MCPcopy
hub / github.com/codeaashu/claude-code / query

Function query

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

Source from the content-addressed store, hash-verified

217}
218
219export async function* query(
220 params: QueryParams,
221): AsyncGenerator<
222 | StreamEvent
223 | RequestStartEvent
224 | Message
225 | TombstoneMessage
226 | ToolUseSummaryMessage,
227 Terminal
228> {
229 const consumedCommandUuids: string[] = []
230 const terminal = yield* queryLoop(params, consumedCommandUuids)
231 // Only reached if queryLoop returned normally. Skipped on throw (error
232 // propagates through yield*) and on .return() (Return completion closes
233 // both generators). This gives the same asymmetric started-without-completed
234 // signal as print.ts's drainCommandQueue when the turn fails.
235 for (const uuid of consumedCommandUuids) {
236 notifyCommandLifecycle(uuid, 'completed')
237 }
238 return terminal
239}
240
241async function* queryLoop(
242 params: QueryParams,

Callers 1

submitMessageMethod · 0.70

Calls 2

queryLoopFunction · 0.85
notifyCommandLifecycleFunction · 0.85

Tested by

no test coverage detected