fix(mcp): keep prompt completion within ready provider sessions

Avoid lazy provider startup for document and procedure completion. Propagate MCP cancellation through completers, cancel lookups during session transitions, and share provider result projection with ordinary operations. Cover cold, starting, warm, queued, cancelled, and closed sessions through MCP composition and provider boundaries.
This commit is contained in:
morluto
2026-10-12 16:27:51 +08:00
parent 0d5033ad12
commit 07b36c1489
16 changed files with 740 additions and 57 deletions
@@ -94,6 +94,15 @@ export class CompositeProvider implements AnalysisProvider {
return outcomes.find((outcome) => !outcome.ok) ?? ok(null);
};
return {
executeIfReady: (operation, parameters, options) => {
const provider = this.#providerByOperation.get(operation);
const client =
provider === undefined ? undefined : clients.get(provider);
return (
client?.executeIfReady?.(operation, parameters, options) ??
Promise.resolve(undefined)
);
},
execute: (operation, parameters, options) => {
if (operation === "health")
return Promise.resolve(