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

Function active

packages/opencode/src/cli/cmd/run/stream.transport.ts:209–227  ·  view source on GitHub ↗
(event: Event, sessionID: string)

Source from the content-addressed store, hash-verified

207}
208
209function active(event: Event, sessionID: string): boolean {
210 if (sid(event) !== sessionID) {
211 return false
212 }
213
214 if (event.type === "message.updated") {
215 return event.properties.info.role === "assistant"
216 }
217
218 if (event.type === "message.part.delta" || event.type === "message.part.updated") {
219 return false
220 }
221
222 if (event.type !== "session.status") {
223 return true
224 }
225
226 return event.properties.status.type !== "idle"
227}
228
229// Races the turn's deferred completion against an abort signal.
230function waitTurn(done: Wait["done"], signal: AbortSignal) {

Callers 1

touchFunction · 0.70

Calls 1

sidFunction · 0.85

Tested by

no test coverage detected