MCPcopy Create free account
hub / github.com/anomalyco/opencode / buildLocationServiceMap

Function buildLocationServiceMap

packages/core/src/location-services.ts:84–108  ·  view source on GitHub ↗
(
  replacements: LayerNode.Replacements = [],
)

Source from the content-addressed store, hash-verified

82export type LocationError = LayerNode.Error<typeof locationServices>
83
84export function buildLocationServiceMap(
85 replacements: LayerNode.Replacements = [],
86): Layer.Layer<LocationServiceMap.Service> {
87 return Layer.effect(
88 LocationServiceMap.Service,
89 LayerMap.make(
90 (ref: Location.Ref) => {
91 const allReplacements = replacements.concat([[Location.node, Location.boundNode(ref)]])
92 const location = LayerNode.hoist(locationServices, Node.tags.values.global, allReplacements)
93
94 return LayerNode.compile(location.node).pipe(
95 Layer.fresh,
96 Layer.tap(() =>
97 Effect.logInfo("booting location services", {
98 directory: ref.directory,
99 workspaceID: ref.workspaceID,
100 }),
101 ),
102 Layer.provide(LayerNode.compile(location.hoisted)),
103 )
104 },
105 { idleTimeToLive: "60 minutes" },
106 ),
107 )
108}
109
110// This is temporary for backwards compatibility
111export const locationServiceMapLayer = buildLocationServiceMap()

Callers 3

buildFunction · 0.90
createRoutesFunction · 0.90

Calls 1

makeMethod · 0.45

Tested by

no test coverage detected