stitchkit 0.104.1 → 0.105.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +381 -12
- package/darwin-native.cjs +4 -2
- package/dist/agent-runtime/browser-control-contract.d.ts +32 -2
- package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -1
- package/dist/agent-runtime/browser-controller.d.ts +21 -3
- package/dist/agent-runtime/browser-controller.d.ts.map +1 -1
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-refusals.d.ts +1 -0
- package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/compaction.d.ts.map +1 -1
- package/dist/agent-runtime/contained-write.d.ts.map +1 -1
- package/dist/agent-runtime/control-schema.d.ts +48 -1
- package/dist/agent-runtime/control-schema.d.ts.map +1 -1
- package/dist/agent-runtime/deferred-tool-search.d.ts +3 -2
- package/dist/agent-runtime/deferred-tool-search.d.ts.map +1 -1
- package/dist/agent-runtime/harness-control.d.ts.map +1 -1
- package/dist/agent-runtime/harness-realtime.d.ts +34 -4
- package/dist/agent-runtime/harness-realtime.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-state.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-owner.d.ts +9 -1
- package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox.d.ts +32 -1
- package/dist/agent-runtime/sandbox.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-records.d.ts.map +1 -1
- package/dist/agent-runtime/schedules.d.ts.map +1 -1
- package/dist/agent-runtime/store-events.d.ts +9 -4
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/testing.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-contract.d.ts +50 -0
- package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-generations.d.ts +24 -0
- package/dist/application/diagnostic-journal-generations.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-open.d.ts +10 -0
- package/dist/application/diagnostic-journal-open.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-quarantine.d.ts +28 -0
- package/dist/application/diagnostic-journal-quarantine.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-read-contract.d.ts +73 -3
- package/dist/application/diagnostic-journal-read-contract.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-reader.d.ts +17 -2
- package/dist/application/diagnostic-journal-reader.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-recovery.d.ts +18 -2
- package/dist/application/diagnostic-journal-recovery.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-storage.d.ts +6 -2
- package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-tail.d.ts +12 -0
- package/dist/application/diagnostic-journal-tail.d.ts.map +1 -0
- package/dist/application/diagnostic-journal.d.ts +3 -0
- package/dist/application/diagnostic-journal.d.ts.map +1 -1
- package/dist/application/directory-inbox-accept.d.ts +3 -3
- package/dist/application/directory-inbox-accept.d.ts.map +1 -1
- package/dist/application/directory-inbox-contract.d.ts +38 -10
- package/dist/application/directory-inbox-contract.d.ts.map +1 -1
- package/dist/application/directory-inbox-delivery.d.ts +3 -3
- package/dist/application/directory-inbox-delivery.d.ts.map +1 -1
- package/dist/application/directory-inbox-files.d.ts +17 -2
- package/dist/application/directory-inbox-files.d.ts.map +1 -1
- package/dist/application/directory-inbox-state.d.ts +1 -1
- package/dist/application/directory-inbox-state.d.ts.map +1 -1
- package/dist/application/directory-inbox.d.ts +1 -1
- package/dist/application/directory-inbox.d.ts.map +1 -1
- package/dist/application/file-state-store.d.ts +21 -1
- package/dist/application/file-state-store.d.ts.map +1 -1
- package/dist/application/grammy.d.ts.map +1 -1
- package/dist/application/kernel-contract.d.ts.map +1 -1
- package/dist/application/revision-signal.d.ts.map +1 -1
- package/dist/application/state-store.d.ts +3 -0
- package/dist/application/state-store.d.ts.map +1 -1
- package/dist/browser/api-error.d.ts +38 -0
- package/dist/browser/api-error.d.ts.map +1 -0
- package/dist/browser/chunked-upload.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts.map +1 -1
- package/dist/browser/client-url.d.ts.map +1 -1
- package/dist/browser/contract-stream.d.ts.map +1 -1
- package/dist/browser/http.d.ts +0 -25
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/resumable.d.ts.map +1 -1
- package/dist/contract/define-validation.d.ts +0 -1
- package/dist/contract/define-validation.d.ts.map +1 -1
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/errors-factory.d.ts.map +1 -1
- package/dist/contract/errors.d.ts +15 -18
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/normalize.d.ts.map +1 -1
- package/dist/durability/effect.d.ts.map +1 -1
- package/dist/durability/scheduler.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/browser.js +29 -18
- package/dist/entrypoints/agent-runtime/coding-tools.js +8 -7
- package/dist/entrypoints/agent-runtime/harness.js +15 -14
- package/dist/entrypoints/agent-runtime/realtime.d.ts +1 -1
- package/dist/entrypoints/agent-runtime/realtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/realtime.js +119 -54
- package/dist/entrypoints/agent-runtime/sandbox.js +23 -17
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +4 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +4 -3
- package/dist/entrypoints/agent-runtime/testing.js +8 -6
- package/dist/entrypoints/agent-runtime.js +37 -38
- package/dist/entrypoints/application/diagnostic-journal.js +305 -111
- package/dist/entrypoints/application/directory-inbox.js +174 -77
- package/dist/entrypoints/application/grammy.js +5 -2
- package/dist/entrypoints/application/opentelemetry.js +2 -2
- package/dist/entrypoints/application.d.ts +2 -2
- package/dist/entrypoints/application.d.ts.map +1 -1
- package/dist/entrypoints/application.js +17 -8
- package/dist/entrypoints/cli/publish.d.ts +16 -0
- package/dist/entrypoints/cli/publish.d.ts.map +1 -0
- package/dist/entrypoints/cli/publish.js +527 -0
- package/dist/entrypoints/cli.d.ts +1 -2
- package/dist/entrypoints/cli.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +59 -966
- package/dist/entrypoints/contract.js +3 -3
- package/dist/entrypoints/files/packaging.js +196 -56
- package/dist/entrypoints/files.d.ts +1 -0
- package/dist/entrypoints/files.d.ts.map +1 -1
- package/dist/entrypoints/files.js +17 -10
- package/dist/entrypoints/index.d.ts +2 -1
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +31 -60
- package/dist/entrypoints/node.js +8 -8
- package/dist/entrypoints/observability.js +3 -3
- package/dist/entrypoints/primitives.js +67 -83
- package/dist/entrypoints/process.d.ts +1 -1
- package/dist/entrypoints/process.d.ts.map +1 -1
- package/dist/entrypoints/process.js +2 -2
- package/dist/entrypoints/react.js +4 -2
- package/dist/entrypoints/remote.js +37 -13
- package/dist/entrypoints/server.js +18 -16
- package/dist/entrypoints/telegram/screens.js +5 -3
- package/dist/entrypoints/telegram.js +31 -46
- package/dist/entrypoints/testing.d.ts +1 -1
- package/dist/entrypoints/testing.d.ts.map +1 -1
- package/dist/entrypoints/testing.js +444 -448
- package/dist/entrypoints/tools/connections.js +268 -105
- package/dist/entrypoints/tools/contract.js +2 -2
- package/dist/entrypoints/tools/invoker.js +8 -7
- package/dist/entrypoints/tools/mcp.d.ts +2 -2
- package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
- package/dist/entrypoints/tools/mcp.js +10 -9
- package/dist/entrypoints/tools.d.ts +0 -1
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +118 -53
- package/dist/entrypoints/tracking.js +2 -3
- package/dist/files/boundary.d.ts +2 -2
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/chunk-spool.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +2 -2
- package/dist/files/file-io.d.ts.map +1 -1
- package/dist/files/native-packaging-layout.d.ts +50 -4
- package/dist/files/native-packaging-layout.d.ts.map +1 -1
- package/dist/files/native-packaging.d.ts +104 -21
- package/dist/files/native-packaging.d.ts.map +1 -1
- package/dist/{index-r5hsgkz5.js → index-0gs4ymfj.js} +6 -3
- package/dist/{index-zax7resm.js → index-0gxvns6s.js} +1 -13
- package/dist/index-0s4xebbg.js +8 -0
- package/dist/{index-r4r70zmh.js → index-12zsej7b.js} +5 -2
- package/dist/{index-kemm0ej5.js → index-1pwwan01.js} +65 -22
- package/dist/{index-vgkbcnkc.js → index-299sm5tr.js} +1 -1
- package/dist/{index-2vnh05w4.js → index-2k91mewf.js} +31 -74
- package/dist/{index-269zqj8m.js → index-2rc6jd9n.js} +28 -12
- package/dist/{index-wh0ecvyk.js → index-37asdw3a.js} +1 -1
- package/dist/index-3h0ztg0z.js +285 -0
- package/dist/{index-g95fk660.js → index-4vsby8n8.js} +8 -15
- package/dist/index-556g5hsh.js +17 -0
- package/dist/{index-adhgd4pe.js → index-5p55xreg.js} +2 -2
- package/dist/index-5w6t91ze.js +47 -0
- package/dist/{index-9pw0a51a.js → index-6yxhe58g.js} +40 -7
- package/dist/{index-6d9xaxw1.js → index-8ks9b85e.js} +33 -5
- package/dist/{index-bhb950qs.js → index-916yh4e2.js} +25 -12
- package/dist/index-9tqbxv5p.js +44 -0
- package/dist/{index-5csmzesf.js → index-azx12jgv.js} +4 -3
- package/dist/{index-mbnnw3f2.js → index-b0kddvzw.js} +15 -5
- package/dist/{index-n5yqxd3d.js → index-b0w7rbpt.js} +23 -2
- package/dist/index-b56nnscm.js +132 -0
- package/dist/{index-0ndk4555.js → index-c0hffcmj.js} +2 -2
- package/dist/{index-pptyv13k.js → index-c17xcx4k.js} +42 -6
- package/dist/{index-g2j7pnak.js → index-cmzvhhtd.js} +5 -2
- package/dist/index-cq59agna.js +51 -0
- package/dist/{index-ssmd41kh.js → index-d2h99n7d.js} +1 -1
- package/dist/{index-z94wht4y.js → index-dky0dcmf.js} +34 -5
- package/dist/{index-za6j7nwy.js → index-dsnjzb62.js} +104 -51
- package/dist/index-eemvahkc.js +21 -0
- package/dist/index-ef8gdaq0.js +105 -0
- package/dist/{index-fa4wg312.js → index-f199nfq5.js} +10 -6
- package/dist/{index-ck71tbcf.js → index-fsw1ybf3.js} +11 -15
- package/dist/{index-f330qqyg.js → index-g2vfg7ak.js} +217 -63
- package/dist/{index-fk18k56k.js → index-gr5g3xfw.js} +11 -18
- package/dist/{index-jn9g8xdt.js → index-hjvje0pf.js} +6 -4
- package/dist/{index-x928baz2.js → index-j9gxbztg.js} +18 -14
- package/dist/index-kfjkb396.js +37 -0
- package/dist/{index-6drst9sg.js → index-ksfagmyz.js} +45 -345
- package/dist/index-m616f0yz.js +120 -0
- package/dist/{index-fm1c1a08.js → index-m6w6jtda.js} +40 -21
- package/dist/{index-ptn0g0gj.js → index-ma963wz7.js} +21 -20
- package/dist/{index-bakgedh8.js → index-msfpyy2f.js} +2 -4
- package/dist/{index-ywppsaby.js → index-n1nszyk0.js} +23 -34
- package/dist/{index-v14qqmys.js → index-n4689krb.js} +1 -1
- package/dist/{index-a0zzh8ak.js → index-pz3y6b6g.js} +3 -3
- package/dist/{index-43p08g7t.js → index-pzb63z66.js} +12 -8
- package/dist/{index-h97tqqp1.js → index-qaet40b2.js} +5 -3
- package/dist/{index-t1sr4aks.js → index-qaqbdm7s.js} +52 -6
- package/dist/{index-77nxk6ay.js → index-r393tnfp.js} +16 -10
- package/dist/{index-kb8styz3.js → index-rpzewktb.js} +15 -5
- package/dist/{index-27a2pj09.js → index-sj28htvf.js} +1 -1
- package/dist/index-szybbezc.js +455 -0
- package/dist/{index-2hyavjjj.js → index-wbhdzxar.js} +3 -3
- package/dist/{index-4e0ah203.js → index-wdy68sh6.js} +47 -24
- package/dist/{index-hbd32c6a.js → index-wqmvtnkp.js} +38 -89
- package/dist/{index-hp9d77wk.js → index-x7w1z6pf.js} +15 -4
- package/dist/{index-20yvtn9a.js → index-yt7gyg5x.js} +1 -1
- package/dist/{index-cvda079a.js → index-yvfk3y36.js} +12 -2
- package/dist/{index-5z6jn897.js → index-z23rfxhj.js} +1 -1
- package/dist/internal/abort-race.d.ts +8 -2
- package/dist/internal/abort-race.d.ts.map +1 -1
- package/dist/internal/atomic-file.d.ts +55 -9
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/atomic-publication.d.ts +39 -4
- package/dist/internal/atomic-publication.d.ts.map +1 -1
- package/dist/internal/atomic-staging.d.ts +46 -0
- package/dist/internal/atomic-staging.d.ts.map +1 -0
- package/dist/internal/bounded-file-read.d.ts +19 -11
- package/dist/internal/bounded-file-read.d.ts.map +1 -1
- package/dist/internal/bounded-lines.d.ts.map +1 -1
- package/dist/internal/close-after.d.ts +11 -0
- package/dist/internal/close-after.d.ts.map +1 -0
- package/dist/internal/deadline.d.ts +10 -0
- package/dist/internal/deadline.d.ts.map +1 -1
- package/dist/internal/exclusive-lock-read.d.ts +10 -12
- package/dist/internal/exclusive-lock-read.d.ts.map +1 -1
- package/dist/internal/exclusive-lock.d.ts +2 -2
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/file-observation.d.ts +14 -0
- package/dist/internal/file-observation.d.ts.map +1 -0
- package/dist/internal/json-data.d.ts +22 -5
- package/dist/internal/json-data.d.ts.map +1 -1
- package/dist/internal/positive-integer.d.ts +9 -0
- package/dist/internal/positive-integer.d.ts.map +1 -0
- package/dist/internal/process-instance.d.ts +35 -5
- package/dist/internal/process-instance.d.ts.map +1 -1
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/internal/timers.d.ts +11 -0
- package/dist/internal/timers.d.ts.map +1 -0
- package/dist/internal/with-exclusive-lock.d.ts +5 -4
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
- package/dist/observability/bounded-sink.d.ts.map +1 -1
- package/dist/primitives/canonical-json.d.ts +23 -2
- package/dist/primitives/canonical-json.d.ts.map +1 -1
- package/dist/primitives/delivery.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/money.d.ts.map +1 -1
- package/dist/process/cleanup.d.ts +6 -1
- package/dist/process/cleanup.d.ts.map +1 -1
- package/dist/process/command-lifetime.d.ts +4 -0
- package/dist/process/command-lifetime.d.ts.map +1 -1
- package/dist/process/command-owner.d.ts.map +1 -1
- package/dist/process/command.d.ts +4 -0
- package/dist/process/command.d.ts.map +1 -1
- package/dist/process/contract.d.ts +67 -2
- package/dist/process/contract.d.ts.map +1 -1
- package/dist/process/group.d.ts +40 -3
- package/dist/process/group.d.ts.map +1 -1
- package/dist/process/launch.d.ts +12 -1
- package/dist/process/launch.d.ts.map +1 -1
- package/dist/process/terminate.d.ts +39 -0
- package/dist/process/terminate.d.ts.map +1 -0
- package/dist/react/query-client.d.ts.map +1 -1
- package/dist/realtime/rejection.d.ts.map +1 -1
- package/dist/server/contract-stream.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts.map +1 -1
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/request-body.d.ts +0 -1
- package/dist/server/request-body.d.ts.map +1 -1
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/telegram/broadcast-delivery.d.ts.map +1 -1
- package/dist/telegram/broadcast-failure.d.ts +10 -2
- package/dist/telegram/broadcast-failure.d.ts.map +1 -1
- package/dist/telegram/operator-channel.d.ts.map +1 -1
- package/dist/telegram/screens/outcome.d.ts.map +1 -1
- package/dist/testing/surface-conformance.d.ts +1 -1
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest.d.ts +0 -6
- 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.d.ts +1 -1
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/help.d.ts.map +1 -1
- package/dist/tools/cli/invoke.d.ts +2 -2
- package/dist/tools/cli/invoke.d.ts.map +1 -1
- package/dist/tools/cli/profile.d.ts.map +1 -1
- package/dist/tools/cli/publication-assets.d.ts.map +1 -1
- package/dist/tools/cli/publication-contract.d.ts +8 -0
- package/dist/tools/cli/publication-contract.d.ts.map +1 -1
- package/dist/tools/cli/publication-control.d.ts.map +1 -1
- package/dist/tools/cli/publication-storage.d.ts +23 -2
- package/dist/tools/cli/publication-storage.d.ts.map +1 -1
- package/dist/tools/cli/publication.d.ts +8 -1
- package/dist/tools/cli/publication.d.ts.map +1 -1
- package/dist/tools/connections/errors.d.ts +18 -6
- package/dist/tools/connections/errors.d.ts.map +1 -1
- package/dist/tools/connections/limits.d.ts +8 -2
- package/dist/tools/connections/limits.d.ts.map +1 -1
- package/dist/tools/connections/mcp-client.d.ts.map +1 -1
- package/dist/tools/connections/mcp-envelope.d.ts.map +1 -1
- package/dist/tools/connections/openapi.d.ts.map +1 -1
- package/dist/tools/connections/schema-budget.d.ts +1 -1
- package/dist/tools/connections/schema-budget.d.ts.map +1 -1
- package/dist/tools/connections/sse-session.d.ts.map +1 -1
- package/dist/tools/execute-args.d.ts.map +1 -1
- package/dist/tools/execute-result.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts +17 -3
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/internal/tool-error-projection.d.ts +16 -0
- package/dist/tools/internal/tool-error-projection.d.ts.map +1 -0
- package/dist/tools/internal/tool-view.d.ts.map +1 -1
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/list-names.d.ts +3 -2
- package/dist/tools/list-names.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +3 -2
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools/mcp/handler.d.ts +7 -0
- package/dist/tools/mcp/handler.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +18 -2
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/prepare.d.ts +3 -3
- package/dist/tools/mcp/prepare.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/dist/tools/mcp/stdio-signals.d.ts +14 -0
- package/dist/tools/mcp/stdio-signals.d.ts.map +1 -1
- package/dist/tools/mcp/stdio.d.ts +7 -0
- package/dist/tools/mcp/stdio.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-types.d.ts +3 -3
- package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
- package/dist/tools/operations/define-wait-tool.d.ts +1 -1
- package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
- package/dist/tools/operations/wait-core.d.ts +0 -6
- package/dist/tools/operations/wait-core.d.ts.map +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/remote.d.ts +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/{runtime-tool-execution.d.ts → runtime-tool-declaration.d.ts} +32 -9
- package/dist/tools/runtime-tool-declaration.d.ts.map +1 -0
- package/dist/tools/runtime-tool-mcp.d.ts +6 -15
- package/dist/tools/runtime-tool-mcp.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +14 -12
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/schema/coerce.d.ts +4 -0
- package/dist/tools/schema/coerce.d.ts.map +1 -1
- package/dist/tools/schema/flatten-join.d.ts.map +1 -1
- package/dist/tools/surface.d.ts +7 -11
- package/dist/tools/surface.d.ts.map +1 -1
- package/dist/tools/transfer/define-download-tool.d.ts +1 -1
- package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
- package/dist/tools/transfer/define-upload-tool.d.ts +1 -1
- package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
- package/dist/tools/transfer/define-view-file-tool.d.ts +1 -1
- package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
- package/dist/tools/transfer/managed-file-error.d.ts.map +1 -1
- package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
- package/dist/tools/transfer/view-file.d.ts +1 -1
- package/dist/tools/transfer/view-file.d.ts.map +1 -1
- package/dist/tools/transports.d.ts +3 -2
- package/dist/tools/transports.d.ts.map +1 -1
- package/llms/agent-runtime-browser.txt +10 -4
- package/llms/agent-runtime-harness.txt +32 -31
- package/llms/agent-runtime-react.txt +1 -1
- package/llms/agent-runtime-realtime.txt +14 -5
- package/llms/agent-runtime-sandbox.txt +3 -11
- package/llms/agent-runtime.3.txt +2 -2
- package/llms/agent-runtime.txt +0 -9
- package/llms/application.2.txt +3 -12
- package/llms/application.3.txt +7 -4
- package/llms/application.txt +44 -15
- package/llms/cli-publish.txt +29 -0
- package/llms/cli.2.txt +9 -11
- package/llms/cli.txt +26 -14
- package/llms/declaration.txt +0 -9
- package/llms/files-packaging.txt +22 -7
- package/llms/files.txt +4 -2
- package/llms/geo.txt +0 -9
- package/llms/live.txt +4 -13
- package/llms/observability.txt +31 -5
- package/llms/primitives.txt +38 -20
- package/llms/process.txt +305 -154
- package/llms/react-keyboard.txt +0 -9
- package/llms/react.txt +0 -18
- package/llms/server.4.txt +1 -1
- package/llms/server.5.txt +1 -1
- package/llms/server.txt +1 -1
- package/llms/stitchkit.txt +6 -7
- package/llms/telegram-screens.txt +2 -2
- package/llms/testing.txt +0 -1
- package/llms/tools-mcp.txt +2 -3
- package/llms/tools.2.txt +12 -0
- package/llms/tools.3.txt +5 -6
- package/llms/tools.txt +6 -4
- package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
- package/llms/{upgrading-0.44.0-0.61.0.txt → upgrading-0.53.0-0.67.0.txt} +576 -506
- package/llms/{upgrading-0.62.0-0.80.0.txt → upgrading-0.68.0-0.94.0.txt} +562 -576
- package/llms/{upgrading-0.81.0-0.104.0.txt → upgrading-0.95.0-0.105.0.txt} +452 -567
- package/llms/upgrading.txt +4 -4
- package/llms-full.txt +1053 -405
- package/llms.txt +24 -24
- package/native-assets.json +11 -3
- package/package.json +6 -6
- package/dist/agent-runtime/harness-tools.d.ts +0 -11
- package/dist/agent-runtime/harness-tools.d.ts.map +0 -1
- package/dist/entrypoints/agent-runtime/harness-tools.d.ts +0 -2
- package/dist/entrypoints/agent-runtime/harness-tools.d.ts.map +0 -1
- package/dist/entrypoints/agent-runtime/harness-tools.js +0 -32
- package/dist/index-1a6jtnd9.js +0 -88
- package/dist/index-8a9ksm91.js +0 -95
- package/dist/index-a3wma1hk.js +0 -48
- package/dist/index-jd470k6q.js +0 -109
- package/dist/index-n1dqr7gf.js +0 -20
- package/dist/index-nggfa2yn.js +0 -34
- package/dist/index-s4evrmp5.js +0 -98
- package/dist/index-ze1eph1k.js +0 -20
- package/dist/tools/connections/error-projection.d.ts +0 -4
- package/dist/tools/connections/error-projection.d.ts.map +0 -1
- package/dist/tools/runtime-tool-execution.d.ts.map +0 -1
- package/llms/agent-runtime-harness-tools.txt +0 -25
- package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
|
@@ -1,23 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppError2,
|
|
3
|
+
STITCH_ERROR_STATUS2,
|
|
4
|
+
isRetryableStatus2
|
|
5
|
+
} from "../../index-j9gxbztg.js";
|
|
6
|
+
import {
|
|
7
|
+
TOOL_ERROR_PROJECTION
|
|
8
|
+
} from "../../index-556g5hsh.js";
|
|
1
9
|
import"../../index-ct75c3at.js";
|
|
2
10
|
import {
|
|
3
11
|
declaresDraft07,
|
|
4
12
|
withDefsDialect
|
|
5
|
-
} from "../../index-
|
|
13
|
+
} from "../../index-r393tnfp.js";
|
|
14
|
+
import"../../index-rpzewktb.js";
|
|
6
15
|
import {
|
|
7
|
-
|
|
8
|
-
} from "../../index-
|
|
9
|
-
import"../../index-kb8styz3.js";
|
|
16
|
+
withSignalDeadline
|
|
17
|
+
} from "../../index-9tqbxv5p.js";
|
|
10
18
|
import {
|
|
11
|
-
|
|
12
|
-
} from "../../index-
|
|
19
|
+
raceAbort
|
|
20
|
+
} from "../../index-b0kddvzw.js";
|
|
13
21
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
MAX_TIMER_MS
|
|
23
|
+
} from "../../index-eemvahkc.js";
|
|
24
|
+
import {
|
|
25
|
+
assertPositiveSafeInteger
|
|
26
|
+
} from "../../index-0s4xebbg.js";
|
|
27
|
+
import {
|
|
28
|
+
defineRuntimeTool2
|
|
29
|
+
} from "../../index-yvfk3y36.js";
|
|
21
30
|
import {
|
|
22
31
|
safeJsonParse
|
|
23
32
|
} from "../../index-zsarb5xp.js";
|
|
@@ -25,10 +34,186 @@ import {
|
|
|
25
34
|
isRecord
|
|
26
35
|
} from "../../index-9jfdm5tg.js";
|
|
27
36
|
|
|
37
|
+
// src/tools/connections/errors.ts
|
|
38
|
+
class ConnectionAuthorizationRequiredError extends Error {
|
|
39
|
+
connectionName;
|
|
40
|
+
instanceId;
|
|
41
|
+
operation;
|
|
42
|
+
phase;
|
|
43
|
+
constructor(connectionName, instanceId, context = {}) {
|
|
44
|
+
super(`Connection "${connectionName}" requires authorization`);
|
|
45
|
+
this.name = "ConnectionAuthorizationRequiredError";
|
|
46
|
+
this.connectionName = connectionName;
|
|
47
|
+
this.instanceId = instanceId;
|
|
48
|
+
this.operation = context.operation ?? "request";
|
|
49
|
+
this.phase = context.phase ?? "call";
|
|
50
|
+
}
|
|
51
|
+
[TOOL_ERROR_PROJECTION]() {
|
|
52
|
+
const message = "Authorization required";
|
|
53
|
+
return new AppError2("UNAUTHORIZED", {
|
|
54
|
+
message,
|
|
55
|
+
status: STITCH_ERROR_STATUS2.UNAUTHORIZED,
|
|
56
|
+
details: {
|
|
57
|
+
message,
|
|
58
|
+
reason: "authorization-required",
|
|
59
|
+
operation: this.operation,
|
|
60
|
+
phase: this.phase
|
|
61
|
+
},
|
|
62
|
+
hint: "Obtain a new credential before retrying.",
|
|
63
|
+
retryable: false
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
class ConnectionRequestError extends Error {
|
|
69
|
+
connectionName;
|
|
70
|
+
status;
|
|
71
|
+
body;
|
|
72
|
+
operation;
|
|
73
|
+
phase;
|
|
74
|
+
constructor(connectionName, status, body, context = {}) {
|
|
75
|
+
super(`Connection "${connectionName}" request failed with status ${status}`);
|
|
76
|
+
this.name = "ConnectionRequestError";
|
|
77
|
+
this.connectionName = connectionName;
|
|
78
|
+
this.status = status;
|
|
79
|
+
this.body = body;
|
|
80
|
+
this.operation = context.operation ?? "request";
|
|
81
|
+
this.phase = context.phase ?? "call";
|
|
82
|
+
}
|
|
83
|
+
[TOOL_ERROR_PROJECTION]() {
|
|
84
|
+
const forbidden = this.status === 403;
|
|
85
|
+
const code = forbidden ? "FORBIDDEN" : "CONNECTION_REQUEST_FAILED";
|
|
86
|
+
const message = forbidden ? "Connection access denied" : "Connection request failed";
|
|
87
|
+
return new AppError2(code, {
|
|
88
|
+
message,
|
|
89
|
+
status: STITCH_ERROR_STATUS2[code],
|
|
90
|
+
details: {
|
|
91
|
+
message,
|
|
92
|
+
reason: forbidden ? "permission-denied" : "upstream-request-failed",
|
|
93
|
+
operation: this.operation,
|
|
94
|
+
phase: this.phase,
|
|
95
|
+
upstreamStatus: this.status
|
|
96
|
+
},
|
|
97
|
+
hint: forbidden ? "Check the credential permissions." : "Check the upstream service and verify any write outcome before retrying.",
|
|
98
|
+
retryable: !forbidden && isRetryableStatus2(this.status)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
class ConnectionUrlError extends Error {
|
|
104
|
+
url;
|
|
105
|
+
constructor(message, url) {
|
|
106
|
+
super(message);
|
|
107
|
+
this.name = "ConnectionUrlError";
|
|
108
|
+
this.url = url;
|
|
109
|
+
}
|
|
110
|
+
[TOOL_ERROR_PROJECTION]() {
|
|
111
|
+
return new AppError2("BAD_REQUEST", {
|
|
112
|
+
message: "Connection URL refused",
|
|
113
|
+
status: STITCH_ERROR_STATUS2.BAD_REQUEST,
|
|
114
|
+
details: { message: "Connection URL refused", reason: "url-rejected" },
|
|
115
|
+
hint: "Check the connection URL and its allowed hosts.",
|
|
116
|
+
retryable: false
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
class ConnectionBudgetExceededError extends Error {
|
|
122
|
+
limit;
|
|
123
|
+
actual;
|
|
124
|
+
constructor(limit, actual, unit = "tools") {
|
|
125
|
+
super(`Connection surface exposes ${actual} ${unit}, above the budget of ${limit}`);
|
|
126
|
+
this.name = "ConnectionBudgetExceededError";
|
|
127
|
+
this.limit = limit;
|
|
128
|
+
this.actual = actual;
|
|
129
|
+
}
|
|
130
|
+
[TOOL_ERROR_PROJECTION]() {
|
|
131
|
+
return new AppError2("BAD_REQUEST", {
|
|
132
|
+
message: "Connection mount budget exceeded",
|
|
133
|
+
status: STITCH_ERROR_STATUS2.BAD_REQUEST,
|
|
134
|
+
details: {
|
|
135
|
+
message: "Connection mount budget exceeded",
|
|
136
|
+
reason: "mount-budget-exceeded",
|
|
137
|
+
limit: this.limit,
|
|
138
|
+
actual: this.actual
|
|
139
|
+
},
|
|
140
|
+
hint: "Narrow the mounted tool surface or increase its mount budget.",
|
|
141
|
+
retryable: false
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
class ConnectionTimeoutError extends Error {
|
|
147
|
+
connectionName;
|
|
148
|
+
timeoutMs;
|
|
149
|
+
operation;
|
|
150
|
+
phase;
|
|
151
|
+
observedReadBytes;
|
|
152
|
+
constructor(connectionName, timeoutMs, context = {}) {
|
|
153
|
+
super(`Connection "${connectionName}" timed out after ${timeoutMs} ms`);
|
|
154
|
+
this.name = "ConnectionTimeoutError";
|
|
155
|
+
this.connectionName = connectionName;
|
|
156
|
+
this.timeoutMs = timeoutMs;
|
|
157
|
+
this.operation = context.operation ?? "request";
|
|
158
|
+
this.phase = context.phase ?? "call";
|
|
159
|
+
this.observedReadBytes = context.observedReadBytes ?? 0;
|
|
160
|
+
}
|
|
161
|
+
[TOOL_ERROR_PROJECTION]() {
|
|
162
|
+
const message = "Connection deadline exceeded";
|
|
163
|
+
return new AppError2("CONNECTION_TIMEOUT", {
|
|
164
|
+
message,
|
|
165
|
+
status: STITCH_ERROR_STATUS2.CONNECTION_TIMEOUT,
|
|
166
|
+
details: {
|
|
167
|
+
message,
|
|
168
|
+
reason: "deadline-exceeded",
|
|
169
|
+
operation: this.operation,
|
|
170
|
+
phase: this.phase,
|
|
171
|
+
timeoutMs: this.timeoutMs,
|
|
172
|
+
observedReadBytes: this.observedReadBytes
|
|
173
|
+
},
|
|
174
|
+
hint: "Check the connection deadline and verify any write outcome before retrying.",
|
|
175
|
+
retryable: false
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
class ConnectionResponseTooLargeError extends Error {
|
|
181
|
+
connectionName;
|
|
182
|
+
maxBytes;
|
|
183
|
+
operation;
|
|
184
|
+
phase;
|
|
185
|
+
observedReadBytes;
|
|
186
|
+
constructor(connectionName, maxBytes, context = {}) {
|
|
187
|
+
super(`Connection "${connectionName}" response exceeded the ${maxBytes} byte limit`);
|
|
188
|
+
this.name = "ConnectionResponseTooLargeError";
|
|
189
|
+
this.connectionName = connectionName;
|
|
190
|
+
this.maxBytes = maxBytes;
|
|
191
|
+
this.operation = context.operation ?? "request";
|
|
192
|
+
this.phase = context.phase ?? "call";
|
|
193
|
+
this.observedReadBytes = context.observedReadBytes ?? 0;
|
|
194
|
+
}
|
|
195
|
+
[TOOL_ERROR_PROJECTION]() {
|
|
196
|
+
const message = "Connection response exceeds the byte limit";
|
|
197
|
+
return new AppError2("CONNECTION_RESPONSE_TOO_LARGE", {
|
|
198
|
+
message,
|
|
199
|
+
status: STITCH_ERROR_STATUS2.CONNECTION_RESPONSE_TOO_LARGE,
|
|
200
|
+
details: {
|
|
201
|
+
message,
|
|
202
|
+
reason: "response-too-large",
|
|
203
|
+
operation: this.operation,
|
|
204
|
+
phase: this.phase,
|
|
205
|
+
maxResponseBytes: this.maxBytes,
|
|
206
|
+
observedReadBytes: this.observedReadBytes
|
|
207
|
+
},
|
|
208
|
+
hint: "Narrow the response or increase the limit for this operation phase.",
|
|
209
|
+
retryable: false
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
28
214
|
// src/tools/connections/limits.ts
|
|
29
215
|
var DEFAULT_CONNECTION_TIMEOUT_MS = 30000;
|
|
30
216
|
var DEFAULT_MAX_RESPONSE_BYTES = 1024 * 1024;
|
|
31
|
-
var MAX_TIMER_MS = 2147483647;
|
|
32
217
|
function connectionTimeoutMs(value) {
|
|
33
218
|
if (value === undefined)
|
|
34
219
|
return DEFAULT_CONNECTION_TIMEOUT_MS;
|
|
@@ -40,55 +225,19 @@ function connectionTimeoutMs(value) {
|
|
|
40
225
|
function connectionMaxResponseBytes(value) {
|
|
41
226
|
if (value === undefined)
|
|
42
227
|
return DEFAULT_MAX_RESPONSE_BYTES;
|
|
43
|
-
|
|
44
|
-
throw new RangeError("Connection maxResponseBytes must be a positive safe integer");
|
|
45
|
-
}
|
|
228
|
+
assertPositiveSafeInteger("Connection maxResponseBytes", value, RangeError);
|
|
46
229
|
return value;
|
|
47
230
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return pending;
|
|
51
|
-
if (signal.aborted) {
|
|
52
|
-
pending.catch(() => {
|
|
53
|
-
return;
|
|
54
|
-
});
|
|
55
|
-
signal.throwIfAborted();
|
|
56
|
-
}
|
|
57
|
-
const aborted = Promise.withResolvers();
|
|
58
|
-
const onAbort = () => aborted.reject(signal.reason);
|
|
59
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
60
|
-
try {
|
|
61
|
-
signal.throwIfAborted();
|
|
62
|
-
const result = await Promise.race([pending, aborted.promise]);
|
|
63
|
-
signal.throwIfAborted();
|
|
64
|
-
return result;
|
|
65
|
-
} catch (error) {
|
|
66
|
-
signal.throwIfAborted();
|
|
67
|
-
throw error;
|
|
68
|
-
} finally {
|
|
69
|
-
signal.removeEventListener("abort", onAbort);
|
|
70
|
-
}
|
|
231
|
+
function awaitConnection(pending, signal) {
|
|
232
|
+
return signal ? raceAbort(pending, signal) : pending;
|
|
71
233
|
}
|
|
72
|
-
|
|
73
|
-
connectionTimeoutMs(timeoutMs);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
controller.abort(callerSignal.reason);
|
|
80
|
-
else
|
|
81
|
-
callerSignal.addEventListener("abort", onAbort, { once: true });
|
|
82
|
-
}
|
|
83
|
-
if (context)
|
|
84
|
-
context.signal = controller.signal;
|
|
85
|
-
try {
|
|
86
|
-
controller.signal.throwIfAborted();
|
|
87
|
-
return await awaitConnection(body(controller.signal), controller.signal);
|
|
88
|
-
} finally {
|
|
89
|
-
clearTimeout(timer);
|
|
90
|
-
callerSignal?.removeEventListener("abort", onAbort);
|
|
91
|
-
}
|
|
234
|
+
function withConnectionDeadline(connectionName, context, callerSignal, body) {
|
|
235
|
+
const timeoutMs = connectionTimeoutMs(context.timeoutMs);
|
|
236
|
+
let scoped = context;
|
|
237
|
+
return withSignalDeadline(timeoutMs, callerSignal, () => new ConnectionTimeoutError(connectionName, timeoutMs, scoped), (signal) => {
|
|
238
|
+
scoped = { ...context, signal };
|
|
239
|
+
return raceAbort(body(scoped), signal);
|
|
240
|
+
});
|
|
92
241
|
}
|
|
93
242
|
async function readBoundedText(response, maxBytes, connectionName, context) {
|
|
94
243
|
context?.signal?.throwIfAborted();
|
|
@@ -111,7 +260,7 @@ async function readBoundedText(response, maxBytes, connectionName, context) {
|
|
|
111
260
|
if (context)
|
|
112
261
|
context.observedReadBytes += value.byteLength;
|
|
113
262
|
if (total > maxBytes) {
|
|
114
|
-
throw new
|
|
263
|
+
throw new ConnectionResponseTooLargeError(connectionName, maxBytes, {
|
|
115
264
|
...context,
|
|
116
265
|
observedReadBytes: total
|
|
117
266
|
});
|
|
@@ -134,7 +283,7 @@ async function readConnectionErrorText(response, connectionName, context) {
|
|
|
134
283
|
return (await readBoundedText(response, context.maxResponseBytes, connectionName, context)).slice(0, 512);
|
|
135
284
|
} catch (error) {
|
|
136
285
|
context.signal?.throwIfAborted();
|
|
137
|
-
if (error instanceof
|
|
286
|
+
if (error instanceof ConnectionResponseTooLargeError || error instanceof ConnectionTimeoutError) {
|
|
138
287
|
throw error;
|
|
139
288
|
}
|
|
140
289
|
return "";
|
|
@@ -178,10 +327,10 @@ function assertConnectionUrl(rawUrl, connectionName) {
|
|
|
178
327
|
try {
|
|
179
328
|
url = new URL(rawUrl);
|
|
180
329
|
} catch {
|
|
181
|
-
throw new
|
|
330
|
+
throw new ConnectionUrlError(`Connection "${connectionName}" has an unparseable URL: ${rawUrl}`, rawUrl);
|
|
182
331
|
}
|
|
183
332
|
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
184
|
-
throw new
|
|
333
|
+
throw new ConnectionUrlError(`Connection "${connectionName}" must use http(s), got "${url.protocol}"`, rawUrl);
|
|
185
334
|
}
|
|
186
335
|
return url;
|
|
187
336
|
}
|
|
@@ -193,7 +342,7 @@ function connectionAllowedHosts(connectionUrl, extra) {
|
|
|
193
342
|
}
|
|
194
343
|
function assertAllowedHost(url, allowedHosts, connectionName) {
|
|
195
344
|
if (!allowedHosts.has(url.host.toLowerCase())) {
|
|
196
|
-
throw new
|
|
345
|
+
throw new ConnectionUrlError(`Connection "${connectionName}" refused request to host "${url.host}": not the connection host or an allowed host`, url.toString());
|
|
197
346
|
}
|
|
198
347
|
}
|
|
199
348
|
|
|
@@ -230,7 +379,7 @@ async function fetchConnection(target, init, allowedHosts, connectionName) {
|
|
|
230
379
|
const response = await fetch(url, { ...init, redirect: "manual" });
|
|
231
380
|
if (response.status >= 300 && response.status < 400) {
|
|
232
381
|
await response.body?.cancel();
|
|
233
|
-
throw new
|
|
382
|
+
throw new ConnectionUrlError(`Connection "${connectionName}" refused a redirect`, url.toString());
|
|
234
383
|
}
|
|
235
384
|
return response;
|
|
236
385
|
}
|
|
@@ -262,7 +411,7 @@ async function* readSseFrames(response, maxBytes, connectionName, options = {})
|
|
|
262
411
|
const context = () => options.currentContext?.() ?? options.context;
|
|
263
412
|
const tooLarge = (observedReadBytes) => {
|
|
264
413
|
const current = context();
|
|
265
|
-
return new
|
|
414
|
+
return new ConnectionResponseTooLargeError(connectionName, current?.maxResponseBytes ?? maxBytes, { ...current, observedReadBytes });
|
|
266
415
|
};
|
|
267
416
|
try {
|
|
268
417
|
for (;; ) {
|
|
@@ -356,7 +505,7 @@ class SseSession {
|
|
|
356
505
|
return this.waitForEndpoint(signal);
|
|
357
506
|
}
|
|
358
507
|
const readiness = this.endpointContext;
|
|
359
|
-
return withConnectionDeadline(this.connectionName, readiness
|
|
508
|
+
return withConnectionDeadline(this.connectionName, readiness, signal, (scoped) => this.waitForEndpoint(scoped.signal));
|
|
360
509
|
}
|
|
361
510
|
close(reason = new Error("MCP SSE session closed")) {
|
|
362
511
|
if (this.controller.signal.aborted)
|
|
@@ -383,7 +532,7 @@ class SseSession {
|
|
|
383
532
|
if (context)
|
|
384
533
|
return this.requestWithin(message, token, context, signal);
|
|
385
534
|
const operation = connectionReadContext(mcpOperation(message.method), this.limits);
|
|
386
|
-
return withConnectionDeadline(this.connectionName, operation
|
|
535
|
+
return withConnectionDeadline(this.connectionName, operation, signal, (scoped) => this.requestWithin(message, token, scoped, scoped.signal));
|
|
387
536
|
}
|
|
388
537
|
async requestWithin(message, token, context, signal) {
|
|
389
538
|
const abort = () => this.close(signal?.reason);
|
|
@@ -425,10 +574,10 @@ class SseSession {
|
|
|
425
574
|
response.body?.cancel().catch(() => {
|
|
426
575
|
return;
|
|
427
576
|
});
|
|
428
|
-
throw new
|
|
577
|
+
throw new ConnectionAuthorizationRequiredError(this.connectionName, this.instanceId, context);
|
|
429
578
|
}
|
|
430
579
|
if (!response.ok) {
|
|
431
|
-
throw new
|
|
580
|
+
throw new ConnectionRequestError(this.connectionName, response.status, await readConnectionErrorText(response, this.connectionName, context), context);
|
|
432
581
|
}
|
|
433
582
|
}
|
|
434
583
|
currentContext() {
|
|
@@ -448,7 +597,7 @@ class SseSession {
|
|
|
448
597
|
const total = (this.streamBytes.get(context) ?? 0) + bytes;
|
|
449
598
|
this.streamBytes.set(context, total);
|
|
450
599
|
if (total > context.maxResponseBytes) {
|
|
451
|
-
throw new
|
|
600
|
+
throw new ConnectionResponseTooLargeError(this.connectionName, context.maxResponseBytes, { ...context, observedReadBytes: total });
|
|
452
601
|
}
|
|
453
602
|
}
|
|
454
603
|
}
|
|
@@ -537,7 +686,7 @@ class McpHttpClient {
|
|
|
537
686
|
await this.dispatch({ jsonrpc: "2.0", method: "notifications/initialized" }, token, signal);
|
|
538
687
|
} catch (error) {
|
|
539
688
|
signal?.throwIfAborted();
|
|
540
|
-
if (error instanceof
|
|
689
|
+
if (error instanceof ConnectionTimeoutError || error instanceof ConnectionResponseTooLargeError) {
|
|
541
690
|
throw error;
|
|
542
691
|
}
|
|
543
692
|
}
|
|
@@ -551,21 +700,21 @@ class McpHttpClient {
|
|
|
551
700
|
const negotiate = message.method === "initialize" && this.initialInitializePending;
|
|
552
701
|
if (message.method === "initialize")
|
|
553
702
|
this.initialInitializePending = false;
|
|
554
|
-
return withConnectionDeadline(this.connectionName, context
|
|
703
|
+
return withConnectionDeadline(this.connectionName, context, signal, async (scoped) => {
|
|
555
704
|
if (this.mode === "sse")
|
|
556
|
-
return this.sseRequest(message, token,
|
|
705
|
+
return this.sseRequest(message, token, scoped);
|
|
557
706
|
try {
|
|
558
|
-
return await this.streamableRequest(message, token,
|
|
707
|
+
return await this.streamableRequest(message, token, scoped);
|
|
559
708
|
} catch (error) {
|
|
560
|
-
|
|
561
|
-
if (negotiate && error instanceof
|
|
562
|
-
await this.openSse(token,
|
|
709
|
+
scoped.signal?.throwIfAborted();
|
|
710
|
+
if (negotiate && error instanceof ConnectionRequestError && FALLBACK_STATUSES.has(error.status)) {
|
|
711
|
+
await this.openSse(token, scoped);
|
|
563
712
|
this.mode = "sse";
|
|
564
|
-
return this.sseRequest(message, token,
|
|
713
|
+
return this.sseRequest(message, token, scoped);
|
|
565
714
|
}
|
|
566
715
|
throw error;
|
|
567
716
|
}
|
|
568
|
-
}
|
|
717
|
+
});
|
|
569
718
|
}
|
|
570
719
|
async streamableRequest(message, token, context) {
|
|
571
720
|
const target = new URL(this.options.transport.url);
|
|
@@ -581,10 +730,10 @@ class McpHttpClient {
|
|
|
581
730
|
response.body?.cancel().catch(() => {
|
|
582
731
|
return;
|
|
583
732
|
});
|
|
584
|
-
throw new
|
|
733
|
+
throw new ConnectionAuthorizationRequiredError(this.connectionName, this.instanceId, context);
|
|
585
734
|
}
|
|
586
735
|
if (!response.ok) {
|
|
587
|
-
throw new
|
|
736
|
+
throw new ConnectionRequestError(this.connectionName, response.status, await readConnectionErrorText(response, this.connectionName, context), context);
|
|
588
737
|
}
|
|
589
738
|
const session = response.headers.get("mcp-session-id");
|
|
590
739
|
if (session)
|
|
@@ -675,9 +824,19 @@ function mcpToolFailure(toolName, result) {
|
|
|
675
824
|
if (isRecord(payload) && typeof payload.error === "string") {
|
|
676
825
|
const details = isRecord(payload.details) ? payload.details : undefined;
|
|
677
826
|
const message = typeof details?.message === "string" ? details.message : payload.error;
|
|
678
|
-
return new AppError2(payload.error,
|
|
827
|
+
return new AppError2(payload.error, {
|
|
828
|
+
message,
|
|
829
|
+
status: 502,
|
|
830
|
+
details,
|
|
831
|
+
hint: typeof payload._hint === "string" ? payload._hint : undefined,
|
|
832
|
+
retryable: typeof payload.retryable === "boolean" ? payload.retryable : undefined
|
|
833
|
+
});
|
|
679
834
|
}
|
|
680
|
-
return new AppError2(UPSTREAM_TOOL_ERROR,
|
|
835
|
+
return new AppError2(UPSTREAM_TOOL_ERROR, {
|
|
836
|
+
message: `External MCP tool "${toolName}" returned an error`,
|
|
837
|
+
status: 502,
|
|
838
|
+
details: payload === undefined ? undefined : { upstream: payload }
|
|
839
|
+
});
|
|
681
840
|
}
|
|
682
841
|
|
|
683
842
|
// src/tools/connections/runtime.ts
|
|
@@ -687,7 +846,7 @@ async function withConnectionToken(params, body) {
|
|
|
687
846
|
try {
|
|
688
847
|
return await body(token);
|
|
689
848
|
} catch (error) {
|
|
690
|
-
if (error instanceof
|
|
849
|
+
if (error instanceof ConnectionAuthorizationRequiredError) {
|
|
691
850
|
params.client?.teardown();
|
|
692
851
|
}
|
|
693
852
|
throw error;
|
|
@@ -929,8 +1088,12 @@ async function mountOpenApiConnection(connection, instanceId, onSkipped) {
|
|
|
929
1088
|
discovery: { timeoutMs, maxResponseBytes },
|
|
930
1089
|
call: { timeoutMs, maxResponseBytes }
|
|
931
1090
|
});
|
|
932
|
-
return withConnectionDeadline(connection.name,
|
|
933
|
-
const requestInit = {
|
|
1091
|
+
return withConnectionDeadline(connection.name, readContext, context.signal, async (scoped) => {
|
|
1092
|
+
const requestInit = {
|
|
1093
|
+
method: entry.method,
|
|
1094
|
+
headers,
|
|
1095
|
+
signal: scoped.signal
|
|
1096
|
+
};
|
|
934
1097
|
if (body && args.body !== undefined) {
|
|
935
1098
|
headers["content-type"] = "application/json";
|
|
936
1099
|
requestInit.body = JSON.stringify(args.body);
|
|
@@ -938,13 +1101,13 @@ async function mountOpenApiConnection(connection, instanceId, onSkipped) {
|
|
|
938
1101
|
const response = await fetchConnection(url, requestInit, allowedHosts, connection.name);
|
|
939
1102
|
if (response.status === 401) {
|
|
940
1103
|
await response.body?.cancel();
|
|
941
|
-
throw new
|
|
1104
|
+
throw new ConnectionAuthorizationRequiredError(connection.name, instanceId, scoped);
|
|
942
1105
|
}
|
|
943
1106
|
if (!response.ok) {
|
|
944
|
-
throw new
|
|
1107
|
+
throw new ConnectionRequestError(connection.name, response.status, await readConnectionErrorText(response, connection.name, scoped), scoped);
|
|
945
1108
|
}
|
|
946
|
-
return readResponse(response, maxResponseBytes, connection.name,
|
|
947
|
-
}
|
|
1109
|
+
return readResponse(response, maxResponseBytes, connection.name, scoped);
|
|
1110
|
+
});
|
|
948
1111
|
})
|
|
949
1112
|
});
|
|
950
1113
|
recordForeignSchemaBytes(definition, jsonSchemaBytes(schema));
|
|
@@ -970,13 +1133,13 @@ async function loadOpenApiDocument(connection, timeoutMs, maxResponseBytes) {
|
|
|
970
1133
|
discovery: { timeoutMs, maxResponseBytes },
|
|
971
1134
|
call: { timeoutMs, maxResponseBytes }
|
|
972
1135
|
});
|
|
973
|
-
const parsed = await withConnectionDeadline(connection.name,
|
|
974
|
-
const response = await fetchConnection(url, { signal }, connectionAllowedHosts(url, connection.allowHosts), connection.name);
|
|
1136
|
+
const parsed = await withConnectionDeadline(connection.name, readContext, undefined, async (scoped) => {
|
|
1137
|
+
const response = await fetchConnection(url, { signal: scoped.signal }, connectionAllowedHosts(url, connection.allowHosts), connection.name);
|
|
975
1138
|
if (!response.ok) {
|
|
976
|
-
throw new
|
|
1139
|
+
throw new ConnectionRequestError(connection.name, response.status, await readConnectionErrorText(response, connection.name, scoped), scoped);
|
|
977
1140
|
}
|
|
978
|
-
return readBoundedJson(response, maxResponseBytes, connection.name,
|
|
979
|
-
}
|
|
1141
|
+
return readBoundedJson(response, maxResponseBytes, connection.name, scoped);
|
|
1142
|
+
});
|
|
980
1143
|
if (!isRecord(parsed))
|
|
981
1144
|
throw new Error(`OpenAPI spec at ${url} is not an object`);
|
|
982
1145
|
return { document: parsed, url: url.toString() };
|
|
@@ -1206,13 +1369,13 @@ async function mountConnections(connections, options = {}) {
|
|
|
1206
1369
|
}
|
|
1207
1370
|
const limit = options.budget?.maxTools;
|
|
1208
1371
|
if (limit !== undefined && tools.length > limit) {
|
|
1209
|
-
throw new
|
|
1372
|
+
throw new ConnectionBudgetExceededError(limit, tools.length);
|
|
1210
1373
|
}
|
|
1211
1374
|
const schemaLimit = options.budget?.maxSchemaBytes;
|
|
1212
1375
|
if (schemaLimit !== undefined) {
|
|
1213
1376
|
const schemaBytes = tools.reduce((total, tool) => total + foreignSchemaBytes(tool), 0);
|
|
1214
1377
|
if (schemaBytes > schemaLimit) {
|
|
1215
|
-
throw new
|
|
1378
|
+
throw new ConnectionBudgetExceededError(schemaLimit, schemaBytes, "schema bytes");
|
|
1216
1379
|
}
|
|
1217
1380
|
}
|
|
1218
1381
|
return tools;
|
|
@@ -1231,12 +1394,12 @@ function instanceIdOf(connection) {
|
|
|
1231
1394
|
return connectionInstanceId(connection.name, url, connection.instanceKey);
|
|
1232
1395
|
}
|
|
1233
1396
|
export {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1397
|
+
ConnectionAuthorizationRequiredError,
|
|
1398
|
+
ConnectionBudgetExceededError,
|
|
1399
|
+
ConnectionRequestError,
|
|
1400
|
+
ConnectionResponseTooLargeError,
|
|
1401
|
+
ConnectionTimeoutError,
|
|
1402
|
+
ConnectionUrlError,
|
|
1240
1403
|
defineMcpClientConnection,
|
|
1241
1404
|
defineOpenApiConnection,
|
|
1242
1405
|
mountConnections
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
ViewFileErrorSchema2,
|
|
7
7
|
ViewFileOutputSchema2,
|
|
8
8
|
ViewFileInputSchema2
|
|
9
|
-
} from "../../index-
|
|
9
|
+
} from "../../index-0gxvns6s.js";
|
|
10
10
|
import {
|
|
11
11
|
coerceJsonArgs2
|
|
12
|
-
} from "../../index-
|
|
12
|
+
} from "../../index-6yxhe58g.js";
|
|
13
13
|
export {
|
|
14
14
|
AsyncOperationCancelResultSchema2 as AsyncOperationCancelResultSchema,
|
|
15
15
|
McpAnnotationsSchema2 as McpAnnotationsSchema,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import"../../index-
|
|
2
|
-
import"../../index-
|
|
3
|
-
import"../../index-
|
|
1
|
+
import"../../index-j9gxbztg.js";
|
|
2
|
+
import"../../index-rpzewktb.js";
|
|
3
|
+
import"../../index-556g5hsh.js";
|
|
4
|
+
import"../../index-2k91mewf.js";
|
|
4
5
|
import"../../index-yex7eg1v.js";
|
|
5
|
-
import"../../index-
|
|
6
|
+
import"../../index-6yxhe58g.js";
|
|
6
7
|
import"../../index-ct75c3at.js";
|
|
7
|
-
import"../../index-
|
|
8
|
-
import"../../index-
|
|
8
|
+
import"../../index-r393tnfp.js";
|
|
9
|
+
import"../../index-wbhdzxar.js";
|
|
9
10
|
import {
|
|
10
11
|
createToolInvoker2
|
|
11
|
-
} from "../../index-
|
|
12
|
+
} from "../../index-f199nfq5.js";
|
|
12
13
|
import"../../index-7n68nmc6.js";
|
|
13
14
|
export {
|
|
14
15
|
createToolInvoker2 as createToolInvoker
|
|
@@ -7,6 +7,6 @@ export { buildMcpServer, type DirectMcpSurfaceConfig, type FiniteMcpSurfaceConfi
|
|
|
7
7
|
export type { IncompatibleSchemaPolicy, McpSchemaValidationConfig, McpSurfaceDefinition, McpSurfaceRegistry, ValidateMcpSchemasConfig, } from '../../tools/mcp/prepare.js';
|
|
8
8
|
export { createStdioMcpServer, type McpStdioHandle, type StdioAuthConfig, type StdioMcpServerConfig, } from '../../tools/mcp/stdio.js';
|
|
9
9
|
export { bindStdioProcessSignals, type StdioCloseTarget, type StdioProcessSignalsBinding, type StdioProcessSignalsErrorPhase, type StdioProcessSignalsOptions, } from '../../tools/mcp/stdio-signals.js';
|
|
10
|
-
export type { RuntimeToolDefinitionWithoutOutput } from '../../tools/runtime-tool-
|
|
11
|
-
export type { RuntimeMcpPresentation,
|
|
10
|
+
export type { RuntimeToolDefinition, RuntimeToolDefinitionWithOutput, RuntimeToolDefinitionWithoutOutput, } from '../../tools/runtime-tool-declaration.js';
|
|
11
|
+
export type { RuntimeMcpPresentation, RuntimeMcpToolPresenters, } from '../../tools/runtime-tool-mcp.js';
|
|
12
12
|
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/tools/mcp.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,KAAK,eAAe,EACpB,cAAc,EACd,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,GAChC,MAAM,+BAA+B,CAAC;AACvC,YAAY,
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/tools/mcp.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,KAAK,eAAe,EACpB,cAAc,EACd,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,GAChC,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,qBAAqB,EACrB,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EACV,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC"}
|
|
@@ -14,18 +14,19 @@ import {
|
|
|
14
14
|
createMcpHttpRoute2,
|
|
15
15
|
createStdioMcpServer2,
|
|
16
16
|
bindStdioProcessSignals2
|
|
17
|
-
} from "../../index-
|
|
18
|
-
import"../../index-
|
|
19
|
-
import"../../index-
|
|
17
|
+
} from "../../index-916yh4e2.js";
|
|
18
|
+
import"../../index-j9gxbztg.js";
|
|
19
|
+
import"../../index-rpzewktb.js";
|
|
20
20
|
import"../../index-yex7eg1v.js";
|
|
21
|
-
import"../../index-
|
|
22
|
-
import"../../index-
|
|
23
|
-
import"../../index-
|
|
24
|
-
import"../../index-
|
|
21
|
+
import"../../index-6yxhe58g.js";
|
|
22
|
+
import"../../index-r393tnfp.js";
|
|
23
|
+
import"../../index-2k91mewf.js";
|
|
24
|
+
import"../../index-556g5hsh.js";
|
|
25
|
+
import"../../index-wbhdzxar.js";
|
|
25
26
|
import"../../index-sznqf8fx.js";
|
|
26
27
|
import"../../index-e6c2spsd.js";
|
|
27
|
-
import"../../index-
|
|
28
|
-
import"../../index-
|
|
28
|
+
import"../../index-pz3y6b6g.js";
|
|
29
|
+
import"../../index-yvfk3y36.js";
|
|
29
30
|
import"../../index-7n68nmc6.js";
|
|
30
31
|
export {
|
|
31
32
|
EXT_APPS_BUNDLE_PLACEHOLDER2 as EXT_APPS_BUNDLE_PLACEHOLDER,
|
|
@@ -41,7 +41,6 @@ export { createRuntimeToolFactory, defineRuntimeTool, type RuntimeAgentModelOutp
|
|
|
41
41
|
export { flattenToolJsonSchema, type ToolPresentationSchema, } from '../tools/schema/flatten.js';
|
|
42
42
|
export { findNonPortableFormats, type NonPortableFormat, PORTABLE_JSON_SCHEMA_FORMATS, } from '../tools/schema/portable-formats.js';
|
|
43
43
|
export { findUntypedProperties, type UntypedProperty, } from '../tools/schema/untyped-properties.js';
|
|
44
|
-
export type { ToolSurfaceDefinition } from '../tools/surface.js';
|
|
45
44
|
export { createToolLogger, type ToolCallRecord, type ToolLoggerConfig, } from '../tools/tool-logger.js';
|
|
46
45
|
export { createToolkit, type Toolkit } from '../tools/toolkit.js';
|
|
47
46
|
export { type DefineDownloadToolConfig, defineDownloadTool, } from '../tools/transfer/define-download-tool.js';
|