MCPcopy Create free account
hub / github.com/Qinbf/groundmap / runOneAgentSession

Function runOneAgentSession

tools/debug-console/lib/agent-loop.ts:203–231  ·  view source on GitHub ↗
(
      msgs: ChatMessage[],
    )

Source from the content-addressed store, hash-verified

201 // ──────────────────────────────────────────────
202 if (provider.is_agent) {
203 async function* runOneAgentSession(
204 msgs: ChatMessage[],
205 ): AsyncGenerator<AgentEvent> {
206 for await (const evt of provider.runTurn({
207 model,
208 system,
209 messages: msgs,
210 signal: input.signal,
211 })) {
212 if (evt.kind === "text-delta") {
213 totalAssistantText += evt.text;
214 }
215 if (evt.kind === "tool-call") {
216 callsById.set(evt.id, { name: evt.name, args: evt.args });
217 }
218 yield evt;
219 if (evt.kind === "tool-result") {
220 const triggerCall = callsById.get(evt.id);
221 if (triggerCall) {
222 for await (const synEvt of runAugment(triggerCall, {
223 ok: evt.ok,
224 data: evt.data,
225 })) {
226 yield synEvt;
227 }
228 }
229 }
230 }
231 }
232
233 for await (const evt of runOneAgentSession(messages)) {
234 yield evt;

Callers 1

runAgentFunction · 0.85

Calls 2

runAugmentFunction · 0.85
runTurnMethod · 0.65

Tested by

no test coverage detected