@sentropic/h2a 0.97.2 → 0.97.4
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/bin.js +13 -0
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts +13 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +94 -37
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +2 -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 +65 -2
- 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 +346 -65
- 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 +34 -0
- package/dist/runtime/local-files/locks.d.ts.map +1 -1
- package/dist/runtime/local-files/locks.js +55 -2
- 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 +79 -10
- package/dist/runtime/local-files/store.js.map +1 -1
- package/dist/runtime/mcp/discovery-pagination.d.ts +73 -0
- package/dist/runtime/mcp/discovery-pagination.d.ts.map +1 -0
- package/dist/runtime/mcp/discovery-pagination.js +446 -0
- package/dist/runtime/mcp/discovery-pagination.js.map +1 -0
- package/dist/runtime/mcp/frame-budget.d.ts +149 -0
- package/dist/runtime/mcp/frame-budget.d.ts.map +1 -0
- package/dist/runtime/mcp/frame-budget.js +275 -0
- package/dist/runtime/mcp/frame-budget.js.map +1 -0
- package/dist/runtime/mcp/handlers.d.ts +14 -3
- package/dist/runtime/mcp/handlers.d.ts.map +1 -1
- package/dist/runtime/mcp/handlers.js +22 -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 +2 -0
- package/dist/runtime/mcp/index.d.ts.map +1 -1
- package/dist/runtime/mcp/index.js +2 -0
- package/dist/runtime/mcp/index.js.map +1 -1
- package/dist/runtime/mcp/notifications.d.ts +13 -1
- package/dist/runtime/mcp/notifications.d.ts.map +1 -1
- package/dist/runtime/mcp/notifications.js +36 -20
- package/dist/runtime/mcp/notifications.js.map +1 -1
- package/dist/runtime/mcp/payload-store.d.ts +67 -0
- package/dist/runtime/mcp/payload-store.d.ts.map +1 -0
- package/dist/runtime/mcp/payload-store.js +242 -0
- package/dist/runtime/mcp/payload-store.js.map +1 -0
- package/dist/runtime/mcp/phase-trace.d.ts +98 -0
- package/dist/runtime/mcp/phase-trace.d.ts.map +1 -0
- package/dist/runtime/mcp/phase-trace.js +179 -0
- package/dist/runtime/mcp/phase-trace.js.map +1 -0
- package/dist/runtime/mcp/server.d.ts +36 -1
- package/dist/runtime/mcp/server.d.ts.map +1 -1
- package/dist/runtime/mcp/server.js +162 -5
- 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 +378 -98
- 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 +47 -4
- package/dist/runtime/mcp/tools.js.map +1 -1
- package/dist/runtime/mcp-central.d.ts.map +1 -1
- package/dist/runtime/mcp-central.js +17 -7
- package/dist/runtime/mcp-central.js.map +1 -1
- package/dist/runtime/mcp-http/hosted-mcp-server.d.ts.map +1 -1
- package/dist/runtime/mcp-http/hosted-mcp-server.js +16 -6
- package/dist/runtime/mcp-http/hosted-mcp-server.js.map +1 -1
- package/dist/runtime/mcp-http/readonly-allowlist.d.ts.map +1 -1
- package/dist/runtime/mcp-http/readonly-allowlist.js +6 -0
- package/dist/runtime/mcp-http/readonly-allowlist.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -130,6 +130,6 @@ export declare const H2A_CLI_ADAPTER: {
|
|
|
130
130
|
readonly corePackageName: "@sentropic/h2a";
|
|
131
131
|
readonly protocol: "sentropic.h2a";
|
|
132
132
|
readonly hosts: readonly [import("./hosts/codex.js").H2AConfigurableHostDescriptor, import("./hosts/codex.js").H2AConfigurableHostDescriptor, import("./hosts/codex.js").H2AConfigurableHostDescriptor, import("./hosts/codex.js").H2AConfigurableHostDescriptor, import("./hosts/codex.js").H2AConfigurableHostDescriptor, import("./hosts/codex.js").H2AConfigurableHostDescriptor];
|
|
133
|
-
readonly mcpToolNames: readonly ["h2a_register_instance", "h2a_discover_instances", "h2a_open_negotiation", "h2a_offer", "h2a_counteroffer", "h2a_sign", "h2a_stabilize", "h2a_attest_comprehension", "h2a_declare_conflit_interet", "h2a_conflict_posture", "h2a_inbox", "h2a_send", "h2a_append_journal", "h2a_escalate", "h2a_session_open", "h2a_session_close", "h2a_discover_sessions", "h2a_nhi_report", "h2a_nhi_inventory", "h2a_nhi_attest", "h2a_nhi_offboard", "h2a_nhi_export", "h2a_blockage_raise", "h2a_blockage_list", "h2a_blockage_resolve", "h2a_conductor", "h2a_conductor_claim", "h2a_conductor_release", "h2a_conductor_launch_check", "h2a_conductor_launch", "h2a_run", "h2a_loop_create", "h2a_loop_join", "h2a_loop_report", "h2a_loop_done", "h2a_loop_stop", "h2a_loop_list", "h2a_loop_status", "track_report", "track_snapshot", "track_query", "track_validate", "track_audit", "track_branch_provenance", "track_freshness", "track_external_deps", "track_status", "track_verification_runs", "track_scope_validate", "track_cursor", "track_canevas", "track_amendment_trace", "track_workspace_activity"];
|
|
133
|
+
readonly mcpToolNames: readonly ["h2a_register_instance", "h2a_discover_instances", "h2a_read_payload", "h2a_identity_status", "h2a_open_negotiation", "h2a_offer", "h2a_counteroffer", "h2a_sign", "h2a_stabilize", "h2a_attest_comprehension", "h2a_declare_conflit_interet", "h2a_conflict_posture", "h2a_inbox", "h2a_send", "h2a_append_journal", "h2a_escalate", "h2a_session_open", "h2a_session_close", "h2a_discover_sessions", "h2a_nhi_report", "h2a_nhi_inventory", "h2a_nhi_attest", "h2a_nhi_offboard", "h2a_nhi_export", "h2a_blockage_raise", "h2a_blockage_list", "h2a_blockage_resolve", "h2a_conductor", "h2a_conductor_claim", "h2a_conductor_release", "h2a_conductor_launch_check", "h2a_conductor_launch", "h2a_run", "h2a_loop_create", "h2a_loop_join", "h2a_loop_report", "h2a_loop_done", "h2a_loop_stop", "h2a_loop_list", "h2a_loop_status", "track_report", "track_snapshot", "track_query", "track_validate", "track_audit", "track_branch_provenance", "track_freshness", "track_external_deps", "track_status", "track_verification_runs", "track_scope_validate", "track_cursor", "track_canevas", "track_amendment_trace", "track_workspace_activity"];
|
|
134
134
|
};
|
|
135
135
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const H2A_CLI_MCP_TOOL_NAMES: readonly ["h2a_register_instance", "h2a_discover_instances", "h2a_open_negotiation", "h2a_offer", "h2a_counteroffer", "h2a_sign", "h2a_stabilize", "h2a_attest_comprehension", "h2a_declare_conflit_interet", "h2a_conflict_posture", "h2a_inbox", "h2a_send", "h2a_append_journal", "h2a_escalate", "h2a_session_open", "h2a_session_close", "h2a_discover_sessions", "h2a_nhi_report", "h2a_nhi_inventory", "h2a_nhi_attest", "h2a_nhi_offboard", "h2a_nhi_export", "h2a_blockage_raise", "h2a_blockage_list", "h2a_blockage_resolve", "h2a_conductor", "h2a_conductor_claim", "h2a_conductor_release", "h2a_conductor_launch_check", "h2a_conductor_launch", "h2a_run", "h2a_loop_create", "h2a_loop_join", "h2a_loop_report", "h2a_loop_done", "h2a_loop_stop", "h2a_loop_list", "h2a_loop_status", "track_report", "track_snapshot", "track_query", "track_validate", "track_audit", "track_branch_provenance", "track_freshness", "track_external_deps", "track_status", "track_verification_runs", "track_scope_validate", "track_cursor", "track_canevas", "track_amendment_trace", "track_workspace_activity"];
|
|
1
|
+
export declare const H2A_CLI_MCP_TOOL_NAMES: readonly ["h2a_register_instance", "h2a_discover_instances", "h2a_read_payload", "h2a_identity_status", "h2a_open_negotiation", "h2a_offer", "h2a_counteroffer", "h2a_sign", "h2a_stabilize", "h2a_attest_comprehension", "h2a_declare_conflit_interet", "h2a_conflict_posture", "h2a_inbox", "h2a_send", "h2a_append_journal", "h2a_escalate", "h2a_session_open", "h2a_session_close", "h2a_discover_sessions", "h2a_nhi_report", "h2a_nhi_inventory", "h2a_nhi_attest", "h2a_nhi_offboard", "h2a_nhi_export", "h2a_blockage_raise", "h2a_blockage_list", "h2a_blockage_resolve", "h2a_conductor", "h2a_conductor_claim", "h2a_conductor_release", "h2a_conductor_launch_check", "h2a_conductor_launch", "h2a_run", "h2a_loop_create", "h2a_loop_join", "h2a_loop_report", "h2a_loop_done", "h2a_loop_stop", "h2a_loop_list", "h2a_loop_status", "track_report", "track_snapshot", "track_query", "track_validate", "track_audit", "track_branch_provenance", "track_freshness", "track_external_deps", "track_status", "track_verification_runs", "track_scope_validate", "track_cursor", "track_canevas", "track_amendment_trace", "track_workspace_activity"];
|
|
2
2
|
//# sourceMappingURL=mcp.d.ts.map
|
package/dist/mcp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,omCA0DzB,CAAC"}
|
package/dist/mcp.js
CHANGED
package/dist/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,uBAAuB;IACvB,wBAAwB;IACxB,sBAAsB;IACtB,WAAW;IACX,kBAAkB;IAClB,UAAU;IACV,eAAe;IACf,0BAA0B;IAC1B,6BAA6B;IAC7B,sBAAsB;IACtB,WAAW;IACX,UAAU;IACV,oBAAoB;IACpB,cAAc;IACd,kBAAkB;IAClB,mBAAmB;IACnB,uBAAuB;IACvB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,oBAAoB;IACpB,mBAAmB;IACnB,sBAAsB;IACtB,eAAe;IACf,qBAAqB;IACrB,uBAAuB;IACvB,4BAA4B;IAC5B,sBAAsB;IACtB,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,eAAe;IACf,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,6EAA6E;IAC7E,uEAAuE;IACvE,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,yBAAyB;IACzB,iBAAiB;IACjB,qBAAqB;IACrB,cAAc;IACd,yBAAyB;IACzB,sBAAsB;IACtB,cAAc;IACd,eAAe;IACf,uBAAuB;IACvB,0BAA0B;CAClB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,uBAAuB;IACvB,wBAAwB;IACxB,kBAAkB;IAClB,qBAAqB;IACrB,sBAAsB;IACtB,WAAW;IACX,kBAAkB;IAClB,UAAU;IACV,eAAe;IACf,0BAA0B;IAC1B,6BAA6B;IAC7B,sBAAsB;IACtB,WAAW;IACX,UAAU;IACV,oBAAoB;IACpB,cAAc;IACd,kBAAkB;IAClB,mBAAmB;IACnB,uBAAuB;IACvB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,oBAAoB;IACpB,mBAAmB;IACnB,sBAAsB;IACtB,eAAe;IACf,qBAAqB;IACrB,uBAAuB;IACvB,4BAA4B;IAC5B,sBAAsB;IACtB,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,eAAe;IACf,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,6EAA6E;IAC7E,uEAAuE;IACvE,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,yBAAyB;IACzB,iBAAiB;IACjB,qBAAqB;IACrB,cAAc;IACd,yBAAyB;IACzB,sBAAsB;IACtB,cAAc;IACd,eAAe;IACf,uBAAuB;IACvB,0BAA0B;CAClB,CAAC"}
|
|
@@ -87,4 +87,37 @@ export interface ReclaimOrMintResult {
|
|
|
87
87
|
* reclaim of someone else's.
|
|
88
88
|
*/
|
|
89
89
|
export declare function reclaimOrMint(root: string, key: IdentityBindingKey, deps: ReclaimOrMintDeps): ReclaimOrMintResult;
|
|
90
|
+
/**
|
|
91
|
+
* L2 options for the ASYNC (MCP identity worker) reclaim/mint transaction.
|
|
92
|
+
*/
|
|
93
|
+
export interface ReclaimOrMintOptions {
|
|
94
|
+
/**
|
|
95
|
+
* Cooperative cancellation (transport closed / signal). When aborted BEFORE the
|
|
96
|
+
* lock is held, the wait stops and the attempt throws; a transaction already
|
|
97
|
+
* entered under the lock finishes so no half-written binding is left.
|
|
98
|
+
*/
|
|
99
|
+
readonly signal?: AbortSignal;
|
|
100
|
+
/** Monotone remaining budget (ms) bounding the lock wait for this attempt. */
|
|
101
|
+
readonly deadlineMs?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Materialize keys / registration / alias BEFORE the binding row is appended
|
|
104
|
+
* (mint path only), all inside the held identity lock. This closes the
|
|
105
|
+
* publish-order window through which a concurrent worker that read the fresh
|
|
106
|
+
* binding — but not yet its keyring — could fail proof-of-possession and mint a
|
|
107
|
+
* DUPLICATE identity. The binding is always the LAST durable write.
|
|
108
|
+
*/
|
|
109
|
+
readonly beforePublish?: (result: ReclaimOrMintResult, heldLocks: {
|
|
110
|
+
readonly identity: true;
|
|
111
|
+
}) => void;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Async twin of {@link reclaimOrMint} used by the L2 identity worker. Identical
|
|
115
|
+
* invariants — proof-of-possession gates reclaim, a fail-closed fence
|
|
116
|
+
* (`reclaimStale:false`) refuses an ambiguous sentinel, `reclaimOrMint*` stays
|
|
117
|
+
* the UNIQUE append of a binding row — but the lock WAIT is asynchronous so the
|
|
118
|
+
* worker can receive an IPC cancel between poll attempts instead of blocking the
|
|
119
|
+
* event loop inside `Atomics.wait`. On a mint, `beforePublish` publishes the
|
|
120
|
+
* keyring/registration/alias before the binding append (window closure, T5).
|
|
121
|
+
*/
|
|
122
|
+
export declare function reclaimOrMintAsync(root: string, key: IdentityBindingKey, deps: ReclaimOrMintDeps, options?: ReclaimOrMintOptions): Promise<ReclaimOrMintResult>;
|
|
90
123
|
//# sourceMappingURL=bindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKpE;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,8BAA8B,CAAC;AAE3E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAYD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAa/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,SAAS,CAQjG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,YAAY,EACvB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAST;AAED,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC;IAClD,2EAA2E;IAC3E,IAAI,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,GAAG,IAAI,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,iBAAiB,GACtB,mBAAmB,CAqCrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CACvB,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;KAAE,KACnC,IAAI,CAAC;CACX;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,iBAAiB,EACvB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CA8C9B"}
|
|
@@ -28,7 +28,8 @@ import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
|
28
28
|
import { randomUUID } from "node:crypto";
|
|
29
29
|
import { join } from "node:path";
|
|
30
30
|
import { verifyCanonical } from "@sentropic/h2a";
|
|
31
|
-
import { localStorePaths, withLockSync } from "../local-files/index.js";
|
|
31
|
+
import { localStorePaths, withLock, withLockSync } from "../local-files/index.js";
|
|
32
|
+
import { getActiveMcpTrace } from "../mcp/phase-trace.js";
|
|
32
33
|
/**
|
|
33
34
|
* The one protocol accepted by the DEF identity-binding writer. The cull
|
|
34
35
|
* executor uses the same sentinel and refuses a writer inventory that cannot
|
|
@@ -106,6 +107,19 @@ export function verifyReclaimProof(nonce, signature, publicKeys) {
|
|
|
106
107
|
*/
|
|
107
108
|
export function reclaimOrMint(root, key, deps) {
|
|
108
109
|
mkdirSync(identityDir(root), { recursive: true });
|
|
110
|
+
// L0 (detailed-gated): observe the binding lock's wait/acquire/hold so the
|
|
111
|
+
// trace shows time spent contending the identity write — a logical lock id,
|
|
112
|
+
// never a binding row's content.
|
|
113
|
+
const trace = getActiveMcpTrace();
|
|
114
|
+
const observe = trace?.detailed
|
|
115
|
+
? (event) => {
|
|
116
|
+
trace.phase(`binding_lock_${event.event}`, {
|
|
117
|
+
tool: "identity",
|
|
118
|
+
...(event.waitMs !== undefined ? { waitMs: event.waitMs } : {}),
|
|
119
|
+
...(event.holdMs !== undefined ? { holdMs: event.holdMs } : {})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
: undefined;
|
|
109
123
|
return withLockSync(bindingsLock(root), () => {
|
|
110
124
|
const existing = findBinding(root, key);
|
|
111
125
|
if (existing && deps.verifyProof(existing)) {
|
|
@@ -121,7 +135,56 @@ export function reclaimOrMint(root, key, deps) {
|
|
|
121
135
|
},
|
|
122
136
|
// A cull fence is fail-closed. Reclaiming an apparently stale sentinel
|
|
123
137
|
// would turn an ambiguous owner/fence state into a concurrent write.
|
|
124
|
-
reclaimStale: false
|
|
138
|
+
reclaimStale: false,
|
|
139
|
+
...(observe ? { observe } : {})
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Async twin of {@link reclaimOrMint} used by the L2 identity worker. Identical
|
|
144
|
+
* invariants — proof-of-possession gates reclaim, a fail-closed fence
|
|
145
|
+
* (`reclaimStale:false`) refuses an ambiguous sentinel, `reclaimOrMint*` stays
|
|
146
|
+
* the UNIQUE append of a binding row — but the lock WAIT is asynchronous so the
|
|
147
|
+
* worker can receive an IPC cancel between poll attempts instead of blocking the
|
|
148
|
+
* event loop inside `Atomics.wait`. On a mint, `beforePublish` publishes the
|
|
149
|
+
* keyring/registration/alias before the binding append (window closure, T5).
|
|
150
|
+
*/
|
|
151
|
+
export async function reclaimOrMintAsync(root, key, deps, options = {}) {
|
|
152
|
+
mkdirSync(identityDir(root), { recursive: true });
|
|
153
|
+
const trace = getActiveMcpTrace();
|
|
154
|
+
const observe = trace?.detailed
|
|
155
|
+
? (event) => {
|
|
156
|
+
trace.phase(`binding_lock_${event.event}`, {
|
|
157
|
+
tool: "identity",
|
|
158
|
+
...(event.waitMs !== undefined ? { waitMs: event.waitMs } : {}),
|
|
159
|
+
...(event.holdMs !== undefined ? { holdMs: event.holdMs } : {})
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
: undefined;
|
|
163
|
+
return withLock(bindingsLock(root), () => {
|
|
164
|
+
const existing = findBinding(root, key);
|
|
165
|
+
if (existing && deps.verifyProof(existing)) {
|
|
166
|
+
return { action: "reclaim", instance: existing.instance, agentUuid: existing.agentUuid };
|
|
167
|
+
}
|
|
168
|
+
const minted = deps.mint();
|
|
169
|
+
const result = {
|
|
170
|
+
action: "mint",
|
|
171
|
+
instance: minted.instance,
|
|
172
|
+
agentUuid: minted.agentUuid
|
|
173
|
+
};
|
|
174
|
+
// Publish keys / registration / alias BEFORE the binding row so no reader
|
|
175
|
+
// can observe a binding whose keyring is not yet provable.
|
|
176
|
+
options.beforePublish?.(result, { identity: true });
|
|
177
|
+
appendFileSync(bindingsFile(root), `${JSON.stringify({ ...key, instance: minted.instance, agentUuid: minted.agentUuid, at: new Date(deps.now()).toISOString() })}\n`, "utf8");
|
|
178
|
+
return result;
|
|
179
|
+
}, {
|
|
180
|
+
ownerMetadata: {
|
|
181
|
+
protocol: IDENTITY_BINDING_FENCE_PROTOCOL,
|
|
182
|
+
fenceEpoch: randomUUID()
|
|
183
|
+
},
|
|
184
|
+
reclaimStale: false,
|
|
185
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
186
|
+
...(options.deadlineMs !== undefined ? { timeoutMs: options.deadlineMs } : {}),
|
|
187
|
+
...(observe ? { observe } : {})
|
|
125
188
|
});
|
|
126
189
|
}
|
|
127
190
|
//# sourceMappingURL=bindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../../src/runtime/identity/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAqB,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../../src/runtime/identity/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAqB,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,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C5B,CAAC;QACF,0EAA0E;QAC1E,2DAA2D;QAC3D,OAAO,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,cAAc,CACZ,YAAY,CAAC,IAAI,CAAC,EAClB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE,EAA+B,CAAC,IAAI,EAC9J,MAAM,CACP,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC,EACD;QACE,aAAa,EAAE;YACb,QAAQ,EAAE,+BAA+B;YACzC,UAAU,EAAE,UAAU,EAAE;SACzB;QACD,YAAY,EAAE,KAAK;QACnB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -2,10 +2,10 @@ export { resolveProviderSession } from "./resolver.js";
|
|
|
2
2
|
export type { ProviderSession, ProviderSessionReaders, ProviderSessionSource, ResolveProviderSessionInput } from "./resolver.js";
|
|
3
3
|
export { CLAUDE_TITLE_TAIL_BYTES, CODEX_INDEX_TAIL_BYTES, MAX_DISPLAY_NAME_CHARS, createHostSessionNameRefresher, defaultProviderSessionReaders, readHostSessionName } from "./readers.js";
|
|
4
4
|
export type { HostNameReaders } from "./readers.js";
|
|
5
|
-
export { listBindings, findBinding, verifyReclaimProof, reclaimOrMint } from "./bindings.js";
|
|
6
|
-
export type { H2AIdentityBinding, IdentityBindingKey, ReclaimOrMintDeps, ReclaimOrMintResult } from "./bindings.js";
|
|
5
|
+
export { listBindings, findBinding, verifyReclaimProof, reclaimOrMint, reclaimOrMintAsync } from "./bindings.js";
|
|
6
|
+
export type { H2AIdentityBinding, IdentityBindingKey, ReclaimOrMintDeps, ReclaimOrMintOptions, ReclaimOrMintResult } from "./bindings.js";
|
|
7
7
|
export { mergeInboxDedup, decideLegacyAdoption, listIdentityAliases, legacyAliasAlreadyAdopted, recordIdentityAlias } from "./migration.js";
|
|
8
8
|
export type { H2AIdentityAlias, LegacyAdoptionInput, LegacyAdoptionDecision } from "./migration.js";
|
|
9
|
-
export { identityKeyPaths, resolveLiveIdentity, sanitizeDeclaredCapabilities, H2A_CLI_DECLARED_CAPABILITIES, H2A_DECLARED_CAPABILITIES } from "./live.js";
|
|
10
|
-
export type { H2ADeclaredCapability, ResolveLiveIdentityInput, ResolvedLiveIdentity } from "./live.js";
|
|
9
|
+
export { identityKeyPaths, resolveLiveIdentity, resolveLiveIdentityAsync, sanitizeDeclaredCapabilities, H2A_CLI_DECLARED_CAPABILITIES, H2A_DECLARED_CAPABILITIES } from "./live.js";
|
|
10
|
+
export type { H2ADeclaredCapability, ResolveLiveIdentityInput, ResolveLiveIdentityAsyncOptions, ResolvedLiveIdentity } from "./live.js";
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EAC1B,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,+BAA+B,EAC/B,oBAAoB,EACrB,MAAM,WAAW,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { resolveProviderSession } from "./resolver.js";
|
|
2
2
|
export { CLAUDE_TITLE_TAIL_BYTES, CODEX_INDEX_TAIL_BYTES, MAX_DISPLAY_NAME_CHARS, createHostSessionNameRefresher, defaultProviderSessionReaders, readHostSessionName } from "./readers.js";
|
|
3
|
-
export { listBindings, findBinding, verifyReclaimProof, reclaimOrMint } from "./bindings.js";
|
|
3
|
+
export { listBindings, findBinding, verifyReclaimProof, reclaimOrMint, reclaimOrMintAsync } from "./bindings.js";
|
|
4
4
|
export { mergeInboxDedup, decideLegacyAdoption, listIdentityAliases, legacyAliasAlreadyAdopted, recordIdentityAlias } from "./migration.js";
|
|
5
|
-
export { identityKeyPaths, resolveLiveIdentity, sanitizeDeclaredCapabilities, H2A_CLI_DECLARED_CAPABILITIES, H2A_DECLARED_CAPABILITIES } from "./live.js";
|
|
5
|
+
export { identityKeyPaths, resolveLiveIdentity, resolveLiveIdentityAsync, sanitizeDeclaredCapabilities, H2A_CLI_DECLARED_CAPABILITIES, H2A_DECLARED_CAPABILITIES } from "./live.js";
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/identity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAOvD,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/identity/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAOvD,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAQvB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EAC1B,MAAM,WAAW,CAAC"}
|
|
@@ -95,4 +95,67 @@ export declare function identityKeyPaths(root: string, instance: string): {
|
|
|
95
95
|
*/
|
|
96
96
|
export declare function publicKeyFingerprint(publicKeyPem: string): string;
|
|
97
97
|
export declare function resolveLiveIdentity(input: ResolveLiveIdentityInput): ResolvedLiveIdentity;
|
|
98
|
+
export interface ResolveLiveIdentityAsyncOptions {
|
|
99
|
+
/** Cooperative cancellation propagated to the identity-lock wait. */
|
|
100
|
+
readonly signal?: AbortSignal;
|
|
101
|
+
/** Remaining budget (ms) bounding the identity-lock wait for this attempt. */
|
|
102
|
+
readonly deadlineMs?: number;
|
|
103
|
+
/**
|
|
104
|
+
* Short registry-lock timeout for the registration write so a contended
|
|
105
|
+
* attempt fails fast and releases the identity lock (instead of holding it
|
|
106
|
+
* through a long registry wait), letting the worker retry outside the section.
|
|
107
|
+
*/
|
|
108
|
+
readonly registryLockTimeoutMs?: number;
|
|
109
|
+
/**
|
|
110
|
+
* Memo shared across the worker's retry attempts so the mint CANDIDATE
|
|
111
|
+
* (uuid + derived instance + its keypair) is generated ONCE — a retry reuses
|
|
112
|
+
* the same candidate instead of minting (and generating a keypair) again.
|
|
113
|
+
*/
|
|
114
|
+
readonly mintMemo?: {
|
|
115
|
+
value?: {
|
|
116
|
+
instance: string;
|
|
117
|
+
agentUuid: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Cache of the expensive OUTSIDE-lock reads (provider, proof, legacy decision —
|
|
122
|
+
* each a full registry parse) shared across the worker's retry attempts, so a
|
|
123
|
+
* contended retry does NOT re-parse the ~17 MB registry. Safe: the
|
|
124
|
+
* authoritative reclaim/mint decision is re-made UNDER the lock (fresh
|
|
125
|
+
* `findBinding` + a `verifyProof` that recomputes when the binding changed).
|
|
126
|
+
*/
|
|
127
|
+
readonly prepCache?: {
|
|
128
|
+
prepared?: unknown;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* 0-based attempt index within the worker's retry loop. Only the FIRST attempt
|
|
132
|
+
* (0) may trust a POSITIVE cached proof (it is ms-fresh vs. the pre-read); any
|
|
133
|
+
* retry recomputes the proof under the lock, and a NEGATIVE cached proof is
|
|
134
|
+
* ALWAYS recomputed under the lock (F2: a keyring published by a racing writer
|
|
135
|
+
* between the pre-read and the lock must be seen, or a duplicate is minted).
|
|
136
|
+
*/
|
|
137
|
+
readonly attempt?: number;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* L2 async resolution used ONLY by the identity worker child.
|
|
141
|
+
*
|
|
142
|
+
* Same result and same security invariants as {@link resolveLiveIdentity}, with
|
|
143
|
+
* two deliberate reductions that are safe to make off the parent's event loop:
|
|
144
|
+
*
|
|
145
|
+
* 1. **Proof outside the lock.** The existing binding is read and its
|
|
146
|
+
* proof-of-possession (keypair read + registry keyring parse + signature) is
|
|
147
|
+
* computed BEFORE the identity lock is taken, then re-checked under the lock
|
|
148
|
+
* against the binding actually found — so the ~17 MB registry parse and the
|
|
149
|
+
* ed25519 sign do NOT run inside the critical section on the reconnect
|
|
150
|
+
* (reclaim) hot path. If the binding raced (its instance changed under the
|
|
151
|
+
* lock), the proof for that row is recomputed inline (rare, correct).
|
|
152
|
+
* 2. **Binding published last.** On a mint, the keyring / registration / alias
|
|
153
|
+
* are published inside the held lock BEFORE the binding row is appended, so
|
|
154
|
+
* no concurrent worker can see a binding whose keyring is not yet provable
|
|
155
|
+
* and mint a duplicate.
|
|
156
|
+
*
|
|
157
|
+
* The lock WAIT is asynchronous (cancellable between polls); a transaction
|
|
158
|
+
* already entered under the lock still finishes cooperatively.
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveLiveIdentityAsync(input: ResolveLiveIdentityInput, options?: ResolveLiveIdentityAsyncOptions): Promise<ResolvedLiveIdentity>;
|
|
98
161
|
//# sourceMappingURL=live.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/live.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/live.ts"],"names":[],"mappings":"AAaA,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAWxB,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGpF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,yBAAyB,sDAO5B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,qBAAqB,EAGzE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAC1C,qBAAqB,EAAE,CAGzB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;I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