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,893 @@
|
|
|
1
|
+
# stitchkit/observability — stitchkit docs slice
|
|
2
|
+
|
|
3
|
+
> Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
|
|
4
|
+
> `llms.txt` in this package.
|
|
5
|
+
|
|
6
|
+
Contains: Guide: Observability (docs/guide/observability.md) · API reference: `stitchkit/observability` (docs/api/reference.md)
|
|
7
|
+
|
|
8
|
+
==============================================================================
|
|
9
|
+
# Guide: Observability (docs/guide/observability.md)
|
|
10
|
+
==============================================================================
|
|
11
|
+
|
|
12
|
+
# Observability
|
|
13
|
+
|
|
14
|
+
A request reaches your app through one of two surfaces — an HTTP route or a
|
|
15
|
+
tool call (MCP / agent). Observability is the same question on both: *what
|
|
16
|
+
happened, how long did it take, who made it, did it fail.*
|
|
17
|
+
|
|
18
|
+
stitchkit answers this at two levels.
|
|
19
|
+
|
|
20
|
+
- **The raw hooks** — `LifecycleHooks` and `ToolCallHooks`. Every request and
|
|
21
|
+
every tool call passes through a point you can observe. The lowest level;
|
|
22
|
+
always available. [Jump ↓](#the-raw-hooks)
|
|
23
|
+
- **`stitchkit/observability`** — framework-owned HTTP completion plus canonical
|
|
24
|
+
tool hooks: W3C trace context, an `AsyncLocalStorage` request context, payload
|
|
25
|
+
sanitisation and `createObservability` with independent request/tool sinks.
|
|
26
|
+
[Start here ↓](#the-observability-module)
|
|
27
|
+
|
|
28
|
+
stitchkit still ships no logger and no audit store, and auditing stays opt-in —
|
|
29
|
+
those are the app's choice (→ ADR 0012, reaffirmed in ADR 0184). What it ships is
|
|
30
|
+
the machinery that turns a completed call into a clean, normalised record, keeps
|
|
31
|
+
the ones worth keeping, and does not lose them when the store is down.
|
|
32
|
+
|
|
33
|
+
## The observability module
|
|
34
|
+
|
|
35
|
+
`stitchkit/observability` is server-only. It has three parts — a trace context,
|
|
36
|
+
a request context, and event projections — and you usually touch only the last.
|
|
37
|
+
|
|
38
|
+
### createObservability
|
|
39
|
+
|
|
40
|
+
`createObservability` configures request and tool projections independently.
|
|
41
|
+
Every completed application call is normalised into one `RequestEvent`; HTTP
|
|
42
|
+
completion is owned directly by `createHandler`, while MCP/Agent completion uses
|
|
43
|
+
the canonical `ToolCallHooks` runner. Confirmed HTTP client cancellation stays
|
|
44
|
+
in the access log by default and becomes a structured event only when the
|
|
45
|
+
request sink opts in. There is no nested HTTP audit wrapper.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { createObservability } from 'stitchkit/observability'
|
|
49
|
+
|
|
50
|
+
const write = (event) => db.auditLog.create({ data: {
|
|
51
|
+
traceId: event.traceId,
|
|
52
|
+
source: event.source,
|
|
53
|
+
method: event.method,
|
|
54
|
+
path: event.path,
|
|
55
|
+
ok: event.ok,
|
|
56
|
+
statusCode: event.statusCode,
|
|
57
|
+
durationMs: event.durationMs,
|
|
58
|
+
userId: event.userId,
|
|
59
|
+
payload: event.payload,
|
|
60
|
+
}})
|
|
61
|
+
|
|
62
|
+
export const observability = createObservability({
|
|
63
|
+
request: {
|
|
64
|
+
write,
|
|
65
|
+
includePayload: false, // default: no Request.clone(), payload is null
|
|
66
|
+
includeCancelled: false, // default: keep client closes in access logs only
|
|
67
|
+
filter: (event) => event.method !== 'GET', // see the note on jobs below
|
|
68
|
+
},
|
|
69
|
+
tools: {
|
|
70
|
+
write,
|
|
71
|
+
filter: (event) => event.source === 'mcp' || event.source === 'agent',
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Wire each projection where its completion is owned:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
createServer({ services, observability: observability.request })
|
|
80
|
+
|
|
81
|
+
createMcpHandler({ /* … */ hooks: observability.toolCall })
|
|
82
|
+
mountAgent(service, { hooks: observability.toolCall })
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Each sink runs fire-and-forget and fails independently: a slow or broken request
|
|
86
|
+
sink cannot block the response, suppress operational logging or break the tool
|
|
87
|
+
sink.
|
|
88
|
+
|
|
89
|
+
#### Client cancellation
|
|
90
|
+
|
|
91
|
+
A physical client close is classified only when the request's own signal is
|
|
92
|
+
aborted and the thrown value is either an `AbortError` or contains the exact
|
|
93
|
+
`request.signal.reason` by identity at the top level or within at most eight
|
|
94
|
+
standard `cause` links. Cause traversal is cycle-safe. No message or error-code
|
|
95
|
+
matching is used; active requests and unrelated/deeper causes remain application
|
|
96
|
+
failures. The access completion is always `499/info`, without application error
|
|
97
|
+
fields or project `onError`.
|
|
98
|
+
|
|
99
|
+
Structured request sinks are default-preserving: existing sinks receive no row
|
|
100
|
+
for this outcome. Opt in when cancellation frequency belongs in the durable
|
|
101
|
+
stream:
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
const observability = createObservability({
|
|
105
|
+
request: {
|
|
106
|
+
includeCancelled: true,
|
|
107
|
+
write: (event) => {
|
|
108
|
+
if (event.outcome === 'cancelled') return recordClientClose(event)
|
|
109
|
+
return recordApplicationRequest(event)
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
An opted-in row has `outcome: 'cancelled'`, `ok: false`, `statusCode: 499`, the
|
|
116
|
+
ordinary identity/trace/timing fields and no `errorCode`, `errorMessage` or
|
|
117
|
+
`errorDetail`. `ok` remains the legacy success bit: branch on `outcome` first.
|
|
118
|
+
Cancellation rows use the same filter, capacity, diagnostics, ordering,
|
|
119
|
+
`flush()` and `close()` machinery as every request event. MCP protocol
|
|
120
|
+
cancellation remains represented by `event.mcp.outcome`; Agent and CLI have no
|
|
121
|
+
generic client-disconnect signal and are not inferred from error text.
|
|
122
|
+
|
|
123
|
+
The fire-and-forget work has an explicit bounded lifecycle:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
export const observability = createObservability({
|
|
127
|
+
request: {
|
|
128
|
+
maxPending: 1_000,
|
|
129
|
+
write: persistRequestEvent,
|
|
130
|
+
onSinkError: ({ error, event }) => reportAuditFailure(error, event),
|
|
131
|
+
onDrop: ({ reason, event, pending }) => {
|
|
132
|
+
reportAuditDrop({ reason, traceId: event.traceId, pending })
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
tools: {
|
|
136
|
+
maxPending: 500,
|
|
137
|
+
write: persistToolEvent,
|
|
138
|
+
onSinkError: ({ error, event }) => reportToolAuditFailure(error, event),
|
|
139
|
+
onDrop: reportToolAuditDrop,
|
|
140
|
+
},
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
const status = observability.getStatus()
|
|
144
|
+
const report = await observability.close({ timeoutMs: 5_000 })
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`maxPending` defaults to `1000` per sink and must be a positive safe integer.
|
|
148
|
+
Filtering and sanitisation happen before a write occupies a pending slot. At
|
|
149
|
+
capacity, a new event is rejected with `onDrop({ reason: 'capacity', ... })`;
|
|
150
|
+
after close, admission reports `reason: 'closed'`. Existing writes are never
|
|
151
|
+
cancelled. Sink, filter and diagnostic-callback failures remain isolated from
|
|
152
|
+
the observed request or tool call and are reported through `onSinkError` when
|
|
153
|
+
configured; `onSinkError`/`onDrop` cannot create unhandled rejections.
|
|
154
|
+
|
|
155
|
+
`getStatus()` returns immutable per-surface and aggregate counters: capacity,
|
|
156
|
+
received, accepted, filtered, completed, dropped, failed, preparation failures,
|
|
157
|
+
preparing/pending work and the closed flag. Read it from readiness or metrics
|
|
158
|
+
without parsing callback logs.
|
|
159
|
+
|
|
160
|
+
`flush()` snapshots the current generation and waits only for events admitted
|
|
161
|
+
up to that call. `close()` atomically stops admission, drains every accepted
|
|
162
|
+
generation and returns the final counters plus `durationMs`; repeated unbounded
|
|
163
|
+
calls return the same report. Graceful shutdown order is therefore:
|
|
164
|
+
|
|
165
|
+
1. stop HTTP/MCP admission;
|
|
166
|
+
2. wait for active requests and tool calls;
|
|
167
|
+
3. `await observability.close({ timeoutMs })`;
|
|
168
|
+
4. close the database/storage connection used by the sinks.
|
|
169
|
+
|
|
170
|
+
### Give the drain a bound in a shutdown budget
|
|
171
|
+
|
|
172
|
+
Unbounded, `close()` waits for every accepted event however long the sink takes.
|
|
173
|
+
That is right when the sink is healthy and fatal when it is not: one write that
|
|
174
|
+
never settles — a database that has stopped answering — holds the drain forever,
|
|
175
|
+
and a shutdown that gives every other step a deadline then spends its entire
|
|
176
|
+
budget here and exits by force. A drain that cannot be bounded cannot take part
|
|
177
|
+
in a shutdown budget: it either fits, or it cancels the budget.
|
|
178
|
+
|
|
179
|
+
Both `flush` and `close` take `{ timeoutMs?, signal? }`:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
const report = await observability.close({ timeoutMs: 5_000 })
|
|
183
|
+
if (!report.drained) {
|
|
184
|
+
const t = report.total
|
|
185
|
+
logger.warn('audit drain incomplete', {
|
|
186
|
+
stillWriting: t.pending + t.preparing,
|
|
187
|
+
neverWritten: t.received - t.filtered - t.completed,
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Those are two different numbers and the difference matters. `pending +
|
|
193
|
+
preparing` is what the drain was still waiting for when the bound expired —
|
|
194
|
+
events handed to `write` that may yet succeed. `received - filtered -
|
|
195
|
+
completed` is every event the sink has not written **for any reason**: those,
|
|
196
|
+
plus the ones already lost to `failed`, `dropped` and `preparationFailed`. A
|
|
197
|
+
shutdown log that wants to state how much audit was lost wants the second; one
|
|
198
|
+
that wants to explain why the drain did not finish wants the first.
|
|
199
|
+
|
|
200
|
+
`drained` is read from the counters, not from which side of the race won, so a
|
|
201
|
+
bound that expires on a sink that has in fact finished — a shutdown signal
|
|
202
|
+
already aborted by an earlier step — reports `true` rather than a false alarm.
|
|
203
|
+
|
|
204
|
+
The bound ends the **waiting**, not the writes: a sink's `write` is handed no
|
|
205
|
+
cancellation, so an outstanding one keeps running against whatever the consumer
|
|
206
|
+
closes next. It is a bound on waiting for I/O, not on wall time — no bound can
|
|
207
|
+
preempt a `write` that occupies the event loop. Racing `close()` against your
|
|
208
|
+
own timer looks equivalent and is not: it discards the report along with the
|
|
209
|
+
wait.
|
|
210
|
+
|
|
211
|
+
`flush(bound?)` takes the same bound and returns whether the generation it
|
|
212
|
+
waited on settled. That outcome is returned rather than left to `getStatus()`,
|
|
213
|
+
which cannot answer it: flush waits on the events admitted before the call while
|
|
214
|
+
the status counts everything alive right now, so a complete flush and an expired
|
|
215
|
+
one look identical there.
|
|
216
|
+
|
|
217
|
+
Every other sink in the framework takes the same bound —
|
|
218
|
+
`createApplicationEventSink`, `createApplicationSnapshotSink`,
|
|
219
|
+
`createAgentRuntimeEventSink`, `createAgentObservability`. The hazard was never
|
|
220
|
+
specific to the audit sink; it was specific to waiting without a limit.
|
|
221
|
+
|
|
222
|
+
The drain itself is started once and shared, so a second `close` with a shorter
|
|
223
|
+
bound observes the same drain under its own limit rather than starting another.
|
|
224
|
+
Passing no bound keeps the previous behaviour exactly, including the identical
|
|
225
|
+
returned promise.
|
|
226
|
+
|
|
227
|
+
Stitchkit manages only in-process delivery. If process-crash durability matters,
|
|
228
|
+
make `write` enqueue into a consumer-owned durable outbox and let that adapter
|
|
229
|
+
own retry, replay and storage policy:
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
interface AuditOutbox {
|
|
233
|
+
enqueue(event: RequestEvent): Promise<void>
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const observability = createObservability({
|
|
237
|
+
request: { write: (event) => outbox.enqueue(event) },
|
|
238
|
+
tools: { write: (event) => outbox.enqueue(event) },
|
|
239
|
+
})
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
The core intentionally contains no retry scheduler, database dependency or
|
|
243
|
+
disk queue. A durable adapter can use `(traceId, spanId, source, toolPhase)` as
|
|
244
|
+
its idempotency identity.
|
|
245
|
+
|
|
246
|
+
### RequestEvent
|
|
247
|
+
|
|
248
|
+
Every surface produces the same shape — so a single audit table stays
|
|
249
|
+
queryable across all three:
|
|
250
|
+
|
|
251
|
+
| Field | Notes |
|
|
252
|
+
|-------|-------|
|
|
253
|
+
| `source` | `http` \| `mcp` \| `agent` \| `job` |
|
|
254
|
+
| `kind` | `request` \| `job` — written on **every** row, so a filter never has to read it off an absent `method` |
|
|
255
|
+
| `name` | what the work is, on a job (`agent-loop`, `broadcast-send`); absent on a request, which its method and path name |
|
|
256
|
+
| `method` / `path` | the verb + path, or `TOOL` + `/{source}/{tool}` — **absent** on a job, which arrived over no transport |
|
|
257
|
+
| `serviceName` / `action` | stable contract identity of the operation (→ ADR 0022) — from the contract, not parsed from `path`; set on every surface, present even on a pre-handler 400 |
|
|
258
|
+
| `toolName` | tool calls only |
|
|
259
|
+
| `httpMethod` | the contract verb on **tool** events (their `method` is `TOOL`) — filter reads vs writes across both surfaces with `(event.httpMethod ?? event.method) !== 'GET'` |
|
|
260
|
+
| `dimensions` | app-defined domain dimensions (tenant / project / entity id) — see [request context](#request-context) |
|
|
261
|
+
| `traceId` / `spanId` / `parentSpanId` | [W3C trace context](#trace-context) |
|
|
262
|
+
| `outcome` | optional `'cancelled'` on explicitly enabled HTTP client-close rows; ordinary rows omit it |
|
|
263
|
+
| `ok` / `statusCode` | legacy success bit plus real HTTP status, or `200`/`400` for a tool; an opted-in cancellation is `false` / `499`. `statusCode` is **absent** on a job — it had no transport to have a status on, and inventing one would be the same defect as the `method: 'AGENT'` this replaced. A job's outcome is `ok`, plus `errorCode` when it failed |
|
|
264
|
+
| `durationMs` / `startedAt` | timing |
|
|
265
|
+
| `errorCode` / `errorMessage` / `errorDetail` | failures only — `errorDetail` carries the structure the message flattens (e.g. Zod issues) |
|
|
266
|
+
| `payload` | sanitised tool arguments; HTTP is `null` unless request `includePayload` is enabled |
|
|
267
|
+
| `resultSize` / `responseBytes` | result item count + serialised size |
|
|
268
|
+
| `userId` / `ipAddress` / `userAgent` | identity |
|
|
269
|
+
|
|
270
|
+
### Work that is not a request — `runUnitOfWork`
|
|
271
|
+
|
|
272
|
+
An agent loop launched fire-and-forget, a scheduled broadcast, a scenario engine
|
|
273
|
+
tick: each has a start, a duration and an outcome, and none of them arrived over
|
|
274
|
+
a transport. Run one inside a context and it is audited like everything else:
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
await runUnitOfWork({ name: 'broadcast-send', observability }, async () => {
|
|
278
|
+
setRequestDimensions({ projectId })
|
|
279
|
+
await send()
|
|
280
|
+
})
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
The row carries `kind: 'job'`, the `name`, the duration and the outcome, and
|
|
284
|
+
carries **no** `method`, `path` or `statusCode`, because the work had none. That
|
|
285
|
+
absence is the point. The alternative is what consuming code had to do before —
|
|
286
|
+
write `method: 'AGENT'` into the field for verbs — and a row that names a verb
|
|
287
|
+
nobody used is worse than a row that names none, because a filter reading
|
|
288
|
+
`method !== 'GET'` counts it as a write and nothing looks wrong.
|
|
289
|
+
|
|
290
|
+
Which is why **a filter on `method` needs a decision about jobs.** `auditChanges`
|
|
291
|
+
makes it explicitly: a row with no verb is kept, because whether it changed
|
|
292
|
+
anything cannot be answered from the row, and an audit that drops what it did not
|
|
293
|
+
examine reports zero and looks exactly like a system in which nothing happened.
|
|
294
|
+
A hand-written `event.method !== 'GET'` keeps jobs too (`undefined !== 'GET'`);
|
|
295
|
+
`event.kind === 'request' && event.method !== 'GET'` is how you exclude them on
|
|
296
|
+
purpose.
|
|
297
|
+
|
|
298
|
+
Without an `observability` the work still runs inside a context, so trace ids,
|
|
299
|
+
`setRequestDimensions` and the bounded logger behave — recording is a separate
|
|
300
|
+
decision from having a context. `traceparent` continues the trace of whatever
|
|
301
|
+
scheduled the work, instead of starting an unrelated one.
|
|
302
|
+
|
|
303
|
+
### Write the calls that changed something
|
|
304
|
+
|
|
305
|
+
`auditChanges` is the filter most projects end up writing, shipped so they do not
|
|
306
|
+
have to write it six ways:
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
import { auditChanges, createObservability } from 'stitchkit/observability';
|
|
310
|
+
|
|
311
|
+
createObservability({
|
|
312
|
+
request: { write: saveAuditRow, filter: auditChanges },
|
|
313
|
+
tools: { write: saveAuditRow, filter: auditChanges },
|
|
314
|
+
});
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
It drops `GET`, `HEAD` and `OPTIONS`, keeps everything else, and keeps `401` and
|
|
318
|
+
`403` **whatever the verb was** — a refused read is the row an audit exists to
|
|
319
|
+
hold, and a filter that drops every `GET` drops exactly that. An unrecognised
|
|
320
|
+
verb is kept: an extra row costs bytes, a missing one costs the answer to "who
|
|
321
|
+
changed this", silently and only later.
|
|
322
|
+
|
|
323
|
+
One filter across HTTP, MCP and agent calls, because a tool call carries its
|
|
324
|
+
contract verb in `httpMethod` while its `method` is the literal `TOOL`.
|
|
325
|
+
|
|
326
|
+
Narrower policy stays yours — compose it:
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
filter: (event) => auditChanges(event) && event.serviceName !== 'health',
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Keeping the row when the store is down
|
|
333
|
+
|
|
334
|
+
A sink is fire-and-forget, so an unreachable store means the event is simply
|
|
335
|
+
gone — and a store is most likely to be unreachable during an incident, which is
|
|
336
|
+
the window whose rows someone will later want most.
|
|
337
|
+
|
|
338
|
+
`createSpooledSink` writes the row to a local append-only file first, offers it
|
|
339
|
+
to the store second, and marks it delivered third. What a previous process left
|
|
340
|
+
unmarked is replayed:
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
import { createSpooledSink } from 'stitchkit/observability';
|
|
344
|
+
|
|
345
|
+
const audit = createSpooledSink({
|
|
346
|
+
path: '/var/lib/app/audit.ndjson',
|
|
347
|
+
write: saveAuditRow,
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// Once, at startup, before the sink is wired — and await it.
|
|
351
|
+
const { replayed, failed } = await audit.recover();
|
|
352
|
+
|
|
353
|
+
createObservability({ request: { write: audit.write, filter: auditChanges } });
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
The guarantee is **at least once**. A crash between the store accepting a row and
|
|
357
|
+
the file recording that it did replays the row, so **the store must be idempotent
|
|
358
|
+
on the record key** — `event.spanId` by default, unique per call. A unique index
|
|
359
|
+
on it turns the duplicate into a no-op; without one, replay writes the row twice.
|
|
360
|
+
Exactly-once would need the file and the database to share a transaction. They do
|
|
361
|
+
not.
|
|
362
|
+
|
|
363
|
+
One process, one path. Two processes pointed at the same file replay each other's
|
|
364
|
+
records: harmless against an idempotent store, wasteful always.
|
|
365
|
+
|
|
366
|
+
### Request context
|
|
367
|
+
|
|
368
|
+
When request observability is configured, `createHandler` establishes the
|
|
369
|
+
`AsyncLocalStorage` request context itself and uses the same completion snapshot
|
|
370
|
+
for operational logging and `RequestEvent`. No `wrapFetch` composition is
|
|
371
|
+
needed:
|
|
372
|
+
|
|
373
|
+
```ts
|
|
374
|
+
createServer({ services, logging, observability: observability.request })
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
`wrapInRequestContext` remains available for a custom fetch pipeline that does
|
|
378
|
+
not use `createHandler`; it is no longer part of built-in HTTP audit wiring:
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
Bun.serve({ fetch: wrapInRequestContext(customFetch) })
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Some fields are filled in late. Set them from the hooks that know:
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
import {
|
|
388
|
+
setRequestDimensions,
|
|
389
|
+
setRequestError,
|
|
390
|
+
setRequestUser,
|
|
391
|
+
} from 'stitchkit/observability'
|
|
392
|
+
|
|
393
|
+
createAuthHook({ /* … */ inject: (ctx, user) => user && setRequestUser(user.id) })
|
|
394
|
+
// ↑ on the HTTP path. Inside a tool call this writes to that call's own context
|
|
395
|
+
// (→ ADR 0045); a tool row takes its identity from the mount's `context`.
|
|
396
|
+
// only to override what the framework already recorded — see below:
|
|
397
|
+
setRequestError({ code: err.code, message: err.message, details: err.issues })
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
**The failure is recorded for you.** Every error travels one path inside the
|
|
401
|
+
framework, and that path writes `{ code, message, details }` onto the context —
|
|
402
|
+
so an audited failure names its cause whether or not you wrote an `onError`, and
|
|
403
|
+
whether or not your `onError` returns its own `Response`. Where the envelope was
|
|
404
|
+
scrubbed to `INTERNAL_SERVER_ERROR`, the row gets the **real** message rather than
|
|
405
|
+
the placeholder; the caller still receives the scrubbed one. → ADR 0043
|
|
406
|
+
|
|
407
|
+
`setRequestError` is therefore an **override**, not the wiring: call it when you
|
|
408
|
+
want the row to say something other than what the framework derived (a domain
|
|
409
|
+
code, a curated message, structured issues). The framework writes only when the
|
|
410
|
+
context carries nothing yet, so your value always wins.
|
|
411
|
+
|
|
412
|
+
**Endpoint identity is automatic — for contract operations.** The framework
|
|
413
|
+
writes the matched operation's `(serviceName, action)` into the context at
|
|
414
|
+
route-match, *before* validation, so both are present on every event for a
|
|
415
|
+
request that matched a contract route, including a pre-handler 400. Nothing to
|
|
416
|
+
wire.
|
|
417
|
+
|
|
418
|
+
Raw routes may opt into the same context with `serviceName` and optional
|
|
419
|
+
`action` on their `RawRoute` declaration. Without that declaration they remain
|
|
420
|
+
absent, as they do for a request short-circuited by `onRequest` and an unmatched
|
|
421
|
+
404 or 405. Both fields therefore remain optional in `RequestEvent`; a sink
|
|
422
|
+
with a `NOT NULL` column on either still has to account for unattributed paths.
|
|
423
|
+
|
|
424
|
+
When failure attribution itself is asynchronous, use `createErrorHook`'s
|
|
425
|
+
`onError(error, info, ctx, endpoint)` observer. The framework awaits it before
|
|
426
|
+
calling `render`, so identity or audit enrichment is visible to both the final
|
|
427
|
+
error envelope and the request event. `endpoint` is the matched `MethodDef`, or
|
|
428
|
+
`undefined` when routing failed before a method was selected.
|
|
429
|
+
|
|
430
|
+
**Domain dimensions** — attach your own tenant / project / entity id with
|
|
431
|
+
`setRequestDimensions`. It is an opaque `Record<string, string>` the core gives no
|
|
432
|
+
meaning to (→ ADR 0021). Resolve it cheaply from `ctx.params` / headers in
|
|
433
|
+
`beforeHandle` (success) or `onError` (a pre-handler failure — `ctx.params` /
|
|
434
|
+
`ctx.req` are available there) and it lands on `event.dimensions` for the request
|
|
435
|
+
either way, so your sink reads it as a column instead of re-parsing the path:
|
|
436
|
+
|
|
437
|
+
> **On the tool path it lands on that call's own event, not the request's.** The
|
|
438
|
+
> same hooks object is assignable to `ToolLifecycle`, so this recipe is the one
|
|
439
|
+
> people apply to tools — and since ADR 0045 each tool call runs in its own
|
|
440
|
+
> context. Read the value off the tool row (`event.toolName != null`); both rows
|
|
441
|
+
> carry the same `traceId`, so recovering the enclosing request is one filter:
|
|
442
|
+
>
|
|
443
|
+
> ```bash
|
|
444
|
+
> jq -s '[.[] | select(.dimensions.botId == "B7") | .traceId] as $t
|
|
445
|
+
> | .[] | select(.traceId | IN($t[]))' audit.jsonl
|
|
446
|
+
> ```
|
|
447
|
+
>
|
|
448
|
+
> Worth checking your **runbooks** as well as your code when this lands: a
|
|
449
|
+
> dimension filter written against request rows keeps parsing and starts
|
|
450
|
+
> returning nothing.
|
|
451
|
+
|
|
452
|
+
```ts
|
|
453
|
+
// beforeHandle (success) and onError (failure) alike:
|
|
454
|
+
const projectId = ctx.req?.headers.get('x-project') ?? String(ctx.params?.projectId ?? '')
|
|
455
|
+
if (projectId) setRequestDimensions({ projectId })
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Make the framework router share this trace id — so request logs and your
|
|
459
|
+
application logs carry one id — by passing `getTraceId` as the resolver:
|
|
460
|
+
|
|
461
|
+
```ts
|
|
462
|
+
createHandler({ /* … */ traceId: getTraceId })
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
`getTraceId` returns `undefined` outside an active context, and the framework
|
|
466
|
+
falls back to its own resolver — a trusted inbound `x-request-id` / `x-trace-id`,
|
|
467
|
+
else a fresh id — so the line never carries the string `"undefined"`.
|
|
468
|
+
|
|
469
|
+
Inside a **tool call** the context is that call's own (→ ADR 0045), so the
|
|
470
|
+
enrichment a request log picks up describes the request, not the call.
|
|
471
|
+
|
|
472
|
+
`getRequestContext()` / `getTraceId()` then return the active values from
|
|
473
|
+
anywhere in the call — stamp `getTraceId()` onto every line your logger writes.
|
|
474
|
+
The **request log picks the context up on its own**: with a context active, each
|
|
475
|
+
completion line carries `userId`, `serviceName`, `action` and `dimensions`
|
|
476
|
+
without any configuration.
|
|
477
|
+
|
|
478
|
+
⚠️ In the **structured** output only — the `json` line and a custom `logger`'s
|
|
479
|
+
`data`. The `pretty` `←` line is a line to read, not a record to query, and
|
|
480
|
+
never carries them (nor `enrich`'s fields). Set
|
|
481
|
+
[`logging.format: 'json'`](./server.md#two-formats-and-who-chooses) to see them
|
|
482
|
+
locally; you do not need to change `NODE_ENV` or deploy.
|
|
483
|
+
|
|
484
|
+
### Correlating with a reverse proxy
|
|
485
|
+
|
|
486
|
+
Every response the stitchkit handler produces carries the resolved id as
|
|
487
|
+
**`x-request-id`**. With `cors` configured it is in the default
|
|
488
|
+
`Access-Control-Expose-Headers`, so a browser client can read it and quote it in
|
|
489
|
+
a bug report. Stitchkit browser clients retain it as `ApiError.traceId` on
|
|
490
|
+
response-backed failures. Note the deliberate asymmetry: inbound the id may arrive as
|
|
491
|
+
`X-Trace-Id` *or* `X-Request-Id`; outbound there is one name and no alias.
|
|
492
|
+
|
|
493
|
+
Log the same id from nginx and the two logs join on one key. `log_format` and
|
|
494
|
+
`map` are `http {}`-context directives — put the block there, not inside
|
|
495
|
+
`server {}`:
|
|
496
|
+
|
|
497
|
+
```nginx
|
|
498
|
+
log_format stitch '$remote_addr $status $request_time rid=$rid "$request"';
|
|
499
|
+
|
|
500
|
+
# Fall back to nginx's own id for responses stitchkit never produced — Bun's
|
|
501
|
+
# native `routes`, a throwing `onRequest` (which escapes before any response
|
|
502
|
+
# exists), a redirect whose headers are immutable.
|
|
503
|
+
map $upstream_http_x_request_id $rid {
|
|
504
|
+
"" $request_id;
|
|
505
|
+
default $upstream_http_x_request_id;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
access_log /var/log/nginx/access.log stitch;
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
`grep rid=<id>` across both logs then reconstructs the whole request. Tool calls
|
|
512
|
+
join too: `createToolLogger`'s record carries `traceId`, so an MCP or agent call
|
|
513
|
+
made inside a request lines up with it.
|
|
514
|
+
|
|
515
|
+
### Trace context
|
|
516
|
+
|
|
517
|
+
stitchkit speaks [W3C Trace Context](https://www.w3.org/TR/trace-context/). An
|
|
518
|
+
inbound `traceparent` header is continued — its trace id is kept, its span
|
|
519
|
+
becomes the parent — so a trace spans the front-end call, your HTTP handler and
|
|
520
|
+
every tool call underneath it. With no inbound header a fresh root trace is
|
|
521
|
+
minted. Each tool call opens a [`childSpan`](#trace-context) of the request it
|
|
522
|
+
runs in.
|
|
523
|
+
|
|
524
|
+
You rarely call the trace functions directly — `createHandler` request
|
|
525
|
+
observability and `wrapInRequestContext` use them for you. They are exported (`resolveTraceContext`,
|
|
526
|
+
`parseTraceparent`, `formatTraceparent`, `childSpan`) for when you need to
|
|
527
|
+
propagate a `traceparent` onward to another service.
|
|
528
|
+
|
|
529
|
+
The browser side starts the trace:
|
|
530
|
+
[`createHttpClient({ trace: true })`](./client.md#httpclientconfig) emits a
|
|
531
|
+
fresh root `traceparent` on every request, which the server then continues. The
|
|
532
|
+
trace helpers themselves are browser-safe and also exported from the root
|
|
533
|
+
`stitchkit` entry — a custom client can format its own header.
|
|
534
|
+
|
|
535
|
+
The default CORS allow-list already permits `traceparent` / `tracestate`, so a
|
|
536
|
+
cross-origin `trace: true` client works out of the box. If you set a custom
|
|
537
|
+
`cors.headers`, extend `DEFAULT_CORS_ALLOW_HEADERS` rather than replacing it, or
|
|
538
|
+
the preflight will reject the trace header.
|
|
539
|
+
|
|
540
|
+
MCP tools use the same context. On a modern HTTP or stdio `tools/call`, the
|
|
541
|
+
official SDK exposes W3C propagation values from request `_meta`; Stitchkit
|
|
542
|
+
continues a valid `_meta.traceparent` before validation, lifecycle and hooks.
|
|
543
|
+
If MCP metadata omits `traceparent`, an HTTP call keeps its ambient HTTP trace
|
|
544
|
+
and a stdio call starts a new root. If the key is present but malformed or
|
|
545
|
+
all-zero, the call still runs under a fresh local trace instead of trusting the
|
|
546
|
+
ambient one. This makes explicit MCP propagation authoritative without allowing
|
|
547
|
+
invalid input to break the tool.
|
|
548
|
+
|
|
549
|
+
Bounded `tracestate` and `baggage` are available through
|
|
550
|
+
`getRequestContext()?.trace` for outbound propagation. Their contents are not
|
|
551
|
+
copied into the standard `RequestEvent`; never use them for auth, RBAC, tenant
|
|
552
|
+
selection or rate-limit identity. Every MRTR attempt reads its current request
|
|
553
|
+
metadata, so callers that want one trace across rounds must propagate it on
|
|
554
|
+
each request.
|
|
555
|
+
|
|
556
|
+
> **Span ids live in the request context, not on `ctx`.** The handler `ctx`
|
|
557
|
+
> carries a single `traceId`; the full
|
|
558
|
+
> `{ traceId, spanId, parentSpanId, tracestate?, baggage? }` is on
|
|
559
|
+
> the observability request context. To stamp `spanId` / `parentSpanId` into an
|
|
560
|
+
> audit row read `getRequestContext()?.trace`, not `ctx.spanId`:
|
|
561
|
+
>
|
|
562
|
+
> ```ts
|
|
563
|
+
> const trace = getRequestContext()?.trace
|
|
564
|
+
> audit({ traceId: trace?.traceId, spanId: trace?.spanId, parentSpanId: trace?.parentSpanId })
|
|
565
|
+
> ```
|
|
566
|
+
|
|
567
|
+
### Sanitisation
|
|
568
|
+
|
|
569
|
+
A payload goes into an audit row only after `sanitizePayload`:
|
|
570
|
+
|
|
571
|
+
- **secret-named keys are masked** — a key whose words include a secret term is
|
|
572
|
+
redacted (`password`, `sessionToken`, `X-Api-Key`, `authorization`, `cookie`,
|
|
573
|
+
…), while identifiers that merely contain one (`authorId`, `sessionCount`,
|
|
574
|
+
`tokenizer`) survive. This applies wherever a key exists — an object field and
|
|
575
|
+
a `Map` entry alike, at any depth. A `Set` member has no key, so nothing there
|
|
576
|
+
is masked by name;
|
|
577
|
+
- **binary blobs** (`Uint8Array`, `Blob`, `FormData`) collapse to metadata —
|
|
578
|
+
never the bytes;
|
|
579
|
+
- the result is **capped** — anything over the byte limit becomes a preview.
|
|
580
|
+
|
|
581
|
+
`createObservability` runs it on every emitted event; tune each sink separately:
|
|
582
|
+
|
|
583
|
+
```ts
|
|
584
|
+
createObservability({
|
|
585
|
+
request: {
|
|
586
|
+
write,
|
|
587
|
+
includePayload: true,
|
|
588
|
+
sanitize: { maxBytes: 8_000, sensitiveKeys: /password|token|pin/i },
|
|
589
|
+
},
|
|
590
|
+
tools: {
|
|
591
|
+
write,
|
|
592
|
+
sanitize: { maxBytes: 8_000, sensitiveKeys: /password|token|pin/i },
|
|
593
|
+
},
|
|
594
|
+
})
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
`redact`, `truncatePreview` and `measureSize` are exported on their own if you
|
|
598
|
+
need to sanitise something outside the audit path.
|
|
599
|
+
|
|
600
|
+
## The raw hooks
|
|
601
|
+
|
|
602
|
+
Tool observability is built on hooks you can also use directly — for a one-off
|
|
603
|
+
metric, a custom log line, anything that is not a full audit row.
|
|
604
|
+
|
|
605
|
+
| Surface | Hook | Fires |
|
|
606
|
+
|---------|------|-------|
|
|
607
|
+
| HTTP | `LifecycleHooks.afterHandle` / `onError` | after each HTTP request |
|
|
608
|
+
| MCP & agent tools | `ToolCallHooks.afterToolCall` | after each tool call |
|
|
609
|
+
| MCP & agent tools | `ToolCallHooks.onToolError` | when executable parsing, extension resolution, lifecycle or the handler throws |
|
|
610
|
+
|
|
611
|
+
`afterHandle(ctx, result, endpoint)` runs after a handler returns;
|
|
612
|
+
`onError(ctx, error, endpoint)` when one throws. `afterToolCall(options)` runs
|
|
613
|
+
after every tool call —
|
|
614
|
+
success and error alike — carrying the tool name, the arguments, the result, the
|
|
615
|
+
duration, the call context, the endpoint identity, and (only when the call failed
|
|
616
|
+
by throwing) the raw thrown value.
|
|
617
|
+
|
|
618
|
+
A confirmed HTTP client disconnect is the exception to the raw-hook table: it
|
|
619
|
+
is transport cancellation, so neither `afterHandle` nor project `onError` runs.
|
|
620
|
+
Use the `499/info` access completion or opt-in request cancellation event above.
|
|
621
|
+
|
|
622
|
+
```ts
|
|
623
|
+
createMcpHandler({
|
|
624
|
+
serverInfo, auth, services,
|
|
625
|
+
hooks: {
|
|
626
|
+
afterToolCall: ({ toolName, result, durationMs }) => {
|
|
627
|
+
metrics.timing(`tool.${toolName}`, durationMs, { ok: String(result.ok) })
|
|
628
|
+
},
|
|
629
|
+
},
|
|
630
|
+
})
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
Log **after** completion — a record is of a *finished* call; you need the
|
|
634
|
+
outcome and the duration, neither of which exists before the handler runs.
|
|
635
|
+
|
|
636
|
+
### The cause behind a failed tool call
|
|
637
|
+
|
|
638
|
+
`afterToolCall` gives you the `ToolResult`, and for a thrown `AppError` that is
|
|
639
|
+
the whole story — `code` and `details` are yours to route. For anything else it
|
|
640
|
+
is not: an unexpected throw (a dropped connection, a `TypeError`) is scrubbed to
|
|
641
|
+
a bare `INTERNAL_SERVER_ERROR` with the message `Internal server error`, because
|
|
642
|
+
a raw `Error.message` can carry a connection string or a file path. The result
|
|
643
|
+
your sink receives says nothing about why.
|
|
644
|
+
|
|
645
|
+
`onToolError` is where that value still exists — **as thrown**, before
|
|
646
|
+
normalisation, stack and `cause` intact:
|
|
647
|
+
|
|
648
|
+
```ts
|
|
649
|
+
createMcpHandler({
|
|
650
|
+
serverInfo, auth, services,
|
|
651
|
+
hooks: {
|
|
652
|
+
onToolError: ({ toolName, error, endpoint }) => {
|
|
653
|
+
reportToolFailure({
|
|
654
|
+
tool: toolName,
|
|
655
|
+
action: endpoint.key,
|
|
656
|
+
message: error instanceof Error ? error.message : String(error),
|
|
657
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
658
|
+
})
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
})
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
It fires for a throw from executable params/input/`ToolExtend` parsing,
|
|
665
|
+
extension resolution, `beforeHandle`, the handler or `afterHandle` — every span
|
|
666
|
+
where information is destroyed — and runs **before** `afterToolCall`. It does
|
|
667
|
+
not fire for an ordinary validation result, an output-schema mismatch or a
|
|
668
|
+
`beforeToolCall` rejection: each is already described in full by its
|
|
669
|
+
`ToolResult`.
|
|
670
|
+
|
|
671
|
+
It observes, it does not handle: the tool envelope is always the framework's, a
|
|
672
|
+
returned value is ignored, and a throw from the hook itself is reported to
|
|
673
|
+
`console.error` and swallowed rather than replacing the failure it was called to
|
|
674
|
+
observe. (This is also why it lives on `ToolCallHooks` rather than being an
|
|
675
|
+
`onError` twin on `ToolLifecycle` — `LifecycleHooks.onError` returns a
|
|
676
|
+
`Response`, which a tool call has no use for, and a whole `createServer` hooks
|
|
677
|
+
object must stay assignable to `ToolLifecycle`.)
|
|
678
|
+
|
|
679
|
+
### Compose lifecycle policy explicitly
|
|
680
|
+
|
|
681
|
+
When auth, a feature policy and audit identity are independent modules, compose
|
|
682
|
+
their existing hooks instead of forwarding each phase by hand:
|
|
683
|
+
|
|
684
|
+
```ts
|
|
685
|
+
import { composeLifecycleHooks } from 'stitchkit/server'
|
|
686
|
+
import { composeToolLifecycle } from 'stitchkit/tools'
|
|
687
|
+
|
|
688
|
+
const httpLifecycle = composeLifecycleHooks(authLifecycle, featurePolicy, auditIdentity)
|
|
689
|
+
const toolLifecycle = composeToolLifecycle(authHook, featureToolPolicy, auditToolIdentity)
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
Phases run left to right. `onRequest` stops on the first `Response`; `onError`
|
|
693
|
+
falls through until a hook handles it; after transforms feed the current value
|
|
694
|
+
forward and preserve it when a hook returns `undefined`. Throws remain owned by
|
|
695
|
+
the existing outer error boundary, and the original context/signal identity is
|
|
696
|
+
never replaced.
|
|
697
|
+
|
|
698
|
+
**Do not reach for `setRequestError` here.** It writes to the *request* context,
|
|
699
|
+
which the built-in **tool** row does not read: a tool event takes
|
|
700
|
+
`errorCode` / `errorMessage` / `errorDetail` from the `ToolResult`, and only
|
|
701
|
+
identity and `dimensions` from the context. Calling it in `onToolError` would
|
|
702
|
+
leave the tool row exactly as scrubbed as before. It is right for the **HTTP**
|
|
703
|
+
path, where the request *is* the record. (Since ADR 0045 a tool call runs in its
|
|
704
|
+
own context, so it can no longer write into the enclosing `/mcp` request's row
|
|
705
|
+
either — the call is simply not where that helper belongs.)
|
|
706
|
+
|
|
707
|
+
### One row that names the cause
|
|
708
|
+
|
|
709
|
+
You do not need to correlate the two hooks yourself. `afterToolCall` receives the
|
|
710
|
+
same raw value as the named `error` field, so one hook can build one record:
|
|
711
|
+
|
|
712
|
+
```ts
|
|
713
|
+
hooks: {
|
|
714
|
+
afterToolCall: ({ toolName, result, durationMs, endpoint, error }) => {
|
|
715
|
+
void writeRow({ toolName, result, durationMs, cause: error, endpoint })
|
|
716
|
+
},
|
|
717
|
+
}
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
`error` is present only when the call failed by **throwing** — a
|
|
721
|
+
validation failure or a `beforeToolCall` rejection leaves it `undefined`, because
|
|
722
|
+
neither ever had a raw value to lose. Consumers destructure only the fields they
|
|
723
|
+
use; future optional fields do not change callback arity.
|
|
724
|
+
|
|
725
|
+
`createObservability({ tools })` uses it already. Where the envelope was scrubbed to
|
|
726
|
+
`INTERNAL_SERVER_ERROR`, the row's `errorMessage` becomes the real message
|
|
727
|
+
instead of the placeholder; a truthful envelope (a thrown `AppError`, a
|
|
728
|
+
`ZodError`) is left alone, `errorCode` and `errorDetail` are untouched, and the
|
|
729
|
+
stack is not written — that is `onToolError`'s job, for a tracker that wants it.
|
|
730
|
+
The caller still receives the scrubbed envelope in every case: the raw text
|
|
731
|
+
reaches your server-side record, never the response. → ADR 0042
|
|
732
|
+
|
|
733
|
+
So the two hooks divide by **purpose**, not by capability — `onToolError` for a
|
|
734
|
+
sink of your own (a tracker, a stack, an alert), `afterToolCall` for the record.
|
|
735
|
+
|
|
736
|
+
### Keying a row on (service, action)
|
|
737
|
+
|
|
738
|
+
Built-in observability keys every event by **service** and **action**
|
|
739
|
+
(`event.serviceName` / `event.action`, → ADR 0029) — reach for the raw hook only
|
|
740
|
+
when you also need the handler **output**, which the audit wrapper never sees. For
|
|
741
|
+
that, read the endpoint identity off the `OperationIdentity` the tool hook
|
|
742
|
+
receives — `endpoint.serviceName` and `endpoint.key` (the endpoint key or native
|
|
743
|
+
action,
|
|
744
|
+
e.g. `updatePartial`). They are stable and always present (→ ADR 0022); the action
|
|
745
|
+
is not in the URL and `toolName` is absent on HTTP-only endpoints, so this is the
|
|
746
|
+
only reliable pair. Contract operations are full `MethodDef` values; native MCP
|
|
747
|
+
operations intentionally have no HTTP `path`. `afterHandle` also gives you the handler `result` — so it is
|
|
748
|
+
the home for a rich mutation audit that records output:
|
|
749
|
+
|
|
750
|
+
```ts
|
|
751
|
+
hooks: {
|
|
752
|
+
afterHandle: (ctx, result, endpoint) => {
|
|
753
|
+
void logMutation({
|
|
754
|
+
service: endpoint.serviceName,
|
|
755
|
+
action: endpoint.key,
|
|
756
|
+
input: ctx.input,
|
|
757
|
+
output: result,
|
|
758
|
+
userId: ctx.userId,
|
|
759
|
+
traceId: ctx.traceId,
|
|
760
|
+
})
|
|
761
|
+
return result // don't transform
|
|
762
|
+
},
|
|
763
|
+
}
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
> **Why HTTP observability is framework-owned, not a lifecycle hook.**
|
|
767
|
+
> `LifecycleHooks` has a single `onError`; an audit built on it would compete
|
|
768
|
+
> with the app's error renderer and miss raw/unmatched exits. `createHandler`
|
|
769
|
+
> sees the final response on every path and emits one completion without
|
|
770
|
+
> consuming an application hook.
|
|
771
|
+
|
|
772
|
+
Keep any sink **asynchronous and self-contained**: a slow or failing write must
|
|
773
|
+
never block or break the request. Swallow the sink's own errors.
|
|
774
|
+
|
|
775
|
+
## Typed dimensions and bounded loggers
|
|
776
|
+
|
|
777
|
+
`createDimensionsProjector` keeps endpoint metadata opaque. Configure typed
|
|
778
|
+
request, result and error projections, then call its phase methods from the
|
|
779
|
+
corresponding lifecycle hooks. Every projection writes through
|
|
780
|
+
`setRequestDimensions`; repeated keys follow the declared `overwrite`,
|
|
781
|
+
`preserve` or `error` policy. Two of its inputs are programming errors and
|
|
782
|
+
throw, which fails the request rather than recording a lie: a repeated key
|
|
783
|
+
under `collision: 'error'`, and a key named `__proto__` (it would set the
|
|
784
|
+
bag's prototype — it can only arrive from parsed input, never from an object
|
|
785
|
+
literal, which has no such own key).
|
|
786
|
+
|
|
787
|
+
`createBoundedLogger` decorates the existing `StitchLogger` interface, so Pino,
|
|
788
|
+
console and application sinks keep their ownership. It reuses the same
|
|
789
|
+
sanitizer as request audit: sensitive keys, configured paths, URL fragments and
|
|
790
|
+
`Error` fields are redacted before string/collection/depth/total-byte bounds are
|
|
791
|
+
applied. Active trace, span, user and dimensions are reserved framework fields;
|
|
792
|
+
caller data cannot overwrite them. A throwing getter, cyclic value or failing
|
|
793
|
+
sink never escapes into application code.
|
|
794
|
+
|
|
795
|
+
One string bound for the whole record cuts an error's stack from the bottom —
|
|
796
|
+
which is exactly where your own frames are. Raise the ceiling for that key alone,
|
|
797
|
+
wherever it sits (`stack` at the top of one record and under `errorDetail` in the
|
|
798
|
+
next is the same field), without touching the bound for everything else:
|
|
799
|
+
|
|
800
|
+
```ts
|
|
801
|
+
createBoundedLogger({
|
|
802
|
+
sink,
|
|
803
|
+
bounds: { stringLength: 4_000, stringLengthByKey: { stack: 32_000 } },
|
|
804
|
+
})
|
|
805
|
+
// or directly: redact(value, { maxStringLength: 4_000, maxStringLengthByKey: { stack: 32_000 } })
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
Keyed by name, not by path — the question is "what is this field", not "where is
|
|
809
|
+
it". The entry ceiling (`entryBytes`) keeps the last word: a record that does not
|
|
810
|
+
fit still collapses, but the decision is made for the record, not by cutting one
|
|
811
|
+
field short in advance.
|
|
812
|
+
|
|
813
|
+
==============================================================================
|
|
814
|
+
# API reference: `stitchkit/observability` (docs/api/reference.md)
|
|
815
|
+
==============================================================================
|
|
816
|
+
|
|
817
|
+
## `stitchkit/observability`
|
|
818
|
+
|
|
819
|
+
Server-only. The audit layer one level above the raw hooks — W3C trace context,
|
|
820
|
+
an `AsyncLocalStorage` request context, payload sanitisation and a normalised
|
|
821
|
+
audit event. See the [Observability guide](../guide/observability.md).
|
|
822
|
+
|
|
823
|
+
### Events
|
|
824
|
+
|
|
825
|
+
| Export | Kind | Summary |
|
|
826
|
+
|--------|------|---------|
|
|
827
|
+
| `createObservability` | function | configure framework-owned request completion and canonical tool event sinks — [guide](../guide/observability.md#createobservability) |
|
|
828
|
+
| `auditChanges` | function | the sink `filter` most projects write themselves — drops `GET`/`HEAD`/`OPTIONS`, keeps `401`/`403` whatever the verb, keeps an unrecognised verb |
|
|
829
|
+
| `createSpooledSink` / `SpooledSink` / `SpooledSinkConfig` / `SpoolRecovery` | function / _types_ | spool the row to an append-only file before the store and replay what a previous process left undelivered — at least once, keyed on `spanId` |
|
|
830
|
+
| `createDimensionsProjector` / `DimensionsProjector` / `DimensionsProjectorConfig` / `ProjectedDimensions` | function / _type_ | typed request/result/error attribution projected into the existing request context |
|
|
831
|
+
| `DimensionCollision` / `SetRequestDimensionsOptions` | _type_ | explicit overwrite, preserve or error policy for dimension keys |
|
|
832
|
+
| `createBoundedLogger` | function | decorate a `StitchLogger` with request context, shared sanitisation, redaction and total bounds |
|
|
833
|
+
| `DEFAULT_REDACT_PATHS` | constant | baseline credential/token paths added to the sanitizer's sensitive-key policy |
|
|
834
|
+
| `BoundedLoggerBounds` / `BoundedLoggerOptions` | _type_ | per-value and total record ceilings (`stringLengthByKey` raises the string bound for named keys such as `stack`) plus sink/redaction configuration |
|
|
835
|
+
| `RequestEvent` | _type_ | the normalised audit event handed to the sink; opt-in HTTP cancellation rows carry `outcome: 'cancelled'` |
|
|
836
|
+
| `runUnitOfWork` / `RunUnitOfWorkOptions` | function / _type_ | run work that did not arrive over a transport — an agent loop, a scheduled broadcast — inside one context, with the same completion record a request gets |
|
|
837
|
+
| `RequestContextKind` | _type_ | `'request'` \| `'job'` — what the row describes, written on every event so a filter never has to read it off an absent `method` |
|
|
838
|
+
| `ObservabilityConfig` | _type_ | independent request and tool sink configuration |
|
|
839
|
+
| `Observability` | _type_ | `{ request?, toolCall, getStatus(), flush(bound?): Promise<boolean>, close(bound?) }` with bounded sink lifecycle |
|
|
840
|
+
| `ObservabilityDrainBound` | _type_ | `timeoutMs` and/or `signal` limiting how long `flush`/`close` wait; the wait ends, outstanding writes do not |
|
|
841
|
+
| `ObservabilitySinkStatus` | _type_ | immutable counters for one bounded request/tool sink |
|
|
842
|
+
| `ObservabilityStatus` | _type_ | per-surface plus aggregate operational snapshot |
|
|
843
|
+
| `ObservabilityDrainReport` | _type_ | final closed/drained snapshot, `durationMs` (the shared drain's age, not this call's wait), and `drained` — read from the counters, `false` only when `total.pending + total.preparing` is nonzero |
|
|
844
|
+
| `ObservabilitySinkStatusSchema` / `ObservabilityStatusSchema` / `ObservabilityDrainReportSchema` | schema | runtime schemas for status/report integration boundaries |
|
|
845
|
+
| `RequestEventSinkConfig` | _type_ | `write`, filter/sanitisation, `maxPending`, `onSinkError` and `onDrop` |
|
|
846
|
+
| `RequestObservabilityConfig` | _type_ | request sink plus opt-in payload capture and default-off `includeCancelled` rows |
|
|
847
|
+
| `SinkDropReason` | _type_ | `'capacity' \| 'closed'` |
|
|
848
|
+
| `SinkError` | _type_ | isolated sink/projection failure and optional event |
|
|
849
|
+
| `SinkDrop` | _type_ | rejected event, reason and current pending count |
|
|
850
|
+
| `HttpRequestCompletion` | _type_ | the single framework-owned HTTP outcome, including optional neutral cancellation, projected to logging and request events |
|
|
851
|
+
| `HttpRequestObserver` | _type_ | server-facing projection consumed by `HandlerConfig.observability` |
|
|
852
|
+
|
|
853
|
+
### Request context
|
|
854
|
+
|
|
855
|
+
| Export | Kind | Summary |
|
|
856
|
+
|--------|------|---------|
|
|
857
|
+
| `WrapRequestContextOptions` | _type_ | options for `wrapInRequestContext` |
|
|
858
|
+
| `wrapInRequestContext` | function | run a fetch handler inside a request context — [guide](../guide/observability.md#request-context) |
|
|
859
|
+
| `getRequestContext` | function | the active request context |
|
|
860
|
+
| `getTraceId` | function | the active trace id — pass as `traceId` to `createServer` |
|
|
861
|
+
| `getUserId` | function | the active user id, once auth has resolved it |
|
|
862
|
+
| `setRequestUser` | function | attach the resolved user to the active context |
|
|
863
|
+
| `setRequestEndpoint` | function | attach the resolved endpoint identity to the active context |
|
|
864
|
+
| `setRequestDimensions` | function | attach custom audit dimensions to the active context |
|
|
865
|
+
| `setRequestError` | function | record the error outcome on the active context |
|
|
866
|
+
| `runWithRequestContext` | function | run a function inside a given context |
|
|
867
|
+
| `RequestContext` | _type_ | the per-request record |
|
|
868
|
+
|
|
869
|
+
### Trace context
|
|
870
|
+
|
|
871
|
+
| Export | Kind | Summary |
|
|
872
|
+
|--------|------|---------|
|
|
873
|
+
| `resolveTraceContext` | function | the trace for a request — `traceparent` continued or fresh |
|
|
874
|
+
| `resolvePropagationContext` | function | continue bounded MCP/W3C propagation metadata with optional ambient fallback |
|
|
875
|
+
| `parseTraceparent` | function | parse a `traceparent` header |
|
|
876
|
+
| `formatTraceparent` | function | render a `traceparent` header value |
|
|
877
|
+
| `createTraceContext` | function | a fresh root trace |
|
|
878
|
+
| `childSpan` | function | a child span of a parent trace |
|
|
879
|
+
| `TraceContext` | _type_ | `{ traceId, spanId, parentSpanId?, tracestate?, baggage? }` |
|
|
880
|
+
|
|
881
|
+
### Sanitisation
|
|
882
|
+
|
|
883
|
+
| Export | Kind | Summary |
|
|
884
|
+
|--------|------|---------|
|
|
885
|
+
| `sanitizePayload` | function | redact secrets and cap size — [guide](../guide/observability.md#sanitisation) |
|
|
886
|
+
| `redact` | function | mask secret-named keys, drop binary blobs |
|
|
887
|
+
| `truncatePreview` | function | cap a value by serialised size |
|
|
888
|
+
| `measureSize` | function | item count + byte size of a result |
|
|
889
|
+
| `JsonValue` | _type_ | a JSON-serialisable value |
|
|
890
|
+
| `SanitizeOptions` | _type_ | tuning for `redact` / `sanitizePayload` — `maxStringLengthByKey` bounds a named key wherever it sits without changing the record-wide bound |
|
|
891
|
+
| `SizeMeasure` | _type_ | the result of `measureSize` |
|
|
892
|
+
|
|
893
|
+
---
|