refactor(mcp): make analysis states unrepresentable (#468)

* refactor(config): parse capability settings into exact states

* refactor(runtime): encode replay and process outcomes exactly

* refactor: make analysis states unrepresentable

* refactor(mcp): register canonical schemas with SDK

* fix: preserve capability and catalog invariants

* fix(build): remove stale compiled modules

* fix(replay): update real verifier policy dependency

* fix(package): verify the complete MCP catalog

* fix(test): supply complete replay reload policy

* refactor(contracts): centralize output schema lookup

* refactor(mcp): delegate protocol boundaries to SDK

* fix(browser): approve real source capture

* fix(mcp): preserve catalog guidance
This commit is contained in:
morluto
2026-08-10 02:28:11 +08:00
committed by GitHub
parent 6901edc05d
commit b8a9da0c0f
271 changed files with 5970 additions and 5699 deletions
+8 -13
View File
@@ -34,8 +34,7 @@ export class ProviderStartupDeadline {
readonly #externalSignal: AbortSignal | undefined;
readonly #onExternalAbort: () => void;
#timer: NodeJS.Timeout | undefined;
#timedOut = false;
#cancelled = false;
#interruption: "cancelled" | "timeout" | undefined;
constructor(
readonly timeoutMs: number,
@@ -48,13 +47,13 @@ export class ProviderStartupDeadline {
this.#onExternalAbort = () => {
if (this.#controller.signal.aborted) return;
if (Date.now() >= this.#deadlineAt) {
this.#timedOut = true;
this.#interruption = "timeout";
this.#abort(
new DOMException("Provider startup deadline elapsed", "TimeoutError"),
);
return;
}
this.#cancelled = true;
this.#interruption = "cancelled";
this.#abort(signal?.reason);
};
if (signal?.aborted === true) {
@@ -64,7 +63,7 @@ export class ProviderStartupDeadline {
signal?.addEventListener("abort", this.#onExternalAbort, { once: true });
this.#timer = setTimeout(() => {
if (this.#controller.signal.aborted) return;
this.#timedOut = true;
this.#interruption = "timeout";
this.#abort(
new DOMException("Provider startup deadline elapsed", "TimeoutError"),
);
@@ -76,15 +75,11 @@ export class ProviderStartupDeadline {
return this.#controller.signal;
}
/** True only when the external caller signal initiated cancellation. */
get cancelled(): boolean {
return this.#cancelled;
}
/** True when the absolute startup deadline has elapsed. */
get timedOut(): boolean {
/** First control path that interrupted startup, if any. */
get interruption(): "cancelled" | "timeout" | undefined {
return (
this.#timedOut || (!this.#cancelled && Date.now() >= this.#deadlineAt)
this.#interruption ??
(Date.now() >= this.#deadlineAt ? "timeout" : undefined)
);
}