@sentropic/h2a 0.97.3 → 0.97.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/dist/cli-command-map.d.ts.map +1 -1
- package/dist/cli-command-map.js +1 -0
- package/dist/cli-command-map.js.map +1 -1
- package/dist/cli.d.ts +13 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +129 -53
- package/dist/cli.js.map +1 -1
- package/dist/hosts/muse.d.ts +14 -0
- package/dist/hosts/muse.d.ts.map +1 -0
- package/dist/hosts/muse.js +39 -0
- package/dist/hosts/muse.js.map +1 -0
- package/dist/hosts/plugin.d.ts +3 -3
- package/dist/hosts/plugin.d.ts.map +1 -1
- package/dist/hosts/plugin.js +9 -2
- package/dist/hosts/plugin.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +1 -0
- package/dist/mcp.js.map +1 -1
- package/dist/runtime/identity/bindings.d.ts +33 -0
- package/dist/runtime/identity/bindings.d.ts.map +1 -1
- package/dist/runtime/identity/bindings.js +49 -1
- package/dist/runtime/identity/bindings.js.map +1 -1
- package/dist/runtime/identity/index.d.ts +4 -4
- package/dist/runtime/identity/index.d.ts.map +1 -1
- package/dist/runtime/identity/index.js +2 -2
- package/dist/runtime/identity/index.js.map +1 -1
- package/dist/runtime/identity/live.d.ts +63 -0
- package/dist/runtime/identity/live.d.ts.map +1 -1
- package/dist/runtime/identity/live.js +339 -64
- package/dist/runtime/identity/live.js.map +1 -1
- package/dist/runtime/identity/worker.d.ts +19 -0
- package/dist/runtime/identity/worker.d.ts.map +1 -0
- package/dist/runtime/identity/worker.js +189 -0
- package/dist/runtime/identity/worker.js.map +1 -0
- package/dist/runtime/local-files/locks.d.ts +14 -0
- package/dist/runtime/local-files/locks.d.ts.map +1 -1
- package/dist/runtime/local-files/locks.js +13 -0
- package/dist/runtime/local-files/locks.js.map +1 -1
- package/dist/runtime/local-files/store.d.ts +21 -0
- package/dist/runtime/local-files/store.d.ts.map +1 -1
- package/dist/runtime/local-files/store.js +37 -6
- package/dist/runtime/local-files/store.js.map +1 -1
- package/dist/runtime/loop/index.d.ts +1 -1
- package/dist/runtime/loop/index.d.ts.map +1 -1
- package/dist/runtime/loop/index.js.map +1 -1
- package/dist/runtime/mcp/agent-launch.d.ts +1 -1
- package/dist/runtime/mcp/agent-launch.d.ts.map +1 -1
- package/dist/runtime/mcp/agent-launch.js +8 -5
- package/dist/runtime/mcp/agent-launch.js.map +1 -1
- package/dist/runtime/mcp/handlers.js +1 -1
- package/dist/runtime/mcp/handlers.js.map +1 -1
- package/dist/runtime/mcp/identity-state.d.ts +131 -0
- package/dist/runtime/mcp/identity-state.d.ts.map +1 -0
- package/dist/runtime/mcp/identity-state.js +288 -0
- package/dist/runtime/mcp/identity-state.js.map +1 -0
- package/dist/runtime/mcp/index.d.ts +1 -0
- package/dist/runtime/mcp/index.d.ts.map +1 -1
- package/dist/runtime/mcp/index.js +1 -0
- package/dist/runtime/mcp/index.js.map +1 -1
- package/dist/runtime/mcp/server.d.ts +23 -0
- package/dist/runtime/mcp/server.d.ts.map +1 -1
- package/dist/runtime/mcp/server.js +105 -2
- package/dist/runtime/mcp/server.js.map +1 -1
- package/dist/runtime/mcp/sessions.d.ts +12 -2
- package/dist/runtime/mcp/sessions.d.ts.map +1 -1
- package/dist/runtime/mcp/sessions.js +15 -3
- package/dist/runtime/mcp/sessions.js.map +1 -1
- package/dist/runtime/mcp/stdio.d.ts +21 -0
- package/dist/runtime/mcp/stdio.d.ts.map +1 -1
- package/dist/runtime/mcp/stdio.js +203 -84
- package/dist/runtime/mcp/stdio.js.map +1 -1
- package/dist/runtime/mcp/tools.d.ts.map +1 -1
- package/dist/runtime/mcp/tools.js +22 -6
- package/dist/runtime/mcp/tools.js.map +1 -1
- package/dist/runtime/mcp-http/readonly-allowlist.d.ts.map +1 -1
- package/dist/runtime/mcp-http/readonly-allowlist.js +3 -0
- package/dist/runtime/mcp-http/readonly-allowlist.js.map +1 -1
- package/dist/runtime/version/agent-version.d.ts.map +1 -1
- package/dist/runtime/version/agent-version.js +2 -1
- package/dist/runtime/version/agent-version.js.map +1 -1
- package/package.json +3 -3
- package/skills/h2a/SKILL.md +2 -2
- package/skills/h2a-run/SKILL.md +5 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L2 — identity-independent MCP connection + asynchronous identity readiness.
|
|
3
|
+
*
|
|
4
|
+
* The MCP transport (initialize / tools/list) must answer IMMEDIATELY, without
|
|
5
|
+
* waiting on the shared-identity critical section (the keypair read, the
|
|
6
|
+
* registry parse, and above all the identity/registry lock wait). Those run in a
|
|
7
|
+
* dedicated, non-detached CHILD process (`../identity/worker.js`) so they never
|
|
8
|
+
* block the parent's event loop — a `Promise`/`setImmediate` around the sync
|
|
9
|
+
* lock in the PARENT would not help, because the lock wait (and the ~17 MB
|
|
10
|
+
* registry parse) are synchronous and would still stall `initialize`.
|
|
11
|
+
*
|
|
12
|
+
* This module owns the readiness STATE MACHINE and the single 20 s deadline
|
|
13
|
+
* measured from entering `identity_pending`. Activation (opening the real
|
|
14
|
+
* presence session, reading the private key, publishing the correlated readiness
|
|
15
|
+
* ACK, arming the live signer) is delegated to the caller through `activate`,
|
|
16
|
+
* because that side lives with the SessionRegistry in the stdio transport. The
|
|
17
|
+
* controller only transitions to `identity_ready` once activation reports
|
|
18
|
+
* success — never on the child's raw result, never with a provisional key, never
|
|
19
|
+
* with an early availability ACK.
|
|
20
|
+
*/
|
|
21
|
+
import type { H2ASendSigner } from "../send.js";
|
|
22
|
+
/** The single identity deadline (ms), measured from entering identity_pending. */
|
|
23
|
+
export declare const MCP_IDENTITY_TIMEOUT_MS = 20000;
|
|
24
|
+
export type IdentityFailureCode = "identity_timeout" | "storage_readonly" | "storage_permission_denied" | "identity_worker_failed" | "identity_proof_failed" | "identity_storage_failed" | "session_open_failed" | "readiness_ack_failed";
|
|
25
|
+
export type McpIdentityStatus = {
|
|
26
|
+
state: "identity_disabled";
|
|
27
|
+
} | {
|
|
28
|
+
state: "identity_pending";
|
|
29
|
+
attemptId: string;
|
|
30
|
+
elapsedMs: number;
|
|
31
|
+
timeoutMs: 20000;
|
|
32
|
+
} | {
|
|
33
|
+
state: "identity_ready";
|
|
34
|
+
attemptId: string;
|
|
35
|
+
instance: string;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
signingAvailable: boolean;
|
|
38
|
+
} | {
|
|
39
|
+
state: "identity_failed";
|
|
40
|
+
attemptId: string;
|
|
41
|
+
cause: IdentityFailureCode;
|
|
42
|
+
message: string;
|
|
43
|
+
retryable: false;
|
|
44
|
+
elapsedMs: number;
|
|
45
|
+
};
|
|
46
|
+
export interface McpIdentityController {
|
|
47
|
+
status(): McpIdentityStatus;
|
|
48
|
+
start(): void;
|
|
49
|
+
cancel(reason: "transport_closed" | "signal"): void;
|
|
50
|
+
signer(): H2ASendSigner | undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The identity attributes the worker resolves and hands back over IPC. It
|
|
54
|
+
* carries NO private key material — only paths, which the parent re-validates
|
|
55
|
+
* against `identityKeyPaths(root, instance)` before reading.
|
|
56
|
+
*/
|
|
57
|
+
export interface ResolvedIdentityMessage {
|
|
58
|
+
readonly instance: string;
|
|
59
|
+
readonly host: string;
|
|
60
|
+
readonly workspace?: unknown;
|
|
61
|
+
readonly name?: string;
|
|
62
|
+
readonly action: "override" | "reclaim" | "mint";
|
|
63
|
+
readonly providerSessionId?: string;
|
|
64
|
+
readonly providerSessionSource?: string;
|
|
65
|
+
readonly privateKeyPath: string;
|
|
66
|
+
readonly publicKeyPath: string;
|
|
67
|
+
readonly migrationNotice?: string;
|
|
68
|
+
readonly legacyInstance?: string;
|
|
69
|
+
readonly delegationEligible?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** The deferred identity request the CLI hands to the transport (no lock work). */
|
|
72
|
+
export interface McpIdentityRequest {
|
|
73
|
+
readonly root: string;
|
|
74
|
+
readonly host: string;
|
|
75
|
+
readonly cwd: string;
|
|
76
|
+
readonly explicitInstance?: string;
|
|
77
|
+
readonly name?: string;
|
|
78
|
+
readonly scopes?: readonly string[];
|
|
79
|
+
readonly declaredCapabilities?: readonly string[];
|
|
80
|
+
/** Provider env captured from the launching session (never re-derived in child). */
|
|
81
|
+
readonly providerEnv?: Readonly<Record<string, string>>;
|
|
82
|
+
}
|
|
83
|
+
/** Result of a caller-supplied activation attempt (session + ACK + signer). */
|
|
84
|
+
export type ActivationResult = {
|
|
85
|
+
ok: true;
|
|
86
|
+
sessionId: string;
|
|
87
|
+
signer?: H2ASendSigner;
|
|
88
|
+
} | {
|
|
89
|
+
ok: false;
|
|
90
|
+
cause: IdentityFailureCode;
|
|
91
|
+
message: string;
|
|
92
|
+
};
|
|
93
|
+
export interface CreateIdentityControllerOptions {
|
|
94
|
+
readonly request: McpIdentityRequest;
|
|
95
|
+
/**
|
|
96
|
+
* Perform the real activation once the worker resolved a valid identity and
|
|
97
|
+
* the deadline still holds: open the presence session, read the private key,
|
|
98
|
+
* publish the correlated readiness ACK, build the live signer. Returning
|
|
99
|
+
* `{ok:false}` fails the identity terminally (no partial availability).
|
|
100
|
+
*/
|
|
101
|
+
readonly activate: (identity: ResolvedIdentityMessage) => ActivationResult;
|
|
102
|
+
/** Diagnostic sink (stderr). Never protocol traffic. */
|
|
103
|
+
readonly log?: (line: string) => void;
|
|
104
|
+
/** Test seam: fork a worker child. Production uses the real fork below. */
|
|
105
|
+
readonly spawnWorker?: (request: McpIdentityRequest, budgetMs: number) => IdentityWorkerHandle;
|
|
106
|
+
/** Test seam: monotonic clock in ns. Defaults to process.hrtime.bigint. */
|
|
107
|
+
readonly nowNs?: () => bigint;
|
|
108
|
+
/** Test seam: deadline in ms. Defaults to MCP_IDENTITY_TIMEOUT_MS. */
|
|
109
|
+
readonly timeoutMs?: number;
|
|
110
|
+
}
|
|
111
|
+
/** Minimal handle over the identity worker child (real fork or test double). */
|
|
112
|
+
export interface IdentityWorkerHandle {
|
|
113
|
+
onResolved(cb: (identity: ResolvedIdentityMessage) => void): void;
|
|
114
|
+
onError(cb: (cause: IdentityFailureCode, message: string) => void): void;
|
|
115
|
+
/** Fires when the child exits WITHOUT having produced a result. */
|
|
116
|
+
onExitWithoutResult(cb: () => void): void;
|
|
117
|
+
cancel(reason: string): void;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Real worker fork. Non-detached, argv-only, stdout IGNORED (it must never write
|
|
121
|
+
* protocol traffic), stderr piped for diagnostics, IPC typed. cwd/provider env
|
|
122
|
+
* are captured explicitly so the child does not inherit an artificial
|
|
123
|
+
* conversation. No shell, and NO PEM ever crosses IPC.
|
|
124
|
+
*/
|
|
125
|
+
export declare function forkIdentityWorker(request: McpIdentityRequest, budgetMs: number, log?: (line: string) => void): IdentityWorkerHandle;
|
|
126
|
+
/**
|
|
127
|
+
* Build the identity controller for one MCP attachment. It starts inert and
|
|
128
|
+
* transitions `identity_pending → identity_ready | identity_failed` exactly once.
|
|
129
|
+
*/
|
|
130
|
+
export declare function createIdentityController(options: CreateIdentityControllerOptions): McpIdentityController;
|
|
131
|
+
//# sourceMappingURL=identity-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-state.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp/identity-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAC3B,kBAAkB,GAClB,kBAAkB,GAClB,2BAA2B,GAC3B,wB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D,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,KAAK,oBAAoB,CAAC;IAC/F,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE,uBAAuB,KAAK,IAAI,GAAG,IAAI,CAAC;IAClE,OAAO,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IACzE,mEAAmE;IACnE,mBAAmB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAOD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC3B,oBAAoB,CAiGtB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,+BAA+B,GACvC,qBAAqB,CAyJvB"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L2 — identity-independent MCP connection + asynchronous identity readiness.
|
|
3
|
+
*
|
|
4
|
+
* The MCP transport (initialize / tools/list) must answer IMMEDIATELY, without
|
|
5
|
+
* waiting on the shared-identity critical section (the keypair read, the
|
|
6
|
+
* registry parse, and above all the identity/registry lock wait). Those run in a
|
|
7
|
+
* dedicated, non-detached CHILD process (`../identity/worker.js`) so they never
|
|
8
|
+
* block the parent's event loop — a `Promise`/`setImmediate` around the sync
|
|
9
|
+
* lock in the PARENT would not help, because the lock wait (and the ~17 MB
|
|
10
|
+
* registry parse) are synchronous and would still stall `initialize`.
|
|
11
|
+
*
|
|
12
|
+
* This module owns the readiness STATE MACHINE and the single 20 s deadline
|
|
13
|
+
* measured from entering `identity_pending`. Activation (opening the real
|
|
14
|
+
* presence session, reading the private key, publishing the correlated readiness
|
|
15
|
+
* ACK, arming the live signer) is delegated to the caller through `activate`,
|
|
16
|
+
* because that side lives with the SessionRegistry in the stdio transport. The
|
|
17
|
+
* controller only transitions to `identity_ready` once activation reports
|
|
18
|
+
* success — never on the child's raw result, never with a provisional key, never
|
|
19
|
+
* with an early availability ACK.
|
|
20
|
+
*/
|
|
21
|
+
import { fork } from "node:child_process";
|
|
22
|
+
import { identityKeyPaths } from "../identity/live.js";
|
|
23
|
+
import { getActiveMcpTrace } from "./phase-trace.js";
|
|
24
|
+
/** The single identity deadline (ms), measured from entering identity_pending. */
|
|
25
|
+
export const MCP_IDENTITY_TIMEOUT_MS = 20_000;
|
|
26
|
+
function randomAttemptId() {
|
|
27
|
+
// A short, non-secret correlation id for the attempt (never a nonce/key).
|
|
28
|
+
return `att:${Math.random().toString(16).slice(2, 10)}${Date.now().toString(16)}`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Real worker fork. Non-detached, argv-only, stdout IGNORED (it must never write
|
|
32
|
+
* protocol traffic), stderr piped for diagnostics, IPC typed. cwd/provider env
|
|
33
|
+
* are captured explicitly so the child does not inherit an artificial
|
|
34
|
+
* conversation. No shell, and NO PEM ever crosses IPC.
|
|
35
|
+
*/
|
|
36
|
+
export function forkIdentityWorker(request, budgetMs, log) {
|
|
37
|
+
const capturedEnv = { ...process.env, ...(request.providerEnv ?? {}) };
|
|
38
|
+
let child;
|
|
39
|
+
let resolvedCb;
|
|
40
|
+
let errorCb;
|
|
41
|
+
let exitCb;
|
|
42
|
+
let sawResult = false;
|
|
43
|
+
let started = false;
|
|
44
|
+
const ensureStarted = () => {
|
|
45
|
+
if (started)
|
|
46
|
+
return;
|
|
47
|
+
started = true;
|
|
48
|
+
try {
|
|
49
|
+
child = fork(new URL("../identity/worker.js", import.meta.url), [], {
|
|
50
|
+
cwd: request.cwd,
|
|
51
|
+
env: capturedEnv,
|
|
52
|
+
stdio: ["ignore", "ignore", "pipe", "ipc"]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
queueMicrotask(() => errorCb?.("identity_worker_failed", err instanceof Error ? err.message : String(err)));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// Forward the worker's stderr LINE BY LINE so a `h2a.mcp.phase …` trace span
|
|
60
|
+
// (L0, role=identity-child) is never split across a chunk boundary when it is
|
|
61
|
+
// re-emitted on the parent's stderr. Diagnostics flow through unchanged.
|
|
62
|
+
let stderrBuf = "";
|
|
63
|
+
child.stderr?.on("data", (chunk) => {
|
|
64
|
+
stderrBuf += String(chunk);
|
|
65
|
+
let nl;
|
|
66
|
+
while ((nl = stderrBuf.indexOf("\n")) !== -1) {
|
|
67
|
+
const line = stderrBuf.slice(0, nl);
|
|
68
|
+
stderrBuf = stderrBuf.slice(nl + 1);
|
|
69
|
+
if (line.length > 0)
|
|
70
|
+
log?.(`identity-worker: ${line}`);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
child.stderr?.on("end", () => {
|
|
74
|
+
if (stderrBuf.trimEnd().length > 0)
|
|
75
|
+
log?.(`identity-worker: ${stderrBuf.trimEnd()}`);
|
|
76
|
+
stderrBuf = "";
|
|
77
|
+
});
|
|
78
|
+
child.on("message", (msg) => {
|
|
79
|
+
const m = msg;
|
|
80
|
+
if (!m || typeof m !== "object")
|
|
81
|
+
return;
|
|
82
|
+
if (m.kind === "identity_resolved") {
|
|
83
|
+
sawResult = true;
|
|
84
|
+
resolvedCb?.(m.identity);
|
|
85
|
+
}
|
|
86
|
+
else if (m.kind === "identity_error") {
|
|
87
|
+
sawResult = true;
|
|
88
|
+
const e = m;
|
|
89
|
+
errorCb?.(e.cause ?? "identity_worker_failed", e.message ?? "identity worker error");
|
|
90
|
+
}
|
|
91
|
+
// A `cancel_ack` needs no parent action beyond letting the child exit.
|
|
92
|
+
});
|
|
93
|
+
child.on("error", (err) => {
|
|
94
|
+
if (sawResult)
|
|
95
|
+
return;
|
|
96
|
+
errorCb?.("identity_worker_failed", err instanceof Error ? err.message : String(err));
|
|
97
|
+
});
|
|
98
|
+
child.on("exit", () => {
|
|
99
|
+
if (!sawResult)
|
|
100
|
+
exitCb?.();
|
|
101
|
+
});
|
|
102
|
+
try {
|
|
103
|
+
// Correlate the worker's L0 spans to THIS attempt's trace (same attemptId,
|
|
104
|
+
// role=identity-child) so the relocated identity/lock/registry spans stay
|
|
105
|
+
// joinable with the parent's server-role boot spans.
|
|
106
|
+
const traceAttemptId = getActiveMcpTrace()?.attemptId;
|
|
107
|
+
child.send({
|
|
108
|
+
kind: "resolve_identity",
|
|
109
|
+
v: 1,
|
|
110
|
+
request,
|
|
111
|
+
budgetMs,
|
|
112
|
+
...(traceAttemptId !== undefined ? { traceAttemptId } : {})
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
errorCb?.("identity_worker_failed", err instanceof Error ? err.message : String(err));
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
onResolved(cb) {
|
|
121
|
+
resolvedCb = cb;
|
|
122
|
+
ensureStarted();
|
|
123
|
+
},
|
|
124
|
+
onError(cb) {
|
|
125
|
+
errorCb = cb;
|
|
126
|
+
},
|
|
127
|
+
onExitWithoutResult(cb) {
|
|
128
|
+
exitCb = cb;
|
|
129
|
+
},
|
|
130
|
+
cancel(reason) {
|
|
131
|
+
try {
|
|
132
|
+
child?.send({ kind: "cancel", reason });
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
/* channel already gone; the child's own finally releases its lock */
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Build the identity controller for one MCP attachment. It starts inert and
|
|
142
|
+
* transitions `identity_pending → identity_ready | identity_failed` exactly once.
|
|
143
|
+
*/
|
|
144
|
+
export function createIdentityController(options) {
|
|
145
|
+
const timeoutMs = options.timeoutMs ?? MCP_IDENTITY_TIMEOUT_MS;
|
|
146
|
+
const nowNs = options.nowNs ?? process.hrtime.bigint;
|
|
147
|
+
const spawnWorker = options.spawnWorker ??
|
|
148
|
+
((req, budget) => forkIdentityWorker(req, budget, options.log));
|
|
149
|
+
let state = { state: "identity_disabled" };
|
|
150
|
+
let attemptId = "";
|
|
151
|
+
let startedNs = 0n;
|
|
152
|
+
let deadlineTimer;
|
|
153
|
+
let worker;
|
|
154
|
+
let liveSigner;
|
|
155
|
+
let terminal = false;
|
|
156
|
+
let cancelled = false;
|
|
157
|
+
const elapsedMs = () => Number((nowNs() - startedNs) / 1000000n);
|
|
158
|
+
const clearTimer = () => {
|
|
159
|
+
if (deadlineTimer) {
|
|
160
|
+
clearTimeout(deadlineTimer);
|
|
161
|
+
deadlineTimer = undefined;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const fail = (cause, message) => {
|
|
165
|
+
if (terminal)
|
|
166
|
+
return;
|
|
167
|
+
terminal = true;
|
|
168
|
+
clearTimer();
|
|
169
|
+
state = {
|
|
170
|
+
state: "identity_failed",
|
|
171
|
+
attemptId,
|
|
172
|
+
cause,
|
|
173
|
+
message,
|
|
174
|
+
retryable: false,
|
|
175
|
+
elapsedMs: elapsedMs()
|
|
176
|
+
};
|
|
177
|
+
liveSigner = undefined;
|
|
178
|
+
// L0 trace reuse: the identity lifecycle on the PARENT (the deep provider /
|
|
179
|
+
// registry / lock spans now run in the child, off this event loop).
|
|
180
|
+
getActiveMcpTrace()?.phase("identity_failed", { code: cause });
|
|
181
|
+
options.log?.(`identity failed (${cause}): ${message}`);
|
|
182
|
+
try {
|
|
183
|
+
worker?.cancel("failed");
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
/* best effort */
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const onResolved = (identity) => {
|
|
190
|
+
if (terminal || cancelled)
|
|
191
|
+
return;
|
|
192
|
+
// Deadline re-check at the activation boundary: a late worker result never
|
|
193
|
+
// reactivates the connection.
|
|
194
|
+
if (elapsedMs() >= timeoutMs) {
|
|
195
|
+
fail("identity_timeout", `identity did not become ready within ${timeoutMs}ms`);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
// Validate the returned key paths against the canonical layout for this
|
|
199
|
+
// instance — NEVER read an arbitrary path the child claimed. An explicit
|
|
200
|
+
// `--instance` override resolves with NO key paths (presence-only, no
|
|
201
|
+
// signer); that is allowed and only skips this check.
|
|
202
|
+
if (identity.privateKeyPath) {
|
|
203
|
+
const expected = identityKeyPaths(options.request.root, identity.instance);
|
|
204
|
+
if (identity.privateKeyPath !== expected.privateKeyPath ||
|
|
205
|
+
identity.publicKeyPath !== expected.publicKeyPath) {
|
|
206
|
+
fail("identity_proof_failed", "resolved identity key paths do not match the canonical layout");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
let result;
|
|
211
|
+
try {
|
|
212
|
+
result = options.activate(identity);
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
fail("session_open_failed", err instanceof Error ? err.message : String(err));
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (!result.ok) {
|
|
219
|
+
fail(result.cause, result.message);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
// F1: a FULLY-SUCCESSFUL activation is terminal-ready. We do NOT re-check the
|
|
223
|
+
// deadline here: activation already opened the presence session, armed the
|
|
224
|
+
// signer/wake and published the correlated readiness ACK — failing now would
|
|
225
|
+
// leave a live ACK + presence + wake behind a `failed` state (a wedged
|
|
226
|
+
// connection). The deadline is enforced BEFORE activation (above) and by the
|
|
227
|
+
// parent timer; if activation itself fails, `activate` rolls its own partial
|
|
228
|
+
// work back before returning `{ok:false}`.
|
|
229
|
+
terminal = true;
|
|
230
|
+
clearTimer();
|
|
231
|
+
liveSigner = result.signer;
|
|
232
|
+
state = {
|
|
233
|
+
state: "identity_ready",
|
|
234
|
+
attemptId,
|
|
235
|
+
instance: identity.instance,
|
|
236
|
+
sessionId: result.sessionId,
|
|
237
|
+
signingAvailable: liveSigner !== undefined
|
|
238
|
+
};
|
|
239
|
+
getActiveMcpTrace()?.phase("identity_ready", {
|
|
240
|
+
code: liveSigner ? "signing" : "presence_only"
|
|
241
|
+
});
|
|
242
|
+
options.log?.(`identity ready: ${identity.instance} (signing ${liveSigner ? "available" : "unavailable"})`);
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
status() {
|
|
246
|
+
if (state.state === "identity_pending") {
|
|
247
|
+
return { state: "identity_pending", attemptId, elapsedMs: elapsedMs(), timeoutMs: 20000 };
|
|
248
|
+
}
|
|
249
|
+
return state;
|
|
250
|
+
},
|
|
251
|
+
start() {
|
|
252
|
+
if (state.state !== "identity_disabled")
|
|
253
|
+
return;
|
|
254
|
+
attemptId = randomAttemptId();
|
|
255
|
+
startedNs = nowNs();
|
|
256
|
+
state = { state: "identity_pending", attemptId, elapsedMs: 0, timeoutMs: 20000 };
|
|
257
|
+
// L0 trace reuse: mark that identity entered the async pending window on the
|
|
258
|
+
// parent (initialize/tools-list are already answerable — identity is NOT on
|
|
259
|
+
// the boot critical path anymore, which is the #249 fix).
|
|
260
|
+
getActiveMcpTrace()?.phase("identity_pending");
|
|
261
|
+
deadlineTimer = setTimeout(() => {
|
|
262
|
+
fail("identity_timeout", `identity did not become ready within ${timeoutMs}ms`);
|
|
263
|
+
}, timeoutMs);
|
|
264
|
+
deadlineTimer.unref?.();
|
|
265
|
+
worker = spawnWorker(options.request, timeoutMs);
|
|
266
|
+
worker.onError((cause, message) => fail(cause, message));
|
|
267
|
+
worker.onExitWithoutResult(() => fail("identity_worker_failed", "identity worker exited without a result"));
|
|
268
|
+
worker.onResolved(onResolved);
|
|
269
|
+
},
|
|
270
|
+
cancel(reason) {
|
|
271
|
+
cancelled = true;
|
|
272
|
+
clearTimer();
|
|
273
|
+
try {
|
|
274
|
+
worker?.cancel(reason);
|
|
275
|
+
}
|
|
276
|
+
catch {
|
|
277
|
+
/* best effort */
|
|
278
|
+
}
|
|
279
|
+
// Transport is gone: no activation may follow. Keep the last observable
|
|
280
|
+
// state for any in-flight status read, but disarm the signer.
|
|
281
|
+
liveSigner = undefined;
|
|
282
|
+
},
|
|
283
|
+
signer() {
|
|
284
|
+
return liveSigner;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=identity-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-state.js","sourceRoot":"","sources":["../../../src/runtime/mcp/identity-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,IAAI,EAAqB,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,kFAAkF;AAClF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAwG9C,SAAS,eAAe;IACtB,0EAA0E;IAC1E,OAAO,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AACpF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA2B,EAC3B,QAAgB,EAChB,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,wEAAwE;YACxE,8DAA8D;YAC9D,UAAU,GAAG,SAAS,CAAC;QACzB,CAAC;QACD,MAAM;YACJ,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -6,4 +6,5 @@ export { buildH2aRunInvocation, executeH2aRun, executeH2aRunWithSpawn, handleH2a
|
|
|
6
6
|
export { SessionRegistry, type OpenSessionRequest, type SessionRegistryOptions } from "./sessions.js";
|
|
7
7
|
export { NotificationDispatcher, type McpPushNotification, type NotificationSink } from "./notifications.js";
|
|
8
8
|
export { createMcpTrace, getActiveMcpTrace, setActiveMcpTrace, TRACE_LINE_PREFIX, TRACE_DETAIL_ENV, type McpTrace, type McpTraceEvent, type McpTraceFields, type McpTraceOptions, type McpTraceRole, type McpTraceEventKind } from "./phase-trace.js";
|
|
9
|
+
export { createIdentityController, forkIdentityWorker, MCP_IDENTITY_TIMEOUT_MS, type ActivationResult, type CreateIdentityControllerOptions, type IdentityFailureCode, type IdentityWorkerHandle, type McpIdentityController, type McpIdentityRequest, type McpIdentityStatus, type ResolvedIdentityMessage } from "./identity-state.js";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EACX,KAAK,kBAAkB,EACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EACX,KAAK,kBAAkB,EACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,+BAA+B,EACpC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC"}
|
|
@@ -6,4 +6,5 @@ export { buildH2aRunInvocation, executeH2aRun, executeH2aRunWithSpawn, handleH2a
|
|
|
6
6
|
export { SessionRegistry } from "./sessions.js";
|
|
7
7
|
export { NotificationDispatcher } from "./notifications.js";
|
|
8
8
|
export { createMcpTrace, getActiveMcpTrace, setActiveMcpTrace, TRACE_LINE_PREFIX, TRACE_DETAIL_ENV } from "./phase-trace.js";
|
|
9
|
+
export { createIdentityController, forkIdentityWorker, MCP_IDENTITY_TIMEOUT_MS } from "./identity-state.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EAIrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,4BAA4B,EAG7B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAGN,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EAEZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EAItB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EAGhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EAGvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAOjB,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EAIrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,4BAA4B,EAG7B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAGN,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EAEZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EAItB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EAGhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,sBAAsB,EAGvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAOjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EASxB,MAAM,qBAAqB,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { type H2aRunDelegation, type H2aRunExecutor } from "./agent-launch.js";
|
|
|
7
7
|
import type { H2ASendSigner } from "../send.js";
|
|
8
8
|
import { type PayloadStore } from "./payload-store.js";
|
|
9
9
|
import { type FrameBudget } from "./frame-budget.js";
|
|
10
|
+
import type { McpIdentityController } from "./identity-state.js";
|
|
10
11
|
export interface CreateMcpServerOptions {
|
|
11
12
|
/** Filesystem root for the backing local-files store. */
|
|
12
13
|
root: string;
|
|
@@ -24,6 +25,20 @@ export interface CreateMcpServerOptions {
|
|
|
24
25
|
store?: LocalStore;
|
|
25
26
|
/** Trusted local sidecar identity used by h2a_send; never supplied by tool args. */
|
|
26
27
|
sendContext?: H2ASendSigner;
|
|
28
|
+
/**
|
|
29
|
+
* L2: the asynchronous identity readiness controller. When present, mutating /
|
|
30
|
+
* signed / identity-requiring tools are refused with a bounded typed error
|
|
31
|
+
* while identity is `identity_pending` or `identity_failed`, and
|
|
32
|
+
* `h2a_identity_status` reports the live state. Absent → `identity_disabled`
|
|
33
|
+
* (the historical explicit mode) and no gating.
|
|
34
|
+
*/
|
|
35
|
+
identity?: McpIdentityController;
|
|
36
|
+
/**
|
|
37
|
+
* L2: the LIVE signing identity, read on each `h2a_send` so a signer that only
|
|
38
|
+
* becomes available after asynchronous activation is picked up without
|
|
39
|
+
* rebuilding the server. Falls back to `sendContext` when absent.
|
|
40
|
+
*/
|
|
41
|
+
getSendContext?: () => H2ASendSigner | undefined;
|
|
27
42
|
/**
|
|
28
43
|
* Optional SessionRegistry overrides. Disabled `autoHeartbeat` is the
|
|
29
44
|
* sane default for in-process tests; the stdio transport enables it.
|
|
@@ -39,6 +54,14 @@ export interface CreateMcpServerOptions {
|
|
|
39
54
|
};
|
|
40
55
|
/** L1: frame budget override (tests). Defaults to `resolveFrameBudget()`. */
|
|
41
56
|
frameBudget?: FrameBudget;
|
|
57
|
+
/**
|
|
58
|
+
* L2: when `false`, the auto-created store does NOT initialize the layout
|
|
59
|
+
* (no directory / sentinel / file writes) so `initialize` / `tools/list` /
|
|
60
|
+
* `h2a_identity_status` and every read-only tool answer on a read-only or
|
|
61
|
+
* not-yet-created root before identity is ready. Ignored when `store` is
|
|
62
|
+
* supplied. Default `true` (unchanged for existing callers).
|
|
63
|
+
*/
|
|
64
|
+
storeInitialize?: boolean;
|
|
42
65
|
}
|
|
43
66
|
/** L1: optional per-call transport context (reserved for exact-id budgeting). */
|
|
44
67
|
export interface McpCallContext {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,EAsCL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGzE,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,gBAAgB,GAAG,S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