stitchkit 0.92.0 → 0.94.0
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/CHANGELOG.md +191 -0
- package/README.md +5 -2
- package/dist/agent-runtime/children-control.d.ts +6 -0
- package/dist/agent-runtime/children-control.d.ts.map +1 -0
- package/dist/agent-runtime/children-spawn.d.ts +6 -0
- package/dist/agent-runtime/children-spawn.d.ts.map +1 -0
- package/dist/agent-runtime/children-state.d.ts +46 -0
- package/dist/agent-runtime/children-state.d.ts.map +1 -0
- package/dist/agent-runtime/children-usage.d.ts +8 -0
- package/dist/agent-runtime/children-usage.d.ts.map +1 -0
- package/dist/agent-runtime/children.d.ts +11 -14
- package/dist/agent-runtime/children.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts +2 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/deferred-tool-types.d.ts +2 -2
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/agent-runtime/events.d.ts +1 -1
- package/dist/agent-runtime/events.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +1 -1
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/observability.d.ts +1 -1
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/{agent-runtime-openrouter.d.ts → agent-runtime/openrouter.d.ts} +3 -3
- package/dist/agent-runtime/openrouter.d.ts.map +1 -0
- package/dist/agent-runtime/projections.d.ts +1 -1
- package/dist/agent-runtime/projections.d.ts.map +1 -1
- package/dist/agent-runtime/run-acquisition.d.ts +17 -0
- package/dist/agent-runtime/run-acquisition.d.ts.map +1 -0
- package/dist/agent-runtime/run-execution-state.d.ts +133 -0
- package/dist/agent-runtime/run-execution-state.d.ts.map +1 -0
- package/dist/agent-runtime/run-execution.d.ts +17 -33
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-failure.d.ts +18 -0
- package/dist/agent-runtime/run-failure.d.ts.map +1 -0
- package/dist/agent-runtime/run-model-attempts.d.ts +6 -0
- package/dist/agent-runtime/run-model-attempts.d.ts.map +1 -0
- package/dist/agent-runtime/run-prompt-history.d.ts +58 -0
- package/dist/agent-runtime/run-prompt-history.d.ts.map +1 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts +26 -0
- package/dist/agent-runtime/run-provider-ledger.d.ts.map +1 -0
- package/dist/agent-runtime/run-stream-parts.d.ts +17 -0
- package/dist/agent-runtime/run-stream-parts.d.ts.map +1 -0
- package/dist/agent-runtime/run-terminal.d.ts +11 -0
- package/dist/agent-runtime/run-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/run-turn-preparation.d.ts +22 -0
- package/dist/agent-runtime/run-turn-preparation.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-admission-gate.d.ts +29 -0
- package/dist/agent-runtime/runtime-admission-gate.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-control.d.ts +9 -0
- package/dist/agent-runtime/runtime-control.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-recovery.d.ts +10 -0
- package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-state.d.ts +36 -0
- package/dist/agent-runtime/runtime-state.d.ts.map +1 -0
- package/dist/agent-runtime/runtime-submit.d.ts +5 -0
- package/dist/agent-runtime/runtime-submit.d.ts.map +1 -0
- package/dist/agent-runtime/runtime.d.ts +9 -4
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/{agent-runtime-sqlite-bun.d.ts → agent-runtime/sqlite-bun.d.ts} +5 -4
- package/dist/agent-runtime/sqlite-bun.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-events.d.ts +5 -0
- package/dist/agent-runtime/sqlite-events.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-history.d.ts +7 -0
- package/dist/agent-runtime/sqlite-history.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-ledger.d.ts +7 -0
- package/dist/agent-runtime/sqlite-ledger.d.ts.map +1 -0
- package/dist/{agent-runtime-sqlite-node.d.ts → agent-runtime/sqlite-node.d.ts} +5 -4
- package/dist/agent-runtime/sqlite-node.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-reads.d.ts +14 -0
- package/dist/agent-runtime/sqlite-reads.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-rows.d.ts +178 -0
- package/dist/agent-runtime/sqlite-rows.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-schema.d.ts +7 -0
- package/dist/agent-runtime/sqlite-schema.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-transactions.d.ts +25 -0
- package/dist/agent-runtime/sqlite-transactions.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite.d.ts +10 -6
- package/dist/agent-runtime/sqlite.d.ts.map +1 -1
- package/dist/agent-runtime/store-archive.d.ts +16 -0
- package/dist/agent-runtime/store-archive.d.ts.map +1 -0
- package/dist/{testing/agent-store-conformance.d.ts → agent-runtime/store-conformance.d.ts} +2 -2
- package/dist/agent-runtime/store-conformance.d.ts.map +1 -0
- package/dist/agent-runtime/store-create.d.ts +11 -0
- package/dist/agent-runtime/store-create.d.ts.map +1 -0
- package/dist/agent-runtime/{store-driver.d.ts → store-driver-contract.d.ts} +7 -7
- package/dist/agent-runtime/store-driver-contract.d.ts.map +1 -0
- package/dist/agent-runtime/store-events.d.ts +7 -89
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/store-memory.d.ts +4 -0
- package/dist/agent-runtime/store-memory.d.ts.map +1 -0
- package/dist/agent-runtime/store-mutate.d.ts +13 -0
- package/dist/agent-runtime/store-mutate.d.ts.map +1 -0
- package/dist/agent-runtime/store-purge.d.ts +1 -1
- package/dist/agent-runtime/store-purge.d.ts.map +1 -1
- package/dist/agent-runtime/store-reads.d.ts +29 -0
- package/dist/agent-runtime/store-reads.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-history.d.ts +10 -0
- package/dist/agent-runtime/store-reduce-history.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-run.d.ts +14 -0
- package/dist/agent-runtime/store-reduce-run.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-shared.d.ts +76 -0
- package/dist/agent-runtime/store-reduce-shared.d.ts.map +1 -0
- package/dist/agent-runtime/store-reduce-terminal.d.ts +6 -0
- package/dist/agent-runtime/store-reduce-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/store-reducer.d.ts +24 -0
- package/dist/agent-runtime/store-reducer.d.ts.map +1 -0
- package/dist/agent-runtime/store-snapshot.d.ts +19 -0
- package/dist/agent-runtime/store-snapshot.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +1 -1
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/application/admission.d.ts +1 -1
- package/dist/application/admission.d.ts.map +1 -1
- package/dist/application/events.d.ts +1 -1
- package/dist/application/events.d.ts.map +1 -1
- package/dist/{server → application}/file-state-store.d.ts +1 -1
- package/dist/application/file-state-store.d.ts.map +1 -0
- package/dist/application/health.d.ts +1 -1
- package/dist/application/health.d.ts.map +1 -1
- package/dist/application/kernel-admission.d.ts +8 -0
- package/dist/application/kernel-admission.d.ts.map +1 -0
- package/dist/application/kernel-contract.d.ts +142 -0
- package/dist/application/kernel-contract.d.ts.map +1 -0
- package/dist/application/kernel-resource-context.d.ts +24 -0
- package/dist/application/kernel-resource-context.d.ts.map +1 -0
- package/dist/application/kernel-restart.d.ts +5 -0
- package/dist/application/kernel-restart.d.ts.map +1 -0
- package/dist/application/kernel-rollback.d.ts +4 -0
- package/dist/application/kernel-rollback.d.ts.map +1 -0
- package/dist/application/kernel-shutdown.d.ts +6 -0
- package/dist/application/kernel-shutdown.d.ts.map +1 -0
- package/dist/application/kernel-start.d.ts +20 -0
- package/dist/application/kernel-start.d.ts.map +1 -0
- package/dist/application/kernel-state.d.ts +116 -0
- package/dist/application/kernel-state.d.ts.map +1 -0
- package/dist/application/kernel.d.ts +9 -140
- package/dist/application/kernel.d.ts.map +1 -1
- package/dist/application/latest-sink.d.ts +1 -1
- package/dist/application/latest-sink.d.ts.map +1 -1
- package/dist/application/opentelemetry.d.ts +1 -1
- package/dist/application/opentelemetry.d.ts.map +1 -1
- package/dist/application/watch-hub.d.ts +2 -2
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/browser/client-multipart.d.ts +1 -1
- package/dist/browser/client-multipart.d.ts.map +1 -1
- package/dist/browser/client-url.d.ts +1 -1
- package/dist/browser/client-url.d.ts.map +1 -1
- package/dist/browser/client.d.ts +1 -1
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/contract-stream.d.ts +1 -1
- package/dist/browser/contract-stream.d.ts.map +1 -1
- package/dist/browser/http.d.ts +1 -1
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/resumable.d.ts +1 -28
- package/dist/browser/resumable.d.ts.map +1 -1
- package/dist/browser/retained.d.ts.map +1 -0
- package/dist/browser/socket-io.d.ts +23 -1
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +14 -2
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/contract/define.d.ts +72 -65
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/{internal/errors.d.ts → contract/normalize.d.ts} +3 -39
- package/dist/contract/normalize.d.ts.map +1 -0
- package/dist/contract/tool-view.d.ts +135 -0
- package/dist/contract/tool-view.d.ts.map +1 -0
- package/dist/declaration/declaration.d.ts.map +1 -0
- package/dist/{agent-runtime/durability-contract.d.ts → durability/contract.d.ts} +2 -2
- package/dist/durability/contract.d.ts.map +1 -0
- package/dist/{agent-runtime/durability.d.ts → durability/engine.d.ts} +4 -4
- package/dist/durability/engine.d.ts.map +1 -0
- package/dist/durability/events.d.ts +101 -0
- package/dist/durability/events.d.ts.map +1 -0
- package/dist/{agent-runtime/durability-json.d.ts → durability/json.d.ts} +1 -1
- package/dist/durability/json.d.ts.map +1 -0
- package/dist/{agent-runtime/durability-ledger.d.ts → durability/ledger.d.ts} +2 -2
- package/dist/durability/ledger.d.ts.map +1 -0
- package/dist/{agent-runtime/durability-scheduler.d.ts → durability/scheduler.d.ts} +2 -2
- package/dist/durability/scheduler.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/browser.d.ts +5 -0
- package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -0
- package/dist/{agent-runtime-browser.js → entrypoints/agent-runtime/browser.js} +3 -3
- package/dist/{agent-runtime-coding-tools.d.ts → entrypoints/agent-runtime/coding-tools.d.ts} +2 -2
- package/dist/entrypoints/agent-runtime/coding-tools.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +22 -0
- package/dist/{agent-runtime-harness.d.ts → entrypoints/agent-runtime/harness.d.ts} +2 -2
- package/dist/entrypoints/agent-runtime/harness.d.ts.map +1 -0
- package/dist/{agent-runtime-harness.js → entrypoints/agent-runtime/harness.js} +24 -25
- package/dist/entrypoints/agent-runtime/openrouter.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -0
- package/dist/{agent-runtime-openrouter.js → entrypoints/agent-runtime/openrouter.js} +3 -3
- package/dist/{agent-runtime-sandbox.d.ts → entrypoints/agent-runtime/sandbox.d.ts} +5 -5
- package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -0
- package/dist/{agent-runtime-sandbox.js → entrypoints/agent-runtime/sandbox.js} +11 -12
- package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/sqlite/bun.d.ts.map +1 -0
- package/dist/{agent-runtime-sqlite-bun.js → entrypoints/agent-runtime/sqlite/bun.js} +8 -6
- package/dist/entrypoints/agent-runtime/sqlite/node.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/sqlite/node.d.ts.map +1 -0
- package/dist/{agent-runtime-sqlite-node.js → entrypoints/agent-runtime/sqlite/node.js} +8 -6
- package/dist/entrypoints/agent-runtime/testing.d.ts +4 -0
- package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/testing.js +1084 -0
- package/dist/{agent-runtime.d.ts → entrypoints/agent-runtime.d.ts} +41 -37
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -0
- package/dist/{agent-runtime.js → entrypoints/agent-runtime.js} +408 -366
- package/dist/{application-diagnostic-journal.d.ts → entrypoints/application/diagnostic-journal.d.ts} +2 -2
- package/dist/entrypoints/application/diagnostic-journal.d.ts.map +1 -0
- package/dist/{application-diagnostic-journal.js → entrypoints/application/diagnostic-journal.js} +3 -3
- package/dist/{application-grammy.d.ts → entrypoints/application/grammy.d.ts} +2 -2
- package/dist/entrypoints/application/grammy.d.ts.map +1 -0
- package/dist/{application-grammy.js → entrypoints/application/grammy.js} +2 -2
- package/dist/{application-opentelemetry.d.ts → entrypoints/application/opentelemetry.d.ts} +2 -2
- package/dist/entrypoints/application/opentelemetry.d.ts.map +1 -0
- package/dist/{application-opentelemetry.js → entrypoints/application/opentelemetry.js} +4 -4
- package/dist/{application-schemas.d.ts → entrypoints/application/schemas.d.ts} +2 -2
- package/dist/entrypoints/application/schemas.d.ts.map +1 -0
- package/dist/{application-schemas.js → entrypoints/application/schemas.js} +2 -2
- package/dist/{application.d.ts → entrypoints/application.d.ts} +22 -21
- package/dist/entrypoints/application.d.ts.map +1 -0
- package/dist/{application.js → entrypoints/application.js} +24 -22
- package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -0
- package/dist/{upgrade-cli.js → entrypoints/bin/upgrade-cli.js} +3 -3
- package/dist/{cli.d.ts → entrypoints/cli.d.ts} +15 -15
- package/dist/entrypoints/cli.d.ts.map +1 -0
- package/dist/{cli.js → entrypoints/cli.js} +37 -32
- package/dist/entrypoints/contract.d.ts +9 -0
- package/dist/entrypoints/contract.d.ts.map +1 -0
- package/dist/{contract/index.js → entrypoints/contract.js} +14 -6
- package/dist/entrypoints/declaration.d.ts +2 -0
- package/dist/entrypoints/declaration.d.ts.map +1 -0
- package/dist/{declaration.js → entrypoints/declaration.js} +1 -1
- package/dist/{files.d.ts → entrypoints/files.d.ts} +2 -2
- package/dist/entrypoints/files.d.ts.map +1 -0
- package/dist/{files.js → entrypoints/files.js} +3 -3
- package/dist/{geo.d.ts → entrypoints/geo.d.ts} +1 -1
- package/dist/entrypoints/geo.d.ts.map +1 -0
- package/dist/{geo.js → entrypoints/geo.js} +4 -4
- package/dist/entrypoints/google.d.ts +2 -0
- package/dist/entrypoints/google.d.ts.map +1 -0
- package/dist/{google.js → entrypoints/google.js} +1 -1
- package/dist/{index.d.ts → entrypoints/index.d.ts} +14 -13
- package/dist/entrypoints/index.d.ts.map +1 -0
- package/dist/{index.js → entrypoints/index.js} +99 -33
- package/dist/{live.d.ts → entrypoints/live.d.ts} +4 -4
- package/dist/entrypoints/live.d.ts.map +1 -0
- package/dist/{live.js → entrypoints/live.js} +6 -4
- package/dist/{node.d.ts → entrypoints/node.d.ts} +11 -11
- package/dist/entrypoints/node.d.ts.map +1 -0
- package/dist/{node.js → entrypoints/node.js} +20 -16
- package/dist/entrypoints/oauth.d.ts +2 -0
- package/dist/entrypoints/oauth.d.ts.map +1 -0
- package/dist/{oauth.js → entrypoints/oauth.js} +3 -3
- package/dist/{observability/index.d.ts → entrypoints/observability.d.ts} +11 -11
- package/dist/entrypoints/observability.d.ts.map +1 -0
- package/dist/{observability/index.js → entrypoints/observability.js} +9 -11
- package/dist/entrypoints/primitives.d.ts +3 -0
- package/dist/entrypoints/primitives.d.ts.map +1 -0
- package/dist/{primitives.js → entrypoints/primitives.js} +1 -6
- package/dist/{react.d.ts → entrypoints/react.d.ts} +4 -4
- package/dist/entrypoints/react.d.ts.map +1 -0
- package/dist/{react.js → entrypoints/react.js} +3 -3
- package/dist/{release.d.ts → entrypoints/release.d.ts} +4 -4
- package/dist/entrypoints/release.d.ts.map +1 -0
- package/dist/{release.js → entrypoints/release.js} +1 -1
- package/dist/{remote.d.ts → entrypoints/remote.d.ts} +1 -1
- package/dist/entrypoints/remote.d.ts.map +1 -0
- package/dist/entrypoints/remote.js +66 -0
- package/dist/{server/index.d.ts → entrypoints/server.d.ts} +35 -34
- package/dist/entrypoints/server.d.ts.map +1 -0
- package/dist/{server/index.js → entrypoints/server.js} +294 -244
- package/dist/{telegram.d.ts → entrypoints/telegram.d.ts} +2 -2
- package/dist/entrypoints/telegram.d.ts.map +1 -0
- package/dist/{telegram.js → entrypoints/telegram.js} +1 -1
- package/dist/entrypoints/testing.d.ts +9 -0
- package/dist/entrypoints/testing.d.ts.map +1 -0
- package/dist/{testing.js → entrypoints/testing.js} +107 -926
- package/dist/{tools/connections/index.d.ts → entrypoints/tools/connections.d.ts} +6 -7
- package/dist/entrypoints/tools/connections.d.ts.map +1 -0
- package/dist/{tools/connections/index.js → entrypoints/tools/connections.js} +7 -4
- package/dist/{tools-contract.d.ts → entrypoints/tools/contract.d.ts} +5 -5
- package/dist/entrypoints/tools/contract.d.ts.map +1 -0
- package/dist/{tools-contract.js → entrypoints/tools/contract.js} +4 -4
- package/dist/{tool-invoker.d.ts → entrypoints/tools/invoker.d.ts} +2 -2
- package/dist/entrypoints/tools/invoker.d.ts.map +1 -0
- package/dist/entrypoints/tools/invoker.js +20 -0
- package/dist/entrypoints/tools.d.ts +51 -0
- package/dist/entrypoints/tools.d.ts.map +1 -0
- package/dist/{tools.js → entrypoints/tools.js} +1787 -1751
- package/dist/{tracking-server.d.ts → entrypoints/tracking/server.d.ts} +8 -8
- package/dist/entrypoints/tracking/server.d.ts.map +1 -0
- package/dist/{tracking.d.ts → entrypoints/tracking.d.ts} +15 -15
- package/dist/entrypoints/tracking.d.ts.map +1 -0
- package/dist/{tracking.js → entrypoints/tracking.js} +5 -8
- package/dist/google/google.d.ts.map +1 -0
- package/dist/{index-a916km3r.js → index-0b1ess5e.js} +6 -13
- package/dist/{index-zwkgfq1s.js → index-1nd48tm9.js} +113 -118
- package/dist/{index-7zbps32p.js → index-1zbbzgfh.js} +2 -2
- package/dist/{index-mzvgxp0n.js → index-2cr1cqhn.js} +16 -4
- package/dist/{index-f9mb610r.js → index-35mh5bhj.js} +2 -2
- package/dist/index-48ffdxgk.js +6 -0
- package/dist/index-58k4fp34.js +1023 -0
- package/dist/{index-p13mwz16.js → index-83bdg97s.js} +1 -1
- package/dist/index-97ac4gph.js +3618 -0
- package/dist/{index-kw9t5ayn.js → index-cq4qfycf.js} +5 -5
- package/dist/{index-7gnkny4z.js → index-d9pk3td4.js} +1 -1
- package/dist/{index-e42wzzz5.js → index-dcpdvjsc.js} +7 -7
- package/dist/{index-h9etkkyk.js → index-dydjcp8z.js} +102 -25
- package/dist/{index-sr93cwf9.js → index-e2z3ahw9.js} +2 -2
- package/dist/{index-yewwh1w4.js → index-e87kakm4.js} +96 -11
- package/dist/{index-cby4ar3v.js → index-eqqvgdb3.js} +1 -1
- package/dist/index-fdp6hdxn.js +942 -0
- package/dist/{index-0a349c33.js → index-gyr48nzg.js} +125 -198
- package/dist/{index-wnfk50r0.js → index-h6eeys1v.js} +1 -1
- package/dist/{index-77fekveh.js → index-hffjpmq9.js} +1 -15
- package/dist/{index-yn8remb1.js → index-j05z5gn4.js} +50 -14
- package/dist/index-k5hsfc3j.js +31 -0
- package/dist/{index-fq77yfzc.js → index-kj2wbeta.js} +1 -1
- package/dist/index-kvj7f4hq.js +39 -0
- package/dist/{index-4fpa9dy2.js → index-m9zn6cpq.js} +2 -2
- package/dist/{index-2na0qrfn.js → index-mdzh02yc.js} +7 -7
- package/dist/{index-ywd0y6m1.js → index-mkm15s49.js} +1 -1
- package/dist/index-mp5sn43f.js +1084 -0
- package/dist/{index-7n145nbe.js → index-n6hxg8as.js} +530 -387
- package/dist/index-ngfhvfpd.js +30 -0
- package/dist/{index-e0znv5gn.js → index-p5r7qpdd.js} +2 -93
- package/dist/{index-n0f51dfn.js → index-p81267c2.js} +608 -549
- package/dist/{index-wc4x00bn.js → index-qwhynv6x.js} +1 -1
- package/dist/index-r7nmqpsg.js +154 -0
- package/dist/{index-bx75zwt7.js → index-rewkc2hj.js} +5 -4
- package/dist/{index-9f8ztey6.js → index-sees8yf8.js} +2 -2
- package/dist/{index-vjpvjqpn.js → index-v38qyerb.js} +16 -2
- package/dist/{index-2c2bjw3s.js → index-vcvkq30w.js} +3 -3
- package/dist/index-wqgjfstn.js +18 -0
- package/dist/{index-f477k430.js → index-x4799c19.js} +1 -1
- package/dist/{index-cxqhvq21.js → index-xnj9bgxe.js} +142 -129
- package/dist/index-xsqjkha9.js +281 -0
- package/dist/{index-6kyksz9y.js → index-yw4fzmdz.js} +1 -1
- package/dist/{index-3xwxfj4z.js → index-zeemqhqx.js} +1 -1
- package/dist/{index-tmwcrptx.js → index-zfrhfn82.js} +1 -1
- package/dist/index-znfs20ss.js +98 -0
- package/dist/internal/backoff.d.ts +29 -0
- package/dist/internal/backoff.d.ts.map +1 -0
- package/dist/internal/canonical-json.d.ts +21 -11
- package/dist/internal/canonical-json.d.ts.map +1 -1
- package/dist/internal/channel.d.ts.map +1 -0
- package/dist/internal/logger.d.ts.map +1 -0
- package/dist/internal/request.d.ts.map +1 -0
- package/dist/internal/secure-fetch.d.ts +12 -0
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/internal/stable-digest.d.ts +0 -43
- package/dist/internal/stable-digest.d.ts.map +1 -1
- package/dist/internal/typed.d.ts +0 -8
- package/dist/internal/typed.d.ts.map +1 -1
- package/dist/internal/zod-issues.d.ts +38 -0
- package/dist/internal/zod-issues.d.ts.map +1 -0
- package/dist/{tools/json-schema-dialect.d.ts → json-schema/dialect.d.ts} +1 -1
- package/dist/json-schema/dialect.d.ts.map +1 -0
- package/dist/json-schema/json-schema.d.ts.map +1 -0
- package/dist/live/watch-delta.d.ts.map +1 -1
- package/dist/{oauth.d.ts → oauth/authorization-code.d.ts} +1 -1
- package/dist/oauth/authorization-code.d.ts.map +1 -0
- package/dist/observability/audit.d.ts +2 -2
- package/dist/observability/audit.d.ts.map +1 -1
- package/dist/observability/bounded-logger.d.ts +1 -1
- package/dist/observability/bounded-logger.d.ts.map +1 -1
- package/dist/{internal/observability-sink.d.ts → observability/bounded-sink.d.ts} +2 -2
- package/dist/observability/bounded-sink.d.ts.map +1 -0
- package/dist/observability/context.d.ts +1 -1
- package/dist/observability/context.d.ts.map +1 -1
- package/dist/observability/event.d.ts +1 -1
- package/dist/observability/event.d.ts.map +1 -1
- package/dist/observability/work.d.ts +1 -1
- package/dist/observability/work.d.ts.map +1 -1
- package/dist/primitives/audit.d.ts +1 -1
- package/dist/primitives/audit.d.ts.map +1 -1
- package/dist/primitives/export-operation.d.ts +4 -2
- package/dist/primitives/export-operation.d.ts.map +1 -1
- package/dist/realtime/socket.d.ts +1 -1
- package/dist/realtime/socket.d.ts.map +1 -1
- package/dist/server/context-contribution.d.ts +1 -1
- package/dist/server/context-contribution.d.ts.map +1 -1
- package/dist/server/context.d.ts +2 -2
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/contract-method.d.ts +15 -0
- package/dist/server/contract-method.d.ts.map +1 -0
- package/dist/server/contract-stream.d.ts +1 -1
- package/dist/server/contract-stream.d.ts.map +1 -1
- package/dist/server/create.d.ts +8 -0
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/endpoint-dispatch.d.ts +10 -0
- package/dist/server/endpoint-dispatch.d.ts.map +1 -0
- package/dist/server/endpoint-response.d.ts +18 -0
- package/dist/server/endpoint-response.d.ts.map +1 -0
- package/dist/server/error-dispatch.d.ts +17 -1
- package/dist/server/error-dispatch.d.ts.map +1 -1
- package/dist/server/error-hook.d.ts +2 -2
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts +44 -0
- package/dist/server/handler-state.d.ts.map +1 -0
- package/dist/server/implement.d.ts +1 -1
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/middleware/auth.d.ts +1 -1
- package/dist/server/middleware/auth.d.ts.map +1 -1
- package/dist/server/middleware/cors.d.ts +17 -0
- package/dist/server/middleware/cors.d.ts.map +1 -1
- package/dist/server/middleware/trust-fence.d.ts +1 -1
- package/dist/server/middleware/trust-fence.d.ts.map +1 -1
- package/dist/server/multipart.d.ts +1 -1
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/{tools/oauth-metadata.d.ts → server/oauth/metadata.d.ts} +2 -2
- package/dist/server/oauth/metadata.d.ts.map +1 -0
- package/dist/{tools/oauth-provider.d.ts → server/oauth/provider.d.ts} +2 -2
- package/dist/server/oauth/provider.d.ts.map +1 -0
- package/dist/server/realtime.d.ts +1 -1
- package/dist/server/realtime.d.ts.map +1 -1
- package/dist/server/request-completion.d.ts +16 -0
- package/dist/server/request-completion.d.ts.map +1 -0
- package/dist/server/response-metadata.d.ts +1 -1
- package/dist/server/response-metadata.d.ts.map +1 -1
- package/dist/server/route-table.d.ts +9 -0
- package/dist/server/route-table.d.ts.map +1 -0
- package/dist/server/stream.d.ts +0 -13
- package/dist/server/stream.d.ts.map +1 -1
- package/dist/server/types.d.ts +7 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/testing/handler-clients.d.ts +31 -0
- package/dist/testing/handler-clients.d.ts.map +1 -0
- package/dist/testing/managed-resource-conformance-scenarios.d.ts.map +1 -1
- package/dist/testing/surface-conformance.d.ts +2 -1
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest.d.ts +64 -5
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/{cli-args.d.ts → cli/args.d.ts} +1 -1
- package/dist/tools/cli/args.d.ts.map +1 -0
- package/dist/tools/{cli-checkpoint.d.ts → cli/checkpoint.d.ts} +1 -1
- package/dist/tools/cli/checkpoint.d.ts.map +1 -0
- package/dist/tools/{cli-command.d.ts → cli/command.d.ts} +22 -4
- package/dist/tools/cli/command.d.ts.map +1 -0
- package/dist/tools/{cli.d.ts → cli/config.d.ts} +5 -12
- package/dist/tools/cli/config.d.ts.map +1 -0
- package/dist/tools/cli/create-cli.d.ts +36 -0
- package/dist/tools/cli/create-cli.d.ts.map +1 -0
- package/dist/tools/cli/download.d.ts +8 -0
- package/dist/tools/cli/download.d.ts.map +1 -0
- package/dist/tools/{cli-format.d.ts → cli/format.d.ts} +2 -2
- package/dist/tools/cli/format.d.ts.map +1 -0
- package/dist/tools/cli/help.d.ts +24 -0
- package/dist/tools/cli/help.d.ts.map +1 -0
- package/dist/tools/{cli-installer.d.ts → cli/installer.d.ts} +2 -2
- package/dist/tools/cli/installer.d.ts.map +1 -0
- package/dist/tools/{cli-invoke.d.ts → cli/invoke.d.ts} +35 -10
- package/dist/tools/cli/invoke.d.ts.map +1 -0
- package/dist/tools/cli/io.d.ts +10 -0
- package/dist/tools/cli/io.d.ts.map +1 -0
- package/dist/tools/cli/managed-surface.d.ts +30 -0
- package/dist/tools/cli/managed-surface.d.ts.map +1 -0
- package/dist/tools/{cli-manifest.d.ts → cli/manifest.d.ts} +1 -1
- package/dist/tools/cli/manifest.d.ts.map +1 -0
- package/dist/tools/{cli-policy.d.ts → cli/policy.d.ts} +2 -2
- package/dist/tools/cli/policy.d.ts.map +1 -0
- package/dist/tools/cli/prepare.d.ts +14 -0
- package/dist/tools/cli/prepare.d.ts.map +1 -0
- package/dist/tools/{cli-profile.d.ts → cli/profile.d.ts} +2 -2
- package/dist/tools/cli/profile.d.ts.map +1 -0
- package/dist/tools/cli/run-managed.d.ts +5 -0
- package/dist/tools/cli/run-managed.d.ts.map +1 -0
- package/dist/tools/cli/run-native.d.ts +9 -0
- package/dist/tools/cli/run-native.d.ts.map +1 -0
- package/dist/tools/cli/session.d.ts +40 -0
- package/dist/tools/cli/session.d.ts.map +1 -0
- package/dist/tools/{cli-signature.d.ts → cli/signature.d.ts} +2 -2
- package/dist/tools/cli/signature.d.ts.map +1 -0
- package/dist/tools/{cli-stream.d.ts → cli/stream.d.ts} +4 -4
- package/dist/tools/cli/stream.d.ts.map +1 -0
- package/dist/tools/{cli-update.d.ts → cli/update.d.ts} +3 -3
- package/dist/tools/cli/update.d.ts.map +1 -0
- package/dist/tools/{cli-view.d.ts → cli/view.d.ts} +2 -2
- package/dist/tools/cli/view.d.ts.map +1 -0
- package/dist/tools/{cli-wait.d.ts → cli/wait.d.ts} +2 -2
- package/dist/tools/cli/wait.d.ts.map +1 -0
- package/dist/tools/connections/runtime.d.ts +1 -1
- package/dist/tools/connections/runtime.d.ts.map +1 -1
- package/dist/tools/connections/types.d.ts +3 -3
- package/dist/tools/connections/types.d.ts.map +1 -1
- package/dist/tools/durability-context.d.ts +1 -1
- package/dist/tools/durability-context.d.ts.map +1 -1
- package/dist/tools/execute.d.ts +30 -3
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts +8 -6
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/internal/tool-view.d.ts +41 -0
- package/dist/tools/internal/tool-view.d.ts.map +1 -0
- package/dist/tools/invoker.d.ts +11 -3
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/list-names.d.ts +3 -3
- package/dist/tools/list-names.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +2 -2
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools/{mcp-app.d.ts → mcp/app.d.ts} +1 -1
- package/dist/tools/mcp/app.d.ts.map +1 -0
- package/dist/tools/{mcp-catalog.d.ts → mcp/catalog.d.ts} +2 -2
- package/dist/tools/mcp/catalog.d.ts.map +1 -0
- package/dist/tools/{mcp-handler.d.ts → mcp/handler.d.ts} +5 -5
- package/dist/tools/mcp/handler.d.ts.map +1 -0
- package/dist/tools/{mcp.d.ts → mcp/mount.d.ts} +9 -9
- package/dist/tools/mcp/mount.d.ts.map +1 -0
- package/dist/tools/{mcp-prepare.d.ts → mcp/prepare.d.ts} +9 -9
- package/dist/tools/mcp/prepare.d.ts.map +1 -0
- package/dist/tools/{mcp-progress.d.ts → mcp/progress.d.ts} +2 -2
- package/dist/tools/mcp/progress.d.ts.map +1 -0
- package/dist/tools/mcp/register.d.ts +35 -0
- package/dist/tools/mcp/register.d.ts.map +1 -0
- package/dist/tools/{mcp-round-policy.d.ts → mcp/round-policy.d.ts} +2 -2
- package/dist/tools/mcp/round-policy.d.ts.map +1 -0
- package/dist/tools/{mcp-round.d.ts → mcp/round.d.ts} +4 -4
- package/dist/tools/mcp/round.d.ts.map +1 -0
- package/dist/tools/mcp/runtime-tools.d.ts +24 -0
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -0
- package/dist/tools/{mcp-stdio-signals.d.ts → mcp/stdio-signals.d.ts} +3 -3
- package/dist/tools/mcp/stdio-signals.d.ts.map +1 -0
- package/dist/tools/{mcp-stdio.d.ts → mcp/stdio.d.ts} +4 -4
- package/dist/tools/mcp/stdio.d.ts.map +1 -0
- package/dist/tools/{mcp-trace.d.ts → mcp/trace.d.ts} +1 -1
- package/dist/tools/mcp/trace.d.ts.map +1 -0
- package/dist/tools/mount.d.ts +12 -7
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/native-definition.d.ts +3 -3
- package/dist/tools/native-definition.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-binding-types.d.ts +127 -0
- package/dist/tools/operations/async-operation-binding-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-binding.d.ts +28 -0
- package/dist/tools/operations/async-operation-binding.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-canonical-types.d.ts +110 -0
- package/dist/tools/operations/async-operation-canonical-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-canonical.d.ts +7 -0
- package/dist/tools/operations/async-operation-canonical.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-contract.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-id.d.ts +23 -0
- package/dist/tools/operations/async-operation-id.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime-tools.d.ts +40 -0
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime-types.d.ts +68 -0
- package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime.d.ts +5 -0
- package/dist/tools/operations/async-operation-runtime.d.ts.map +1 -0
- package/dist/tools/{define-wait-tool.d.ts → operations/define-wait-tool.d.ts} +2 -2
- package/dist/tools/operations/define-wait-tool.d.ts.map +1 -0
- package/dist/tools/operations/mount-wait.d.ts.map +1 -0
- package/dist/tools/operations/wait-core.d.ts.map +1 -0
- package/dist/tools/remote.d.ts +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +11 -4
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/schema/coerce.d.ts.map +1 -0
- package/dist/tools/schema/flatten-join.d.ts.map +1 -0
- package/dist/tools/schema/flatten.d.ts.map +1 -0
- package/dist/tools/schema/portable-formats.d.ts.map +1 -0
- package/dist/tools/{presentation.d.ts → schema/presentation.d.ts} +2 -0
- package/dist/tools/schema/presentation.d.ts.map +1 -0
- package/dist/tools/schema/schema.d.ts.map +1 -0
- package/dist/tools/schema/untyped-properties.d.ts.map +1 -0
- package/dist/tools/surface.d.ts +2 -3
- package/dist/tools/surface.d.ts.map +1 -1
- package/dist/tools/toolkit.d.ts +4 -4
- package/dist/tools/toolkit.d.ts.map +1 -1
- package/dist/tools/{define-download-tool.d.ts → transfer/define-download-tool.d.ts} +4 -4
- package/dist/tools/transfer/define-download-tool.d.ts.map +1 -0
- package/dist/tools/{define-upload-tool.d.ts → transfer/define-upload-tool.d.ts} +3 -3
- package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -0
- package/dist/tools/{define-view-file-tool.d.ts → transfer/define-view-file-tool.d.ts} +2 -2
- package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -0
- package/dist/tools/{download-core.d.ts → transfer/download-core.d.ts} +2 -2
- package/dist/tools/transfer/download-core.d.ts.map +1 -0
- package/dist/tools/{managed-file-error.d.ts → transfer/managed-file-error.d.ts} +1 -1
- package/dist/tools/transfer/managed-file-error.d.ts.map +1 -0
- package/dist/tools/{mount-download.d.ts → transfer/mount-download.d.ts} +1 -1
- package/dist/tools/transfer/mount-download.d.ts.map +1 -0
- package/dist/tools/{mount-upload.d.ts → transfer/mount-upload.d.ts} +1 -1
- package/dist/tools/transfer/mount-upload.d.ts.map +1 -0
- package/dist/tools/transfer/native-result.d.ts.map +1 -0
- package/dist/tools/{upload-core.d.ts → transfer/upload-core.d.ts} +1 -1
- package/dist/tools/transfer/upload-core.d.ts.map +1 -0
- package/dist/tools/transfer/view-file-contract.d.ts.map +1 -0
- package/dist/tools/{view-file.d.ts → transfer/view-file.d.ts} +1 -1
- package/dist/tools/transfer/view-file.d.ts.map +1 -0
- package/dist/tools/transports.d.ts +1 -1
- package/dist/tools/transports.d.ts.map +1 -1
- package/dist/tracking/contract.d.ts +1 -1
- package/dist/tracking/contract.d.ts.map +1 -1
- package/llms/agent-runtime-browser.txt +33 -0
- package/llms/agent-runtime-coding-tools.txt +58 -0
- package/llms/agent-runtime-harness.txt +45 -0
- package/llms/agent-runtime-openrouter.txt +22 -0
- package/llms/agent-runtime-sandbox.txt +159 -0
- package/llms/agent-runtime-sqlite-bun.txt +29 -0
- package/llms/agent-runtime-sqlite-node.txt +26 -0
- package/llms/agent-runtime-testing.txt +30 -0
- package/llms/agent-runtime.2.txt +550 -0
- package/llms/agent-runtime.3.txt +311 -0
- package/llms/agent-runtime.txt +893 -0
- package/llms/application-diagnostic-journal.txt +30 -0
- package/llms/application-grammy.txt +27 -0
- package/llms/application-opentelemetry.txt +27 -0
- package/llms/application-schemas.txt +42 -0
- package/llms/application.2.txt +223 -0
- package/llms/application.txt +1144 -0
- package/llms/cli.txt +977 -0
- package/llms/contract.txt +606 -0
- package/llms/declaration.txt +286 -0
- package/llms/files.txt +30 -0
- package/llms/geo.txt +114 -0
- package/llms/google.txt +27 -0
- package/llms/live.txt +471 -0
- package/llms/node.txt +43 -0
- package/llms/oauth.txt +136 -0
- package/llms/observability.txt +893 -0
- package/llms/primitives.txt +158 -0
- package/llms/react.txt +184 -0
- package/llms/release.txt +176 -0
- package/llms/remote.txt +25 -0
- package/llms/server.2.txt +361 -0
- package/llms/server.3.txt +1031 -0
- package/llms/server.4.txt +905 -0
- package/llms/server.5.txt +250 -0
- package/llms/server.txt +996 -0
- package/llms/stitchkit.2.txt +836 -0
- package/llms/stitchkit.3.txt +147 -0
- package/llms/stitchkit.txt +260 -0
- package/llms/telegram.txt +30 -0
- package/llms/testing.txt +676 -0
- package/llms/tools-connections.txt +45 -0
- package/llms/tools-contract.txt +9 -0
- package/llms/tools-invoker.txt +9 -0
- package/llms/tools.2.txt +838 -0
- package/llms/tools.txt +1004 -0
- package/llms/tracking-server.txt +32 -0
- package/llms/tracking.txt +263 -0
- package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
- package/llms/upgrading-0.53.0-0.67.0.txt +1174 -0
- package/llms/upgrading-0.68.0-0.94.0.txt +1159 -0
- package/llms/upgrading.txt +215 -0
- package/llms-full.txt +305 -75
- package/llms.txt +54 -5
- package/package.json +84 -83
- package/dist/agent-runtime/durability-contract.d.ts.map +0 -1
- package/dist/agent-runtime/durability-json.d.ts.map +0 -1
- package/dist/agent-runtime/durability-ledger.d.ts.map +0 -1
- package/dist/agent-runtime/durability-scheduler.d.ts.map +0 -1
- package/dist/agent-runtime/durability.d.ts.map +0 -1
- package/dist/agent-runtime/store-driver.d.ts.map +0 -1
- package/dist/agent-runtime-browser.d.ts +0 -5
- package/dist/agent-runtime-browser.d.ts.map +0 -1
- package/dist/agent-runtime-coding-tools.d.ts.map +0 -1
- package/dist/agent-runtime-coding-tools.js +0 -23
- package/dist/agent-runtime-harness.d.ts.map +0 -1
- package/dist/agent-runtime-openrouter.d.ts.map +0 -1
- package/dist/agent-runtime-sandbox.d.ts.map +0 -1
- package/dist/agent-runtime-sqlite-bun.d.ts.map +0 -1
- package/dist/agent-runtime-sqlite-node.d.ts.map +0 -1
- package/dist/agent-runtime-testing.d.ts +0 -3
- package/dist/agent-runtime-testing.d.ts.map +0 -1
- package/dist/agent-runtime-testing.js +0 -156
- package/dist/agent-runtime.d.ts.map +0 -1
- package/dist/application/channel.d.ts.map +0 -1
- package/dist/application-diagnostic-journal.d.ts.map +0 -1
- package/dist/application-grammy.d.ts.map +0 -1
- package/dist/application-opentelemetry.d.ts.map +0 -1
- package/dist/application-schemas.d.ts.map +0 -1
- package/dist/application.d.ts.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/contract/index.d.ts +0 -8
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/declaration.d.ts.map +0 -1
- package/dist/files.d.ts.map +0 -1
- package/dist/geo.d.ts.map +0 -1
- package/dist/google.d.ts.map +0 -1
- package/dist/index-0j3vcp5m.js +0 -28
- package/dist/index-a11g2kry.js +0 -866
- package/dist/index-cnyk6te3.js +0 -77
- package/dist/index-fadnxwna.js +0 -1046
- package/dist/index-hrbajay7.js +0 -1196
- package/dist/index-s8cnx02s.js +0 -90
- package/dist/index-v5573g1k.js +0 -142
- package/dist/index-vk3kq9sb.js +0 -3344
- package/dist/index.d.ts.map +0 -1
- package/dist/internal/errors.d.ts.map +0 -1
- package/dist/internal/observability-sink.d.ts.map +0 -1
- package/dist/live.d.ts.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/node.d.ts.map +0 -1
- package/dist/oauth.d.ts.map +0 -1
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/primitives.d.ts +0 -3
- package/dist/primitives.d.ts.map +0 -1
- package/dist/react.d.ts.map +0 -1
- package/dist/release.d.ts.map +0 -1
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js +0 -88
- package/dist/retained.d.ts.map +0 -1
- package/dist/server/file-state-store.d.ts.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/request.d.ts.map +0 -1
- package/dist/telegram.d.ts.map +0 -1
- package/dist/testing/agent-store-conformance.d.ts.map +0 -1
- package/dist/testing.d.ts +0 -39
- package/dist/testing.d.ts.map +0 -1
- package/dist/tool-invoker.d.ts.map +0 -1
- package/dist/tool-invoker.js +0 -21
- package/dist/tools/async-operation-contract.d.ts.map +0 -1
- package/dist/tools/async-operation.d.ts +0 -332
- package/dist/tools/async-operation.d.ts.map +0 -1
- package/dist/tools/cli-args.d.ts.map +0 -1
- package/dist/tools/cli-checkpoint.d.ts.map +0 -1
- package/dist/tools/cli-command.d.ts.map +0 -1
- package/dist/tools/cli-format.d.ts.map +0 -1
- package/dist/tools/cli-installer.d.ts.map +0 -1
- package/dist/tools/cli-invoke.d.ts.map +0 -1
- package/dist/tools/cli-manifest.d.ts.map +0 -1
- package/dist/tools/cli-policy.d.ts.map +0 -1
- package/dist/tools/cli-profile.d.ts.map +0 -1
- package/dist/tools/cli-signature.d.ts.map +0 -1
- package/dist/tools/cli-stream.d.ts.map +0 -1
- package/dist/tools/cli-update.d.ts.map +0 -1
- package/dist/tools/cli-view.d.ts.map +0 -1
- package/dist/tools/cli-wait.d.ts.map +0 -1
- package/dist/tools/cli.d.ts.map +0 -1
- package/dist/tools/coerce.d.ts.map +0 -1
- package/dist/tools/connections/index.d.ts.map +0 -1
- package/dist/tools/define-download-tool.d.ts.map +0 -1
- package/dist/tools/define-upload-tool.d.ts.map +0 -1
- package/dist/tools/define-view-file-tool.d.ts.map +0 -1
- package/dist/tools/define-wait-tool.d.ts.map +0 -1
- package/dist/tools/download-core.d.ts.map +0 -1
- package/dist/tools/flatten-join.d.ts.map +0 -1
- package/dist/tools/flatten.d.ts.map +0 -1
- package/dist/tools/json-schema-dialect.d.ts.map +0 -1
- package/dist/tools/json-schema.d.ts.map +0 -1
- package/dist/tools/managed-file-error.d.ts.map +0 -1
- package/dist/tools/mcp-app.d.ts.map +0 -1
- package/dist/tools/mcp-catalog.d.ts.map +0 -1
- package/dist/tools/mcp-handler.d.ts.map +0 -1
- package/dist/tools/mcp-prepare.d.ts.map +0 -1
- package/dist/tools/mcp-progress.d.ts.map +0 -1
- package/dist/tools/mcp-round-policy.d.ts.map +0 -1
- package/dist/tools/mcp-round.d.ts.map +0 -1
- package/dist/tools/mcp-stdio-signals.d.ts.map +0 -1
- package/dist/tools/mcp-stdio.d.ts.map +0 -1
- package/dist/tools/mcp-trace.d.ts.map +0 -1
- package/dist/tools/mcp.d.ts.map +0 -1
- package/dist/tools/mount-download.d.ts.map +0 -1
- package/dist/tools/mount-upload.d.ts.map +0 -1
- package/dist/tools/mount-wait.d.ts.map +0 -1
- package/dist/tools/native-mcp.d.ts +0 -20
- package/dist/tools/native-mcp.d.ts.map +0 -1
- package/dist/tools/native-result.d.ts.map +0 -1
- package/dist/tools/oauth-metadata.d.ts.map +0 -1
- package/dist/tools/oauth-provider.d.ts.map +0 -1
- package/dist/tools/portable-formats.d.ts.map +0 -1
- package/dist/tools/presentation.d.ts.map +0 -1
- package/dist/tools/schema.d.ts.map +0 -1
- package/dist/tools/untyped-properties.d.ts.map +0 -1
- package/dist/tools/upload-core.d.ts.map +0 -1
- package/dist/tools/view-file-contract.d.ts.map +0 -1
- package/dist/tools/view-file.d.ts.map +0 -1
- package/dist/tools/wait-core.d.ts.map +0 -1
- package/dist/tools-contract.d.ts.map +0 -1
- package/dist/tools.d.ts +0 -50
- package/dist/tools.d.ts.map +0 -1
- package/dist/tracking-server.d.ts.map +0 -1
- package/dist/tracking.d.ts.map +0 -1
- package/dist/upgrade-cli.d.ts.map +0 -1
- package/dist/{retained.d.ts → browser/retained.d.ts} +0 -0
- package/dist/{declaration.d.ts → declaration/declaration.d.ts} +0 -0
- package/dist/{upgrade-cli.d.ts → entrypoints/bin/upgrade-cli.d.ts} +0 -0
- package/dist/{tracking-server.js → entrypoints/tracking/server.js} +0 -0
- package/dist/{google.d.ts → google/google.d.ts} +0 -0
- package/dist/{index-pq95qkbf.js → index-5jm36zv1.js} +0 -0
- package/dist/{index-actkayzn.js → index-70yj2ebz.js} +3 -3
- /package/dist/{application → internal}/channel.d.ts +0 -0
- /package/dist/{logger.d.ts → internal/logger.d.ts} +0 -0
- /package/dist/{server → internal}/request.d.ts +0 -0
- /package/dist/{tools → json-schema}/json-schema.d.ts +0 -0
- /package/dist/tools/{async-operation-contract.d.ts → operations/async-operation-contract.d.ts} +0 -0
- /package/dist/tools/{mount-wait.d.ts → operations/mount-wait.d.ts} +0 -0
- /package/dist/tools/{wait-core.d.ts → operations/wait-core.d.ts} +0 -0
- /package/dist/tools/{coerce.d.ts → schema/coerce.d.ts} +0 -0
- /package/dist/tools/{flatten-join.d.ts → schema/flatten-join.d.ts} +0 -0
- /package/dist/tools/{flatten.d.ts → schema/flatten.d.ts} +0 -0
- /package/dist/tools/{portable-formats.d.ts → schema/portable-formats.d.ts} +0 -0
- /package/dist/tools/{schema.d.ts → schema/schema.d.ts} +0 -0
- /package/dist/tools/{untyped-properties.d.ts → schema/untyped-properties.d.ts} +0 -0
- /package/dist/tools/{native-result.d.ts → transfer/native-result.d.ts} +0 -0
- /package/dist/tools/{view-file-contract.d.ts → transfer/view-file-contract.d.ts} +0 -0
|
@@ -1,909 +1,77 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApplication
|
|
3
|
-
} from "
|
|
4
|
-
import"
|
|
5
|
-
import"
|
|
6
|
-
import"
|
|
7
|
-
import {
|
|
8
|
-
createMemoryAgentRuntimeStore
|
|
9
|
-
} from "./index-hrbajay7.js";
|
|
10
|
-
import {
|
|
11
|
-
decodeAgentConversationArchive
|
|
12
|
-
} from "./index-zwkgfq1s.js";
|
|
13
|
-
import {
|
|
14
|
-
AgentMessageSchema,
|
|
15
|
-
AgentRunSchema
|
|
16
|
-
} from "./index-gtj3zc53.js";
|
|
17
|
-
import {
|
|
18
|
-
createAgentRaceBarrier,
|
|
19
|
-
createAgentRaceDriver,
|
|
20
|
-
createAgentRaceTrace
|
|
21
|
-
} from "./index-cnyk6te3.js";
|
|
3
|
+
} from "../index-fdp6hdxn.js";
|
|
4
|
+
import"../index-3gye9wzb.js";
|
|
5
|
+
import"../index-2k4yrqkc.js";
|
|
6
|
+
import"../index-3z73fh2c.js";
|
|
22
7
|
import {
|
|
23
8
|
RealtimeRejectDirectionSchema,
|
|
24
9
|
RealtimeRejectFaultSchema,
|
|
25
10
|
RealtimeRejectPhaseSchema,
|
|
26
11
|
RealtimeRejectReasonSchema
|
|
27
|
-
} from "
|
|
12
|
+
} from "../index-p7hgdyhb.js";
|
|
28
13
|
import {
|
|
29
14
|
createClient,
|
|
30
15
|
createClients
|
|
31
|
-
} from "
|
|
16
|
+
} from "../index-e87kakm4.js";
|
|
32
17
|
import {
|
|
33
18
|
RealtimeRequestDisconnectedError,
|
|
34
19
|
RealtimeRequestInvalidAcknowledgementError,
|
|
35
20
|
RealtimeRequestTimeoutError
|
|
36
|
-
} from "
|
|
37
|
-
import"
|
|
38
|
-
import"
|
|
39
|
-
import
|
|
40
|
-
compareCodepoints,
|
|
41
|
-
serializeCanonicalJson
|
|
42
|
-
} from "./index-0j3vcp5m.js";
|
|
43
|
-
import"./index-e0znv5gn.js";
|
|
21
|
+
} from "../index-2qzskm8h.js";
|
|
22
|
+
import"../index-48ffdxgk.js";
|
|
23
|
+
import"../index-wqgjfstn.js";
|
|
24
|
+
import"../index-zeemqhqx.js";
|
|
44
25
|
import {
|
|
26
|
+
TOOL_TRANSPORTS,
|
|
45
27
|
joinRoutePath
|
|
46
|
-
} from "
|
|
47
|
-
import"
|
|
48
|
-
import"./index-6k1937bx.js";
|
|
49
|
-
import"./index-zcgf3gqf.js";
|
|
28
|
+
} from "../index-gyr48nzg.js";
|
|
29
|
+
import"../index-zcgf3gqf.js";
|
|
50
30
|
import {
|
|
51
31
|
mcpProjectionCandidate,
|
|
52
32
|
prepareProjectedMcpTools,
|
|
53
33
|
projectToolSurface,
|
|
54
34
|
staticInputRounds
|
|
55
|
-
} from "
|
|
35
|
+
} from "../index-dydjcp8z.js";
|
|
56
36
|
import {
|
|
57
37
|
toJsonSchema
|
|
58
|
-
} from "
|
|
59
|
-
import"
|
|
60
|
-
import"
|
|
38
|
+
} from "../index-eqqvgdb3.js";
|
|
39
|
+
import"../index-znfs20ss.js";
|
|
40
|
+
import"../index-p5r7qpdd.js";
|
|
41
|
+
import"../index-2vtcmrj9.js";
|
|
42
|
+
import {
|
|
43
|
+
compareCodeUnits,
|
|
44
|
+
serializeCanonicalJson
|
|
45
|
+
} from "../index-k5hsfc3j.js";
|
|
46
|
+
import"../index-kzfs85xp.js";
|
|
61
47
|
import {
|
|
62
48
|
isRecord
|
|
63
|
-
} from "
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
role: "user",
|
|
71
|
-
status: "committed",
|
|
72
|
-
parts: [{ type: "text", text: id }],
|
|
73
|
-
createdAt: "2026-08-22T00:00:00.000Z",
|
|
74
|
-
updatedAt: "2026-08-22T00:00:00.000Z"
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function queuedRun(conversationId, inputMessageId, id) {
|
|
78
|
-
return AgentRunSchema.parse({
|
|
79
|
-
schemaVersion: 1,
|
|
80
|
-
id,
|
|
81
|
-
conversationId,
|
|
82
|
-
inputMessageIds: [inputMessageId],
|
|
83
|
-
assistantMessageId: `${id}-assistant`,
|
|
84
|
-
state: "queued",
|
|
85
|
-
revision: 0,
|
|
86
|
-
createdAt: "2026-08-22T00:00:00.000Z",
|
|
87
|
-
updatedAt: "2026-08-22T00:00:00.000Z"
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function requireOutcome(actual, expected) {
|
|
91
|
-
if (actual.outcome !== expected) {
|
|
92
|
-
throw new Error(`Agent store conformance expected ${expected}, received ${actual.outcome}`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async function runAgentStoreConformance(config) {
|
|
96
|
-
const run = `conformance-${crypto.randomUUID()}`;
|
|
97
|
-
const context = {
|
|
98
|
-
conversationIds: [
|
|
99
|
-
run,
|
|
100
|
-
`${run}-recovery`,
|
|
101
|
-
`${run}-absorb`,
|
|
102
|
-
`${run}-causal-history`,
|
|
103
|
-
`${run}-causal-active`,
|
|
104
|
-
`${run}-interrupt-priority`,
|
|
105
|
-
`${run}-ledger`,
|
|
106
|
-
`${run}-archive`,
|
|
107
|
-
`${run}-seed`
|
|
108
|
-
]
|
|
109
|
-
};
|
|
110
|
-
const store = await config.createStore(context);
|
|
111
|
-
let failure;
|
|
112
|
-
try {
|
|
113
|
-
await conformanceScenario(store, context.conversationIds);
|
|
114
|
-
} catch (error) {
|
|
115
|
-
failure = error;
|
|
116
|
-
}
|
|
117
|
-
try {
|
|
118
|
-
await config.cleanup?.(context);
|
|
119
|
-
} catch (cleanupError) {
|
|
120
|
-
if (failure === undefined)
|
|
121
|
-
throw cleanupError;
|
|
122
|
-
throw new AggregateError([failure, cleanupError], `${failure instanceof Error ? failure.message : String(failure)} (cleanup also failed: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)})`);
|
|
49
|
+
} from "../index-hffjpmq9.js";
|
|
50
|
+
|
|
51
|
+
// src/testing/handler-clients.ts
|
|
52
|
+
function resolveTestBaseUrl(origin, pathPrefix) {
|
|
53
|
+
const base = new URL(origin ?? "http://stitchkit.test");
|
|
54
|
+
if (base.pathname !== "/" || base.search || base.hash) {
|
|
55
|
+
throw new TypeError("Handler test client origin must contain only an absolute origin");
|
|
123
56
|
}
|
|
124
|
-
|
|
125
|
-
|
|
57
|
+
const prefix = pathPrefix?.replace(/^\/+|\/+$/g, "");
|
|
58
|
+
return prefix ? `${base.origin}/${prefix}` : base.origin;
|
|
126
59
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
conversationId,
|
|
130
|
-
seedKey: "brief",
|
|
131
|
-
inputs: [userMessage(conversationId, "seed-a"), userMessage(conversationId, "seed-b")]
|
|
132
|
-
};
|
|
133
|
-
const first = await store.seedConversationInput(input);
|
|
134
|
-
requireOutcome(first, "applied");
|
|
135
|
-
const before = await store.loadSnapshot(conversationId);
|
|
136
|
-
if (before.messages.map((message) => message.id).join(",") !== "seed-a,seed-b")
|
|
137
|
-
throw new Error("Seed conformance: complete ordered seed missing");
|
|
138
|
-
await Promise.all([store.seedConversationInput(input), store.seedConversationInput(input)]);
|
|
139
|
-
const repeated = await store.loadSnapshot(conversationId);
|
|
140
|
-
if (repeated.version !== before.version || repeated.messages.length !== 2)
|
|
141
|
-
throw new Error("Seed conformance: replay changed history");
|
|
142
|
-
const compacted = await store.replaceCompactedRange({
|
|
143
|
-
conversationId,
|
|
144
|
-
expectedVersion: repeated.version,
|
|
145
|
-
replacedMessageIds: ["seed-a", "seed-b"],
|
|
146
|
-
summary: AgentMessageSchema.parse({
|
|
147
|
-
...userMessage(conversationId, "seed-summary"),
|
|
148
|
-
role: "summary"
|
|
149
|
-
})
|
|
150
|
-
});
|
|
151
|
-
requireOutcome(compacted, "applied");
|
|
152
|
-
await store.seedConversationInput(input);
|
|
153
|
-
const after = await store.loadSnapshot(conversationId);
|
|
154
|
-
if (after.messages.some((message) => message.id === "seed-a" || message.id === "seed-b"))
|
|
155
|
-
throw new Error("Seed conformance: compacted instructions resurrected");
|
|
60
|
+
function createHandlerFetch(handler, server) {
|
|
61
|
+
return async (input, init) => handler(new Request(input, init), server);
|
|
156
62
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
causalHistoryConversationId,
|
|
163
|
-
causalActiveConversationId,
|
|
164
|
-
interruptPriorityConversationId,
|
|
165
|
-
ledgerConversationId,
|
|
166
|
-
archiveConversationId,
|
|
167
|
-
seedConversationId
|
|
168
|
-
] = conversationIds;
|
|
169
|
-
if (seedConversationId)
|
|
170
|
-
await seedScenario(store, seedConversationId);
|
|
171
|
-
if (ledgerConversationId)
|
|
172
|
-
await ledgerScenario(store, ledgerConversationId);
|
|
173
|
-
if (archiveConversationId)
|
|
174
|
-
await archiveScenario(store, archiveConversationId);
|
|
175
|
-
if (!conversationId || !recoveryConversationId || !absorbConversationId || !causalHistoryConversationId || !causalActiveConversationId || !interruptPriorityConversationId) {
|
|
176
|
-
throw new Error("Agent store conformance requires six conversation identities");
|
|
177
|
-
}
|
|
178
|
-
const absentConversationId = `${conversationId}-absent`;
|
|
179
|
-
const firstInput = userMessage(conversationId, "input-1");
|
|
180
|
-
const firstRun = queuedRun(conversationId, firstInput.id, "run-1");
|
|
181
|
-
const accepted = await store.acceptInputAndAssignRun({
|
|
182
|
-
idempotencyKey: "request-1",
|
|
183
|
-
input: firstInput,
|
|
184
|
-
run: firstRun
|
|
185
|
-
});
|
|
186
|
-
requireOutcome(accepted, "applied");
|
|
187
|
-
const duplicate = await store.acceptInputAndAssignRun({
|
|
188
|
-
idempotencyKey: "request-1",
|
|
189
|
-
input: userMessage(conversationId, "discarded-input"),
|
|
190
|
-
run: queuedRun(conversationId, "discarded-input", "discarded-run")
|
|
191
|
-
});
|
|
192
|
-
requireOutcome(duplicate, "duplicate");
|
|
193
|
-
if (duplicate.input.id !== firstInput.id || duplicate.inputMessageId !== firstInput.id || duplicate.runId !== firstRun.id || duplicate.assistantMessageId !== firstRun.assistantMessageId) {
|
|
194
|
-
throw new Error("Duplicate admission did not return its original durable identity");
|
|
195
|
-
}
|
|
196
|
-
const secondInput = userMessage(conversationId, "input-2");
|
|
197
|
-
const coalesced = await store.acceptInputAndAssignRun({
|
|
198
|
-
idempotencyKey: "request-2",
|
|
199
|
-
input: secondInput,
|
|
200
|
-
run: queuedRun(conversationId, secondInput.id, "discarded-coalesced-run"),
|
|
201
|
-
coalesceIntoRunId: firstRun.id
|
|
202
|
-
});
|
|
203
|
-
requireOutcome(coalesced, "applied");
|
|
204
|
-
const assigned = coalesced.snapshot.runs.find((run) => run.id === firstRun.id);
|
|
205
|
-
if (assigned?.inputMessageIds.join(",") !== "input-1,input-2") {
|
|
206
|
-
throw new Error("Coalesced admission did not preserve ordered input identities");
|
|
207
|
-
}
|
|
208
|
-
const collidingInput = userMessage(conversationId, assigned.assistantMessageId);
|
|
209
|
-
await store.acceptInputAndAssignRun({
|
|
210
|
-
idempotencyKey: "request-collision",
|
|
211
|
-
input: collidingInput,
|
|
212
|
-
run: queuedRun(conversationId, collidingInput.id, "discarded-collision-run"),
|
|
213
|
-
coalesceIntoRunId: assigned.id
|
|
214
|
-
}).then(() => {
|
|
215
|
-
throw new Error("Coalesced input reused the reserved assistant identity");
|
|
216
|
-
}, (error) => {
|
|
217
|
-
if (!(error instanceof TypeError))
|
|
218
|
-
throw error;
|
|
219
|
-
});
|
|
220
|
-
await store.replaceCompactedRange({
|
|
221
|
-
conversationId,
|
|
222
|
-
expectedVersion: coalesced.snapshot.version,
|
|
223
|
-
replacedMessageIds: [firstInput.id, secondInput.id],
|
|
224
|
-
summary: AgentMessageSchema.parse({
|
|
225
|
-
schemaVersion: 1,
|
|
226
|
-
id: assigned.assistantMessageId,
|
|
227
|
-
conversationId,
|
|
228
|
-
role: "summary",
|
|
229
|
-
status: "committed",
|
|
230
|
-
parts: [{ type: "text", text: "invalid reserved identity" }],
|
|
231
|
-
createdAt: "2026-08-22T00:00:02.000Z",
|
|
232
|
-
updatedAt: "2026-08-22T00:00:02.000Z"
|
|
233
|
-
})
|
|
234
|
-
}).then(() => {
|
|
235
|
-
throw new Error("Compaction reused a reserved assistant identity");
|
|
236
|
-
}, (error) => {
|
|
237
|
-
if (!(error instanceof TypeError))
|
|
238
|
-
throw error;
|
|
239
|
-
});
|
|
240
|
-
const compacted = await store.replaceCompactedRange({
|
|
241
|
-
conversationId,
|
|
242
|
-
expectedVersion: coalesced.snapshot.version,
|
|
243
|
-
replacedMessageIds: [firstInput.id, secondInput.id],
|
|
244
|
-
summary: AgentMessageSchema.parse({
|
|
245
|
-
schemaVersion: 1,
|
|
246
|
-
id: "summary-1",
|
|
247
|
-
conversationId,
|
|
248
|
-
role: "summary",
|
|
249
|
-
status: "committed",
|
|
250
|
-
parts: [{ type: "text", text: "two inputs" }],
|
|
251
|
-
createdAt: "2026-08-22T00:00:02.000Z",
|
|
252
|
-
updatedAt: "2026-08-22T00:00:02.000Z"
|
|
253
|
-
})
|
|
254
|
-
});
|
|
255
|
-
requireOutcome(compacted, "applied");
|
|
256
|
-
const duplicateAfterCompaction = await store.acceptInputAndAssignRun({
|
|
257
|
-
idempotencyKey: "request-1",
|
|
258
|
-
input: userMessage(conversationId, "discarded-after-compaction"),
|
|
259
|
-
run: queuedRun(conversationId, "discarded-after-compaction", "discarded-run-2")
|
|
260
|
-
});
|
|
261
|
-
requireOutcome(duplicateAfterCompaction, "duplicate");
|
|
262
|
-
if (duplicateAfterCompaction.input.id !== firstInput.id) {
|
|
263
|
-
throw new Error("Compaction discarded the canonical duplicate admission input");
|
|
264
|
-
}
|
|
265
|
-
const acquired = await store.acquireRun({
|
|
266
|
-
conversationId,
|
|
267
|
-
runId: assigned.id,
|
|
268
|
-
expectedRevision: assigned.revision,
|
|
269
|
-
ownerId: "conformance-owner"
|
|
270
|
-
});
|
|
271
|
-
requireOutcome(acquired, "applied");
|
|
272
|
-
const running = acquired.snapshot.runs.find((run) => run.id === assigned.id);
|
|
273
|
-
if (!running)
|
|
274
|
-
throw new Error("Acquired run disappeared");
|
|
275
|
-
const stale = await store.checkpointRunAssistant({
|
|
276
|
-
conversationId,
|
|
277
|
-
runId: running.id,
|
|
278
|
-
expectedRevision: running.revision - 1,
|
|
279
|
-
ownerId: "conformance-owner",
|
|
280
|
-
assistant: AgentMessageSchema.parse({
|
|
281
|
-
schemaVersion: 1,
|
|
282
|
-
id: running.assistantMessageId,
|
|
283
|
-
conversationId,
|
|
284
|
-
runId: running.id,
|
|
285
|
-
role: "assistant",
|
|
286
|
-
status: "streaming",
|
|
287
|
-
parts: [],
|
|
288
|
-
createdAt: "2026-08-22T00:00:00.000Z",
|
|
289
|
-
updatedAt: "2026-08-22T00:00:01.000Z"
|
|
290
|
-
})
|
|
291
|
-
});
|
|
292
|
-
requireOutcome(stale, "conflict");
|
|
293
|
-
await store.recoverRun({
|
|
294
|
-
conversationId,
|
|
295
|
-
runId: running.id,
|
|
296
|
-
expectedRevision: running.revision,
|
|
297
|
-
action: "requeue"
|
|
298
|
-
}).then(() => {
|
|
299
|
-
throw new Error("Acquired recovery replayed without explicit safety evidence");
|
|
300
|
-
}, (error) => {
|
|
301
|
-
if (!(error instanceof TypeError))
|
|
302
|
-
throw error;
|
|
303
|
-
});
|
|
304
|
-
const checkpoint = await store.checkpointRunAssistant({
|
|
305
|
-
conversationId,
|
|
306
|
-
runId: running.id,
|
|
307
|
-
expectedRevision: running.revision,
|
|
308
|
-
ownerId: "conformance-owner",
|
|
309
|
-
assistant: AgentMessageSchema.parse({
|
|
310
|
-
schemaVersion: 1,
|
|
311
|
-
id: running.assistantMessageId,
|
|
312
|
-
conversationId,
|
|
313
|
-
runId: running.id,
|
|
314
|
-
role: "assistant",
|
|
315
|
-
status: "streaming",
|
|
316
|
-
parts: [{ type: "text", text: "checkpoint" }],
|
|
317
|
-
createdAt: "2026-08-22T00:00:00.000Z",
|
|
318
|
-
updatedAt: "2026-08-22T00:00:01.000Z"
|
|
319
|
-
}),
|
|
320
|
-
usage: {
|
|
321
|
-
inputTokens: { value: 1000, provenance: "provider-reported" },
|
|
322
|
-
outputTokens: { value: 100, provenance: "provider-reported" },
|
|
323
|
-
cost: { value: 0.25, currency: "USD", provenance: "provider-reported" }
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
requireOutcome(checkpoint, "applied");
|
|
327
|
-
const checkpointedRun = checkpoint.snapshot.runs.find((run) => run.id === running.id);
|
|
328
|
-
if (!checkpointedRun)
|
|
329
|
-
throw new Error("Checkpointed run disappeared");
|
|
330
|
-
if (checkpointedRun.usage?.cost?.value !== 0.25) {
|
|
331
|
-
throw new Error("Checkpoint did not persist the run usage it was given");
|
|
332
|
-
}
|
|
333
|
-
const terminalAssistant = AgentMessageSchema.parse({
|
|
334
|
-
schemaVersion: 1,
|
|
335
|
-
id: running.assistantMessageId,
|
|
336
|
-
conversationId,
|
|
337
|
-
runId: running.id,
|
|
338
|
-
role: "assistant",
|
|
339
|
-
status: "completed",
|
|
340
|
-
parts: [{ type: "text", text: "done" }],
|
|
341
|
-
createdAt: "2026-08-22T00:00:00.000Z",
|
|
342
|
-
updatedAt: "2026-08-22T00:00:02.000Z"
|
|
343
|
-
});
|
|
344
|
-
if (checkpointedRun.fencingToken === undefined) {
|
|
345
|
-
throw new Error("Acquisition must persist a fencing token the store can read back");
|
|
346
|
-
}
|
|
347
|
-
const staleFence = await store.checkpointRunAssistant({
|
|
348
|
-
conversationId,
|
|
349
|
-
runId: running.id,
|
|
350
|
-
expectedRevision: checkpointedRun.revision,
|
|
351
|
-
ownerId: "conformance-owner",
|
|
352
|
-
fencingToken: checkpointedRun.fencingToken + 1,
|
|
353
|
-
assistant: AgentMessageSchema.parse({
|
|
354
|
-
schemaVersion: 1,
|
|
355
|
-
id: running.assistantMessageId,
|
|
356
|
-
conversationId,
|
|
357
|
-
runId: running.id,
|
|
358
|
-
role: "assistant",
|
|
359
|
-
status: "streaming",
|
|
360
|
-
parts: [{ type: "text", text: "stale fence" }],
|
|
361
|
-
createdAt: "2026-08-22T00:00:00.000Z",
|
|
362
|
-
updatedAt: "2026-08-22T00:00:01.500Z"
|
|
363
|
-
})
|
|
364
|
-
});
|
|
365
|
-
if (staleFence.outcome !== "conflict") {
|
|
366
|
-
throw new Error("A checkpoint with a stale fencing token must conflict");
|
|
367
|
-
}
|
|
368
|
-
const foreignOwner = await store.checkpointRunAssistant({
|
|
369
|
-
conversationId,
|
|
370
|
-
runId: running.id,
|
|
371
|
-
expectedRevision: checkpointedRun.revision,
|
|
372
|
-
ownerId: "a-different-runtime",
|
|
373
|
-
assistant: AgentMessageSchema.parse({
|
|
374
|
-
schemaVersion: 1,
|
|
375
|
-
id: running.assistantMessageId,
|
|
376
|
-
conversationId,
|
|
377
|
-
runId: running.id,
|
|
378
|
-
role: "assistant",
|
|
379
|
-
status: "streaming",
|
|
380
|
-
parts: [{ type: "text", text: "foreign owner" }],
|
|
381
|
-
createdAt: "2026-08-22T00:00:00.000Z",
|
|
382
|
-
updatedAt: "2026-08-22T00:00:01.700Z"
|
|
383
|
-
})
|
|
384
|
-
});
|
|
385
|
-
if (foreignOwner.outcome !== "conflict") {
|
|
386
|
-
throw new Error("A checkpoint from another owner must conflict");
|
|
387
|
-
}
|
|
388
|
-
const liveView = await store.loadRun({ conversationId, runId: running.id });
|
|
389
|
-
if (!liveView)
|
|
390
|
-
throw new Error("loadRun must find a run of this conversation");
|
|
391
|
-
if (liveView.run.id !== running.id || liveView.run.conversationId !== conversationId) {
|
|
392
|
-
throw new Error("loadRun returned a run it was not asked for");
|
|
393
|
-
}
|
|
394
|
-
if (liveView.run.revision !== checkpointedRun.revision) {
|
|
395
|
-
throw new Error("loadRun must return the run as the last mutation left it");
|
|
396
|
-
}
|
|
397
|
-
if (liveView.run.usage?.cost?.value !== 0.25) {
|
|
398
|
-
throw new Error("loadRun must carry the figure the run has spent so far");
|
|
399
|
-
}
|
|
400
|
-
if (liveView.snapshotVersion !== checkpoint.snapshot.version) {
|
|
401
|
-
throw new Error("loadRun must report the conversation version it read at");
|
|
402
|
-
}
|
|
403
|
-
if (liveView.assistant !== undefined) {
|
|
404
|
-
throw new Error("loadRun must not report a terminal answer for a live run");
|
|
405
|
-
}
|
|
406
|
-
if (await store.loadRun({ conversationId, runId: "no-such-run" })) {
|
|
407
|
-
throw new Error("loadRun must return undefined for an unknown run");
|
|
408
|
-
}
|
|
409
|
-
if (await store.loadRun({ conversationId: absentConversationId, runId: running.id })) {
|
|
410
|
-
throw new Error("loadRun must not cross conversation boundaries");
|
|
411
|
-
}
|
|
412
|
-
const activeRuns = await store.listActiveRuns(conversationId);
|
|
413
|
-
if (!activeRuns.some((run) => run.id === running.id)) {
|
|
414
|
-
throw new Error("listActiveRuns must report a run that is in flight");
|
|
415
|
-
}
|
|
416
|
-
if (activeRuns.some((run) => run.terminalReason !== undefined)) {
|
|
417
|
-
throw new Error("listActiveRuns must not report a run that has ended");
|
|
418
|
-
}
|
|
419
|
-
for (let index = 1;index < activeRuns.length; index += 1) {
|
|
420
|
-
const previous = activeRuns[index - 1];
|
|
421
|
-
const current = activeRuns[index];
|
|
422
|
-
if (!previous || !current)
|
|
423
|
-
continue;
|
|
424
|
-
const ordered = previous.createdAt === current.createdAt ? previous.id.localeCompare(current.id) < 0 : previous.createdAt < current.createdAt;
|
|
425
|
-
if (!ordered) {
|
|
426
|
-
throw new Error("listActiveRuns must order by createdAt and then by id");
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
if ((await store.listActiveRuns(absentConversationId)).length !== 0) {
|
|
430
|
-
throw new Error("listActiveRuns must be empty for an unknown conversation");
|
|
431
|
-
}
|
|
432
|
-
const recoverable = await store.scanRecoverable({ limit: 10 });
|
|
433
|
-
if (!recoverable.items.some((item) => item.run.id === running.id)) {
|
|
434
|
-
throw new Error("A running run must appear in a recoverable scan");
|
|
435
|
-
}
|
|
436
|
-
const operation = await store.recordRunOperation({
|
|
437
|
-
conversationId,
|
|
438
|
-
runId: running.id,
|
|
439
|
-
expectedRevision: checkpointedRun.revision,
|
|
440
|
-
ownerId: "conformance-owner",
|
|
441
|
-
fencingToken: checkpointedRun.fencingToken,
|
|
442
|
-
operation: {
|
|
443
|
-
operationId: "model-call-1:0",
|
|
444
|
-
kind: "model-request",
|
|
445
|
-
phase: "first-output",
|
|
446
|
-
step: 0,
|
|
447
|
-
startedAt: "2026-08-22T00:00:01.800Z",
|
|
448
|
-
firstOutputAt: "2026-08-22T00:00:01.900Z"
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
requireOutcome(operation, "applied");
|
|
452
|
-
const operatedRun = operation.snapshot.runs.find((run) => run.id === running.id);
|
|
453
|
-
if (operatedRun?.lastOperation?.operationId !== "model-call-1:0") {
|
|
454
|
-
throw new Error("Run operation identity did not survive its durable mutation");
|
|
455
|
-
}
|
|
456
|
-
const operatedView = await store.loadRun({ conversationId, runId: running.id });
|
|
457
|
-
if (operatedView?.run.lastOperation?.startedAt !== "2026-08-22T00:00:01.800Z") {
|
|
458
|
-
throw new Error("loadRun did not retain the original operation timestamp");
|
|
459
|
-
}
|
|
460
|
-
const interrupted = await store.requestRunInterrupt({
|
|
461
|
-
conversationId,
|
|
462
|
-
runId: running.id,
|
|
463
|
-
expectedRevision: operatedRun.revision
|
|
464
|
-
});
|
|
465
|
-
requireOutcome(interrupted, "applied");
|
|
466
|
-
const interruptedRun = interrupted.snapshot.runs.find((run) => run.id === running.id);
|
|
467
|
-
if (interruptedRun?.state !== "interrupt_requested") {
|
|
468
|
-
throw new Error("A durable interrupt must move the run to interrupt_requested");
|
|
469
|
-
}
|
|
470
|
-
if (interruptedRun.usage?.cost?.value !== 0.25) {
|
|
471
|
-
throw new Error("An interrupt must not discard the figure the run had already spent");
|
|
472
|
-
}
|
|
473
|
-
const terminalUsage = {
|
|
474
|
-
inputTokens: { value: 3000, provenance: "computed" },
|
|
475
|
-
outputTokens: { value: 300, provenance: "computed" },
|
|
476
|
-
reasoningTokens: { value: 30, provenance: "computed" },
|
|
477
|
-
cacheReadTokens: { value: 200, provenance: "computed" },
|
|
478
|
-
cacheWriteTokens: { value: 100, provenance: "computed" },
|
|
479
|
-
cost: { value: 1.5, currency: "USD", provenance: "computed" }
|
|
63
|
+
function createTestClientConfig(config) {
|
|
64
|
+
return {
|
|
65
|
+
...config.client,
|
|
66
|
+
baseUrl: resolveTestBaseUrl(config.origin, config.pathPrefix),
|
|
67
|
+
fetch: createHandlerFetch(config.handler, config.server)
|
|
480
68
|
};
|
|
481
|
-
const terminalResults = await Promise.all([
|
|
482
|
-
store.commitRunTerminal({
|
|
483
|
-
conversationId,
|
|
484
|
-
runId: running.id,
|
|
485
|
-
expectedRevision: interruptedRun.revision,
|
|
486
|
-
ownerId: "conformance-owner",
|
|
487
|
-
assistant: terminalAssistant,
|
|
488
|
-
reason: "success",
|
|
489
|
-
usage: terminalUsage
|
|
490
|
-
}),
|
|
491
|
-
store.commitRunTerminal({
|
|
492
|
-
conversationId,
|
|
493
|
-
runId: running.id,
|
|
494
|
-
expectedRevision: interruptedRun.revision,
|
|
495
|
-
ownerId: "conformance-owner",
|
|
496
|
-
assistant: terminalAssistant,
|
|
497
|
-
reason: "success",
|
|
498
|
-
usage: terminalUsage
|
|
499
|
-
})
|
|
500
|
-
]);
|
|
501
|
-
const terminalOutcomes = terminalResults.map((result) => result.outcome).sort();
|
|
502
|
-
if (terminalOutcomes.join(",") !== "applied,conflict") {
|
|
503
|
-
throw new Error(`Terminal race was not linearized: ${terminalOutcomes.join(",")}`);
|
|
504
|
-
}
|
|
505
|
-
const terminalApplied = terminalResults.find((result) => result.outcome === "applied");
|
|
506
|
-
if (terminalApplied?.outcome !== "applied") {
|
|
507
|
-
throw new Error("Terminal race produced no applied result");
|
|
508
|
-
}
|
|
509
|
-
const settledRun = terminalApplied.snapshot.runs.find((run) => run.id === running.id);
|
|
510
|
-
if (JSON.stringify(settledRun?.usage) !== JSON.stringify(terminalUsage)) {
|
|
511
|
-
throw new Error("Terminal commit did not persist the run usage it was given");
|
|
512
|
-
}
|
|
513
|
-
const terminalView = await store.loadRun({ conversationId, runId: running.id });
|
|
514
|
-
if (terminalView?.run.terminalReason !== "success") {
|
|
515
|
-
throw new Error("loadRun must report the terminal reason a settled run ended with");
|
|
516
|
-
}
|
|
517
|
-
if (JSON.stringify(terminalView.run.usage) !== JSON.stringify(terminalUsage)) {
|
|
518
|
-
throw new Error("loadRun must return every persisted terminal usage field");
|
|
519
|
-
}
|
|
520
|
-
if (JSON.stringify(terminalView.assistant) !== JSON.stringify(terminalAssistant)) {
|
|
521
|
-
throw new Error("loadRun must retain the answer a settled run produced");
|
|
522
|
-
}
|
|
523
|
-
if ((await store.listActiveRuns(conversationId)).some((run) => run.id === running.id)) {
|
|
524
|
-
throw new Error("listActiveRuns must drop a run once it has ended");
|
|
525
|
-
}
|
|
526
|
-
const compactedTerminal = await store.replaceCompactedRange({
|
|
527
|
-
conversationId,
|
|
528
|
-
expectedVersion: terminalApplied.snapshot.version,
|
|
529
|
-
replacedMessageIds: ["summary-1", terminalAssistant.id],
|
|
530
|
-
summary: AgentMessageSchema.parse({
|
|
531
|
-
schemaVersion: 1,
|
|
532
|
-
id: "summary-2",
|
|
533
|
-
conversationId,
|
|
534
|
-
role: "summary",
|
|
535
|
-
status: "committed",
|
|
536
|
-
parts: [{ type: "text", text: "terminal history" }],
|
|
537
|
-
createdAt: "2026-08-22T00:00:03.000Z",
|
|
538
|
-
updatedAt: "2026-08-22T00:00:03.000Z"
|
|
539
|
-
})
|
|
540
|
-
});
|
|
541
|
-
requireOutcome(compactedTerminal, "applied");
|
|
542
|
-
const duplicateTerminal = await store.acceptInputAndAssignRun({
|
|
543
|
-
idempotencyKey: "request-1",
|
|
544
|
-
input: userMessage(conversationId, "discarded-terminal-input"),
|
|
545
|
-
run: queuedRun(conversationId, "discarded-terminal-input", "discarded-terminal-run")
|
|
546
|
-
});
|
|
547
|
-
requireOutcome(duplicateTerminal, "duplicate");
|
|
548
|
-
if (duplicateTerminal.run.terminalReason !== "success" || JSON.stringify(duplicateTerminal.assistant) !== JSON.stringify(terminalAssistant)) {
|
|
549
|
-
throw new Error("Compaction discarded the canonical duplicate terminal result");
|
|
550
|
-
}
|
|
551
|
-
const recoveryInput = userMessage(recoveryConversationId, "recovery-input");
|
|
552
|
-
const recoveryRun = queuedRun(recoveryConversationId, recoveryInput.id, "recovery-run");
|
|
553
|
-
const recoveryAccepted = await store.acceptInputAndAssignRun({
|
|
554
|
-
idempotencyKey: "recovery-request",
|
|
555
|
-
input: recoveryInput,
|
|
556
|
-
run: recoveryRun
|
|
557
|
-
});
|
|
558
|
-
requireOutcome(recoveryAccepted, "applied");
|
|
559
|
-
const recoveryAssigned = recoveryAccepted.snapshot.runs.find((run) => run.id === recoveryRun.id);
|
|
560
|
-
if (!recoveryAssigned)
|
|
561
|
-
throw new Error("Recovery run disappeared after admission");
|
|
562
|
-
const recoveryAcquired = await store.acquireRun({
|
|
563
|
-
conversationId: recoveryConversationId,
|
|
564
|
-
runId: recoveryAssigned.id,
|
|
565
|
-
expectedRevision: recoveryAssigned.revision,
|
|
566
|
-
ownerId: "abandoned-owner"
|
|
567
|
-
});
|
|
568
|
-
requireOutcome(recoveryAcquired, "applied");
|
|
569
|
-
const abandonedRun = recoveryAcquired.snapshot.runs.find((run) => run.id === recoveryRun.id);
|
|
570
|
-
if (!abandonedRun)
|
|
571
|
-
throw new Error("Recovery run disappeared after acquisition");
|
|
572
|
-
const abandoned = await store.recoverRun({
|
|
573
|
-
conversationId: recoveryConversationId,
|
|
574
|
-
runId: abandonedRun.id,
|
|
575
|
-
expectedRevision: abandonedRun.revision,
|
|
576
|
-
action: "abandon"
|
|
577
|
-
});
|
|
578
|
-
requireOutcome(abandoned, "applied");
|
|
579
|
-
const terminalRun = abandoned.snapshot.runs.find((run) => run.id === abandonedRun.id);
|
|
580
|
-
const terminalMessage = abandoned.snapshot.messages.find((message) => message.id === abandonedRun.assistantMessageId);
|
|
581
|
-
if (terminalRun?.state !== "abandoned" || terminalMessage?.status !== "failed") {
|
|
582
|
-
throw new Error("Abandon recovery did not atomically terminalize its assistant record");
|
|
583
|
-
}
|
|
584
|
-
const abandonedView = await store.loadRun({
|
|
585
|
-
conversationId: recoveryConversationId,
|
|
586
|
-
runId: abandonedRun.id
|
|
587
|
-
});
|
|
588
|
-
if (abandonedView?.run.state !== "abandoned" || abandonedView.run.terminalReason !== "abandoned" || abandonedView.assistant?.status !== "failed") {
|
|
589
|
-
throw new Error("The canonical run record disagrees with its abandoned index projection");
|
|
590
|
-
}
|
|
591
|
-
const afterAbandon = await store.scanRecoverable({ limit: 100 });
|
|
592
|
-
if (afterAbandon.items.some((item) => item.run.id === abandonedRun.id)) {
|
|
593
|
-
throw new Error("The recoverable index still exposes a canonically abandoned run");
|
|
594
|
-
}
|
|
595
|
-
await assertCausalHistoryOrder(store, causalHistoryConversationId);
|
|
596
|
-
await assertActiveRunCausalOrder(store, causalActiveConversationId);
|
|
597
|
-
await assertInterruptPriorityOrder(store, interruptPriorityConversationId);
|
|
598
|
-
await assertAbsorptionIsAtomic(store, absorbConversationId);
|
|
599
|
-
}
|
|
600
|
-
async function assertInterruptPriorityOrder(store, conversationId) {
|
|
601
|
-
const inputs = ["priority-a", "priority-b", "priority-c"].map((id) => userMessage(conversationId, id));
|
|
602
|
-
const [inputA, inputB, inputC] = inputs;
|
|
603
|
-
if (!inputA || !inputB || !inputC)
|
|
604
|
-
throw new Error("Priority fixture is incomplete");
|
|
605
|
-
const runA = queuedRun(conversationId, inputA.id, "priority-run-a");
|
|
606
|
-
const runB = queuedRun(conversationId, inputB.id, "priority-run-b");
|
|
607
|
-
const runC = AgentRunSchema.parse({
|
|
608
|
-
...queuedRun(conversationId, inputC.id, "priority-run-c"),
|
|
609
|
-
queuePriority: "interrupt-next"
|
|
610
|
-
});
|
|
611
|
-
requireOutcome(await store.acceptInputAndAssignRun({ idempotencyKey: runA.id, input: inputA, run: runA }), "applied");
|
|
612
|
-
const acquiredA = await store.acquireRun({
|
|
613
|
-
conversationId,
|
|
614
|
-
runId: runA.id,
|
|
615
|
-
expectedRevision: runA.revision,
|
|
616
|
-
ownerId: "priority-owner-a"
|
|
617
|
-
});
|
|
618
|
-
requireOutcome(acquiredA, "applied");
|
|
619
|
-
const runningA = acquiredA.snapshot.runs.find((run) => run.id === runA.id);
|
|
620
|
-
if (!runningA)
|
|
621
|
-
throw new Error("Priority lead run disappeared after acquisition");
|
|
622
|
-
requireOutcome(await store.acceptInputAndAssignRun({ idempotencyKey: runB.id, input: inputB, run: runB }), "applied");
|
|
623
|
-
requireOutcome(await store.acceptInputAndAssignRun({ idempotencyKey: runC.id, input: inputC, run: runC }), "applied");
|
|
624
|
-
const active = await store.listActiveRuns(conversationId);
|
|
625
|
-
if (active.map((run) => run.id).join(",") !== `${runA.id},${runC.id},${runB.id}`) {
|
|
626
|
-
throw new Error("Active runs did not place urgent work before ordinary pending work");
|
|
627
|
-
}
|
|
628
|
-
requireOutcome(await store.acquireRun({
|
|
629
|
-
conversationId,
|
|
630
|
-
runId: runB.id,
|
|
631
|
-
expectedRevision: runB.revision,
|
|
632
|
-
ownerId: "priority-owner-b"
|
|
633
|
-
}), "conflict");
|
|
634
|
-
const abandonedA = await store.recoverRun({
|
|
635
|
-
conversationId,
|
|
636
|
-
runId: runA.id,
|
|
637
|
-
expectedRevision: runningA.revision,
|
|
638
|
-
action: "abandon"
|
|
639
|
-
});
|
|
640
|
-
requireOutcome(abandonedA, "applied");
|
|
641
|
-
const queuedC = abandonedA.snapshot.runs.find((run) => run.id === runC.id);
|
|
642
|
-
if (!queuedC)
|
|
643
|
-
throw new Error("Urgent run disappeared after predecessor settlement");
|
|
644
|
-
const acquiredC = await store.acquireRun({
|
|
645
|
-
conversationId,
|
|
646
|
-
runId: runC.id,
|
|
647
|
-
expectedRevision: queuedC.revision,
|
|
648
|
-
ownerId: "priority-owner-c"
|
|
649
|
-
});
|
|
650
|
-
requireOutcome(acquiredC, "applied");
|
|
651
|
-
const runningC = acquiredC.snapshot.runs.find((run) => run.id === runC.id);
|
|
652
|
-
if (!runningC)
|
|
653
|
-
throw new Error("Urgent run disappeared after acquisition");
|
|
654
|
-
requireOutcome(await store.acquireRun({
|
|
655
|
-
conversationId,
|
|
656
|
-
runId: runB.id,
|
|
657
|
-
expectedRevision: runB.revision,
|
|
658
|
-
ownerId: "priority-owner-b"
|
|
659
|
-
}), "conflict");
|
|
660
|
-
const abandonedC = await store.recoverRun({
|
|
661
|
-
conversationId,
|
|
662
|
-
runId: runC.id,
|
|
663
|
-
expectedRevision: runningC.revision,
|
|
664
|
-
action: "abandon"
|
|
665
|
-
});
|
|
666
|
-
requireOutcome(abandonedC, "applied");
|
|
667
|
-
const queuedB = abandonedC.snapshot.runs.find((run) => run.id === runB.id);
|
|
668
|
-
if (!queuedB)
|
|
669
|
-
throw new Error("Ordinary run disappeared after urgent settlement");
|
|
670
|
-
const acquiredB = await store.acquireRun({
|
|
671
|
-
conversationId,
|
|
672
|
-
runId: runB.id,
|
|
673
|
-
expectedRevision: queuedB.revision,
|
|
674
|
-
ownerId: "priority-owner-b"
|
|
675
|
-
});
|
|
676
|
-
requireOutcome(acquiredB, "applied");
|
|
677
|
-
const ordered = acquiredB.snapshot.runs.map((run) => run.id).join(",");
|
|
678
|
-
if (ordered !== `${runA.id},${runC.id},${runB.id}`) {
|
|
679
|
-
throw new Error(`Durable execution order was not preserved: ${ordered}`);
|
|
680
|
-
}
|
|
681
|
-
const [sequenceA, sequenceC, sequenceB] = acquiredB.snapshot.runs.map((run) => run.executionSequence);
|
|
682
|
-
if (sequenceA === undefined || sequenceC === undefined || sequenceB === undefined || !(sequenceA < sequenceC && sequenceC < sequenceB)) {
|
|
683
|
-
throw new Error("Acquisition did not persist increasing execution sequence values");
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
async function assertActiveRunCausalOrder(store, conversationId) {
|
|
687
|
-
for (const id of ["z-causal-run", "a-causal-run"]) {
|
|
688
|
-
const input = userMessage(conversationId, `${id}-input`);
|
|
689
|
-
requireOutcome(await store.acceptInputAndAssignRun({
|
|
690
|
-
idempotencyKey: id,
|
|
691
|
-
input,
|
|
692
|
-
run: queuedRun(conversationId, input.id, id)
|
|
693
|
-
}), "applied");
|
|
694
|
-
}
|
|
695
|
-
const active = await store.listActiveRuns(conversationId);
|
|
696
|
-
if (active.map((run) => run.id).join(",") !== "z-causal-run,a-causal-run") {
|
|
697
|
-
throw new Error("listActiveRuns must preserve causal history order for timestamp ties");
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
async function assertCausalHistoryOrder(store, conversationId) {
|
|
701
|
-
const leadInput = userMessage(conversationId, "causal-input-1");
|
|
702
|
-
const leadRun = queuedRun(conversationId, leadInput.id, "causal-run-1");
|
|
703
|
-
requireOutcome(await store.acceptInputAndAssignRun({
|
|
704
|
-
idempotencyKey: "causal-request-1",
|
|
705
|
-
input: leadInput,
|
|
706
|
-
run: leadRun
|
|
707
|
-
}), "applied");
|
|
708
|
-
const acquired = await store.acquireRun({
|
|
709
|
-
conversationId,
|
|
710
|
-
runId: leadRun.id,
|
|
711
|
-
expectedRevision: leadRun.revision,
|
|
712
|
-
ownerId: "causal-owner"
|
|
713
|
-
});
|
|
714
|
-
requireOutcome(acquired, "applied");
|
|
715
|
-
const running = acquired.snapshot.runs.find((run) => run.id === leadRun.id);
|
|
716
|
-
if (!running)
|
|
717
|
-
throw new Error("Causal-order run disappeared after acquisition");
|
|
718
|
-
const successorInput = userMessage(conversationId, "causal-input-2");
|
|
719
|
-
const successorRun = queuedRun(conversationId, successorInput.id, "causal-run-2");
|
|
720
|
-
requireOutcome(await store.acceptInputAndAssignRun({
|
|
721
|
-
idempotencyKey: "causal-request-2",
|
|
722
|
-
input: successorInput,
|
|
723
|
-
run: successorRun
|
|
724
|
-
}), "applied");
|
|
725
|
-
const assistant = AgentMessageSchema.parse({
|
|
726
|
-
schemaVersion: 1,
|
|
727
|
-
id: running.assistantMessageId,
|
|
728
|
-
conversationId,
|
|
729
|
-
runId: running.id,
|
|
730
|
-
role: "assistant",
|
|
731
|
-
status: "streaming",
|
|
732
|
-
parts: [{ type: "text", text: "causal answer" }],
|
|
733
|
-
createdAt: "2026-08-28T00:00:00.000Z",
|
|
734
|
-
updatedAt: "2026-08-28T00:00:01.000Z"
|
|
735
|
-
});
|
|
736
|
-
const checkpoint = await store.checkpointRunAssistant({
|
|
737
|
-
conversationId,
|
|
738
|
-
runId: running.id,
|
|
739
|
-
expectedRevision: running.revision,
|
|
740
|
-
ownerId: "causal-owner",
|
|
741
|
-
...running.fencingToken !== undefined && { fencingToken: running.fencingToken },
|
|
742
|
-
assistant
|
|
743
|
-
});
|
|
744
|
-
requireOutcome(checkpoint, "applied");
|
|
745
|
-
const order = checkpoint.snapshot.messages.map((message) => message.id).join(",");
|
|
746
|
-
if (order !== `${leadInput.id},${assistant.id},${successorInput.id}`) {
|
|
747
|
-
throw new Error(`Agent history is not in causal run order: ${order}`);
|
|
748
|
-
}
|
|
749
69
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const leadRun = queuedRun(conversationId, leadInput.id, "absorb-run-1");
|
|
753
|
-
const lead = await store.acceptInputAndAssignRun({
|
|
754
|
-
idempotencyKey: "absorb-request-1",
|
|
755
|
-
input: leadInput,
|
|
756
|
-
run: leadRun
|
|
757
|
-
});
|
|
758
|
-
requireOutcome(lead, "applied");
|
|
759
|
-
const successorInput = userMessage(conversationId, "absorb-input-2");
|
|
760
|
-
const successorRun = queuedRun(conversationId, successorInput.id, "absorb-run-2");
|
|
761
|
-
const successor = await store.acceptInputAndAssignRun({
|
|
762
|
-
idempotencyKey: "absorb-request-2",
|
|
763
|
-
input: successorInput,
|
|
764
|
-
run: successorRun
|
|
765
|
-
});
|
|
766
|
-
requireOutcome(successor, "applied");
|
|
767
|
-
const acquired = await store.acquireRun({
|
|
768
|
-
conversationId,
|
|
769
|
-
runId: leadRun.id,
|
|
770
|
-
expectedRevision: 0,
|
|
771
|
-
ownerId: "absorb-owner"
|
|
772
|
-
});
|
|
773
|
-
requireOutcome(acquired, "applied");
|
|
774
|
-
const running = acquired.snapshot.runs.find((run) => run.id === leadRun.id);
|
|
775
|
-
if (!running)
|
|
776
|
-
throw new Error("Absorbing run disappeared after acquisition");
|
|
777
|
-
const answer = AgentMessageSchema.parse({
|
|
778
|
-
schemaVersion: 1,
|
|
779
|
-
id: running.assistantMessageId,
|
|
780
|
-
conversationId,
|
|
781
|
-
runId: running.id,
|
|
782
|
-
role: "assistant",
|
|
783
|
-
status: "completed",
|
|
784
|
-
parts: [{ type: "text", text: "answered both" }],
|
|
785
|
-
createdAt: "2026-08-26T00:00:00.000Z",
|
|
786
|
-
updatedAt: "2026-08-26T00:00:02.000Z"
|
|
787
|
-
});
|
|
788
|
-
await store.commitRunTerminal({
|
|
789
|
-
conversationId,
|
|
790
|
-
runId: running.id,
|
|
791
|
-
expectedRevision: running.revision,
|
|
792
|
-
ownerId: "absorb-owner",
|
|
793
|
-
assistant: AgentMessageSchema.parse({ ...answer, status: "interrupted" }),
|
|
794
|
-
reason: "interrupted",
|
|
795
|
-
absorb: [{ runId: successorRun.id, inputMessageIds: [successorInput.id] }]
|
|
796
|
-
}).then(() => {
|
|
797
|
-
throw new Error("A non-completing run absorbed a queued successor");
|
|
798
|
-
}, (error) => {
|
|
799
|
-
if (!(error instanceof TypeError))
|
|
800
|
-
throw error;
|
|
801
|
-
});
|
|
802
|
-
const committed = await store.commitRunTerminal({
|
|
803
|
-
conversationId,
|
|
804
|
-
runId: running.id,
|
|
805
|
-
expectedRevision: running.revision,
|
|
806
|
-
ownerId: "absorb-owner",
|
|
807
|
-
assistant: answer,
|
|
808
|
-
reason: "success",
|
|
809
|
-
absorb: [{ runId: successorRun.id, inputMessageIds: [successorInput.id] }]
|
|
810
|
-
});
|
|
811
|
-
requireOutcome(committed, "applied");
|
|
812
|
-
const absorbingView = await store.loadRun({ conversationId, runId: leadRun.id });
|
|
813
|
-
if (absorbingView?.run.inputMessageIds.join(",") !== "absorb-input-1,absorb-input-2") {
|
|
814
|
-
throw new Error("An absorbing run must record the inputs it answered");
|
|
815
|
-
}
|
|
816
|
-
const absorbedView = await store.loadRun({ conversationId, runId: successorRun.id });
|
|
817
|
-
if (absorbedView?.run.terminalReason !== "absorbed") {
|
|
818
|
-
throw new Error("An absorbed successor must be terminal in the same transaction");
|
|
819
|
-
}
|
|
820
|
-
if (absorbedView.run.absorbedIntoRunId !== leadRun.id) {
|
|
821
|
-
throw new Error("An absorbed run must name the run that answered its input");
|
|
822
|
-
}
|
|
823
|
-
if (absorbedView.assistant !== undefined) {
|
|
824
|
-
throw new Error("An absorbed run produced no answer and must retain none");
|
|
825
|
-
}
|
|
826
|
-
if ((await store.listActiveRuns(conversationId)).length !== 0) {
|
|
827
|
-
throw new Error("An absorbed successor must leave the active listing");
|
|
828
|
-
}
|
|
829
|
-
const retried = await store.acceptInputAndAssignRun({
|
|
830
|
-
idempotencyKey: "absorb-request-2",
|
|
831
|
-
input: userMessage(conversationId, "absorb-discarded"),
|
|
832
|
-
run: queuedRun(conversationId, "absorb-discarded", "absorb-discarded-run")
|
|
833
|
-
});
|
|
834
|
-
requireOutcome(retried, "duplicate");
|
|
835
|
-
if (retried.runId !== leadRun.id || retried.assistant?.id !== answer.id) {
|
|
836
|
-
throw new Error("A retried absorbed key must resolve to the run that answered it");
|
|
837
|
-
}
|
|
838
|
-
if (retried.inputMessageId !== successorInput.id) {
|
|
839
|
-
throw new Error("A retried absorbed key must still name its own input");
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
async function ledgerScenario(store, conversationId) {
|
|
843
|
-
const first = await store.appendEvent({
|
|
844
|
-
conversationId,
|
|
845
|
-
kind: "state/set",
|
|
846
|
-
payload: { n: 1 }
|
|
847
|
-
});
|
|
848
|
-
if (first.seq !== 1)
|
|
849
|
-
throw new Error(`Agent store conformance expected seq 1, received ${first.seq}`);
|
|
850
|
-
const appended = await Promise.all(Array.from({ length: 20 }, (_, index) => store.appendEvent({ conversationId, kind: "state/set", payload: { n: index + 2 } })));
|
|
851
|
-
const seqs = [first.seq, ...appended.map((event) => event.seq)].sort((a, b) => a - b);
|
|
852
|
-
for (let index = 0;index < seqs.length; index += 1) {
|
|
853
|
-
if (seqs[index] !== index + 1) {
|
|
854
|
-
throw new Error(`Agent store conformance expected contiguous seq, received ${seqs.join(",")}`);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
const page = await store.readEvents({ conversationId, fromSeq: 5, toSeq: 9, limit: 3 });
|
|
858
|
-
if (page.items.map((event) => event.seq).join(",") !== "5,6,7" || page.nextSeq !== 8) {
|
|
859
|
-
throw new Error(`Agent store conformance expected events 5,6,7 then 8, received ${page.items.map((event) => event.seq).join(",")} then ${page.nextSeq}`);
|
|
860
|
-
}
|
|
861
|
-
const ignorable = await store.appendEvent({
|
|
862
|
-
conversationId,
|
|
863
|
-
kind: "state/set",
|
|
864
|
-
payload: { n: "ignorable" },
|
|
865
|
-
ignorable: true
|
|
866
|
-
});
|
|
867
|
-
if (ignorable.ignorable !== true) {
|
|
868
|
-
throw new Error("Agent store conformance expected the ignorable flag to persist");
|
|
869
|
-
}
|
|
870
|
-
const archive = await store.exportConversation(conversationId);
|
|
871
|
-
const again = await store.exportConversation(conversationId);
|
|
872
|
-
if (Buffer.compare(Buffer.from(archive), Buffer.from(again)) !== 0) {
|
|
873
|
-
throw new Error("Agent store conformance expected two exports of a quiet store to be byte-equal");
|
|
874
|
-
}
|
|
875
|
-
const decoded = decodeAgentConversationArchive(archive);
|
|
876
|
-
if (decoded.events.length !== 22) {
|
|
877
|
-
throw new Error(`Agent store conformance expected 22 archived events, received ${decoded.events.length}`);
|
|
878
|
-
}
|
|
70
|
+
function createHandlerTestClient(config) {
|
|
71
|
+
return createClient(config.contract, createTestClientConfig(config), config.contractConfig);
|
|
879
72
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
const inputMessage = userMessage(conversationId, "archived-input");
|
|
883
|
-
const run = queuedRun(conversationId, inputMessage.id, "archived-run");
|
|
884
|
-
requireOutcome(await origin.acceptInputAndAssignRun({
|
|
885
|
-
idempotencyKey: "archived-request",
|
|
886
|
-
input: inputMessage,
|
|
887
|
-
run
|
|
888
|
-
}), "applied");
|
|
889
|
-
await origin.appendEvent({
|
|
890
|
-
conversationId,
|
|
891
|
-
kind: "state/set",
|
|
892
|
-
payload: { name: "topic", value: "archive" }
|
|
893
|
-
});
|
|
894
|
-
const imported = await store.importConversation(await origin.exportConversation(conversationId));
|
|
895
|
-
if (imported.conversationId !== conversationId || imported.events !== 2) {
|
|
896
|
-
throw new Error(`Agent store conformance expected 2 imported events for ${conversationId}, received ${imported.events} for ${imported.conversationId}`);
|
|
897
|
-
}
|
|
898
|
-
const restored = await store.loadSnapshot(conversationId);
|
|
899
|
-
const expected = await origin.loadSnapshot(conversationId);
|
|
900
|
-
if (restored.version !== expected.version || restored.messages.map((message) => message.id).join(",") !== expected.messages.map((message) => message.id).join(",") || restored.runs.map((entry) => `${entry.id}:${entry.state}`).join(",") !== expected.runs.map((entry) => `${entry.id}:${entry.state}`).join(",")) {
|
|
901
|
-
throw new Error(`Agent store conformance expected the imported snapshot to match its archive, received version ${restored.version} with ${restored.messages.length} messages and ${restored.runs.length} runs`);
|
|
902
|
-
}
|
|
903
|
-
const events = await store.readEvents({ conversationId, limit: 10 });
|
|
904
|
-
if (events.items.map((event) => event.kind).join(",") !== "runtime/transition,state/set") {
|
|
905
|
-
throw new Error(`Agent store conformance expected the imported ledger to keep its kinds, received ${events.items.map((event) => event.kind).join(",")}`);
|
|
906
|
-
}
|
|
73
|
+
function createHandlerTestClients(config) {
|
|
74
|
+
return createClients(config.contracts, createTestClientConfig(config), config.contractConfig);
|
|
907
75
|
}
|
|
908
76
|
// src/testing/managed-resource-conformance-contract.ts
|
|
909
77
|
import { z } from "zod";
|
|
@@ -1487,8 +655,9 @@ import { z as z3 } from "zod";
|
|
|
1487
655
|
// src/testing/surface-manifest.ts
|
|
1488
656
|
import { createHash } from "node:crypto";
|
|
1489
657
|
import { z as z2 } from "zod";
|
|
658
|
+
var SURFACE_MANIFEST_VERSION = 3;
|
|
1490
659
|
var HttpMethodSchema = z2.enum(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"]);
|
|
1491
|
-
var ToolTransportSchema = z2.enum(
|
|
660
|
+
var ToolTransportSchema = z2.enum(TOOL_TRANSPORTS);
|
|
1492
661
|
var SurfaceTransportSchema = z2.enum(["HTTP", "MCP", "AGENT", "CLI", "REALTIME"]);
|
|
1493
662
|
var SurfaceSchemaDigestsSchema = z2.object({
|
|
1494
663
|
params: z2.string().nullable(),
|
|
@@ -1496,6 +665,17 @@ var SurfaceSchemaDigestsSchema = z2.object({
|
|
|
1496
665
|
output: z2.string().nullable(),
|
|
1497
666
|
multipart: z2.string().nullable()
|
|
1498
667
|
});
|
|
668
|
+
var SurfaceManifestOperationMcpSchema = z2.object({
|
|
669
|
+
inputRequired: z2.union([
|
|
670
|
+
z2.array(z2.object({ key: z2.string(), message: z2.string(), schema: z2.string().nullable() })),
|
|
671
|
+
z2.literal("resolved-per-call")
|
|
672
|
+
])
|
|
673
|
+
}).nullable();
|
|
674
|
+
var SurfaceManifestOperationToolViewSchema = z2.object({
|
|
675
|
+
defaults: z2.string().nullable(),
|
|
676
|
+
output: z2.string().nullable(),
|
|
677
|
+
project: z2.boolean()
|
|
678
|
+
});
|
|
1499
679
|
var SurfaceManifestOperationSchema = z2.object({
|
|
1500
680
|
kind: z2.enum(["contract", "runtime"]),
|
|
1501
681
|
service: z2.string(),
|
|
@@ -1504,6 +684,8 @@ var SurfaceManifestOperationSchema = z2.object({
|
|
|
1504
684
|
scope: z2.string().nullable(),
|
|
1505
685
|
description: z2.string(),
|
|
1506
686
|
schemas: SurfaceSchemaDigestsSchema,
|
|
687
|
+
mcp: SurfaceManifestOperationMcpSchema,
|
|
688
|
+
toolView: SurfaceManifestOperationToolViewSchema.optional(),
|
|
1507
689
|
http: z2.array(z2.object({ method: HttpMethodSchema, path: z2.string() }))
|
|
1508
690
|
});
|
|
1509
691
|
var SurfaceManifestToolSchema = z2.object({
|
|
@@ -1540,7 +722,7 @@ var SurfaceManifestRealtimeEventSchema = z2.object({
|
|
|
1540
722
|
acknowledgement: SurfaceRealtimeSchemaPairSchema.nullable()
|
|
1541
723
|
});
|
|
1542
724
|
var SurfaceManifestSchema = z2.object({
|
|
1543
|
-
manifestVersion: z2.literal(
|
|
725
|
+
manifestVersion: z2.literal(SURFACE_MANIFEST_VERSION),
|
|
1544
726
|
digestVersion: z2.literal(1),
|
|
1545
727
|
operations: z2.array(SurfaceManifestOperationSchema),
|
|
1546
728
|
toolSurfaces: z2.array(SurfaceManifestToolSurfaceSchema),
|
|
@@ -1556,12 +738,12 @@ function digestValue(value) {
|
|
|
1556
738
|
function canonicalSchemaValue(value, parentKey) {
|
|
1557
739
|
if (Array.isArray(value)) {
|
|
1558
740
|
const entries = value.map((entry) => canonicalSchemaValue(entry));
|
|
1559
|
-
return parentKey === "required" && entries.every((entry) => typeof entry === "string") ? entries.sort((left, right) =>
|
|
741
|
+
return parentKey === "required" && entries.every((entry) => typeof entry === "string") ? entries.sort((left, right) => compareCodeUnits(String(left), String(right))) : entries;
|
|
1560
742
|
}
|
|
1561
743
|
if (!isRecord(value))
|
|
1562
744
|
return value;
|
|
1563
745
|
const result = {};
|
|
1564
|
-
for (const key of Object.keys(value).sort(
|
|
746
|
+
for (const key of Object.keys(value).sort(compareCodeUnits)) {
|
|
1565
747
|
result[key] = canonicalSchemaValue(value[key], key);
|
|
1566
748
|
}
|
|
1567
749
|
return result;
|
|
@@ -1594,18 +776,39 @@ function operationFrom(kind, source) {
|
|
|
1594
776
|
output: schemaDigest(source.outputSchema, "output"),
|
|
1595
777
|
multipart: multipartDigest(source.multipart)
|
|
1596
778
|
},
|
|
779
|
+
mcp: mcpRoundsOf(source),
|
|
780
|
+
...toolViewEntry(source),
|
|
1597
781
|
http: []
|
|
1598
782
|
};
|
|
1599
783
|
}
|
|
1600
|
-
function
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1603
|
-
|
|
784
|
+
function toolViewOf(source) {
|
|
785
|
+
const view = source.toolView;
|
|
786
|
+
if (!view)
|
|
787
|
+
return null;
|
|
788
|
+
return {
|
|
789
|
+
defaults: view.defaults === undefined || Object.keys(view.defaults).length === 0 ? null : digestValue(view.defaults),
|
|
790
|
+
output: schemaDigest(view.output, "output"),
|
|
791
|
+
project: view.project !== undefined
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
function toolViewEntry(source) {
|
|
795
|
+
const toolView = toolViewOf(source);
|
|
796
|
+
return toolView ? { toolView } : {};
|
|
797
|
+
}
|
|
798
|
+
function mcpRoundsOf(source) {
|
|
799
|
+
if (!source.mcp)
|
|
800
|
+
return null;
|
|
801
|
+
const declared = staticInputRounds(source.mcp);
|
|
802
|
+
return {
|
|
803
|
+
inputRequired: declared ? declared.map((request) => ({
|
|
1604
804
|
key: request.key,
|
|
1605
805
|
message: request.message,
|
|
1606
806
|
schema: schemaDigest(request.schema, "input")
|
|
1607
807
|
})) : "resolved-per-call"
|
|
1608
|
-
}
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
function operationFingerprint(source) {
|
|
811
|
+
const mcp = mcpRoundsOf(source);
|
|
1609
812
|
return serializeSurfaceValue({
|
|
1610
813
|
method: source.method,
|
|
1611
814
|
serviceName: source.serviceName,
|
|
@@ -1613,11 +816,12 @@ function operationFingerprint(source) {
|
|
|
1613
816
|
desc: source.desc,
|
|
1614
817
|
scope: source.scope ?? null,
|
|
1615
818
|
path: source.path ?? null,
|
|
1616
|
-
expose: source.expose ? [...source.expose].sort(
|
|
819
|
+
expose: source.expose ? [...source.expose].sort(compareCodeUnits) : null,
|
|
1617
820
|
toolName: source.toolName ?? null,
|
|
1618
821
|
annotations: source.annotations ?? null,
|
|
1619
822
|
ui: source.ui ?? null,
|
|
1620
823
|
mcp,
|
|
824
|
+
toolView: toolViewOf(source),
|
|
1621
825
|
rawBody: source.rawBody ?? false,
|
|
1622
826
|
safelistedBody: source.safelistedBody ?? false,
|
|
1623
827
|
rawResponse: source.rawResponse ?? false,
|
|
@@ -1635,7 +839,7 @@ function operationFingerprint(source) {
|
|
|
1635
839
|
});
|
|
1636
840
|
}
|
|
1637
841
|
function sortTools(tools) {
|
|
1638
|
-
return tools.sort((left, right) =>
|
|
842
|
+
return tools.sort((left, right) => compareCodeUnits(left.name, right.name) || compareCodeUnits(left.service, right.service) || compareCodeUnits(left.action, right.action) || compareCodeUnits(left.kind, right.kind));
|
|
1639
843
|
}
|
|
1640
844
|
function buildSurfaceManifest(config) {
|
|
1641
845
|
const operations = new Map;
|
|
@@ -1734,7 +938,7 @@ function buildSurfaceManifest(config) {
|
|
|
1734
938
|
if (explicitMcp)
|
|
1735
939
|
addToolProjection("MCP", null, explicitMcp);
|
|
1736
940
|
if (namedMcp) {
|
|
1737
|
-
for (const name of Object.keys(namedMcp).sort(
|
|
941
|
+
for (const name of Object.keys(namedMcp).sort(compareCodeUnits)) {
|
|
1738
942
|
const projection = namedMcp[name];
|
|
1739
943
|
if (projection)
|
|
1740
944
|
addToolProjection("MCP", name, projection);
|
|
@@ -1746,14 +950,14 @@ function buildSurfaceManifest(config) {
|
|
|
1746
950
|
addToolProjection("AGENT", null, agent ?? shared, agent ?? {});
|
|
1747
951
|
addToolProjection("CLI", null, config.toolSurfaces?.CLI ?? shared);
|
|
1748
952
|
const realtime = [];
|
|
1749
|
-
const realtimeContracts = Object.keys(config.realtime ?? {}).sort(
|
|
953
|
+
const realtimeContracts = Object.keys(config.realtime ?? {}).sort(compareCodeUnits);
|
|
1750
954
|
for (const contractName of realtimeContracts) {
|
|
1751
955
|
const contract = config.realtime?.[contractName];
|
|
1752
956
|
if (!contract)
|
|
1753
957
|
continue;
|
|
1754
958
|
for (const direction of ["serverToClient", "clientToServer"]) {
|
|
1755
959
|
const registry = contract[direction];
|
|
1756
|
-
for (const event of Object.keys(registry).sort(
|
|
960
|
+
for (const event of Object.keys(registry).sort(compareCodeUnits)) {
|
|
1757
961
|
const definition = registry[event];
|
|
1758
962
|
if (!definition)
|
|
1759
963
|
continue;
|
|
@@ -1784,22 +988,26 @@ function buildSurfaceManifest(config) {
|
|
|
1784
988
|
description: command.description,
|
|
1785
989
|
input: schemaDigest(command.input, "input") ?? digestValue({}),
|
|
1786
990
|
output: schemaDigest(command.output, "output")
|
|
1787
|
-
})).sort((left, right) =>
|
|
991
|
+
})).sort((left, right) => compareCodeUnits(left.name, right.name));
|
|
1788
992
|
for (const operation of operations.values()) {
|
|
1789
|
-
operation.http.sort((left, right) =>
|
|
993
|
+
operation.http.sort((left, right) => compareCodeUnits(left.path, right.path) || compareCodeUnits(left.method, right.method));
|
|
1790
994
|
}
|
|
1791
995
|
return SurfaceManifestSchema.parse({
|
|
1792
|
-
manifestVersion:
|
|
996
|
+
manifestVersion: SURFACE_MANIFEST_VERSION,
|
|
1793
997
|
digestVersion: 1,
|
|
1794
|
-
operations: [...operations.values()].sort((left, right) =>
|
|
1795
|
-
toolSurfaces: toolSurfaces.sort((left, right) =>
|
|
998
|
+
operations: [...operations.values()].sort((left, right) => compareCodeUnits(left.service, right.service) || compareCodeUnits(left.action, right.action) || compareCodeUnits(left.kind, right.kind)),
|
|
999
|
+
toolSurfaces: toolSurfaces.sort((left, right) => compareCodeUnits(left.transport, right.transport) || compareCodeUnits(left.surface ?? "", right.surface ?? "")),
|
|
1796
1000
|
realtimeContracts,
|
|
1797
1001
|
realtime,
|
|
1798
1002
|
cliOnly,
|
|
1799
|
-
extensions: [...config.extensions ?? []].sort((left, right) =>
|
|
1003
|
+
extensions: [...config.extensions ?? []].sort((left, right) => compareCodeUnits(left.transport, right.transport) || compareCodeUnits(left.name, right.name))
|
|
1800
1004
|
});
|
|
1801
1005
|
}
|
|
1802
1006
|
function assertSurfaceManifestSnapshot(manifest, snapshot) {
|
|
1007
|
+
const committed = snapshot.manifestVersion;
|
|
1008
|
+
if (committed !== SURFACE_MANIFEST_VERSION) {
|
|
1009
|
+
throw new Error(`Surface snapshot is manifestVersion ${String(committed)}; this build writes ` + `${SURFACE_MANIFEST_VERSION}. Regenerate it and review the diff — the format ` + "changed, so the first regeneration is expected to be large.");
|
|
1010
|
+
}
|
|
1803
1011
|
const actual = serializeSurfaceValue(SurfaceManifestSchema.parse(manifest));
|
|
1804
1012
|
const expected = serializeSurfaceValue(SurfaceManifestSchema.parse(snapshot));
|
|
1805
1013
|
if (actual !== expected) {
|
|
@@ -2005,7 +1213,7 @@ function assertSurfaceDiscovery(manifest, observed) {
|
|
|
2005
1213
|
if (observed.openApi) {
|
|
2006
1214
|
assertSameSet("HTTP/OpenAPI", manifest.operations.flatMap((operation) => operation.http.map((entry) => `${entry.method}:${entry.path.replace(/:([^/]+)/g, "{$1}")}`)), openApiOperations(observed.openApi));
|
|
2007
1215
|
}
|
|
2008
|
-
for (const transport of
|
|
1216
|
+
for (const transport of TOOL_TRANSPORTS) {
|
|
2009
1217
|
const names = observed[transport];
|
|
2010
1218
|
if (names) {
|
|
2011
1219
|
assertSameSet(`${transport} discovery`, expectedToolNames(manifest, transport, null), names);
|
|
@@ -2128,44 +1336,14 @@ actual: ${serializeSurfaceValue(actual)}`);
|
|
|
2128
1336
|
throw failure;
|
|
2129
1337
|
}
|
|
2130
1338
|
}
|
|
2131
|
-
|
|
2132
|
-
// src/testing.ts
|
|
2133
|
-
function resolveTestBaseUrl(origin, pathPrefix) {
|
|
2134
|
-
const base = new URL(origin ?? "http://stitchkit.test");
|
|
2135
|
-
if (base.pathname !== "/" || base.search || base.hash) {
|
|
2136
|
-
throw new TypeError("Handler test client origin must contain only an absolute origin");
|
|
2137
|
-
}
|
|
2138
|
-
const prefix = pathPrefix?.replace(/^\/+|\/+$/g, "");
|
|
2139
|
-
return prefix ? `${base.origin}/${prefix}` : base.origin;
|
|
2140
|
-
}
|
|
2141
|
-
function createHandlerFetch(handler, server) {
|
|
2142
|
-
return async (input, init) => handler(new Request(input, init), server);
|
|
2143
|
-
}
|
|
2144
|
-
function createTestClientConfig(config) {
|
|
2145
|
-
return {
|
|
2146
|
-
...config.client,
|
|
2147
|
-
baseUrl: resolveTestBaseUrl(config.origin, config.pathPrefix),
|
|
2148
|
-
fetch: createHandlerFetch(config.handler, config.server)
|
|
2149
|
-
};
|
|
2150
|
-
}
|
|
2151
|
-
function createHandlerTestClient(config) {
|
|
2152
|
-
return createClient(config.contract, createTestClientConfig(config), config.contractConfig);
|
|
2153
|
-
}
|
|
2154
|
-
function createHandlerTestClients(config) {
|
|
2155
|
-
return createClients(config.contracts, createTestClientConfig(config), config.contractConfig);
|
|
2156
|
-
}
|
|
2157
1339
|
export {
|
|
2158
1340
|
serializeSurfaceValue,
|
|
2159
1341
|
runSurfaceProbes,
|
|
2160
1342
|
runManagedResourceConformance,
|
|
2161
|
-
runAgentStoreConformance,
|
|
2162
1343
|
defineRealtimeProbe,
|
|
2163
1344
|
createRealtimeProbeDriver,
|
|
2164
1345
|
createHandlerTestClients,
|
|
2165
1346
|
createHandlerTestClient,
|
|
2166
|
-
createAgentRaceTrace,
|
|
2167
|
-
createAgentRaceDriver,
|
|
2168
|
-
createAgentRaceBarrier,
|
|
2169
1347
|
buildSurfaceManifest,
|
|
2170
1348
|
assertSurfaceManifestSnapshot,
|
|
2171
1349
|
assertSurfaceDiscovery,
|
|
@@ -2176,8 +1354,11 @@ export {
|
|
|
2176
1354
|
SurfaceManifestToolSchema,
|
|
2177
1355
|
SurfaceManifestSchema,
|
|
2178
1356
|
SurfaceManifestRealtimeEventSchema,
|
|
1357
|
+
SurfaceManifestOperationToolViewSchema,
|
|
2179
1358
|
SurfaceManifestOperationSchema,
|
|
1359
|
+
SurfaceManifestOperationMcpSchema,
|
|
2180
1360
|
SurfaceManifestExtensionSchema,
|
|
1361
|
+
SURFACE_MANIFEST_VERSION,
|
|
2181
1362
|
RealtimeRejectionObservationSchema,
|
|
2182
1363
|
RealtimeDisconnectObservationSchema,
|
|
2183
1364
|
ManagedResourceConformanceTraceOutcomeSchema,
|