stitchkit 0.93.0 → 0.94.1
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 +198 -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-shell-process.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/coding-tool-listing.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -1
- package/dist/agent-runtime/contained-darwin.d.ts +38 -0
- package/dist/agent-runtime/contained-darwin.d.ts.map +1 -0
- package/dist/agent-runtime/contained-files.d.ts +11 -26
- package/dist/agent-runtime/contained-files.d.ts.map +1 -1
- package/dist/agent-runtime/contained-scan.d.ts +21 -0
- package/dist/agent-runtime/contained-scan.d.ts.map +1 -0
- package/dist/agent-runtime/contained-write.d.ts +9 -0
- package/dist/agent-runtime/contained-write.d.ts.map +1 -0
- package/dist/agent-runtime/deferred-tool-types.d.ts +4 -3
- 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/harness-control.d.ts +0 -1
- package/dist/agent-runtime/harness-control.d.ts.map +1 -1
- package/dist/agent-runtime/harness.d.ts +0 -5
- package/dist/agent-runtime/harness.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +3 -2
- 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 +29 -0
- 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 +10 -5
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-records.d.ts +34 -0
- package/dist/agent-runtime/schedule-records.d.ts.map +1 -0
- package/dist/agent-runtime/schedules.d.ts +34 -0
- package/dist/agent-runtime/schedules.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite-bun.d.ts +12 -0
- 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 +12 -0
- 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/agent-runtime/store-conformance-lifecycle.d.ts +434 -0
- package/dist/agent-runtime/store-conformance-lifecycle.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts +18 -0
- package/dist/agent-runtime/store-conformance-ordering.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-support.d.ts +130 -0
- package/dist/agent-runtime/store-conformance-support.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts +12 -0
- package/dist/agent-runtime/store-conformance-terminal.d.ts.map +1 -0
- package/dist/agent-runtime/store-conformance.d.ts +40 -0
- 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-contract.d.ts +814 -0
- 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-rate.d.ts +21 -0
- package/dist/application/admission-rate.d.ts.map +1 -0
- package/dist/application/admission-run.d.ts +8 -0
- package/dist/application/admission-run.d.ts.map +1 -0
- package/dist/application/admission.d.ts +1 -1
- package/dist/application/admission.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-lock.d.ts +9 -34
- package/dist/application/diagnostic-journal-lock.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
- package/dist/application/events.d.ts +1 -1
- package/dist/application/events.d.ts.map +1 -1
- package/dist/application/file-state-store.d.ts +23 -0
- 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/notification-outbox.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/schedule.d.ts +0 -1
- package/dist/application/schedule.d.ts.map +1 -1
- package/dist/application/watch-hub-core.d.ts +122 -0
- package/dist/application/watch-hub-core.d.ts.map +1 -0
- package/dist/application/watch-hub.d.ts +3 -3
- package/dist/application/watch-hub.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts +14 -0
- package/dist/browser/client-executors.d.ts.map +1 -0
- 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 +3 -2
- 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-fetch.d.ts +22 -0
- package/dist/browser/http-fetch.d.ts.map +1 -0
- package/dist/browser/http.d.ts +2 -4
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/live-state-core.d.ts +63 -0
- package/dist/browser/live-state-core.d.ts.map +1 -0
- package/dist/browser/live-state.d.ts.map +1 -1
- package/dist/browser/realtime-client.d.ts +26 -0
- package/dist/browser/realtime-client.d.ts.map +1 -0
- 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-connection.d.ts +82 -0
- package/dist/browser/socket-io-connection.d.ts.map +1 -0
- package/dist/browser/socket-io-peer.d.ts +20 -0
- package/dist/browser/socket-io-peer.d.ts.map +1 -0
- package/dist/browser/socket-io-trace.d.ts +31 -0
- package/dist/browser/socket-io-trace.d.ts.map +1 -0
- package/dist/browser/socket-io.d.ts +24 -18
- 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/client-types.d.ts +134 -0
- package/dist/contract/client-types.d.ts.map +1 -0
- package/dist/contract/define-validation.d.ts +30 -0
- package/dist/contract/define-validation.d.ts.map +1 -0
- package/dist/contract/define.d.ts +47 -394
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/normalize.d.ts +56 -0
- package/dist/contract/normalize.d.ts.map +1 -0
- package/dist/contract/runtime-context.d.ts +131 -0
- package/dist/contract/runtime-context.d.ts.map +1 -0
- package/dist/contract/tool-options.d.ts +105 -0
- package/dist/contract/tool-options.d.ts.map +1 -0
- package/dist/contract/tool-view.d.ts +148 -0
- package/dist/contract/tool-view.d.ts.map +1 -0
- package/dist/declaration/declaration.d.ts.map +1 -0
- package/dist/durability/contract.d.ts +259 -0
- package/dist/durability/contract.d.ts.map +1 -0
- package/dist/durability/effect.d.ts +24 -0
- package/dist/durability/effect.d.ts.map +1 -0
- package/dist/durability/engine.d.ts +14 -0
- package/dist/durability/engine.d.ts.map +1 -0
- package/dist/durability/events.d.ts +103 -0
- package/dist/durability/events.d.ts.map +1 -0
- package/dist/durability/json.d.ts +3 -0
- package/dist/durability/json.d.ts.map +1 -0
- package/dist/durability/ledger.d.ts +27 -0
- package/dist/durability/ledger.d.ts.map +1 -0
- package/dist/durability/parks.d.ts +22 -0
- package/dist/durability/parks.d.ts.map +1 -0
- package/dist/durability/scheduler.d.ts +30 -0
- 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/entrypoints/agent-runtime/browser.js +124 -0
- package/dist/entrypoints/agent-runtime/coding-tools.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/coding-tools.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/coding-tools.js +22 -0
- package/dist/entrypoints/agent-runtime/harness.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/harness.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/harness.js +739 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts +2 -0
- package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/openrouter.js +270 -0
- package/dist/entrypoints/agent-runtime/sandbox.d.ts +5 -0
- package/dist/entrypoints/agent-runtime/sandbox.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime/sandbox.js +797 -0
- 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/entrypoints/agent-runtime/sqlite/bun.js +44 -0
- 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/entrypoints/agent-runtime/sqlite/node.js +46 -0
- 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 +1116 -0
- package/dist/entrypoints/agent-runtime.d.ts +42 -0
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -0
- package/dist/entrypoints/agent-runtime.js +2670 -0
- package/dist/entrypoints/application/diagnostic-journal.d.ts +21 -0
- package/dist/entrypoints/application/diagnostic-journal.d.ts.map +1 -0
- package/dist/entrypoints/application/diagnostic-journal.js +492 -0
- package/dist/entrypoints/application/grammy.d.ts +2 -0
- package/dist/entrypoints/application/grammy.d.ts.map +1 -0
- package/dist/entrypoints/application/grammy.js +169 -0
- package/dist/entrypoints/application/opentelemetry.d.ts +2 -0
- package/dist/entrypoints/application/opentelemetry.d.ts.map +1 -0
- package/dist/entrypoints/application/opentelemetry.js +250 -0
- package/dist/entrypoints/application/schemas.d.ts +15 -0
- package/dist/entrypoints/application/schemas.d.ts.map +1 -0
- package/dist/entrypoints/application/schemas.js +27 -0
- package/dist/entrypoints/application.d.ts +23 -0
- package/dist/entrypoints/application.d.ts.map +1 -0
- package/dist/entrypoints/application.js +2016 -0
- package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -0
- package/dist/entrypoints/bin/upgrade-cli.js +177 -0
- package/dist/entrypoints/cli.d.ts +44 -0
- package/dist/entrypoints/cli.d.ts.map +1 -0
- package/dist/entrypoints/cli.js +773 -0
- package/dist/entrypoints/contract.d.ts +12 -0
- package/dist/entrypoints/contract.d.ts.map +1 -0
- package/dist/entrypoints/contract.js +64 -0
- package/dist/entrypoints/declaration.d.ts +2 -0
- package/dist/entrypoints/declaration.d.ts.map +1 -0
- package/dist/entrypoints/declaration.js +183 -0
- package/dist/entrypoints/files.d.ts +5 -0
- package/dist/entrypoints/files.d.ts.map +1 -0
- package/dist/entrypoints/files.js +111 -0
- package/dist/entrypoints/geo.d.ts +3 -0
- package/dist/entrypoints/geo.d.ts.map +1 -0
- package/dist/entrypoints/geo.js +245 -0
- package/dist/entrypoints/google.d.ts +2 -0
- package/dist/entrypoints/google.d.ts.map +1 -0
- package/dist/entrypoints/google.js +175 -0
- package/dist/entrypoints/index.d.ts +17 -0
- package/dist/entrypoints/index.d.ts.map +1 -0
- package/dist/entrypoints/index.js +764 -0
- package/dist/entrypoints/live.d.ts +19 -0
- package/dist/entrypoints/live.d.ts.map +1 -0
- package/dist/entrypoints/live.js +302 -0
- package/dist/entrypoints/node.d.ts +19 -0
- package/dist/entrypoints/node.d.ts.map +1 -0
- package/dist/entrypoints/node.js +308 -0
- package/dist/entrypoints/oauth.d.ts +2 -0
- package/dist/entrypoints/oauth.d.ts.map +1 -0
- package/dist/entrypoints/oauth.js +170 -0
- package/dist/entrypoints/observability.d.ts +19 -0
- package/dist/entrypoints/observability.d.ts.map +1 -0
- package/dist/entrypoints/observability.js +567 -0
- package/dist/entrypoints/primitives.d.ts +3 -0
- package/dist/entrypoints/primitives.d.ts.map +1 -0
- package/dist/entrypoints/primitives.js +749 -0
- package/dist/entrypoints/react.d.ts +5 -0
- package/dist/entrypoints/react.d.ts.map +1 -0
- package/dist/entrypoints/react.js +403 -0
- package/dist/entrypoints/release.d.ts +15 -0
- package/dist/entrypoints/release.d.ts.map +1 -0
- package/dist/entrypoints/release.js +196 -0
- package/dist/entrypoints/remote.d.ts +9 -0
- package/dist/entrypoints/remote.d.ts.map +1 -0
- package/dist/entrypoints/remote.js +66 -0
- package/dist/entrypoints/server.d.ts +39 -0
- package/dist/entrypoints/server.d.ts.map +1 -0
- package/dist/entrypoints/server.js +2009 -0
- package/dist/entrypoints/telegram.d.ts +3 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -0
- package/dist/entrypoints/telegram.js +224 -0
- package/dist/entrypoints/testing.d.ts +10 -0
- package/dist/entrypoints/testing.d.ts.map +1 -0
- package/dist/entrypoints/testing.js +1377 -0
- package/dist/entrypoints/tools/connections.d.ts +19 -0
- package/dist/entrypoints/tools/connections.d.ts.map +1 -0
- package/dist/entrypoints/tools/connections.js +1110 -0
- package/dist/entrypoints/tools/contract.d.ts +29 -0
- package/dist/entrypoints/tools/contract.d.ts.map +1 -0
- package/dist/entrypoints/tools/contract.js +24 -0
- package/dist/entrypoints/tools/invoker.d.ts +9 -0
- package/dist/entrypoints/tools/invoker.d.ts.map +1 -0
- package/dist/entrypoints/tools/invoker.js +20 -0
- package/dist/entrypoints/tools.d.ts +54 -0
- package/dist/entrypoints/tools.d.ts.map +1 -0
- package/dist/entrypoints/tools.js +3009 -0
- package/dist/entrypoints/tracking/server.d.ts +15 -0
- package/dist/entrypoints/tracking/server.d.ts.map +1 -0
- package/dist/entrypoints/tracking.d.ts +24 -0
- package/dist/entrypoints/tracking.d.ts.map +1 -0
- package/dist/entrypoints/tracking.js +1140 -0
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +14 -0
- package/dist/files/file-io.d.ts.map +1 -0
- package/dist/google/google.d.ts.map +1 -0
- package/dist/index-0b1ess5e.js +38 -0
- package/dist/index-1j8pm5t0.js +412 -0
- package/dist/index-1zbbzgfh.js +89 -0
- package/dist/index-2bxbyab0.js +47 -0
- package/dist/index-2gxzjvyr.js +266 -0
- package/dist/index-35mh5bhj.js +177 -0
- package/dist/index-48ffdxgk.js +6 -0
- package/dist/index-4gcnakhx.js +82 -0
- package/dist/index-55hkhm67.js +343 -0
- package/dist/index-79z7m7dt.js +675 -0
- package/dist/index-7f68ghdn.js +3618 -0
- package/dist/index-7p1f0vp2.js +154 -0
- package/dist/index-83bdg97s.js +16 -0
- package/dist/index-863ea9jb.js +154 -0
- package/dist/index-8p52kd5p.js +242 -0
- package/dist/index-d9pk3td4.js +326 -0
- package/dist/index-dce5wxcq.js +63 -0
- package/dist/index-e01r054k.js +105 -0
- package/dist/index-ensd0r74.js +595 -0
- package/dist/index-eqqvgdb3.js +46 -0
- package/dist/index-gxrt5h6v.js +341 -0
- package/dist/index-h6eeys1v.js +211 -0
- package/dist/index-ham5sz8m.js +734 -0
- package/dist/index-het2he5g.js +1387 -0
- package/dist/index-hffjpmq9.js +30 -0
- package/dist/index-hmp4800j.js +51 -0
- package/dist/index-k30h66yd.js +317 -0
- package/dist/index-k5hsfc3j.js +31 -0
- package/dist/index-khtgb21r.js +92 -0
- package/dist/index-m9zn6cpq.js +51 -0
- package/dist/index-ndddxtyx.js +324 -0
- package/dist/index-ngfhvfpd.js +30 -0
- package/dist/index-np4m8hd3.js +1205 -0
- package/dist/index-p3vsv1fb.js +3493 -0
- package/dist/index-p5r7qpdd.js +85 -0
- package/dist/index-p9e0w8hs.js +1084 -0
- package/dist/index-p9sh0xx4.js +64 -0
- package/dist/index-paz6sgdp.js +371 -0
- package/dist/index-px2gm2jp.js +448 -0
- package/dist/index-qwhynv6x.js +103 -0
- package/dist/index-s812ycat.js +65 -0
- package/dist/index-sp1tzwnb.js +281 -0
- package/dist/index-t9rhjr9f.js +2306 -0
- package/dist/index-v260df89.js +342 -0
- package/dist/index-w906953s.js +946 -0
- package/dist/index-wdkt63w3.js +214 -0
- package/dist/index-wqgjfstn.js +18 -0
- package/dist/index-wsm5w4ee.js +1023 -0
- package/dist/index-xw3s75nj.js +100 -0
- package/dist/index-yw4fzmdz.js +268 -0
- package/dist/index-zfrhfn82.js +85 -0
- package/dist/index-znfs20ss.js +98 -0
- package/dist/internal/atomic-file.d.ts +23 -2
- package/dist/internal/atomic-file.d.ts.map +1 -1
- 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/exclusive-lock.d.ts +51 -0
- package/dist/internal/exclusive-lock.d.ts.map +1 -0
- package/dist/internal/logger.d.ts.map +1 -0
- package/dist/internal/process-identity.d.ts +47 -0
- package/dist/internal/process-identity.d.ts.map +1 -0
- package/dist/internal/request.d.ts.map +1 -0
- 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/with-exclusive-lock.d.ts +67 -0
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -0
- package/dist/internal/zod-issues.d.ts +38 -0
- package/dist/internal/zod-issues.d.ts.map +1 -0
- package/dist/json-schema/dialect.d.ts +17 -0
- 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-client.d.ts.map +1 -1
- package/dist/live/watch-delta.d.ts.map +1 -1
- package/dist/oauth/authorization-code.d.ts +57 -0
- package/dist/oauth/authorization-code.d.ts.map +1 -0
- package/dist/observability/audit.d.ts +3 -3
- 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/observability/bounded-sink.d.ts +81 -0
- 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 +2 -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/registry.d.ts +0 -5
- package/dist/realtime/registry.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/bun.d.ts +0 -1
- package/dist/server/bun.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 +19 -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-registry.d.ts +54 -0
- package/dist/server/implement-registry.d.ts.map +1 -0
- package/dist/server/implement.d.ts +9 -55
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/middleware/auth.d.ts +1 -31
- 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/jwt.d.ts +31 -0
- package/dist/server/middleware/jwt.d.ts.map +1 -0
- 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-reader.d.ts +22 -0
- package/dist/server/multipart-reader.d.ts.map +1 -0
- package/dist/server/multipart.d.ts +1 -1
- package/dist/server/multipart.d.ts.map +1 -1
- package/dist/server/oauth/cimd.d.ts +88 -0
- package/dist/server/oauth/cimd.d.ts.map +1 -0
- package/dist/server/oauth/endpoints.d.ts +39 -0
- package/dist/server/oauth/endpoints.d.ts.map +1 -0
- package/dist/server/oauth/metadata.d.ts +28 -0
- package/dist/server/oauth/metadata.d.ts.map +1 -0
- package/dist/server/oauth/provider.d.ts +117 -0
- 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/streaming-pump.d.ts +66 -0
- package/dist/server/streaming-pump.d.ts.map +1 -0
- package/dist/server/streaming-route.d.ts +12 -5
- package/dist/server/streaming-route.d.ts.map +1 -1
- package/dist/server/types.d.ts +10 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/unix-client-bun.d.ts.map +1 -1
- package/dist/server/unix-client-http1.d.ts +76 -0
- package/dist/server/unix-client-http1.d.ts.map +1 -0
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/testing/handler-clients.d.ts +32 -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/realtime-probe.d.ts +33 -0
- package/dist/testing/realtime-probe.d.ts.map +1 -0
- package/dist/testing/surface-conformance.d.ts +2 -32
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest-digest.d.ts +44 -0
- package/dist/testing/surface-manifest-digest.d.ts.map +1 -0
- package/dist/testing/surface-manifest.d.ts +30 -4
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/agent.d.ts +1 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/args-fields.d.ts +31 -0
- package/dist/tools/cli/args-fields.d.ts.map +1 -0
- package/dist/tools/cli/args-route.d.ts +42 -0
- package/dist/tools/cli/args-route.d.ts.map +1 -0
- package/dist/tools/cli/args-view.d.ts +32 -0
- package/dist/tools/cli/args-view.d.ts.map +1 -0
- package/dist/tools/cli/args.d.ts +80 -0
- package/dist/tools/cli/args.d.ts.map +1 -0
- package/dist/tools/cli/argument-error.d.ts +5 -0
- package/dist/tools/cli/argument-error.d.ts.map +1 -0
- package/dist/tools/cli/checkpoint.d.ts +24 -0
- package/dist/tools/cli/checkpoint.d.ts.map +1 -0
- package/dist/tools/cli/command.d.ts +70 -0
- package/dist/tools/cli/command.d.ts.map +1 -0
- package/dist/tools/cli/config.d.ts +90 -0
- 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 +50 -0
- 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 +34 -0
- package/dist/tools/cli/installer.d.ts.map +1 -0
- package/dist/tools/cli/invoke.d.ts +144 -0
- 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 +80 -0
- package/dist/tools/cli/manifest.d.ts.map +1 -0
- package/dist/tools/cli/policy.d.ts +27 -0
- 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 +40 -0
- 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 +81 -0
- package/dist/tools/cli/signature.d.ts.map +1 -0
- package/dist/tools/cli/stream.d.ts +93 -0
- package/dist/tools/cli/stream.d.ts.map +1 -0
- package/dist/tools/cli/update.d.ts +145 -0
- package/dist/tools/cli/update.d.ts.map +1 -0
- package/dist/tools/cli/view.d.ts +12 -0
- package/dist/tools/cli/view.d.ts.map +1 -0
- package/dist/tools/cli/wait.d.ts +54 -0
- 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-args.d.ts +23 -0
- package/dist/tools/execute-args.d.ts.map +1 -0
- package/dist/tools/execute-hooks.d.ts +146 -0
- package/dist/tools/execute-hooks.d.ts.map +1 -0
- package/dist/tools/execute-result.d.ts +40 -0
- package/dist/tools/execute-result.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +31 -193
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts +9 -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 +13 -4
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/lifecycle.d.ts +1 -1
- package/dist/tools/lifecycle.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 +62 -0
- package/dist/tools/mcp/app.d.ts.map +1 -0
- package/dist/tools/mcp/catalog.d.ts +68 -0
- package/dist/tools/mcp/catalog.d.ts.map +1 -0
- package/dist/tools/mcp/handler.d.ts +46 -0
- package/dist/tools/mcp/handler.d.ts.map +1 -0
- package/dist/tools/mcp/mount.d.ts +152 -0
- package/dist/tools/mcp/mount.d.ts.map +1 -0
- package/dist/tools/mcp/prepare.d.ts +76 -0
- package/dist/tools/mcp/prepare.d.ts.map +1 -0
- package/dist/tools/mcp/progress.d.ts +46 -0
- package/dist/tools/mcp/progress.d.ts.map +1 -0
- package/dist/tools/mcp/register.d.ts +36 -0
- package/dist/tools/mcp/register.d.ts.map +1 -0
- package/dist/tools/mcp/round-context.d.ts +38 -0
- package/dist/tools/mcp/round-context.d.ts.map +1 -0
- package/dist/tools/mcp/round-policy.d.ts +33 -0
- package/dist/tools/mcp/round-policy.d.ts.map +1 -0
- package/dist/tools/mcp/round.d.ts +53 -0
- package/dist/tools/mcp/round.d.ts.map +1 -0
- package/dist/tools/mcp/runtime-tools.d.ts +25 -0
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -0
- package/dist/tools/mcp/stdio-signals.d.ts +33 -0
- package/dist/tools/mcp/stdio-signals.d.ts.map +1 -0
- package/dist/tools/mcp/stdio.d.ts +20 -0
- package/dist/tools/mcp/stdio.d.ts.map +1 -0
- package/dist/tools/mcp/trace.d.ts +12 -0
- package/dist/tools/mcp/trace.d.ts.map +1 -0
- package/dist/tools/mount.d.ts +14 -7
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/native-definition.d.ts +4 -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 +41 -0
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -0
- package/dist/tools/operations/async-operation-runtime-types.d.ts +69 -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/operations/define-wait-tool.d.ts +22 -0
- 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 +13 -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/schema/presentation.d.ts +24 -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/tool-logger.d.ts +1 -1
- package/dist/tools/tool-logger.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/transfer/define-download-tool.d.ts +18 -0
- package/dist/tools/transfer/define-download-tool.d.ts.map +1 -0
- package/dist/tools/transfer/define-upload-tool.d.ts +16 -0
- package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -0
- package/dist/tools/transfer/define-view-file-tool.d.ts +10 -0
- package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -0
- package/dist/tools/transfer/download-core.d.ts +20 -0
- package/dist/tools/transfer/download-core.d.ts.map +1 -0
- package/dist/tools/transfer/managed-file-error.d.ts +6 -0
- package/dist/tools/transfer/managed-file-error.d.ts.map +1 -0
- package/dist/tools/transfer/mount-download.d.ts +41 -0
- package/dist/tools/transfer/mount-download.d.ts.map +1 -0
- package/dist/tools/transfer/mount-upload.d.ts +21 -0
- 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/transfer/upload-core.d.ts +4 -0
- 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/transfer/view-file.d.ts +62 -0
- 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/client-listeners.d.ts +30 -0
- package/dist/tracking/client-listeners.d.ts.map +1 -0
- package/dist/tracking/client-visit.d.ts +61 -0
- package/dist/tracking/client-visit.d.ts.map +1 -0
- package/dist/tracking/client.d.ts +3 -2
- package/dist/tracking/client.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 +487 -0
- package/llms/application.txt +886 -0
- package/llms/cli.2.txt +80 -0
- package/llms/cli.txt +948 -0
- package/llms/contract.txt +606 -0
- package/llms/declaration.txt +286 -0
- package/llms/files.txt +33 -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 +647 -0
- package/llms/tools.3.txt +288 -0
- package/llms/tools.txt +966 -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 +312 -77
- package/llms.txt +54 -5
- package/package.json +84 -83
- package/dist/agent-runtime/durability-contract.d.ts +0 -176
- package/dist/agent-runtime/durability-contract.d.ts.map +0 -1
- package/dist/agent-runtime/durability-json.d.ts +0 -3
- package/dist/agent-runtime/durability-json.d.ts.map +0 -1
- package/dist/agent-runtime/durability-ledger.d.ts +0 -16
- package/dist/agent-runtime/durability-ledger.d.ts.map +0 -1
- package/dist/agent-runtime/durability-scheduler.d.ts +0 -29
- package/dist/agent-runtime/durability-scheduler.d.ts.map +0 -1
- package/dist/agent-runtime/durability.d.ts +0 -14
- package/dist/agent-runtime/durability.d.ts.map +0 -1
- package/dist/agent-runtime/store-driver.d.ts +0 -814
- 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-browser.js +0 -124
- package/dist/agent-runtime-coding-tools.d.ts +0 -2
- 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 +0 -2
- package/dist/agent-runtime-harness.d.ts.map +0 -1
- package/dist/agent-runtime-harness.js +0 -729
- package/dist/agent-runtime-openrouter.d.ts +0 -29
- package/dist/agent-runtime-openrouter.d.ts.map +0 -1
- package/dist/agent-runtime-openrouter.js +0 -270
- package/dist/agent-runtime-sandbox.d.ts +0 -5
- package/dist/agent-runtime-sandbox.d.ts.map +0 -1
- package/dist/agent-runtime-sandbox.js +0 -798
- package/dist/agent-runtime-sqlite-bun.d.ts +0 -11
- package/dist/agent-runtime-sqlite-bun.d.ts.map +0 -1
- package/dist/agent-runtime-sqlite-bun.js +0 -42
- package/dist/agent-runtime-sqlite-node.d.ts +0 -11
- package/dist/agent-runtime-sqlite-node.d.ts.map +0 -1
- package/dist/agent-runtime-sqlite-node.js +0 -44
- 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 +0 -38
- package/dist/agent-runtime.d.ts.map +0 -1
- package/dist/agent-runtime.js +0 -2607
- package/dist/application/channel.d.ts.map +0 -1
- package/dist/application-diagnostic-journal.d.ts +0 -21
- package/dist/application-diagnostic-journal.d.ts.map +0 -1
- package/dist/application-diagnostic-journal.js +0 -632
- package/dist/application-grammy.d.ts +0 -2
- package/dist/application-grammy.d.ts.map +0 -1
- package/dist/application-grammy.js +0 -169
- package/dist/application-opentelemetry.d.ts +0 -2
- package/dist/application-opentelemetry.d.ts.map +0 -1
- package/dist/application-opentelemetry.js +0 -250
- package/dist/application-schemas.d.ts +0 -15
- package/dist/application-schemas.d.ts.map +0 -1
- package/dist/application-schemas.js +0 -27
- package/dist/application.d.ts +0 -22
- package/dist/application.d.ts.map +0 -1
- package/dist/application.js +0 -1977
- package/dist/cli.d.ts +0 -41
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -753
- package/dist/contract/index.d.ts +0 -8
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/contract/index.js +0 -55
- package/dist/declaration.d.ts.map +0 -1
- package/dist/declaration.js +0 -183
- package/dist/files.d.ts +0 -3
- package/dist/files.d.ts.map +0 -1
- package/dist/files.js +0 -15
- package/dist/geo.d.ts +0 -3
- package/dist/geo.d.ts.map +0 -1
- package/dist/geo.js +0 -245
- package/dist/google.d.ts.map +0 -1
- package/dist/google.js +0 -175
- package/dist/index-0a349c33.js +0 -470
- package/dist/index-0j3vcp5m.js +0 -28
- package/dist/index-2c2bjw3s.js +0 -51
- package/dist/index-2na0qrfn.js +0 -214
- package/dist/index-2qzskm8h.js +0 -63
- package/dist/index-3bmnp41g.js +0 -2169
- package/dist/index-3xwxfj4z.js +0 -334
- package/dist/index-4fpa9dy2.js +0 -51
- package/dist/index-6kyksz9y.js +0 -268
- package/dist/index-77fekveh.js +0 -44
- package/dist/index-7gnkny4z.js +0 -326
- package/dist/index-7zbps32p.js +0 -89
- package/dist/index-9f8ztey6.js +0 -588
- package/dist/index-a11g2kry.js +0 -866
- package/dist/index-a916km3r.js +0 -45
- package/dist/index-actkayzn.js +0 -367
- package/dist/index-bn2cjajt.js +0 -524
- package/dist/index-bx75zwt7.js +0 -63
- package/dist/index-cby4ar3v.js +0 -46
- package/dist/index-cnyk6te3.js +0 -77
- package/dist/index-cxqhvq21.js +0 -413
- package/dist/index-e0znv5gn.js +0 -176
- package/dist/index-e42wzzz5.js +0 -154
- package/dist/index-f477k430.js +0 -324
- package/dist/index-f9mb610r.js +0 -177
- package/dist/index-fadnxwna.js +0 -1046
- package/dist/index-fq77yfzc.js +0 -1303
- package/dist/index-h9etkkyk.js +0 -1126
- package/dist/index-hrbajay7.js +0 -1196
- package/dist/index-kw9t5ayn.js +0 -507
- package/dist/index-mzvgxp0n.js +0 -80
- package/dist/index-n0f51dfn.js +0 -3170
- package/dist/index-p13mwz16.js +0 -16
- package/dist/index-s8cnx02s.js +0 -90
- package/dist/index-sr93cwf9.js +0 -325
- package/dist/index-tmwcrptx.js +0 -85
- package/dist/index-v5573g1k.js +0 -142
- package/dist/index-vjpvjqpn.js +0 -86
- package/dist/index-vk3kq9sb.js +0 -3344
- package/dist/index-wc4x00bn.js +0 -103
- package/dist/index-wnfk50r0.js +0 -211
- package/dist/index-yewwh1w4.js +0 -647
- package/dist/index-yn8remb1.js +0 -290
- package/dist/index-ywd0y6m1.js +0 -394
- package/dist/index-zwkgfq1s.js +0 -345
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -632
- package/dist/internal/errors.d.ts +0 -92
- package/dist/internal/errors.d.ts.map +0 -1
- package/dist/internal/observability-sink.d.ts +0 -81
- package/dist/internal/observability-sink.d.ts.map +0 -1
- package/dist/live.d.ts +0 -19
- package/dist/live.d.ts.map +0 -1
- package/dist/live.js +0 -282
- package/dist/logger.d.ts.map +0 -1
- package/dist/node.d.ts +0 -18
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -303
- package/dist/oauth.d.ts +0 -57
- package/dist/oauth.d.ts.map +0 -1
- package/dist/oauth.js +0 -170
- package/dist/observability/index.d.ts +0 -19
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js +0 -569
- package/dist/primitives.d.ts +0 -3
- package/dist/primitives.d.ts.map +0 -1
- package/dist/primitives.js +0 -754
- package/dist/react.d.ts +0 -5
- package/dist/react.d.ts.map +0 -1
- package/dist/react.js +0 -403
- package/dist/release.d.ts +0 -15
- package/dist/release.d.ts.map +0 -1
- package/dist/release.js +0 -196
- package/dist/remote.d.ts +0 -9
- 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 +0 -23
- package/dist/server/file-state-store.d.ts.map +0 -1
- package/dist/server/index.d.ts +0 -36
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -1745
- package/dist/server/request.d.ts.map +0 -1
- package/dist/telegram.d.ts +0 -3
- package/dist/telegram.d.ts.map +0 -1
- package/dist/telegram.js +0 -224
- package/dist/testing/agent-store-conformance.d.ts +0 -40
- 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/testing.js +0 -2209
- package/dist/tool-invoker.d.ts +0 -9
- 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 +0 -143
- package/dist/tools/cli-args.d.ts.map +0 -1
- package/dist/tools/cli-checkpoint.d.ts +0 -24
- package/dist/tools/cli-checkpoint.d.ts.map +0 -1
- package/dist/tools/cli-command.d.ts +0 -70
- package/dist/tools/cli-command.d.ts.map +0 -1
- package/dist/tools/cli-format.d.ts +0 -49
- package/dist/tools/cli-format.d.ts.map +0 -1
- package/dist/tools/cli-installer.d.ts +0 -34
- package/dist/tools/cli-installer.d.ts.map +0 -1
- package/dist/tools/cli-invoke.d.ts +0 -143
- package/dist/tools/cli-invoke.d.ts.map +0 -1
- package/dist/tools/cli-manifest.d.ts +0 -80
- package/dist/tools/cli-manifest.d.ts.map +0 -1
- package/dist/tools/cli-policy.d.ts +0 -27
- package/dist/tools/cli-policy.d.ts.map +0 -1
- package/dist/tools/cli-profile.d.ts +0 -40
- package/dist/tools/cli-profile.d.ts.map +0 -1
- package/dist/tools/cli-signature.d.ts +0 -81
- package/dist/tools/cli-signature.d.ts.map +0 -1
- package/dist/tools/cli-stream.d.ts +0 -93
- package/dist/tools/cli-stream.d.ts.map +0 -1
- package/dist/tools/cli-update.d.ts +0 -126
- package/dist/tools/cli-update.d.ts.map +0 -1
- package/dist/tools/cli-view.d.ts +0 -12
- package/dist/tools/cli-view.d.ts.map +0 -1
- package/dist/tools/cli-wait.d.ts +0 -54
- package/dist/tools/cli-wait.d.ts.map +0 -1
- package/dist/tools/cli.d.ts +0 -94
- 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 +0 -20
- package/dist/tools/connections/index.d.ts.map +0 -1
- package/dist/tools/connections/index.js +0 -1107
- package/dist/tools/define-download-tool.d.ts +0 -18
- package/dist/tools/define-download-tool.d.ts.map +0 -1
- package/dist/tools/define-upload-tool.d.ts +0 -16
- package/dist/tools/define-upload-tool.d.ts.map +0 -1
- package/dist/tools/define-view-file-tool.d.ts +0 -10
- package/dist/tools/define-view-file-tool.d.ts.map +0 -1
- package/dist/tools/define-wait-tool.d.ts +0 -22
- package/dist/tools/define-wait-tool.d.ts.map +0 -1
- package/dist/tools/download-core.d.ts +0 -20
- 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 +0 -17
- 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 +0 -6
- package/dist/tools/managed-file-error.d.ts.map +0 -1
- package/dist/tools/mcp-app.d.ts +0 -62
- package/dist/tools/mcp-app.d.ts.map +0 -1
- package/dist/tools/mcp-catalog.d.ts +0 -68
- package/dist/tools/mcp-catalog.d.ts.map +0 -1
- package/dist/tools/mcp-handler.d.ts +0 -46
- package/dist/tools/mcp-handler.d.ts.map +0 -1
- package/dist/tools/mcp-prepare.d.ts +0 -75
- package/dist/tools/mcp-prepare.d.ts.map +0 -1
- package/dist/tools/mcp-progress.d.ts +0 -46
- package/dist/tools/mcp-progress.d.ts.map +0 -1
- package/dist/tools/mcp-round-policy.d.ts +0 -33
- package/dist/tools/mcp-round-policy.d.ts.map +0 -1
- package/dist/tools/mcp-round.d.ts +0 -61
- package/dist/tools/mcp-round.d.ts.map +0 -1
- package/dist/tools/mcp-stdio-signals.d.ts +0 -33
- package/dist/tools/mcp-stdio-signals.d.ts.map +0 -1
- package/dist/tools/mcp-stdio.d.ts +0 -20
- package/dist/tools/mcp-stdio.d.ts.map +0 -1
- package/dist/tools/mcp-trace.d.ts +0 -12
- package/dist/tools/mcp-trace.d.ts.map +0 -1
- package/dist/tools/mcp.d.ts +0 -152
- package/dist/tools/mcp.d.ts.map +0 -1
- package/dist/tools/mount-download.d.ts +0 -41
- package/dist/tools/mount-download.d.ts.map +0 -1
- package/dist/tools/mount-upload.d.ts +0 -21
- 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 +0 -28
- package/dist/tools/oauth-metadata.d.ts.map +0 -1
- package/dist/tools/oauth-provider.d.ts +0 -184
- 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 +0 -22
- 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 +0 -4
- 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 +0 -62
- 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 +0 -29
- package/dist/tools-contract.d.ts.map +0 -1
- package/dist/tools-contract.js +0 -24
- package/dist/tools.d.ts +0 -50
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -2930
- package/dist/tracking-server.d.ts +0 -15
- package/dist/tracking-server.d.ts.map +0 -1
- package/dist/tracking.d.ts +0 -24
- package/dist/tracking.d.ts.map +0 -1
- package/dist/tracking.js +0 -1092
- package/dist/upgrade-cli.d.ts.map +0 -1
- package/dist/upgrade-cli.js +0 -177
- /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/{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
|
@@ -0,0 +1,1205 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toJsonSchema
|
|
3
|
+
} from "./index-eqqvgdb3.js";
|
|
4
|
+
import {
|
|
5
|
+
validateDeclaredOutput
|
|
6
|
+
} from "./index-znfs20ss.js";
|
|
7
|
+
import {
|
|
8
|
+
AppError
|
|
9
|
+
} from "./index-2vtcmrj9.js";
|
|
10
|
+
import {
|
|
11
|
+
serializeCanonicalJson
|
|
12
|
+
} from "./index-k5hsfc3j.js";
|
|
13
|
+
import {
|
|
14
|
+
isRecord
|
|
15
|
+
} from "./index-hffjpmq9.js";
|
|
16
|
+
|
|
17
|
+
// src/tools/schema/portable-formats.ts
|
|
18
|
+
var PORTABLE_JSON_SCHEMA_FORMATS = new Set([
|
|
19
|
+
"date",
|
|
20
|
+
"time",
|
|
21
|
+
"date-time",
|
|
22
|
+
"duration",
|
|
23
|
+
"uri",
|
|
24
|
+
"uri-reference",
|
|
25
|
+
"uri-template",
|
|
26
|
+
"email",
|
|
27
|
+
"hostname",
|
|
28
|
+
"ipv4",
|
|
29
|
+
"ipv6",
|
|
30
|
+
"regex",
|
|
31
|
+
"uuid",
|
|
32
|
+
"json-pointer",
|
|
33
|
+
"relative-json-pointer"
|
|
34
|
+
]);
|
|
35
|
+
function propertyPath(prefix, property) {
|
|
36
|
+
return prefix ? `${prefix}.${property}` : property;
|
|
37
|
+
}
|
|
38
|
+
function keywordPath(prefix, keyword) {
|
|
39
|
+
if (prefix && keyword.startsWith("["))
|
|
40
|
+
return `${prefix}${keyword}`;
|
|
41
|
+
return prefix ? `${prefix}.${keyword}` : keyword;
|
|
42
|
+
}
|
|
43
|
+
function findNonPortableFormats(schema, allowFormats = []) {
|
|
44
|
+
const allowed = new Set([...PORTABLE_JSON_SCHEMA_FORMATS, ...allowFormats]);
|
|
45
|
+
const found = [];
|
|
46
|
+
const pending = [{ value: schema, path: "" }];
|
|
47
|
+
while (pending.length > 0) {
|
|
48
|
+
const current = pending.pop();
|
|
49
|
+
if (!current || !isRecord(current.value))
|
|
50
|
+
continue;
|
|
51
|
+
const format = current.value.format;
|
|
52
|
+
if (typeof format === "string" && !allowed.has(format)) {
|
|
53
|
+
found.push({ path: current.path || "(root)", format });
|
|
54
|
+
}
|
|
55
|
+
const properties = current.value.properties;
|
|
56
|
+
if (isRecord(properties)) {
|
|
57
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
58
|
+
pending.push({ value, path: propertyPath(current.path, key) });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (const mapKey of ["$defs", "definitions", "patternProperties", "dependentSchemas"]) {
|
|
62
|
+
const entries = current.value[mapKey];
|
|
63
|
+
if (!isRecord(entries))
|
|
64
|
+
continue;
|
|
65
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
66
|
+
pending.push({ value, path: keywordPath(current.path, `${mapKey}.${key}`) });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const directChildren = [
|
|
70
|
+
["items", "[]"],
|
|
71
|
+
["contains", "contains"],
|
|
72
|
+
["additionalProperties", "*"],
|
|
73
|
+
["unevaluatedProperties", "*"],
|
|
74
|
+
["propertyNames", "propertyNames"],
|
|
75
|
+
["not", "not"],
|
|
76
|
+
["if", "if"],
|
|
77
|
+
["then", "then"],
|
|
78
|
+
["else", "else"]
|
|
79
|
+
];
|
|
80
|
+
for (const [keyword, segment] of directChildren) {
|
|
81
|
+
const child = current.value[keyword];
|
|
82
|
+
if (isRecord(child)) {
|
|
83
|
+
pending.push({ value: child, path: keywordPath(current.path, segment) });
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(child)) {
|
|
86
|
+
child.forEach((value, index) => {
|
|
87
|
+
pending.push({ value, path: keywordPath(current.path, `${segment}[${index}]`) });
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const keyword of ["prefixItems", "allOf", "anyOf", "oneOf"]) {
|
|
92
|
+
const branches = current.value[keyword];
|
|
93
|
+
if (!Array.isArray(branches))
|
|
94
|
+
continue;
|
|
95
|
+
branches.forEach((value, index) => {
|
|
96
|
+
pending.push({ value, path: keywordPath(current.path, `${keyword}[${index}]`) });
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return found.sort((left, right) => left.path.localeCompare(right.path) || left.format.localeCompare(right.format));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/tools/schema/flatten-join.ts
|
|
104
|
+
var ANNOTATION_KEYS = new Set(["$schema", "default", "description", "examples", "title"]);
|
|
105
|
+
var TYPE_KEYWORDS = {
|
|
106
|
+
array: [
|
|
107
|
+
"contains",
|
|
108
|
+
"items",
|
|
109
|
+
"maxContains",
|
|
110
|
+
"maxItems",
|
|
111
|
+
"minContains",
|
|
112
|
+
"minItems",
|
|
113
|
+
"prefixItems",
|
|
114
|
+
"uniqueItems"
|
|
115
|
+
],
|
|
116
|
+
integer: ["exclusiveMaximum", "exclusiveMinimum", "maximum", "minimum", "multipleOf"],
|
|
117
|
+
number: ["exclusiveMaximum", "exclusiveMinimum", "maximum", "minimum", "multipleOf"],
|
|
118
|
+
object: [
|
|
119
|
+
"additionalProperties",
|
|
120
|
+
"dependentRequired",
|
|
121
|
+
"dependentSchemas",
|
|
122
|
+
"maxProperties",
|
|
123
|
+
"minProperties",
|
|
124
|
+
"patternProperties",
|
|
125
|
+
"properties",
|
|
126
|
+
"propertyNames",
|
|
127
|
+
"required"
|
|
128
|
+
],
|
|
129
|
+
string: [
|
|
130
|
+
"contentEncoding",
|
|
131
|
+
"contentMediaType",
|
|
132
|
+
"format",
|
|
133
|
+
"maxLength",
|
|
134
|
+
"minLength",
|
|
135
|
+
"pattern"
|
|
136
|
+
]
|
|
137
|
+
};
|
|
138
|
+
function nullableProjection(schema) {
|
|
139
|
+
if (!Array.isArray(schema.anyOf) || schema.anyOf.length !== 2)
|
|
140
|
+
return schema;
|
|
141
|
+
const branches = schema.anyOf.filter(isRecord);
|
|
142
|
+
if (branches.length !== 2)
|
|
143
|
+
return schema;
|
|
144
|
+
const nullBranch = branches.find((branch) => branch.type === "null");
|
|
145
|
+
const value = branches.find((branch) => typeof branch.type === "string" && branch.type !== "null");
|
|
146
|
+
if (!nullBranch || !value || Object.keys(nullBranch).some((key) => key !== "type")) {
|
|
147
|
+
return schema;
|
|
148
|
+
}
|
|
149
|
+
const type = value.type;
|
|
150
|
+
if (typeof type !== "string")
|
|
151
|
+
return schema;
|
|
152
|
+
const projected = { type: [type, "null"] };
|
|
153
|
+
for (const key of [...ANNOTATION_KEYS, ...TYPE_KEYWORDS[type] ?? []]) {
|
|
154
|
+
if (value[key] !== undefined)
|
|
155
|
+
projected[key] = value[key];
|
|
156
|
+
else if (schema[key] !== undefined)
|
|
157
|
+
projected[key] = schema[key];
|
|
158
|
+
}
|
|
159
|
+
if (value.const !== undefined)
|
|
160
|
+
projected.enum = [value.const, null];
|
|
161
|
+
else if (Array.isArray(value.enum))
|
|
162
|
+
projected.enum = [...value.enum, null];
|
|
163
|
+
return projected;
|
|
164
|
+
}
|
|
165
|
+
function withoutAnnotations(schema) {
|
|
166
|
+
const result = {};
|
|
167
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
168
|
+
if (!ANNOTATION_KEYS.has(key))
|
|
169
|
+
result[key] = value;
|
|
170
|
+
}
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
function stringValues(schema) {
|
|
174
|
+
if (typeof schema.const === "string")
|
|
175
|
+
return [schema.const];
|
|
176
|
+
if (!Array.isArray(schema.enum))
|
|
177
|
+
return null;
|
|
178
|
+
const values = schema.enum.filter((value) => typeof value === "string");
|
|
179
|
+
return values.length === schema.enum.length ? values : null;
|
|
180
|
+
}
|
|
181
|
+
var JSON_SCHEMA_TYPE_ORDER = [
|
|
182
|
+
"string",
|
|
183
|
+
"number",
|
|
184
|
+
"integer",
|
|
185
|
+
"boolean",
|
|
186
|
+
"object",
|
|
187
|
+
"array",
|
|
188
|
+
"null"
|
|
189
|
+
];
|
|
190
|
+
function jsonSchemaType(value) {
|
|
191
|
+
switch (value) {
|
|
192
|
+
case "array":
|
|
193
|
+
case "boolean":
|
|
194
|
+
case "integer":
|
|
195
|
+
case "null":
|
|
196
|
+
case "number":
|
|
197
|
+
case "object":
|
|
198
|
+
case "string":
|
|
199
|
+
return value;
|
|
200
|
+
default:
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function valueType(value) {
|
|
205
|
+
if (value === null)
|
|
206
|
+
return "null";
|
|
207
|
+
if (Array.isArray(value))
|
|
208
|
+
return "array";
|
|
209
|
+
if (isRecord(value))
|
|
210
|
+
return "object";
|
|
211
|
+
if (typeof value === "string")
|
|
212
|
+
return "string";
|
|
213
|
+
if (typeof value === "number")
|
|
214
|
+
return "number";
|
|
215
|
+
if (typeof value === "boolean")
|
|
216
|
+
return "boolean";
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
function normalizeTypes(types) {
|
|
220
|
+
const normalized = new Set(types);
|
|
221
|
+
if (normalized.has("number"))
|
|
222
|
+
normalized.delete("integer");
|
|
223
|
+
return JSON_SCHEMA_TYPE_ORDER.filter((type) => normalized.has(type));
|
|
224
|
+
}
|
|
225
|
+
function combinedBranchTypes(schema) {
|
|
226
|
+
for (const keyword of ["oneOf", "anyOf"]) {
|
|
227
|
+
const value = schema[keyword];
|
|
228
|
+
if (!Array.isArray(value) || value.length === 0)
|
|
229
|
+
continue;
|
|
230
|
+
const collected = [];
|
|
231
|
+
for (const branch of value) {
|
|
232
|
+
if (!isRecord(branch))
|
|
233
|
+
return null;
|
|
234
|
+
const types = typeNames(branch);
|
|
235
|
+
if (!types)
|
|
236
|
+
return null;
|
|
237
|
+
collected.push(...types);
|
|
238
|
+
}
|
|
239
|
+
return normalizeTypes(collected);
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
function typeNames(schema) {
|
|
244
|
+
const direct = jsonSchemaType(schema.type);
|
|
245
|
+
if (direct)
|
|
246
|
+
return [direct];
|
|
247
|
+
if (Array.isArray(schema.type)) {
|
|
248
|
+
const values = [];
|
|
249
|
+
for (const value of schema.type) {
|
|
250
|
+
const type = jsonSchemaType(value);
|
|
251
|
+
if (!type)
|
|
252
|
+
return null;
|
|
253
|
+
values.push(type);
|
|
254
|
+
}
|
|
255
|
+
return values.length > 0 ? normalizeTypes(values) : null;
|
|
256
|
+
}
|
|
257
|
+
if (schema.const !== undefined) {
|
|
258
|
+
const type = valueType(schema.const);
|
|
259
|
+
return type ? [type] : null;
|
|
260
|
+
}
|
|
261
|
+
if (Array.isArray(schema.enum) && schema.enum.length > 0) {
|
|
262
|
+
const values = [];
|
|
263
|
+
for (const value of schema.enum) {
|
|
264
|
+
const type = valueType(value);
|
|
265
|
+
if (!type)
|
|
266
|
+
return null;
|
|
267
|
+
values.push(type);
|
|
268
|
+
}
|
|
269
|
+
return normalizeTypes(values);
|
|
270
|
+
}
|
|
271
|
+
return combinedBranchTypes(schema);
|
|
272
|
+
}
|
|
273
|
+
function typeSchema(type, nullable) {
|
|
274
|
+
const schema = { type: nullable ? [type, "null"] : type };
|
|
275
|
+
if (type === "array")
|
|
276
|
+
schema.items = {};
|
|
277
|
+
if (type === "object")
|
|
278
|
+
schema.additionalProperties = {};
|
|
279
|
+
return schema;
|
|
280
|
+
}
|
|
281
|
+
function commonBaseType(schemas) {
|
|
282
|
+
const names = schemas.map(typeNames);
|
|
283
|
+
if (names.some((value) => value === null))
|
|
284
|
+
return {};
|
|
285
|
+
let nullable = false;
|
|
286
|
+
const bases = new Set;
|
|
287
|
+
for (const branch of names) {
|
|
288
|
+
if (!branch)
|
|
289
|
+
return {};
|
|
290
|
+
for (const name of branch) {
|
|
291
|
+
if (name === "null")
|
|
292
|
+
nullable = true;
|
|
293
|
+
else
|
|
294
|
+
bases.add(name);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (bases.size === 0)
|
|
298
|
+
return nullable ? { type: "null" } : {};
|
|
299
|
+
if (bases.size === 1) {
|
|
300
|
+
const [only] = bases;
|
|
301
|
+
return only ? typeSchema(only, nullable) : {};
|
|
302
|
+
}
|
|
303
|
+
if ([...bases].every((name) => name === "integer" || name === "number")) {
|
|
304
|
+
return typeSchema("number", nullable);
|
|
305
|
+
}
|
|
306
|
+
const types = normalizeTypes(nullable ? [...bases, "null"] : bases);
|
|
307
|
+
return types.length > 0 ? { type: types } : {};
|
|
308
|
+
}
|
|
309
|
+
function mergePropertySchemas(properties) {
|
|
310
|
+
const schemas = properties.map((property) => nullableProjection(property.schema));
|
|
311
|
+
const structural = schemas.map(withoutAnnotations);
|
|
312
|
+
const [first] = structural;
|
|
313
|
+
let merged;
|
|
314
|
+
if (first && structural.every((schema) => serializeCanonicalJson(schema) === serializeCanonicalJson(first))) {
|
|
315
|
+
merged = structuredClone(first);
|
|
316
|
+
} else {
|
|
317
|
+
const values = schemas.map(stringValues);
|
|
318
|
+
const allStrings = values.every((value) => value !== null);
|
|
319
|
+
merged = allStrings ? { type: "string", enum: [...new Set(values.flatMap((value) => value ?? []))] } : commonBaseType(schemas);
|
|
320
|
+
}
|
|
321
|
+
const descriptions = [
|
|
322
|
+
...new Set(schemas.map((schema) => schema.description).filter((value) => typeof value === "string"))
|
|
323
|
+
];
|
|
324
|
+
if (descriptions.length === 1)
|
|
325
|
+
merged.description = descriptions[0];
|
|
326
|
+
return merged;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/tools/schema/flatten.ts
|
|
330
|
+
function rebuild(value) {
|
|
331
|
+
if (Array.isArray(value))
|
|
332
|
+
return value.map(rebuild);
|
|
333
|
+
if (!isRecord(value))
|
|
334
|
+
return value;
|
|
335
|
+
const node = {};
|
|
336
|
+
for (const [key, child] of Object.entries(value))
|
|
337
|
+
node[key] = rebuild(child);
|
|
338
|
+
return flattenNode(node);
|
|
339
|
+
}
|
|
340
|
+
function objectVariants(node) {
|
|
341
|
+
if (!Array.isArray(node.oneOf) || node.oneOf.length < 2)
|
|
342
|
+
return null;
|
|
343
|
+
const variants = node.oneOf.filter(isRecord);
|
|
344
|
+
if (variants.length !== node.oneOf.length)
|
|
345
|
+
return null;
|
|
346
|
+
if (variants.some((variant) => variant.type !== "object" || !isRecord(variant.properties))) {
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
return variants;
|
|
350
|
+
}
|
|
351
|
+
function findDiscriminator(variants) {
|
|
352
|
+
const [first] = variants;
|
|
353
|
+
if (!first || !isRecord(first.properties))
|
|
354
|
+
return null;
|
|
355
|
+
for (const key of Object.keys(first.properties).sort()) {
|
|
356
|
+
const values = [];
|
|
357
|
+
const seen = new Set;
|
|
358
|
+
let valid = true;
|
|
359
|
+
for (const variant of variants) {
|
|
360
|
+
if (!requiredKeys(variant).has(key)) {
|
|
361
|
+
valid = false;
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
const properties = variant.properties;
|
|
365
|
+
const field = isRecord(properties) ? properties[key] : undefined;
|
|
366
|
+
const branchValues = isRecord(field) ? stringValues(field) : null;
|
|
367
|
+
if (!branchValues || branchValues.length === 0) {
|
|
368
|
+
valid = false;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
for (const value of branchValues) {
|
|
372
|
+
if (seen.has(value)) {
|
|
373
|
+
valid = false;
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
seen.add(value);
|
|
377
|
+
}
|
|
378
|
+
if (!valid)
|
|
379
|
+
break;
|
|
380
|
+
values.push(branchValues);
|
|
381
|
+
}
|
|
382
|
+
if (valid)
|
|
383
|
+
return { key, values };
|
|
384
|
+
}
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
function requiredKeys(variant) {
|
|
388
|
+
if (!Array.isArray(variant.required))
|
|
389
|
+
return new Set;
|
|
390
|
+
return new Set(variant.required.filter((key) => typeof key === "string"));
|
|
391
|
+
}
|
|
392
|
+
function appendHint(schema, hint) {
|
|
393
|
+
const description = typeof schema.description === "string" ? schema.description : undefined;
|
|
394
|
+
return { ...schema, description: description ? `${description} ${hint}` : hint };
|
|
395
|
+
}
|
|
396
|
+
function flattenNode(node) {
|
|
397
|
+
const variants = objectVariants(node);
|
|
398
|
+
if (!variants)
|
|
399
|
+
return node;
|
|
400
|
+
const discriminator = findDiscriminator(variants);
|
|
401
|
+
if (!discriminator)
|
|
402
|
+
return node;
|
|
403
|
+
const perKey = new Map;
|
|
404
|
+
for (let index = 0;index < variants.length; index++) {
|
|
405
|
+
const variant = variants[index];
|
|
406
|
+
if (!variant)
|
|
407
|
+
continue;
|
|
408
|
+
const labels = discriminator.values[index] ?? [];
|
|
409
|
+
const required2 = requiredKeys(variant);
|
|
410
|
+
if (!isRecord(variant.properties))
|
|
411
|
+
continue;
|
|
412
|
+
for (const [key, rawSchema] of Object.entries(variant.properties)) {
|
|
413
|
+
if (key === discriminator.key || !isRecord(rawSchema))
|
|
414
|
+
continue;
|
|
415
|
+
const entries = perKey.get(key) ?? [];
|
|
416
|
+
entries.push({ schema: rawSchema, labels, required: required2.has(key) });
|
|
417
|
+
perKey.set(key, entries);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const discriminatorProperties = [];
|
|
421
|
+
for (let index = 0;index < variants.length; index++) {
|
|
422
|
+
const variant = variants[index];
|
|
423
|
+
if (!variant || !isRecord(variant.properties))
|
|
424
|
+
continue;
|
|
425
|
+
const schema = variant.properties[discriminator.key];
|
|
426
|
+
if (!isRecord(schema))
|
|
427
|
+
continue;
|
|
428
|
+
discriminatorProperties.push({
|
|
429
|
+
schema,
|
|
430
|
+
labels: discriminator.values[index] ?? [],
|
|
431
|
+
required: true
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
const properties = {
|
|
435
|
+
[discriminator.key]: mergePropertySchemas(discriminatorProperties)
|
|
436
|
+
};
|
|
437
|
+
const required = [discriminator.key];
|
|
438
|
+
for (const [key, entries] of perKey) {
|
|
439
|
+
let merged = mergePropertySchemas(entries);
|
|
440
|
+
const requiredEverywhere = entries.length === variants.length && entries.every((entry) => entry.required);
|
|
441
|
+
if (requiredEverywhere) {
|
|
442
|
+
required.push(key);
|
|
443
|
+
} else {
|
|
444
|
+
const requiredLabels = entries.filter((entry) => entry.required).flatMap((entry) => entry.labels);
|
|
445
|
+
const presentLabels = entries.flatMap((entry) => entry.labels);
|
|
446
|
+
const labels = requiredLabels.length > 0 ? requiredLabels : presentLabels;
|
|
447
|
+
const verb = requiredLabels.length > 0 ? "Required" : "Available";
|
|
448
|
+
merged = appendHint(merged, `${verb} if ${discriminator.key} = ${[...new Set(labels)].join(" | ")}`);
|
|
449
|
+
}
|
|
450
|
+
properties[key] = merged;
|
|
451
|
+
}
|
|
452
|
+
const result = {};
|
|
453
|
+
for (const [key, value] of Object.entries(node)) {
|
|
454
|
+
if (key !== "oneOf" && key !== "anyOf" && key !== "properties" && key !== "required") {
|
|
455
|
+
result[key] = value;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
result.type = "object";
|
|
459
|
+
result.properties = properties;
|
|
460
|
+
result.required = required;
|
|
461
|
+
result.additionalProperties = variants.every((variant) => variant.additionalProperties === false) ? false : {};
|
|
462
|
+
return result;
|
|
463
|
+
}
|
|
464
|
+
function flattenToolJsonSchema(schema) {
|
|
465
|
+
const result = rebuild(schema);
|
|
466
|
+
return isRecord(result) ? result : {};
|
|
467
|
+
}
|
|
468
|
+
function freezeToolJsonSchema(schema) {
|
|
469
|
+
for (const value of Object.values(schema))
|
|
470
|
+
freezeJsonValue(value);
|
|
471
|
+
return Object.freeze(schema);
|
|
472
|
+
}
|
|
473
|
+
function freezeJsonValue(value) {
|
|
474
|
+
if (Array.isArray(value)) {
|
|
475
|
+
for (const item of value)
|
|
476
|
+
freezeJsonValue(item);
|
|
477
|
+
Object.freeze(value);
|
|
478
|
+
} else if (isRecord(value)) {
|
|
479
|
+
freezeToolJsonSchema(value);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// src/tools/schema/untyped-properties.ts
|
|
484
|
+
var TYPE_KEYWORDS2 = ["type", "enum", "const", "anyOf", "oneOf", "allOf", "$ref", "not"];
|
|
485
|
+
function saysWhatItIs(schema) {
|
|
486
|
+
return TYPE_KEYWORDS2.some((keyword) => schema[keyword] !== undefined);
|
|
487
|
+
}
|
|
488
|
+
function findUntypedProperties(schema, prefix = "") {
|
|
489
|
+
if (!isRecord(schema))
|
|
490
|
+
return [];
|
|
491
|
+
const found = [];
|
|
492
|
+
const properties = schema.properties;
|
|
493
|
+
if (isRecord(properties)) {
|
|
494
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
495
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
496
|
+
if (isRecord(value)) {
|
|
497
|
+
if (!saysWhatItIs(value)) {
|
|
498
|
+
const description = value.description;
|
|
499
|
+
found.push({
|
|
500
|
+
path,
|
|
501
|
+
...typeof description === "string" && { description }
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
found.push(...findUntypedProperties(value, path));
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
for (const key of ["items", "additionalProperties"]) {
|
|
509
|
+
const child = schema[key];
|
|
510
|
+
if (isRecord(child))
|
|
511
|
+
found.push(...findUntypedProperties(child, prefix));
|
|
512
|
+
if (Array.isArray(child)) {
|
|
513
|
+
for (const entry of child) {
|
|
514
|
+
if (isRecord(entry))
|
|
515
|
+
found.push(...findUntypedProperties(entry, prefix));
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
for (const key of ["prefixItems"]) {
|
|
520
|
+
const child = schema[key];
|
|
521
|
+
if (Array.isArray(child)) {
|
|
522
|
+
for (const entry of child) {
|
|
523
|
+
if (isRecord(entry))
|
|
524
|
+
found.push(...findUntypedProperties(entry, prefix));
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const patterned = schema.patternProperties;
|
|
529
|
+
if (isRecord(patterned)) {
|
|
530
|
+
for (const value of Object.values(patterned)) {
|
|
531
|
+
if (isRecord(value))
|
|
532
|
+
found.push(...findUntypedProperties(value, prefix));
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
for (const key of ["$defs", "definitions"]) {
|
|
536
|
+
const container = schema[key];
|
|
537
|
+
if (!isRecord(container))
|
|
538
|
+
continue;
|
|
539
|
+
for (const definition of Object.values(container)) {
|
|
540
|
+
if (isRecord(definition))
|
|
541
|
+
found.push(...findUntypedProperties(definition, prefix));
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
for (const key of ["allOf", "anyOf", "oneOf"]) {
|
|
545
|
+
const branches = schema[key];
|
|
546
|
+
if (Array.isArray(branches)) {
|
|
547
|
+
for (const branch of branches)
|
|
548
|
+
found.push(...findUntypedProperties(branch, prefix));
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return found;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// src/tools/internal/tool-view.ts
|
|
555
|
+
function toolSurfaceOutputSchema(operation) {
|
|
556
|
+
if (!operation.outputSchema)
|
|
557
|
+
return;
|
|
558
|
+
return operation.toolView?.output ?? operation.outputSchema;
|
|
559
|
+
}
|
|
560
|
+
function applyToolViewDefaults(inputArgs, defaults) {
|
|
561
|
+
if (!defaults)
|
|
562
|
+
return inputArgs;
|
|
563
|
+
const filled = { ...inputArgs };
|
|
564
|
+
for (const [key, value] of Object.entries(defaults)) {
|
|
565
|
+
if (filled[key] === undefined)
|
|
566
|
+
filled[key] = structuredClone(value);
|
|
567
|
+
}
|
|
568
|
+
return filled;
|
|
569
|
+
}
|
|
570
|
+
function projectToolView(options) {
|
|
571
|
+
const { view } = options;
|
|
572
|
+
let projected = options.full;
|
|
573
|
+
if (view.project) {
|
|
574
|
+
try {
|
|
575
|
+
projected = Reflect.apply(view.project, undefined, [options.full, options.call]);
|
|
576
|
+
} catch (error) {
|
|
577
|
+
const failure = new AppError("INTERNAL_SERVER_ERROR", `${options.operation} toolView.project threw`, 500);
|
|
578
|
+
failure.cause = error;
|
|
579
|
+
throw failure;
|
|
580
|
+
}
|
|
581
|
+
if (isRecord(projected) && typeof projected.then === "function") {
|
|
582
|
+
Promise.resolve(projected).catch(() => {
|
|
583
|
+
return;
|
|
584
|
+
});
|
|
585
|
+
throw new AppError("INTERNAL_SERVER_ERROR", `${options.operation} toolView.project returned a Promise — it must be synchronous`, 500);
|
|
586
|
+
}
|
|
587
|
+
if (projected === undefined) {
|
|
588
|
+
return {
|
|
589
|
+
ok: false,
|
|
590
|
+
message: `${options.operation} toolView.project returned undefined`
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
const checked = validateDeclaredOutput(view.output ?? options.fullSchema, projected, view.project ? options.onStripped : undefined);
|
|
595
|
+
if (!checked.ok) {
|
|
596
|
+
return { ok: false, message: `${options.operation} toolView: ${checked.message}` };
|
|
597
|
+
}
|
|
598
|
+
return checked;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// src/tools/schema/schema.ts
|
|
602
|
+
import { z } from "zod";
|
|
603
|
+
function objectShapeKeys(schema) {
|
|
604
|
+
return schema instanceof z.ZodObject ? Object.keys(schema.shape) : [];
|
|
605
|
+
}
|
|
606
|
+
function keyPolicyOf(schema) {
|
|
607
|
+
return schema.def.catchall;
|
|
608
|
+
}
|
|
609
|
+
function rebuildObject(source, shape) {
|
|
610
|
+
return withKeyPolicy(z.object(shape), keyPolicyOf(source));
|
|
611
|
+
}
|
|
612
|
+
function withKeyPolicy(object, policy) {
|
|
613
|
+
if (policy === undefined)
|
|
614
|
+
return object;
|
|
615
|
+
return object.catchall(representable(policy));
|
|
616
|
+
}
|
|
617
|
+
function representable(policy) {
|
|
618
|
+
if (policy instanceof z.ZodNever || policy instanceof z.ZodUnknown)
|
|
619
|
+
return policy;
|
|
620
|
+
if (!(policy instanceof z.ZodType))
|
|
621
|
+
return z.unknown();
|
|
622
|
+
try {
|
|
623
|
+
toJsonSchema(policy, "input");
|
|
624
|
+
return policy;
|
|
625
|
+
} catch {
|
|
626
|
+
return z.unknown();
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
function mergeSchemas(paramsSchema, inputSchema) {
|
|
630
|
+
if (paramsSchema && !(paramsSchema instanceof z.ZodObject)) {
|
|
631
|
+
throw new Error("Tool params schema must be a z.object()");
|
|
632
|
+
}
|
|
633
|
+
const paramsObject = paramsSchema instanceof z.ZodObject ? paramsSchema : undefined;
|
|
634
|
+
if (!inputSchema) {
|
|
635
|
+
return paramsObject ?? z.object({});
|
|
636
|
+
}
|
|
637
|
+
if (inputSchema instanceof z.ZodObject) {
|
|
638
|
+
if (paramsObject) {
|
|
639
|
+
const conflicts = Object.keys(paramsObject.shape).filter((key) => (key in inputSchema.shape));
|
|
640
|
+
if (conflicts.length > 0) {
|
|
641
|
+
throw new Error(`Schema merge conflict: ${conflicts.join(", ")} appear in both params and input`);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return rebuildObject(inputSchema, {
|
|
645
|
+
...paramsObject?.shape ?? {},
|
|
646
|
+
...inputSchema.shape
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
return paramsObject ? z.intersection(paramsObject, inputSchema) : inputSchema;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// src/tools/names.ts
|
|
653
|
+
var SINGULAR_EXCEPTIONS = new Set([
|
|
654
|
+
"analytics",
|
|
655
|
+
"status",
|
|
656
|
+
"stats",
|
|
657
|
+
"settings",
|
|
658
|
+
"media",
|
|
659
|
+
"progress",
|
|
660
|
+
"news"
|
|
661
|
+
]);
|
|
662
|
+
var TOOL_NAME_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
663
|
+
function normalizeService(value) {
|
|
664
|
+
return value.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
665
|
+
}
|
|
666
|
+
function normalizeMethod(value) {
|
|
667
|
+
return value.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
668
|
+
}
|
|
669
|
+
function singularize(name) {
|
|
670
|
+
if (SINGULAR_EXCEPTIONS.has(name))
|
|
671
|
+
return name;
|
|
672
|
+
if (name.endsWith("ies"))
|
|
673
|
+
return `${name.slice(0, -3)}y`;
|
|
674
|
+
if (name.endsWith("s") && !name.endsWith("ss"))
|
|
675
|
+
return name.slice(0, -1);
|
|
676
|
+
return name;
|
|
677
|
+
}
|
|
678
|
+
function singularizeTail(name) {
|
|
679
|
+
const cut = name.lastIndexOf("_");
|
|
680
|
+
if (cut === -1)
|
|
681
|
+
return singularize(name);
|
|
682
|
+
return `${name.slice(0, cut + 1)}${singularize(name.slice(cut + 1))}`;
|
|
683
|
+
}
|
|
684
|
+
function hasUsableChars(value) {
|
|
685
|
+
return /[a-zA-Z0-9]/.test(value);
|
|
686
|
+
}
|
|
687
|
+
function assertToolName(name, serviceName, key) {
|
|
688
|
+
const where = `service "${serviceName}", method "${key}"`;
|
|
689
|
+
if (!TOOL_NAME_RE.test(name)) {
|
|
690
|
+
const why = name.length > 64 ? `is ${name.length} characters (max 64) — set an explicit \`tool.name\`` : "must match [a-zA-Z0-9_-]";
|
|
691
|
+
throw new Error(`Tool name "${name}" (${where}) ${why}`);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
function toToolName(serviceName, methodName) {
|
|
695
|
+
const normalized = normalizeService(serviceName);
|
|
696
|
+
const singular = singularizeTail(normalized);
|
|
697
|
+
const method = normalizeMethod(methodName);
|
|
698
|
+
if (method === "list")
|
|
699
|
+
return `list_${normalized}`;
|
|
700
|
+
if (method === "get")
|
|
701
|
+
return `get_${singular}`;
|
|
702
|
+
if (method === "create")
|
|
703
|
+
return `create_${singular}`;
|
|
704
|
+
if (method === "update")
|
|
705
|
+
return `update_${singular}`;
|
|
706
|
+
if (method === "delete")
|
|
707
|
+
return `delete_${singular}`;
|
|
708
|
+
const snake = method.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
709
|
+
return `${snake}_${singular}`.replace(/^_/, "");
|
|
710
|
+
}
|
|
711
|
+
function assertUniqueToolName(name, taken, surface) {
|
|
712
|
+
if (taken) {
|
|
713
|
+
throw new Error(`Duplicate ${surface} "${name}" across mounted operations`);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// src/tools/schema/presentation.ts
|
|
718
|
+
import { z as z2 } from "zod";
|
|
719
|
+
|
|
720
|
+
// src/json-schema/dialect.ts
|
|
721
|
+
var DRAFT_07_MARKER = "draft-07";
|
|
722
|
+
var DRAFT_07_KEYWORD = "definitions";
|
|
723
|
+
var DEFS_KEYWORD = "$defs";
|
|
724
|
+
function declaresDraft07(dialect) {
|
|
725
|
+
return typeof dialect === "string" && dialect.includes(DRAFT_07_MARKER);
|
|
726
|
+
}
|
|
727
|
+
function rewriteDefinitionPointers(value) {
|
|
728
|
+
if (Array.isArray(value))
|
|
729
|
+
return value.map(rewriteDefinitionPointers);
|
|
730
|
+
if (!isRecord(value))
|
|
731
|
+
return value;
|
|
732
|
+
const rewritten = {};
|
|
733
|
+
for (const [key, child] of Object.entries(value)) {
|
|
734
|
+
rewritten[key] = key === "$ref" && typeof child === "string" && child.startsWith(`#/${DRAFT_07_KEYWORD}/`) ? `#/${DEFS_KEYWORD}/${child.slice(`#/${DRAFT_07_KEYWORD}/`.length)}` : rewriteDefinitionPointers(child);
|
|
735
|
+
}
|
|
736
|
+
return rewritten;
|
|
737
|
+
}
|
|
738
|
+
function withDefsDialect(schema) {
|
|
739
|
+
const definitions = schema[DRAFT_07_KEYWORD];
|
|
740
|
+
if (!isRecord(definitions) || DEFS_KEYWORD in schema)
|
|
741
|
+
return schema;
|
|
742
|
+
const rewritten = {};
|
|
743
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
744
|
+
if (key === DRAFT_07_KEYWORD)
|
|
745
|
+
continue;
|
|
746
|
+
rewritten[key] = rewriteDefinitionPointers(value);
|
|
747
|
+
}
|
|
748
|
+
rewritten[DEFS_KEYWORD] = rewriteDefinitionPointers(definitions);
|
|
749
|
+
return rewritten;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// src/tools/schema/presentation.ts
|
|
753
|
+
function withoutDialect(schema) {
|
|
754
|
+
const result = {};
|
|
755
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
756
|
+
if (key !== "$schema")
|
|
757
|
+
result[key] = value;
|
|
758
|
+
}
|
|
759
|
+
return result;
|
|
760
|
+
}
|
|
761
|
+
function hasLocalReference(value) {
|
|
762
|
+
if (Array.isArray(value))
|
|
763
|
+
return value.some(hasLocalReference);
|
|
764
|
+
if (!isRecord(value))
|
|
765
|
+
return false;
|
|
766
|
+
if (typeof value.$ref === "string" && value.$ref.startsWith("#"))
|
|
767
|
+
return true;
|
|
768
|
+
return Object.values(value).some(hasLocalReference);
|
|
769
|
+
}
|
|
770
|
+
var NAMESPACE_SEPARATOR = "__";
|
|
771
|
+
var DEFINITION_KEYWORDS = ["definitions", "$defs"];
|
|
772
|
+
function rewriteReference(reference, namespace, targets) {
|
|
773
|
+
if (reference === "#" || reference === "#/") {
|
|
774
|
+
targets.rootReferenced = true;
|
|
775
|
+
return `#/definitions/${namespace}`;
|
|
776
|
+
}
|
|
777
|
+
const segments = reference.slice(2).split("/");
|
|
778
|
+
const [keyword, name, ...rest] = segments;
|
|
779
|
+
if (keyword !== undefined && name !== undefined && DEFINITION_KEYWORDS.includes(keyword)) {
|
|
780
|
+
const renamed = `${namespace}${NAMESPACE_SEPARATOR}${name}`;
|
|
781
|
+
return ["#", "definitions", renamed, ...rest].join("/");
|
|
782
|
+
}
|
|
783
|
+
targets.rootReferenced = true;
|
|
784
|
+
return `#/definitions/${namespace}/${segments.join("/")}`;
|
|
785
|
+
}
|
|
786
|
+
function rewriteLocalReferences(value, namespace, targets) {
|
|
787
|
+
if (Array.isArray(value)) {
|
|
788
|
+
return value.map((child) => rewriteLocalReferences(child, namespace, targets));
|
|
789
|
+
}
|
|
790
|
+
if (!isRecord(value))
|
|
791
|
+
return value;
|
|
792
|
+
const rewritten = {};
|
|
793
|
+
for (const [key, child] of Object.entries(value)) {
|
|
794
|
+
rewritten[key] = key === "$ref" && typeof child === "string" && child.startsWith("#") ? rewriteReference(child, namespace, targets) : rewriteLocalReferences(child, namespace, targets);
|
|
795
|
+
}
|
|
796
|
+
return rewritten;
|
|
797
|
+
}
|
|
798
|
+
function namespaceLocalReferences(schema, namespace) {
|
|
799
|
+
if (!schema || !hasLocalReference(schema))
|
|
800
|
+
return schema;
|
|
801
|
+
const targets = { rootReferenced: false };
|
|
802
|
+
const rewritten = rewriteLocalReferences(schema, namespace, targets);
|
|
803
|
+
if (!isRecord(rewritten))
|
|
804
|
+
return schema;
|
|
805
|
+
const definitions = {};
|
|
806
|
+
const body = {};
|
|
807
|
+
for (const [key, value] of Object.entries(rewritten)) {
|
|
808
|
+
if (DEFINITION_KEYWORDS.includes(key)) {
|
|
809
|
+
if (isRecord(value)) {
|
|
810
|
+
for (const [name, definition] of Object.entries(value)) {
|
|
811
|
+
definitions[`${namespace}${NAMESPACE_SEPARATOR}${name}`] = definition;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
body[key] = value;
|
|
817
|
+
}
|
|
818
|
+
if (targets.rootReferenced)
|
|
819
|
+
definitions[namespace] = withoutDialect(body);
|
|
820
|
+
if (Object.keys(definitions).length === 0)
|
|
821
|
+
return body;
|
|
822
|
+
return { ...body, definitions };
|
|
823
|
+
}
|
|
824
|
+
function objectProperties(schema) {
|
|
825
|
+
return schema.type === "object" && isRecord(schema.properties) ? schema.properties : null;
|
|
826
|
+
}
|
|
827
|
+
function requiredKeys2(schema) {
|
|
828
|
+
return Array.isArray(schema.required) ? schema.required.filter((key) => typeof key === "string") : [];
|
|
829
|
+
}
|
|
830
|
+
function hoistDefinitions(schema) {
|
|
831
|
+
const branches = Array.isArray(schema.allOf) ? schema.allOf : [];
|
|
832
|
+
const definitions = {};
|
|
833
|
+
const lifted = branches.map((branch) => {
|
|
834
|
+
if (!isRecord(branch) || !isRecord(branch.definitions))
|
|
835
|
+
return branch;
|
|
836
|
+
Object.assign(definitions, branch.definitions);
|
|
837
|
+
const rest = {};
|
|
838
|
+
for (const [key, value] of Object.entries(branch)) {
|
|
839
|
+
if (key !== "definitions")
|
|
840
|
+
rest[key] = value;
|
|
841
|
+
}
|
|
842
|
+
return rest;
|
|
843
|
+
});
|
|
844
|
+
if (Object.keys(definitions).length === 0)
|
|
845
|
+
return schema;
|
|
846
|
+
return { ...schema, allOf: lifted, definitions };
|
|
847
|
+
}
|
|
848
|
+
function mergeObjectSchemas(left, right, rightOwnsUnknownKeys) {
|
|
849
|
+
const leftProperties = objectProperties(left);
|
|
850
|
+
const rightProperties = objectProperties(right);
|
|
851
|
+
if (!leftProperties || !rightProperties)
|
|
852
|
+
return hoistDefinitions({ allOf: [left, right] });
|
|
853
|
+
const conflicts = Object.keys(leftProperties).filter((key) => (key in rightProperties));
|
|
854
|
+
if (conflicts.length > 0) {
|
|
855
|
+
throw new Error(`Schema merge conflict: ${conflicts.join(", ")} appear in both params and input`);
|
|
856
|
+
}
|
|
857
|
+
const merged = {
|
|
858
|
+
type: "object",
|
|
859
|
+
properties: { ...leftProperties, ...rightProperties },
|
|
860
|
+
required: [...new Set([...requiredKeys2(left), ...requiredKeys2(right)])]
|
|
861
|
+
};
|
|
862
|
+
const leftDefinitions = isRecord(left.definitions) ? left.definitions : {};
|
|
863
|
+
const rightDefinitions = isRecord(right.definitions) ? right.definitions : {};
|
|
864
|
+
const definitions = { ...leftDefinitions, ...rightDefinitions };
|
|
865
|
+
if (Object.keys(definitions).length > 0)
|
|
866
|
+
merged.definitions = definitions;
|
|
867
|
+
const unknownKeys = rightOwnsUnknownKeys ? right.additionalProperties : left.additionalProperties;
|
|
868
|
+
if (unknownKeys !== undefined)
|
|
869
|
+
merged.additionalProperties = unknownKeys;
|
|
870
|
+
return merged;
|
|
871
|
+
}
|
|
872
|
+
function schemaFromZod(schema, unrepresentable, flatten) {
|
|
873
|
+
if (!schema)
|
|
874
|
+
return;
|
|
875
|
+
const json = toJsonSchema(schema, "input", unrepresentable, "draft-07");
|
|
876
|
+
return flatten ? flattenToolJsonSchema(json) : json;
|
|
877
|
+
}
|
|
878
|
+
function buildToolPresentationSchema(config) {
|
|
879
|
+
const unrepresentable = config.unrepresentable ?? "any";
|
|
880
|
+
const flatten = config.flattenUnionInput ?? false;
|
|
881
|
+
const params = namespaceLocalReferences(schemaFromZod(config.paramsSchema, unrepresentable, flatten), "params");
|
|
882
|
+
const input = namespaceLocalReferences(schemaFromZod(config.inputSchema, unrepresentable, flatten), "input");
|
|
883
|
+
let presentation;
|
|
884
|
+
if (params && input) {
|
|
885
|
+
presentation = mergeObjectSchemas(withoutDialect(params), withoutDialect(input), true);
|
|
886
|
+
} else if (input) {
|
|
887
|
+
presentation = input;
|
|
888
|
+
} else if (params) {
|
|
889
|
+
presentation = params;
|
|
890
|
+
} else {
|
|
891
|
+
presentation = {
|
|
892
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
893
|
+
type: "object",
|
|
894
|
+
properties: {}
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
if (config.extendSchema) {
|
|
898
|
+
const extra = namespaceLocalReferences(schemaFromZod(z2.object(config.extendSchema), unrepresentable, flatten), "extend");
|
|
899
|
+
if (extra) {
|
|
900
|
+
presentation = mergeObjectSchemas(withoutDialect(extra), withoutDialect(presentation), true);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
if (config.defaults)
|
|
904
|
+
presentation = withToolDefaults(presentation, config.defaults);
|
|
905
|
+
if (presentation.$schema === undefined) {
|
|
906
|
+
presentation = {
|
|
907
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
908
|
+
...presentation
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
return freezeToolJsonSchema(presentation);
|
|
912
|
+
}
|
|
913
|
+
function withToolDefaults(schema, defaults) {
|
|
914
|
+
const properties = objectProperties(schema);
|
|
915
|
+
if (!properties)
|
|
916
|
+
return schema;
|
|
917
|
+
const keys = Object.keys(defaults).filter((key) => isRecord(properties[key]));
|
|
918
|
+
if (keys.length === 0)
|
|
919
|
+
return schema;
|
|
920
|
+
const nextProperties = { ...properties };
|
|
921
|
+
for (const key of keys) {
|
|
922
|
+
const property = properties[key];
|
|
923
|
+
if (!isRecord(property))
|
|
924
|
+
continue;
|
|
925
|
+
const value = structuredClone(defaults[key]);
|
|
926
|
+
nextProperties[key] = typeof property.$ref === "string" ? { allOf: [property], default: value } : { ...property, default: value };
|
|
927
|
+
}
|
|
928
|
+
const required = requiredKeys2(schema).filter((key) => !keys.includes(key));
|
|
929
|
+
const next = { ...schema, properties: nextProperties };
|
|
930
|
+
if (Array.isArray(schema.required))
|
|
931
|
+
next.required = required;
|
|
932
|
+
return next;
|
|
933
|
+
}
|
|
934
|
+
function isObjectPresentationSchema(schema) {
|
|
935
|
+
return schema.type === "object" && isRecord(schema.properties);
|
|
936
|
+
}
|
|
937
|
+
function presentationMetadata(schema) {
|
|
938
|
+
return withDefsDialect(withoutDialect(schema));
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// src/tools/internal/surface-projector.ts
|
|
942
|
+
import { z as z3 } from "zod";
|
|
943
|
+
|
|
944
|
+
// src/tools/mcp/round-policy.ts
|
|
945
|
+
function staticInputRounds(policy) {
|
|
946
|
+
return Array.isArray(policy.inputRequired) ? policy.inputRequired : undefined;
|
|
947
|
+
}
|
|
948
|
+
function validateMcpRoundPolicy(tool, policy, runtime) {
|
|
949
|
+
if (!runtime?.stateConfigured) {
|
|
950
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares inputRequired but no multiRound.state key is configured`);
|
|
951
|
+
}
|
|
952
|
+
const { maxRounds } = runtime;
|
|
953
|
+
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
954
|
+
throw new Error("[stitchkit] multiRound.serving.maxRounds must be a positive integer");
|
|
955
|
+
}
|
|
956
|
+
const declared = staticInputRounds(policy);
|
|
957
|
+
if (!declared)
|
|
958
|
+
return;
|
|
959
|
+
if (declared.length === 0) {
|
|
960
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" must declare at least one input round`);
|
|
961
|
+
}
|
|
962
|
+
assertRoundShape(tool, declared, maxRounds);
|
|
963
|
+
}
|
|
964
|
+
function validateResolvedInputRounds(tool, resolved, maxRounds) {
|
|
965
|
+
assertRoundShape(tool, resolved, maxRounds);
|
|
966
|
+
}
|
|
967
|
+
function assertRoundShape(tool, rounds, maxRounds) {
|
|
968
|
+
if (rounds.length > maxRounds) {
|
|
969
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares ${rounds.length} input rounds, exceeding maxRounds ${maxRounds}`);
|
|
970
|
+
}
|
|
971
|
+
const keys = new Set;
|
|
972
|
+
for (const request of rounds) {
|
|
973
|
+
if (keys.has(request.key)) {
|
|
974
|
+
throw new Error(`[stitchkit] MCP tool "${tool.name}" declares duplicate input key "${request.key}"`);
|
|
975
|
+
}
|
|
976
|
+
keys.add(request.key);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// src/tools/internal/surface-projector.ts
|
|
981
|
+
function assertToolExtensionCompatible(base, extra) {
|
|
982
|
+
if (!(base instanceof z3.ZodObject))
|
|
983
|
+
return;
|
|
984
|
+
const conflicts = Object.keys(extra).filter((key) => (key in base.shape));
|
|
985
|
+
if (conflicts.length > 0) {
|
|
986
|
+
throw new Error(`Tool extend conflict: ${conflicts.join(", ")} already declared by the contract`);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
function projectRuntimeTool(definition, assertName = true) {
|
|
990
|
+
if (assertName) {
|
|
991
|
+
assertProjectedName(definition.name, definition.identity.serviceName, definition.identity.action, "MCP", false);
|
|
992
|
+
}
|
|
993
|
+
return {
|
|
994
|
+
kind: "runtime",
|
|
995
|
+
source: definition,
|
|
996
|
+
serviceName: definition.identity.serviceName,
|
|
997
|
+
action: definition.identity.action,
|
|
998
|
+
name: definition.name,
|
|
999
|
+
presentationSchema: buildToolPresentationSchema({
|
|
1000
|
+
inputSchema: definition.input,
|
|
1001
|
+
unrepresentable: "any"
|
|
1002
|
+
}),
|
|
1003
|
+
shouldExtend: false,
|
|
1004
|
+
...definition.mcp !== undefined && { mcp: definition.mcp }
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
function projectedRuntimeToolSupports(definition, transport) {
|
|
1008
|
+
if (definition.transports?.length === 0) {
|
|
1009
|
+
throw new Error(`Runtime tool "${definition.name}" must expose at least one transport`);
|
|
1010
|
+
}
|
|
1011
|
+
return definition.transports ? definition.transports.includes(transport) : transport !== "CLI";
|
|
1012
|
+
}
|
|
1013
|
+
function duplicateLabel(transport) {
|
|
1014
|
+
if (transport === "MCP")
|
|
1015
|
+
return "MCP tool name";
|
|
1016
|
+
if (transport === "AGENT")
|
|
1017
|
+
return "agent tool name";
|
|
1018
|
+
return "CLI command";
|
|
1019
|
+
}
|
|
1020
|
+
function assertProjectedName(name, serviceName, action, transport, derived) {
|
|
1021
|
+
if (transport === "CLI")
|
|
1022
|
+
return;
|
|
1023
|
+
if (derived && !hasUsableChars(serviceName)) {
|
|
1024
|
+
throw new Error(`Service prefix "${serviceName}" (method "${action}") has no characters usable in a tool name — set an explicit \`tool.name\` or rename the prefix`);
|
|
1025
|
+
}
|
|
1026
|
+
assertToolName(name, serviceName, action);
|
|
1027
|
+
}
|
|
1028
|
+
function projectToolSurface(surface, transport, config = {}) {
|
|
1029
|
+
const projected = [];
|
|
1030
|
+
const names = new Set;
|
|
1031
|
+
const origins = new Map;
|
|
1032
|
+
const append = (tool) => {
|
|
1033
|
+
if (config.assertUniqueNames ?? true) {
|
|
1034
|
+
if (names.has(tool.name)) {
|
|
1035
|
+
const previous = origins.get(tool.name) ?? "unknown";
|
|
1036
|
+
const current = `${tool.serviceName}.${tool.action}`;
|
|
1037
|
+
throw new Error(`Duplicate ${duplicateLabel(transport)} "${tool.name}" across mounted operations: ${previous}, ${current}`);
|
|
1038
|
+
}
|
|
1039
|
+
assertUniqueToolName(tool.name, false, duplicateLabel(transport));
|
|
1040
|
+
}
|
|
1041
|
+
names.add(tool.name);
|
|
1042
|
+
origins.set(tool.name, `${tool.serviceName}.${tool.action}`);
|
|
1043
|
+
projected.push(tool);
|
|
1044
|
+
};
|
|
1045
|
+
for (const service of surface.services ?? []) {
|
|
1046
|
+
for (const [methodName, method] of Object.entries(service.methods)) {
|
|
1047
|
+
if (transport === "CLI") {
|
|
1048
|
+
if (!method.expose?.includes("CLI"))
|
|
1049
|
+
continue;
|
|
1050
|
+
} else if (method.expose && !method.expose.includes(transport)) {
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
if (method.multipart || method.rawBody || method.responseMeta || method.rawResponse) {
|
|
1054
|
+
continue;
|
|
1055
|
+
}
|
|
1056
|
+
const name = method.toolName ?? toToolName(service.name, methodName);
|
|
1057
|
+
if (config.assertNames ?? true) {
|
|
1058
|
+
assertProjectedName(name, service.name, methodName, transport, !method.toolName);
|
|
1059
|
+
}
|
|
1060
|
+
const shouldExtend = transport !== "CLI" && config.extend !== undefined && (!config.extend.filter || config.extend.filter(service, method));
|
|
1061
|
+
if (shouldExtend && config.extend) {
|
|
1062
|
+
assertToolExtensionCompatible(mergeSchemas(method.paramsSchema, method.inputSchema), config.extend.schema);
|
|
1063
|
+
}
|
|
1064
|
+
append({
|
|
1065
|
+
kind: "contract",
|
|
1066
|
+
source: method,
|
|
1067
|
+
serviceName: method.serviceName,
|
|
1068
|
+
action: method.key,
|
|
1069
|
+
name,
|
|
1070
|
+
presentationSchema: buildToolPresentationSchema({
|
|
1071
|
+
paramsSchema: method.paramsSchema,
|
|
1072
|
+
inputSchema: method.inputSchema,
|
|
1073
|
+
defaults: method.toolView?.defaults,
|
|
1074
|
+
extendSchema: shouldExtend ? config.extend?.schema : undefined,
|
|
1075
|
+
flattenUnionInput: config.flattenUnionInput,
|
|
1076
|
+
unrepresentable: "any"
|
|
1077
|
+
}),
|
|
1078
|
+
shouldExtend,
|
|
1079
|
+
...method.mcp !== undefined && { mcp: method.mcp }
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
for (const definition of surface.runtimeTools ?? []) {
|
|
1084
|
+
if (!projectedRuntimeToolSupports(definition, transport))
|
|
1085
|
+
continue;
|
|
1086
|
+
if (config.assertNames ?? true) {
|
|
1087
|
+
assertProjectedName(definition.name, definition.identity.serviceName, definition.identity.action, transport, false);
|
|
1088
|
+
}
|
|
1089
|
+
append(projectRuntimeTool(definition, false));
|
|
1090
|
+
}
|
|
1091
|
+
return projected;
|
|
1092
|
+
}
|
|
1093
|
+
function mcpProjectionCandidate(tool) {
|
|
1094
|
+
if (tool.kind === "contract") {
|
|
1095
|
+
return {
|
|
1096
|
+
tool,
|
|
1097
|
+
name: tool.name,
|
|
1098
|
+
...tool.source.paramsSchema !== undefined && {
|
|
1099
|
+
paramsSchema: tool.source.paramsSchema
|
|
1100
|
+
},
|
|
1101
|
+
...tool.source.inputSchema !== undefined && {
|
|
1102
|
+
inputSchema: tool.source.inputSchema
|
|
1103
|
+
},
|
|
1104
|
+
...tool.source.toolView?.defaults !== undefined && {
|
|
1105
|
+
inputDefaults: tool.source.toolView.defaults
|
|
1106
|
+
},
|
|
1107
|
+
...toolSurfaceOutputSchema(tool.source) !== undefined && {
|
|
1108
|
+
outputSchema: toolSurfaceOutputSchema(tool.source)
|
|
1109
|
+
},
|
|
1110
|
+
shouldExtend: tool.shouldExtend,
|
|
1111
|
+
...tool.mcp !== undefined && { mcp: tool.mcp }
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
return {
|
|
1115
|
+
tool,
|
|
1116
|
+
name: tool.name,
|
|
1117
|
+
inputSchema: tool.source.input,
|
|
1118
|
+
...tool.source.output !== undefined && { outputSchema: tool.source.output },
|
|
1119
|
+
shouldExtend: false,
|
|
1120
|
+
...tool.mcp !== undefined && { mcp: tool.mcp }
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
function reportIncompatible(message, policy, logger, failures) {
|
|
1124
|
+
if (policy === "throw")
|
|
1125
|
+
failures.push(message);
|
|
1126
|
+
else if (policy === "warn") {
|
|
1127
|
+
if (logger)
|
|
1128
|
+
logger.warn(`[stitchkit] ${message}`);
|
|
1129
|
+
else
|
|
1130
|
+
console.warn(`[stitchkit] ${message}`);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
function prepareProjectedMcpTools(tools, config = {}) {
|
|
1134
|
+
const policy = config.schemaValidation?.policy ?? "throw";
|
|
1135
|
+
const failures = [];
|
|
1136
|
+
const prepared = [];
|
|
1137
|
+
const names = new Set;
|
|
1138
|
+
for (const tool of tools) {
|
|
1139
|
+
assertUniqueToolName(tool.name, names.has(tool.name), "MCP tool name");
|
|
1140
|
+
names.add(tool.name);
|
|
1141
|
+
if (tool.mcp)
|
|
1142
|
+
validateMcpRoundPolicy(tool, tool.mcp, config.multiRound);
|
|
1143
|
+
let inputSchema;
|
|
1144
|
+
try {
|
|
1145
|
+
inputSchema = buildToolPresentationSchema({
|
|
1146
|
+
paramsSchema: tool.paramsSchema,
|
|
1147
|
+
inputSchema: tool.inputSchema,
|
|
1148
|
+
extendSchema: tool.shouldExtend && config.extend ? config.extend.schema : undefined,
|
|
1149
|
+
flattenUnionInput: config.flattenUnionInput,
|
|
1150
|
+
unrepresentable: "throw",
|
|
1151
|
+
defaults: tool.inputDefaults
|
|
1152
|
+
});
|
|
1153
|
+
} catch (error) {
|
|
1154
|
+
reportIncompatible(`MCP tool "${tool.name}" — input schema is not JSON Schema-compatible: ${error instanceof Error ? error.message : String(error)}`, policy, config.logger, failures);
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
if (!isObjectPresentationSchema(inputSchema)) {
|
|
1158
|
+
reportIncompatible(`MCP tool "${tool.name}" — input must be an object schema; a union, discriminated union or scalar cannot be an MCP tool input (flatten it in the contract, or drop MCP from \`expose\`)`, policy, config.logger, failures);
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1161
|
+
if (config.schemaValidation?.requireTypedProperties) {
|
|
1162
|
+
const allowed = new Set(config.schemaValidation.allowUntyped ?? []);
|
|
1163
|
+
for (const untyped of findUntypedProperties(inputSchema)) {
|
|
1164
|
+
const path = `${tool.name}.${untyped.path}`;
|
|
1165
|
+
if (allowed.has(path))
|
|
1166
|
+
continue;
|
|
1167
|
+
const clue = untyped.description ? ` (only a description: "${untyped.description}")` : "";
|
|
1168
|
+
reportIncompatible(`MCP tool "${tool.name}" — input property "${untyped.path}" carries no type, enum or $ref${clue}. A model is given no way to know what to send. Use \`z.json()\` for an arbitrary JSON value; use \`allowUntyped\` only when the presentation value is genuinely not representable as JSON Schema.`, policy === "skip" ? "warn" : policy, config.logger, failures);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
if (config.schemaValidation?.requirePortableFormats) {
|
|
1172
|
+
for (const finding of findNonPortableFormats(inputSchema, config.schemaValidation.allowFormats)) {
|
|
1173
|
+
reportIncompatible(`MCP tool "${tool.name}" — input property "${finding.path}" uses non-portable JSON Schema format "${finding.format}". Use a portable pattern/schema, or list the format in \`allowFormats\` only when every MCP client supports it.`, policy === "skip" ? "warn" : policy, config.logger, failures);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
const outputSchema = tool.outputSchema;
|
|
1177
|
+
let compatibleOutput;
|
|
1178
|
+
if (outputSchema) {
|
|
1179
|
+
try {
|
|
1180
|
+
const output = toJsonSchema(outputSchema, "output");
|
|
1181
|
+
compatibleOutput = outputSchema;
|
|
1182
|
+
if (config.schemaValidation?.requirePortableFormats) {
|
|
1183
|
+
for (const finding of findNonPortableFormats(output, config.schemaValidation.allowFormats)) {
|
|
1184
|
+
reportIncompatible(`MCP tool "${tool.name}" — output property "${finding.path}" uses non-portable JSON Schema format "${finding.format}". Use a portable pattern/schema, or list the format in \`allowFormats\` only when every MCP client supports it.`, policy === "skip" ? "warn" : policy, config.logger, failures);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
} catch (error) {
|
|
1188
|
+
reportIncompatible(`MCP tool "${tool.name}" — output schema is not JSON Schema-compatible: ${error instanceof Error ? error.message : String(error)}`, policy, config.logger, failures);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
prepared.push({
|
|
1192
|
+
tool: tool.tool,
|
|
1193
|
+
inputSchema,
|
|
1194
|
+
...compatibleOutput !== undefined && { outputSchema: compatibleOutput }
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
if (failures.length > 0) {
|
|
1198
|
+
throw new Error(`[stitchkit] ${failures.length} problem(s) with MCP tool schemas:
|
|
1199
|
+
- ${failures.join(`
|
|
1200
|
+
- `)}`);
|
|
1201
|
+
}
|
|
1202
|
+
return prepared;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
export { toolSurfaceOutputSchema, applyToolViewDefaults, projectToolView, objectShapeKeys, rebuildObject, mergeSchemas, staticInputRounds, validateMcpRoundPolicy, validateResolvedInputRounds, assertToolName, assertUniqueToolName, PORTABLE_JSON_SCHEMA_FORMATS, findNonPortableFormats, declaresDraft07, withDefsDialect, flattenToolJsonSchema, buildToolPresentationSchema, presentationMetadata, findUntypedProperties, assertToolExtensionCompatible, projectRuntimeTool, projectToolSurface, mcpProjectionCandidate, prepareProjectedMcpTools };
|