MCPcopy
hub / github.com/anomalyco/opencode / isolatedRun

Function isolatedRun

packages/opencode/test/lib/effect.ts:38–47  ·  view source on GitHub ↗
(value, layer)

Source from the content-addressed store, hash-verified

36type Runner = <A, E, R, E2>(value: Body<A, E, R | Scope.Scope>, layer: Layer.Layer<R, E2>) => Promise<A>
37
38const isolatedRun: Runner = (value, layer) =>
39 Effect.gen(function* () {
40 const exit = yield* body(value).pipe(Effect.scoped, Effect.provide(layer), Effect.exit)
41 if (Exit.isFailure(exit)) {
42 for (const err of Cause.prettyErrors(exit.cause)) {
43 yield* Effect.logError(err)
44 }
45 }
46 return yield* exit
47 }).pipe(Effect.runPromise)
48
49// Builds the test layer through the shared process-wide memoMap so cached
50// services (Bus, Session, …) match Server.Default's instances. Use for tests

Callers

nothing calls this directly

Calls 1

bodyFunction · 0.70

Tested by

no test coverage detected