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
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import {
|
|
2
|
+
raceAbort
|
|
3
|
+
} from "./index-b0kddvzw.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/secure-fetch.ts
|
|
6
|
+
import { lookup } from "node:dns/promises";
|
|
7
|
+
import { request as httpRequest } from "node:http";
|
|
8
|
+
import { request as httpsRequest } from "node:https";
|
|
9
|
+
import { isIP } from "node:net";
|
|
10
|
+
var NUMERIC_HOST = /^(0x[0-9a-f]+|[0-9.]+)$/i;
|
|
11
|
+
var MAX_REDIRECTS = 5;
|
|
12
|
+
function assertHttpUrl(url) {
|
|
13
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
14
|
+
throw new Error(`refusing to fetch a non-http(s) URL (${url.protocol})`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function mappedIpv4FromIpv6(ip) {
|
|
18
|
+
const rest = ip.startsWith("::ffff:") ? ip.slice("::ffff:".length) : ip.startsWith("0:0:0:0:0:ffff:") ? ip.slice("0:0:0:0:0:ffff:".length) : null;
|
|
19
|
+
if (rest === null)
|
|
20
|
+
return null;
|
|
21
|
+
if (isIP(rest) === 4)
|
|
22
|
+
return rest;
|
|
23
|
+
const [hiRaw, loRaw, extra] = rest.split(":");
|
|
24
|
+
if (hiRaw === undefined || loRaw === undefined || extra !== undefined)
|
|
25
|
+
return null;
|
|
26
|
+
if (!/^[0-9a-f]{1,4}$/i.test(hiRaw) || !/^[0-9a-f]{1,4}$/i.test(loRaw))
|
|
27
|
+
return null;
|
|
28
|
+
const hi = Number.parseInt(hiRaw, 16);
|
|
29
|
+
const lo = Number.parseInt(loRaw, 16);
|
|
30
|
+
return [hi >> 8, hi & 255, lo >> 8, lo & 255].join(".");
|
|
31
|
+
}
|
|
32
|
+
function ipv6Words(ip) {
|
|
33
|
+
const halves = ip.toLowerCase().split("::");
|
|
34
|
+
if (halves.length > 2)
|
|
35
|
+
return null;
|
|
36
|
+
const head = halves[0] ? halves[0].split(":") : [];
|
|
37
|
+
const tail = halves[1] ? halves[1].split(":") : [];
|
|
38
|
+
const missing = 8 - head.length - tail.length;
|
|
39
|
+
if (halves.length === 1 && missing !== 0 || missing < 0)
|
|
40
|
+
return null;
|
|
41
|
+
const parts = halves.length === 2 ? [...head, ...Array(missing).fill("0"), ...tail] : head;
|
|
42
|
+
if (parts.length !== 8)
|
|
43
|
+
return null;
|
|
44
|
+
const words = [];
|
|
45
|
+
for (const part of parts) {
|
|
46
|
+
if (!/^[0-9a-f]{1,4}$/i.test(part))
|
|
47
|
+
return null;
|
|
48
|
+
words.push(Number.parseInt(part, 16));
|
|
49
|
+
}
|
|
50
|
+
return words;
|
|
51
|
+
}
|
|
52
|
+
function isPrivateIp(ip) {
|
|
53
|
+
const normalized = ip.replace(/^\[|\]$/g, "");
|
|
54
|
+
const family = isIP(normalized);
|
|
55
|
+
if (family === 4) {
|
|
56
|
+
const [a, b] = normalized.split(".").map(Number);
|
|
57
|
+
if (a === undefined || b === undefined)
|
|
58
|
+
return true;
|
|
59
|
+
const value = normalized.split(".").map(Number).reduce((total, octet) => total * 256 + octet, 0);
|
|
60
|
+
const inCidr = (base, prefix) => {
|
|
61
|
+
const baseValue = base.split(".").map(Number).reduce((total, octet) => total * 256 + octet, 0);
|
|
62
|
+
const size = 2 ** (32 - prefix);
|
|
63
|
+
return value >= baseValue && value < baseValue + size;
|
|
64
|
+
};
|
|
65
|
+
const blockedRanges = [
|
|
66
|
+
["0.0.0.0", 8],
|
|
67
|
+
["10.0.0.0", 8],
|
|
68
|
+
["100.64.0.0", 10],
|
|
69
|
+
["127.0.0.0", 8],
|
|
70
|
+
["169.254.0.0", 16],
|
|
71
|
+
["172.16.0.0", 12],
|
|
72
|
+
["192.0.0.0", 24],
|
|
73
|
+
["192.0.2.0", 24],
|
|
74
|
+
["192.31.196.0", 24],
|
|
75
|
+
["192.52.193.0", 24],
|
|
76
|
+
["192.88.99.0", 24],
|
|
77
|
+
["192.168.0.0", 16],
|
|
78
|
+
["192.175.48.0", 24],
|
|
79
|
+
["198.18.0.0", 15],
|
|
80
|
+
["198.51.100.0", 24],
|
|
81
|
+
["203.0.113.0", 24],
|
|
82
|
+
["224.0.0.0", 4],
|
|
83
|
+
["240.0.0.0", 4]
|
|
84
|
+
];
|
|
85
|
+
return blockedRanges.some(([base, prefix]) => inCidr(base, prefix));
|
|
86
|
+
}
|
|
87
|
+
if (family === 6) {
|
|
88
|
+
const lower = normalized.toLowerCase();
|
|
89
|
+
const mapped = mappedIpv4FromIpv6(lower);
|
|
90
|
+
if (mapped)
|
|
91
|
+
return isPrivateIp(mapped);
|
|
92
|
+
const words = ipv6Words(lower);
|
|
93
|
+
if (!words)
|
|
94
|
+
return true;
|
|
95
|
+
const [first, second, third] = words;
|
|
96
|
+
if (first === undefined || second === undefined || third === undefined)
|
|
97
|
+
return true;
|
|
98
|
+
return first === 0 || first === 100 && second === 65435 && third === 1 || first === 256 && second === 0 || first === 8193 && (second <= 511 || second === 3512) || first === 8194 || first === 16383 || first === 24320 || (first & 65024) === 64512 || (first & 65472) === 65152 || (first & 65280) === 65280;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
async function assertPublicUrl(url, signal) {
|
|
103
|
+
await resolvePublicAddress(url, signal);
|
|
104
|
+
}
|
|
105
|
+
async function fetchGuarded(start, allowPrivate, options = {}) {
|
|
106
|
+
const timeoutMs = options.timeoutMs ?? 15000;
|
|
107
|
+
const bodyTimeoutMs = options.bodyTimeoutMs ?? 120000;
|
|
108
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
109
|
+
throw new Error("timeoutMs must be positive");
|
|
110
|
+
}
|
|
111
|
+
if (!Number.isFinite(bodyTimeoutMs) || bodyTimeoutMs <= 0) {
|
|
112
|
+
throw new Error("bodyTimeoutMs must be positive");
|
|
113
|
+
}
|
|
114
|
+
const controller = new AbortController;
|
|
115
|
+
const signal = options.signal ? AbortSignal.any([options.signal, controller.signal]) : controller.signal;
|
|
116
|
+
const headerTimer = setTimeout(() => {
|
|
117
|
+
controller.abort(new Error(`fetch did not produce response headers within ${timeoutMs}ms`));
|
|
118
|
+
}, timeoutMs);
|
|
119
|
+
headerTimer.unref?.();
|
|
120
|
+
let settled = false;
|
|
121
|
+
try {
|
|
122
|
+
let url = start;
|
|
123
|
+
for (let hop = 0;hop <= MAX_REDIRECTS; hop++) {
|
|
124
|
+
if (allowPrivate)
|
|
125
|
+
assertHttpUrl(url);
|
|
126
|
+
else
|
|
127
|
+
await assertPublicUrl(url, signal);
|
|
128
|
+
const res = await fetch(url, { redirect: "manual", signal });
|
|
129
|
+
const location = res.status >= 300 && res.status < 400 ? res.headers.get("location") : null;
|
|
130
|
+
if (location === null) {
|
|
131
|
+
settled = true;
|
|
132
|
+
clearTimeout(headerTimer);
|
|
133
|
+
const bodyTimer = setTimeout(() => {
|
|
134
|
+
controller.abort(new Error(`fetch body was not consumed within ${bodyTimeoutMs}ms`));
|
|
135
|
+
}, bodyTimeoutMs);
|
|
136
|
+
bodyTimer.unref?.();
|
|
137
|
+
return res;
|
|
138
|
+
}
|
|
139
|
+
await res.body?.cancel();
|
|
140
|
+
url = new URL(location, url);
|
|
141
|
+
}
|
|
142
|
+
throw new Error("too many redirects");
|
|
143
|
+
} finally {
|
|
144
|
+
if (!settled)
|
|
145
|
+
clearTimeout(headerTimer);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
class PrivateAddressRefusal extends Error {
|
|
150
|
+
name = "PrivateAddressRefusal";
|
|
151
|
+
}
|
|
152
|
+
async function resolvePublicAddress(url, signal) {
|
|
153
|
+
assertHttpUrl(url);
|
|
154
|
+
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
155
|
+
if (!host)
|
|
156
|
+
throw new Error("refusing to fetch a URL with no host");
|
|
157
|
+
const ipFamily = isIP(host);
|
|
158
|
+
if (ipFamily) {
|
|
159
|
+
if (isPrivateIp(host))
|
|
160
|
+
throw new PrivateAddressRefusal("refusing to fetch a private address");
|
|
161
|
+
return { address: host, family: ipFamily === 6 ? 6 : 4 };
|
|
162
|
+
}
|
|
163
|
+
if (NUMERIC_HOST.test(host)) {
|
|
164
|
+
throw new PrivateAddressRefusal("refusing to fetch a non-canonical numeric host");
|
|
165
|
+
}
|
|
166
|
+
if (host === "localhost" || host.endsWith(".local") || host.endsWith(".internal")) {
|
|
167
|
+
throw new PrivateAddressRefusal("refusing to fetch an internal host");
|
|
168
|
+
}
|
|
169
|
+
const pending = lookup(host, { all: true });
|
|
170
|
+
const records = signal ? await raceAbort(pending, signal) : await pending;
|
|
171
|
+
for (const record of records) {
|
|
172
|
+
if (isPrivateIp(record.address)) {
|
|
173
|
+
throw new PrivateAddressRefusal("refusing to fetch a host that resolves to a private address");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const record = records[0];
|
|
177
|
+
if (!record)
|
|
178
|
+
throw new Error("public hostname resolved to no addresses");
|
|
179
|
+
return { address: record.address, family: record.family === 6 ? 6 : 4 };
|
|
180
|
+
}
|
|
181
|
+
async function fetchPinnedDocument(start, options) {
|
|
182
|
+
if (!Number.isInteger(options.maxBytes) || options.maxBytes < 1) {
|
|
183
|
+
throw new Error("maxBytes must be a positive integer");
|
|
184
|
+
}
|
|
185
|
+
if (!Number.isFinite(options.timeoutMs) || options.timeoutMs <= 0) {
|
|
186
|
+
throw new Error("timeoutMs must be positive");
|
|
187
|
+
}
|
|
188
|
+
let url = start;
|
|
189
|
+
const maxRedirects = options.maxRedirects ?? MAX_REDIRECTS;
|
|
190
|
+
if (!Number.isInteger(maxRedirects) || maxRedirects < 0) {
|
|
191
|
+
throw new Error("maxRedirects must be a non-negative integer");
|
|
192
|
+
}
|
|
193
|
+
const signal = AbortSignal.timeout(options.timeoutMs);
|
|
194
|
+
for (let hop = 0;hop <= maxRedirects; hop++) {
|
|
195
|
+
if (options.requireHttps && url.protocol !== "https:") {
|
|
196
|
+
throw new Error("document URL and every redirect must use https");
|
|
197
|
+
}
|
|
198
|
+
if (url.username || url.password) {
|
|
199
|
+
throw new Error("document URL cannot contain credentials");
|
|
200
|
+
}
|
|
201
|
+
const resolved = await resolvePublicAddress(url, signal);
|
|
202
|
+
const transport = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
203
|
+
const response = await new Promise((resolve, reject) => {
|
|
204
|
+
const request = transport({
|
|
205
|
+
protocol: url.protocol,
|
|
206
|
+
hostname: resolved.address,
|
|
207
|
+
family: resolved.family,
|
|
208
|
+
port: url.port || undefined,
|
|
209
|
+
path: `${url.pathname}${url.search}`,
|
|
210
|
+
method: "GET",
|
|
211
|
+
signal,
|
|
212
|
+
servername: url.hostname,
|
|
213
|
+
headers: {
|
|
214
|
+
host: url.host,
|
|
215
|
+
accept: "application/json",
|
|
216
|
+
...options.headers
|
|
217
|
+
}
|
|
218
|
+
}, (incoming) => {
|
|
219
|
+
const headers = new Headers;
|
|
220
|
+
for (const [name, value] of Object.entries(incoming.headers)) {
|
|
221
|
+
if (Array.isArray(value)) {
|
|
222
|
+
for (const item of value)
|
|
223
|
+
headers.append(name, item);
|
|
224
|
+
} else if (value !== undefined) {
|
|
225
|
+
headers.set(name, value);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const chunks = [];
|
|
229
|
+
let total = 0;
|
|
230
|
+
incoming.on("data", (chunk) => {
|
|
231
|
+
total += chunk.byteLength;
|
|
232
|
+
if (total > options.maxBytes) {
|
|
233
|
+
incoming.destroy(new Error("response body exceeds configured byte limit"));
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
chunks.push(chunk);
|
|
237
|
+
});
|
|
238
|
+
incoming.once("error", reject);
|
|
239
|
+
incoming.once("end", () => {
|
|
240
|
+
const body = new Uint8Array(total);
|
|
241
|
+
let offset = 0;
|
|
242
|
+
for (const chunk of chunks) {
|
|
243
|
+
body.set(chunk, offset);
|
|
244
|
+
offset += chunk.byteLength;
|
|
245
|
+
}
|
|
246
|
+
resolve({ status: incoming.statusCode ?? 0, headers, body, url });
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
request.once("error", reject);
|
|
250
|
+
request.end();
|
|
251
|
+
});
|
|
252
|
+
if (response.status < 300 || response.status >= 400)
|
|
253
|
+
return response;
|
|
254
|
+
const location = response.headers.get("location");
|
|
255
|
+
if (!location)
|
|
256
|
+
return response;
|
|
257
|
+
url = new URL(location, url);
|
|
258
|
+
}
|
|
259
|
+
throw new Error("too many redirects");
|
|
260
|
+
}
|
|
261
|
+
async function readCapped(res, max) {
|
|
262
|
+
const reader = res.body?.getReader();
|
|
263
|
+
if (!reader)
|
|
264
|
+
return Buffer.alloc(0);
|
|
265
|
+
const chunks = [];
|
|
266
|
+
let total = 0;
|
|
267
|
+
try {
|
|
268
|
+
while (true) {
|
|
269
|
+
const { done, value } = await reader.read();
|
|
270
|
+
if (done)
|
|
271
|
+
break;
|
|
272
|
+
total += value.length;
|
|
273
|
+
if (total > max) {
|
|
274
|
+
await reader.cancel();
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
chunks.push(value);
|
|
278
|
+
}
|
|
279
|
+
} finally {
|
|
280
|
+
reader.releaseLock();
|
|
281
|
+
}
|
|
282
|
+
return Buffer.concat(chunks);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export { fetchGuarded, PrivateAddressRefusal, fetchPinnedDocument, readCapped };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
attemptExclusiveLock
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-dsnjzb62.js";
|
|
4
|
+
import {
|
|
5
|
+
sleep
|
|
6
|
+
} from "./index-eemvahkc.js";
|
|
4
7
|
|
|
5
8
|
// src/internal/with-exclusive-lock.ts
|
|
6
9
|
class ExclusiveLockError2 extends Error {
|
|
@@ -16,7 +19,6 @@ class ExclusiveLockError2 extends Error {
|
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
19
|
-
var DEFAULT_OWNERLESS_GRACE_MS = 5000;
|
|
20
22
|
var FIRST_RETRY_MS = 10;
|
|
21
23
|
var MAX_RETRY_MS = 100;
|
|
22
24
|
function nonNegative(name, value, fallback) {
|
|
@@ -39,21 +41,10 @@ function describeEvidence(diagnosis) {
|
|
|
39
41
|
const identity = diagnosis.identity === undefined ? "" : `, identity ${diagnosis.identity}`;
|
|
40
42
|
return ` (${diagnosis.attribution}, liveness ${diagnosis.liveness}${identity})`;
|
|
41
43
|
}
|
|
42
|
-
function pause(ms, signal) {
|
|
43
|
-
return new Promise((resolve) => {
|
|
44
|
-
const done = () => {
|
|
45
|
-
clearTimeout(timer);
|
|
46
|
-
signal?.removeEventListener("abort", done);
|
|
47
|
-
resolve();
|
|
48
|
-
};
|
|
49
|
-
const timer = setTimeout(done, ms);
|
|
50
|
-
signal?.addEventListener("abort", done, { once: true });
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
44
|
async function withExclusiveLock2(path, run, options = {}) {
|
|
54
45
|
const label = options.label ?? path;
|
|
55
46
|
const timeoutMs = nonNegative("timeoutMs", options.timeoutMs, DEFAULT_TIMEOUT_MS);
|
|
56
|
-
const ownerlessGraceMs = options.ownerlessGraceMs === null ?
|
|
47
|
+
const ownerlessGraceMs = options.ownerlessGraceMs === undefined || options.ownerlessGraceMs === null ? options.ownerlessGraceMs : nonNegative("ownerlessGraceMs", options.ownerlessGraceMs, 0);
|
|
57
48
|
const mode = options.mode ?? 384;
|
|
58
49
|
if (!Number.isInteger(mode) || mode < 0 || mode > 511)
|
|
59
50
|
throw new RangeError("[stitchkit] withExclusiveLock: mode must be permission bits from 0000 to 0777");
|
|
@@ -108,7 +99,9 @@ async function withExclusiveLock2(path, run, options = {}) {
|
|
|
108
99
|
const holder = attempt.diagnosis?.owner ?? null;
|
|
109
100
|
throw new ExclusiveLockError2("LOCK_TIMEOUT", label, holder, `[stitchkit] the lock on "${label}" is held by ${describeHolder(holder)}${describeEvidence(attempt.diagnosis)}; gave up after ${timeoutMs} ms`, { cause: attempt.diagnosis?.cause ?? attempt.error });
|
|
110
101
|
}
|
|
111
|
-
await
|
|
102
|
+
await sleep(Math.min(delay * (0.5 + Math.random() / 2), remaining), signal).catch(() => {
|
|
103
|
+
return;
|
|
104
|
+
});
|
|
112
105
|
delay = Math.min(delay * 2, MAX_RETRY_MS);
|
|
113
106
|
}
|
|
114
107
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppError2
|
|
3
|
+
} from "./index-j9gxbztg.js";
|
|
4
|
+
|
|
5
|
+
// src/tools/internal/tool-error-projection.ts
|
|
6
|
+
var TOOL_ERROR_PROJECTION = Symbol.for("stitchkit.toolErrorProjection");
|
|
7
|
+
function projectedToolError(error) {
|
|
8
|
+
if (typeof error !== "object" || error === null)
|
|
9
|
+
return;
|
|
10
|
+
const project = Reflect.get(error, TOOL_ERROR_PROJECTION);
|
|
11
|
+
if (typeof project !== "function")
|
|
12
|
+
return;
|
|
13
|
+
const projected = Reflect.apply(project, error, []);
|
|
14
|
+
return AppError2.is(projected) ? projected : undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { TOOL_ERROR_PROJECTION, projectedToolError };
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
AgentStoreEventEnvelopeSchema2,
|
|
3
3
|
AgentStoreEventPageSchema2,
|
|
4
4
|
AgentRecoverablePageSchema2
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-0gs4ymfj.js";
|
|
6
6
|
import {
|
|
7
7
|
AgentRecordIdSchema2,
|
|
8
8
|
AgentMessageSchema2
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
isActiveRunState,
|
|
17
17
|
replaceMessage,
|
|
18
18
|
createAgentRuntimeStore2
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-d2h99n7d.js";
|
|
20
20
|
|
|
21
21
|
// src/agent-runtime/store-memory.ts
|
|
22
22
|
import { z } from "zod";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
jsonDataRefusal
|
|
3
|
+
} from "./index-m6w6jtda.js";
|
|
4
|
+
import {
|
|
5
|
+
serializeCanonicalJson
|
|
6
|
+
} from "./index-zsvzhjtk.js";
|
|
7
|
+
|
|
8
|
+
// src/primitives/canonical-json.ts
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
var CanonicalJsonOptionsSchema = z.strictObject({
|
|
11
|
+
maxDepth: z.number().int().min(0).max(100).default(100),
|
|
12
|
+
maxNodes: z.number().int().positive().default(1e5),
|
|
13
|
+
maxBytes: z.number().int().positive().default(1024 * 1024)
|
|
14
|
+
});
|
|
15
|
+
var MESSAGES = {
|
|
16
|
+
cycle: "Value contains a cycle",
|
|
17
|
+
"negative-zero": "Value contains -0, which JSON cannot carry",
|
|
18
|
+
depth: "Value is nested deeper than maxDepth",
|
|
19
|
+
nodes: "Value has more nodes than maxNodes",
|
|
20
|
+
bytes: "Value is longer than maxBytes in UTF-8",
|
|
21
|
+
"not-json": "Expected bounded plain JSON: dense arrays, finite numbers, plain objects, no accessors"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
class CanonicalJsonError2 extends TypeError {
|
|
25
|
+
reason;
|
|
26
|
+
constructor(reason) {
|
|
27
|
+
super(MESSAGES[reason]);
|
|
28
|
+
this.reason = reason;
|
|
29
|
+
this.name = "CanonicalJsonError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function canonicalJson2(value, options = {}) {
|
|
33
|
+
return serialize(value, options, false);
|
|
34
|
+
}
|
|
35
|
+
function canonicalZodJson(value, options = {}) {
|
|
36
|
+
return serialize(value, options, true);
|
|
37
|
+
}
|
|
38
|
+
function serialize(value, options, zodJson) {
|
|
39
|
+
const limits = CanonicalJsonOptionsSchema.parse(options);
|
|
40
|
+
const snapshot = {};
|
|
41
|
+
const refusal = jsonDataRefusal(value, { ...limits, omitObjectUndefined: true, zodJson }, snapshot);
|
|
42
|
+
if (refusal !== undefined)
|
|
43
|
+
throw new CanonicalJsonError2(refusal);
|
|
44
|
+
return serializeCanonicalJson(snapshot.value);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { CanonicalJsonError2, canonicalJson2, canonicalZodJson };
|
|
@@ -34,6 +34,28 @@ function acceptsRawString(schema) {
|
|
|
34
34
|
}
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
37
|
+
function arrayMembers(schema) {
|
|
38
|
+
if (schema instanceof z.ZodArray)
|
|
39
|
+
return [schema];
|
|
40
|
+
if (schema instanceof z.ZodOptional || schema instanceof z.ZodNullable || schema instanceof z.ZodDefault) {
|
|
41
|
+
return arrayMembers(schema.unwrap());
|
|
42
|
+
}
|
|
43
|
+
if (schema instanceof z.ZodUnion) {
|
|
44
|
+
return schema.def.options.flatMap((option) => arrayMembers(option));
|
|
45
|
+
}
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
function writtenAsList(text, schema) {
|
|
49
|
+
if (!text.trimStart().startsWith("["))
|
|
50
|
+
return false;
|
|
51
|
+
let parsed;
|
|
52
|
+
try {
|
|
53
|
+
parsed = safeJsonParse(text);
|
|
54
|
+
} catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return Array.isArray(parsed) && arrayMembers(schema).some((m) => m.safeParse(parsed).success);
|
|
58
|
+
}
|
|
37
59
|
function matchingVariant(union, value) {
|
|
38
60
|
const disc = union.def.discriminator;
|
|
39
61
|
const tag = value[disc];
|
|
@@ -48,16 +70,27 @@ function matchingVariant(union, value) {
|
|
|
48
70
|
}
|
|
49
71
|
return;
|
|
50
72
|
}
|
|
51
|
-
function coerceValue(value, schema) {
|
|
73
|
+
function coerceValue(value, schema, path) {
|
|
52
74
|
if (!schema)
|
|
53
75
|
return value;
|
|
54
76
|
if (schema instanceof z.ZodOptional || schema instanceof z.ZodNullable || schema instanceof z.ZodDefault) {
|
|
55
|
-
return coerceValue(value, schema.unwrap());
|
|
77
|
+
return coerceValue(value, schema.unwrap(), path);
|
|
56
78
|
}
|
|
57
79
|
let current = value;
|
|
58
80
|
if (typeof current === "string" && needsJsonCoercion(schema)) {
|
|
59
|
-
if (acceptsRawString(schema))
|
|
81
|
+
if (acceptsRawString(schema)) {
|
|
82
|
+
if (writtenAsList(current, schema)) {
|
|
83
|
+
throw new z.ZodError([
|
|
84
|
+
{
|
|
85
|
+
code: "custom",
|
|
86
|
+
path: [...path],
|
|
87
|
+
message: `${path.join(".")} is a list written as text — pass the array itself, not JSON written as text`,
|
|
88
|
+
input: current
|
|
89
|
+
}
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
60
92
|
return current;
|
|
93
|
+
}
|
|
61
94
|
try {
|
|
62
95
|
current = safeJsonParse(current);
|
|
63
96
|
} catch {
|
|
@@ -68,21 +101,21 @@ function coerceValue(value, schema) {
|
|
|
68
101
|
const shape = schema.shape;
|
|
69
102
|
const out = {};
|
|
70
103
|
for (const [key, item] of Object.entries(current)) {
|
|
71
|
-
out[key] = coerceValue(item, shape[key]);
|
|
104
|
+
out[key] = coerceValue(item, shape[key], [...path, key]);
|
|
72
105
|
}
|
|
73
106
|
return out;
|
|
74
107
|
}
|
|
75
108
|
if (schema instanceof z.ZodArray && Array.isArray(current)) {
|
|
76
|
-
return current.map((item) => coerceValue(item, schema.element));
|
|
109
|
+
return current.map((item, index) => coerceValue(item, schema.element, [...path, index]));
|
|
77
110
|
}
|
|
78
111
|
if (schema instanceof z.ZodDiscriminatedUnion && isRecord(current)) {
|
|
79
112
|
const variant = matchingVariant(schema, current);
|
|
80
|
-
return variant ? coerceValue(current, variant) : current;
|
|
113
|
+
return variant ? coerceValue(current, variant, path) : current;
|
|
81
114
|
}
|
|
82
115
|
return current;
|
|
83
116
|
}
|
|
84
117
|
function coerceJsonArgs2(args, schema) {
|
|
85
|
-
const coerced = coerceValue(args, schema);
|
|
118
|
+
const coerced = coerceValue(args, schema, []);
|
|
86
119
|
return isRecord(coerced) ? coerced : args;
|
|
87
120
|
}
|
|
88
121
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppError2,
|
|
3
3
|
STITCH_ERROR_STATUS2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-j9gxbztg.js";
|
|
5
5
|
|
|
6
6
|
// src/agent-runtime/sandbox.ts
|
|
7
7
|
import { z } from "zod";
|
|
@@ -21,16 +21,38 @@ var AgentSandboxGradeSchema2 = z.discriminatedUnion("grade", [
|
|
|
21
21
|
z.object({ grade: z.literal("unavailable"), reason: z.string().min(1) }).strict()
|
|
22
22
|
]);
|
|
23
23
|
var probes = new WeakMap;
|
|
24
|
-
|
|
24
|
+
var PROBE_FAILED = "sandbox probe failed";
|
|
25
|
+
var PROBE_INVALID = "sandbox probe returned no valid grade";
|
|
26
|
+
async function runProbe(sandbox) {
|
|
27
|
+
let value;
|
|
28
|
+
try {
|
|
29
|
+
value = await sandbox.probe();
|
|
30
|
+
} catch (cause) {
|
|
31
|
+
return { grade: { grade: "unavailable", reason: PROBE_FAILED }, cause };
|
|
32
|
+
}
|
|
33
|
+
const parsed = AgentSandboxGradeSchema2.safeParse(value);
|
|
34
|
+
if (parsed.success)
|
|
35
|
+
return { grade: parsed.data };
|
|
36
|
+
return { grade: { grade: "unavailable", reason: PROBE_INVALID }, cause: parsed.error };
|
|
37
|
+
}
|
|
38
|
+
function probeAgentProcessSandboxOutcome(sandbox, options = {}) {
|
|
25
39
|
if (options.refresh)
|
|
26
40
|
probes.delete(sandbox);
|
|
27
41
|
const present = probes.get(sandbox);
|
|
28
42
|
if (present)
|
|
29
43
|
return present;
|
|
30
|
-
const pending =
|
|
44
|
+
const pending = runProbe(sandbox);
|
|
31
45
|
probes.set(sandbox, pending);
|
|
32
46
|
return pending;
|
|
33
47
|
}
|
|
48
|
+
async function probeAgentProcessSandbox2(sandbox, options = {}) {
|
|
49
|
+
const fresh = options.refresh === true || !probes.has(sandbox);
|
|
50
|
+
const outcome = await probeAgentProcessSandboxOutcome(sandbox, options);
|
|
51
|
+
if (fresh && outcome.cause !== undefined) {
|
|
52
|
+
process.emitWarning(new Error("Sandbox probe failed", { cause: outcome.cause }));
|
|
53
|
+
}
|
|
54
|
+
return outcome.grade;
|
|
55
|
+
}
|
|
34
56
|
function missingSandboxRestrictions2(grade, required) {
|
|
35
57
|
if (grade.grade === "unavailable")
|
|
36
58
|
return required;
|
|
@@ -54,7 +76,13 @@ async function recordAgentSandboxProbe2(input) {
|
|
|
54
76
|
|
|
55
77
|
// src/agent-runtime/coding-tool-refusals.ts
|
|
56
78
|
function codingRefusal(code, message, options = {}) {
|
|
57
|
-
throw new AppError2(code,
|
|
79
|
+
throw new AppError2(code, {
|
|
80
|
+
message,
|
|
81
|
+
status: STITCH_ERROR_STATUS2[code],
|
|
82
|
+
details: { message, ...options.details },
|
|
83
|
+
hint: options.hint,
|
|
84
|
+
..."cause" in options && { cause: options.cause }
|
|
85
|
+
});
|
|
58
86
|
}
|
|
59
87
|
function codingPathRefusal(code, message, path, options = {}) {
|
|
60
88
|
codingRefusal(code, message, {
|
|
@@ -98,4 +126,4 @@ function refuseUnknownSpillReference(reference) {
|
|
|
98
126
|
});
|
|
99
127
|
}
|
|
100
128
|
|
|
101
|
-
export { AgentSandboxRestrictionSchema2, AgentSandboxGradeSchema2, probeAgentProcessSandbox2, missingSandboxRestrictions2, recordAgentSandboxProbe2, codingRefusal, codingPathRefusal, refuseMissingCodingPath, refuseUnknownSpillReference };
|
|
129
|
+
export { AgentSandboxRestrictionSchema2, AgentSandboxGradeSchema2, probeAgentProcessSandboxOutcome, probeAgentProcessSandbox2, missingSandboxRestrictions2, recordAgentSandboxProbe2, codingRefusal, codingPathRefusal, refuseMissingCodingPath, refuseUnknownSpillReference };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./index-ct75c3at.js";
|
|
4
4
|
import {
|
|
5
5
|
AppError2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-j9gxbztg.js";
|
|
7
7
|
import {
|
|
8
8
|
resolvePropagationContext2
|
|
9
9
|
} from "./index-yex7eg1v.js";
|
|
@@ -14,20 +14,23 @@ import {
|
|
|
14
14
|
validateResolvedInputRounds,
|
|
15
15
|
presentationMetadata,
|
|
16
16
|
prepareProjectedMcpTools
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-r393tnfp.js";
|
|
18
18
|
import {
|
|
19
19
|
parseToolCallArguments,
|
|
20
20
|
toolResultFromError,
|
|
21
21
|
observed
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-2k91mewf.js";
|
|
23
23
|
import {
|
|
24
24
|
collectTools2,
|
|
25
25
|
createToolRunner,
|
|
26
26
|
formatToolError
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-wbhdzxar.js";
|
|
28
28
|
import {
|
|
29
29
|
redact2
|
|
30
30
|
} from "./index-e6c2spsd.js";
|
|
31
|
+
import {
|
|
32
|
+
collectToolSurface
|
|
33
|
+
} from "./index-pz3y6b6g.js";
|
|
31
34
|
import {
|
|
32
35
|
DEFAULT_CORS_ALLOW_HEADERS2,
|
|
33
36
|
DEFAULT_PROCESS_SIGNALS,
|
|
@@ -35,9 +38,6 @@ import {
|
|
|
35
38
|
reportSignalError,
|
|
36
39
|
guardSignalCallback
|
|
37
40
|
} from "./index-yk4g8805.js";
|
|
38
|
-
import {
|
|
39
|
-
collectToolSurface
|
|
40
|
-
} from "./index-a0zzh8ak.js";
|
|
41
41
|
import {
|
|
42
42
|
argumentsDigest
|
|
43
43
|
} from "./index-r7a7r7ha.js";
|
|
@@ -374,7 +374,7 @@ async function runRoundFailure(tool, rawArgs, runTool, context, code, message) {
|
|
|
374
374
|
...tool.method,
|
|
375
375
|
outputSchema: undefined,
|
|
376
376
|
handler: () => {
|
|
377
|
-
throw new AppError2(code, message, 400);
|
|
377
|
+
throw new AppError2(code, { message, status: 400 });
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
}, rawArgs, context);
|
|
@@ -653,15 +653,24 @@ function registerMcpTool(server, presentation, descriptor, config) {
|
|
|
653
653
|
finalizeOutput: async (data) => {
|
|
654
654
|
const presented = await present(data);
|
|
655
655
|
if (!isRecord(presented)) {
|
|
656
|
-
throw new AppError2("INTERNAL_SERVER_ERROR",
|
|
656
|
+
throw new AppError2("INTERNAL_SERVER_ERROR", {
|
|
657
|
+
message: "Runtime MCP presenter did not return a result",
|
|
658
|
+
status: 500
|
|
659
|
+
});
|
|
657
660
|
}
|
|
658
661
|
if ("structuredContent" in presented || "isError" in presented) {
|
|
659
|
-
throw new AppError2("INTERNAL_SERVER_ERROR",
|
|
662
|
+
throw new AppError2("INTERNAL_SERVER_ERROR", {
|
|
663
|
+
message: "Runtime MCP presenter cannot set framework-owned structuredContent or isError",
|
|
664
|
+
status: 500
|
|
665
|
+
});
|
|
660
666
|
}
|
|
661
667
|
const structured = format({ ok: true, data }, descriptor.outputMode, name).structuredContent;
|
|
662
668
|
const response = structured === undefined ? presented : { ...presented, structuredContent: structured };
|
|
663
669
|
if (!isCallToolResult(response)) {
|
|
664
|
-
throw new AppError2("INTERNAL_SERVER_ERROR",
|
|
670
|
+
throw new AppError2("INTERNAL_SERVER_ERROR", {
|
|
671
|
+
message: "Runtime MCP presenter returned an invalid CallToolResult",
|
|
672
|
+
status: 500
|
|
673
|
+
});
|
|
665
674
|
}
|
|
666
675
|
return response;
|
|
667
676
|
}
|
|
@@ -700,6 +709,9 @@ function registerMcpTool(server, presentation, descriptor, config) {
|
|
|
700
709
|
}
|
|
701
710
|
|
|
702
711
|
// src/tools/mcp/runtime-tools.ts
|
|
712
|
+
function isMcpPresenter(value) {
|
|
713
|
+
return typeof value === "function";
|
|
714
|
+
}
|
|
703
715
|
function mountPreparedRuntimeMcp(server, tools, config) {
|
|
704
716
|
const runTool = createToolRunner({
|
|
705
717
|
source: "mcp",
|
|
@@ -711,7 +723,8 @@ function mountPreparedRuntimeMcp(server, tools, config) {
|
|
|
711
723
|
onOutputStrip: config.onOutputStrip
|
|
712
724
|
});
|
|
713
725
|
for (const { definition, descriptor } of tools) {
|
|
714
|
-
const present = definition
|
|
726
|
+
const { present: presenters } = definition;
|
|
727
|
+
const present = isRecord(presenters) && isMcpPresenter(presenters.mcp) ? presenters.mcp : undefined;
|
|
715
728
|
registerMcpTool(server, {
|
|
716
729
|
name: definition.name,
|
|
717
730
|
description: definition.description,
|