MCPcopy Create free account
hub / github.com/Noumena-Network/code / collectTurnEvents

Function collectTurnEvents

src/QueryEngine.test.ts:11–29  ·  view source on GitHub ↗
(
  stream: AsyncGenerator<QueryEngineReplEvent, TTerminal>,
)

Source from the content-addressed store, hash-verified

9import type { Tools } from './Tool.js'
10
11async function collectTurnEvents<TTerminal>(
12 stream: AsyncGenerator<QueryEngineReplEvent, TTerminal>,
13): Promise<{
14 events: QueryEngineReplEvent[]
15 terminal: TTerminal
16}> {
17 const events: QueryEngineReplEvent[] = []
18
19 while (true) {
20 const next = await stream.next()
21 if (next.done) {
22 return {
23 events,
24 terminal: next.value,
25 }
26 }
27 events.push(next.value)
28 }
29}
30
31describe('QueryEngine prepared turn seams', () => {
32 it('runPreparedTurn forwards the prepared params, events, and terminal value', async () => {

Callers 1

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected