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,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validateDeclaredOutput
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-rpzewktb.js";
|
|
4
4
|
import {
|
|
5
5
|
toolResultFromError,
|
|
6
6
|
toolErrorFromResult
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-2k91mewf.js";
|
|
8
8
|
import {
|
|
9
9
|
coerceJsonArgs2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-6yxhe58g.js";
|
|
11
11
|
import {
|
|
12
12
|
jsonSchemaFields
|
|
13
13
|
} from "./index-ct75c3at.js";
|
|
@@ -15,17 +15,24 @@ import {
|
|
|
15
15
|
objectShapeKeys,
|
|
16
16
|
assertUniqueToolName,
|
|
17
17
|
buildToolPresentationSchema
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-r393tnfp.js";
|
|
19
19
|
import {
|
|
20
20
|
createToolRunner,
|
|
21
21
|
formatToolError
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-wbhdzxar.js";
|
|
23
|
+
import {
|
|
24
|
+
fetchGuarded,
|
|
25
|
+
readCapped
|
|
26
|
+
} from "./index-3h0ztg0z.js";
|
|
23
27
|
import {
|
|
24
28
|
isWithinDir2
|
|
25
29
|
} from "./index-5cc6r990.js";
|
|
30
|
+
import {
|
|
31
|
+
sleep
|
|
32
|
+
} from "./index-eemvahkc.js";
|
|
26
33
|
import {
|
|
27
34
|
collectToolSurface
|
|
28
|
-
} from "./index-
|
|
35
|
+
} from "./index-pz3y6b6g.js";
|
|
29
36
|
import {
|
|
30
37
|
formatZodError2
|
|
31
38
|
} from "./index-1eeqpadm.js";
|
|
@@ -726,6 +733,9 @@ function routeCliArgv2(argv, defaultCommand) {
|
|
|
726
733
|
};
|
|
727
734
|
}
|
|
728
735
|
|
|
736
|
+
// src/tools/cli/args.ts
|
|
737
|
+
import { z as z2 } from "zod";
|
|
738
|
+
|
|
729
739
|
// src/tools/cli/args-view.ts
|
|
730
740
|
function resolveCliView(flags, ascending) {
|
|
731
741
|
if (flags.size === 0) {
|
|
@@ -839,7 +849,6 @@ function readCliTokens(argv, fields, config) {
|
|
|
839
849
|
continue;
|
|
840
850
|
}
|
|
841
851
|
if (tok === "-h") {
|
|
842
|
-
appendCliOptionValue(frameworkFlags, "help", "true", { kind: "boolean" });
|
|
843
852
|
options.help = true;
|
|
844
853
|
continue;
|
|
845
854
|
}
|
|
@@ -885,9 +894,11 @@ function readCliTokens(argv, fields, config) {
|
|
|
885
894
|
const separate = value === undefined ? separateBoolValue(argv[i + 1]) : undefined;
|
|
886
895
|
if (separate !== undefined)
|
|
887
896
|
i++;
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
897
|
+
if (name !== "help") {
|
|
898
|
+
appendCliOptionValue(frameworkFlags, name, value ?? String(separate ?? true), {
|
|
899
|
+
kind: "boolean"
|
|
900
|
+
});
|
|
901
|
+
}
|
|
891
902
|
const enabled = value === undefined ? separate ?? true : parseReservedBool(name, value);
|
|
892
903
|
if (name === "dry-run")
|
|
893
904
|
options.dryRun = enabled;
|
|
@@ -900,7 +911,7 @@ function readCliTokens(argv, fields, config) {
|
|
|
900
911
|
else if (name === "ascending")
|
|
901
912
|
ascending = enabled;
|
|
902
913
|
else
|
|
903
|
-
options.help = enabled;
|
|
914
|
+
options.help = options.help || enabled;
|
|
904
915
|
continue;
|
|
905
916
|
}
|
|
906
917
|
if (option.globalKind === "value") {
|
|
@@ -1022,6 +1033,11 @@ function parseCliArgs2(argv, schema, config = {}) {
|
|
|
1022
1033
|
options.view = view;
|
|
1023
1034
|
return { toolArgs: buildToolArgs(tokens, fields, config.positionals), options };
|
|
1024
1035
|
}
|
|
1036
|
+
function refuseGlobalOption(issue) {
|
|
1037
|
+
const field = issue?.path[0];
|
|
1038
|
+
const where = typeof field === "string" ? `--${field}` : "application option";
|
|
1039
|
+
throw new CliArgumentError2(`${where}: ${issue?.message ?? "invalid value"}`);
|
|
1040
|
+
}
|
|
1025
1041
|
function extractCliGlobalOptions2(argv, schema) {
|
|
1026
1042
|
if (schema === undefined)
|
|
1027
1043
|
return { argv: [...argv], globals: {} };
|
|
@@ -1062,13 +1078,17 @@ function extractCliGlobalOptions2(argv, schema) {
|
|
|
1062
1078
|
for (const [name, values] of raw) {
|
|
1063
1079
|
args[name] = coerceField(fields.get(name), values, `--${name}`);
|
|
1064
1080
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1081
|
+
let coerced;
|
|
1082
|
+
try {
|
|
1083
|
+
coerced = coerceJsonArgs2(args, schema);
|
|
1084
|
+
} catch (error) {
|
|
1085
|
+
if (error instanceof z2.ZodError)
|
|
1086
|
+
refuseGlobalOption(error.issues[0]);
|
|
1087
|
+
throw error;
|
|
1071
1088
|
}
|
|
1089
|
+
const parsed = schema.safeParse(coerced);
|
|
1090
|
+
if (!parsed.success)
|
|
1091
|
+
refuseGlobalOption(parsed.error.issues[0]);
|
|
1072
1092
|
return { argv: rest, globals: parsed.data };
|
|
1073
1093
|
}
|
|
1074
1094
|
|
|
@@ -1229,35 +1249,11 @@ class WaitTimeoutError extends Error {
|
|
|
1229
1249
|
this.name = "WaitTimeoutError";
|
|
1230
1250
|
}
|
|
1231
1251
|
}
|
|
1232
|
-
var defaultSleep = (ms, signal) => {
|
|
1233
|
-
signal?.throwIfAborted();
|
|
1234
|
-
return new Promise((resolve, reject) => {
|
|
1235
|
-
let settled = false;
|
|
1236
|
-
const settle = (action) => {
|
|
1237
|
-
if (settled)
|
|
1238
|
-
return;
|
|
1239
|
-
settled = true;
|
|
1240
|
-
signal?.removeEventListener("abort", onAbort);
|
|
1241
|
-
action();
|
|
1242
|
-
};
|
|
1243
|
-
const timer = setTimeout(() => {
|
|
1244
|
-
settle(resolve);
|
|
1245
|
-
}, ms);
|
|
1246
|
-
timer.unref?.();
|
|
1247
|
-
const onAbort = () => {
|
|
1248
|
-
clearTimeout(timer);
|
|
1249
|
-
settle(() => reject(signal?.reason ?? new Error("aborted")));
|
|
1250
|
-
};
|
|
1251
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1252
|
-
if (signal?.aborted)
|
|
1253
|
-
onAbort();
|
|
1254
|
-
});
|
|
1255
|
-
};
|
|
1256
1252
|
async function pollUntil(params) {
|
|
1257
1253
|
const backoff = params.backoff?.length ? params.backoff : DEFAULT_BACKOFF;
|
|
1258
1254
|
const lastBackoff = backoff[backoff.length - 1] ?? 5;
|
|
1259
1255
|
const timeoutSec = params.timeoutSec ?? DEFAULT_TIMEOUT;
|
|
1260
|
-
const
|
|
1256
|
+
const pause = params.sleepFn ?? sleep;
|
|
1261
1257
|
const now = params.nowFn ?? (() => performance.now());
|
|
1262
1258
|
const startedAt = now();
|
|
1263
1259
|
const deadline = startedAt + timeoutSec * 1000;
|
|
@@ -1299,7 +1295,7 @@ async function pollUntil(params) {
|
|
|
1299
1295
|
if (elapsedSec >= timeoutSec)
|
|
1300
1296
|
return { state, timedOut: true };
|
|
1301
1297
|
const waitSec = backoff[Math.min(attempt, backoff.length - 1)] ?? lastBackoff;
|
|
1302
|
-
await
|
|
1298
|
+
await pause(Math.min(waitSec * 1000, Math.max(0, deadline - now())), params.signal);
|
|
1303
1299
|
}
|
|
1304
1300
|
}
|
|
1305
1301
|
function runWaitOperation(params) {
|
|
@@ -1459,305 +1455,6 @@ function createCliIo(config) {
|
|
|
1459
1455
|
// src/tools/cli/download.ts
|
|
1460
1456
|
import { basename, resolve } from "node:path";
|
|
1461
1457
|
|
|
1462
|
-
// src/internal/secure-fetch.ts
|
|
1463
|
-
import { lookup } from "node:dns/promises";
|
|
1464
|
-
import { request as httpRequest } from "node:http";
|
|
1465
|
-
import { request as httpsRequest } from "node:https";
|
|
1466
|
-
import { isIP } from "node:net";
|
|
1467
|
-
var NUMERIC_HOST = /^(0x[0-9a-f]+|[0-9.]+)$/i;
|
|
1468
|
-
var MAX_REDIRECTS = 5;
|
|
1469
|
-
function assertHttpUrl(url) {
|
|
1470
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
1471
|
-
throw new Error(`refusing to fetch a non-http(s) URL (${url.protocol})`);
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
function mappedIpv4FromIpv6(ip) {
|
|
1475
|
-
const rest = ip.startsWith("::ffff:") ? ip.slice("::ffff:".length) : ip.startsWith("0:0:0:0:0:ffff:") ? ip.slice("0:0:0:0:0:ffff:".length) : null;
|
|
1476
|
-
if (rest === null)
|
|
1477
|
-
return null;
|
|
1478
|
-
if (isIP(rest) === 4)
|
|
1479
|
-
return rest;
|
|
1480
|
-
const [hiRaw, loRaw, extra] = rest.split(":");
|
|
1481
|
-
if (hiRaw === undefined || loRaw === undefined || extra !== undefined)
|
|
1482
|
-
return null;
|
|
1483
|
-
if (!/^[0-9a-f]{1,4}$/i.test(hiRaw) || !/^[0-9a-f]{1,4}$/i.test(loRaw))
|
|
1484
|
-
return null;
|
|
1485
|
-
const hi = Number.parseInt(hiRaw, 16);
|
|
1486
|
-
const lo = Number.parseInt(loRaw, 16);
|
|
1487
|
-
return [hi >> 8, hi & 255, lo >> 8, lo & 255].join(".");
|
|
1488
|
-
}
|
|
1489
|
-
function ipv6Words(ip) {
|
|
1490
|
-
const halves = ip.toLowerCase().split("::");
|
|
1491
|
-
if (halves.length > 2)
|
|
1492
|
-
return null;
|
|
1493
|
-
const head = halves[0] ? halves[0].split(":") : [];
|
|
1494
|
-
const tail = halves[1] ? halves[1].split(":") : [];
|
|
1495
|
-
const missing = 8 - head.length - tail.length;
|
|
1496
|
-
if (halves.length === 1 && missing !== 0 || missing < 0)
|
|
1497
|
-
return null;
|
|
1498
|
-
const parts = halves.length === 2 ? [...head, ...Array(missing).fill("0"), ...tail] : head;
|
|
1499
|
-
if (parts.length !== 8)
|
|
1500
|
-
return null;
|
|
1501
|
-
const words = [];
|
|
1502
|
-
for (const part of parts) {
|
|
1503
|
-
if (!/^[0-9a-f]{1,4}$/i.test(part))
|
|
1504
|
-
return null;
|
|
1505
|
-
words.push(Number.parseInt(part, 16));
|
|
1506
|
-
}
|
|
1507
|
-
return words;
|
|
1508
|
-
}
|
|
1509
|
-
function isPrivateIp(ip) {
|
|
1510
|
-
const normalized = ip.replace(/^\[|\]$/g, "");
|
|
1511
|
-
const family = isIP(normalized);
|
|
1512
|
-
if (family === 4) {
|
|
1513
|
-
const [a, b] = normalized.split(".").map(Number);
|
|
1514
|
-
if (a === undefined || b === undefined)
|
|
1515
|
-
return true;
|
|
1516
|
-
const value = normalized.split(".").map(Number).reduce((total, octet) => total * 256 + octet, 0);
|
|
1517
|
-
const inCidr = (base, prefix) => {
|
|
1518
|
-
const baseValue = base.split(".").map(Number).reduce((total, octet) => total * 256 + octet, 0);
|
|
1519
|
-
const size = 2 ** (32 - prefix);
|
|
1520
|
-
return value >= baseValue && value < baseValue + size;
|
|
1521
|
-
};
|
|
1522
|
-
const blockedRanges = [
|
|
1523
|
-
["0.0.0.0", 8],
|
|
1524
|
-
["10.0.0.0", 8],
|
|
1525
|
-
["100.64.0.0", 10],
|
|
1526
|
-
["127.0.0.0", 8],
|
|
1527
|
-
["169.254.0.0", 16],
|
|
1528
|
-
["172.16.0.0", 12],
|
|
1529
|
-
["192.0.0.0", 24],
|
|
1530
|
-
["192.0.2.0", 24],
|
|
1531
|
-
["192.31.196.0", 24],
|
|
1532
|
-
["192.52.193.0", 24],
|
|
1533
|
-
["192.88.99.0", 24],
|
|
1534
|
-
["192.168.0.0", 16],
|
|
1535
|
-
["192.175.48.0", 24],
|
|
1536
|
-
["198.18.0.0", 15],
|
|
1537
|
-
["198.51.100.0", 24],
|
|
1538
|
-
["203.0.113.0", 24],
|
|
1539
|
-
["224.0.0.0", 4],
|
|
1540
|
-
["240.0.0.0", 4]
|
|
1541
|
-
];
|
|
1542
|
-
return blockedRanges.some(([base, prefix]) => inCidr(base, prefix));
|
|
1543
|
-
}
|
|
1544
|
-
if (family === 6) {
|
|
1545
|
-
const lower = normalized.toLowerCase();
|
|
1546
|
-
const mapped = mappedIpv4FromIpv6(lower);
|
|
1547
|
-
if (mapped)
|
|
1548
|
-
return isPrivateIp(mapped);
|
|
1549
|
-
const words = ipv6Words(lower);
|
|
1550
|
-
if (!words)
|
|
1551
|
-
return true;
|
|
1552
|
-
const [first, second, third] = words;
|
|
1553
|
-
if (first === undefined || second === undefined || third === undefined)
|
|
1554
|
-
return true;
|
|
1555
|
-
return first === 0 || first === 100 && second === 65435 && third === 1 || first === 256 && second === 0 || first === 8193 && (second <= 511 || second === 3512) || first === 8194 || first === 16383 || first === 24320 || (first & 65024) === 64512 || (first & 65472) === 65152 || (first & 65280) === 65280;
|
|
1556
|
-
}
|
|
1557
|
-
return false;
|
|
1558
|
-
}
|
|
1559
|
-
function raceWithAbort(promise, signal) {
|
|
1560
|
-
if (signal.aborted) {
|
|
1561
|
-
promise.catch(() => {
|
|
1562
|
-
return;
|
|
1563
|
-
});
|
|
1564
|
-
return Promise.reject(signal.reason ?? new Error("aborted"));
|
|
1565
|
-
}
|
|
1566
|
-
return new Promise((resolve, reject) => {
|
|
1567
|
-
const onAbort = () => reject(signal.reason ?? new Error("aborted"));
|
|
1568
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
1569
|
-
promise.then((value) => {
|
|
1570
|
-
signal.removeEventListener("abort", onAbort);
|
|
1571
|
-
resolve(value);
|
|
1572
|
-
}, (error) => {
|
|
1573
|
-
signal.removeEventListener("abort", onAbort);
|
|
1574
|
-
reject(error);
|
|
1575
|
-
});
|
|
1576
|
-
});
|
|
1577
|
-
}
|
|
1578
|
-
async function assertPublicUrl(url, signal) {
|
|
1579
|
-
await resolvePublicAddress(url, signal);
|
|
1580
|
-
}
|
|
1581
|
-
async function fetchGuarded(start, allowPrivate, options = {}) {
|
|
1582
|
-
const timeoutMs = options.timeoutMs ?? 15000;
|
|
1583
|
-
const bodyTimeoutMs = options.bodyTimeoutMs ?? 120000;
|
|
1584
|
-
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
1585
|
-
throw new Error("timeoutMs must be positive");
|
|
1586
|
-
}
|
|
1587
|
-
if (!Number.isFinite(bodyTimeoutMs) || bodyTimeoutMs <= 0) {
|
|
1588
|
-
throw new Error("bodyTimeoutMs must be positive");
|
|
1589
|
-
}
|
|
1590
|
-
const controller = new AbortController;
|
|
1591
|
-
const signal = options.signal ? AbortSignal.any([options.signal, controller.signal]) : controller.signal;
|
|
1592
|
-
const headerTimer = setTimeout(() => {
|
|
1593
|
-
controller.abort(new Error(`fetch did not produce response headers within ${timeoutMs}ms`));
|
|
1594
|
-
}, timeoutMs);
|
|
1595
|
-
headerTimer.unref?.();
|
|
1596
|
-
let settled = false;
|
|
1597
|
-
try {
|
|
1598
|
-
let url = start;
|
|
1599
|
-
for (let hop = 0;hop <= MAX_REDIRECTS; hop++) {
|
|
1600
|
-
if (allowPrivate)
|
|
1601
|
-
assertHttpUrl(url);
|
|
1602
|
-
else
|
|
1603
|
-
await assertPublicUrl(url, signal);
|
|
1604
|
-
const res = await fetch(url, { redirect: "manual", signal });
|
|
1605
|
-
const location = res.status >= 300 && res.status < 400 ? res.headers.get("location") : null;
|
|
1606
|
-
if (location === null) {
|
|
1607
|
-
settled = true;
|
|
1608
|
-
clearTimeout(headerTimer);
|
|
1609
|
-
const bodyTimer = setTimeout(() => {
|
|
1610
|
-
controller.abort(new Error(`fetch body was not consumed within ${bodyTimeoutMs}ms`));
|
|
1611
|
-
}, bodyTimeoutMs);
|
|
1612
|
-
bodyTimer.unref?.();
|
|
1613
|
-
return res;
|
|
1614
|
-
}
|
|
1615
|
-
await res.body?.cancel();
|
|
1616
|
-
url = new URL(location, url);
|
|
1617
|
-
}
|
|
1618
|
-
throw new Error("too many redirects");
|
|
1619
|
-
} finally {
|
|
1620
|
-
if (!settled)
|
|
1621
|
-
clearTimeout(headerTimer);
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
class PrivateAddressRefusal extends Error {
|
|
1626
|
-
name = "PrivateAddressRefusal";
|
|
1627
|
-
}
|
|
1628
|
-
async function resolvePublicAddress(url, signal) {
|
|
1629
|
-
assertHttpUrl(url);
|
|
1630
|
-
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
1631
|
-
if (!host)
|
|
1632
|
-
throw new Error("refusing to fetch a URL with no host");
|
|
1633
|
-
const ipFamily = isIP(host);
|
|
1634
|
-
if (ipFamily) {
|
|
1635
|
-
if (isPrivateIp(host))
|
|
1636
|
-
throw new PrivateAddressRefusal("refusing to fetch a private address");
|
|
1637
|
-
return { address: host, family: ipFamily === 6 ? 6 : 4 };
|
|
1638
|
-
}
|
|
1639
|
-
if (NUMERIC_HOST.test(host)) {
|
|
1640
|
-
throw new PrivateAddressRefusal("refusing to fetch a non-canonical numeric host");
|
|
1641
|
-
}
|
|
1642
|
-
if (host === "localhost" || host.endsWith(".local") || host.endsWith(".internal")) {
|
|
1643
|
-
throw new PrivateAddressRefusal("refusing to fetch an internal host");
|
|
1644
|
-
}
|
|
1645
|
-
const pending = lookup(host, { all: true });
|
|
1646
|
-
const records = signal ? await raceWithAbort(pending, signal) : await pending;
|
|
1647
|
-
for (const record of records) {
|
|
1648
|
-
if (isPrivateIp(record.address)) {
|
|
1649
|
-
throw new PrivateAddressRefusal("refusing to fetch a host that resolves to a private address");
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
const record = records[0];
|
|
1653
|
-
if (!record)
|
|
1654
|
-
throw new Error("public hostname resolved to no addresses");
|
|
1655
|
-
return { address: record.address, family: record.family === 6 ? 6 : 4 };
|
|
1656
|
-
}
|
|
1657
|
-
async function fetchPinnedDocument(start, options) {
|
|
1658
|
-
if (!Number.isInteger(options.maxBytes) || options.maxBytes < 1) {
|
|
1659
|
-
throw new Error("maxBytes must be a positive integer");
|
|
1660
|
-
}
|
|
1661
|
-
if (!Number.isFinite(options.timeoutMs) || options.timeoutMs <= 0) {
|
|
1662
|
-
throw new Error("timeoutMs must be positive");
|
|
1663
|
-
}
|
|
1664
|
-
let url = start;
|
|
1665
|
-
const maxRedirects = options.maxRedirects ?? MAX_REDIRECTS;
|
|
1666
|
-
if (!Number.isInteger(maxRedirects) || maxRedirects < 0) {
|
|
1667
|
-
throw new Error("maxRedirects must be a non-negative integer");
|
|
1668
|
-
}
|
|
1669
|
-
const signal = AbortSignal.timeout(options.timeoutMs);
|
|
1670
|
-
for (let hop = 0;hop <= maxRedirects; hop++) {
|
|
1671
|
-
if (options.requireHttps && url.protocol !== "https:") {
|
|
1672
|
-
throw new Error("document URL and every redirect must use https");
|
|
1673
|
-
}
|
|
1674
|
-
if (url.username || url.password) {
|
|
1675
|
-
throw new Error("document URL cannot contain credentials");
|
|
1676
|
-
}
|
|
1677
|
-
const resolved = await resolvePublicAddress(url, signal);
|
|
1678
|
-
const transport = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
1679
|
-
const response = await new Promise((resolve, reject) => {
|
|
1680
|
-
const request = transport({
|
|
1681
|
-
protocol: url.protocol,
|
|
1682
|
-
hostname: resolved.address,
|
|
1683
|
-
family: resolved.family,
|
|
1684
|
-
port: url.port || undefined,
|
|
1685
|
-
path: `${url.pathname}${url.search}`,
|
|
1686
|
-
method: "GET",
|
|
1687
|
-
signal,
|
|
1688
|
-
servername: url.hostname,
|
|
1689
|
-
headers: {
|
|
1690
|
-
host: url.host,
|
|
1691
|
-
accept: "application/json",
|
|
1692
|
-
...options.headers
|
|
1693
|
-
}
|
|
1694
|
-
}, (incoming) => {
|
|
1695
|
-
const headers = new Headers;
|
|
1696
|
-
for (const [name, value] of Object.entries(incoming.headers)) {
|
|
1697
|
-
if (Array.isArray(value)) {
|
|
1698
|
-
for (const item of value)
|
|
1699
|
-
headers.append(name, item);
|
|
1700
|
-
} else if (value !== undefined) {
|
|
1701
|
-
headers.set(name, value);
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
const chunks = [];
|
|
1705
|
-
let total = 0;
|
|
1706
|
-
incoming.on("data", (chunk) => {
|
|
1707
|
-
total += chunk.byteLength;
|
|
1708
|
-
if (total > options.maxBytes) {
|
|
1709
|
-
incoming.destroy(new Error("response body exceeds configured byte limit"));
|
|
1710
|
-
return;
|
|
1711
|
-
}
|
|
1712
|
-
chunks.push(chunk);
|
|
1713
|
-
});
|
|
1714
|
-
incoming.once("error", reject);
|
|
1715
|
-
incoming.once("end", () => {
|
|
1716
|
-
const body = new Uint8Array(total);
|
|
1717
|
-
let offset = 0;
|
|
1718
|
-
for (const chunk of chunks) {
|
|
1719
|
-
body.set(chunk, offset);
|
|
1720
|
-
offset += chunk.byteLength;
|
|
1721
|
-
}
|
|
1722
|
-
resolve({ status: incoming.statusCode ?? 0, headers, body, url });
|
|
1723
|
-
});
|
|
1724
|
-
});
|
|
1725
|
-
request.once("error", reject);
|
|
1726
|
-
request.end();
|
|
1727
|
-
});
|
|
1728
|
-
if (response.status < 300 || response.status >= 400)
|
|
1729
|
-
return response;
|
|
1730
|
-
const location = response.headers.get("location");
|
|
1731
|
-
if (!location)
|
|
1732
|
-
return response;
|
|
1733
|
-
url = new URL(location, url);
|
|
1734
|
-
}
|
|
1735
|
-
throw new Error("too many redirects");
|
|
1736
|
-
}
|
|
1737
|
-
async function readCapped(res, max) {
|
|
1738
|
-
const reader = res.body?.getReader();
|
|
1739
|
-
if (!reader)
|
|
1740
|
-
return Buffer.alloc(0);
|
|
1741
|
-
const chunks = [];
|
|
1742
|
-
let total = 0;
|
|
1743
|
-
try {
|
|
1744
|
-
while (true) {
|
|
1745
|
-
const { done, value } = await reader.read();
|
|
1746
|
-
if (done)
|
|
1747
|
-
break;
|
|
1748
|
-
total += value.length;
|
|
1749
|
-
if (total > max) {
|
|
1750
|
-
await reader.cancel();
|
|
1751
|
-
return null;
|
|
1752
|
-
}
|
|
1753
|
-
chunks.push(value);
|
|
1754
|
-
}
|
|
1755
|
-
} finally {
|
|
1756
|
-
reader.releaseLock();
|
|
1757
|
-
}
|
|
1758
|
-
return Buffer.concat(chunks);
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
1458
|
// src/internal/write-download.ts
|
|
1762
1459
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
1763
1460
|
import { dirname } from "node:path";
|
|
@@ -1836,8 +1533,11 @@ function constraintLabel(schema) {
|
|
|
1836
1533
|
];
|
|
1837
1534
|
for (const [keyword, label] of bounds) {
|
|
1838
1535
|
const bound = schema[keyword];
|
|
1839
|
-
if (typeof bound
|
|
1840
|
-
|
|
1536
|
+
if (typeof bound !== "number")
|
|
1537
|
+
continue;
|
|
1538
|
+
if (schema.type === "integer" && Math.abs(bound) === Number.MAX_SAFE_INTEGER)
|
|
1539
|
+
continue;
|
|
1540
|
+
limits.push(`${label}${bound}`);
|
|
1841
1541
|
}
|
|
1842
1542
|
const compositions = [
|
|
1843
1543
|
["anyOf", "any of", " | "],
|
|
@@ -2418,4 +2118,4 @@ async function createCli2(config) {
|
|
|
2418
2118
|
return runManagedInvocation(session, route);
|
|
2419
2119
|
}
|
|
2420
2120
|
|
|
2421
|
-
export {
|
|
2121
|
+
export { WaitTimeoutError, runWaitOperation, defineCliCommand2, DEFAULT_EXIT_CODES2, cliExitCode2, emitResult2, CliArgumentError2, cliInvocationResult2, createCliInvoker2, routeCliArgv2, parseCliArgs2, extractCliGlobalOptions2, renderCliView2, pollUntilDone2, createCli2 };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
closeAfter
|
|
3
|
+
} from "./index-b56nnscm.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/bounded-file-read.ts
|
|
6
|
+
import { constants } from "node:fs";
|
|
7
|
+
import { open } from "node:fs/promises";
|
|
8
|
+
class BoundedFileReadError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
observation;
|
|
11
|
+
constructor(code, message, observation, options) {
|
|
12
|
+
super(message, options);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.observation = observation;
|
|
15
|
+
this.name = "BoundedFileReadError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
var observationOf = (info) => ({
|
|
19
|
+
dev: info.dev,
|
|
20
|
+
ino: info.ino,
|
|
21
|
+
size: info.size,
|
|
22
|
+
nlink: info.nlink,
|
|
23
|
+
mtimeMs: info.mtimeMs,
|
|
24
|
+
ctimeMs: info.ctimeMs
|
|
25
|
+
});
|
|
26
|
+
function missingCode(error) {
|
|
27
|
+
return typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : undefined;
|
|
28
|
+
}
|
|
29
|
+
async function openChecked(target, options, openDescriptor) {
|
|
30
|
+
if (options.rejectSymlinks && !constants.O_NOFOLLOW)
|
|
31
|
+
throw new BoundedFileReadError("FILE_UNSUPPORTED", "strict leaf nofollow is unavailable");
|
|
32
|
+
const flags = constants.O_RDONLY | (options.rejectSymlinks ? constants.O_NOFOLLOW ?? 0 : 0) | (constants.O_NONBLOCK ?? 0);
|
|
33
|
+
let handle;
|
|
34
|
+
try {
|
|
35
|
+
handle = await openDescriptor(target, flags);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (options.rejectSymlinks && missingCode(error) === "ELOOP")
|
|
38
|
+
throw new BoundedFileReadError("FILE_UNSAFE_LINK", "managed file leaf is a symlink", undefined, { cause: error });
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const before = await handle.stat();
|
|
43
|
+
if (!before.isFile())
|
|
44
|
+
throw new BoundedFileReadError("FILE_NOT_REGULAR", "managed path is not a regular file");
|
|
45
|
+
if (options.singleLink && before.nlink !== 1)
|
|
46
|
+
throw new BoundedFileReadError("FILE_UNSAFE_LINK", "managed file has multiple links", observationOf(before));
|
|
47
|
+
return { handle, before };
|
|
48
|
+
} catch (error) {
|
|
49
|
+
await handle.close().catch(() => {
|
|
50
|
+
return;
|
|
51
|
+
});
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function openRegularFile(target, options = {}) {
|
|
56
|
+
return openChecked(target, options, open);
|
|
57
|
+
}
|
|
58
|
+
var tooLarge = (maxBytes, observation) => new BoundedFileReadError("FILE_TOO_LARGE", `file exceeds the ${maxBytes}-byte cap`, observation);
|
|
59
|
+
async function readBoundedFile(target, maxBytes, options = {}, openDescriptor = open) {
|
|
60
|
+
options.signal?.throwIfAborted();
|
|
61
|
+
const { handle, before } = await openChecked(target, options, openDescriptor);
|
|
62
|
+
return closeAfter(handle, async () => {
|
|
63
|
+
try {
|
|
64
|
+
options.signal?.throwIfAborted();
|
|
65
|
+
if (before.size > maxBytes)
|
|
66
|
+
throw tooLarge(maxBytes);
|
|
67
|
+
const bytes = await readHandle(handle, maxBytes, options.signal);
|
|
68
|
+
const after = await handle.stat();
|
|
69
|
+
if (options.stable && (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs || before.nlink !== after.nlink || bytes.length !== after.size))
|
|
70
|
+
throw new BoundedFileReadError("FILE_CHANGED", "managed file changed during read");
|
|
71
|
+
options.signal?.throwIfAborted();
|
|
72
|
+
return { bytes, observation: observationOf(after) };
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (error instanceof BoundedFileReadError && error.code === "FILE_TOO_LARGE") {
|
|
75
|
+
const current = await handle.stat().catch(() => {
|
|
76
|
+
return;
|
|
77
|
+
});
|
|
78
|
+
if (current?.isFile() && current.dev === before.dev && current.ino === before.ino)
|
|
79
|
+
throw tooLarge(maxBytes, observationOf(current));
|
|
80
|
+
}
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
async function readHandle(handle, maxBytes, signal) {
|
|
86
|
+
const chunks = [];
|
|
87
|
+
let total = 0;
|
|
88
|
+
let ended = false;
|
|
89
|
+
while (!ended) {
|
|
90
|
+
const capacity = Math.min(64 * 1024, maxBytes + 1 - total);
|
|
91
|
+
if (capacity <= 0)
|
|
92
|
+
throw tooLarge(maxBytes);
|
|
93
|
+
const chunk = new Uint8Array(capacity);
|
|
94
|
+
let filled = 0;
|
|
95
|
+
while (filled < capacity) {
|
|
96
|
+
signal?.throwIfAborted();
|
|
97
|
+
const { bytesRead } = await handle.read(chunk, filled, capacity - filled);
|
|
98
|
+
if (bytesRead === 0) {
|
|
99
|
+
ended = true;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
filled += bytesRead;
|
|
103
|
+
total += bytesRead;
|
|
104
|
+
if (total > maxBytes)
|
|
105
|
+
throw tooLarge(maxBytes);
|
|
106
|
+
}
|
|
107
|
+
if (filled > 0)
|
|
108
|
+
chunks.push(chunk.subarray(0, filled));
|
|
109
|
+
}
|
|
110
|
+
signal?.throwIfAborted();
|
|
111
|
+
const bytes = new Uint8Array(total);
|
|
112
|
+
let offset = 0;
|
|
113
|
+
for (const chunk of chunks) {
|
|
114
|
+
bytes.set(chunk, offset);
|
|
115
|
+
offset += chunk.byteLength;
|
|
116
|
+
}
|
|
117
|
+
return bytes;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { BoundedFileReadError, openRegularFile, readBoundedFile };
|