Files
Jordan Ritter 7633e333c5 feat(core): expose run-completion promise synchronously from runAgent
Split RunHandler.runAgent into a synchronous public wrapper plus a private
_runAgentInner so the inner run promise can be captured BEFORE any await. For
top-level runs (not recursive tool follow-ups), register a normalized
completion promise in a per-agent WeakMap, exposed via runCompletion(agent) and
surfaced on CopilotKitCore as runAgentCompletion(agent).

The promise resolves (never rejects) once the run settles either way, including
a pre-RUN_STARTED rejection. This closes the structural seam in
intelligence-agent.ts, where activeRunCompletionPromise is only assigned AFTER
await onInitialize — too late for a caller to gate on. A synchronous handle lets
the CopilotChat send queue hold a slot until the prior run genuinely finishes.
2026-06-03 12:04:51 -07:00
..
2026-04-10 23:38:59 +00:00
2026-05-30 17:34:06 +00:00