handlers.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { SessionV2 } from "@opencode-ai/core/session"
  2. import { LocationServiceMap } from "@opencode-ai/core/location-layer"
  3. import { PermissionSaved } from "@opencode-ai/core/permission/saved"
  4. import { Layer } from "effect"
  5. import { layer as locationLayer } from "./groups/location"
  6. import { sessionLocationLayer } from "./middleware/session-location"
  7. import { MessageHandler } from "./handlers/message"
  8. import { ModelHandler } from "./handlers/model"
  9. import { ProviderHandler } from "./handlers/provider"
  10. import { SessionHandler } from "./handlers/session"
  11. import { PermissionHandler } from "./handlers/permission"
  12. import { FileSystemHandler } from "./handlers/fs"
  13. import { CommandHandler } from "./handlers/command"
  14. import { SkillHandler } from "./handlers/skill"
  15. import { EventHandler } from "./handlers/event"
  16. import { AgentHandler } from "./handlers/agent"
  17. import { HealthHandler } from "./handlers/health"
  18. import { QuestionHandler } from "./handlers/question"
  19. import { ReferenceHandler } from "./handlers/reference"
  20. import * as SessionExecutionLocal from "@opencode-ai/core/session/execution/local"
  21. import { LocationHandler } from "./handlers/location"
  22. import { IntegrationHandler } from "./handlers/integration"
  23. import { CredentialHandler } from "./handlers/credential"
  24. import { Credential } from "@opencode-ai/core/credential"
  25. import { ProjectCopyHandler } from "./handlers/project-copy"
  26. export const handlers = Layer.mergeAll(
  27. HealthHandler,
  28. LocationHandler,
  29. AgentHandler,
  30. SessionHandler,
  31. MessageHandler,
  32. ModelHandler,
  33. ProviderHandler,
  34. IntegrationHandler,
  35. CredentialHandler,
  36. PermissionHandler,
  37. FileSystemHandler,
  38. CommandHandler,
  39. SkillHandler,
  40. EventHandler,
  41. QuestionHandler,
  42. ReferenceHandler,
  43. ProjectCopyHandler,
  44. ).pipe(
  45. Layer.provide(sessionLocationLayer),
  46. Layer.provide(locationLayer),
  47. Layer.provide(SessionV2.defaultLayer),
  48. Layer.provide(SessionExecutionLocal.defaultLayer),
  49. Layer.provide(PermissionSaved.defaultLayer),
  50. Layer.provide(LocationServiceMap.layer),
  51. Layer.provide(Credential.defaultLayer),
  52. )