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

Function waitForBusy

packages/opencode/test/session/prompt.test.ts:328–337  ·  view source on GitHub ↗
(sessionID: SessionID, duration: Duration.Input = "2 seconds")

Source from the content-addressed store, hash-verified

326// inside Runner.startShell's serialized transition, so cancel can't no-op once
327// we observe it.
328const waitForBusy = (sessionID: SessionID, duration: Duration.Input = "2 seconds") =>
329 pollWithTimeout(
330 Effect.gen(function* () {
331 const status = yield* SessionStatus.Service
332 const s = yield* status.get(sessionID)
333 return s.type === "busy" ? (true as const) : undefined
334 }),
335 `session ${sessionID} never became busy`,
336 duration,
337 )
338
339const hasBash = Effect.sync(() => Bun.which("bash") !== null)
340

Callers 1

prompt.test.tsFile · 0.85

Calls 2

pollWithTimeoutFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected