stitchkit 0.104.2 → 0.105.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +401 -13
- 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 +161 -66
- 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 +78 -17
- 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-269zqj8m.js → index-1ptj98e0.js} +28 -12
- 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-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-f330qqyg.js → index-5c26631f.js} +244 -67
- 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-cazts87s.js +105 -0
- package/dist/{index-g2j7pnak.js → index-cmzvhhtd.js} +5 -2
- package/dist/{index-ssmd41kh.js → index-d2h99n7d.js} +1 -1
- package/dist/{index-z94wht4y.js → index-dky0dcmf.js} +34 -5
- package/dist/index-drs41arz.js +455 -0
- package/dist/{index-za6j7nwy.js → index-dsnjzb62.js} +104 -51
- package/dist/index-eemvahkc.js +21 -0
- package/dist/{index-fa4wg312.js → index-f199nfq5.js} +10 -6
- package/dist/{index-ck71tbcf.js → index-fsw1ybf3.js} +11 -15
- package/dist/{index-fk18k56k.js → index-gr5g3xfw.js} +11 -18
- package/dist/{index-jn9g8xdt.js → index-hjvje0pf.js} +6 -4
- package/dist/index-j4zh647a.js +59 -0
- 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-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-hbd32c6a.js → index-w8etpm8j.js} +38 -89
- package/dist/{index-2hyavjjj.js → index-wbhdzxar.js} +3 -3
- package/dist/{index-4e0ah203.js → index-wdy68sh6.js} +47 -24
- package/dist/{index-hp9d77wk.js → index-x7w1z6pf.js} +15 -4
- package/dist/{index-ptn0g0gj.js → index-y7k2cdgv.js} +21 -20
- 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 +47 -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 +7 -2
- package/dist/process/cleanup.d.ts.map +1 -1
- package/dist/process/command-lifetime.d.ts +6 -1
- package/dist/process/command-lifetime.d.ts.map +1 -1
- package/dist/process/command-owner.d.ts +1 -0
- 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 +68 -2
- package/dist/process/contract.d.ts.map +1 -1
- package/dist/process/group.d.ts +42 -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 +40 -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 +18 -8
- 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 +324 -160
- 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 +1068 -412
- 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
|
@@ -3,19 +3,27 @@ import {
|
|
|
3
3
|
ProcessInstanceSchema2,
|
|
4
4
|
readProcessInstance,
|
|
5
5
|
probeProcessOwner2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-azx12jgv.js";
|
|
7
|
+
import {
|
|
8
|
+
BoundedFileReadError,
|
|
9
|
+
readBoundedFile
|
|
10
|
+
} from "./index-m616f0yz.js";
|
|
11
|
+
import {
|
|
12
|
+
AtomicFilePublicationError2,
|
|
13
|
+
publishAtomicFile
|
|
14
|
+
} from "./index-b56nnscm.js";
|
|
7
15
|
import {
|
|
8
16
|
isRecord
|
|
9
17
|
} from "./index-9jfdm5tg.js";
|
|
10
18
|
|
|
11
19
|
// src/internal/exclusive-lock.ts
|
|
12
|
-
import {
|
|
20
|
+
import { randomUUID } from "node:crypto";
|
|
21
|
+
import { lstat, open, readdir, unlink } from "node:fs/promises";
|
|
13
22
|
import { hostname } from "node:os";
|
|
23
|
+
import { dirname, join } from "node:path";
|
|
14
24
|
import { z } from "zod";
|
|
15
25
|
|
|
16
26
|
// src/internal/exclusive-lock-read.ts
|
|
17
|
-
import { constants } from "node:fs";
|
|
18
|
-
import { open } from "node:fs/promises";
|
|
19
27
|
var OWNER_RECORD_BYTES = 16 * 1024;
|
|
20
28
|
|
|
21
29
|
class LockRecordError extends Error {
|
|
@@ -26,42 +34,28 @@ class LockRecordError extends Error {
|
|
|
26
34
|
this.code = code;
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
var LOCK_CODE = {
|
|
38
|
+
FILE_UNSUPPORTED: "LOCK_UNSAFE_RECORD",
|
|
39
|
+
FILE_NOT_REGULAR: "LOCK_UNSAFE_RECORD",
|
|
40
|
+
FILE_UNSAFE_LINK: "LOCK_UNSAFE_RECORD",
|
|
41
|
+
FILE_TOO_LARGE: "LOCK_RECORD_TOO_LARGE",
|
|
42
|
+
FILE_CHANGED: "LOCK_RECORD_CHANGED"
|
|
43
|
+
};
|
|
44
|
+
async function readLockRecord(path, {
|
|
45
|
+
openDescriptor,
|
|
46
|
+
signal,
|
|
47
|
+
singleLink = true
|
|
48
|
+
} = {}) {
|
|
35
49
|
try {
|
|
36
|
-
signal
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
throw new LockRecordError(
|
|
44
|
-
|
|
45
|
-
const bytes = Buffer.alloc(OWNER_RECORD_BYTES + 1);
|
|
46
|
-
let length = 0;
|
|
47
|
-
while (length < bytes.length) {
|
|
48
|
-
signal?.throwIfAborted();
|
|
49
|
-
const read = await handle.read(bytes, length, bytes.length - length, length);
|
|
50
|
-
if (read.bytesRead === 0)
|
|
51
|
-
break;
|
|
52
|
-
length += read.bytesRead;
|
|
53
|
-
}
|
|
54
|
-
if (length > OWNER_RECORD_BYTES) {
|
|
55
|
-
throw new LockRecordError("LOCK_RECORD_TOO_LARGE", "Lock owner record grew beyond its byte cap");
|
|
56
|
-
}
|
|
57
|
-
const after = await handle.stat();
|
|
58
|
-
signal?.throwIfAborted();
|
|
59
|
-
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs || before.nlink !== after.nlink || length !== after.size) {
|
|
60
|
-
throw new LockRecordError("LOCK_RECORD_CHANGED", "Lock owner record changed during its read");
|
|
61
|
-
}
|
|
62
|
-
return { text: bytes.subarray(0, length).toString("utf8"), info: after };
|
|
63
|
-
} finally {
|
|
64
|
-
await handle.close();
|
|
50
|
+
const { bytes, observation } = await readBoundedFile(path, OWNER_RECORD_BYTES, { rejectSymlinks: true, singleLink, stable: true, ...signal && { signal } }, openDescriptor);
|
|
51
|
+
return {
|
|
52
|
+
text: new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes),
|
|
53
|
+
info: observation
|
|
54
|
+
};
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (error instanceof BoundedFileReadError)
|
|
57
|
+
throw new LockRecordError(LOCK_CODE[error.code], error.message);
|
|
58
|
+
throw error;
|
|
65
59
|
}
|
|
66
60
|
}
|
|
67
61
|
|
|
@@ -104,14 +98,43 @@ async function diagnose(owner, declaredIdentity) {
|
|
|
104
98
|
return { attribution, ...await probeProcessOwner2(owner.pid, owner.process), owner };
|
|
105
99
|
}
|
|
106
100
|
var MAX_RECLAIM_DEPTH = 16;
|
|
101
|
+
var STALE_GUARD_GRACE_MS = 5000;
|
|
102
|
+
var STAGED_NAME = /^\.lock-[0-9a-f-]{36}\.tmp$/;
|
|
103
|
+
async function stagedSibling(path, ino, dev) {
|
|
104
|
+
const directory = dirname(path);
|
|
105
|
+
for (const name of await readdir(directory)) {
|
|
106
|
+
if (!STAGED_NAME.test(name))
|
|
107
|
+
continue;
|
|
108
|
+
const candidate = join(directory, name);
|
|
109
|
+
const info = await lstat(candidate).catch(() => {
|
|
110
|
+
return;
|
|
111
|
+
});
|
|
112
|
+
if (info?.isFile() && info.ino === ino && info.dev === dev)
|
|
113
|
+
return candidate;
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
107
117
|
async function readLockFile(path, onFailure, signal) {
|
|
108
118
|
try {
|
|
109
|
-
|
|
119
|
+
let stagedName;
|
|
120
|
+
let record;
|
|
121
|
+
try {
|
|
122
|
+
record = await readLockRecord(path, { signal });
|
|
123
|
+
} catch (cause) {
|
|
124
|
+
if (!(cause instanceof LockRecordError) || cause.code !== "LOCK_UNSAFE_RECORD")
|
|
125
|
+
throw cause;
|
|
126
|
+
const info = await lstat(path);
|
|
127
|
+
stagedName = info.nlink === 2 ? await stagedSibling(path, info.ino, info.dev) : undefined;
|
|
128
|
+
if (stagedName === undefined)
|
|
129
|
+
throw cause;
|
|
130
|
+
record = await readLockRecord(path, { signal, singleLink: false });
|
|
131
|
+
}
|
|
110
132
|
return {
|
|
111
133
|
...readOwner(record.text),
|
|
112
134
|
ino: record.info.ino,
|
|
113
135
|
dev: record.info.dev,
|
|
114
|
-
mtimeMs: record.info.mtimeMs
|
|
136
|
+
mtimeMs: record.info.mtimeMs,
|
|
137
|
+
...stagedName !== undefined && { stagedName }
|
|
115
138
|
};
|
|
116
139
|
} catch (cause) {
|
|
117
140
|
if (!isCode(cause, "ENOENT"))
|
|
@@ -119,10 +142,23 @@ async function readLockFile(path, onFailure, signal) {
|
|
|
119
142
|
return;
|
|
120
143
|
}
|
|
121
144
|
}
|
|
122
|
-
async function
|
|
145
|
+
async function sweepStagedLocks(directory, machine, signal) {
|
|
146
|
+
for (const name of await readdir(directory).catch(() => [])) {
|
|
147
|
+
if (!STAGED_NAME.test(name))
|
|
148
|
+
continue;
|
|
149
|
+
const candidate = join(directory, name);
|
|
150
|
+
const state = await readLockFile(candidate, undefined, signal);
|
|
151
|
+
if (!state?.owner)
|
|
152
|
+
continue;
|
|
153
|
+
if ((await diagnose(state.owner, machine)).liveness !== "gone")
|
|
154
|
+
continue;
|
|
155
|
+
await unlinkIfSame(candidate, state.ino, state.dev, state.stagedName === undefined ? 1 : 2);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async function unlinkIfSame(path, ino, dev, links = 1) {
|
|
123
159
|
try {
|
|
124
160
|
const current = await lstat(path);
|
|
125
|
-
if (current.ino !== ino || current.dev !== dev || !current.isFile() || current.nlink !==
|
|
161
|
+
if (current.ino !== ino || current.dev !== dev || !current.isFile() || current.nlink !== links)
|
|
126
162
|
return;
|
|
127
163
|
await unlink(path);
|
|
128
164
|
} catch (error) {
|
|
@@ -133,7 +169,6 @@ async function unlinkIfSame(path, ino, dev) {
|
|
|
133
169
|
async function createOwned(path, options, reclaimed) {
|
|
134
170
|
const identity = await machineIdentity(options.machineIdentity);
|
|
135
171
|
const instance = await readProcessInstance(process.pid);
|
|
136
|
-
const handle = await open2(path, "wx", options.mode);
|
|
137
172
|
const owner = {
|
|
138
173
|
pid: process.pid,
|
|
139
174
|
process: instance,
|
|
@@ -141,29 +176,41 @@ async function createOwned(path, options, reclaimed) {
|
|
|
141
176
|
acquiredAt: new Date().toISOString(),
|
|
142
177
|
...identity !== null && { machine: identity }
|
|
143
178
|
};
|
|
179
|
+
const ownedRecord = `${JSON.stringify(owner)}
|
|
180
|
+
`;
|
|
181
|
+
const staged = join(dirname(path), `.lock-${randomUUID()}.tmp`);
|
|
182
|
+
const handle = await open(staged, "wx", options.mode);
|
|
144
183
|
let ino;
|
|
145
184
|
let dev;
|
|
185
|
+
let published = false;
|
|
146
186
|
try {
|
|
147
187
|
const info = await handle.stat();
|
|
148
188
|
ino = info.ino;
|
|
149
189
|
dev = info.dev;
|
|
150
190
|
await handle.chmod(options.mode);
|
|
151
|
-
await handle.writeFile(
|
|
152
|
-
|
|
191
|
+
await handle.writeFile(ownedRecord, "utf8");
|
|
192
|
+
try {
|
|
193
|
+
await publishAtomicFile(staged, path, { replace: false, durability: "file" });
|
|
194
|
+
published = true;
|
|
195
|
+
} catch (error) {
|
|
196
|
+
published = error instanceof AtomicFilePublicationError2;
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
153
199
|
} catch (error) {
|
|
154
200
|
await handle.close().catch(() => {
|
|
155
201
|
return;
|
|
156
202
|
});
|
|
157
|
-
if (ino !== undefined && dev !== undefined)
|
|
158
|
-
await unlinkIfSame(path, ino, dev).catch(() => {
|
|
203
|
+
if (published && ino !== undefined && dev !== undefined)
|
|
204
|
+
await unlinkIfSame(path, ino, dev, 2).catch(() => {
|
|
159
205
|
return;
|
|
160
206
|
});
|
|
207
|
+
await unlink(staged).catch(() => {
|
|
208
|
+
return;
|
|
209
|
+
});
|
|
161
210
|
throw error;
|
|
162
211
|
}
|
|
163
212
|
const ownedInode = ino;
|
|
164
213
|
const ownedDevice = dev;
|
|
165
|
-
const ownedRecord = `${JSON.stringify(owner)}
|
|
166
|
-
`;
|
|
167
214
|
let released = false;
|
|
168
215
|
return {
|
|
169
216
|
path,
|
|
@@ -206,7 +253,7 @@ async function reclaimUnderGuard(path, options, depth) {
|
|
|
206
253
|
try {
|
|
207
254
|
acquired = await attemptExclusiveLock(guardPath, {
|
|
208
255
|
...options,
|
|
209
|
-
ownerlessGraceMs: options.ownerlessGraceMs === undefined ?
|
|
256
|
+
ownerlessGraceMs: options.ownerlessGraceMs === undefined ? STALE_GUARD_GRACE_MS : options.ownerlessGraceMs
|
|
210
257
|
}, depth + 1);
|
|
211
258
|
} catch (cause) {
|
|
212
259
|
if (!isCode(cause, "ENAMETOOLONG"))
|
|
@@ -229,8 +276,14 @@ async function reclaimUnderGuard(path, options, depth) {
|
|
|
229
276
|
return { refused: true };
|
|
230
277
|
if (!reclaimable(state, diagnosis, options.ownerlessGraceMs))
|
|
231
278
|
return { refused: true, cause: diagnosis.cause };
|
|
279
|
+
if (state.stagedName !== undefined)
|
|
280
|
+
await unlink(state.stagedName).catch((error) => {
|
|
281
|
+
if (!isCode(error, "ENOENT"))
|
|
282
|
+
throw error;
|
|
283
|
+
});
|
|
232
284
|
await unlinkIfSame(path, state.ino, state.dev);
|
|
233
285
|
}
|
|
286
|
+
await sweepStagedLocks(dirname(path), options.machineIdentity, options.signal);
|
|
234
287
|
return await createOwned(path, options, state !== undefined).catch((error) => {
|
|
235
288
|
if (isCode(error, "EEXIST"))
|
|
236
289
|
return { refused: true, cause: error };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/internal/timers.ts
|
|
2
|
+
var MAX_TIMER_MS = 2147483647;
|
|
3
|
+
function sleep(ms, signal) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
if (signal?.aborted) {
|
|
6
|
+
reject(signal.reason);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const abort = () => {
|
|
10
|
+
clearTimeout(timer);
|
|
11
|
+
reject(signal?.reason);
|
|
12
|
+
};
|
|
13
|
+
const timer = setTimeout(() => {
|
|
14
|
+
signal?.removeEventListener("abort", abort);
|
|
15
|
+
resolve();
|
|
16
|
+
}, ms);
|
|
17
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { MAX_TIMER_MS, sleep };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppError2
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-j9gxbztg.js";
|
|
4
4
|
import {
|
|
5
5
|
toolErrorFromResult
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-2k91mewf.js";
|
|
7
7
|
import {
|
|
8
8
|
assertUniqueToolName
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-r393tnfp.js";
|
|
10
10
|
import {
|
|
11
11
|
collectTools2,
|
|
12
12
|
createToolRunner
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-wbhdzxar.js";
|
|
14
14
|
|
|
15
15
|
// src/tools/invoker.ts
|
|
16
16
|
function createToolInvoker2(services, config) {
|
|
@@ -30,8 +30,12 @@ function createToolInvoker2(services, config) {
|
|
|
30
30
|
const tool = tools.get(name);
|
|
31
31
|
if (tool)
|
|
32
32
|
return tool;
|
|
33
|
-
throw new AppError2("NOT_FOUND",
|
|
34
|
-
|
|
33
|
+
throw new AppError2("NOT_FOUND", {
|
|
34
|
+
message: `Unknown tool: ${name}`,
|
|
35
|
+
status: 404,
|
|
36
|
+
details: {
|
|
37
|
+
available: names
|
|
38
|
+
}
|
|
35
39
|
});
|
|
36
40
|
};
|
|
37
41
|
const run = (name, args, options = {}) => {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRouteParamsSchema
|
|
3
3
|
} from "./index-m38ej7e5.js";
|
|
4
|
+
import {
|
|
5
|
+
assertPositiveSafeInteger
|
|
6
|
+
} from "./index-0s4xebbg.js";
|
|
4
7
|
import {
|
|
5
8
|
isUnsafeKey
|
|
6
9
|
} from "./index-zsarb5xp.js";
|
|
@@ -71,11 +74,6 @@ function assertToolView(prefix, key, ep) {
|
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
// src/contract/define-validation.ts
|
|
74
|
-
function assertPositiveLimit(where, name, value) {
|
|
75
|
-
if (value !== undefined && (!Number.isSafeInteger(value) || value <= 0)) {
|
|
76
|
-
throw new Error(`${where} ${name} must be a positive safe integer, received ${value}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
77
|
function assertMultipartEndpoint(prefix, key, ep) {
|
|
80
78
|
const where = `Contract "${prefix}": multipart endpoint "${key}"`;
|
|
81
79
|
if (ep.method !== "POST" && ep.method !== "PUT" && ep.method !== "PATCH") {
|
|
@@ -85,16 +83,16 @@ function assertMultipartEndpoint(prefix, key, ep) {
|
|
|
85
83
|
if (!multipart || typeof multipart !== "object") {
|
|
86
84
|
throw new Error(`${where} must declare a multipart descriptor`);
|
|
87
85
|
}
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
assertPositiveSafeInteger(`${where} maxRequestBytes`, multipart.maxRequestBytes, Error);
|
|
87
|
+
assertPositiveSafeInteger(`${where} maxFieldBytes`, multipart.maxFieldBytes, Error);
|
|
90
88
|
const entries = Object.entries(multipart.files);
|
|
91
89
|
if (entries.length === 0)
|
|
92
90
|
throw new Error(`${where} must declare at least one file field`);
|
|
93
91
|
for (const [field, policy] of entries) {
|
|
94
92
|
if (!field || isUnsafeKey(field))
|
|
95
93
|
throw new Error(`${where} has an invalid file field name`);
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
assertPositiveSafeInteger(`${where} field "${field}" maxBytes`, policy.maxBytes, Error);
|
|
95
|
+
assertPositiveSafeInteger(`${where} field "${field}" maxFiles`, policy.maxFiles, Error);
|
|
98
96
|
if (policy.multiple !== true && policy.maxFiles !== undefined) {
|
|
99
97
|
throw new Error(`${where} field "${field}" may set maxFiles only with multiple: true`);
|
|
100
98
|
}
|
|
@@ -142,9 +140,9 @@ function assertStreamingResponseEndpoint(prefix, key, ep) {
|
|
|
142
140
|
if (runtimeFinalLine === "require-newline" && runtimeFormat === "sse") {
|
|
143
141
|
throw new Error(`${where} finalLine applies only to ndjson`);
|
|
144
142
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
assertPositiveSafeInteger(`${where} maxFrameBytes`, ep.stream.maxFrameBytes, Error);
|
|
144
|
+
assertPositiveSafeInteger(`${where} lifetimeMs`, ep.stream.lifetimeMs, Error);
|
|
145
|
+
assertPositiveSafeInteger(`${where} heartbeatMs`, ep.stream.heartbeatMs, Error);
|
|
148
146
|
if (ep.stream.idleTimeoutSeconds !== undefined && (!Number.isSafeInteger(ep.stream.idleTimeoutSeconds) || ep.stream.idleTimeoutSeconds < 0)) {
|
|
149
147
|
throw new Error(`${where} idleTimeoutSeconds must be a non-negative safe integer`);
|
|
150
148
|
}
|
|
@@ -267,9 +265,7 @@ function defineContract2(meta, endpoints) {
|
|
|
267
265
|
if (ep.desc.trim() === "") {
|
|
268
266
|
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" has an empty desc`);
|
|
269
267
|
}
|
|
270
|
-
|
|
271
|
-
throw new Error(`Contract "${meta.prefix}": endpoint "${key}" maxJsonBodyBytes must be a positive safe integer, received ${ep.maxJsonBodyBytes}`);
|
|
272
|
-
}
|
|
268
|
+
assertPositiveSafeInteger(`Contract "${meta.prefix}": endpoint "${key}" maxJsonBodyBytes`, ep.maxJsonBodyBytes, Error);
|
|
273
269
|
if (ep.multipart)
|
|
274
270
|
assertMultipartEndpoint(meta.prefix, key, ep);
|
|
275
271
|
if (ep.rawResponse)
|
|
@@ -14,17 +14,15 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
ToolExecutionControlError2,
|
|
16
16
|
isToolExecutionControlError2
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-2k91mewf.js";
|
|
18
18
|
import {
|
|
19
19
|
agentDurableEventId2
|
|
20
20
|
} from "./index-mnkk1ffz.js";
|
|
21
21
|
import {
|
|
22
|
-
createLocalStepDurability2
|
|
23
|
-
} from "./index-pptyv13k.js";
|
|
24
|
-
import {
|
|
22
|
+
createLocalStepDurability2,
|
|
25
23
|
isAgentToolError2,
|
|
26
24
|
createToolDurabilityContext
|
|
27
|
-
} from "./index-
|
|
25
|
+
} from "./index-c17xcx4k.js";
|
|
28
26
|
import {
|
|
29
27
|
canonicalAgentJson2,
|
|
30
28
|
createToolChronology,
|
|
@@ -33,13 +31,16 @@ import {
|
|
|
33
31
|
isAssistantHistoryEvidence2,
|
|
34
32
|
isCompleteAgentHistoryTurn,
|
|
35
33
|
assistantStatus
|
|
36
|
-
} from "./index-
|
|
34
|
+
} from "./index-0gs4ymfj.js";
|
|
37
35
|
import {
|
|
38
36
|
messageOf
|
|
39
37
|
} from "./index-g149e9pk.js";
|
|
40
38
|
import {
|
|
41
39
|
createMutationQueue
|
|
42
40
|
} from "./index-sykb5ag7.js";
|
|
41
|
+
import {
|
|
42
|
+
assertPositiveSafeInteger
|
|
43
|
+
} from "./index-0s4xebbg.js";
|
|
43
44
|
import {
|
|
44
45
|
serializeCanonicalJson
|
|
45
46
|
} from "./index-zsvzhjtk.js";
|
|
@@ -2129,9 +2130,7 @@ async function recoverAgentRuns(state, options) {
|
|
|
2129
2130
|
if (!Number.isSafeInteger(pageSize) || pageSize < 1 || pageSize > 1000) {
|
|
2130
2131
|
throw new TypeError("Recovery pageSize must be an integer between 1 and 1000");
|
|
2131
2132
|
}
|
|
2132
|
-
|
|
2133
|
-
throw new TypeError("Recovery maxRuns must be a positive safe integer");
|
|
2134
|
-
}
|
|
2133
|
+
assertPositiveSafeInteger("Recovery maxRuns", maxRuns);
|
|
2135
2134
|
const ordered = await collectRecoverable(state, options, pageSize, maxRuns);
|
|
2136
2135
|
const outcomes = [];
|
|
2137
2136
|
const scheduledRuns = new Map;
|
|
@@ -3914,15 +3913,9 @@ function resolveLoopLimits(config) {
|
|
|
3914
3913
|
const maxSteps = config.loop?.maxSteps ?? 50;
|
|
3915
3914
|
const declaredIdleTimeoutMs = config.loop?.idleTimeoutMs;
|
|
3916
3915
|
const idleTimeoutMs = declaredIdleTimeoutMs === null ? undefined : declaredIdleTimeoutMs ?? 60000;
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
if (!Number.isSafeInteger(maxSteps) || maxSteps < 1) {
|
|
3921
|
-
throw new TypeError("maxSteps must be a positive safe integer");
|
|
3922
|
-
}
|
|
3923
|
-
if (idleTimeoutMs !== undefined && (!Number.isSafeInteger(idleTimeoutMs) || idleTimeoutMs < 1)) {
|
|
3924
|
-
throw new TypeError("idleTimeoutMs must be a positive safe integer");
|
|
3925
|
-
}
|
|
3916
|
+
assertPositiveSafeInteger("checkpointEveryEvents", checkpointEveryEvents);
|
|
3917
|
+
assertPositiveSafeInteger("maxSteps", maxSteps);
|
|
3918
|
+
assertPositiveSafeInteger("idleTimeoutMs", idleTimeoutMs);
|
|
3926
3919
|
const policyNames = new Set(["max-steps"]);
|
|
3927
3920
|
for (const policy of config.loop?.stopPolicies ?? []) {
|
|
3928
3921
|
if (!policy.name || policyNames.has(policy.name)) {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentControlRequestSchema2,
|
|
3
3
|
AgentControlResponseSchema2
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-b0w7rbpt.js";
|
|
5
5
|
import {
|
|
6
6
|
createAgentRuntimeEventSink2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-299sm5tr.js";
|
|
8
|
+
import {
|
|
9
|
+
assertPositiveSafeInteger
|
|
10
|
+
} from "./index-0s4xebbg.js";
|
|
8
11
|
|
|
9
12
|
// src/agent-runtime/harness-control.ts
|
|
10
13
|
async function runControlledOperation(harness, request) {
|
|
@@ -64,8 +67,7 @@ function controlFailure(requestId, code, message) {
|
|
|
64
67
|
}
|
|
65
68
|
function attachmentLimit(config) {
|
|
66
69
|
const limit = config.maxPendingAttachments ?? 32;
|
|
67
|
-
|
|
68
|
-
throw new TypeError("maxPendingAttachments must be a positive safe integer");
|
|
70
|
+
assertPositiveSafeInteger("maxPendingAttachments", limit);
|
|
69
71
|
return limit;
|
|
70
72
|
}
|
|
71
73
|
function connectionState(config, {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertPositiveSafeInteger
|
|
3
|
+
} from "./index-0s4xebbg.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/atomic-staging.ts
|
|
6
|
+
import { randomBytes } from "node:crypto";
|
|
7
|
+
import { lstat, readdir, unlink } from "node:fs/promises";
|
|
8
|
+
import { dirname, join } from "node:path";
|
|
9
|
+
var PREFIX = ".stitchkit-";
|
|
10
|
+
var SUFFIX = ".tmp";
|
|
11
|
+
var RANDOM_BYTES = 12;
|
|
12
|
+
var literal = (text) => text.replaceAll(".", "\\.");
|
|
13
|
+
var NAME = new RegExp(`^${literal(PREFIX)}[0-9a-f]{${RANDOM_BYTES * 2}}${literal(SUFFIX)}$`);
|
|
14
|
+
function stagingName() {
|
|
15
|
+
return `${PREFIX}${randomBytes(RANDOM_BYTES).toString("hex")}${SUFFIX}`;
|
|
16
|
+
}
|
|
17
|
+
function stagingPath(target) {
|
|
18
|
+
return join(dirname(target), stagingName());
|
|
19
|
+
}
|
|
20
|
+
function isAtomicStagingName2(name) {
|
|
21
|
+
return NAME.test(name);
|
|
22
|
+
}
|
|
23
|
+
function isMissing(error) {
|
|
24
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
25
|
+
}
|
|
26
|
+
async function sweepAtomicStaging2(options) {
|
|
27
|
+
const { directory, olderThanMs, signal } = options;
|
|
28
|
+
assertPositiveSafeInteger("olderThanMs", olderThanMs, RangeError);
|
|
29
|
+
signal?.throwIfAborted();
|
|
30
|
+
const cutoff = Date.now() - olderThanMs;
|
|
31
|
+
const removed = [];
|
|
32
|
+
let names;
|
|
33
|
+
try {
|
|
34
|
+
names = await readdir(directory);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
if (isMissing(error))
|
|
37
|
+
return removed;
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
for (const name of names) {
|
|
41
|
+
signal?.throwIfAborted();
|
|
42
|
+
if (!isAtomicStagingName2(name))
|
|
43
|
+
continue;
|
|
44
|
+
const path = join(directory, name);
|
|
45
|
+
try {
|
|
46
|
+
const info = await lstat(path);
|
|
47
|
+
if (!info.isFile() || info.mtimeMs > cutoff)
|
|
48
|
+
continue;
|
|
49
|
+
await unlink(path);
|
|
50
|
+
removed.push(name);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
if (!isMissing(error))
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return removed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { stagingName, stagingPath, isAtomicStagingName2, sweepAtomicStaging2 };
|
|
@@ -8,15 +8,15 @@ class AppError2 extends Error {
|
|
|
8
8
|
hint;
|
|
9
9
|
traceId;
|
|
10
10
|
retryable;
|
|
11
|
-
constructor(code,
|
|
12
|
-
super(message ?? code);
|
|
11
|
+
constructor(code, options = {}) {
|
|
12
|
+
super(options.message ?? code, "cause" in options ? { cause: options.cause } : undefined);
|
|
13
13
|
this.code = code;
|
|
14
|
-
this.status = status;
|
|
15
|
-
this.details = details;
|
|
16
|
-
this.hint = hint;
|
|
17
|
-
this.traceId = traceId;
|
|
18
|
-
this.retryable = retryable;
|
|
19
14
|
this.name = "AppError";
|
|
15
|
+
this.status = options.status ?? 500;
|
|
16
|
+
this.details = options.details;
|
|
17
|
+
this.hint = options.hint;
|
|
18
|
+
this.traceId = options.traceId;
|
|
19
|
+
this.retryable = options.retryable;
|
|
20
20
|
Object.defineProperty(this, APP_ERROR_BRAND, { value: true });
|
|
21
21
|
}
|
|
22
22
|
static is(err) {
|
|
@@ -35,22 +35,22 @@ class AppError2 extends Error {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
function notFound2(message = "Not found") {
|
|
38
|
-
throw new AppError2("NOT_FOUND", message, 404);
|
|
38
|
+
throw new AppError2("NOT_FOUND", { message, status: 404 });
|
|
39
39
|
}
|
|
40
40
|
function badRequest2(message, details) {
|
|
41
|
-
throw new AppError2("BAD_REQUEST", message, 400, details);
|
|
41
|
+
throw new AppError2("BAD_REQUEST", { message, status: 400, details });
|
|
42
42
|
}
|
|
43
43
|
function unauthorized2(message = "Unauthorized") {
|
|
44
|
-
throw new AppError2("UNAUTHORIZED", message, 401);
|
|
44
|
+
throw new AppError2("UNAUTHORIZED", { message, status: 401 });
|
|
45
45
|
}
|
|
46
46
|
function forbidden2(message = "Forbidden") {
|
|
47
|
-
throw new AppError2("FORBIDDEN", message, 403);
|
|
47
|
+
throw new AppError2("FORBIDDEN", { message, status: 403 });
|
|
48
48
|
}
|
|
49
49
|
function conflict2(message = "Conflict", details) {
|
|
50
|
-
throw new AppError2("CONFLICT", message, 409, details);
|
|
50
|
+
throw new AppError2("CONFLICT", { message, status: 409, details });
|
|
51
51
|
}
|
|
52
52
|
function rateLimited2(message = "Too many requests") {
|
|
53
|
-
throw new AppError2("RATE_LIMITED", message, 429);
|
|
53
|
+
throw new AppError2("RATE_LIMITED", { message, status: 429 });
|
|
54
54
|
}
|
|
55
55
|
var STITCH_ERROR_STATUS2 = {
|
|
56
56
|
BAD_REQUEST: 400,
|
|
@@ -99,7 +99,11 @@ function isStitchErrorCode2(code) {
|
|
|
99
99
|
return Object.hasOwn(STITCH_ERROR_STATUS2, code);
|
|
100
100
|
}
|
|
101
101
|
function appError2(code, message, details) {
|
|
102
|
-
throw new AppError2(code,
|
|
102
|
+
throw new AppError2(code, {
|
|
103
|
+
message,
|
|
104
|
+
status: isStitchErrorCode2(code) ? STITCH_ERROR_STATUS2[code] : 500,
|
|
105
|
+
details
|
|
106
|
+
});
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
export { AppError2, notFound2, badRequest2, unauthorized2, forbidden2, conflict2, rateLimited2, STITCH_ERROR_STATUS2, isRetryableStatus2, isStitchErrorCode2, appError2 };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/browser/api-error.ts
|
|
2
|
+
var API_ERROR_BRAND = Symbol.for("stitchkit.ApiError");
|
|
3
|
+
function messageForCode(code, message) {
|
|
4
|
+
return message !== undefined && message.length > 0 ? message : `${code} (no message supplied)`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
class ApiError2 extends Error {
|
|
8
|
+
code;
|
|
9
|
+
status;
|
|
10
|
+
details;
|
|
11
|
+
hint;
|
|
12
|
+
traceId;
|
|
13
|
+
retryable;
|
|
14
|
+
constructor(code, options = {}) {
|
|
15
|
+
super(messageForCode(code, options.message), "cause" in options ? { cause: options.cause } : undefined);
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.name = "ApiError";
|
|
18
|
+
this.status = options.status ?? 0;
|
|
19
|
+
this.details = options.details;
|
|
20
|
+
this.hint = options.hint;
|
|
21
|
+
this.traceId = options.traceId;
|
|
22
|
+
this.retryable = options.retryable;
|
|
23
|
+
Object.defineProperty(this, API_ERROR_BRAND, { value: true });
|
|
24
|
+
}
|
|
25
|
+
static is(error) {
|
|
26
|
+
return typeof error === "object" && error !== null && API_ERROR_BRAND in error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function refuseLocally(path, message) {
|
|
30
|
+
return new ApiError2("VALIDATION_ERROR", {
|
|
31
|
+
status: 0,
|
|
32
|
+
details: { issues: [{ path, code: "invalid_type", message }] },
|
|
33
|
+
message
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { ApiError2, refuseLocally };
|