MCPcopy Index your code
hub / github.com/anomalyco/opencode / attachWith

Function attachWith

packages/opencode/src/effect/run-service.ts:14–22  ·  view source on GitHub ↗
(effect: Effect.Effect<A, E, R>, refs: Refs)

Source from the content-addressed store, hash-verified

12}
13
14export function attachWith<A, E, R>(effect: Effect.Effect<A, E, R>, refs: Refs): Effect.Effect<A, E, R> {
15 if (!refs.instance && !refs.workspace) return effect
16 if (!refs.instance) return effect.pipe(Effect.provideService(WorkspaceRef, refs.workspace))
17 if (!refs.workspace) return effect.pipe(Effect.provideService(InstanceRef, refs.instance))
18 return effect.pipe(
19 Effect.provideService(InstanceRef, refs.instance),
20 Effect.provideService(WorkspaceRef, refs.workspace),
21 )
22}
23
24export function attach<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> {
25 const workspace = WorkspaceContext.workspaceID

Callers 3

bindFunction · 0.90
wrapFunction · 0.90
attachFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected