stitchkit 0.104.1 → 0.105.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +381 -12
- package/darwin-native.cjs +4 -2
- package/dist/agent-runtime/browser-control-contract.d.ts +32 -2
- package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -1
- package/dist/agent-runtime/browser-controller.d.ts +21 -3
- package/dist/agent-runtime/browser-controller.d.ts.map +1 -1
- package/dist/agent-runtime/coding-shell-process.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-refusals.d.ts +1 -0
- package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/compaction.d.ts.map +1 -1
- package/dist/agent-runtime/contained-write.d.ts.map +1 -1
- package/dist/agent-runtime/control-schema.d.ts +48 -1
- package/dist/agent-runtime/control-schema.d.ts.map +1 -1
- package/dist/agent-runtime/deferred-tool-search.d.ts +3 -2
- package/dist/agent-runtime/deferred-tool-search.d.ts.map +1 -1
- package/dist/agent-runtime/harness-control.d.ts.map +1 -1
- package/dist/agent-runtime/harness-realtime.d.ts +34 -4
- package/dist/agent-runtime/harness-realtime.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-recovery.d.ts.map +1 -1
- package/dist/agent-runtime/runtime-state.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-contract.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox-process-owner.d.ts +9 -1
- package/dist/agent-runtime/sandbox-process-owner.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox.d.ts +32 -1
- package/dist/agent-runtime/sandbox.d.ts.map +1 -1
- package/dist/agent-runtime/schedule-records.d.ts.map +1 -1
- package/dist/agent-runtime/schedules.d.ts.map +1 -1
- package/dist/agent-runtime/store-events.d.ts +9 -4
- package/dist/agent-runtime/store-events.d.ts.map +1 -1
- package/dist/agent-runtime/testing.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-contract.d.ts +50 -0
- package/dist/application/diagnostic-journal-contract.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-generations.d.ts +24 -0
- package/dist/application/diagnostic-journal-generations.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-open.d.ts +10 -0
- package/dist/application/diagnostic-journal-open.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-quarantine.d.ts +28 -0
- package/dist/application/diagnostic-journal-quarantine.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-read-contract.d.ts +73 -3
- package/dist/application/diagnostic-journal-read-contract.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-reader.d.ts +17 -2
- package/dist/application/diagnostic-journal-reader.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-recovery.d.ts +18 -2
- package/dist/application/diagnostic-journal-recovery.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-storage.d.ts +6 -2
- package/dist/application/diagnostic-journal-storage.d.ts.map +1 -1
- package/dist/application/diagnostic-journal-tail.d.ts +12 -0
- package/dist/application/diagnostic-journal-tail.d.ts.map +1 -0
- package/dist/application/diagnostic-journal.d.ts +3 -0
- package/dist/application/diagnostic-journal.d.ts.map +1 -1
- package/dist/application/directory-inbox-accept.d.ts +3 -3
- package/dist/application/directory-inbox-accept.d.ts.map +1 -1
- package/dist/application/directory-inbox-contract.d.ts +38 -10
- package/dist/application/directory-inbox-contract.d.ts.map +1 -1
- package/dist/application/directory-inbox-delivery.d.ts +3 -3
- package/dist/application/directory-inbox-delivery.d.ts.map +1 -1
- package/dist/application/directory-inbox-files.d.ts +17 -2
- package/dist/application/directory-inbox-files.d.ts.map +1 -1
- package/dist/application/directory-inbox-state.d.ts +1 -1
- package/dist/application/directory-inbox-state.d.ts.map +1 -1
- package/dist/application/directory-inbox.d.ts +1 -1
- package/dist/application/directory-inbox.d.ts.map +1 -1
- package/dist/application/file-state-store.d.ts +21 -1
- package/dist/application/file-state-store.d.ts.map +1 -1
- package/dist/application/grammy.d.ts.map +1 -1
- package/dist/application/kernel-contract.d.ts.map +1 -1
- package/dist/application/revision-signal.d.ts.map +1 -1
- package/dist/application/state-store.d.ts +3 -0
- package/dist/application/state-store.d.ts.map +1 -1
- package/dist/browser/api-error.d.ts +38 -0
- package/dist/browser/api-error.d.ts.map +1 -0
- package/dist/browser/chunked-upload.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts.map +1 -1
- package/dist/browser/client-url.d.ts.map +1 -1
- package/dist/browser/contract-stream.d.ts.map +1 -1
- package/dist/browser/http.d.ts +0 -25
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/resumable.d.ts.map +1 -1
- package/dist/contract/define-validation.d.ts +0 -1
- package/dist/contract/define-validation.d.ts.map +1 -1
- package/dist/contract/define.d.ts.map +1 -1
- package/dist/contract/errors-factory.d.ts.map +1 -1
- package/dist/contract/errors.d.ts +15 -18
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/normalize.d.ts.map +1 -1
- package/dist/durability/effect.d.ts.map +1 -1
- package/dist/durability/scheduler.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/browser.js +29 -18
- package/dist/entrypoints/agent-runtime/coding-tools.js +8 -7
- package/dist/entrypoints/agent-runtime/harness.js +15 -14
- package/dist/entrypoints/agent-runtime/realtime.d.ts +1 -1
- package/dist/entrypoints/agent-runtime/realtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/realtime.js +119 -54
- package/dist/entrypoints/agent-runtime/sandbox.js +23 -17
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +4 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +4 -3
- package/dist/entrypoints/agent-runtime/testing.js +8 -6
- package/dist/entrypoints/agent-runtime.js +37 -38
- package/dist/entrypoints/application/diagnostic-journal.js +305 -111
- package/dist/entrypoints/application/directory-inbox.js +174 -77
- package/dist/entrypoints/application/grammy.js +5 -2
- package/dist/entrypoints/application/opentelemetry.js +2 -2
- package/dist/entrypoints/application.d.ts +2 -2
- package/dist/entrypoints/application.d.ts.map +1 -1
- package/dist/entrypoints/application.js +17 -8
- package/dist/entrypoints/cli/publish.d.ts +16 -0
- package/dist/entrypoints/cli/publish.d.ts.map +1 -0
- package/dist/entrypoints/cli/publish.js +527 -0
- package/dist/entrypoints/cli.d.ts +1 -2
- package/dist/entrypoints/cli.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +59 -966
- package/dist/entrypoints/contract.js +3 -3
- package/dist/entrypoints/files/packaging.js +196 -56
- package/dist/entrypoints/files.d.ts +1 -0
- package/dist/entrypoints/files.d.ts.map +1 -1
- package/dist/entrypoints/files.js +17 -10
- package/dist/entrypoints/index.d.ts +2 -1
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +31 -60
- package/dist/entrypoints/node.js +8 -8
- package/dist/entrypoints/observability.js +3 -3
- package/dist/entrypoints/primitives.js +67 -83
- package/dist/entrypoints/process.d.ts +1 -1
- package/dist/entrypoints/process.d.ts.map +1 -1
- package/dist/entrypoints/process.js +2 -2
- package/dist/entrypoints/react.js +4 -2
- package/dist/entrypoints/remote.js +37 -13
- package/dist/entrypoints/server.js +18 -16
- package/dist/entrypoints/telegram/screens.js +5 -3
- package/dist/entrypoints/telegram.js +31 -46
- package/dist/entrypoints/testing.d.ts +1 -1
- package/dist/entrypoints/testing.d.ts.map +1 -1
- package/dist/entrypoints/testing.js +444 -448
- package/dist/entrypoints/tools/connections.js +268 -105
- package/dist/entrypoints/tools/contract.js +2 -2
- package/dist/entrypoints/tools/invoker.js +8 -7
- package/dist/entrypoints/tools/mcp.d.ts +2 -2
- package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
- package/dist/entrypoints/tools/mcp.js +10 -9
- package/dist/entrypoints/tools.d.ts +0 -1
- package/dist/entrypoints/tools.d.ts.map +1 -1
- package/dist/entrypoints/tools.js +118 -53
- package/dist/entrypoints/tracking.js +2 -3
- package/dist/files/boundary.d.ts +2 -2
- package/dist/files/boundary.d.ts.map +1 -1
- package/dist/files/chunk-spool.d.ts.map +1 -1
- package/dist/files/file-io.d.ts +2 -2
- package/dist/files/file-io.d.ts.map +1 -1
- package/dist/files/native-packaging-layout.d.ts +50 -4
- package/dist/files/native-packaging-layout.d.ts.map +1 -1
- package/dist/files/native-packaging.d.ts +104 -21
- package/dist/files/native-packaging.d.ts.map +1 -1
- package/dist/{index-r5hsgkz5.js → index-0gs4ymfj.js} +6 -3
- package/dist/{index-zax7resm.js → index-0gxvns6s.js} +1 -13
- package/dist/index-0s4xebbg.js +8 -0
- package/dist/{index-r4r70zmh.js → index-12zsej7b.js} +5 -2
- package/dist/{index-kemm0ej5.js → index-1pwwan01.js} +65 -22
- package/dist/{index-vgkbcnkc.js → index-299sm5tr.js} +1 -1
- package/dist/{index-2vnh05w4.js → index-2k91mewf.js} +31 -74
- package/dist/{index-269zqj8m.js → index-2rc6jd9n.js} +28 -12
- package/dist/{index-wh0ecvyk.js → index-37asdw3a.js} +1 -1
- package/dist/index-3h0ztg0z.js +285 -0
- package/dist/{index-g95fk660.js → index-4vsby8n8.js} +8 -15
- package/dist/index-556g5hsh.js +17 -0
- package/dist/{index-adhgd4pe.js → index-5p55xreg.js} +2 -2
- package/dist/index-5w6t91ze.js +47 -0
- package/dist/{index-9pw0a51a.js → index-6yxhe58g.js} +40 -7
- package/dist/{index-6d9xaxw1.js → index-8ks9b85e.js} +33 -5
- package/dist/{index-bhb950qs.js → index-916yh4e2.js} +25 -12
- package/dist/index-9tqbxv5p.js +44 -0
- package/dist/{index-5csmzesf.js → index-azx12jgv.js} +4 -3
- package/dist/{index-mbnnw3f2.js → index-b0kddvzw.js} +15 -5
- package/dist/{index-n5yqxd3d.js → index-b0w7rbpt.js} +23 -2
- package/dist/index-b56nnscm.js +132 -0
- package/dist/{index-0ndk4555.js → index-c0hffcmj.js} +2 -2
- package/dist/{index-pptyv13k.js → index-c17xcx4k.js} +42 -6
- package/dist/{index-g2j7pnak.js → index-cmzvhhtd.js} +5 -2
- package/dist/index-cq59agna.js +51 -0
- package/dist/{index-ssmd41kh.js → index-d2h99n7d.js} +1 -1
- package/dist/{index-z94wht4y.js → index-dky0dcmf.js} +34 -5
- package/dist/{index-za6j7nwy.js → index-dsnjzb62.js} +104 -51
- package/dist/index-eemvahkc.js +21 -0
- package/dist/index-ef8gdaq0.js +105 -0
- package/dist/{index-fa4wg312.js → index-f199nfq5.js} +10 -6
- package/dist/{index-ck71tbcf.js → index-fsw1ybf3.js} +11 -15
- package/dist/{index-f330qqyg.js → index-g2vfg7ak.js} +217 -63
- package/dist/{index-fk18k56k.js → index-gr5g3xfw.js} +11 -18
- package/dist/{index-jn9g8xdt.js → index-hjvje0pf.js} +6 -4
- package/dist/{index-x928baz2.js → index-j9gxbztg.js} +18 -14
- package/dist/index-kfjkb396.js +37 -0
- package/dist/{index-6drst9sg.js → index-ksfagmyz.js} +45 -345
- package/dist/index-m616f0yz.js +120 -0
- package/dist/{index-fm1c1a08.js → index-m6w6jtda.js} +40 -21
- package/dist/{index-ptn0g0gj.js → index-ma963wz7.js} +21 -20
- package/dist/{index-bakgedh8.js → index-msfpyy2f.js} +2 -4
- package/dist/{index-ywppsaby.js → index-n1nszyk0.js} +23 -34
- package/dist/{index-v14qqmys.js → index-n4689krb.js} +1 -1
- package/dist/{index-a0zzh8ak.js → index-pz3y6b6g.js} +3 -3
- package/dist/{index-43p08g7t.js → index-pzb63z66.js} +12 -8
- package/dist/{index-h97tqqp1.js → index-qaet40b2.js} +5 -3
- package/dist/{index-t1sr4aks.js → index-qaqbdm7s.js} +52 -6
- package/dist/{index-77nxk6ay.js → index-r393tnfp.js} +16 -10
- package/dist/{index-kb8styz3.js → index-rpzewktb.js} +15 -5
- package/dist/{index-27a2pj09.js → index-sj28htvf.js} +1 -1
- package/dist/index-szybbezc.js +455 -0
- package/dist/{index-2hyavjjj.js → index-wbhdzxar.js} +3 -3
- package/dist/{index-4e0ah203.js → index-wdy68sh6.js} +47 -24
- package/dist/{index-hbd32c6a.js → index-wqmvtnkp.js} +38 -89
- package/dist/{index-hp9d77wk.js → index-x7w1z6pf.js} +15 -4
- package/dist/{index-20yvtn9a.js → index-yt7gyg5x.js} +1 -1
- package/dist/{index-cvda079a.js → index-yvfk3y36.js} +12 -2
- package/dist/{index-5z6jn897.js → index-z23rfxhj.js} +1 -1
- package/dist/internal/abort-race.d.ts +8 -2
- package/dist/internal/abort-race.d.ts.map +1 -1
- package/dist/internal/atomic-file.d.ts +55 -9
- package/dist/internal/atomic-file.d.ts.map +1 -1
- package/dist/internal/atomic-publication.d.ts +39 -4
- package/dist/internal/atomic-publication.d.ts.map +1 -1
- package/dist/internal/atomic-staging.d.ts +46 -0
- package/dist/internal/atomic-staging.d.ts.map +1 -0
- package/dist/internal/bounded-file-read.d.ts +19 -11
- package/dist/internal/bounded-file-read.d.ts.map +1 -1
- package/dist/internal/bounded-lines.d.ts.map +1 -1
- package/dist/internal/close-after.d.ts +11 -0
- package/dist/internal/close-after.d.ts.map +1 -0
- package/dist/internal/deadline.d.ts +10 -0
- package/dist/internal/deadline.d.ts.map +1 -1
- package/dist/internal/exclusive-lock-read.d.ts +10 -12
- package/dist/internal/exclusive-lock-read.d.ts.map +1 -1
- package/dist/internal/exclusive-lock.d.ts +2 -2
- package/dist/internal/exclusive-lock.d.ts.map +1 -1
- package/dist/internal/file-observation.d.ts +14 -0
- package/dist/internal/file-observation.d.ts.map +1 -0
- package/dist/internal/json-data.d.ts +22 -5
- package/dist/internal/json-data.d.ts.map +1 -1
- package/dist/internal/positive-integer.d.ts +9 -0
- package/dist/internal/positive-integer.d.ts.map +1 -0
- package/dist/internal/process-instance.d.ts +35 -5
- package/dist/internal/process-instance.d.ts.map +1 -1
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/internal/timers.d.ts +11 -0
- package/dist/internal/timers.d.ts.map +1 -0
- package/dist/internal/with-exclusive-lock.d.ts +5 -4
- package/dist/internal/with-exclusive-lock.d.ts.map +1 -1
- package/dist/observability/bounded-sink.d.ts.map +1 -1
- package/dist/primitives/canonical-json.d.ts +23 -2
- package/dist/primitives/canonical-json.d.ts.map +1 -1
- package/dist/primitives/delivery.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/money.d.ts.map +1 -1
- package/dist/process/cleanup.d.ts +6 -1
- package/dist/process/cleanup.d.ts.map +1 -1
- package/dist/process/command-lifetime.d.ts +4 -0
- package/dist/process/command-lifetime.d.ts.map +1 -1
- package/dist/process/command-owner.d.ts.map +1 -1
- package/dist/process/command.d.ts +4 -0
- package/dist/process/command.d.ts.map +1 -1
- package/dist/process/contract.d.ts +67 -2
- package/dist/process/contract.d.ts.map +1 -1
- package/dist/process/group.d.ts +40 -3
- package/dist/process/group.d.ts.map +1 -1
- package/dist/process/launch.d.ts +12 -1
- package/dist/process/launch.d.ts.map +1 -1
- package/dist/process/terminate.d.ts +39 -0
- package/dist/process/terminate.d.ts.map +1 -0
- package/dist/react/query-client.d.ts.map +1 -1
- package/dist/realtime/rejection.d.ts.map +1 -1
- package/dist/server/contract-stream.d.ts.map +1 -1
- package/dist/server/handler-state.d.ts.map +1 -1
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/request-body.d.ts +0 -1
- package/dist/server/request-body.d.ts.map +1 -1
- package/dist/server/unix-client.d.ts.map +1 -1
- package/dist/telegram/broadcast-delivery.d.ts.map +1 -1
- package/dist/telegram/broadcast-failure.d.ts +10 -2
- package/dist/telegram/broadcast-failure.d.ts.map +1 -1
- package/dist/telegram/operator-channel.d.ts.map +1 -1
- package/dist/telegram/screens/outcome.d.ts.map +1 -1
- package/dist/testing/surface-conformance.d.ts +1 -1
- package/dist/testing/surface-conformance.d.ts.map +1 -1
- package/dist/testing/surface-manifest.d.ts +0 -6
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/tools/agent.d.ts +1 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli/args.d.ts +1 -1
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/dist/tools/cli/help.d.ts.map +1 -1
- package/dist/tools/cli/invoke.d.ts +2 -2
- package/dist/tools/cli/invoke.d.ts.map +1 -1
- package/dist/tools/cli/profile.d.ts.map +1 -1
- package/dist/tools/cli/publication-assets.d.ts.map +1 -1
- package/dist/tools/cli/publication-contract.d.ts +8 -0
- package/dist/tools/cli/publication-contract.d.ts.map +1 -1
- package/dist/tools/cli/publication-control.d.ts.map +1 -1
- package/dist/tools/cli/publication-storage.d.ts +23 -2
- package/dist/tools/cli/publication-storage.d.ts.map +1 -1
- package/dist/tools/cli/publication.d.ts +8 -1
- package/dist/tools/cli/publication.d.ts.map +1 -1
- package/dist/tools/connections/errors.d.ts +18 -6
- package/dist/tools/connections/errors.d.ts.map +1 -1
- package/dist/tools/connections/limits.d.ts +8 -2
- package/dist/tools/connections/limits.d.ts.map +1 -1
- package/dist/tools/connections/mcp-client.d.ts.map +1 -1
- package/dist/tools/connections/mcp-envelope.d.ts.map +1 -1
- package/dist/tools/connections/openapi.d.ts.map +1 -1
- package/dist/tools/connections/schema-budget.d.ts +1 -1
- package/dist/tools/connections/schema-budget.d.ts.map +1 -1
- package/dist/tools/connections/sse-session.d.ts.map +1 -1
- package/dist/tools/execute-args.d.ts.map +1 -1
- package/dist/tools/execute-result.d.ts.map +1 -1
- package/dist/tools/internal/surface-projector.d.ts +17 -3
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/internal/tool-error-projection.d.ts +16 -0
- package/dist/tools/internal/tool-error-projection.d.ts.map +1 -0
- package/dist/tools/internal/tool-view.d.ts.map +1 -1
- package/dist/tools/invoker.d.ts.map +1 -1
- package/dist/tools/list-names.d.ts +3 -2
- package/dist/tools/list-names.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +3 -2
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools/mcp/handler.d.ts +7 -0
- package/dist/tools/mcp/handler.d.ts.map +1 -1
- package/dist/tools/mcp/mount.d.ts +18 -2
- package/dist/tools/mcp/mount.d.ts.map +1 -1
- package/dist/tools/mcp/prepare.d.ts +3 -3
- package/dist/tools/mcp/prepare.d.ts.map +1 -1
- package/dist/tools/mcp/register.d.ts.map +1 -1
- package/dist/tools/mcp/runtime-tools.d.ts.map +1 -1
- package/dist/tools/mcp/stdio-signals.d.ts +14 -0
- package/dist/tools/mcp/stdio-signals.d.ts.map +1 -1
- package/dist/tools/mcp/stdio.d.ts +7 -0
- package/dist/tools/mcp/stdio.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-tools.d.ts.map +1 -1
- package/dist/tools/operations/async-operation-runtime-types.d.ts +3 -3
- package/dist/tools/operations/async-operation-runtime-types.d.ts.map +1 -1
- package/dist/tools/operations/define-wait-tool.d.ts +1 -1
- package/dist/tools/operations/define-wait-tool.d.ts.map +1 -1
- package/dist/tools/operations/wait-core.d.ts +0 -6
- package/dist/tools/operations/wait-core.d.ts.map +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/remote.d.ts +1 -1
- package/dist/tools/remote.d.ts.map +1 -1
- package/dist/tools/{runtime-tool-execution.d.ts → runtime-tool-declaration.d.ts} +32 -9
- package/dist/tools/runtime-tool-declaration.d.ts.map +1 -0
- package/dist/tools/runtime-tool-mcp.d.ts +6 -15
- package/dist/tools/runtime-tool-mcp.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +14 -12
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools/schema/coerce.d.ts +4 -0
- package/dist/tools/schema/coerce.d.ts.map +1 -1
- package/dist/tools/schema/flatten-join.d.ts.map +1 -1
- package/dist/tools/surface.d.ts +7 -11
- package/dist/tools/surface.d.ts.map +1 -1
- package/dist/tools/transfer/define-download-tool.d.ts +1 -1
- package/dist/tools/transfer/define-download-tool.d.ts.map +1 -1
- package/dist/tools/transfer/define-upload-tool.d.ts +1 -1
- package/dist/tools/transfer/define-upload-tool.d.ts.map +1 -1
- package/dist/tools/transfer/define-view-file-tool.d.ts +1 -1
- package/dist/tools/transfer/define-view-file-tool.d.ts.map +1 -1
- package/dist/tools/transfer/managed-file-error.d.ts.map +1 -1
- package/dist/tools/transfer/view-file-contract.d.ts.map +1 -1
- package/dist/tools/transfer/view-file.d.ts +1 -1
- package/dist/tools/transfer/view-file.d.ts.map +1 -1
- package/dist/tools/transports.d.ts +3 -2
- package/dist/tools/transports.d.ts.map +1 -1
- package/llms/agent-runtime-browser.txt +10 -4
- package/llms/agent-runtime-harness.txt +32 -31
- package/llms/agent-runtime-react.txt +1 -1
- package/llms/agent-runtime-realtime.txt +14 -5
- package/llms/agent-runtime-sandbox.txt +3 -11
- package/llms/agent-runtime.3.txt +2 -2
- package/llms/agent-runtime.txt +0 -9
- package/llms/application.2.txt +3 -12
- package/llms/application.3.txt +7 -4
- package/llms/application.txt +44 -15
- package/llms/cli-publish.txt +29 -0
- package/llms/cli.2.txt +9 -11
- package/llms/cli.txt +26 -14
- package/llms/declaration.txt +0 -9
- package/llms/files-packaging.txt +22 -7
- package/llms/files.txt +4 -2
- package/llms/geo.txt +0 -9
- package/llms/live.txt +4 -13
- package/llms/observability.txt +31 -5
- package/llms/primitives.txt +38 -20
- package/llms/process.txt +305 -154
- package/llms/react-keyboard.txt +0 -9
- package/llms/react.txt +0 -18
- package/llms/server.4.txt +1 -1
- package/llms/server.5.txt +1 -1
- package/llms/server.txt +1 -1
- package/llms/stitchkit.txt +6 -7
- package/llms/telegram-screens.txt +2 -2
- package/llms/testing.txt +0 -1
- package/llms/tools-mcp.txt +2 -3
- package/llms/tools.2.txt +12 -0
- package/llms/tools.3.txt +5 -6
- package/llms/tools.txt +6 -4
- package/llms/upgrading-0.37.0-0.50.0.txt +947 -0
- package/llms/{upgrading-0.44.0-0.61.0.txt → upgrading-0.53.0-0.67.0.txt} +576 -506
- package/llms/{upgrading-0.62.0-0.80.0.txt → upgrading-0.68.0-0.94.0.txt} +562 -576
- package/llms/{upgrading-0.81.0-0.104.0.txt → upgrading-0.95.0-0.105.0.txt} +452 -567
- package/llms/upgrading.txt +4 -4
- package/llms-full.txt +1053 -405
- package/llms.txt +24 -24
- package/native-assets.json +11 -3
- package/package.json +6 -6
- package/dist/agent-runtime/harness-tools.d.ts +0 -11
- package/dist/agent-runtime/harness-tools.d.ts.map +0 -1
- package/dist/entrypoints/agent-runtime/harness-tools.d.ts +0 -2
- package/dist/entrypoints/agent-runtime/harness-tools.d.ts.map +0 -1
- package/dist/entrypoints/agent-runtime/harness-tools.js +0 -32
- package/dist/index-1a6jtnd9.js +0 -88
- package/dist/index-8a9ksm91.js +0 -95
- package/dist/index-a3wma1hk.js +0 -48
- package/dist/index-jd470k6q.js +0 -109
- package/dist/index-n1dqr7gf.js +0 -20
- package/dist/index-nggfa2yn.js +0 -34
- package/dist/index-s4evrmp5.js +0 -98
- package/dist/index-ze1eph1k.js +0 -20
- package/dist/tools/connections/error-projection.d.ts +0 -4
- package/dist/tools/connections/error-projection.d.ts.map +0 -1
- package/dist/tools/runtime-tool-execution.d.ts.map +0 -1
- package/llms/agent-runtime-harness-tools.txt +0 -25
- package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
raceAbort
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-b0kddvzw.js";
|
|
4
|
+
import {
|
|
5
|
+
MAX_TIMER_MS,
|
|
6
|
+
sleep
|
|
7
|
+
} from "./index-eemvahkc.js";
|
|
8
|
+
import {
|
|
9
|
+
assertPositiveSafeInteger
|
|
10
|
+
} from "./index-0s4xebbg.js";
|
|
4
11
|
|
|
5
12
|
// src/process/contract.ts
|
|
6
13
|
import { z } from "zod";
|
|
@@ -12,6 +19,14 @@ var NativeCommandSettlementSchema = z.discriminatedUnion("kind", [
|
|
|
12
19
|
}),
|
|
13
20
|
z.object({ kind: z.literal("error"), cause: z.unknown() })
|
|
14
21
|
]);
|
|
22
|
+
var COMMAND_CLEANUP_TIMEOUT_MS = 2000;
|
|
23
|
+
var MAX_COMMAND_STOP_GRACE_MS = 3600000;
|
|
24
|
+
var NativeCommandStopPolicySchema = z.strictObject({
|
|
25
|
+
target: z.enum(["group", "leader"]),
|
|
26
|
+
signal: z.enum(["SIGTERM", "SIGINT", "SIGHUP", "SIGQUIT", "SIGUSR1", "SIGUSR2"]).default("SIGTERM"),
|
|
27
|
+
graceMs: z.number().int().nonnegative().max(MAX_COMMAND_STOP_GRACE_MS),
|
|
28
|
+
killOn: z.custom((v) => v instanceof AbortSignal).optional()
|
|
29
|
+
});
|
|
15
30
|
var NativeCommandOptionsSchema = z.strictObject({
|
|
16
31
|
executable: z.string().min(1),
|
|
17
32
|
args: z.array(z.string()).default([]),
|
|
@@ -19,25 +34,40 @@ var NativeCommandOptionsSchema = z.strictObject({
|
|
|
19
34
|
env: z.record(z.string(), z.string()).optional(),
|
|
20
35
|
envPolicy: z.enum(["declared-only", "ambient"]).default("declared-only"),
|
|
21
36
|
signal: z.custom((v) => v instanceof AbortSignal).optional(),
|
|
22
|
-
timeoutMs: z.number().int().positive().max(
|
|
37
|
+
timeoutMs: z.number().int().positive().max(MAX_TIMER_MS).optional(),
|
|
23
38
|
maxOutputBytes: z.number().int().positive().optional(),
|
|
24
39
|
capture: z.boolean().default(false),
|
|
25
40
|
stdin: z.custom((v) => v instanceof Uint8Array).optional(),
|
|
26
41
|
maxStdinBytes: z.number().int().positive().default(1024 * 1024),
|
|
27
42
|
onOutput: z.custom((v) => typeof v === "function").optional(),
|
|
28
43
|
onLeaderSettled: z.custom((v) => typeof v === "function").optional(),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
stop: NativeCommandStopPolicySchema.default({
|
|
45
|
+
target: "group",
|
|
46
|
+
signal: "SIGTERM",
|
|
47
|
+
graceMs: 100
|
|
48
|
+
}),
|
|
49
|
+
descendants: z.enum(["terminate-after-leader", "leave"]).default("terminate-after-leader"),
|
|
50
|
+
cleanupTimeoutMs: z.number().int().positive().max(30000).default(COMMAND_CLEANUP_TIMEOUT_MS)
|
|
51
|
+
}).check((ctx) => {
|
|
52
|
+
const input = ctx.value;
|
|
32
53
|
if (!input.signal && input.timeoutMs === undefined)
|
|
33
|
-
ctx.
|
|
54
|
+
ctx.issues.push({
|
|
55
|
+
code: "custom",
|
|
56
|
+
input: ctx.value,
|
|
57
|
+
message: "Declare a caller signal or a finite timeout"
|
|
58
|
+
});
|
|
34
59
|
if (input.capture && input.maxOutputBytes === undefined)
|
|
35
|
-
ctx.
|
|
60
|
+
ctx.issues.push({
|
|
36
61
|
code: "custom",
|
|
62
|
+
input: ctx.value,
|
|
37
63
|
message: "Capture requires a finite combined output budget"
|
|
38
64
|
});
|
|
39
65
|
if (input.stdin && input.stdin.byteLength > input.maxStdinBytes)
|
|
40
|
-
ctx.
|
|
66
|
+
ctx.issues.push({
|
|
67
|
+
code: "custom",
|
|
68
|
+
input: ctx.value,
|
|
69
|
+
message: "stdin exceeds maxStdinBytes"
|
|
70
|
+
});
|
|
41
71
|
});
|
|
42
72
|
var NativeCommandResultSchema = z.object({
|
|
43
73
|
exitCode: z.number().int().nullable(),
|
|
@@ -62,8 +92,7 @@ class NativeCommandError2 extends Error {
|
|
|
62
92
|
|
|
63
93
|
// src/process/group.ts
|
|
64
94
|
function createCommandDeadline(timeoutMs, reason) {
|
|
65
|
-
|
|
66
|
-
throw new RangeError("Command deadline must be a positive safe integer");
|
|
95
|
+
assertPositiveSafeInteger("Command deadline", timeoutMs, RangeError);
|
|
67
96
|
const controller = new AbortController;
|
|
68
97
|
const deadline = performance.now() + timeoutMs;
|
|
69
98
|
let timer;
|
|
@@ -72,7 +101,7 @@ function createCommandDeadline(timeoutMs, reason) {
|
|
|
72
101
|
if (remaining <= 0)
|
|
73
102
|
controller.abort(reason);
|
|
74
103
|
else
|
|
75
|
-
timer = setTimeout(schedule, Math.min(remaining,
|
|
104
|
+
timer = setTimeout(schedule, Math.min(remaining, MAX_TIMER_MS));
|
|
76
105
|
};
|
|
77
106
|
schedule();
|
|
78
107
|
return {
|
|
@@ -86,14 +115,19 @@ function createCommandDeadline(timeoutMs, reason) {
|
|
|
86
115
|
function deniedOnDarwin(error) {
|
|
87
116
|
return process.platform === "darwin" && error instanceof Error && "code" in error && error.code === "EPERM";
|
|
88
117
|
}
|
|
118
|
+
function isErrno(error, code) {
|
|
119
|
+
return error instanceof Error && "code" in error && error.code === code;
|
|
120
|
+
}
|
|
89
121
|
function signalGroup(pid, signal) {
|
|
90
122
|
if (pid === undefined)
|
|
91
|
-
return;
|
|
123
|
+
return false;
|
|
92
124
|
try {
|
|
93
125
|
process.kill(-pid, signal);
|
|
126
|
+
return true;
|
|
94
127
|
} catch (error) {
|
|
95
|
-
if (
|
|
96
|
-
|
|
128
|
+
if (isErrno(error, "ESRCH"))
|
|
129
|
+
return false;
|
|
130
|
+
throw error;
|
|
97
131
|
}
|
|
98
132
|
}
|
|
99
133
|
function exists(pid) {
|
|
@@ -103,7 +137,7 @@ function exists(pid) {
|
|
|
103
137
|
process.kill(-pid, 0);
|
|
104
138
|
return true;
|
|
105
139
|
} catch (error) {
|
|
106
|
-
if (error
|
|
140
|
+
if (isErrno(error, "ESRCH"))
|
|
107
141
|
return false;
|
|
108
142
|
if (deniedOnDarwin(error))
|
|
109
143
|
return true;
|
|
@@ -113,8 +147,7 @@ function exists(pid) {
|
|
|
113
147
|
async function signalUntilSettled(pid, signal, deadline) {
|
|
114
148
|
for (;; ) {
|
|
115
149
|
try {
|
|
116
|
-
signalGroup(pid, signal);
|
|
117
|
-
return;
|
|
150
|
+
return signalGroup(pid, signal);
|
|
118
151
|
} catch (error) {
|
|
119
152
|
if (!deniedOnDarwin(error) || performance.now() >= deadline)
|
|
120
153
|
throw error;
|
|
@@ -122,16 +155,49 @@ async function signalUntilSettled(pid, signal, deadline) {
|
|
|
122
155
|
}
|
|
123
156
|
}
|
|
124
157
|
}
|
|
125
|
-
async function stopCommandGroup(
|
|
126
|
-
const
|
|
127
|
-
|
|
158
|
+
async function stopCommandGroup(stop) {
|
|
159
|
+
const { pid, policy } = stop;
|
|
160
|
+
const deadline = performance.now() + policy.graceMs + stop.cleanupTimeoutMs;
|
|
161
|
+
if (stop.force || policy.killOn?.aborted) {
|
|
128
162
|
await signalUntilSettled(pid, "SIGKILL", deadline);
|
|
129
163
|
return;
|
|
130
164
|
}
|
|
131
|
-
await signalUntilSettled(pid,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
165
|
+
if (!await signalUntilSettled(pid, policy.signal, deadline))
|
|
166
|
+
return;
|
|
167
|
+
const until = performance.now() + policy.graceMs;
|
|
168
|
+
let interval = 10;
|
|
169
|
+
let present = exists(pid);
|
|
170
|
+
while (present && !policy.killOn?.aborted && performance.now() < until) {
|
|
171
|
+
await sleep(Math.min(interval, until - performance.now()), policy.killOn).catch(() => {
|
|
172
|
+
return;
|
|
173
|
+
});
|
|
174
|
+
interval = Math.min(interval * 2, 250);
|
|
175
|
+
present = exists(pid);
|
|
176
|
+
}
|
|
177
|
+
if (present)
|
|
178
|
+
await signalUntilSettled(pid, "SIGKILL", deadline);
|
|
179
|
+
}
|
|
180
|
+
async function stopCommandLeader(stop) {
|
|
181
|
+
const { pid, policy, leader } = stop;
|
|
182
|
+
const deadline = performance.now() + policy.graceMs + stop.cleanupTimeoutMs;
|
|
183
|
+
const running = () => leader.exitCode === null && leader.signalCode === null;
|
|
184
|
+
if (!stop.force && !policy.killOn?.aborted && pid !== undefined && running()) {
|
|
185
|
+
try {
|
|
186
|
+
process.kill(pid, policy.signal);
|
|
187
|
+
} catch (error) {
|
|
188
|
+
if (!isErrno(error, "ESRCH"))
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
const grace = new AbortController;
|
|
192
|
+
const end = () => grace.abort();
|
|
193
|
+
policy.killOn?.addEventListener("abort", end, { once: true });
|
|
194
|
+
stop.leaderExit.then(end, end);
|
|
195
|
+
await sleep(policy.graceMs, grace.signal).catch(() => {
|
|
196
|
+
return;
|
|
197
|
+
});
|
|
198
|
+
policy.killOn?.removeEventListener("abort", end);
|
|
199
|
+
grace.abort();
|
|
200
|
+
}
|
|
135
201
|
await signalUntilSettled(pid, "SIGKILL", deadline);
|
|
136
202
|
}
|
|
137
203
|
function commandCleanupError(cause) {
|
|
@@ -146,18 +212,26 @@ function waitForCommandClose(closed, timeoutMs) {
|
|
|
146
212
|
|
|
147
213
|
// src/process/cleanup.ts
|
|
148
214
|
async function cleanupNativeCommand(input) {
|
|
215
|
+
const signalled = Promise.resolve().then(input.signal);
|
|
216
|
+
const teardown = () => input.transport?.destroy();
|
|
217
|
+
const destroyed = signalled.then(teardown, teardown);
|
|
218
|
+
const awaitRelease = async () => {
|
|
219
|
+
if (!input.transport)
|
|
220
|
+
return;
|
|
221
|
+
try {
|
|
222
|
+
await waitForCommandClose(input.transport.released, input.timeoutMs);
|
|
223
|
+
} catch (cause) {
|
|
224
|
+
throw new Error(`Command handles remained open: ${[...input.transport.pendingHandles].join(", ")}`, { cause });
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
const released = signalled.then(awaitRelease, () => {
|
|
228
|
+
return;
|
|
229
|
+
});
|
|
149
230
|
const cleanup = await Promise.allSettled([
|
|
150
231
|
input.settle(input.event ?? { kind: "error", cause: input.error }),
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return;
|
|
155
|
-
try {
|
|
156
|
-
await waitForCommandClose(input.transport.released, input.timeoutMs);
|
|
157
|
-
} catch (cause) {
|
|
158
|
-
throw new Error(`Command handles remained open: ${[...input.transport.pendingHandles].join(", ")}`, { cause });
|
|
159
|
-
}
|
|
160
|
-
})
|
|
232
|
+
destroyed,
|
|
233
|
+
signalled,
|
|
234
|
+
released
|
|
161
235
|
]);
|
|
162
236
|
const failures = cleanup.flatMap((item) => item.status === "rejected" && item.reason !== input.error ? [item.reason] : []);
|
|
163
237
|
if (failures.length)
|
|
@@ -165,6 +239,11 @@ async function cleanupNativeCommand(input) {
|
|
|
165
239
|
}
|
|
166
240
|
|
|
167
241
|
// src/process/command-lifetime.ts
|
|
242
|
+
class CommandStopped extends DOMException {
|
|
243
|
+
constructor() {
|
|
244
|
+
super("Command stopped", "AbortError");
|
|
245
|
+
}
|
|
246
|
+
}
|
|
168
247
|
function createCommandLifetime(input) {
|
|
169
248
|
const acceptSettlement = (error) => {
|
|
170
249
|
if (error instanceof NativeCommandError2 && error.code === "COMMAND_CLEANUP")
|
|
@@ -198,7 +277,7 @@ function createCommandLifetime(input) {
|
|
|
198
277
|
},
|
|
199
278
|
async stop() {
|
|
200
279
|
if (!input.finished())
|
|
201
|
-
input.controller.abort(new
|
|
280
|
+
input.controller.abort(new CommandStopped);
|
|
202
281
|
await input.result.then(() => {
|
|
203
282
|
return;
|
|
204
283
|
}, acceptSettlement);
|
|
@@ -329,13 +408,13 @@ function createCommandTransport(child) {
|
|
|
329
408
|
function nativeCommandBudgets(options, driver) {
|
|
330
409
|
const cleanupTimeoutMs = driver?.cleanupTimeoutMs ?? options.cleanupTimeoutMs;
|
|
331
410
|
const timeoutMs = driver?.timeoutMs ?? options.timeoutMs;
|
|
332
|
-
|
|
411
|
+
const budgets = [
|
|
333
412
|
["cleanup", cleanupTimeoutMs],
|
|
334
413
|
["execution", timeoutMs],
|
|
335
414
|
["close", driver?.closeTimeoutMs]
|
|
336
|
-
]
|
|
337
|
-
|
|
338
|
-
|
|
415
|
+
];
|
|
416
|
+
for (const [name, value] of budgets)
|
|
417
|
+
assertPositiveSafeInteger(`Command ${name} deadline`, value, RangeError);
|
|
339
418
|
return { cleanupTimeoutMs, timeoutMs };
|
|
340
419
|
}
|
|
341
420
|
var owners = new WeakMap;
|
|
@@ -414,7 +493,14 @@ function outputStream(source, closed, maxBufferedBytes) {
|
|
|
414
493
|
}
|
|
415
494
|
};
|
|
416
495
|
}
|
|
417
|
-
function launchNativeCommand(
|
|
496
|
+
function launchNativeCommand({
|
|
497
|
+
options,
|
|
498
|
+
driver,
|
|
499
|
+
onSpawn,
|
|
500
|
+
onFailure,
|
|
501
|
+
onInputFailure,
|
|
502
|
+
onAcquired
|
|
503
|
+
}) {
|
|
418
504
|
let native;
|
|
419
505
|
const launch = driver?.launch;
|
|
420
506
|
if (!launch)
|
|
@@ -518,10 +604,45 @@ async function failedCommandStart(cause, cleanup) {
|
|
|
518
604
|
throw error;
|
|
519
605
|
}
|
|
520
606
|
|
|
607
|
+
// src/process/terminate.ts
|
|
608
|
+
function signalCommandChild(child, input) {
|
|
609
|
+
if (input.group && ownsCommandGroup(child)) {
|
|
610
|
+
const stop = {
|
|
611
|
+
pid: child.pid,
|
|
612
|
+
policy: input.policy,
|
|
613
|
+
cleanupTimeoutMs: input.cleanupTimeoutMs,
|
|
614
|
+
force: input.force
|
|
615
|
+
};
|
|
616
|
+
return input.policy.target === "leader" ? stopCommandLeader({ ...stop, leader: child, leaderExit: input.leaderExit }) : stopCommandGroup(stop);
|
|
617
|
+
}
|
|
618
|
+
return Promise.resolve().then(() => {
|
|
619
|
+
if (child.exitCode === null && child.signalCode === null && !child.kill("SIGKILL"))
|
|
620
|
+
throw new Error("Command leader termination was refused");
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
async function terminateOwnedGroup(child, closed, cleanupTimeoutMs) {
|
|
624
|
+
try {
|
|
625
|
+
await signalCommandChild(child, {
|
|
626
|
+
group: true,
|
|
627
|
+
policy: { target: "group", signal: "SIGTERM", graceMs: 0 },
|
|
628
|
+
leaderExit: closed,
|
|
629
|
+
cleanupTimeoutMs,
|
|
630
|
+
force: true
|
|
631
|
+
});
|
|
632
|
+
await waitForCommandClose(closed, cleanupTimeoutMs);
|
|
633
|
+
} catch (cause) {
|
|
634
|
+
for (const pipe of [child.stdin, child.stdout, child.stderr])
|
|
635
|
+
pipe.destroy();
|
|
636
|
+
throw commandCleanupError(cause);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
521
640
|
// src/process/command-owner.ts
|
|
522
641
|
function startNativeCommand(input, onSpawn, driver) {
|
|
523
642
|
const options = NativeCommandOptionsSchema.parse(input);
|
|
524
643
|
options.signal?.throwIfAborted();
|
|
644
|
+
const { killOn } = options.stop;
|
|
645
|
+
killOn?.throwIfAborted();
|
|
525
646
|
if (process.platform === "win32" && driver?.group !== false)
|
|
526
647
|
throw new NativeCommandError2("COMMAND_UNAVAILABLE", "POSIX process groups are required");
|
|
527
648
|
const { cleanupTimeoutMs, timeoutMs } = nativeCommandBudgets(options, driver);
|
|
@@ -530,6 +651,12 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
530
651
|
options.signal?.addEventListener("abort", abort, { once: true });
|
|
531
652
|
if (options.signal?.aborted)
|
|
532
653
|
abort();
|
|
654
|
+
const kill = () => controller.abort(killOn?.reason);
|
|
655
|
+
killOn?.addEventListener("abort", kill, { once: true });
|
|
656
|
+
const release = () => {
|
|
657
|
+
options.signal?.removeEventListener("abort", abort);
|
|
658
|
+
killOn?.removeEventListener("abort", kill);
|
|
659
|
+
};
|
|
533
660
|
const deadline = timeoutMs === undefined ? undefined : createCommandDeadline(timeoutMs, new NativeCommandError2("COMMAND_LIMIT", "Command deadline exceeded", {
|
|
534
661
|
reason: "deadline"
|
|
535
662
|
}));
|
|
@@ -549,13 +676,15 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
549
676
|
return;
|
|
550
677
|
});
|
|
551
678
|
const signalOwned = (force = driver?.force) => {
|
|
552
|
-
|
|
553
|
-
if (!child)
|
|
679
|
+
if (!acquired)
|
|
554
680
|
return Promise.resolve();
|
|
555
|
-
return
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
681
|
+
return signalCommandChild(acquired.child, {
|
|
682
|
+
group: driver?.group !== false,
|
|
683
|
+
policy: options.stop,
|
|
684
|
+
leaderExit: acquired.leader,
|
|
685
|
+
cleanupTimeoutMs,
|
|
686
|
+
force: force === true
|
|
687
|
+
});
|
|
559
688
|
};
|
|
560
689
|
const owner = createCommandLifetime({
|
|
561
690
|
result,
|
|
@@ -567,19 +696,26 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
567
696
|
let spawnFailure;
|
|
568
697
|
let launched;
|
|
569
698
|
try {
|
|
570
|
-
launched = launchNativeCommand(
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
699
|
+
launched = launchNativeCommand({
|
|
700
|
+
options,
|
|
701
|
+
driver,
|
|
702
|
+
onSpawn,
|
|
703
|
+
onFailure: (error) => {
|
|
704
|
+
spawnFailure = new NativeCommandError2("COMMAND_UNAVAILABLE", "Command could not start", {
|
|
705
|
+
cause: error
|
|
706
|
+
});
|
|
707
|
+
controller.abort(spawnFailure);
|
|
708
|
+
},
|
|
709
|
+
onInputFailure: (error) => controller.abort(error),
|
|
710
|
+
onAcquired: (transport) => {
|
|
711
|
+
acquired = transport;
|
|
712
|
+
registerNativeCommandOwner(transport.child, owner);
|
|
713
|
+
}
|
|
578
714
|
});
|
|
579
715
|
} catch (cause) {
|
|
580
716
|
deadline?.cancel();
|
|
581
717
|
deadline?.signal.removeEventListener("abort", expired);
|
|
582
|
-
|
|
718
|
+
release();
|
|
583
719
|
controller.abort(cause);
|
|
584
720
|
failedCommandStart(cause, (error) => cleanupNativeCommand({
|
|
585
721
|
error,
|
|
@@ -598,7 +734,8 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
598
734
|
const cancelCloseDeadline = createLeaderCloseDeadline(leader, driver?.closeTimeoutMs, controller);
|
|
599
735
|
const drain = async (stream, channel, captured) => {
|
|
600
736
|
for await (const chunk of stream) {
|
|
601
|
-
controller.signal.
|
|
737
|
+
if (controller.signal.aborted)
|
|
738
|
+
continue;
|
|
602
739
|
if (!(chunk instanceof Uint8Array))
|
|
603
740
|
throw new TypeError("Expected binary command output");
|
|
604
741
|
total += chunk.byteLength;
|
|
@@ -609,10 +746,27 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
609
746
|
if (options.capture)
|
|
610
747
|
captured.push(Uint8Array.from(chunk));
|
|
611
748
|
if (options.onOutput)
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
749
|
+
try {
|
|
750
|
+
await raceAbort(Promise.resolve().then(() => {
|
|
751
|
+
controller.signal.throwIfAborted();
|
|
752
|
+
return options.onOutput?.(chunk, channel, controller.signal);
|
|
753
|
+
}), controller.signal);
|
|
754
|
+
} catch (error) {
|
|
755
|
+
if (!controller.signal.aborted || error !== controller.signal.reason)
|
|
756
|
+
throw error;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
const settleLeader = async (event) => {
|
|
761
|
+
await settle(event);
|
|
762
|
+
if (controller.signal.aborted)
|
|
763
|
+
return;
|
|
764
|
+
if (options.descendants !== "terminate-after-leader" || event.kind !== "exit")
|
|
765
|
+
return;
|
|
766
|
+
try {
|
|
767
|
+
await signalOwned();
|
|
768
|
+
} catch (cause) {
|
|
769
|
+
throw commandCleanupError(cause);
|
|
616
770
|
}
|
|
617
771
|
};
|
|
618
772
|
const run = (async () => {
|
|
@@ -622,7 +776,7 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
622
776
|
drain(output, "stdout", stdout),
|
|
623
777
|
drain(errorOutput, "stderr", stderr)
|
|
624
778
|
]);
|
|
625
|
-
await raceAbort(Promise.all([drains, leader.then(
|
|
779
|
+
await raceAbort(Promise.all([drains, leader.then(settleLeader)]), controller.signal);
|
|
626
780
|
const status = await raceAbort(closed, controller.signal);
|
|
627
781
|
if (spawnFailure !== undefined)
|
|
628
782
|
throw spawnFailure;
|
|
@@ -642,7 +796,7 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
642
796
|
cancelCloseDeadline();
|
|
643
797
|
deadline?.cancel();
|
|
644
798
|
deadline?.signal.removeEventListener("abort", expired);
|
|
645
|
-
|
|
799
|
+
release();
|
|
646
800
|
controller.abort(new Error("Command completed"));
|
|
647
801
|
}
|
|
648
802
|
})();
|
|
@@ -650,4 +804,4 @@ function startNativeCommand(input, onSpawn, driver) {
|
|
|
650
804
|
return owner;
|
|
651
805
|
}
|
|
652
806
|
|
|
653
|
-
export { NativeCommandError2,
|
|
807
|
+
export { COMMAND_CLEANUP_TIMEOUT_MS, NativeCommandError2, CommandStopped, spawnOwnedCommand, nativeCommandOwner, terminateOwnedGroup, startNativeCommand };
|
|
@@ -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, {
|
|
@@ -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 };
|