location-layer.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { Layer, LayerMap } from "effect"
  2. import { Location } from "./location"
  3. import { Policy } from "./policy"
  4. import { Config } from "./config"
  5. import { PluginV2 } from "./plugin"
  6. import { Catalog } from "./catalog"
  7. import { AgentV2 } from "./agent"
  8. import { PluginBoot } from "./plugin/boot"
  9. import { Project } from "./project"
  10. import { EventV2 } from "./event"
  11. import { Auth } from "./auth"
  12. import { Npm } from "./npm"
  13. import { ModelsDev } from "./models-dev"
  14. import { AppFileSystem } from "./filesystem"
  15. import { Global } from "./global"
  16. export class LocationServiceMap extends LayerMap.Service<LocationServiceMap>()("@opencode/example/LocationServiceMap", {
  17. lookup: (ref: Location.Ref) => {
  18. const location = Location.layer(ref)
  19. return Layer.mergeAll(
  20. location,
  21. Policy.locationLayer,
  22. Config.locationLayer,
  23. PluginV2.locationLayer,
  24. Catalog.locationLayer,
  25. AgentV2.locationLayer,
  26. PluginBoot.locationLayer,
  27. ).pipe(Layer.provideMerge(location), Layer.fresh)
  28. },
  29. idleTimeToLive: "60 minutes",
  30. dependencies: [
  31. Project.defaultLayer,
  32. EventV2.defaultLayer,
  33. Auth.defaultLayer,
  34. Npm.defaultLayer,
  35. ModelsDev.defaultLayer,
  36. AppFileSystem.defaultLayer,
  37. Global.defaultLayer,
  38. ],
  39. }) {}