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
package/llms/cli.txt
ADDED
|
@@ -0,0 +1,948 @@
|
|
|
1
|
+
# stitchkit/cli — stitchkit docs slice, part 1 of 2
|
|
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
|
+
> Continues in `llms/cli.2.txt`.
|
|
6
|
+
|
|
7
|
+
Parts of this slice:
|
|
8
|
+
- `llms/cli.txt`: Guide: CLI (docs/guide/cli.md)
|
|
9
|
+
- `llms/cli.2.txt`: API reference: `stitchkit/cli` (docs/api/reference.md)
|
|
10
|
+
|
|
11
|
+
==============================================================================
|
|
12
|
+
# Guide: CLI (docs/guide/cli.md)
|
|
13
|
+
==============================================================================
|
|
14
|
+
|
|
15
|
+
# CLI
|
|
16
|
+
|
|
17
|
+
The same contract and managed runtime tools that drive HTTP, MCP and agent
|
|
18
|
+
surfaces can also drive a command-line program. `createCli` composes their
|
|
19
|
+
commands with explicitly local binary commands in one router and help tree.
|
|
20
|
+
Managed commands — `myapp generate "a fox" --wait`,
|
|
21
|
+
`myapp models list --json | jq …` — run through the same validation, auth gate
|
|
22
|
+
and error model as every other managed surface (HTTP ≡ MCP ≡ agent ≡ CLI,
|
|
23
|
+
[ADR 0014](../decisions/0014-tool-http-parity.md)).
|
|
24
|
+
|
|
25
|
+
It exists for what the other three surfaces cannot do: a generation kicked off
|
|
26
|
+
with `Bash(run_in_background)` that notifies on exit, a `SKILL.md` that shells
|
|
27
|
+
out in one line, a pipeable terminal command.
|
|
28
|
+
|
|
29
|
+
## Exposure is opt-in
|
|
30
|
+
|
|
31
|
+
Unlike MCP and agent — where an endpoint with no `expose` is a tool by default —
|
|
32
|
+
**a method becomes a CLI command only when its `expose` lists `'CLI'`.** Adding
|
|
33
|
+
the CLI never silently turns your existing API tools into shell commands.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
{ method: 'POST', path: '/', desc: 'Generate media', tool: { name: 'generate' },
|
|
37
|
+
expose: ['CLI', 'MCP', 'AGENT'], input: GenerateInput, output: Generation } // CLI + MCP + agent
|
|
38
|
+
{ method: 'GET', path: '/models', desc: 'List models', tool: { name: 'list_models' },
|
|
39
|
+
expose: ['CLI'] } // CLI only
|
|
40
|
+
{ method: 'GET', path: '/search', desc: 'Search' } // HTTP + MCP + AGENT — NOT CLI
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
A fresh contract shows **zero** CLI commands until methods opt in — that is the
|
|
44
|
+
design, not a bug. A pathless runtime definition follows the same rule: it must
|
|
45
|
+
explicitly include `'CLI'` in `transports`; the undefined default remains
|
|
46
|
+
`['MCP', 'AGENT']`. The command name is the tool name — `tool.name` if set, else
|
|
47
|
+
a verb-aware name from the method + prefix (`list` → `list_widgets`, `get` →
|
|
48
|
+
`get_widget`), not a literal `prefix_key`.
|
|
49
|
+
|
|
50
|
+
## A minimal CLI
|
|
51
|
+
|
|
52
|
+
stitchkit ships no binary — you write the executable and point your app's `bin`
|
|
53
|
+
at it:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
#!/usr/bin/env node
|
|
57
|
+
// src/cli.ts
|
|
58
|
+
import { createCli } from 'stitchkit/cli'
|
|
59
|
+
import { catalogService, generateService } from './services'
|
|
60
|
+
|
|
61
|
+
await createCli({
|
|
62
|
+
name: 'myapp',
|
|
63
|
+
version: '1.0.0',
|
|
64
|
+
services: [catalogService, generateService],
|
|
65
|
+
resolveAuth: () => resolveToken(process.env.MYAPP_TOKEN), // lazy, at most once
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`createCli({ signal })` and its wait loop honor an explicit caller
|
|
70
|
+
`AbortSignal`. Stitchkit does not install a process-global SIGINT handler for
|
|
71
|
+
ordinary CLI programs: if desired, the application binds SIGINT to an
|
|
72
|
+
`AbortController` and passes its signal. Aborting wait stops polling only; it
|
|
73
|
+
does not cancel the underlying job.
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
// package.json
|
|
77
|
+
{ "bin": { "myapp": "./dist/cli.js" } }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`stitchkit/cli` pulls in neither the MCP SDK nor `ai`, so a CLI binary needs no
|
|
81
|
+
MCP/agent peer dependencies.
|
|
82
|
+
|
|
83
|
+
## Pathless managed commands
|
|
84
|
+
|
|
85
|
+
Use `runtimeTools` when an application operation has no HTTP path but must keep
|
|
86
|
+
the canonical operation identity, context, lifecycle/RBAC, hooks and
|
|
87
|
+
introspection. It can share one definition with MCP and Agent while opting into
|
|
88
|
+
CLI explicitly:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { createCli } from 'stitchkit/cli'
|
|
92
|
+
import { defineUploadTool } from 'stitchkit/tools'
|
|
93
|
+
import { z } from 'zod'
|
|
94
|
+
|
|
95
|
+
const uploadInput = defineUploadTool({
|
|
96
|
+
name: 'upload_input',
|
|
97
|
+
description: 'Upload one local input file',
|
|
98
|
+
identity: { serviceName: 'jobs', action: 'uploadInput', scope: 'user' },
|
|
99
|
+
output: z.object({ url: z.url() }),
|
|
100
|
+
transports: ['MCP', 'AGENT', 'CLI'],
|
|
101
|
+
upload: (path, context) => uploadFile(path, context.signal),
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
await createCli({
|
|
105
|
+
name: 'myapp',
|
|
106
|
+
version: '1.0.0',
|
|
107
|
+
runtimeTools: [uploadInput],
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`services` and `runtimeTools` may each be static arrays or factories receiving
|
|
112
|
+
the resolved identity. A runtime-only CLI is valid; `stitchkit/cli` still pulls
|
|
113
|
+
in neither MCP nor AI peers. Contract/runtime name collisions and reserved
|
|
114
|
+
option fields fail through the same checks before managed dispatch.
|
|
115
|
+
|
|
116
|
+
## Native binary commands
|
|
117
|
+
|
|
118
|
+
Login, self-update, diagnostics, integration setup and shell completion belong
|
|
119
|
+
to the executable, not to HTTP/MCP/Agent. Define them with `defineCliCommand`:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { createCli, defineCliCommand } from 'stitchkit/cli'
|
|
123
|
+
import { z } from 'zod'
|
|
124
|
+
|
|
125
|
+
const login = defineCliCommand({
|
|
126
|
+
name: 'login',
|
|
127
|
+
description: 'Store credentials for later managed commands',
|
|
128
|
+
input: z.object({ token: z.string() }),
|
|
129
|
+
output: z.object({ configured: z.boolean() }),
|
|
130
|
+
handler: async ({ input }) => {
|
|
131
|
+
await saveToken(input.token)
|
|
132
|
+
return { configured: true }
|
|
133
|
+
},
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
await createCli({
|
|
137
|
+
name: 'myapp',
|
|
138
|
+
version: '1.0.0',
|
|
139
|
+
commands: [login],
|
|
140
|
+
resolveAuth: loadStoredIdentity,
|
|
141
|
+
services: (identity) => createRemoteServices(identity),
|
|
142
|
+
})
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Native commands receive only typed `input`, parsed global `options` and the
|
|
146
|
+
configured stdout/stderr writers. They reuse help, argv/stdin parsing,
|
|
147
|
+
validation, dry-run, error envelopes and exit mapping, but deliberately have no
|
|
148
|
+
fake service/action/scope/method identity, lifecycle or tool hooks and never
|
|
149
|
+
appear in MCP/Agent manifests.
|
|
150
|
+
|
|
151
|
+
A native command with a declared output may also own its final terminal
|
|
152
|
+
presentation and successful process status. Both callbacks receive the exact
|
|
153
|
+
Zod output type and run only after output validation; help, dry-run and failed
|
|
154
|
+
validation never invoke them:
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
const doctor = defineCliCommand({
|
|
158
|
+
name: 'doctor',
|
|
159
|
+
description: 'Inspect local health',
|
|
160
|
+
input: z.object({}),
|
|
161
|
+
output: z.object({ status: z.enum(['ok', 'degraded']) }),
|
|
162
|
+
handler: () => ({ status: 'degraded' }),
|
|
163
|
+
present: ({ result, options }) =>
|
|
164
|
+
options.json ? `${JSON.stringify(result)}\n` : `STATUS ${result.status}\n`,
|
|
165
|
+
exitCode: (result) => result.status === 'degraded' ? 1 : 0,
|
|
166
|
+
})
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`present` returns the exact stdout bytes, which Stitchkit writes once. Without
|
|
170
|
+
it the canonical JSON output is unchanged. `exitCode` classifies a successfully
|
|
171
|
+
validated result and must return an integer in `0..255`; failed `ToolResult`
|
|
172
|
+
envelopes and the application-wide `exitCodes` mapping remain authoritative for
|
|
173
|
+
failures. A throwing callback, invalid status or non-string presenter becomes a
|
|
174
|
+
normalized `INTERNAL_SERVER_ERROR`, never partial success output. Void native
|
|
175
|
+
commands cannot declare either callback.
|
|
176
|
+
|
|
177
|
+
`--version`, a selected native command and its command help run before
|
|
178
|
+
`resolveAuth`, services, context or runtime-tool factories. Top-level help is
|
|
179
|
+
also credential-free when managed surfaces are static. A dynamic factory must
|
|
180
|
+
resolve identity to discover its command names; its collisions are checked at
|
|
181
|
+
that resolution boundary. If eager global collision proof matters, keep the
|
|
182
|
+
surface static.
|
|
183
|
+
|
|
184
|
+
## Calling commands
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
<app> <command> [positional] [--flags]
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Arguments are coerced to the contract schema's types — every argv token is a
|
|
191
|
+
string, the schema says what it should be:
|
|
192
|
+
|
|
193
|
+
| Zod field | CLI |
|
|
194
|
+
| -------------------- | ---------------------------------------------- |
|
|
195
|
+
| `z.string()` | `--name "box"` or a positional |
|
|
196
|
+
| `z.number()` | `--count 3` → `3` |
|
|
197
|
+
| `z.boolean()` | `--active` (presence) / `--no-active` |
|
|
198
|
+
| `z.enum([...])` | `--size large` |
|
|
199
|
+
| `z.array(z.string())`| `--tag a --tag b` → `["a","b"]` |
|
|
200
|
+
| `z.object({...})` | `--opts '{"k":"v"}'` (JSON) or `--opts.k v` |
|
|
201
|
+
| `.optional()` / `.default()` | not required |
|
|
202
|
+
|
|
203
|
+
Without presentation configuration, positional arguments fill non-boolean
|
|
204
|
+
fields in declaration order, so `myapp generate "a fox"` is
|
|
205
|
+
`--prompt "a fox"`. A piped value fills the first required unset field:
|
|
206
|
+
`echo "a fox" | myapp generate`.
|
|
207
|
+
|
|
208
|
+
A token is an option only when it is a long form (`--name`, `--name=value`,
|
|
209
|
+
`--`) or `-` followed by a letter. Anything else that starts with `-` is data:
|
|
210
|
+
`myapp note a "- item"` fills a positional, and after an option that expects a
|
|
211
|
+
value the next token is that value — `--grep -foo`, `--count -5`. The next
|
|
212
|
+
token is refused as a value only when it is itself an option, so `--grep --json`
|
|
213
|
+
still reports that `--grep` requires a value. A value that cannot be read as
|
|
214
|
+
its field's type is refused naming the flag and what was typed:
|
|
215
|
+
`--tail expects a whole number, got "abc"`.
|
|
216
|
+
|
|
217
|
+
For a stable shell grammar, declare the default command, short aliases and the
|
|
218
|
+
exact positional fields on `createCli`:
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
await createCli({
|
|
222
|
+
name: 'myapp',
|
|
223
|
+
version: '1.0.0',
|
|
224
|
+
services,
|
|
225
|
+
commands: [doctor],
|
|
226
|
+
defaultCommand: 'logs',
|
|
227
|
+
optionAliases: {
|
|
228
|
+
logs: { f: 'follow', n: 'lines' },
|
|
229
|
+
},
|
|
230
|
+
positionals: {
|
|
231
|
+
logs: ['target'], // `lines` is option-only
|
|
232
|
+
doctor: [], // no argv positionals
|
|
233
|
+
},
|
|
234
|
+
})
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Now `myapp`, `myapp --json` and `myapp logs --json` select `logs`;
|
|
238
|
+
`myapp -f -n 100 --target api` maps to
|
|
239
|
+
`logs --follow --lines 100 --target api`. A leading non-option token remains an
|
|
240
|
+
explicit command so typos stay loud rather than becoming ambiguous default
|
|
241
|
+
positionals; use an explicit `myapp logs api` when passing positionals. Leading
|
|
242
|
+
framework globals may precede that explicit command. Top-level `--help`, `-h`
|
|
243
|
+
and `--version` never execute the default, and top-level help marks it.
|
|
244
|
+
|
|
245
|
+
Aliases are command-local, one ASCII letter and validated against the resolved
|
|
246
|
+
command schema. `-f` / `-f=false` are boolean forms; values accept `-n 100` and
|
|
247
|
+
`-n=100`. Arrays accumulate across short and long forms. `-h` is reserved,
|
|
248
|
+
bundles such as `-fn`, attached values such as `-n100`, `--no-f` and unknown
|
|
249
|
+
short flags are rejected. Canonical `--no-follow` remains available.
|
|
250
|
+
|
|
251
|
+
### A trailing list
|
|
252
|
+
|
|
253
|
+
When the LAST declared positional is an array field, it takes every remaining
|
|
254
|
+
token, each coerced by the array's element type:
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
positionals: { handoff: ['to', 'files'] } // files: z.array(z.string())
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
myapp handoff proj a.md b.md → { to: 'proj', files: ['a.md', 'b.md'] }
|
|
262
|
+
myapp handoff proj a.md → { to: 'proj', files: ['a.md'] }
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
One token is a one-element list, not a scalar, so the parsed shape never depends
|
|
266
|
+
on how many a caller happened to pass. Command help marks it:
|
|
267
|
+
`Usage: myapp handoff <to> <files...>`. The flag form still works
|
|
268
|
+
(`--files '["a.md","b.md"]'`, or a repeated `--files`) — but passing both forms
|
|
269
|
+
in one call is an argument error rather than a silent merge.
|
|
270
|
+
|
|
271
|
+
Only the trailing position is variadic. An array declared anywhere else in the
|
|
272
|
+
list keeps taking exactly one token (a JSON array), and its help stays `<tags>`,
|
|
273
|
+
so the usage line always says which field is the list.
|
|
274
|
+
|
|
275
|
+
`positionals` replaces automatic schema-order selection only for the named
|
|
276
|
+
command. An empty array disables argv positionals. Fields remain available as
|
|
277
|
+
long/short options and stdin still fills the first required unset field with the
|
|
278
|
+
same schema-aware coercion. Unknown, duplicate or boolean targets and a required
|
|
279
|
+
positional after an optional/default positional fail when that command surface
|
|
280
|
+
resolves. Native dispatch retains its lazy credential-free boundary; dynamic
|
|
281
|
+
managed policies validate when their identity-dependent surface resolves.
|
|
282
|
+
|
|
283
|
+
The advertised schema is never mutated — a CLI call validates against the exact
|
|
284
|
+
same Zod schema an HTTP or MCP call does.
|
|
285
|
+
|
|
286
|
+
## Global flags
|
|
287
|
+
|
|
288
|
+
| Flag | Effect |
|
|
289
|
+
| --------------------- | ---------------------------------------------------------- |
|
|
290
|
+
| `--json` | Compact success/error JSON records for scripts |
|
|
291
|
+
| `--wait` | Block-poll an async result to a terminal state |
|
|
292
|
+
| `--wait-timeout <s>` | Override the `--wait` timeout |
|
|
293
|
+
| `--output-dir <dir>` | Download result media into a directory |
|
|
294
|
+
| `--quiet` | Suppress non-essential stderr output |
|
|
295
|
+
| `--dry-run` | Print the resolved call without executing |
|
|
296
|
+
| `--help`, `-h` | Usage — top-level or per-command flag table |
|
|
297
|
+
| `--help <text>` | List only the commands matching a substring |
|
|
298
|
+
| `--count-by <field>` | Count records per distinct value — see [Aggregate views](#aggregate-views) |
|
|
299
|
+
| `--sum <f> [--by <g>]`| Total a numeric field, optionally grouped |
|
|
300
|
+
| `--sort <field>` | Order records by a field, largest first |
|
|
301
|
+
| `--ascending` | Flip `--sort` to smallest first |
|
|
302
|
+
| `--top <n>` | Keep the n leading entries of the view asked for |
|
|
303
|
+
| `--table <a,b>` | Render named fields as an aligned table |
|
|
304
|
+
|
|
305
|
+
stdout carries the result; structured errors and progress go to stderr. With
|
|
306
|
+
`--json`, a success or structured failure is exactly one compact,
|
|
307
|
+
newline-terminated JSON record on its respective stream; progress and CLI usage
|
|
308
|
+
diagnostics remain ordinary stderr text. This keeps stdout pipeable and
|
|
309
|
+
`2>/dev/null` clean. The process exit code carries the error class (`0` ok,
|
|
310
|
+
`VALIDATION_ERROR → 1`, `UNAUTHORIZED → 2`, `FORBIDDEN → 3`, `NOT_FOUND → 4`,
|
|
311
|
+
…) — override per app with `exitCodes`.
|
|
312
|
+
|
|
313
|
+
### A narrower question than "all of them"
|
|
314
|
+
|
|
315
|
+
On a discovered surface `--help` is the only way to learn what exists, and that
|
|
316
|
+
can be two hundred commands. At that size the list stops being an answer: it
|
|
317
|
+
scrolls past a person and costs an agent the same context an unfiltered result
|
|
318
|
+
would. So there is a question between "one command" and "all of them":
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
myapp --help broadcast # also: -h broadcast · help broadcast · --help=broadcast
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
Commands matching "broadcast" (3 of 205):
|
|
326
|
+
broadcast_send Send a broadcast to every subscriber
|
|
327
|
+
broadcast_cancel Stop a running broadcast
|
|
328
|
+
announce_publish Publish an announcement as a broadcast
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
The description is searched as well as the name, because the word someone knows
|
|
332
|
+
is often in the sentence rather than the name — `announce_publish` above is
|
|
333
|
+
matched that way. The count says what was left out.
|
|
334
|
+
|
|
335
|
+
**No match is an exit code**, not an empty success: `0` over an empty list reads
|
|
336
|
+
as "there are none", which is a different statement from "none of these". It
|
|
337
|
+
exits with whatever `NOT_FOUND` maps to (`4` by default). Bare `--help` is
|
|
338
|
+
unchanged, and `--help=false` still means what it always did — the reserved
|
|
339
|
+
boolean's negation — so one value never carries two meanings.
|
|
340
|
+
|
|
341
|
+
## Application global options
|
|
342
|
+
|
|
343
|
+
`--json` and friends above are the framework's. An application usually has
|
|
344
|
+
globals of its own — which identity key to use, which checkout a call speaks
|
|
345
|
+
for, which profile — and they belong to no single operation:
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
await createCli({
|
|
349
|
+
name: 'myapp',
|
|
350
|
+
version: '1.0.0',
|
|
351
|
+
globalOptions: z.object({
|
|
352
|
+
caller: z.string().optional().describe('Identity key file'),
|
|
353
|
+
root: z.string().optional().describe('Checkout the call speaks for'),
|
|
354
|
+
}),
|
|
355
|
+
resolveAuth: (globals) => loadIdentity(globals.caller),
|
|
356
|
+
context: (auth, globals) => ({ auth, root: globals.root }),
|
|
357
|
+
runtimeTools: (auth) => catalogFor(auth),
|
|
358
|
+
})
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
myapp --root /srv/app handoff_read --handoffId u
|
|
363
|
+
myapp handoff_read --root /srv/app --handoffId u # the same call
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
These flags are lifted out of argv wherever they stand — before or after the
|
|
367
|
+
command name — validated against the declared schema, and kept out of every
|
|
368
|
+
operation's arguments: `handoff_read` above receives `{ handoffId: 'u' }` and
|
|
369
|
+
nothing else. The values reach `resolveAuth(globals)`, `context(auth, globals)`
|
|
370
|
+
and a native command's `globals`. An invalid value is an argument error naming
|
|
371
|
+
the flag; a name that collides with a framework option, or with a field of any
|
|
372
|
+
command, is refused at startup rather than shadowing it silently. Past a bare
|
|
373
|
+
`--` every token is a literal, so a positional value that reads like a global
|
|
374
|
+
survives intact.
|
|
375
|
+
|
|
376
|
+
Both help levels list them under `Application options:`.
|
|
377
|
+
|
|
378
|
+
## When the managed surface cannot resolve
|
|
379
|
+
|
|
380
|
+
A CLI whose commands come from a running server declares them with a factory,
|
|
381
|
+
and that factory needs an identity. When `resolveAuth` fails — the server is
|
|
382
|
+
down, the key file is missing — the commands it would have named are unknown to
|
|
383
|
+
the CLI, but the native ones are not:
|
|
384
|
+
|
|
385
|
+
```
|
|
386
|
+
$ myapp --help
|
|
387
|
+
myapp 1.0.0
|
|
388
|
+
...
|
|
389
|
+
Commands:
|
|
390
|
+
serve Run the server
|
|
391
|
+
|
|
392
|
+
Managed commands are unavailable: UNREACHABLE: socket closed
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Help still lists what does not depend on identity and says, in one line, why the
|
|
396
|
+
rest is missing. Calling a name the CLI cannot resolve answers with that same
|
|
397
|
+
refusal and the exit code its error class declares through `exitCodes` — never
|
|
398
|
+
`Unknown command`, which would claim the name does not exist when the truth is
|
|
399
|
+
that it could not be looked up. A native command and its help still run: they
|
|
400
|
+
never needed an identity. Identity is still resolved at most once per
|
|
401
|
+
invocation, failure included.
|
|
402
|
+
|
|
403
|
+
Per-command help derives the positional form from the same resolved policy as
|
|
404
|
+
the argv parser. For example, a required `action` and optional `profile` render as
|
|
405
|
+
`Usage: myapp skill <action> [profile] [--flags]`; the argument table also shows
|
|
406
|
+
`<action> | --action` and `[profile] | --profile`. Boolean fields remain flags.
|
|
407
|
+
Declared aliases render beside their canonical options, for example
|
|
408
|
+
`-n, --lines`.
|
|
409
|
+
|
|
410
|
+
## `--wait` — background-friendly generation
|
|
411
|
+
|
|
412
|
+
`--wait` polls an async result until it is done. It is generic — the core knows
|
|
413
|
+
nothing about "generations": you say how to read the poll target, which command
|
|
414
|
+
to re-call and when it is done.
|
|
415
|
+
|
|
416
|
+
```ts
|
|
417
|
+
await createCli({
|
|
418
|
+
name: 'myapp',
|
|
419
|
+
version: '1.0.0',
|
|
420
|
+
services,
|
|
421
|
+
wait: {
|
|
422
|
+
generate: {
|
|
423
|
+
tool: 'get_generation',
|
|
424
|
+
poll: (r) => (isRecord(r) && typeof r.id === 'string' ? { id: r.id } : null),
|
|
425
|
+
done: (r) => isRecord(r) && ['COMPLETED', 'FAILED'].includes(String(r.status)),
|
|
426
|
+
failed: (r) => isRecord(r) && r.status === 'FAILED',
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
})
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
`failed` is optional. When it matches either the initial result or a later poll,
|
|
433
|
+
polling stops and the CLI emits `WAIT_FAILED` on stderr with a non-zero exit;
|
|
434
|
+
the terminal payload is retained under `details.result`. `failed` is checked
|
|
435
|
+
before `done`, so overlapping predicates fail closed. A failed poll tool call
|
|
436
|
+
keeps its own error code, and an elapsed deadline remains `TIMEOUT`.
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
# foreground
|
|
440
|
+
myapp generate "a fox" --wait --output-dir ./out
|
|
441
|
+
|
|
442
|
+
# background — frees the agent; a notification fires on exit
|
|
443
|
+
myapp generate "a fox" --wait --json > result.json &
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
## Aggregate views
|
|
447
|
+
|
|
448
|
+
The CLI's audience is agents, scripts and `jq`, so output is JSON. That settles
|
|
449
|
+
the *encoding*; it does not settle whether the answer to "how many items per
|
|
450
|
+
status" should be every item. Measured on a live server, one ordinary question:
|
|
451
|
+
|
|
452
|
+
| call | characters returned |
|
|
453
|
+
|---|---|
|
|
454
|
+
| the listing (98 records) | 34 750 |
|
|
455
|
+
| `--count-by status` | ~90 |
|
|
456
|
+
|
|
457
|
+
An agent pays for every one of those characters in its context window, and `|
|
|
458
|
+
jq` does not help: the bytes have been read into the conversation by the time
|
|
459
|
+
`jq` sees them. So the aggregate is computed on the result, before anything is
|
|
460
|
+
written.
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
myapp item_list --count-by status # { "active": 33, "idle": 33, "stopped": 32 }
|
|
464
|
+
myapp item_list --count-by status --top 2 # the two largest groups
|
|
465
|
+
myapp item_list --sum messages # 4753
|
|
466
|
+
myapp item_list --sum messages --by status # one total per status
|
|
467
|
+
myapp item_list --top 5 --by status # same view, written the other way round
|
|
468
|
+
myapp item_list --table id,status # the one human-facing shape
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Two words, one each: **`--by` groups, `--sort` orders.** That leaves `--top` a
|
|
472
|
+
single meaning everywhere — *the n leading entries of the view you asked for* —
|
|
473
|
+
so the question a CLI actually gets asked composes out of the parts:
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
myapp item_list --top 5 --sort messages --table id,messages # the five biggest, as a table
|
|
477
|
+
myapp item_list --sort messages --top 5 --json # the same five, as records
|
|
478
|
+
myapp item_list --sort name --ascending # ordered the other way
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Groups come back largest first for the same reason. A record that carries no
|
|
482
|
+
value for the sort field sorts **last in both directions**: it is not the
|
|
483
|
+
smallest, it is not on the scale at all, and letting it lead an ascending list
|
|
484
|
+
would answer a question nobody asked.
|
|
485
|
+
|
|
486
|
+
Three rules worth knowing before you rely on them:
|
|
487
|
+
|
|
488
|
+
- **A field the result does not carry is an argument error.** A group of zero
|
|
489
|
+
over a misspelled field is indistinguishable from a true empty answer, and the
|
|
490
|
+
caller reads it as data. The message names the fields that *are* there.
|
|
491
|
+
- **An aggregate needs a collection** — the result itself when it is an array,
|
|
492
|
+
or the single array field of a result object. An aggregate over a scalar, or
|
|
493
|
+
over an object with two array fields, is refused rather than guessed.
|
|
494
|
+
- **Without a view flag the output is byte-for-byte what it was.** The flags are
|
|
495
|
+
reserved CLI behaviour like `--json`; they never reach a tool argument.
|
|
496
|
+
- **Ordering and grouping do not mix.** `--sort` with `--by`, `--count-by` or
|
|
497
|
+
`--sum` is refused rather than given a second meaning.
|
|
498
|
+
|
|
499
|
+
A failed call still reports its own error and exit code. An aggregate over an
|
|
500
|
+
error is not an answer to the question that was asked.
|
|
501
|
+
|
|
502
|
+
## Named profiles
|
|
503
|
+
|
|
504
|
+
A CLI that talks to a deployed server needs an address and a credential per
|
|
505
|
+
environment, and the way a person picks one is a name: `--profile prod`.
|
|
506
|
+
`globalOptions` gives the flag a home and `resolveAuth(globals)` gives it a
|
|
507
|
+
resolution point. The rule that makes the mechanism safe is easy to write the
|
|
508
|
+
wrong way round, because the unsafe version reads as kindness:
|
|
509
|
+
|
|
510
|
+
> the named profile does not exist, but exactly one profile is configured — use it.
|
|
511
|
+
|
|
512
|
+
That is correct exactly while a single profile exists. The day a second appears
|
|
513
|
+
it is a command run against the wrong deployment, with nothing in the output to
|
|
514
|
+
say so. **A profile named explicitly and not found is a refusal, never a
|
|
515
|
+
substitution.** Substitution survives only where it cannot be wrong: no name was
|
|
516
|
+
given at all and exactly one profile exists — and even then it is announced on
|
|
517
|
+
stderr. The distinction has to be drawn at resolution; one step later, "prod" and
|
|
518
|
+
"prod by default" are the same string.
|
|
519
|
+
|
|
520
|
+
`createCliProfileStore` is that rule, plus the twenty lines every consumer of
|
|
521
|
+
this shape writes:
|
|
522
|
+
|
|
523
|
+
```ts
|
|
524
|
+
import { createCliProfileStore } from 'stitchkit/cli'
|
|
525
|
+
import { homedir } from 'node:os'
|
|
526
|
+
import { join } from 'node:path'
|
|
527
|
+
import { z } from 'zod'
|
|
528
|
+
|
|
529
|
+
const profiles = createCliProfileStore({
|
|
530
|
+
directory: join(homedir(), '.config/myapp/profiles'),
|
|
531
|
+
schema: z.object({ url: z.url(), token: z.string().min(1) }),
|
|
532
|
+
createHint: (name, path) => `write ${path} with {"url","token"} for "${name}"`,
|
|
533
|
+
})
|
|
534
|
+
|
|
535
|
+
await createCli({
|
|
536
|
+
name: 'myapp',
|
|
537
|
+
version,
|
|
538
|
+
globalOptions: z.object({ profile: z.string().optional() }),
|
|
539
|
+
resolveAuth: (globals) => profiles.resolve(globals.profile).value,
|
|
540
|
+
services,
|
|
541
|
+
})
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
Files are written `0600` in a `0700` directory — and a profile file other users
|
|
545
|
+
can read is refused with the `chmod` that fixes it, because it holds a
|
|
546
|
+
credential.
|
|
547
|
+
|
|
548
|
+
## Distribution and self-update
|
|
549
|
+
|
|
550
|
+
`createCli` ships no executable, and that is right — but the step after the
|
|
551
|
+
executable is not application logic either. It is the same problem for every
|
|
552
|
+
consumer, with the same three traps:
|
|
553
|
+
|
|
554
|
+
1. **The installer cannot parse the manifest.** A `curl … | sh` runs on a
|
|
555
|
+
machine where nothing is installed yet, including `jq`. So the installer is
|
|
556
|
+
generated *from* the manifest, server-side, with the URL and digest already
|
|
557
|
+
substituted — it parses no JSON at all.
|
|
558
|
+
2. **Replacing a running binary is a rename, not a write.** Anything else can
|
|
559
|
+
leave a half-written executable on someone's PATH when the connection drops.
|
|
560
|
+
3. **The digest covers the decompressed bytes** — the file that will actually be
|
|
561
|
+
executed, not the archive that was transferred.
|
|
562
|
+
|
|
563
|
+
The framework owns the manifest shape, the installer generation and the update
|
|
564
|
+
primitive. The application owns where the assets live, which platforms it
|
|
565
|
+
publishes and who may download them.
|
|
566
|
+
|
|
567
|
+
```ts
|
|
568
|
+
import {
|
|
569
|
+
CliBuildManifestSchema, assertCliPublishable, renderCliInstaller,
|
|
570
|
+
selectCliBuildAsset, checkCliUpdate, applyCliUpdate,
|
|
571
|
+
} from 'stitchkit/cli'
|
|
572
|
+
|
|
573
|
+
// Publishing: refuse to republish one version from a different commit —
|
|
574
|
+
// otherwise everyone who already installed it never receives the fix.
|
|
575
|
+
assertCliPublishable(previous, next)
|
|
576
|
+
|
|
577
|
+
// Serving: omit `asset` and one script covers every published target, selecting
|
|
578
|
+
// by uname at run time — otherwise that dispatch is the last hand-written piece
|
|
579
|
+
// of the install path, and every publisher writes the same x86_64 → x64 table.
|
|
580
|
+
renderCliInstaller({ manifest, binaryName: 'myapp' })
|
|
581
|
+
// Or pin one target explicitly:
|
|
582
|
+
renderCliInstaller({ manifest, asset: selectCliBuildAsset(manifest, target), binaryName: 'myapp' })
|
|
583
|
+
|
|
584
|
+
// Checking: bounded, at most once per interval, silent on any failure.
|
|
585
|
+
const check = await checkCliUpdate({ manifestUrl, currentVersion, lastCheckedAt })
|
|
586
|
+
if (check.status === 'outdated' && check.asset) {
|
|
587
|
+
// Replacing is always an explicit command, never a side effect of a check.
|
|
588
|
+
await applyCliUpdate({ asset: check.asset })
|
|
589
|
+
}
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
`checkCliUpdate` has **four** answers, not three: `skipped`, `current`,
|
|
593
|
+
`outdated` and `unknown`. "Could not ask" is not "up to date" — collapsing them
|
|
594
|
+
is how a tool goes quiet about its own staleness for months. It never throws,
|
|
595
|
+
and a command still exits with the code it earned.
|
|
596
|
+
|
|
597
|
+
Carry the build stamp inside the binary (`CliBuildStampSchema`,
|
|
598
|
+
`formatCliBuildStamp`) so the tool can say what it is rather than leaving the
|
|
599
|
+
reader to infer it from behaviour.
|
|
600
|
+
|
|
601
|
+
#### A manifest inside your own network
|
|
602
|
+
|
|
603
|
+
The check goes through the same SSRF boundary every outbound fetch does, so a
|
|
604
|
+
manifest served from `10.x`, `localhost` or a `.internal` name is refused and
|
|
605
|
+
the answer is `unknown`. For a self-hosted deployment that is a wrong answer
|
|
606
|
+
dressed as a careful one, and the refusal says so — it names the field that
|
|
607
|
+
lifts it rather than reading like a timeout:
|
|
608
|
+
|
|
609
|
+
```text
|
|
610
|
+
refusing to fetch an internal host — the manifest endpoint is not public.
|
|
611
|
+
Set `allowPrivateHosts` if it is your own deployment; the download keeps its
|
|
612
|
+
own setting, because an asset URL comes from the document.
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
```ts
|
|
616
|
+
const check = await checkCliUpdate({ manifestUrl, currentVersion, allowPrivateHosts: true })
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
Set it from whether **your** endpoint is private, not as a blanket switch, and
|
|
620
|
+
leave `applyCliUpdate` at its default. The two are not the same decision: the
|
|
621
|
+
manifest URL is configuration you wrote, while an asset URL arrives inside a
|
|
622
|
+
document the endpoint served, and a document is exactly what an SSRF boundary
|
|
623
|
+
exists to distrust.
|
|
624
|
+
|
|
625
|
+
### Proving who built it — signing the manifest
|
|
626
|
+
|
|
627
|
+
The asset digest proves the bytes that arrived are the bytes the manifest named.
|
|
628
|
+
It proves nothing about who named them: the manifest and the assets come from
|
|
629
|
+
one origin, so whoever can replace one can replace the other. Authorship needs a
|
|
630
|
+
key the build carries and the server never holds.
|
|
631
|
+
|
|
632
|
+
```ts
|
|
633
|
+
// Publishing — the only side that holds a private key.
|
|
634
|
+
const signature = signCliManifest(manifest, { keyId: 'release-2026', privateKey })
|
|
635
|
+
publish({ ...manifest, signature })
|
|
636
|
+
|
|
637
|
+
// Installing — the trust root is compiled into the binary. One fetched at run
|
|
638
|
+
// time from the same origin as the manifest would prove nothing.
|
|
639
|
+
const trust = { keys: { 'release-2026': PUBLISHED_KEY } }
|
|
640
|
+
const check = await checkCliUpdate({ manifestUrl, currentVersion, trust })
|
|
641
|
+
if (check.status === 'outdated' && check.asset) {
|
|
642
|
+
await applyCliUpdate({ asset: check.asset, manifest: check.manifest, trust, backupPath })
|
|
643
|
+
}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
The signature covers `{name, version, commit, builtAt, assets[]}` with **every
|
|
647
|
+
asset's digest**, so the chain closes on the file that will execute rather than
|
|
648
|
+
on the document describing it; moving an asset to a new URL does not invalidate
|
|
649
|
+
it, changing what an asset contains does.
|
|
650
|
+
|
|
651
|
+
Five verdicts, and `unenforced` is the one that earns its keep: a build with no
|
|
652
|
+
pinned key keeps updating, and the fact that nothing was checked is *visible*
|
|
653
|
+
rather than assumed. `missing`, `unknown-key` and `invalid` are distinguished
|
|
654
|
+
because they need different answers — a key you forgot to pin is not a forged
|
|
655
|
+
signature.
|
|
656
|
+
|
|
657
|
+
A bad verdict does not produce a fifth status. `outdated` is an instruction to
|
|
658
|
+
install, and a manifest that failed its signature has not established that there
|
|
659
|
+
is a newer build worth installing — only that a document claims one. The check
|
|
660
|
+
answers `unknown` with the verdict in its reason, so it is never mistaken for a
|
|
661
|
+
network failure. `applyCliUpdate` checks again and refuses **before** the
|
|
662
|
+
download: a signature verified after the bytes are on the machine produces a
|
|
663
|
+
cleanup problem rather than a refusal.
|
|
664
|
+
|
|
665
|
+
### A way back — `backupPath` and `rollbackCliUpdate`
|
|
666
|
+
|
|
667
|
+
Rolling back is a property of updating, not of the application:
|
|
668
|
+
|
|
669
|
+
```ts
|
|
670
|
+
const applied = await applyCliUpdate({ asset, targetPath, backupPath })
|
|
671
|
+
// …the new build turns out to be wrong. `backupSha256` is absent when there was
|
|
672
|
+
// nothing to keep — a first install — and that is the case with nothing to roll
|
|
673
|
+
// back to:
|
|
674
|
+
if (applied.backupSha256) {
|
|
675
|
+
rollbackCliUpdate({ targetPath, backupPath, expectedSha256: applied.backupSha256 })
|
|
676
|
+
}
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
The copy is taken between "the new bytes verified" and the replacement — earlier
|
|
680
|
+
would preserve a binary about to be replaced by a download that then failed its
|
|
681
|
+
digest, later has nothing left to copy — and it carries the target's file mode,
|
|
682
|
+
because a backup that cannot be executed is not a way back. A first install has
|
|
683
|
+
nothing to keep, which is not a failure.
|
|
684
|
+
|
|
685
|
+
`expectedSha256` is required, not optional. A rollback that installs whatever
|
|
686
|
+
happens to be at the backup path is a second install of an unverified binary,
|
|
687
|
+
and the day it is used is the day nobody is in a position to check.
|
|
688
|
+
|
|
689
|
+
### Run it before it replaces anything — `verify`
|
|
690
|
+
|
|
691
|
+
A digest proves the bytes are the ones published, not that they load. A tool
|
|
692
|
+
that updates itself unattended — a daemon — and installs a build that does not
|
|
693
|
+
start takes its own updater down with it, and every machine is then repaired by
|
|
694
|
+
hand. `verify` is the step between "digest matched" and "target replaced":
|
|
695
|
+
|
|
696
|
+
```ts
|
|
697
|
+
await applyCliUpdate({
|
|
698
|
+
asset, targetPath, backupPath,
|
|
699
|
+
verify: async (candidate, signal) => {
|
|
700
|
+
const child = Bun.spawn(['bun', candidate, 'version'], { signal, stdout: 'pipe' })
|
|
701
|
+
const printed = (await new Response(child.stdout).text()).trim()
|
|
702
|
+
if ((await child.exited) !== 0 || printed !== check.version) {
|
|
703
|
+
throw new Error(`printed ${printed}, expected ${check.version}`)
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
verifyTimeoutMs: 15_000, // default 30 000
|
|
707
|
+
})
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
The verified bytes are written beside the target as an executable candidate
|
|
711
|
+
with the target's extension, and `verify` gets its path — a path rather than a
|
|
712
|
+
command, because a JavaScript bundle is started through its runtime. It runs
|
|
713
|
+
before the backup and the replacement. If it throws or outlives
|
|
714
|
+
`verifyTimeoutMs` (its `signal` aborts at the deadline), the candidate is
|
|
715
|
+
removed, the target and any earlier backup are untouched, and the update is
|
|
716
|
+
refused with the reason as its cause. The target is written from the checked
|
|
717
|
+
bytes in memory, never from the candidate file, so nothing the candidate did
|
|
718
|
+
while it ran can change what is installed.
|
|
719
|
+
|
|
720
|
+
### Two release tracks
|
|
721
|
+
|
|
722
|
+
`assertCliPublishable` takes one manifest **or every manifest already
|
|
723
|
+
published**:
|
|
724
|
+
|
|
725
|
+
```ts
|
|
726
|
+
assertCliPublishable([stableManifest, betaManifest], next)
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
With a single argument and two tracks the check is silently useless: `1.2.3`
|
|
730
|
+
goes to beta from one commit and to stable from another, the function is called
|
|
731
|
+
with the track being published and sees no conflict, and the person who
|
|
732
|
+
installed the beta is told they are current forever. Nothing on their machine
|
|
733
|
+
looks wrong.
|
|
734
|
+
|
|
735
|
+
**The channel itself is not an argument of the framework, and will not become
|
|
736
|
+
one.** The framework has no model of how your URLs are built and should not: an
|
|
737
|
+
asset's address comes from the manifest, and the manifest's address belongs to
|
|
738
|
+
your server. A channel is two documents at two addresses — which of them a build
|
|
739
|
+
consults is your decision, and `assertCliPublishable` is told about all of them
|
|
740
|
+
rather than taught the shape of any.
|
|
741
|
+
|
|
742
|
+
## One operation per line — `createCliInvoker`
|
|
743
|
+
|
|
744
|
+
The most common way an agent drives a CLI is not one command: it is a stream —
|
|
745
|
+
a JSON line per operation, an answer per line — and a resumable batch of the
|
|
746
|
+
same. The mechanics contain nothing product-specific, and until now the
|
|
747
|
+
framework left the one piece that cannot be written outside it: running an
|
|
748
|
+
already-parsed call.
|
|
749
|
+
|
|
750
|
+
```ts
|
|
751
|
+
import { createCliInvoker, defineCliStreamCommand, defineCliBatchCommand } from 'stitchkit/cli'
|
|
752
|
+
|
|
753
|
+
const invoker = await createCliInvoker({ name: 'myapp', services })
|
|
754
|
+
|
|
755
|
+
const outcome = await invoker.invoke('create_item', { title: 'hello', tags: ['a'] })
|
|
756
|
+
// { ok: true, exitCode: 0, data: { … } } — nothing written, nothing exited
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
`invoke` runs the same pipeline a typed command runs — the same validation, the
|
|
760
|
+
same `lifecycle` gate, the same hooks — and returns the handler's validated
|
|
761
|
+
output with **the exit code the printed path would give**, from the same table.
|
|
762
|
+
`data` is typed `unknown`: the surface is resolved at run time from services and
|
|
763
|
+
runtime tools, so there is no compile-time name to key a result type on. Narrow
|
|
764
|
+
it with the contract's own output schema. That table used to
|
|
765
|
+
live inside the function that prints, so the only way to learn a code was to
|
|
766
|
+
print it.
|
|
767
|
+
|
|
768
|
+
Without this, a stream loop had to re-spawn the binary per line: arguments
|
|
769
|
+
serialised back into `--flag value` strings, nested objects pushed through
|
|
770
|
+
`JSON.stringify` into one argv slot and parsed again on the other side, the
|
|
771
|
+
result read back out of stdout text. Three conversions of data the framework was
|
|
772
|
+
already holding, plus a process start measured at 0.15 s — thirty seconds for a
|
|
773
|
+
two-hundred-line manifest before any work begins. The ban on nesting one stream
|
|
774
|
+
inside another was a consequence of that child process, not a rule anyone wanted.
|
|
775
|
+
|
|
776
|
+
### Native commands in the stream
|
|
777
|
+
|
|
778
|
+
A native command is in the invoker's surface when — and only when — it declares
|
|
779
|
+
`output`:
|
|
780
|
+
|
|
781
|
+
```ts
|
|
782
|
+
const describe = defineCliCommand({
|
|
783
|
+
name: 'describe', description: 'Describe the catalogue',
|
|
784
|
+
input: z.object({ model: z.string() }),
|
|
785
|
+
output: z.object({ model: z.string(), ratios: z.array(z.string()) }),
|
|
786
|
+
handler: ({ input }) => ({ model: input.model, ratios: ['1:1', '16:9'] }),
|
|
787
|
+
})
|
|
788
|
+
|
|
789
|
+
await createCliInvoker({ name: 'myapp', services, commands: [describe] })
|
|
790
|
+
// invoke('describe', { model: 'flux' }) → { ok: true, exitCode: 0, data: { … } }
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
A command that declares `output?: never` prints itself and returns nothing, so
|
|
794
|
+
there is no result to hand back; it answers `NOT_FOUND` and stays on the command
|
|
795
|
+
line, where stdout exists. Your stream command is one of these, which is why a
|
|
796
|
+
stream still cannot invoke itself.
|
|
797
|
+
|
|
798
|
+
On this path `present` is not called — it is stdout formatting, and there is no
|
|
799
|
+
stdout — while `exitCode` is applied through the same function the command line
|
|
800
|
+
uses, so a script branching on the code sees one answer from both. Anything the
|
|
801
|
+
handler writes comes back as `written` rather than interleaving with your own
|
|
802
|
+
output:
|
|
803
|
+
|
|
804
|
+
```ts
|
|
805
|
+
const outcome = await invoker.invoke('describe', { model: 'flux' })
|
|
806
|
+
outcome.written // { stderr: 'warming the cache\n' } — absent when nothing was written
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
### Mounting the loop
|
|
810
|
+
|
|
811
|
+
```ts
|
|
812
|
+
await createCli({
|
|
813
|
+
name: 'myapp', version, services,
|
|
814
|
+
commands: [
|
|
815
|
+
defineCliStreamCommand({ name: 'jsonl', invoker }),
|
|
816
|
+
defineCliBatchCommand({ name: 'batch', invoker, checkpointPath: '.myapp-batch.json' }),
|
|
817
|
+
],
|
|
818
|
+
})
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
They are factories, not framework-owned names. Reserving `jsonl` and `batch`
|
|
822
|
+
would take two names out of a namespace that belongs to the application — one
|
|
823
|
+
that already has a `batch` command would either fail at startup or find its own
|
|
824
|
+
command silently shadowed — so you mount them under whatever you call them, like
|
|
825
|
+
any other command of yours.
|
|
826
|
+
|
|
827
|
+
Each line is `{ id, command, args }`; each answer is the invocation result plus
|
|
828
|
+
that `id`. A line that is not JSON, or has no `id`, is **answered** and the
|
|
829
|
+
stream continues: a stream that goes quiet on one line leaves its consumer
|
|
830
|
+
unable to tell which request it lost. Answers go to stdout, one object per line,
|
|
831
|
+
and nothing else does.
|
|
832
|
+
|
|
833
|
+
### Resuming a batch
|
|
834
|
+
|
|
835
|
+
The checkpoint records, per id, a digest of the line that produced the recorded
|
|
836
|
+
answer, and is written after **every** line by atomic rename — a checkpoint that
|
|
837
|
+
only survives a clean finish protects against exactly the case that does not
|
|
838
|
+
happen.
|
|
839
|
+
|
|
840
|
+
A re-run replays what already ran. A line whose content changed under the same
|
|
841
|
+
id is **refused**: replaying it would report success for an operation nobody
|
|
842
|
+
ran, and re-running it would repeat a paid call. Both answer a question nobody
|
|
843
|
+
asked.
|
|
844
|
+
|
|
845
|
+
What stays yours: what makes a repeat safe (an idempotency key derived from the
|
|
846
|
+
line id), which operations a batch may contain, and how much of it runs at once.
|
|
847
|
+
That is product knowledge, and the framework has no business guessing it.
|
|
848
|
+
|
|
849
|
+
## Commands discovered from a running server
|
|
850
|
+
|
|
851
|
+
A CLI compiled from contracts carries the surface of the build it was compiled
|
|
852
|
+
from. One built from discovery carries the surface the server has *right now* —
|
|
853
|
+
which matters, because a long-lived MCP client freezes schemas at connect time
|
|
854
|
+
and then refuses the server's own newer fields:
|
|
855
|
+
|
|
856
|
+
```ts
|
|
857
|
+
const discovered = await mountConnections([
|
|
858
|
+
defineMcpClientConnection({
|
|
859
|
+
name: 'api',
|
|
860
|
+
transport: { url },
|
|
861
|
+
token: () => key,
|
|
862
|
+
transports: ['CLI'], // the opt-in: this server's tools are commands
|
|
863
|
+
}),
|
|
864
|
+
])
|
|
865
|
+
await createCli({ name: 'myapp', version, runtimeTools: discovered, commands: [...] })
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
`transports` is where the opt-in belongs: a whole server becomes a set of
|
|
869
|
+
commands, and a connection without it still contributes nothing to the CLI —
|
|
870
|
+
exposure stays explicit, as it is everywhere else in the framework.
|
|
871
|
+
|
|
872
|
+
One unconvertible schema no longer takes the connection down with it. The tool
|
|
873
|
+
is skipped and **named** (`onSkippedTool`, or a stderr line by default), so a
|
|
874
|
+
surface of two hundred tools is not lost to one.
|
|
875
|
+
|
|
876
|
+
**A remote refusal keeps its code.** A failed `tools/call` used to become a
|
|
877
|
+
one-sentence `Error` with the result discarded, which cost three things at once:
|
|
878
|
+
the code (so `exitCodes` had nothing to map and every remote failure exited `1`),
|
|
879
|
+
the message the operator needed, and the error's own class — a plain `Error` is
|
|
880
|
+
an *unexpected* error to the runner, so it printed a code frame of the framework
|
|
881
|
+
bundle before the JSON failure and was then scrubbed to `INTERNAL_SERVER_ERROR`.
|
|
882
|
+
A structured `{ error, details }` body is now relayed as the contract error it
|
|
883
|
+
is, on every transport; anything else fails as `UPSTREAM_TOOL_ERROR` carrying
|
|
884
|
+
what the server did send. Not `INTERNAL_SERVER_ERROR`, because nothing of ours
|
|
885
|
+
broke.
|
|
886
|
+
|
|
887
|
+
**On the CLI a discovered command prints the answer, not the envelope.**
|
|
888
|
+
`tools/call` returns `{ content: [...], structuredContent? }`, and an agent mount
|
|
889
|
+
needs exactly that — the parts are what a model is shown. The CLI is different in
|
|
890
|
+
kind, because the handler's value is what gets printed, piped and aggregated:
|
|
891
|
+
handed the envelope, `--count-by status` groups the *content parts* and answers
|
|
892
|
+
`no record carries the field "status" — available: text, type`. So the CLI
|
|
893
|
+
transport unwraps, and only it: `structuredContent` when the server sent one, a
|
|
894
|
+
lone text part when it parses as JSON, its text when it does not. Several parts,
|
|
895
|
+
an image or audio pass through whole — picking one of many would be inventing an
|
|
896
|
+
answer.
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
## Auth parity
|
|
900
|
+
|
|
901
|
+
A scoped command is guarded by the same `createAuthHook` your HTTP server uses —
|
|
902
|
+
pass it as `lifecycle`, and inject the identity through `context` so
|
|
903
|
+
`resolveFromContext` can read it:
|
|
904
|
+
|
|
905
|
+
```ts
|
|
906
|
+
const authHook = createAuthHook({ /* resolve, resolveFromContext, rules */ })
|
|
907
|
+
|
|
908
|
+
await createCli({
|
|
909
|
+
name: 'myapp',
|
|
910
|
+
version: '1.0.0',
|
|
911
|
+
resolveAuth: () => resolveIdentityFromToken(process.env.MYAPP_TOKEN),
|
|
912
|
+
context: (identity) => ({ user: identity }), // resolveFromContext reads this
|
|
913
|
+
lifecycle: { beforeHandle: authHook }, // same policy; HTTP wires it as authorize
|
|
914
|
+
services,
|
|
915
|
+
})
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
Without `lifecycle`, a scoped command runs **unguarded** — the scope check lives
|
|
919
|
+
entirely inside the `createAuthHook` result, so with no hook wired in there is
|
|
920
|
+
nothing to enforce a method's `scope`. This matches the MCP / agent surfaces
|
|
921
|
+
exactly ([ADR 0014](../decisions/0014-tool-http-parity.md)): on every tool
|
|
922
|
+
transport the auth gate is opt-in, so a contract with scoped methods **must** be
|
|
923
|
+
given a `lifecycle` (and `context` identity) to be protected. The gate only
|
|
924
|
+
*fails closed* once the hook **is** present but `resolveFromContext` is missing —
|
|
925
|
+
then a scoped call has no identity and is rejected.
|
|
926
|
+
|
|
927
|
+
## Typed context
|
|
928
|
+
|
|
929
|
+
Use `createToolkit<AppContext>()` to type the injected `context` against your
|
|
930
|
+
app's context shape — the tool-side mirror of `createImplement`
|
|
931
|
+
([ADR 0017](../decisions/0017-typed-tool-context.md)):
|
|
932
|
+
|
|
933
|
+
```ts
|
|
934
|
+
const tools = createToolkit<{ user: User }>()
|
|
935
|
+
await tools.createCli({
|
|
936
|
+
name: 'myapp',
|
|
937
|
+
version: '1.0.0',
|
|
938
|
+
services,
|
|
939
|
+
context: (identity) => ({ user: identity }), // checked against { user: User }
|
|
940
|
+
})
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
## Remaining boundary
|
|
944
|
+
|
|
945
|
+
File-upload (`multipart`) contract endpoints remain CLI-invisible, the same as
|
|
946
|
+
on MCP/Agent: their wire body is not a JSON tool form. Model file-oriented
|
|
947
|
+
application behavior as a managed pathless command, or binary-only behavior as
|
|
948
|
+
a native command. Streaming (SSE) output is not yet piped to stdout.
|