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

Function query

src/query.ts:270–290  ·  view source on GitHub ↗
(
  params: QueryParams,
)

Source from the content-addressed store, hash-verified

268}
269
270export async function* query(
271 params: QueryParams,
272): AsyncGenerator<
273 | StreamEvent
274 | RequestStartEvent
275 | Message
276 | TombstoneMessage
277 | ToolUseSummaryMessage,
278 Terminal
279> {
280 const consumedCommandUuids: string[] = []
281 const terminal = yield* queryLoop(params, consumedCommandUuids)
282 // Only reached if queryLoop returned normally. Skipped on throw (error
283 // propagates through yield*) and on .return() (Return completion closes
284 // both generators). This gives the same asymmetric started-without-completed
285 // signal as print.ts's drainCommandQueue when the turn fails.
286 for (const uuid of consumedCommandUuids) {
287 notifyCommandLifecycle(uuid, 'completed')
288 }
289 return terminal
290}
291
292async function* queryLoop(
293 params: QueryParams,

Callers 2

query.test.tsFile · 0.70
submitMessageMethod · 0.70

Calls 2

queryLoopFunction · 0.85
notifyCommandLifecycleFunction · 0.85

Tested by

no test coverage detected