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

Function finishRun

packages/opencode/src/effect/runner.ts:70–81  ·  view source on GitHub ↗
(id: number, done: Deferred.Deferred<A, E | Cancelled>, exit: Exit.Exit<A, E>)

Source from the content-addressed store, hash-verified

68 SynchronizedRef.modify(ref, (st) => [st._tag === "Idle" ? idle : Effect.void, st] as const).pipe(Effect.flatten)
69
70 const finishRun = (id: number, done: Deferred.Deferred<A, E | Cancelled>, exit: Exit.Exit<A, E>) =>
71 SynchronizedRef.modify(
72 ref,
73 (st) =>
74 [
75 Effect.gen(function* () {
76 if (st._tag === "Running" && st.run.id === id) yield* idle
77 yield* complete(done, exit)
78 }),
79 st._tag === "Running" && st.run.id === id ? ({ _tag: "Idle" } as const) : st,
80 ] as const,
81 ).pipe(Effect.flatten)
82
83 const startRun = (work: Effect.Effect<A, E>, done: Deferred.Deferred<A, E | Cancelled>) =>
84 Effect.gen(function* () {

Callers 1

startRunFunction · 0.85

Calls 1

completeFunction · 0.70

Tested by

no test coverage detected