mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
32551f2bdb
Replace the brittle `"activeRunCompletionPromise" in agent` probe + double `as unknown as` casts in CopilotChat with a typed `RunCompletionAware` contract plus an `isRunCompletionAware` type guard, both exported from core. IntelligenceAgent now declares the property and implements the interface, so the in-flight-run await is reachable without a cast and non-Intelligence agents still degrade safely. Cast sites in the attachments/e2e tests and the MockStepwiseAgent helper are updated to the typed accessor. Factor the await-then-send logic into a shared `waitForActiveRunToSettle` helper and call it from BOTH onSubmitInput and handleSelectSuggestion. This closes the suggestion-path in-flight gap: selecting a suggestion mid-run no longer pre-empts/aborts the active run (e.g. an interrupt RESUME) — the same regression PR #5195 fixed for the typed-Enter path. Adds a red-green regression test that parks the suggestion send on the in-flight promise.