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

Function start

packages/core/src/session/run-coordinator.ts:37–49  ·  view source on GitHub ↗
(key: Key, entry: Entry<E>, force: boolean, successor = false)

Source from the content-addressed store, hash-verified

35 })
36
37 const start = (key: Key, entry: Entry<E>, force: boolean, successor = false) => {
38 const ready = Deferred.makeUnsafe<void>()
39 const owner = fork(
40 (successor ? Effect.yieldNow : Deferred.await(ready)).pipe(
41 Effect.andThen(Effect.suspend(() => options.drain(key, force))),
42 Effect.onExit((exit) => Effect.sync(() => settle(key, entry, exit))),
43 Effect.exit,
44 Effect.asVoid,
45 ),
46 )
47 entry.owner = owner
48 if (!successor) Deferred.doneUnsafe(ready, Effect.void)
49 }
50
51 const settle = (key: Key, entry: Entry<E>, exit: Exit.Exit<void, E>) => {
52 if (Exit.isSuccess(exit) && !entry.stopping && entry.pendingWake) {

Callers 3

settleFunction · 0.70
runFunction · 0.70
wakeFunction · 0.70

Calls 3

forkFunction · 0.85
syncMethod · 0.80
settleFunction · 0.70

Tested by

no test coverage detected