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

Function attach

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

Source from the content-addressed store, hash-verified

22}
23
24export function attach<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> {
25 const workspace = WorkspaceContext.workspaceID
26 const fiber = Fiber.getCurrent()
27 return attachWith(effect, {
28 instance: fiber ? Context.getReferenceUnsafe(fiber.context, InstanceRef) : undefined,
29 workspace: workspace ?? (fiber ? Context.getReferenceUnsafe(fiber.context, WorkspaceRef) : undefined),
30 })
31}
32
33export function makeRuntime<I, S, E>(service: Context.Service<I, S>, layer: Layer.Layer<I, E>) {
34 let rt: ManagedRuntime.ManagedRuntime<I, E> | undefined

Callers 3

wrapFunction · 0.90
makeRuntimeFunction · 0.70

Calls 1

attachWithFunction · 0.85

Tested by

no test coverage detected