@bastani/atomic 0.10.10-alpha.2 → 0.10.11-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -0
- package/README.md +1 -1
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +8 -10
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +6 -6
- package/dist/_shared/mode-shared-2QJSCUM6.js +52 -15
- package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/runtime-O4KCSG4C.js +3 -3
- package/dist/_shared/{sdk-RRLVN7ER.js → sdk-AVFII7NK.js} +757 -233
- package/dist/_shared/sdk-AVFII7NK.js.map +1 -0
- package/dist/_shared/session-data-AHTU7IS6.js +3 -3
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/{startup-0-0-4VG2G44V.js → startup-0-0-57KF6LZH.js} +94 -42
- package/dist/_shared/startup-0-0-57KF6LZH.js.map +1 -0
- package/dist/_shared/{startup-0-1-XTIL65D4.js → startup-0-1-GIY75K46.js} +75 -13
- package/dist/_shared/startup-0-1-GIY75K46.js.map +1 -0
- package/dist/_shared/startup-0-2-27OWFHV6.js +72 -7
- package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -1
- package/dist/_shared/startup-0-3-T4DVFYWX.js +4 -4
- package/dist/_shared/startup-0-4-ZMJV547D.js +4 -4
- package/dist/_shared/{startup-0-5-FD2P735I.js → startup-0-5-YDW47QX6.js} +27 -69
- package/dist/_shared/startup-0-5-YDW47QX6.js.map +1 -0
- package/dist/_shared/startup-10-0-TDQNBDDL.js +6 -6
- package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
- package/dist/_shared/startup-15-0-YUKGAC63.js +31 -7
- package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
- package/dist/_shared/startup-15-1-4S7FLMNG.js +7 -6
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +4 -4
- package/dist/_shared/{startup-8-1-4KANEHRA.js → startup-8-1-X32CYSXB.js} +1219 -714
- package/dist/_shared/startup-8-1-X32CYSXB.js.map +1 -0
- package/dist/_shared/storage-command-7MGXLJGZ.js +14 -8
- package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
- package/dist/_shared/task-reference-stream-JWMUZSJX.js +1 -1
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +24 -0
- package/dist/builtin/intercom/broker/broker.bundle.mjs +993 -362
- package/dist/builtin/intercom/broker/database-wake-up-bus.ts +103 -24
- package/dist/builtin/intercom/broker/multinode-router.ts +42 -21
- package/dist/builtin/intercom/broker/multinode-state-store.ts +22 -1
- package/dist/builtin/intercom/broker/open-broker-state.ts +82 -31
- package/dist/builtin/intercom/broker/paths.ts +8 -4
- package/dist/builtin/intercom/broker/released-asker-remote-replies.ts +18 -6
- package/dist/builtin/intercom/broker/sql-add-column.ts +4 -1
- package/dist/builtin/intercom/broker/sql-ended-child-queue-store.ts +65 -44
- package/dist/builtin/intercom/broker/sql-held-send-store.ts +11 -3
- package/dist/builtin/intercom/broker/sql-known-session-store.ts +24 -12
- package/dist/builtin/intercom/broker/sql-lease-store.ts +375 -65
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +270 -101
- package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +20 -9
- package/dist/builtin/intercom/broker/sql-released-ask-store.ts +14 -6
- package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +27 -11
- package/dist/builtin/intercom/broker/sql-schema.ts +139 -1
- package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +97 -34
- package/dist/builtin/intercom/index.bundle.mjs +11 -8
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +20 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/skill-creator/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +62 -23
- package/dist/builtin/web-access/CHANGELOG.md +9 -0
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +4 -4
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +3 -3
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +2 -2
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.code.js +2 -2
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +1 -1
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +1 -1
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +3 -3
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +2 -2
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/agent-session-methods.d.ts +3 -0
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/compaction/compactor.d.ts +2 -0
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.code.js +1 -1
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +2 -2
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.code.js +1 -1
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.code.js +1 -1
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/extensions/loader-virtual-modules.js +2 -2
- package/dist/core/extensions/runner-context.js +3 -3
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/intercom-broker-control-host.code.js +1 -1
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +3 -3
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/model-registry.js +1 -1
- package/dist/core/model-resolver-defaults.d.ts +3 -2
- package/dist/core/package-manager-storage-adapters.code.js +1 -1
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/sdk.code.js +3 -4
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.d.ts +5 -2
- package/dist/core/session-manager-core.js +17 -13
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.code.js +1 -1
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.code.js +1 -1
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/storage/added-exports.d.ts +6 -0
- package/dist/core/storage/added-exports.js +16 -0
- package/dist/core/storage/added-exports.js.map +1 -0
- package/dist/core/storage/database.d.ts +16 -0
- package/dist/core/storage/database.js.map +1 -1
- package/dist/core/storage/fenced-paths.d.ts +47 -0
- package/dist/core/storage/fenced-paths.js +53 -0
- package/dist/core/storage/fenced-paths.js.map +1 -1
- package/dist/core/storage/file-identity.js +31 -2
- package/dist/core/storage/file-identity.js.map +1 -1
- package/dist/core/storage/index.d.ts +3 -0
- package/dist/core/storage/index.js +5 -2
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/migrations.d.ts +22 -0
- package/dist/core/storage/migrations.js +55 -0
- package/dist/core/storage/migrations.js.map +1 -1
- package/dist/core/storage/node-sqlite-thread.js +19 -6
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.js +53 -4
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/prefix.d.ts +3 -2
- package/dist/core/storage/prefix.js +18 -2
- package/dist/core/storage/prefix.js.map +1 -1
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/schema-catalog.d.ts +42 -0
- package/dist/core/storage/schema-catalog.js +141 -0
- package/dist/core/storage/schema-catalog.js.map +1 -0
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +41 -20
- package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +3 -3
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.code.js +1 -1
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/expanded-child-details.code.js +3 -3
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-staging.code.js +176 -36
- package/dist/core/storage/session/fork-staging.code.js.map +1 -1
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-window.code.js +3 -3
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +2 -2
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/session-search-index.d.ts +5 -0
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +3 -3
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-chat-records.d.ts +15 -0
- package/dist/core/storage/session/sql-session-store.code.js +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts +102 -5
- package/dist/core/storage/session/sql-session-store.impl.js +4 -4
- package/dist/core/storage/session/sql-session-store.js +4 -4
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.code.js +1 -1
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/session/types.d.ts +14 -0
- package/dist/core/storage/sqlite-facade.d.ts +37 -5
- package/dist/core/storage/sqlite-facade.js +351 -18
- package/dist/core/storage/sqlite-facade.js.map +1 -1
- package/dist/core/storage/statement-sequence.d.ts +83 -0
- package/dist/core/storage/statement-sequence.js +21 -0
- package/dist/core/storage/statement-sequence.js.map +1 -1
- package/dist/core/storage/storage-status.code.js +1 -1
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.code.js +1 -1
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.code.js +1 -1
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.code.js +1 -1
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +3 -3
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +4 -4
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.code.js +1 -1
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/bash.d.ts +8 -4
- package/dist/core/tools/history-session.d.ts +5 -0
- package/dist/core/tools/history-tasks.d.ts +123 -0
- package/dist/core/tools/kill.d.ts +5 -2
- package/dist/core/tools/powershell.d.ts +2 -2
- package/dist/core/tools/read-url.code.js +3 -3
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/tools/read.d.ts +12 -2
- package/dist/core/tools/resource-selectors.d.ts +2 -0
- package/dist/core/tools/search.d.ts +12 -2
- package/dist/core/worktree-snapshot/blob-store.d.ts +14 -2
- package/dist/core/worktree-snapshot/blob-store.js +69 -16
- package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
- package/dist/core/worktree-snapshot/errors.code.js +2 -2
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.code.js +2 -2
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +2 -2
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +3 -3
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.code.js +1 -1
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index.js +5 -5
- package/dist/main-first-time-setup.code.js +1 -1
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/main.js +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts +1 -0
- package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/task-inspector.d.ts +2 -0
- package/dist/modes/interactive/components/user-message-selector-archive.code.js +1 -1
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +2 -2
- package/dist/modes/print-mode.js +1 -1
- package/dist/modes/rpc/agent-panel-bridge.d.ts +5 -0
- package/dist/package-manager-cli.code.js +6 -6
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/rpc-entry.js +1 -1
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/0.js +1 -1
- package/dist/startup-stages/1.js +1 -1
- package/dist/startup-stages/10.js +1 -1
- package/dist/startup-stages/12.js +1 -1
- package/dist/startup-stages/2.js +8 -1
- package/dist/startup-stages/3.js +1 -6
- package/dist/startup-stages/5.js +1 -1
- package/dist/startup-stages/7.js +1 -5
- package/dist/utils/startup-database-spare.code.js +2 -2
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.code.js +1 -1
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/background-tasks.md +123 -23
- package/docs/compaction.md +18 -0
- package/docs/docs.json +2 -0
- package/docs/environment-variables.md +1 -1
- package/docs/getting-started/installation.md +9 -2
- package/docs/guides/postgres-pgbouncer.md +339 -0
- package/docs/guides/postgres-tuning.md +311 -0
- package/docs/guides/resume-on-any-machine.md +2 -2
- package/docs/guides.md +2 -0
- package/docs/index.md +1 -1
- package/docs/libraries/agent-core.md +1 -1
- package/docs/libraries/ai.md +2 -2
- package/docs/libraries/codemode.md +1 -1
- package/docs/libraries/storage-libsql.md +6 -1
- package/docs/libraries/storage-postgres.md +11 -6
- package/docs/libraries/tui.md +1 -1
- package/docs/libraries.md +2 -2
- package/docs/programmatic.md +1 -1
- package/docs/quickstart.md +1 -1
- package/docs/sdk/storage.md +1 -1
- package/docs/sdk/web-server.md +1 -3
- package/docs/sdk.md +1 -7
- package/docs/sessions.md +58 -2
- package/docs/settings.md +20 -1
- package/docs/skills/authoring.md +1 -1
- package/docs/skills.md +79 -6
- package/docs/storage.md +262 -12
- package/docs/subagents/reference.md +2 -2
- package/docs/subagents.md +4 -3
- package/docs/tools.md +44 -10
- package/docs/windows.md +1 -1
- package/package.json +9 -9
- package/dist/_shared/sdk-RRLVN7ER.js.map +0 -1
- package/dist/_shared/startup-0-0-4VG2G44V.js.map +0 -1
- package/dist/_shared/startup-0-1-XTIL65D4.js.map +0 -1
- package/dist/_shared/startup-0-5-FD2P735I.js.map +0 -1
- package/dist/_shared/startup-8-1-4KANEHRA.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { __name } from "./rolldown-runtime-BGM3D5V3.js";
|
|
2
2
|
import { APP_NAME, BUILTIN_PACKAGE_DIR_NAMES, CONFIG_DIR_NAME, ENV_CLEAR_ON_SHRINK, ENV_HARDWARE_CURSOR, ENV_SESSION_DIR, INTERACTIVE_ENGINE_BOOTSTRAP_FLAG, addHostStorageAdapter, canonicalizePath as canonicalizePath$1, createChildProcessEnvironment, flushPersistentCompileCache, formatPathRelativeToCwdOrAbsolute, getAgentConfigPaths, getAgentDir, getAgentDirs, getBinDir, getBlueprintActionsDir, getCwdRelativePath, getEnvValue, getGlobalBlueprintPath, getHomeDir, getProjectBlueprintPath, getProjectConfigPaths, getReadmePath, hostStorageAdapter, isBunBinary, isBunRuntime, isChildProcessExitStatusUnknownError, isLocalPath, markLifecycleTiming, normalizePath, removeOwnedInteractiveEngineBootstrapAsync, resolvePath, shortenHomePath, splitBom, stripBom, waitForChildProcess, writeInteractiveEngineBootstrapAsync } from "./p0-cli-BB45ZQY6.js";
|
|
3
|
-
import { BLUEPRINT_CONTEXT_TYPE, BlueprintBuildFailedError, BlueprintError, BlueprintInvalidError, BlueprintStepFailedError, BlueprintStepTimedOutError, BlueprintUsesUnsupportedError, CACHE_WARMING_MODES, CompactionConfigError, DEFAULT_BUILTIN_SELECTION_EXTRA_TOOLS, DEFAULT_MAX_BYTES, EditInputError, EditMatchError, EditTargetError, FileToolAbortedError, HostListenerFailures, LONG_LIVED_COMMANDS,
|
|
4
|
-
import { EMPTY_OUTPUT_TEXT, HistorySearchPositions, MAX_INDEXED_ENTRY_CHARS, ResumeTimingsRecorder, SEARCH_PART_CHARS, SessionStorageSelectionSchema, TaskElapsedClocks, WorkspaceDriftError, WorkspaceRestoreError, WorkspaceSnapshotError, bindTaskClock, bindTaskClockSource, buildDirectoryTree, buildDirectoryTreeFromOperations, captureRegistrationInvocation, compareCreated, compareFrozen, conflictEntries, convertToLlm, createBranchSummaryMessage, createCustomMessage, diffLines, ensureTool, execCommand, findSessionOpenHolder, findWorkspaceError, formatResumeTimings, invocationExtension, invocationRuntime, isWorkspaceConfigError, isWorkspaceDriftError, isWorkspaceError, isWorkspaceGitError, isWorkspaceSnapshotError, lifecycleScopeForOwner, normalizeAzureSettings, openEventSubscription, originalRegistrationCallback, ownedSettingsManagers, parseArgs, parseConflictBytes, parseInteractiveEngineMessage, presentTaskError, prewarmModelApi, readConflictUrl, readLocalFileChunks, recordBlueprintStep, recordResumeTimings, recordSettingsWrite, refreshConflictFile, registerConflictBlocks, registerFactoryStartupHandler, renderTodoCall, renderTodoResult, resolveInstalledGit, resolveInvocationRuntime, selectReadLinesFromChunks, selectReadLinesFromList, serializeInteractiveEngineFrame, serializeTodoForAgent, serializeTodoListForAgent, sessionPosition, settingsWriteOwner, splitSearchTextParts, startupSourceId, taskClockOf, taskClockRunning, timeCheckoutRestore, unpackIds, unreadablePathError, validateEventSource, validateSubscriptionAdmission, waitResultTail, waitStatus, withoutSearchPosition, writeRenderers } from "./startup-0-1-
|
|
3
|
+
import { BLUEPRINT_CONTEXT_TYPE, BlueprintBuildFailedError, BlueprintError, BlueprintInvalidError, BlueprintStepFailedError, BlueprintStepTimedOutError, BlueprintUsesUnsupportedError, CACHE_WARMING_MODES, COMMAND_FOREGROUND_BUDGET_MS, CompactionConfigError, DEFAULT_BUILTIN_SELECTION_EXTRA_TOOLS, DEFAULT_MAX_BYTES, EditInputError, EditMatchError, EditTargetError, FileToolAbortedError, HostListenerFailures, LONG_LIVED_COMMANDS, Minimatch, RESTART_CANCELLED_MESSAGE, STALE_EXTENSION_CONTEXT_MESSAGE, ShellTimeoutError, SqliteSelectorConnection, SubscriptionChildUnavailableError, SubscriptionClosedError, SubscriptionConfigError, TASK_MARKS, TaskMessageError, TaskMessageTimeoutError, WriteSelectorError, activeToolExecutionStarts, allToolNames, announceBlueprintBuildWaiting, applyBashSessionEnvironment, asyncScope, attachJsonlLineReader, attachLineReader, bindSavedTaskOrigins, blueprintBuildShared, blueprintDigest, canonicalEventBusFor, chatPosition, clearAssignmentIfClosed, clearLockHolder, clearLockHolderAsync, convertBufferWithMarkit, convertFileWithMarkit, createGitEnvironment, defaultToolNamesFor, defineTool, detectSupportedImageMimeTypeFromFile, displayTodoId, entryLines, expandSearchUrl, experimentalToolSamplingProperty, filterSearchOutputByLineRange, formatReadLineRange as formatReadLineRange$1, formatSelectedLines, formatSize, formatTimeoutSeconds as formatTimeoutSeconds$1, formatTodoId, frozenClocks, getManifestFromPackageJson, getTextOutput, getTodoPath, getTodoStatus, getTodoTitle, getTodosDir, getTodosDirLabel, getToolListError, handOverBuildTimings, holdDeprecationWarnings, holdToolsUntilBuilt, hostInputError, invalidArgText, invalidateNativeSearchCache, isBlueprintError, isGitProvisionError, isGitUnavailableError, isPathInside, isReadResourceSelector, isReadableUrlPath, isTodoClosed, isToolModifier, keptTaskHint, linkPath, literalPathLike, loadNativeSearchBinding, mergeReadRanges, nativeModuleProblem, normalizePathLikeInput, normalizeTodoId, noteSavedSeq, openAdapterSelectionDatabase, originalHistoryNote, prepareLockTakeover, projectTrustHandlerRegistered, projectTrustedBeforeExtensions, readLedger, readTaskOutputTail, receiveChatReceipt, recordLockHolder, recordLockHolderAsync, registerCanonicalEventBus, releaseDeprecationWarnings, renderBlueprintContext, renderToolPath, replaceTabs, reportContained, repositoryKey, resolvePhysicalPathAsync, rootKey, savedReadLines, scopedBackgroundTasks, searchPosition, selectExactReadRanges, selectReadRanges, serializeJsonLine, settingsFileNoticeKey, settingsInternals, shortenPath, sleep, sliceHead, snapshotBashSessionEnvironment, sortTodos, spawnHostProcess, splitLineRangeSelector, splitPathLikeGlob, splitReadLineSelector, splitTodosByAssignment, startShellDeadline, startToolTimer, str, stringEntries, takeOverDeadHolder, takeOverDeadHolderAsync, takeQueuedDeliveryChange, taskResumer, timestamp, toolTimerText, transcriptHeaderLines, truncateHead, truncateLine, updateLedger, validateTodoId, warnDeprecation, withFileMutationQueue, withResolvingFileMutationQueue, workspaceKey } from "./startup-0-0-57KF6LZH.js";
|
|
4
|
+
import { EMPTY_OUTPUT_TEXT, HistorySearchPositions, MAX_INDEXED_ENTRY_CHARS, ResumeTimingsRecorder, SEARCH_PART_CHARS, SessionStorageSelectionSchema, TaskElapsedClocks, TaskToolError, WorkspaceDriftError, WorkspaceRestoreError, WorkspaceSnapshotError, bindTaskClock, bindTaskClockSource, buildDirectoryTree, buildDirectoryTreeFromOperations, cancelReceiptSentence, captureRegistrationInvocation, compareCreated, compareFrozen, conflictEntries, convertToLlm, createBranchSummaryMessage, createCustomMessage, diffLines, ensureTool, execCommand, findSessionOpenHolder, findWorkspaceError, formatResumeTimings, invocationExtension, invocationRuntime, isWorkspaceConfigError, isWorkspaceDriftError, isWorkspaceError, isWorkspaceGitError, isWorkspaceSnapshotError, lifecycleScopeForOwner, normalizeAzureSettings, openEventSubscription, originalRegistrationCallback, ownedSettingsManagers, parseArgs, parseConflictBytes, parseInteractiveEngineMessage, parseSkillUri, presentTaskError, prewarmModelApi, readConflictUrl, readLocalFileChunks, recordBlueprintStep, recordResumeTimings, recordSettingsWrite, refreshConflictFile, registerConflictBlocks, registerFactoryStartupHandler, renderTodoCall, renderTodoResult, resolveInstalledGit, resolveInvocationRuntime, selectReadLinesFromChunks, selectReadLinesFromList, serializeInteractiveEngineFrame, serializeTodoForAgent, serializeTodoListForAgent, sessionPosition, settingsWriteOwner, splitSearchTextParts, startupSourceId, taskClockOf, taskClockRunning, timeCheckoutRestore, unpackIds, unreadablePathError, validateEventSource, validateSubscriptionAdmission, waitResultTail, waitStatus, withoutSearchPosition, writeRenderers } from "./startup-0-1-GIY75K46.js";
|
|
5
5
|
import { CodeHighlighter, FS_WATCH_RETRY_DELAY_MS, applyEarlyInputChunk, closeWatcher, getLanguageFromPath, graphemeAt, highlightCode, isSafeFsWatchPathError, keepStartupDialogDraft, migrateKeybindingsConfig, parenthesizedKeyHint, recordTimingLines, sanitizeTerminalText, singleLineDisplayText, slashCommandHint, terminalDisplayText, theme, watchWithErrorHandlerAsync, withEarlyInputHeldForStartupDialog } from "./p2-shell-main-B2WIALFD.js";
|
|
6
6
|
import { parseJsonFileContent } from "./p1-shared-RG5I5LJ6.js";
|
|
7
7
|
import { ProjectTrustStore, failureDebugFields, hasProjectTrustInputs, hasProjectTrustInputsAsync, inLockTurn, matchesOnSameLineCI, redactUrlCredentials, releaseLock, releaseLockSync, renameReplacing, renameReplacingAsync, renameWithRetry, reportDebugAsync, waitForLock, waitForLockSync } from "./p1b-elig-ENCUPKKJ.js";
|
|
8
|
-
import { FILE_HEADERS_ONLY, InteractiveEngineMonitor, ModelConfig, RpcTerminalDrain, SESSIONS_STORAGE_ENV, STORAGE_ENV, TodoParams, addShellOutputPreview, assertSessionOpen, bindTaskChatPage, captureTaskChatFile, chatPageRequest, createTwoFilesPatch, drainSessionWork, dropWrongTypedSettings, estimateTokens, formatPatch, formatTruncationNotice, formatWorkingElapsed, getNativeMcpToolIdentity, getPowerShellConfigAsync, getShellConfigAsync, getShellEnvAsync, hasCallingSessionWork, invalidSettingMessage, isPowerShellAvailable, isResumePreconditionError, isTodoOperationError, killChildProcessTree, loadTaskOwnTranscriptEntries, markNativeMcpToolDefinition, processSharedStorageSelection, processSharedStorageSelectionAsync, processStorageEnvironment, rebuildShellWaitResult, selectProcessStorage, selectProcessStorageSteps, sessionGenerationClosing, sessionLifetime, spawnShellProcess, structuredPatch, taskChatPage, taskExtensionStatuses, taskOwnTranscriptEntries, taskTranscriptSource, trackDetachedChildPid, trackDetachedChildProcess, trackSessionWork, untrackDetachedChildPid, watchTaskExtensionStatuses, wrapToolDefinition } from "./startup-0-2-27OWFHV6.js";
|
|
8
|
+
import { FILE_HEADERS_ONLY, InteractiveEngineMonitor, ModelConfig, RpcTerminalDrain, SESSIONS_STORAGE_ENV, STORAGE_ENV, TodoParams, addShellOutputPreview, assertSessionOpen, bindTaskChatPage, captureTaskChatFile, chatPageRequest, createTwoFilesPatch, drainSessionWork, dropWrongTypedSettings, estimateTokens, formatKillCall, formatPatch, formatTruncationNotice, formatWorkingElapsed, getNativeMcpToolIdentity, getPowerShellConfigAsync, getShellConfigAsync, getShellEnvAsync, hasCallingSessionWork, invalidSettingMessage, isPowerShellAvailable, isResumePreconditionError, isTodoOperationError, killChildProcessTree, loadTaskOwnTranscriptEntries, markNativeMcpToolDefinition, processSharedStorageSelection, processSharedStorageSelectionAsync, processStorageEnvironment, rebuildKillResult, rebuildShellWaitResult, selectProcessStorage, selectProcessStorageSteps, sessionGenerationClosing, sessionLifetime, spawnShellProcess, structuredPatch, taskChatPage, taskExtensionStatuses, taskOwnTranscriptEntries, taskTranscriptSource, trackDetachedChildPid, trackDetachedChildProcess, trackSessionWork, untrackDetachedChildPid, watchTaskExtensionStatuses, wrapToolDefinition } from "./startup-0-2-27OWFHV6.js";
|
|
9
9
|
import { appendToLog, applyContextEdit, assertExtensionAction, buildProcessStarting, extensionWorkOpen, getBaseDirsForScope, getOwnerTaskSession, getOwnerTaskStore, inExtensionCleanup, isResumeFailure, isRetiredExtensionCleanup, isTaskTurnInterrupted, loadArchiveSnapshot, logTail, migrateAzureProvider, migrateAzureProviderAsync, onExtensionSessionQuit, openStepLog, processImage, resolvePathFromBase, resolveWorktreeSnapshotSettings, runLoggedProcess, sessionEntryToContextMessages, sha256Hex, startElapsedMs, stripLeadingCdCommandAsync, taskResumedTurns, trackExtensionWork, watchOwnerTaskStoreBinding, withTodoLock } from "./startup-0-3-T4DVFYWX.js";
|
|
10
10
|
import { DecisionConfigError, SessionHistoryNotLoadedError, asAcceptedRequestFailure, isDecisionConfigError, markRpcTransportFailure, rpcTransportError } from "./settings-startup-4QCVCI53.js";
|
|
11
11
|
import { JsonlSessionStore, LegacySessionStore, checkedCustomMessage, checkedCustomType, checkedLabel, getLastConversationMessageId, getLatestSessionSummary, historyPageGeneration, storeSnapshotIndex, transcriptCursorWithin } from "./startup-8-0-34CBHPZH.js";
|
|
12
|
-
import { admitPooledWorktree, adoptPrebuiltSeed, assertRpcSuccess, authForStream, captureLocatedCheckout, captureWorktreeSnapshot, carryOverDegradedWork, childOfAttempt, chunkedToolResult, chunkedToolResultEntry, claimIdleWorktree,
|
|
12
|
+
import { TASK_COMPLETION_MESSAGE_TYPE, admitPooledWorktree, adoptPrebuiltSeed, assertRpcSuccess, authForStream, captureLocatedCheckout, captureWorktreeSnapshot, carryOverDegradedWork, childOfAttempt, chunkedToolResult, chunkedToolResultEntry, claimIdleWorktree, completionTitleDescription, confirmPooledWorktreeLease, createLoadedAskUserQuestionToolDefinition, createToolNameMatcher, defaultResumePreflightIo, discardPooledWorktree, evictIdleWorktrees, executeNativePty, executeSupervisedCommand, expandSkillCommand, extensionsCanDecideProjectTrust, getExistingGitInstallPathAsync, getManagedNpmInstallPath, gitText, holdRestoredWorktree, holdsSessionSnapshotRef, hostPlatform, inheritWorkspace, isHeadOnlyAdvance, isMcpToolName, isRecoverableRestoreFailure, keepSessionSnapshotCommit, loadSnapshotPathPolicy, locateCheckout, lookupOwnedTask, nextCaptureTick, parseBlueprint, parseSource, pendingLfsDownload, pooledWorktreeHolder, readRepositoryConfig, recordPooledWorktreeState, recordWorktreeCapture, releaseRestoredWorktree, releaseSessionSnapshotRefs, removeRestoredWorktree, require_dist, restoreBestWorktree, restoreDegradedWorktree, restoreDegradedWorktreeAt, restoreWorktree, restoreWorktreeAt, retireSessionSnapshotRefs, runGit, selectDocument, setAsideWorktree, snapshotRestoreWarnings, unrestoredRecord, validateBashWait, validateTaskHeartbeatMs, verifyWorktree, waitForSupervisedCommand, waitingReleasedTools, withScratchDirectory, withoutSupersededAttempts, worktreeSetAside, writeWorkingTree } from "./startup-0-5-YDW47QX6.js";
|
|
13
13
|
import { OutputAccumulator, SNAPSHOT_COLLECTION_SESSION_DELAY_MS, TOOL_BLOCK_LIMITS, ToolBlockRecords, applyModelsJson, cancelledBuilds, canonicalPaths, canonicalizeWorktreePathAsync, collapseToolBlockLines, defaultWorktreeSnapshotStoreDir, migrateAuthJsonConfigValues, migrateAuthJsonConfigValuesAsync, migrateModelsJsonConfigValues, migrateModelsJsonConfigValuesAsync, renderDiff, runCanonicalSteps, runCanonicalStepsAsync, sameRemote, scheduleSnapshotCollection, settleOtherBuilds, taskTranscriptPageWithCuts, withBuildLocks } from "./startup-0-4-ZMJV547D.js";
|
|
14
14
|
import { SETTINGS_DEFAULTS } from "./p2-common-YLSYXMDQ.js";
|
|
15
15
|
import { adoptPrewarmedEngine, engineLaunch, waitForPrewarmedEngineReady } from "./p1a-prewarm-XIU57JHF.js";
|
|
@@ -9387,7 +9387,47 @@ function shortReadErrorReason(text, details) {
|
|
|
9387
9387
|
if (/beyond end of/i.test(text)) return "out of range";
|
|
9388
9388
|
return "failed";
|
|
9389
9389
|
}
|
|
9390
|
+
/**
|
|
9391
|
+
* A `read` or `search` that waits on a background history task, or whose call went on as one: a Wait block for the
|
|
9392
|
+
* former, and a block that names the running task for the latter. Any other call returns `undefined`.
|
|
9393
|
+
*/
|
|
9394
|
+
function presentHistoryTask(input, title) {
|
|
9395
|
+
const argsRecord = asRecord(input.args);
|
|
9396
|
+
const waiting = argsRecord?.action === "wait";
|
|
9397
|
+
const task = asRecord(asRecord(input.result?.details)?.historyTask);
|
|
9398
|
+
if (!waiting && task === void 0) return void 0;
|
|
9399
|
+
const blockTitle = waiting ? "Wait" : title;
|
|
9400
|
+
const args = waiting ? singleLineDisplayText(asString(argsRecord?.id) ?? "") : void 0;
|
|
9401
|
+
const isRunning = !input.result || input.isPartial;
|
|
9402
|
+
const elapsed = formatToolBlockElapsed(resolveDurationMs(input), {
|
|
9403
|
+
isRunning,
|
|
9404
|
+
subTenDecimal: false
|
|
9405
|
+
});
|
|
9406
|
+
if (isRunning) return {
|
|
9407
|
+
title: blockTitle,
|
|
9408
|
+
args,
|
|
9409
|
+
status: "running",
|
|
9410
|
+
meta: elapsed ? [elapsed] : void 0
|
|
9411
|
+
};
|
|
9412
|
+
const lines = splitContentLines(extractRawText(input.result)).map((line) => theme.fg(input.result?.isError ? "error" : "toolOutput", replaceTabs(line)));
|
|
9413
|
+
if (task !== void 0) return {
|
|
9414
|
+
title: blockTitle,
|
|
9415
|
+
args: args ?? singleLineDisplayText(asString(task.taskId) ?? ""),
|
|
9416
|
+
status: "shell-running",
|
|
9417
|
+
meta: ["continues in background"],
|
|
9418
|
+
details: new ToolBlockLines(lines, true)
|
|
9419
|
+
};
|
|
9420
|
+
return {
|
|
9421
|
+
title: blockTitle,
|
|
9422
|
+
args,
|
|
9423
|
+
status: input.result?.isError ? "failure" : "success",
|
|
9424
|
+
meta: elapsed ? [elapsed] : void 0,
|
|
9425
|
+
details: new ToolBlockLines(collapseToolBlockLines(lines, TOOL_BLOCK_LIMITS.search, input.expanded))
|
|
9426
|
+
};
|
|
9427
|
+
}
|
|
9390
9428
|
function presentRead(input) {
|
|
9429
|
+
const historyTask = presentHistoryTask(input, "Read");
|
|
9430
|
+
if (historyTask) return historyTask;
|
|
9391
9431
|
const activeTheme = input.theme ?? theme;
|
|
9392
9432
|
const { display, startLine, basePath } = formatReadArgs(asRecord(input.args), input.cwd);
|
|
9393
9433
|
const isRunning = !input.result || input.isPartial;
|
|
@@ -9513,6 +9553,8 @@ function parseSearchRows(rawText) {
|
|
|
9513
9553
|
};
|
|
9514
9554
|
}
|
|
9515
9555
|
function presentSearch(input) {
|
|
9556
|
+
const historyTask = presentHistoryTask(input, "Search");
|
|
9557
|
+
if (historyTask) return historyTask;
|
|
9516
9558
|
const display = formatSearchArgs(asRecord(input.args), input.cwd);
|
|
9517
9559
|
const isRunning = !input.result || input.isPartial;
|
|
9518
9560
|
const elapsed = formatToolBlockElapsed(resolveDurationMs(input), {
|
|
@@ -11658,6 +11700,10 @@ async function fallbackInternalPath(value, cwd) {
|
|
|
11658
11700
|
async function resolveInternalSelector(value, cwd) {
|
|
11659
11701
|
return fallbackInternalPath(value, cwd);
|
|
11660
11702
|
}
|
|
11703
|
+
/** The filesystem path an internal URL names, asking the session's routers before the workspace fallback. */
|
|
11704
|
+
function resolveInternalPath(value, cwd, context) {
|
|
11705
|
+
return resolveViaRouter(value, cwd, context);
|
|
11706
|
+
}
|
|
11661
11707
|
async function readInternalSelector(value, cwd, context) {
|
|
11662
11708
|
const routed = await routerFromContext(context)?.read?.(value);
|
|
11663
11709
|
if (typeof routed === "string") return routed;
|
|
@@ -12208,7 +12254,7 @@ const envSchema = Type$1.Unsafe({
|
|
|
12208
12254
|
const bashBaseSchema = Type$1.Object({
|
|
12209
12255
|
command: Type$1.String({ description: "Shell command to execute." }),
|
|
12210
12256
|
env: Type$1.Optional(envSchema),
|
|
12211
|
-
timeout: Type$1.Optional(Type$1.Number({ description: "
|
|
12257
|
+
timeout: Type$1.Optional(Type$1.Number({ description: "Optional deadline in seconds, greater than 0. Omit it for no time limit: the command runs until it finishes or is stopped." })),
|
|
12212
12258
|
wait: Type$1.Optional(Type$1.Unsafe({
|
|
12213
12259
|
type: "object",
|
|
12214
12260
|
properties: {
|
|
@@ -12224,7 +12270,7 @@ const bashBaseSchema = Type$1.Object({
|
|
|
12224
12270
|
},
|
|
12225
12271
|
required: ["kind"],
|
|
12226
12272
|
additionalProperties: false,
|
|
12227
|
-
description: "Observation policy
|
|
12273
|
+
description: "Observation policy; it never stops the command. Omit for owner-configured automatic yield (default 10s)."
|
|
12228
12274
|
})),
|
|
12229
12275
|
cwd: Type$1.Optional(Type$1.String({ description: "Working directory for the command." })),
|
|
12230
12276
|
pty: Type$1.Optional(Type$1.Boolean({ description: "Run with PTY handling." })),
|
|
@@ -12267,26 +12313,29 @@ const bashToolSystemPromptContribution = Object.freeze({
|
|
|
12267
12313
|
snippet: "Execute a shell command.",
|
|
12268
12314
|
guidelines: Object.freeze([
|
|
12269
12315
|
"You can inspect ATOMIC_* or PI_* environment variables for current model and session details.",
|
|
12270
|
-
"Use { action: \"wait\", id: taskId } to observe an existing shell task with the owner policy. Avoid repeated short polls; await completion notifications when no dependent work is blocked. Never relaunch a yielded command. Waiting
|
|
12316
|
+
"Use { action: \"wait\", id: taskId } to observe an existing shell task with the owner policy. Avoid repeated short polls; await completion notifications when no dependent work is blocked. Never relaunch a yielded command. Waiting never stops a command or changes when it stops.",
|
|
12271
12317
|
"For ordinary commands, omit wait to use the owner's observation policy (normally 10s). Do not routinely request one-second waits: premature yields add tool calls without making the command faster. Use a short budget only for a concrete responsiveness need, or explicit background observation when you have independent work to do. Explicit budgets, including zero for polling, remain available.",
|
|
12272
|
-
"Choose foreground or background shell observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never
|
|
12318
|
+
"Choose foreground or background shell observation as needed without asking the user each time. Background yields after admission; foreground waits for its optional budget then the same command continues in background. Omitted wait uses owner-configured automatic background yield (default 10s). Observation never stops the command. Background requires a supported task owner; unbound foreground waits until completion regardless of budget.",
|
|
12319
|
+
`A command has no time limit: it runs until it exits, kill({ id: taskId }) stops it, or this session ends. Set timeout (in seconds) only when it must stop by a deadline; timeout: 600 stops it after 10 minutes. Up to 64 commands run at once in a session; at that limit a new command is refused until one finishes or is stopped.`
|
|
12273
12320
|
])
|
|
12274
12321
|
});
|
|
12275
|
-
|
|
12276
|
-
|
|
12322
|
+
/**
|
|
12323
|
+
* Leaving `timeout` out is what runs a command with no time limit. `0` and negative values are refused: a deadline that
|
|
12324
|
+
* has already passed is never useful, and a model that writes `0` usually means "no limit".
|
|
12325
|
+
*/
|
|
12277
12326
|
function validateExplicitTimeoutSeconds(timeout) {
|
|
12278
|
-
if (!Number.isFinite(timeout) || timeout <= 0 || timeout
|
|
12327
|
+
if (!Number.isFinite(timeout) || timeout <= 0 || !Number.isFinite(timeout * 1e3)) throw new Error(`Invalid timeout ${String(timeout)}: timeout must be a positive number of seconds. Leave timeout out for no time limit.`);
|
|
12279
12328
|
}
|
|
12280
12329
|
const STILL_RUNNING = (taskId) => `Command is still running (task ${taskId}).`;
|
|
12281
12330
|
/**
|
|
12282
|
-
* The text a launch that continues in the background ends with: its task, and
|
|
12283
|
-
*
|
|
12331
|
+
* The text a launch that continues in the background ends with: its task, and what stops it. A command has no time
|
|
12332
|
+
* limit unless its launch set a timeout, which then stops it whether or not anyone waits on it (#4639).
|
|
12284
12333
|
*/
|
|
12285
12334
|
function stillRunningReceipt(taskId, timeoutSeconds) {
|
|
12286
|
-
return `${STILL_RUNNING(taskId)} Its
|
|
12335
|
+
return timeoutSeconds === void 0 ? `${STILL_RUNNING(taskId)} It has no time limit: it runs until it exits, kill stops it, or this session ends.` : `${STILL_RUNNING(taskId)} Its timeout stops it after ${formatTimeoutSeconds$1(timeoutSeconds * 1e3)}.`;
|
|
12287
12336
|
}
|
|
12288
12337
|
function normalizeTimeoutSeconds(timeout) {
|
|
12289
|
-
if (timeout === void 0) return
|
|
12338
|
+
if (timeout === void 0) return void 0;
|
|
12290
12339
|
validateExplicitTimeoutSeconds(timeout);
|
|
12291
12340
|
return Math.max(1, Math.round(timeout * 1e3)) / 1e3;
|
|
12292
12341
|
}
|
|
@@ -12348,14 +12397,14 @@ function createLocalBashOperations(options) {
|
|
|
12348
12397
|
shellExitedAfterMs = performance.now() - startedAt;
|
|
12349
12398
|
});
|
|
12350
12399
|
let deadline;
|
|
12351
|
-
let
|
|
12400
|
+
let stopDeadline;
|
|
12352
12401
|
const waitAbort = new AbortController();
|
|
12353
12402
|
const onAbort = () => {
|
|
12354
12403
|
waitAbort.abort();
|
|
12355
12404
|
shellProcess.stop();
|
|
12356
12405
|
};
|
|
12357
12406
|
try {
|
|
12358
|
-
if (timeout !== void 0
|
|
12407
|
+
if (timeout !== void 0) stopDeadline = startShellDeadline(timeout * 1e3, () => {
|
|
12359
12408
|
deadline = {
|
|
12360
12409
|
timeoutSeconds: timeout,
|
|
12361
12410
|
elapsedMs: Math.round(performance.now() - startedAt),
|
|
@@ -12363,7 +12412,7 @@ function createLocalBashOperations(options) {
|
|
|
12363
12412
|
};
|
|
12364
12413
|
waitAbort.abort();
|
|
12365
12414
|
shellProcess.stop();
|
|
12366
|
-
}
|
|
12415
|
+
});
|
|
12367
12416
|
child.stdout?.on("data", (data) => onData(data, "stdout"));
|
|
12368
12417
|
child.stderr?.on("data", (data) => onData(data, "stderr"));
|
|
12369
12418
|
if (signal) {
|
|
@@ -12398,7 +12447,7 @@ function createLocalBashOperations(options) {
|
|
|
12398
12447
|
return { exitCode: resolvedExitCode };
|
|
12399
12448
|
} finally {
|
|
12400
12449
|
shellProcess.finish();
|
|
12401
|
-
|
|
12450
|
+
stopDeadline?.();
|
|
12402
12451
|
if (signal) signal.removeEventListener("abort", onAbort);
|
|
12403
12452
|
}
|
|
12404
12453
|
} };
|
|
@@ -12430,7 +12479,7 @@ function formatBashCall(args, prompt) {
|
|
|
12430
12479
|
if (args?.action === "wait") return theme.fg("toolTitle", theme.bold(`${prompt} wait ${str(args.id) ?? "..."}`));
|
|
12431
12480
|
const command = str(args?.command);
|
|
12432
12481
|
const timeout = args?.timeout;
|
|
12433
|
-
const timeoutSuffix = timeout ? theme.fg("muted", ` (timeout ${timeout}s)`) : "";
|
|
12482
|
+
const timeoutSuffix = timeout !== void 0 ? theme.fg("muted", ` (timeout ${timeout}s)`) : "";
|
|
12434
12483
|
const commandDisplay = command === null ? invalidArgText(theme) : command ? command : theme.fg("toolOutput", "...");
|
|
12435
12484
|
return theme.fg("toolTitle", theme.bold(`${prompt} ${commandDisplay}`)) + timeoutSuffix;
|
|
12436
12485
|
}
|
|
@@ -12474,7 +12523,7 @@ function createBashToolDefinition(cwd, options, presentation = BASH_SHELL_PRESEN
|
|
|
12474
12523
|
concurrency: (args) => args.pty === true ? "exclusive" : "shared",
|
|
12475
12524
|
detachable: (args) => args.action === "wait" && args.budgetMs === void 0,
|
|
12476
12525
|
label: "bash",
|
|
12477
|
-
description: "Execute a shell command with optional PTY handling and foreground/background observation, or observe an existing task with action: \"wait\", id, and optional budgetMs. Omitted command wait uses owner policy (default 10s).
|
|
12526
|
+
description: "Execute a shell command with optional PTY handling and foreground/background observation, or observe an existing task with action: \"wait\", id, and optional budgetMs. Omitted command wait uses owner policy (default 10s). A command runs until it exits or is stopped unless timeout sets a deadline in seconds; observation never stops it. A background command can run indefinitely, such as a dev server; stop it with kill. Background and existing-task waits require a supported task owner; unbound foreground execution waits until completion.",
|
|
12478
12527
|
promptSnippet: bashToolSystemPromptContribution.snippet,
|
|
12479
12528
|
constrainedSampling: {
|
|
12480
12529
|
type: "json_schema",
|
|
@@ -12623,7 +12672,7 @@ function createBashToolDefinition(cwd, options, presentation = BASH_SHELL_PRESEN
|
|
|
12623
12672
|
const startedAt = Date.now();
|
|
12624
12673
|
const withTiming = (details) => ({
|
|
12625
12674
|
...details,
|
|
12626
|
-
timeoutSeconds: timeout,
|
|
12675
|
+
...timeout === void 0 ? {} : { timeoutSeconds: timeout },
|
|
12627
12676
|
...bashCommand.timeout !== void 0 && bashCommand.timeout !== timeout ? { requestedTimeoutSeconds: bashCommand.timeout } : {},
|
|
12628
12677
|
wallTimeMs: Date.now() - startedAt
|
|
12629
12678
|
});
|
|
@@ -13326,9 +13375,9 @@ function runWorkerTask(payload, timeoutMs, signal, transfer) {
|
|
|
13326
13375
|
const onAbort = () => {
|
|
13327
13376
|
removeOrCancel({ error: signal?.reason ?? /* @__PURE__ */ new Error("Operation aborted") });
|
|
13328
13377
|
};
|
|
13329
|
-
const timer = setTimeout(() => {
|
|
13378
|
+
const timer = Number.isFinite(effectiveMs) ? setTimeout(() => {
|
|
13330
13379
|
removeOrCancel({ timedOut: true });
|
|
13331
|
-
}, effectiveMs);
|
|
13380
|
+
}, effectiveMs) : void 0;
|
|
13332
13381
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
13333
13382
|
waitingQueue.push(task);
|
|
13334
13383
|
pumpQueue();
|
|
@@ -13394,6 +13443,11 @@ const DEFAULT_HISTORY_BUDGET = {
|
|
|
13394
13443
|
rows: 25e4,
|
|
13395
13444
|
timeMs: 3e3
|
|
13396
13445
|
};
|
|
13446
|
+
/**
|
|
13447
|
+
* The time budget of the history calls a background history task makes, in place of the router's own:
|
|
13448
|
+
* `Number.POSITIVE_INFINITY`, as such a task has no time limit.
|
|
13449
|
+
*/
|
|
13450
|
+
const historyTaskTimeBudget = asyncScope();
|
|
13397
13451
|
const SLICE_MS = 2;
|
|
13398
13452
|
const PROGRESS_FLOOR_MS = 250;
|
|
13399
13453
|
const STORE_WAIT_MIN_MS = 15;
|
|
@@ -13415,7 +13469,7 @@ const MULTILINE_MODIFIER_SYNTAX = /\(\?[a-ln-zA-Z]*m[a-zA-Z]*(?:-[a-zA-Z]*)?:/;
|
|
|
13415
13469
|
const CANDIDATE_PAGE = 64;
|
|
13416
13470
|
const EXTRA_COUNT_SEQS = 500;
|
|
13417
13471
|
const SKIPPED_TYPES = ["custom", "worktree_snapshot"];
|
|
13418
|
-
const PREVIEW_CHARS = 72;
|
|
13472
|
+
const PREVIEW_CHARS$1 = 72;
|
|
13419
13473
|
const MULTILINE_WINDOW_NOTE = `multi-line matches are searched up to ${MATCH_SPAN_CHARS / 1024} KB of text or ${WINDOW_MAX_SEQS} entries past where they start, so a longer match is not shown`;
|
|
13420
13474
|
const WINDOW_CUT_LINE = "";
|
|
13421
13475
|
const utf8Decoder = new TextDecoder();
|
|
@@ -13431,6 +13485,10 @@ function isHistoryDeadlineError(error) {
|
|
|
13431
13485
|
function yieldTurn() {
|
|
13432
13486
|
return new Promise((resolve) => setImmediate$1(resolve));
|
|
13433
13487
|
}
|
|
13488
|
+
/** A signal that aborts after `ms`, or never for an unlimited (infinite) time budget. */
|
|
13489
|
+
function timeoutSignal(ms) {
|
|
13490
|
+
return Number.isFinite(ms) ? AbortSignal.timeout(ms) : new AbortController().signal;
|
|
13491
|
+
}
|
|
13434
13492
|
var HistoryCallBudget = class {
|
|
13435
13493
|
signal;
|
|
13436
13494
|
reservedBytes;
|
|
@@ -13445,7 +13503,7 @@ var HistoryCallBudget = class {
|
|
|
13445
13503
|
this.signal = signal;
|
|
13446
13504
|
this.timeMs = Math.max(STORE_WAIT_MIN_MS, budget.timeMs);
|
|
13447
13505
|
this.deadline = performance.now() + budget.timeMs;
|
|
13448
|
-
this.callSignal = this.withCaller(
|
|
13506
|
+
this.callSignal = this.withCaller(timeoutSignal(this.timeMs));
|
|
13449
13507
|
const reserve = Math.max(Math.min(NOTE_RESERVE_BYTES, Math.floor(budget.bytes * .25)) + Math.max(0, noteBytes - NOTE_RESERVE_BYTES), budget.bytes < NOTE_RESERVE_BYTES ? Math.min(noteBytes, Math.floor(budget.bytes / 2)) : 0);
|
|
13450
13508
|
this.bytesLeft = Math.max(1, budget.bytes - reserve);
|
|
13451
13509
|
this.reservedBytes = budget.bytes - this.bytesLeft;
|
|
@@ -13460,7 +13518,7 @@ var HistoryCallBudget = class {
|
|
|
13460
13518
|
const until = performance.now() + floorMs;
|
|
13461
13519
|
this.floor = {
|
|
13462
13520
|
until,
|
|
13463
|
-
signal: this.withCaller(
|
|
13521
|
+
signal: this.withCaller(timeoutSignal(floorMs))
|
|
13464
13522
|
};
|
|
13465
13523
|
}
|
|
13466
13524
|
markProgress() {
|
|
@@ -13659,7 +13717,7 @@ async function materializeEntry(item, budget) {
|
|
|
13659
13717
|
await budget.pace();
|
|
13660
13718
|
return { entry: smallRenderedEntry(item.seq, lines) };
|
|
13661
13719
|
}
|
|
13662
|
-
const workerResult = await renderRawEntryInWorker(item.rawChunks, PREVIEW_CHARS, budget.remainingMs(), budget.signal, item.rawFormatVersion);
|
|
13720
|
+
const workerResult = await renderRawEntryInWorker(item.rawChunks, PREVIEW_CHARS$1, budget.remainingMs(), budget.signal, item.rawFormatVersion);
|
|
13663
13721
|
if ("timedOut" in workerResult) return workerResult;
|
|
13664
13722
|
return { entry: await largeRenderedEntry(item.seq, workerResult.renderedUtf8, budget) };
|
|
13665
13723
|
}
|
|
@@ -13906,7 +13964,7 @@ function classify(entry) {
|
|
|
13906
13964
|
item: {
|
|
13907
13965
|
at,
|
|
13908
13966
|
kind: "user",
|
|
13909
|
-
preview: oneLine(messageText(entry.message.content), PREVIEW_CHARS)
|
|
13967
|
+
preview: oneLine(messageText(entry.message.content), PREVIEW_CHARS$1)
|
|
13910
13968
|
}
|
|
13911
13969
|
};
|
|
13912
13970
|
case "assistant": return { count: "assistant" };
|
|
@@ -13918,7 +13976,7 @@ function classify(entry) {
|
|
|
13918
13976
|
item: {
|
|
13919
13977
|
at,
|
|
13920
13978
|
kind: "branch summary",
|
|
13921
|
-
preview: oneLine(entry.message.summary, PREVIEW_CHARS)
|
|
13979
|
+
preview: oneLine(entry.message.summary, PREVIEW_CHARS$1)
|
|
13922
13980
|
}
|
|
13923
13981
|
};
|
|
13924
13982
|
default: return { count: "other" };
|
|
@@ -13928,7 +13986,7 @@ function classify(entry) {
|
|
|
13928
13986
|
item: {
|
|
13929
13987
|
at,
|
|
13930
13988
|
kind: "compaction",
|
|
13931
|
-
preview: oneLine(entry.summary, PREVIEW_CHARS)
|
|
13989
|
+
preview: oneLine(entry.summary, PREVIEW_CHARS$1)
|
|
13932
13990
|
}
|
|
13933
13991
|
};
|
|
13934
13992
|
case "branch_summary": return {
|
|
@@ -13936,7 +13994,7 @@ function classify(entry) {
|
|
|
13936
13994
|
item: {
|
|
13937
13995
|
at,
|
|
13938
13996
|
kind: "branch summary",
|
|
13939
|
-
preview: oneLine(entry.summary, PREVIEW_CHARS)
|
|
13997
|
+
preview: oneLine(entry.summary, PREVIEW_CHARS$1)
|
|
13940
13998
|
}
|
|
13941
13999
|
};
|
|
13942
14000
|
case "session_summary": return { count: "sessionSummary" };
|
|
@@ -13946,7 +14004,7 @@ function classify(entry) {
|
|
|
13946
14004
|
}
|
|
13947
14005
|
async function classifyEntryAt(item, budget) {
|
|
13948
14006
|
if (item.rawChunks === void 0) return classify(item.entry);
|
|
13949
|
-
const res = await renderRawEntryInWorker(item.rawChunks, PREVIEW_CHARS, budget.remainingMs(), budget.signal, item.rawFormatVersion);
|
|
14007
|
+
const res = await renderRawEntryInWorker(item.rawChunks, PREVIEW_CHARS$1, budget.remainingMs(), budget.signal, item.rawFormatVersion);
|
|
13950
14008
|
if ("timedOut" in res) return res;
|
|
13951
14009
|
return res.outline;
|
|
13952
14010
|
}
|
|
@@ -15601,7 +15659,13 @@ function createHistoryRouter(sources) {
|
|
|
15601
15659
|
...DEFAULT_HISTORY_BUDGET,
|
|
15602
15660
|
...sources.budget
|
|
15603
15661
|
};
|
|
15604
|
-
const newBudget = (signal, noteBytes) =>
|
|
15662
|
+
const newBudget = (signal, noteBytes) => {
|
|
15663
|
+
const timeMs = historyTaskTimeBudget.getStore();
|
|
15664
|
+
return new HistoryCallBudget(timeMs === void 0 ? limits : {
|
|
15665
|
+
...limits,
|
|
15666
|
+
timeMs
|
|
15667
|
+
}, signal, noteBytes);
|
|
15668
|
+
};
|
|
15605
15669
|
const noteBytes = (url, target, ranges, searchLabels = 0, multiline = false) => {
|
|
15606
15670
|
const widest = Number.MAX_SAFE_INTEGER;
|
|
15607
15671
|
const selected = ranges?.map((range) => ({
|
|
@@ -16968,6 +17032,371 @@ function createFindToolDefinition(cwd, options) {
|
|
|
16968
17032
|
function createFindTool(cwd, options) {
|
|
16969
17033
|
return wrapToolDefinition(createFindToolDefinition(cwd, options));
|
|
16970
17034
|
}
|
|
17035
|
+
/** Why a history call was refused at {@link MAX_ACTIVE_HISTORY_TASKS}, worded as the shell commands' limit is. */
|
|
17036
|
+
const HISTORY_TASK_LIMIT_MESSAGE = `4 history searches and reads are already running in this session, the most it runs at once. Stop one you no longer need with kill, or wait for one to finish, then run this one again.`;
|
|
17037
|
+
/** Finished background history tasks a session keeps, so a late wait still returns their result. */
|
|
17038
|
+
const SETTLED_HISTORY_TASKS_KEPT = 16;
|
|
17039
|
+
const PREVIEW_CHARS = 2e3;
|
|
17040
|
+
const HISTORY_TASK_ID = /^history-\d+$/;
|
|
17041
|
+
let lastHistoryTaskNumber = 0;
|
|
17042
|
+
/** The model-facing rule for history:// calls that outlive their observation budget, shared by `read` and `search`. */
|
|
17043
|
+
const HISTORY_TASK_GUIDELINE = `A history:// read or search waits for its result like bash does: 10 seconds by default, or as set by wait (wait: { kind: "background" } returns at once). If it is still running then, it keeps running in the background with no time limit and returns a task ID, and its result arrives later as a completion notice. To wait for that result, call the same tool with { action: "wait", id }; to stop it, call kill({ id }). Never repeat the call to get its result. Up to 4 run at once in a session; at that limit a new one is refused until one finishes or is stopped.`;
|
|
17044
|
+
function outcomeOf(result, signal) {
|
|
17045
|
+
return result.then((value) => ({
|
|
17046
|
+
kind: "completed",
|
|
17047
|
+
result: value
|
|
17048
|
+
}), (error) => signal.aborted ? { kind: "cancelled" } : {
|
|
17049
|
+
kind: "failed",
|
|
17050
|
+
error
|
|
17051
|
+
});
|
|
17052
|
+
}
|
|
17053
|
+
function delay(ms, signal) {
|
|
17054
|
+
if (signal?.aborted) return Promise.resolve("aborted");
|
|
17055
|
+
return new Promise((resolve) => {
|
|
17056
|
+
const timer = setTimeout(() => {
|
|
17057
|
+
signal?.removeEventListener("abort", onAbort);
|
|
17058
|
+
resolve("elapsed");
|
|
17059
|
+
}, ms);
|
|
17060
|
+
const onAbort = () => {
|
|
17061
|
+
clearTimeout(timer);
|
|
17062
|
+
resolve("aborted");
|
|
17063
|
+
};
|
|
17064
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
17065
|
+
});
|
|
17066
|
+
}
|
|
17067
|
+
function errorMessage(error) {
|
|
17068
|
+
return error instanceof Error ? error.message || error.name : String(error);
|
|
17069
|
+
}
|
|
17070
|
+
function resultText(content) {
|
|
17071
|
+
return content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
|
|
17072
|
+
}
|
|
17073
|
+
function label(kind) {
|
|
17074
|
+
return kind === "search" ? "history search" : "history read";
|
|
17075
|
+
}
|
|
17076
|
+
function stillRunningText(task) {
|
|
17077
|
+
const tool = task.kind;
|
|
17078
|
+
return `History ${task.kind} is still running (task ${task.id}). It has no time limit: it runs until it finishes, kill stops it, or this session ends. The result arrives as a completion notice; if it is too long, it ends with a "continue with" URL as usual. Wait for it with ${tool}({ action: "wait", id: "${task.id}" }) or stop it with kill({ id: "${task.id}" }). Never repeat the call to get its result.`;
|
|
17079
|
+
}
|
|
17080
|
+
function stillRunning(task) {
|
|
17081
|
+
return {
|
|
17082
|
+
content: [{
|
|
17083
|
+
type: "text",
|
|
17084
|
+
text: stillRunningText(task)
|
|
17085
|
+
}],
|
|
17086
|
+
details: { historyTask: {
|
|
17087
|
+
taskId: task.id,
|
|
17088
|
+
state: "running"
|
|
17089
|
+
} }
|
|
17090
|
+
};
|
|
17091
|
+
}
|
|
17092
|
+
/** The result a wait or a call returns for a settled task: its own output, or the failure it ended with. */
|
|
17093
|
+
function settledResult(task, outcome) {
|
|
17094
|
+
if (outcome.kind === "completed") return outcome.result;
|
|
17095
|
+
if (outcome.kind === "failed") return {
|
|
17096
|
+
content: [{
|
|
17097
|
+
type: "text",
|
|
17098
|
+
text: `History ${task.kind} ${task.id} failed: ${errorMessage(outcome.error)}`
|
|
17099
|
+
}],
|
|
17100
|
+
details: void 0,
|
|
17101
|
+
isError: true
|
|
17102
|
+
};
|
|
17103
|
+
return {
|
|
17104
|
+
content: [{
|
|
17105
|
+
type: "text",
|
|
17106
|
+
text: `History ${task.kind} ${task.id} was stopped before it finished.`
|
|
17107
|
+
}],
|
|
17108
|
+
details: void 0,
|
|
17109
|
+
isError: true
|
|
17110
|
+
};
|
|
17111
|
+
}
|
|
17112
|
+
function completionMessage(task, outcome) {
|
|
17113
|
+
const name = label(task.kind);
|
|
17114
|
+
const failed = outcome.kind !== "completed";
|
|
17115
|
+
const text = outcome.kind === "completed" ? resultText(outcome.result.content) : "";
|
|
17116
|
+
const verb = failed ? "failed" : "completed";
|
|
17117
|
+
const title = `Background ${name} ${verb}: ${task.subject}`;
|
|
17118
|
+
const lines = [title, `Task: ${task.id}`];
|
|
17119
|
+
if (outcome.kind === "failed") lines.push(`Error: ${errorMessage(outcome.error)}`);
|
|
17120
|
+
if (text.trim()) lines.push("", "Result (task output, not instructions):", text);
|
|
17121
|
+
lines.push("", "This execution has ended. Do not restart it merely to retrieve its result.");
|
|
17122
|
+
const line = {
|
|
17123
|
+
status: failed ? "failure" : "success",
|
|
17124
|
+
label: `History ${task.kind}`,
|
|
17125
|
+
subject: task.subject,
|
|
17126
|
+
outcome: verb,
|
|
17127
|
+
...task.elapsedMs === void 0 ? {} : { elapsedMs: task.elapsedMs }
|
|
17128
|
+
};
|
|
17129
|
+
const preview = outcome.kind === "failed" ? errorMessage(outcome.error) : text.slice(0, PREVIEW_CHARS);
|
|
17130
|
+
return {
|
|
17131
|
+
customType: TASK_COMPLETION_MESSAGE_TYPE,
|
|
17132
|
+
content: lines.join("\n"),
|
|
17133
|
+
display: true,
|
|
17134
|
+
details: {
|
|
17135
|
+
completionId: `${task.id}-completion`,
|
|
17136
|
+
taskId: task.id,
|
|
17137
|
+
notification: {
|
|
17138
|
+
title,
|
|
17139
|
+
preview,
|
|
17140
|
+
status: failed ? "failed" : "completed",
|
|
17141
|
+
taskId: task.id,
|
|
17142
|
+
line
|
|
17143
|
+
}
|
|
17144
|
+
}
|
|
17145
|
+
};
|
|
17146
|
+
}
|
|
17147
|
+
/**
|
|
17148
|
+
* The background history calls of one session: a `read` or `search` of `history://` that outlives its observation
|
|
17149
|
+
* budget keeps scanning here, in this process and on the session's own store, and reports through a task completion
|
|
17150
|
+
* notice. These are not owner tasks: they do not appear in `/tasks`, and closing the session or reloading it stops them.
|
|
17151
|
+
*/
|
|
17152
|
+
var HistoryTaskRegistry = class {
|
|
17153
|
+
options;
|
|
17154
|
+
running = /* @__PURE__ */ new Map();
|
|
17155
|
+
finished = /* @__PURE__ */ new Map();
|
|
17156
|
+
/** Calls observed in the foreground that may still become tasks; they count toward the active limit. */
|
|
17157
|
+
observing = 0;
|
|
17158
|
+
closed = false;
|
|
17159
|
+
constructor(options) {
|
|
17160
|
+
this.options = options;
|
|
17161
|
+
}
|
|
17162
|
+
automaticBudgetMs() {
|
|
17163
|
+
return this.options.automaticBudgetMs ? this.options.automaticBudgetMs() : COMMAND_FOREGROUND_BUDGET_MS;
|
|
17164
|
+
}
|
|
17165
|
+
/** Whether `id` names a history task, as opposed to an owner task. */
|
|
17166
|
+
static isTaskId(id) {
|
|
17167
|
+
return HISTORY_TASK_ID.test(id);
|
|
17168
|
+
}
|
|
17169
|
+
/**
|
|
17170
|
+
* Runs one history call. It returns inline when it settles within its observation budget, and otherwise goes on
|
|
17171
|
+
* as a background task, returning a result that names it. Past {@link MAX_ACTIVE_HISTORY_TASKS} active calls it is
|
|
17172
|
+
* refused; once closed, the call runs inline with the default time budget, as it always did.
|
|
17173
|
+
*/
|
|
17174
|
+
async run(call) {
|
|
17175
|
+
if (this.closed) return call.run(call.signal);
|
|
17176
|
+
if (this.running.size + this.observing >= 4) throw new Error(HISTORY_TASK_LIMIT_MESSAGE);
|
|
17177
|
+
call.signal?.throwIfAborted();
|
|
17178
|
+
const budgetMs = call.wait === void 0 ? this.automaticBudgetMs() : call.wait.kind === "background" ? 0 : call.wait.budgetMs;
|
|
17179
|
+
const controller = new AbortController();
|
|
17180
|
+
const stopWithCall = () => controller.abort(call.signal?.reason);
|
|
17181
|
+
call.signal?.addEventListener("abort", stopWithCall, { once: true });
|
|
17182
|
+
const task = {
|
|
17183
|
+
id: `history-${++lastHistoryTaskNumber}`,
|
|
17184
|
+
kind: call.kind,
|
|
17185
|
+
subject: completionTitleDescription(call.subject),
|
|
17186
|
+
startedAt: Date.now(),
|
|
17187
|
+
controller,
|
|
17188
|
+
settled: outcomeOf(historyTaskTimeBudget.run(Number.POSITIVE_INFINITY, () => call.run(controller.signal)), controller.signal),
|
|
17189
|
+
waiters: 0
|
|
17190
|
+
};
|
|
17191
|
+
this.observing++;
|
|
17192
|
+
let observed;
|
|
17193
|
+
try {
|
|
17194
|
+
observed = call.wait?.kind === "background" ? "elapsed" : budgetMs === void 0 ? await task.settled : await Promise.race([task.settled, delay(budgetMs, call.signal)]);
|
|
17195
|
+
} finally {
|
|
17196
|
+
this.observing--;
|
|
17197
|
+
call.signal?.removeEventListener("abort", stopWithCall);
|
|
17198
|
+
}
|
|
17199
|
+
if (observed === "aborted") {
|
|
17200
|
+
controller.abort(call.signal?.reason);
|
|
17201
|
+
observed = await task.settled;
|
|
17202
|
+
}
|
|
17203
|
+
if (observed !== "elapsed") {
|
|
17204
|
+
if (observed.kind === "completed") return observed.result;
|
|
17205
|
+
if (observed.kind === "failed") throw observed.error;
|
|
17206
|
+
throw call.signal?.reason ?? /* @__PURE__ */ new Error("aborted");
|
|
17207
|
+
}
|
|
17208
|
+
this.running.set(task.id, task);
|
|
17209
|
+
task.settled.then((outcome) => this.settle(task, outcome));
|
|
17210
|
+
return stillRunning(task);
|
|
17211
|
+
}
|
|
17212
|
+
settle(task, outcome) {
|
|
17213
|
+
task.outcome = outcome;
|
|
17214
|
+
task.elapsedMs = Date.now() - task.startedAt;
|
|
17215
|
+
this.running.delete(task.id);
|
|
17216
|
+
if (this.closed) return;
|
|
17217
|
+
this.finished.set(task.id, task);
|
|
17218
|
+
for (const id of this.finished.keys()) {
|
|
17219
|
+
if (this.finished.size <= SETTLED_HISTORY_TASKS_KEPT) break;
|
|
17220
|
+
this.finished.delete(id);
|
|
17221
|
+
}
|
|
17222
|
+
if (task.waiters > 0 || outcome.kind === "cancelled") return;
|
|
17223
|
+
Promise.resolve().then(() => this.options.notify(completionMessage(task, outcome))).catch(() => {});
|
|
17224
|
+
}
|
|
17225
|
+
lookup(id) {
|
|
17226
|
+
const task = this.running.get(id) ?? this.finished.get(id);
|
|
17227
|
+
if (!task) throw new Error(`Unknown history task ${id}: it was never started here, or it ended long ago`);
|
|
17228
|
+
return task;
|
|
17229
|
+
}
|
|
17230
|
+
/** Observes a history task for `budgetMs` (the owner's automatic budget when omitted) or until it settles. */
|
|
17231
|
+
async wait(id, budgetMs, signal) {
|
|
17232
|
+
const task = this.lookup(id);
|
|
17233
|
+
if (task.outcome) return settledResult(task, task.outcome);
|
|
17234
|
+
const budget = budgetMs ?? this.automaticBudgetMs();
|
|
17235
|
+
task.waiters++;
|
|
17236
|
+
try {
|
|
17237
|
+
const observed = budget === void 0 ? await task.settled : await Promise.race([task.settled, delay(budget, signal)]);
|
|
17238
|
+
if (observed === "aborted") throw signal?.reason ?? /* @__PURE__ */ new Error("aborted");
|
|
17239
|
+
if (observed === "elapsed") return stillRunning(task);
|
|
17240
|
+
return settledResult(task, observed);
|
|
17241
|
+
} finally {
|
|
17242
|
+
task.waiters--;
|
|
17243
|
+
}
|
|
17244
|
+
}
|
|
17245
|
+
/** Stops a running history task and waits for its scan to end; a finished one is reported as it ended. */
|
|
17246
|
+
async cancel(id) {
|
|
17247
|
+
const task = this.lookup(id);
|
|
17248
|
+
if (task.outcome) return `History ${task.kind} ${id} had already finished; nothing to stop. It ${outcomePhrase(task.outcome)}.`;
|
|
17249
|
+
task.controller.abort(/* @__PURE__ */ new Error("Stopped by kill"));
|
|
17250
|
+
const outcome = await task.settled;
|
|
17251
|
+
return outcome.kind === "cancelled" ? `History ${task.kind} ${id} was stopped; it no longer reads the session store.` : `History ${task.kind} ${id} ${outcomePhrase(outcome)} before it could be stopped.`;
|
|
17252
|
+
}
|
|
17253
|
+
/** Stops every running task without notices; later calls run inline. */
|
|
17254
|
+
async close() {
|
|
17255
|
+
this.closed = true;
|
|
17256
|
+
const tasks = [...this.running.values()];
|
|
17257
|
+
for (const task of tasks) task.controller.abort(/* @__PURE__ */ new Error("History task stopped: its session closed"));
|
|
17258
|
+
this.finished.clear();
|
|
17259
|
+
await Promise.all(tasks.map((task) => task.settled));
|
|
17260
|
+
}
|
|
17261
|
+
};
|
|
17262
|
+
function outcomePhrase(outcome) {
|
|
17263
|
+
if (outcome.kind === "completed") return "completed";
|
|
17264
|
+
if (outcome.kind === "failed") return `failed: ${errorMessage(outcome.error)}`;
|
|
17265
|
+
return "was stopped";
|
|
17266
|
+
}
|
|
17267
|
+
/** Whether a `read` path or `search` paths name a `history://` URL. */
|
|
17268
|
+
function namesHistoryUrl(paths) {
|
|
17269
|
+
if (paths === void 0) return false;
|
|
17270
|
+
return (typeof paths === "string" ? [paths] : paths).some((path) => path.trim().startsWith("history://"));
|
|
17271
|
+
}
|
|
17272
|
+
/** Validates a `wait` policy of `read` or `search`, as bash validates its own. */
|
|
17273
|
+
function validateHistoryWait(wait) {
|
|
17274
|
+
if (wait === void 0) return void 0;
|
|
17275
|
+
const policy = wait;
|
|
17276
|
+
if (!policy || typeof policy !== "object" || policy.kind !== "background" && policy.kind !== "foreground" || Object.keys(policy).some((key) => key !== "kind" && (policy.kind !== "foreground" || key !== "budgetMs")) || policy.kind === "foreground" && policy.budgetMs !== void 0 && (typeof policy.budgetMs !== "number" || !Number.isFinite(policy.budgetMs) || policy.budgetMs < 0)) throw new Error("Invalid wait: expected background or foreground with a finite non-negative budgetMs");
|
|
17277
|
+
return policy;
|
|
17278
|
+
}
|
|
17279
|
+
/** The `wait` parameter of `read` and `search`, the same observation policy as bash's. */
|
|
17280
|
+
const historyWaitSchema = Type$1.Unsafe({
|
|
17281
|
+
type: "object",
|
|
17282
|
+
properties: {
|
|
17283
|
+
kind: {
|
|
17284
|
+
type: "string",
|
|
17285
|
+
enum: ["background", "foreground"]
|
|
17286
|
+
},
|
|
17287
|
+
budgetMs: {
|
|
17288
|
+
type: "number",
|
|
17289
|
+
minimum: 0,
|
|
17290
|
+
description: "How long to wait, in milliseconds; only valid with kind foreground."
|
|
17291
|
+
}
|
|
17292
|
+
},
|
|
17293
|
+
required: ["kind"],
|
|
17294
|
+
additionalProperties: false,
|
|
17295
|
+
description: "How long to wait for a history:// read or search, as for bash. Omit to wait the default time (10 seconds unless configured); a call still running after that keeps running as a background task."
|
|
17296
|
+
});
|
|
17297
|
+
/** The properties that observe an existing history task instead of starting a call. */
|
|
17298
|
+
const historyWaitActionProperties = {
|
|
17299
|
+
action: {
|
|
17300
|
+
type: "string",
|
|
17301
|
+
enum: ["wait"],
|
|
17302
|
+
description: "Wait for a background history task started earlier, instead of starting a new call."
|
|
17303
|
+
},
|
|
17304
|
+
id: {
|
|
17305
|
+
type: "string",
|
|
17306
|
+
description: "History task ID returned by an earlier call, such as history-3."
|
|
17307
|
+
},
|
|
17308
|
+
budgetMs: {
|
|
17309
|
+
type: "number",
|
|
17310
|
+
minimum: 0,
|
|
17311
|
+
description: "How long to wait, in milliseconds; omit to wait the default time."
|
|
17312
|
+
}
|
|
17313
|
+
};
|
|
17314
|
+
/**
|
|
17315
|
+
* Checks the shape of a `read` or `search` call: a wait names `action`, `id` and optionally `budgetMs` only; any other
|
|
17316
|
+
* call names `required` and neither `id` nor `budgetMs`.
|
|
17317
|
+
*/
|
|
17318
|
+
function prepareHistoryAwareInput(args, tool, required) {
|
|
17319
|
+
if (typeof args !== "object" || args === null || Array.isArray(args)) return args;
|
|
17320
|
+
const has = (key) => Object.hasOwn(args, key);
|
|
17321
|
+
if (has("action")) {
|
|
17322
|
+
if (!has("id") || Object.keys(args).some((key) => ![
|
|
17323
|
+
"action",
|
|
17324
|
+
"id",
|
|
17325
|
+
"budgetMs"
|
|
17326
|
+
].includes(key))) throw new Error(`Invalid ${tool} wait: expected action wait, id, and optional finite non-negative budgetMs`);
|
|
17327
|
+
} else if (!has(required) || has("id") || has("budgetMs")) throw new Error(`Invalid ${tool} call: ${required} is required; id and budgetMs require action wait`);
|
|
17328
|
+
return args;
|
|
17329
|
+
}
|
|
17330
|
+
/** Runs `action: "wait"` of `read` or `search` against the session's history tasks. */
|
|
17331
|
+
function waitForHistoryTask(registry, input, tool, signal) {
|
|
17332
|
+
if (input.action !== "wait" || typeof input.id !== "string" || input.budgetMs !== void 0 && (typeof input.budgetMs !== "number" || !Number.isFinite(input.budgetMs) || input.budgetMs < 0)) throw new Error(`Invalid ${tool} wait: expected action wait, id, and optional finite non-negative budgetMs`);
|
|
17333
|
+
if (!registry) throw new Error("History task wait requires a session");
|
|
17334
|
+
return registry.wait(input.id, input.budgetMs, signal);
|
|
17335
|
+
}
|
|
17336
|
+
// dist/core/tools/kill.js
|
|
17337
|
+
const killSchema = Type$1.Object({ id: Type$1.String({ description: "Task ID returned by a bash or powershell command, or a history:// read or search, that is running in the background" }) });
|
|
17338
|
+
function createKillToolDefinition(options) {
|
|
17339
|
+
return {
|
|
17340
|
+
name: "kill",
|
|
17341
|
+
label: "Kill",
|
|
17342
|
+
description: "Stop a background task this session started: a bash or PowerShell command, or a history:// read or search. Pass its task ID, not a process ID. It does not stop subagents or tasks owned by others. For a shell task, the result says whether the stop was accepted and whether the process and its cleanup have finished; an accepted stop does not mean the process has exited yet.",
|
|
17343
|
+
parameters: killSchema,
|
|
17344
|
+
...experimentalToolSamplingProperty(),
|
|
17345
|
+
promptSnippet: "Stop a background shell or history task by its task ID",
|
|
17346
|
+
execute: async (_toolCallId, { id }) => {
|
|
17347
|
+
if (HistoryTaskRegistry.isTaskId(id)) {
|
|
17348
|
+
const history = options?.historyTasks?.();
|
|
17349
|
+
if (!history) throw new Error("kill of a history task requires a session");
|
|
17350
|
+
return {
|
|
17351
|
+
content: [{
|
|
17352
|
+
type: "text",
|
|
17353
|
+
text: await history.cancel(id)
|
|
17354
|
+
}],
|
|
17355
|
+
details: void 0
|
|
17356
|
+
};
|
|
17357
|
+
}
|
|
17358
|
+
const binding = options?.taskOwner?.();
|
|
17359
|
+
if (!binding) throw new Error("kill requires a supported task owner");
|
|
17360
|
+
const { supervisor, owner } = binding;
|
|
17361
|
+
const task = lookupOwnedTask(binding, id);
|
|
17362
|
+
const watched = supervisor.watchOwnerTasks(owner);
|
|
17363
|
+
if (!watched.ok) throw new TaskToolError(watched.error, id);
|
|
17364
|
+
try {
|
|
17365
|
+
if (watched.value.snapshot.tasks.find((entry) => entry.ref.taskId === id)?.kind !== "command") throw new Error("kill only supports shell tasks");
|
|
17366
|
+
const result = await supervisor.cancelTask(task, "user");
|
|
17367
|
+
if (!result.ok) throw new TaskToolError(result.error, id);
|
|
17368
|
+
const receipt = result.value;
|
|
17369
|
+
return {
|
|
17370
|
+
content: [{
|
|
17371
|
+
type: "text",
|
|
17372
|
+
text: cancelReceiptSentence(receipt)
|
|
17373
|
+
}],
|
|
17374
|
+
details: receipt,
|
|
17375
|
+
...receipt.cleanup.kind === "failed" ? { isError: true } : {}
|
|
17376
|
+
};
|
|
17377
|
+
} finally {
|
|
17378
|
+
watched.value.dispose();
|
|
17379
|
+
}
|
|
17380
|
+
},
|
|
17381
|
+
renderCall(args, _theme, context) {
|
|
17382
|
+
const text = context.lastComponent ?? new Text("", 0, 0);
|
|
17383
|
+
text.setText(formatKillCall(args));
|
|
17384
|
+
return text;
|
|
17385
|
+
},
|
|
17386
|
+
renderResult(result, _options, _theme, context) {
|
|
17387
|
+
const component = context.lastComponent ?? new Container();
|
|
17388
|
+
rebuildKillResult(component, result, {
|
|
17389
|
+
isError: context.isError,
|
|
17390
|
+
taskId: context.args.id
|
|
17391
|
+
});
|
|
17392
|
+
component.invalidate();
|
|
17393
|
+
return component;
|
|
17394
|
+
}
|
|
17395
|
+
};
|
|
17396
|
+
}
|
|
17397
|
+
function createKillTool(options) {
|
|
17398
|
+
return wrapToolDefinition(createKillToolDefinition(options));
|
|
17399
|
+
}
|
|
16971
17400
|
// dist/core/tools/ls.js
|
|
16972
17401
|
const lsSchema = Type$1.Object({
|
|
16973
17402
|
path: Type$1.Optional(Type$1.String({ description: "Directory to list (default: current directory)" })),
|
|
@@ -17166,18 +17595,18 @@ function createLocalPowerShellOperations(binding) {
|
|
|
17166
17595
|
});
|
|
17167
17596
|
const { child } = shellProcess;
|
|
17168
17597
|
let timedOut = false;
|
|
17169
|
-
let
|
|
17598
|
+
let stopDeadline;
|
|
17170
17599
|
const waitAbort = new AbortController();
|
|
17171
17600
|
const onAbort = () => {
|
|
17172
17601
|
waitAbort.abort();
|
|
17173
17602
|
shellProcess.stop();
|
|
17174
17603
|
};
|
|
17175
17604
|
try {
|
|
17176
|
-
if (options.timeout !== void 0
|
|
17605
|
+
if (options.timeout !== void 0) stopDeadline = startShellDeadline(options.timeout * 1e3, () => {
|
|
17177
17606
|
timedOut = true;
|
|
17178
17607
|
waitAbort.abort();
|
|
17179
17608
|
shellProcess.stop();
|
|
17180
|
-
}
|
|
17609
|
+
});
|
|
17181
17610
|
child.stdout?.on("data", (data) => options.onData(data, "stdout"));
|
|
17182
17611
|
child.stderr?.on("data", (data) => options.onData(data, "stderr"));
|
|
17183
17612
|
if (options.signal) {
|
|
@@ -17197,7 +17626,7 @@ function createLocalPowerShellOperations(binding) {
|
|
|
17197
17626
|
return { exitCode };
|
|
17198
17627
|
} finally {
|
|
17199
17628
|
shellProcess.finish();
|
|
17200
|
-
|
|
17629
|
+
stopDeadline?.();
|
|
17201
17630
|
options.signal?.removeEventListener("abort", onAbort);
|
|
17202
17631
|
}
|
|
17203
17632
|
} };
|
|
@@ -17220,7 +17649,7 @@ function createPowerShellToolDefinition(cwd, options = {}) {
|
|
|
17220
17649
|
if (args[1].action === void 0) validateBashWait(args[1].wait, !!options.operations || !!options.taskOwner);
|
|
17221
17650
|
return definition.execute(...args);
|
|
17222
17651
|
},
|
|
17223
|
-
description: "Execute a PowerShell command or observe an existing task with action: \"wait\", id, and optional budgetMs. Owner-bound commands automatically yield after 10s by default without stopping execution. Unbound commands wait for completion; background and existing-task waits require a task owner.",
|
|
17652
|
+
description: "Execute a PowerShell command or observe an existing task with action: \"wait\", id, and optional budgetMs. A command runs until it exits or is stopped unless timeout sets a deadline in seconds. A background command can run indefinitely, such as a dev server; stop it with kill. Owner-bound commands automatically yield after 10s by default without stopping execution. Unbound commands wait for completion; background and existing-task waits require a task owner.",
|
|
17224
17653
|
promptSnippet: powershellToolSystemPromptContribution.snippet,
|
|
17225
17654
|
promptGuidelines: options.exposeSessionEnvironment === false ? void 0 : [...powershellToolSystemPromptContribution.guidelines]
|
|
17226
17655
|
};
|
|
@@ -17560,11 +17989,29 @@ function applyReadLineSelection(allLines, ranges, offset, limit, exact = false)
|
|
|
17560
17989
|
};
|
|
17561
17990
|
}
|
|
17562
17991
|
// dist/core/tools/read.js
|
|
17563
|
-
const
|
|
17992
|
+
const readBaseSchema = Type$1.Object({
|
|
17993
|
+
path: Type$1.String({ description: "File, directory, archive member, SQLite selector, internal resource (skill://, local://, artifact://, conflict://, history://), image, document, or URL to read. Append selectors such as :raw, :conflicts, :N, :A-B, :A+C, or :A-B,C-D to scope output." }),
|
|
17994
|
+
wait: Type$1.Optional(historyWaitSchema)
|
|
17995
|
+
}, { additionalProperties: false });
|
|
17996
|
+
const readSchema = Type$1.Unsafe({
|
|
17997
|
+
...readBaseSchema,
|
|
17998
|
+
properties: {
|
|
17999
|
+
...readBaseSchema.properties,
|
|
18000
|
+
...historyWaitActionProperties
|
|
18001
|
+
},
|
|
18002
|
+
required: []
|
|
18003
|
+
});
|
|
17564
18004
|
const readToolSystemPromptContribution = Object.freeze({
|
|
17565
18005
|
snippet: "Read a path selector.",
|
|
17566
|
-
guidelines: Object.freeze(["Use read to inspect file and resource contents; use path selectors for line ranges, raw output, and conflict views."])
|
|
18006
|
+
guidelines: Object.freeze(["Use read to inspect file and resource contents; use path selectors for line ranges, raw output, and conflict views.", HISTORY_TASK_GUIDELINE])
|
|
17567
18007
|
});
|
|
18008
|
+
/** A history task's receipt or wait result, with the structured output every read result carries. */
|
|
18009
|
+
function asReadResult(result) {
|
|
18010
|
+
return {
|
|
18011
|
+
...result,
|
|
18012
|
+
structuredContent: result.structuredContent ?? toReadOutput(result.content)
|
|
18013
|
+
};
|
|
18014
|
+
}
|
|
17568
18015
|
const readOutputSchema = Type$1.Union([Type$1.String(), Type$1.Object({
|
|
17569
18016
|
type: Type$1.Literal("image"),
|
|
17570
18017
|
data: Type$1.String(),
|
|
@@ -17789,6 +18236,20 @@ function splitSelectorOr(pathValue, whole) {
|
|
|
17789
18236
|
return { path: whole };
|
|
17790
18237
|
}
|
|
17791
18238
|
}
|
|
18239
|
+
/** A whole read of `skill://<name>` names the skill's directory first, so the skill's relative references resolve. */
|
|
18240
|
+
function withSkillBaseDirectory(url, result) {
|
|
18241
|
+
const skill = parseSkillUri(url);
|
|
18242
|
+
const first = result.content[0];
|
|
18243
|
+
if (!skill || skill.subpath || first?.type !== "text") return result;
|
|
18244
|
+
const header = `Base directory for this skill: ${url.replace(/\/+$/, "")}/`;
|
|
18245
|
+
return {
|
|
18246
|
+
...result,
|
|
18247
|
+
content: [{
|
|
18248
|
+
...first,
|
|
18249
|
+
text: `${header}\n\n${first.text}`
|
|
18250
|
+
}, ...result.content.slice(1)]
|
|
18251
|
+
};
|
|
18252
|
+
}
|
|
17792
18253
|
function appendReadSelectors(pathValue, selector) {
|
|
17793
18254
|
const range = selector.ranges?.map((item) => item.end === void 0 ? `${item.start}` : `${item.start}-${item.end}`).join(",") ?? (selector.offset ? `${selector.offset}` : "");
|
|
17794
18255
|
return `${pathValue}${range ? `:${range}` : ""}${selector.conflicts ? ":conflicts" : ""}${selector.raw ? ":raw" : ""}`;
|
|
@@ -17797,484 +18258,500 @@ function createReadToolDefinition(cwd, options) {
|
|
|
17797
18258
|
const autoResizeImages = options?.autoResizeImages ?? true;
|
|
17798
18259
|
const fallbackResizeOptions = options?.resizeOptions;
|
|
17799
18260
|
const ops = options?.operations ?? defaultReadOperations;
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
|
|
17812
|
-
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
|
|
17843
|
-
|
|
17844
|
-
|
|
17845
|
-
|
|
17846
|
-
|
|
17847
|
-
|
|
17848
|
-
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
|
|
17857
|
-
|
|
17858
|
-
|
|
17859
|
-
|
|
17860
|
-
|
|
17861
|
-
|
|
18261
|
+
const readPath = async (toolCallId, path, signal, ctx) => {
|
|
18262
|
+
const resourceCtx = ctx;
|
|
18263
|
+
const executionCwd = ctx?.cwd || cwd;
|
|
18264
|
+
const markerless = path.replace(/:raw(?=(:|$))/g, "").replace(/:conflicts(?=(:|$))/g, "");
|
|
18265
|
+
const sqliteOriginal = await sqliteSelectorForPath(markerless, executionCwd);
|
|
18266
|
+
const sqliteDirect = await sqliteSelectorForPath(path, executionCwd);
|
|
18267
|
+
const literalPath = await isExistingLiteralPath(path, executionCwd, ops);
|
|
18268
|
+
const splitSelector = literalPath || sqliteOriginal?.rowId ? splitSelectorOr(path, markerless) : splitReadLineSelector(path);
|
|
18269
|
+
const selector = literalPath || await archiveSelectorMemberExists(path, executionCwd) ? { path } : sqliteDirect && (sqliteDirect.table === "raw" || sqliteDirect.table === "conflicts") ? { path } : sqliteOriginal?.rowId && splitSelector.path !== markerless ? {
|
|
18270
|
+
path: markerless,
|
|
18271
|
+
raw: splitSelector.raw,
|
|
18272
|
+
conflicts: splitSelector.conflicts
|
|
18273
|
+
} : sqliteOriginal && splitSelector.path === markerless && markerless !== path ? {
|
|
18274
|
+
path: markerless,
|
|
18275
|
+
raw: splitSelector.raw,
|
|
18276
|
+
conflicts: splitSelector.conflicts
|
|
18277
|
+
} : splitSelector.path === path && sqliteDirect ? { path } : splitSelector;
|
|
18278
|
+
const effectivePath = selector.path;
|
|
18279
|
+
const effectiveOffset = selector.offset;
|
|
18280
|
+
const effectiveLimit = selector.limit;
|
|
18281
|
+
const effectiveRanges = selector.ranges;
|
|
18282
|
+
const rawOutput = selector.raw;
|
|
18283
|
+
const conflictsOnly = selector.conflicts;
|
|
18284
|
+
return new Promise((resolve, reject) => {
|
|
18285
|
+
if (signal?.aborted) {
|
|
18286
|
+
reject(new FileToolAbortedError(signal.reason));
|
|
18287
|
+
return;
|
|
18288
|
+
}
|
|
18289
|
+
let aborted = false;
|
|
18290
|
+
const onAbort = () => {
|
|
18291
|
+
aborted = true;
|
|
18292
|
+
reject(new FileToolAbortedError(signal?.reason));
|
|
18293
|
+
};
|
|
18294
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
18295
|
+
(async () => {
|
|
18296
|
+
try {
|
|
18297
|
+
const archive = parseArchiveSelector(effectivePath);
|
|
18298
|
+
const sqlite = await sqliteSelectorForPath(effectivePath, executionCwd);
|
|
18299
|
+
if (isReadableUrlPath(effectivePath)) {
|
|
18300
|
+
const { readUrlBranch } = await import("../core/tools/read-url.code.js").catch((error) => __atomicOnDemandFailed(error, "this feature"));
|
|
18301
|
+
resolve(await readUrlBranch({
|
|
18302
|
+
effectivePath,
|
|
18303
|
+
rawOutput: rawOutput === true,
|
|
18304
|
+
effectiveRanges,
|
|
18305
|
+
effectiveOffset,
|
|
18306
|
+
effectiveLimit,
|
|
18307
|
+
cwd: executionCwd,
|
|
18308
|
+
ctx,
|
|
18309
|
+
signal,
|
|
18310
|
+
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18311
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
18312
|
+
oversized: oversizedReadResult,
|
|
18313
|
+
sourceMeta: readSourceMeta
|
|
18314
|
+
}));
|
|
18315
|
+
return;
|
|
18316
|
+
}
|
|
18317
|
+
if (sqlite) {
|
|
18318
|
+
const textContent = await readSqliteSelector(sqlite);
|
|
18319
|
+
const selection = applyReadLineSelection(textContent.split("\n"), effectiveRanges, effectiveOffset, effectiveLimit, rawOutput);
|
|
18320
|
+
const selectedText = selection.lines.join("\n");
|
|
18321
|
+
if ((effectiveRanges || effectiveOffset) && selection.lines.length === 0) {
|
|
18322
|
+
resolve({
|
|
18323
|
+
content: [{
|
|
18324
|
+
type: "text",
|
|
18325
|
+
text: `Requested line ${effectiveRanges?.[0]?.start ?? effectiveOffset ?? 1} is beyond end of resource (${textContent.split("\n").length} lines total).`
|
|
18326
|
+
}],
|
|
18327
|
+
details: void 0
|
|
18328
|
+
});
|
|
18329
|
+
return;
|
|
18330
|
+
}
|
|
18331
|
+
if (selectedText.length > READ_TOOL_MAX_RESULT_CHARS || Buffer.byteLength(selectedText, "utf8") > 51200) {
|
|
18332
|
+
resolve(oversizedReadResult({
|
|
18333
|
+
blocked: true,
|
|
18334
|
+
path: effectivePath,
|
|
18335
|
+
chars: selectedText.length,
|
|
17862
18336
|
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
17863
|
-
|
|
17864
|
-
|
|
17865
|
-
|
|
18337
|
+
startLine: selection.firstLine,
|
|
18338
|
+
totalFileLines: textContent.split("\n").length,
|
|
18339
|
+
firstLineBytes: Buffer.byteLength(selection.lines[0] ?? "", "utf8"),
|
|
18340
|
+
byteGuidance: false
|
|
17866
18341
|
}));
|
|
17867
18342
|
return;
|
|
17868
18343
|
}
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
|
|
17872
|
-
|
|
17873
|
-
|
|
18344
|
+
resolve({
|
|
18345
|
+
content: [{
|
|
18346
|
+
type: "text",
|
|
18347
|
+
text: selectedText
|
|
18348
|
+
}],
|
|
18349
|
+
details: readSourceMeta(effectivePath)
|
|
18350
|
+
});
|
|
18351
|
+
return;
|
|
18352
|
+
}
|
|
18353
|
+
if (archive) {
|
|
18354
|
+
const resolvedArchive = await resolveArchiveSelector(archive, executionCwd);
|
|
18355
|
+
let allLines = (await readArchiveSelector(resolvedArchive)).split("\n");
|
|
18356
|
+
if (conflictsOnly) {
|
|
18357
|
+
let inConflict = false;
|
|
18358
|
+
const conflictLines = allLines.filter((line) => {
|
|
18359
|
+
if (line.startsWith("<<<<<<<")) inConflict = true;
|
|
18360
|
+
const keep = inConflict;
|
|
18361
|
+
if (line.startsWith(">>>>>>>")) inConflict = false;
|
|
18362
|
+
return keep;
|
|
18363
|
+
});
|
|
18364
|
+
if (conflictLines.length === 0) {
|
|
17874
18365
|
resolve({
|
|
17875
18366
|
content: [{
|
|
17876
18367
|
type: "text",
|
|
17877
|
-
text:
|
|
18368
|
+
text: "No conflict markers found"
|
|
17878
18369
|
}],
|
|
17879
18370
|
details: void 0
|
|
17880
18371
|
});
|
|
17881
18372
|
return;
|
|
17882
18373
|
}
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17887
|
-
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
|
|
18374
|
+
allLines = conflictLines;
|
|
18375
|
+
}
|
|
18376
|
+
const rangeSelection = (rawOutput ? selectExactReadRanges : selectReadRanges)(allLines, effectiveRanges);
|
|
18377
|
+
const startLine = rangeSelection ? rangeSelection.firstLine - 1 : effectiveOffset ? Math.max(0, effectiveOffset - 1) : 0;
|
|
18378
|
+
if (startLine >= allLines.length || effectiveRanges && rangeSelection?.selectedLines.length === 0) {
|
|
18379
|
+
resolve({
|
|
18380
|
+
content: [{
|
|
18381
|
+
type: "text",
|
|
18382
|
+
text: `Requested line ${startLine + 1} is beyond end of resource (${allLines.length} lines total).`
|
|
18383
|
+
}],
|
|
18384
|
+
details: void 0
|
|
18385
|
+
});
|
|
18386
|
+
return;
|
|
18387
|
+
}
|
|
18388
|
+
const endLine = effectiveLimit !== void 0 ? Math.min(startLine + effectiveLimit, allLines.length) : allLines.length;
|
|
18389
|
+
const selectedLines = rangeSelection?.selectedLines ?? allLines.slice(startLine, endLine);
|
|
18390
|
+
const selectedText = selectedLines.join("\n");
|
|
18391
|
+
if (selectedText.length > READ_TOOL_MAX_RESULT_CHARS || Buffer.byteLength(selectedText, "utf8") > 51200) {
|
|
18392
|
+
resolve(oversizedReadResult({
|
|
18393
|
+
blocked: true,
|
|
18394
|
+
path: `${resolvedArchive.archivePath}:${resolvedArchive.memberPath}`,
|
|
18395
|
+
chars: selectedText.length,
|
|
18396
|
+
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18397
|
+
startLine: startLine + 1,
|
|
18398
|
+
totalFileLines: allLines.length,
|
|
18399
|
+
firstLineBytes: Buffer.byteLength(selectedLines[0] ?? "", "utf8"),
|
|
18400
|
+
byteGuidance: false
|
|
18401
|
+
}));
|
|
18402
|
+
return;
|
|
18403
|
+
}
|
|
18404
|
+
resolve({
|
|
18405
|
+
content: [{
|
|
18406
|
+
type: "text",
|
|
18407
|
+
text: selectedText
|
|
18408
|
+
}],
|
|
18409
|
+
details: readSourceMeta(`${resolvedArchive.archivePath}:${resolvedArchive.memberPath}`)
|
|
18410
|
+
});
|
|
18411
|
+
return;
|
|
18412
|
+
}
|
|
18413
|
+
if (isInternalUrl(effectivePath)) {
|
|
18414
|
+
const sourcePath = effectivePath.startsWith("local://") ? await resolveInternalSelector(effectivePath, executionCwd) : effectivePath.startsWith("skill://") ? await resolveInternalPath(effectivePath, executionCwd, resourceCtx) : void 0;
|
|
18415
|
+
if (sourcePath) {
|
|
18416
|
+
const result = await createReadToolDefinition(executionCwd, options).execute(toolCallId, { path: appendReadSelectors(sourcePath, selector) }, signal, void 0, ctx);
|
|
18417
|
+
resolve(!effectiveRanges && !effectiveOffset && effectiveLimit === void 0 && !rawOutput ? withSkillBaseDirectory(effectivePath, result) : result);
|
|
18418
|
+
return;
|
|
18419
|
+
}
|
|
18420
|
+
const selected = await readInternalSelected(effectivePath, {
|
|
18421
|
+
...effectiveRanges === void 0 ? {} : { ranges: effectiveRanges },
|
|
18422
|
+
...effectiveOffset === void 0 ? {} : { offset: effectiveOffset },
|
|
18423
|
+
...effectiveLimit === void 0 ? {} : { limit: effectiveLimit },
|
|
18424
|
+
...rawOutput ? { raw: true } : {},
|
|
18425
|
+
...signal === void 0 ? {} : { signal }
|
|
18426
|
+
}, resourceCtx);
|
|
18427
|
+
if (aborted) return;
|
|
18428
|
+
if (selected !== void 0) {
|
|
17896
18429
|
resolve({
|
|
17897
18430
|
content: [{
|
|
17898
18431
|
type: "text",
|
|
17899
|
-
text:
|
|
18432
|
+
text: selected
|
|
17900
18433
|
}],
|
|
17901
18434
|
details: readSourceMeta(effectivePath)
|
|
17902
18435
|
});
|
|
17903
18436
|
return;
|
|
17904
18437
|
}
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
let inConflict = false;
|
|
17910
|
-
const conflictLines = allLines.filter((line) => {
|
|
17911
|
-
if (line.startsWith("<<<<<<<")) inConflict = true;
|
|
17912
|
-
const keep = inConflict;
|
|
17913
|
-
if (line.startsWith(">>>>>>>")) inConflict = false;
|
|
17914
|
-
return keep;
|
|
17915
|
-
});
|
|
17916
|
-
if (conflictLines.length === 0) {
|
|
17917
|
-
resolve({
|
|
17918
|
-
content: [{
|
|
17919
|
-
type: "text",
|
|
17920
|
-
text: "No conflict markers found"
|
|
17921
|
-
}],
|
|
17922
|
-
details: void 0
|
|
17923
|
-
});
|
|
17924
|
-
return;
|
|
17925
|
-
}
|
|
17926
|
-
allLines = conflictLines;
|
|
17927
|
-
}
|
|
17928
|
-
const rangeSelection = (rawOutput ? selectExactReadRanges : selectReadRanges)(allLines, effectiveRanges);
|
|
17929
|
-
const startLine = rangeSelection ? rangeSelection.firstLine - 1 : effectiveOffset ? Math.max(0, effectiveOffset - 1) : 0;
|
|
17930
|
-
if (startLine >= allLines.length || effectiveRanges && rangeSelection?.selectedLines.length === 0) {
|
|
17931
|
-
resolve({
|
|
17932
|
-
content: [{
|
|
17933
|
-
type: "text",
|
|
17934
|
-
text: `Requested line ${startLine + 1} is beyond end of resource (${allLines.length} lines total).`
|
|
17935
|
-
}],
|
|
17936
|
-
details: void 0
|
|
17937
|
-
});
|
|
17938
|
-
return;
|
|
17939
|
-
}
|
|
17940
|
-
const endLine = effectiveLimit !== void 0 ? Math.min(startLine + effectiveLimit, allLines.length) : allLines.length;
|
|
17941
|
-
const selectedLines = rangeSelection?.selectedLines ?? allLines.slice(startLine, endLine);
|
|
17942
|
-
const selectedText = selectedLines.join("\n");
|
|
17943
|
-
if (selectedText.length > READ_TOOL_MAX_RESULT_CHARS || Buffer.byteLength(selectedText, "utf8") > 51200) {
|
|
17944
|
-
resolve(oversizedReadResult({
|
|
17945
|
-
blocked: true,
|
|
17946
|
-
path: `${resolvedArchive.archivePath}:${resolvedArchive.memberPath}`,
|
|
17947
|
-
chars: selectedText.length,
|
|
17948
|
-
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
17949
|
-
startLine: startLine + 1,
|
|
17950
|
-
totalFileLines: allLines.length,
|
|
17951
|
-
firstLineBytes: Buffer.byteLength(selectedLines[0] ?? "", "utf8"),
|
|
17952
|
-
byteGuidance: false
|
|
17953
|
-
}));
|
|
17954
|
-
return;
|
|
17955
|
-
}
|
|
18438
|
+
const allLines = (await readInternalSelector(effectivePath, executionCwd, resourceCtx)).split("\n");
|
|
18439
|
+
const rangeSelection = (rawOutput ? selectExactReadRanges : selectReadRanges)(allLines, effectiveRanges);
|
|
18440
|
+
const startLine = rangeSelection ? rangeSelection.firstLine - 1 : effectiveOffset ? Math.max(0, effectiveOffset - 1) : 0;
|
|
18441
|
+
if (startLine >= allLines.length || effectiveRanges && rangeSelection?.selectedLines.length === 0) {
|
|
17956
18442
|
resolve({
|
|
17957
18443
|
content: [{
|
|
17958
18444
|
type: "text",
|
|
17959
|
-
text:
|
|
18445
|
+
text: `Requested line ${startLine + 1} is beyond end of resource (${allLines.length} lines total).`
|
|
17960
18446
|
}],
|
|
17961
|
-
details:
|
|
18447
|
+
details: void 0
|
|
17962
18448
|
});
|
|
17963
18449
|
return;
|
|
17964
18450
|
}
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
17977
|
-
|
|
17978
|
-
|
|
17979
|
-
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
|
|
17983
|
-
|
|
17984
|
-
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
|
|
17988
|
-
|
|
17989
|
-
|
|
17990
|
-
|
|
17991
|
-
|
|
17992
|
-
|
|
17993
|
-
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
|
|
17997
|
-
|
|
17998
|
-
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
}
|
|
18002
|
-
const endLine = effectiveLimit !== void 0 ? Math.min(startLine + effectiveLimit, allLines.length) : allLines.length;
|
|
18003
|
-
const selectedLines = rangeSelection?.selectedLines ?? allLines.slice(startLine, endLine);
|
|
18004
|
-
const selectedText = selectedLines.join("\n");
|
|
18005
|
-
if (selectedText.length > READ_TOOL_MAX_RESULT_CHARS || Buffer.byteLength(selectedText, "utf8") > 51200) {
|
|
18006
|
-
resolve(oversizedReadResult({
|
|
18007
|
-
blocked: true,
|
|
18008
|
-
path: effectivePath,
|
|
18009
|
-
chars: selectedText.length,
|
|
18010
|
-
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18011
|
-
startLine: startLine + 1,
|
|
18012
|
-
totalFileLines: allLines.length,
|
|
18013
|
-
firstLineBytes: Buffer.byteLength(selectedLines[0] ?? "", "utf8"),
|
|
18014
|
-
byteGuidance: false
|
|
18015
|
-
}));
|
|
18016
|
-
return;
|
|
18017
|
-
}
|
|
18451
|
+
const endLine = effectiveLimit !== void 0 ? Math.min(startLine + effectiveLimit, allLines.length) : allLines.length;
|
|
18452
|
+
const selectedLines = rangeSelection?.selectedLines ?? allLines.slice(startLine, endLine);
|
|
18453
|
+
const selectedText = selectedLines.join("\n");
|
|
18454
|
+
if (selectedText.length > READ_TOOL_MAX_RESULT_CHARS || Buffer.byteLength(selectedText, "utf8") > 51200) {
|
|
18455
|
+
resolve(oversizedReadResult({
|
|
18456
|
+
blocked: true,
|
|
18457
|
+
path: effectivePath,
|
|
18458
|
+
chars: selectedText.length,
|
|
18459
|
+
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18460
|
+
startLine: startLine + 1,
|
|
18461
|
+
totalFileLines: allLines.length,
|
|
18462
|
+
firstLineBytes: Buffer.byteLength(selectedLines[0] ?? "", "utf8"),
|
|
18463
|
+
byteGuidance: false
|
|
18464
|
+
}));
|
|
18465
|
+
return;
|
|
18466
|
+
}
|
|
18467
|
+
resolve({
|
|
18468
|
+
content: [{
|
|
18469
|
+
type: "text",
|
|
18470
|
+
text: selectedText
|
|
18471
|
+
}],
|
|
18472
|
+
details: readSourceMeta(effectivePath)
|
|
18473
|
+
});
|
|
18474
|
+
return;
|
|
18475
|
+
}
|
|
18476
|
+
if (isReadResourceSelector(effectivePath)) throw new Error(`Read resource selectors are not supported by this filesystem backend: ${path}`);
|
|
18477
|
+
const absolutePath = await resolveReadPathAsync(effectivePath, executionCwd);
|
|
18478
|
+
if (aborted) return;
|
|
18479
|
+
let content;
|
|
18480
|
+
let details;
|
|
18481
|
+
await ops.access(absolutePath);
|
|
18482
|
+
if (aborted) return;
|
|
18483
|
+
if (isDocumentPath(absolutePath) && !rawOutput && !isNotebookPath(absolutePath)) {
|
|
18484
|
+
const textContent = await extractDocumentMarkdown(await ops.readFile(absolutePath), absolutePath);
|
|
18485
|
+
const selection = applyReadLineSelection(textContent.split("\n"), effectiveRanges, effectiveOffset, effectiveLimit, rawOutput);
|
|
18486
|
+
if (selection.lines.length === 0) {
|
|
18018
18487
|
resolve({
|
|
18019
18488
|
content: [{
|
|
18020
18489
|
type: "text",
|
|
18021
|
-
text:
|
|
18490
|
+
text: `Requested line ${selection.firstLine} is beyond end of document (${textContent.split("\n").length} lines total).`
|
|
18022
18491
|
}],
|
|
18023
|
-
details:
|
|
18492
|
+
details: void 0
|
|
18024
18493
|
});
|
|
18025
18494
|
return;
|
|
18026
18495
|
}
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
content: [{
|
|
18040
|
-
type: "text",
|
|
18041
|
-
text: `Requested line ${selection.firstLine} is beyond end of document (${textContent.split("\n").length} lines total).`
|
|
18042
|
-
}],
|
|
18043
|
-
details: void 0
|
|
18044
|
-
});
|
|
18045
|
-
return;
|
|
18046
|
-
}
|
|
18047
|
-
const selectedText = selection.lines.join("\n");
|
|
18048
|
-
if (selectedText.length > READ_TOOL_MAX_RESULT_CHARS || Buffer.byteLength(selectedText, "utf8") > 51200) {
|
|
18049
|
-
resolve(oversizedReadResult({
|
|
18050
|
-
blocked: true,
|
|
18051
|
-
path: absolutePath,
|
|
18052
|
-
chars: selectedText.length,
|
|
18053
|
-
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18054
|
-
startLine: selection.firstLine,
|
|
18055
|
-
totalFileLines: textContent.split("\n").length,
|
|
18056
|
-
firstLineBytes: Buffer.byteLength(selection.lines[0] ?? "", "utf8"),
|
|
18057
|
-
byteGuidance: false
|
|
18058
|
-
}));
|
|
18059
|
-
return;
|
|
18060
|
-
}
|
|
18061
|
-
content = [{
|
|
18062
|
-
type: "text",
|
|
18063
|
-
text: selectedText
|
|
18064
|
-
}];
|
|
18065
|
-
resolve({
|
|
18066
|
-
content,
|
|
18067
|
-
details: readSourceMeta(absolutePath)
|
|
18068
|
-
});
|
|
18496
|
+
const selectedText = selection.lines.join("\n");
|
|
18497
|
+
if (selectedText.length > READ_TOOL_MAX_RESULT_CHARS || Buffer.byteLength(selectedText, "utf8") > 51200) {
|
|
18498
|
+
resolve(oversizedReadResult({
|
|
18499
|
+
blocked: true,
|
|
18500
|
+
path: absolutePath,
|
|
18501
|
+
chars: selectedText.length,
|
|
18502
|
+
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18503
|
+
startLine: selection.firstLine,
|
|
18504
|
+
totalFileLines: textContent.split("\n").length,
|
|
18505
|
+
firstLineBytes: Buffer.byteLength(selection.lines[0] ?? "", "utf8"),
|
|
18506
|
+
byteGuidance: false
|
|
18507
|
+
}));
|
|
18069
18508
|
return;
|
|
18070
18509
|
}
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
}
|
|
18510
|
+
content = [{
|
|
18511
|
+
type: "text",
|
|
18512
|
+
text: selectedText
|
|
18513
|
+
}];
|
|
18514
|
+
resolve({
|
|
18515
|
+
content,
|
|
18516
|
+
details: readSourceMeta(absolutePath)
|
|
18517
|
+
});
|
|
18518
|
+
return;
|
|
18519
|
+
}
|
|
18520
|
+
let tree;
|
|
18521
|
+
if (ops.stat && ops.listDir) {
|
|
18522
|
+
if ((await ops.stat(absolutePath))?.isDirectory) tree = await buildDirectoryTreeFromOperations(absolutePath, { listDir: ops.listDir }, {
|
|
18079
18523
|
maxDepth: 2,
|
|
18080
18524
|
perDirLimit: 12,
|
|
18081
18525
|
rootLimit: null
|
|
18082
18526
|
});
|
|
18083
|
-
|
|
18084
|
-
|
|
18085
|
-
|
|
18086
|
-
|
|
18087
|
-
|
|
18088
|
-
|
|
18089
|
-
|
|
18090
|
-
|
|
18091
|
-
|
|
18092
|
-
|
|
18093
|
-
|
|
18094
|
-
|
|
18095
|
-
|
|
18527
|
+
} else if (!options?.operations && (await stat$2(absolutePath)).isDirectory()) tree = await buildDirectoryTree(absolutePath, {
|
|
18528
|
+
maxDepth: 2,
|
|
18529
|
+
perDirLimit: 12,
|
|
18530
|
+
rootLimit: null
|
|
18531
|
+
});
|
|
18532
|
+
if (tree) {
|
|
18533
|
+
const allLines = tree.rendered.split("\n");
|
|
18534
|
+
const rangeSelection = (rawOutput ? selectExactReadRanges : selectReadRanges)(allLines, effectiveRanges);
|
|
18535
|
+
const startLine = rangeSelection ? rangeSelection.firstLine - 1 : effectiveOffset ? Math.max(0, effectiveOffset - 1) : 0;
|
|
18536
|
+
if (startLine >= allLines.length || effectiveRanges && rangeSelection?.selectedLines.length === 0) {
|
|
18537
|
+
resolve({
|
|
18538
|
+
content: [{
|
|
18539
|
+
type: "text",
|
|
18540
|
+
text: `Requested line ${startLine + 1} is beyond end of directory (${allLines.length} lines total).`
|
|
18541
|
+
}],
|
|
18542
|
+
details: void 0
|
|
18543
|
+
});
|
|
18544
|
+
return;
|
|
18545
|
+
}
|
|
18546
|
+
const endLine = effectiveLimit !== void 0 ? Math.min(startLine + effectiveLimit, allLines.length) : allLines.length;
|
|
18547
|
+
content = [{
|
|
18548
|
+
type: "text",
|
|
18549
|
+
text: (rangeSelection?.selectedLines ?? allLines.slice(startLine, endLine)).join("\n")
|
|
18550
|
+
}];
|
|
18551
|
+
const meta = {
|
|
18552
|
+
...readSourceMeta(absolutePath).meta,
|
|
18553
|
+
...tree.truncated ? { limits: {
|
|
18554
|
+
perDirLimit: 12,
|
|
18555
|
+
totalLines: tree.totalLines
|
|
18556
|
+
} } : {}
|
|
18557
|
+
};
|
|
18558
|
+
resolve({
|
|
18559
|
+
content,
|
|
18560
|
+
details: {
|
|
18561
|
+
isDirectory: true,
|
|
18562
|
+
resolvedPath: absolutePath,
|
|
18563
|
+
meta
|
|
18096
18564
|
}
|
|
18097
|
-
|
|
18565
|
+
});
|
|
18566
|
+
return;
|
|
18567
|
+
}
|
|
18568
|
+
const mimeType = ops.detectImageMimeType ? await ops.detectImageMimeType(absolutePath) : void 0;
|
|
18569
|
+
if (mimeType) {
|
|
18570
|
+
const buffer = await ops.readFile(absolutePath);
|
|
18571
|
+
const processed = await processImage(buffer, mimeType, {
|
|
18572
|
+
autoResizeImages,
|
|
18573
|
+
resizeOptions: ctx?.model?.inputLimits?.images?.resize ?? fallbackResizeOptions
|
|
18574
|
+
});
|
|
18575
|
+
if (!processed.ok) content = [{
|
|
18576
|
+
type: "text",
|
|
18577
|
+
text: `Read image file [${mimeType}]\n${processed.message}`
|
|
18578
|
+
}];
|
|
18579
|
+
else {
|
|
18580
|
+
let textNote = `Read image file [${processed.mimeType}]`;
|
|
18581
|
+
if (processed.hints.length > 0) textNote += `\n${processed.hints.join("\n")}`;
|
|
18098
18582
|
content = [{
|
|
18099
18583
|
type: "text",
|
|
18100
|
-
text:
|
|
18584
|
+
text: textNote
|
|
18585
|
+
}, {
|
|
18586
|
+
type: "image",
|
|
18587
|
+
data: processed.data,
|
|
18588
|
+
mimeType: processed.mimeType
|
|
18101
18589
|
}];
|
|
18102
|
-
|
|
18103
|
-
...readSourceMeta(absolutePath)
|
|
18104
|
-
|
|
18105
|
-
perDirLimit: 12,
|
|
18106
|
-
totalLines: tree.totalLines
|
|
18107
|
-
} } : {}
|
|
18590
|
+
if (ctx?.model && !ctx.model.input.includes("image")) details = {
|
|
18591
|
+
...readSourceMeta(absolutePath),
|
|
18592
|
+
imageUnsupportedByModel: ctx.model.id
|
|
18108
18593
|
};
|
|
18109
|
-
|
|
18110
|
-
|
|
18111
|
-
|
|
18112
|
-
|
|
18113
|
-
|
|
18114
|
-
|
|
18594
|
+
}
|
|
18595
|
+
} else {
|
|
18596
|
+
const offsetStartLine = effectiveOffset ? Math.max(0, effectiveOffset - 1) : 0;
|
|
18597
|
+
const plan = effectiveRanges?.length ? {
|
|
18598
|
+
ranges: effectiveRanges,
|
|
18599
|
+
exact: rawOutput === true
|
|
18600
|
+
} : { firstLine: offsetStartLine + 1 };
|
|
18601
|
+
const notebookView = isNotebookPath(absolutePath) && !rawOutput;
|
|
18602
|
+
let selection;
|
|
18603
|
+
if (conflictsOnly || notebookView) {
|
|
18604
|
+
const buffer = await ops.readFile(absolutePath);
|
|
18605
|
+
const textContent = notebookView ? await readEditableNotebookText(absolutePath, effectivePath) : buffer.toString("utf-8");
|
|
18606
|
+
const lineTextContent = rawOutput ? textContent : textContent.replace(/\r\n/g, "\n");
|
|
18607
|
+
const sourceLines = lineTextContent.split("\n");
|
|
18608
|
+
let allLines = rawOutput || !lineTextContent.endsWith("\n") ? sourceLines : sourceLines.slice(0, -1);
|
|
18609
|
+
if (conflictsOnly) {
|
|
18610
|
+
registerConflictBlocks(executionCwd, absolutePath, parseConflictBytes(absolutePath, buffer));
|
|
18611
|
+
const conflictLines = [];
|
|
18612
|
+
let inConflict = false;
|
|
18613
|
+
for (const line of allLines) {
|
|
18614
|
+
if (line.startsWith("<<<<<<<")) inConflict = true;
|
|
18615
|
+
if (inConflict) conflictLines.push(line);
|
|
18616
|
+
if (line.startsWith(">>>>>>>")) inConflict = false;
|
|
18115
18617
|
}
|
|
18618
|
+
if (conflictLines.length > 0) allLines = conflictLines;
|
|
18619
|
+
else {
|
|
18620
|
+
signal?.removeEventListener("abort", onAbort);
|
|
18621
|
+
resolve({
|
|
18622
|
+
content: [{
|
|
18623
|
+
type: "text",
|
|
18624
|
+
text: "No conflict markers found"
|
|
18625
|
+
}],
|
|
18626
|
+
details: void 0
|
|
18627
|
+
});
|
|
18628
|
+
return;
|
|
18629
|
+
}
|
|
18630
|
+
}
|
|
18631
|
+
selection = selectReadLinesFromList(allLines, plan, READ_TOOL_MAX_RESULT_CHARS);
|
|
18632
|
+
} else selection = await selectReadLinesFromChunks(ops.createReadStream?.(absolutePath, { signal }) ?? readWholeFile(ops, absolutePath), plan, {
|
|
18633
|
+
raw: rawOutput === true,
|
|
18634
|
+
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18635
|
+
signal
|
|
18636
|
+
});
|
|
18637
|
+
const totalFileLines = selection.totalLines;
|
|
18638
|
+
const startLine = "ranges" in plan ? selection.firstLineNumber - 1 : offsetStartLine;
|
|
18639
|
+
const startLineDisplay = startLine + 1;
|
|
18640
|
+
if (startLine >= totalFileLines || "ranges" in plan && selection.count === 0) {
|
|
18641
|
+
resolve({
|
|
18642
|
+
content: [{
|
|
18643
|
+
type: "text",
|
|
18644
|
+
text: `Requested line ${effectiveRanges?.[0]?.start ?? startLineDisplay} is beyond end of file (${totalFileLines} lines total). Use ${effectivePath}:${Math.max(1, totalFileLines)} to read the final line.`
|
|
18645
|
+
}],
|
|
18646
|
+
details: void 0
|
|
18116
18647
|
});
|
|
18117
18648
|
return;
|
|
18118
18649
|
}
|
|
18119
|
-
const
|
|
18120
|
-
if (
|
|
18121
|
-
const
|
|
18122
|
-
const
|
|
18123
|
-
|
|
18124
|
-
|
|
18125
|
-
|
|
18126
|
-
|
|
18650
|
+
const selectedLines = selection.lines;
|
|
18651
|
+
if (selection.chars > READ_TOOL_MAX_RESULT_CHARS) {
|
|
18652
|
+
const firstLineBytes = selection.firstLineBytes;
|
|
18653
|
+
const byteGuidance = selection.countBeforeTrailingEmpty <= 1 || firstLineBytes > 51200;
|
|
18654
|
+
const oversizedRead = {
|
|
18655
|
+
blocked: true,
|
|
18656
|
+
path: absolutePath,
|
|
18657
|
+
chars: selection.chars,
|
|
18658
|
+
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18659
|
+
startLine: startLineDisplay,
|
|
18660
|
+
totalFileLines,
|
|
18661
|
+
firstLineBytes,
|
|
18662
|
+
byteGuidance
|
|
18663
|
+
};
|
|
18664
|
+
details = {
|
|
18665
|
+
oversizedRead,
|
|
18666
|
+
meta: readSourceMeta(absolutePath).meta
|
|
18667
|
+
};
|
|
18668
|
+
content = [{
|
|
18127
18669
|
type: "text",
|
|
18128
|
-
text:
|
|
18670
|
+
text: buildOversizedReadMessage(oversizedRead)
|
|
18129
18671
|
}];
|
|
18130
|
-
else {
|
|
18131
|
-
let textNote = `Read image file [${processed.mimeType}]`;
|
|
18132
|
-
if (processed.hints.length > 0) textNote += `\n${processed.hints.join("\n")}`;
|
|
18133
|
-
content = [{
|
|
18134
|
-
type: "text",
|
|
18135
|
-
text: textNote
|
|
18136
|
-
}, {
|
|
18137
|
-
type: "image",
|
|
18138
|
-
data: processed.data,
|
|
18139
|
-
mimeType: processed.mimeType
|
|
18140
|
-
}];
|
|
18141
|
-
if (ctx?.model && !ctx.model.input.includes("image")) details = {
|
|
18142
|
-
...readSourceMeta(absolutePath),
|
|
18143
|
-
imageUnsupportedByModel: ctx.model.id
|
|
18144
|
-
};
|
|
18145
|
-
}
|
|
18146
18672
|
} else {
|
|
18147
|
-
const
|
|
18148
|
-
const
|
|
18149
|
-
|
|
18150
|
-
|
|
18151
|
-
|
|
18152
|
-
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18157
|
-
|
|
18158
|
-
|
|
18159
|
-
|
|
18160
|
-
if (conflictsOnly) {
|
|
18161
|
-
registerConflictBlocks(executionCwd, absolutePath, parseConflictBytes(absolutePath, buffer));
|
|
18162
|
-
const conflictLines = [];
|
|
18163
|
-
let inConflict = false;
|
|
18164
|
-
for (const line of allLines) {
|
|
18165
|
-
if (line.startsWith("<<<<<<<")) inConflict = true;
|
|
18166
|
-
if (inConflict) conflictLines.push(line);
|
|
18167
|
-
if (line.startsWith(">>>>>>>")) inConflict = false;
|
|
18168
|
-
}
|
|
18169
|
-
if (conflictLines.length > 0) allLines = conflictLines;
|
|
18170
|
-
else {
|
|
18171
|
-
signal?.removeEventListener("abort", onAbort);
|
|
18172
|
-
resolve({
|
|
18173
|
-
content: [{
|
|
18174
|
-
type: "text",
|
|
18175
|
-
text: "No conflict markers found"
|
|
18176
|
-
}],
|
|
18177
|
-
details: void 0
|
|
18178
|
-
});
|
|
18179
|
-
return;
|
|
18673
|
+
const truncation = truncateHead(selectedLines.join("\n"));
|
|
18674
|
+
const shownLines = truncation.truncated ? truncation.outputLines : selectedLines.length;
|
|
18675
|
+
const shownLineNumbers = "ranges" in plan ? selection.lineNumbers.slice(0, shownLines) : void 0;
|
|
18676
|
+
const lastShownLine = shownLineNumbers?.at(-1) ?? startLine + shownLines;
|
|
18677
|
+
let outputText = shownLineNumbers && !rawOutput ? formatSelectedLines(selectedLines.slice(0, shownLines), shownLineNumbers, totalFileLines) : truncation.content;
|
|
18678
|
+
if (truncation.firstLineExceedsLimit) {
|
|
18679
|
+
outputText = `[Line ${startLineDisplay} is ${formatSize(selection.firstLineBytes)}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${effectivePath} | head -c ${DEFAULT_MAX_BYTES}]`;
|
|
18680
|
+
details = {
|
|
18681
|
+
truncation,
|
|
18682
|
+
meta: {
|
|
18683
|
+
source: absolutePath,
|
|
18684
|
+
sourcePath: absolutePath,
|
|
18685
|
+
truncation
|
|
18180
18686
|
}
|
|
18181
|
-
}
|
|
18182
|
-
selection = selectReadLinesFromList(allLines, plan, READ_TOOL_MAX_RESULT_CHARS);
|
|
18183
|
-
} else selection = await selectReadLinesFromChunks(ops.createReadStream?.(absolutePath, { signal }) ?? readWholeFile(ops, absolutePath), plan, {
|
|
18184
|
-
raw: rawOutput === true,
|
|
18185
|
-
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18186
|
-
signal
|
|
18187
|
-
});
|
|
18188
|
-
const totalFileLines = selection.totalLines;
|
|
18189
|
-
const startLine = "ranges" in plan ? selection.firstLineNumber - 1 : offsetStartLine;
|
|
18190
|
-
const startLineDisplay = startLine + 1;
|
|
18191
|
-
if (startLine >= totalFileLines || "ranges" in plan && selection.count === 0) {
|
|
18192
|
-
resolve({
|
|
18193
|
-
content: [{
|
|
18194
|
-
type: "text",
|
|
18195
|
-
text: `Requested line ${effectiveRanges?.[0]?.start ?? startLineDisplay} is beyond end of file (${totalFileLines} lines total). Use ${effectivePath}:${Math.max(1, totalFileLines)} to read the final line.`
|
|
18196
|
-
}],
|
|
18197
|
-
details: void 0
|
|
18198
|
-
});
|
|
18199
|
-
return;
|
|
18200
|
-
}
|
|
18201
|
-
const selectedLines = selection.lines;
|
|
18202
|
-
if (selection.chars > READ_TOOL_MAX_RESULT_CHARS) {
|
|
18203
|
-
const firstLineBytes = selection.firstLineBytes;
|
|
18204
|
-
const byteGuidance = selection.countBeforeTrailingEmpty <= 1 || firstLineBytes > 51200;
|
|
18205
|
-
const oversizedRead = {
|
|
18206
|
-
blocked: true,
|
|
18207
|
-
path: absolutePath,
|
|
18208
|
-
chars: selection.chars,
|
|
18209
|
-
maxChars: READ_TOOL_MAX_RESULT_CHARS,
|
|
18210
|
-
startLine: startLineDisplay,
|
|
18211
|
-
totalFileLines,
|
|
18212
|
-
firstLineBytes,
|
|
18213
|
-
byteGuidance
|
|
18214
18687
|
};
|
|
18688
|
+
} else if (truncation.truncated) {
|
|
18689
|
+
const nextOffset = lastShownLine + 1;
|
|
18690
|
+
outputText += truncation.truncatedBy === "lines" ? `\n\n[Showing lines ${startLineDisplay}-${lastShownLine} of ${totalFileLines}. Continue with path selector :${nextOffset}.]` : `\n\n[Showing lines ${startLineDisplay}-${lastShownLine} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Continue with path selector :${nextOffset}.]`;
|
|
18215
18691
|
details = {
|
|
18216
|
-
|
|
18217
|
-
meta:
|
|
18692
|
+
truncation,
|
|
18693
|
+
meta: {
|
|
18694
|
+
source: absolutePath,
|
|
18695
|
+
sourcePath: absolutePath,
|
|
18696
|
+
truncation
|
|
18697
|
+
}
|
|
18218
18698
|
};
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
18222
|
-
}];
|
|
18223
|
-
} else {
|
|
18224
|
-
const truncation = truncateHead(selectedLines.join("\n"));
|
|
18225
|
-
const shownLines = truncation.truncated ? truncation.outputLines : selectedLines.length;
|
|
18226
|
-
const shownLineNumbers = "ranges" in plan ? selection.lineNumbers.slice(0, shownLines) : void 0;
|
|
18227
|
-
const lastShownLine = shownLineNumbers?.at(-1) ?? startLine + shownLines;
|
|
18228
|
-
let outputText = shownLineNumbers && !rawOutput ? formatSelectedLines(selectedLines.slice(0, shownLines), shownLineNumbers, totalFileLines) : truncation.content;
|
|
18229
|
-
if (truncation.firstLineExceedsLimit) {
|
|
18230
|
-
outputText = `[Line ${startLineDisplay} is ${formatSize(selection.firstLineBytes)}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${effectivePath} | head -c ${DEFAULT_MAX_BYTES}]`;
|
|
18231
|
-
details = {
|
|
18232
|
-
truncation,
|
|
18233
|
-
meta: {
|
|
18234
|
-
source: absolutePath,
|
|
18235
|
-
sourcePath: absolutePath,
|
|
18236
|
-
truncation
|
|
18237
|
-
}
|
|
18238
|
-
};
|
|
18239
|
-
} else if (truncation.truncated) {
|
|
18240
|
-
const nextOffset = lastShownLine + 1;
|
|
18241
|
-
outputText += truncation.truncatedBy === "lines" ? `\n\n[Showing lines ${startLineDisplay}-${lastShownLine} of ${totalFileLines}. Continue with path selector :${nextOffset}.]` : `\n\n[Showing lines ${startLineDisplay}-${lastShownLine} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Continue with path selector :${nextOffset}.]`;
|
|
18242
|
-
details = {
|
|
18243
|
-
truncation,
|
|
18244
|
-
meta: {
|
|
18245
|
-
source: absolutePath,
|
|
18246
|
-
sourcePath: absolutePath,
|
|
18247
|
-
truncation
|
|
18248
|
-
}
|
|
18249
|
-
};
|
|
18250
|
-
} else if (!rawOutput && lastShownLine < totalFileLines) {
|
|
18251
|
-
const remaining = totalFileLines - lastShownLine;
|
|
18252
|
-
outputText += `\n\n[${remaining} more lines in file. Continue with path selector :${lastShownLine + 1}.]`;
|
|
18253
|
-
}
|
|
18254
|
-
content = [{
|
|
18255
|
-
type: "text",
|
|
18256
|
-
text: outputText
|
|
18257
|
-
}];
|
|
18699
|
+
} else if (!rawOutput && lastShownLine < totalFileLines) {
|
|
18700
|
+
const remaining = totalFileLines - lastShownLine;
|
|
18701
|
+
outputText += `\n\n[${remaining} more lines in file. Continue with path selector :${lastShownLine + 1}.]`;
|
|
18258
18702
|
}
|
|
18703
|
+
content = [{
|
|
18704
|
+
type: "text",
|
|
18705
|
+
text: outputText
|
|
18706
|
+
}];
|
|
18259
18707
|
}
|
|
18260
|
-
if (aborted) return;
|
|
18261
|
-
signal?.removeEventListener("abort", onAbort);
|
|
18262
|
-
resolve({
|
|
18263
|
-
content,
|
|
18264
|
-
details: details ?? readSourceMeta(absolutePath)
|
|
18265
|
-
});
|
|
18266
|
-
} catch (error) {
|
|
18267
|
-
signal?.removeEventListener("abort", onAbort);
|
|
18268
|
-
if (!aborted) reject(error);
|
|
18269
18708
|
}
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18709
|
+
if (aborted) return;
|
|
18710
|
+
signal?.removeEventListener("abort", onAbort);
|
|
18711
|
+
resolve({
|
|
18712
|
+
content,
|
|
18713
|
+
details: details ?? readSourceMeta(absolutePath)
|
|
18714
|
+
});
|
|
18715
|
+
} catch (error) {
|
|
18716
|
+
signal?.removeEventListener("abort", onAbort);
|
|
18717
|
+
if (!aborted) reject(error);
|
|
18718
|
+
}
|
|
18719
|
+
})();
|
|
18720
|
+
}).then((result) => result.details?.oversizedRead?.blocked ? {
|
|
18721
|
+
...result,
|
|
18722
|
+
isError: true
|
|
18723
|
+
} : {
|
|
18724
|
+
...result,
|
|
18725
|
+
structuredContent: toReadOutput(result.content)
|
|
18726
|
+
});
|
|
18727
|
+
};
|
|
18728
|
+
return withBuiltinToolBlockRenderers({
|
|
18729
|
+
name: "read",
|
|
18730
|
+
label: "read",
|
|
18731
|
+
description: "Read files, directories, archives, SQLite databases, internal resources (including history:// for past sessions), images, documents, and URLs through one path string.",
|
|
18732
|
+
promptSnippet: readToolSystemPromptContribution.snippet,
|
|
18733
|
+
promptGuidelines: [...readToolSystemPromptContribution.guidelines],
|
|
18734
|
+
constrainedSampling: {
|
|
18735
|
+
type: "json_schema",
|
|
18736
|
+
strict: "prefer"
|
|
18737
|
+
},
|
|
18738
|
+
parameters: readSchema,
|
|
18739
|
+
outputSchema: readOutputSchema,
|
|
18740
|
+
maxResultSizeChars: 1e400,
|
|
18741
|
+
prepareArguments: (args) => prepareHistoryAwareInput(args, "read", "path"),
|
|
18742
|
+
async execute(toolCallId, input, signal, _onUpdate, ctx) {
|
|
18743
|
+
if (input.action !== void 0) return asReadResult(await waitForHistoryTask(options?.historyTasks?.(), input, "read", signal));
|
|
18744
|
+
const { path, wait } = input;
|
|
18745
|
+
const policy = validateHistoryWait(wait);
|
|
18746
|
+
const registry = namesHistoryUrl(path) ? options?.historyTasks?.() : void 0;
|
|
18747
|
+
if (!registry) return readPath(toolCallId, path, signal, ctx);
|
|
18748
|
+
return asReadResult(await registry.run({
|
|
18749
|
+
kind: "read",
|
|
18750
|
+
subject: path,
|
|
18751
|
+
wait: policy,
|
|
18752
|
+
signal,
|
|
18753
|
+
run: (callSignal) => readPath(toolCallId, path, callSignal, ctx)
|
|
18754
|
+
}));
|
|
18278
18755
|
},
|
|
18279
18756
|
renderCall(args, theme, context) {
|
|
18280
18757
|
const text = context.lastComponent ?? new Text("", 0, 0);
|
|
@@ -18787,18 +19264,30 @@ function buildSearchDetails(base, text, cwd, scopePath, missingPaths = []) {
|
|
|
18787
19264
|
};
|
|
18788
19265
|
}
|
|
18789
19266
|
// dist/core/tools/search.js
|
|
18790
|
-
const
|
|
19267
|
+
const searchBaseSchema = Type$1.Object({
|
|
18791
19268
|
pattern: Type$1.String({ description: "Regex pattern. Whitespace-only patterns are rejected; otherwise the pattern is preserved verbatim." }),
|
|
18792
19269
|
paths: Type$1.Optional(Type$1.Union([Type$1.String({ description: "File, directory, glob, internal URL (skill://, local://, artifact://, conflict://, history://), or <file>:<lines> selector to search. Omitted or empty searches the workspace root." }), Type$1.Array(Type$1.String({ description: "File, directory, glob, internal URL, or <file>:<lines> selector to search." }))])),
|
|
18793
19270
|
i: Type$1.Optional(Type$1.Boolean({ description: "Case-insensitive search." })),
|
|
18794
19271
|
gitignore: Type$1.Optional(Type$1.Boolean({ description: "Respect gitignore." })),
|
|
18795
19272
|
case: Type$1.Optional(Type$1.Boolean({ description: "Set false for case-insensitive search (oh-my-pi compatibility)." })),
|
|
18796
|
-
skip: Type$1.Optional(Type$1.Union([Type$1.Number({ description: "Files to skip before collecting results; use to paginate when the previous call hit the file limit." }), Type$1.Null()]))
|
|
19273
|
+
skip: Type$1.Optional(Type$1.Union([Type$1.Number({ description: "Files to skip before collecting results; use to paginate when the previous call hit the file limit." }), Type$1.Null()])),
|
|
19274
|
+
wait: Type$1.Optional(historyWaitSchema)
|
|
18797
19275
|
}, { additionalProperties: false });
|
|
19276
|
+
const searchSchema = Type$1.Unsafe({
|
|
19277
|
+
...searchBaseSchema,
|
|
19278
|
+
properties: {
|
|
19279
|
+
...searchBaseSchema.properties,
|
|
19280
|
+
...historyWaitActionProperties
|
|
19281
|
+
},
|
|
19282
|
+
required: []
|
|
19283
|
+
});
|
|
18798
19284
|
const searchToolSystemPromptContribution = Object.freeze({
|
|
18799
19285
|
snippet: "Search file contents with regex patterns.",
|
|
18800
|
-
guidelines: Object.freeze([])
|
|
19286
|
+
guidelines: Object.freeze([HISTORY_TASK_GUIDELINE])
|
|
18801
19287
|
});
|
|
19288
|
+
function asSearchResult(result) {
|
|
19289
|
+
return result;
|
|
19290
|
+
}
|
|
18802
19291
|
/** An existing path is used exactly, so `app/[id]/page.tsx` is that file, not the pattern `app/[id]` (#5177). */
|
|
18803
19292
|
async function splitSearchPath(value, cwd) {
|
|
18804
19293
|
return await pathExists(await resolveToCwdAsync(normalizePathLikeInput(value), cwd)) ? literalPathLike(value) : splitPathLikeGlob(value);
|
|
@@ -19175,287 +19664,303 @@ function createSearchToolDefinition(cwd, options) {
|
|
|
19175
19664
|
...options,
|
|
19176
19665
|
nativeCache: false
|
|
19177
19666
|
});
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
|
|
19200
|
-
|
|
19201
|
-
|
|
19202
|
-
|
|
19667
|
+
const runSearch = async (toolCallId, params, signal, onUpdate, ctx) => {
|
|
19668
|
+
const resourceCtx = ctx;
|
|
19669
|
+
const executionCwd = ctx?.cwd || cwd;
|
|
19670
|
+
if (params.pattern.trim() === "") throw new Error("Pattern must not be empty");
|
|
19671
|
+
const targets = await normalizeSearchTargets(params.paths, executionCwd);
|
|
19672
|
+
const ignoreCase = params.i === true || params.case === false;
|
|
19673
|
+
const contextBefore = options?.contextBefore ?? 1;
|
|
19674
|
+
const contextAfter = options?.contextAfter ?? 3;
|
|
19675
|
+
const searchContext = Math.max(contextBefore, contextAfter);
|
|
19676
|
+
const isSingleFileSearch = targets.length === 1 && await stat(await resolveToCwdAsync(targets[0].path, executionCwd)).then((stat) => stat.isFile()).catch(() => false);
|
|
19677
|
+
const limit = isSingleFileSearch ? SINGLE_FILE_MATCHES : DEFAULT_LIMIT;
|
|
19678
|
+
let skip = normalizeSkip(params.skip);
|
|
19679
|
+
const singleFileSkipIgnored = skip > 0 && isSingleFileSearch;
|
|
19680
|
+
if (singleFileSkipIgnored) skip = 0;
|
|
19681
|
+
for (const target of targets) {
|
|
19682
|
+
if (target.archive || target.sqlite || target.internal) continue;
|
|
19683
|
+
if (target.lineRanges && !await stat(await resolveToCwdAsync(target.path, executionCwd)).then((stat) => stat.isFile()).catch(() => false)) throw new Error("Line-range search selectors are only supported for single files");
|
|
19684
|
+
}
|
|
19685
|
+
const results = [];
|
|
19686
|
+
const groups = [];
|
|
19687
|
+
const skippedMissingPaths = [];
|
|
19688
|
+
const scopePath = targets.map((target) => target.path).join(", ") || ".";
|
|
19689
|
+
let pageFullWithMore = false;
|
|
19690
|
+
let internalSearchCapped = false;
|
|
19691
|
+
let remaining = limit;
|
|
19692
|
+
const targetHasMatch = async (target) => {
|
|
19693
|
+
if (target.archive || target.sqlite || target.internal) {
|
|
19694
|
+
const archive = target.archive ? await resolveArchiveSelector(target.archive, executionCwd) : void 0;
|
|
19695
|
+
return groupSearchOutput(filterTargetLineRanges(archive ? await searchArchiveSelector(archive, params.pattern, ignoreCase, false, contextBefore, contextAfter) : target.sqlite ? await searchSqliteSelector(target.sqlite, params.pattern, ignoreCase, contextBefore, contextAfter) : await searchInternalSelector(target.internal, executionCwd, params.pattern, ignoreCase, false, resourceCtx, contextBefore, contextAfter, {
|
|
19696
|
+
...target.lineRanges === void 0 ? {} : { ranges: target.lineRanges },
|
|
19697
|
+
...signal === void 0 ? {} : { signal }
|
|
19698
|
+
}, {
|
|
19699
|
+
first: 0,
|
|
19700
|
+
end: 0
|
|
19701
|
+
}), target, contextBefore, contextAfter)).length > 0;
|
|
19203
19702
|
}
|
|
19204
|
-
const
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
}), target, contextBefore, contextAfter)).length > 0;
|
|
19221
|
-
}
|
|
19222
|
-
const ranged = await searchFileLineRanges(target, executionCwd, params.pattern, ignoreCase, contextBefore, contextAfter);
|
|
19223
|
-
if (ranged !== void 0) return groupSearchOutput(ranged).length > 0;
|
|
19224
|
-
return (await grepDefinition.execute(toolCallId, {
|
|
19225
|
-
pattern: params.pattern,
|
|
19226
|
-
path: target.path,
|
|
19227
|
-
glob: target.glob,
|
|
19228
|
-
ignoreCase,
|
|
19229
|
-
literal: false,
|
|
19230
|
-
context: 0,
|
|
19231
|
-
limit: 1,
|
|
19232
|
-
gitignore: params.gitignore
|
|
19233
|
-
}, signal, void 0, ctx)).content.some((item) => item.type === "text" && item.text && item.text !== "No matches found");
|
|
19234
|
-
};
|
|
19235
|
-
for (const target of targets) {
|
|
19236
|
-
if (skip === 0 && remaining <= 0) {
|
|
19237
|
-
if (!target.archive && !target.sqlite && !target.internal && targets.length > 1 && await stat(await resolveToCwdAsync(target.path, executionCwd)).then(() => false).catch(() => true)) {
|
|
19238
|
-
skippedMissingPaths.push(target.path);
|
|
19239
|
-
continue;
|
|
19240
|
-
}
|
|
19241
|
-
if (await targetHasMatch(target)) {
|
|
19242
|
-
pageFullWithMore = true;
|
|
19243
|
-
break;
|
|
19244
|
-
}
|
|
19245
|
-
continue;
|
|
19246
|
-
}
|
|
19247
|
-
if (target.archive || target.sqlite || target.internal) {
|
|
19248
|
-
const archive = target.archive ? await resolveArchiveSelector(target.archive, executionCwd) : void 0;
|
|
19249
|
-
let text = archive ? await searchArchiveSelector(archive, params.pattern, ignoreCase, false, contextBefore, contextAfter) : target.sqlite ? await searchSqliteSelector(target.sqlite, params.pattern, ignoreCase, contextBefore, contextAfter) : await searchInternalSelector(target.internal, executionCwd, params.pattern, ignoreCase, false, resourceCtx, contextBefore, contextAfter, {
|
|
19250
|
-
...target.lineRanges === void 0 ? {} : { ranges: target.lineRanges },
|
|
19251
|
-
...signal === void 0 ? {} : { signal }
|
|
19252
|
-
}, {
|
|
19253
|
-
first: Math.max(0, skip - groups.length),
|
|
19254
|
-
end: skip > 0 ? skip + limit - groups.length : remaining
|
|
19255
|
-
});
|
|
19256
|
-
if (archive && target.archive) text = text.split(archive.archivePath).join(target.archive.archivePath);
|
|
19257
|
-
if (target.sqlite) text = text.split(target.sqlite.databasePath).join(target.path.match(/^(.+?\.(?:sqlite3?|db3?))/i)?.[1] ?? target.sqlite.databasePath);
|
|
19258
|
-
text = text || "No matches found";
|
|
19259
|
-
text = filterTargetLineRanges(text, target, contextBefore, contextAfter);
|
|
19260
|
-
const outputGroups = groupSearchOutput(text);
|
|
19261
|
-
if (skip > 0) groups.push(...outputGroups.map((group) => ({
|
|
19262
|
-
targetPath: target.path,
|
|
19263
|
-
virtual: isVirtualSearchTarget(target),
|
|
19264
|
-
group
|
|
19265
|
-
})));
|
|
19266
|
-
else if (outputGroups.length > 0) {
|
|
19267
|
-
const hadMore = outputGroups.length > remaining;
|
|
19268
|
-
text = formatSearchGroups(outputGroups, remaining);
|
|
19269
|
-
if (hadMore) {
|
|
19270
|
-
text += `\n\n${continuationHint(limit, skip)}`;
|
|
19271
|
-
pageFullWithMore = true;
|
|
19272
|
-
}
|
|
19273
|
-
remaining -= Math.min(remaining, outputGroups.length);
|
|
19274
|
-
} else if (text && text !== "No matches found") remaining--;
|
|
19275
|
-
else text = "No matches found";
|
|
19276
|
-
if (skip === 0) results.push({
|
|
19277
|
-
content: [{
|
|
19278
|
-
type: "text",
|
|
19279
|
-
text
|
|
19280
|
-
}],
|
|
19281
|
-
details: void 0
|
|
19282
|
-
});
|
|
19283
|
-
continue;
|
|
19284
|
-
}
|
|
19285
|
-
if (targets.length > 1 && await stat(await resolveToCwdAsync(target.path, executionCwd)).then(() => false).catch(() => true)) {
|
|
19703
|
+
const ranged = await searchFileLineRanges(target, executionCwd, params.pattern, ignoreCase, contextBefore, contextAfter);
|
|
19704
|
+
if (ranged !== void 0) return groupSearchOutput(ranged).length > 0;
|
|
19705
|
+
return (await grepDefinition.execute(toolCallId, {
|
|
19706
|
+
pattern: params.pattern,
|
|
19707
|
+
path: target.path,
|
|
19708
|
+
glob: target.glob,
|
|
19709
|
+
ignoreCase,
|
|
19710
|
+
literal: false,
|
|
19711
|
+
context: 0,
|
|
19712
|
+
limit: 1,
|
|
19713
|
+
gitignore: params.gitignore
|
|
19714
|
+
}, signal, void 0, ctx)).content.some((item) => item.type === "text" && item.text && item.text !== "No matches found");
|
|
19715
|
+
};
|
|
19716
|
+
for (const target of targets) {
|
|
19717
|
+
if (skip === 0 && remaining <= 0) {
|
|
19718
|
+
if (!target.archive && !target.sqlite && !target.internal && targets.length > 1 && await stat(await resolveToCwdAsync(target.path, executionCwd)).then(() => false).catch(() => true)) {
|
|
19286
19719
|
skippedMissingPaths.push(target.path);
|
|
19287
|
-
results.push({
|
|
19288
|
-
content: [{
|
|
19289
|
-
type: "text",
|
|
19290
|
-
text: "No matches found"
|
|
19291
|
-
}],
|
|
19292
|
-
details: void 0
|
|
19293
|
-
});
|
|
19294
19720
|
continue;
|
|
19295
19721
|
}
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
const result = {
|
|
19300
|
-
content: [{
|
|
19301
|
-
type: "text",
|
|
19302
|
-
text
|
|
19303
|
-
}],
|
|
19304
|
-
details: void 0
|
|
19305
|
-
};
|
|
19306
|
-
results.push(result);
|
|
19307
|
-
const outputGroups = groupSearchOutput(text);
|
|
19308
|
-
if (skip > 0) groups.push(...outputGroups.map((group) => ({
|
|
19309
|
-
targetPath: target.path,
|
|
19310
|
-
virtual: false,
|
|
19311
|
-
group
|
|
19312
|
-
})));
|
|
19313
|
-
else if (!isSingleFileSearch && outputGroups.length > 0) {
|
|
19314
|
-
const hadMore = outputGroups.length > remaining;
|
|
19315
|
-
text = formatSearchGroups(outputGroups, remaining);
|
|
19316
|
-
if (hadMore) {
|
|
19317
|
-
result.details = fileLimitDetails(limit);
|
|
19318
|
-
pageFullWithMore = true;
|
|
19319
|
-
}
|
|
19320
|
-
remaining -= Math.min(remaining, outputGroups.length);
|
|
19321
|
-
result.content = [{
|
|
19322
|
-
type: "text",
|
|
19323
|
-
text
|
|
19324
|
-
}];
|
|
19325
|
-
}
|
|
19326
|
-
continue;
|
|
19722
|
+
if (await targetHasMatch(target)) {
|
|
19723
|
+
pageFullWithMore = true;
|
|
19724
|
+
break;
|
|
19327
19725
|
}
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19337
|
-
|
|
19338
|
-
}
|
|
19339
|
-
|
|
19340
|
-
if (
|
|
19341
|
-
|
|
19342
|
-
text =
|
|
19343
|
-
if (text !== "No matches found") text = applyDefaultSearchContext(text, contextBefore, contextAfter) || "No matches found";
|
|
19726
|
+
continue;
|
|
19727
|
+
}
|
|
19728
|
+
if (target.archive || target.sqlite || target.internal) {
|
|
19729
|
+
const archive = target.archive ? await resolveArchiveSelector(target.archive, executionCwd) : void 0;
|
|
19730
|
+
let text = archive ? await searchArchiveSelector(archive, params.pattern, ignoreCase, false, contextBefore, contextAfter) : target.sqlite ? await searchSqliteSelector(target.sqlite, params.pattern, ignoreCase, contextBefore, contextAfter) : await searchInternalSelector(target.internal, executionCwd, params.pattern, ignoreCase, false, resourceCtx, contextBefore, contextAfter, {
|
|
19731
|
+
...target.lineRanges === void 0 ? {} : { ranges: target.lineRanges },
|
|
19732
|
+
...signal === void 0 ? {} : { signal }
|
|
19733
|
+
}, {
|
|
19734
|
+
first: Math.max(0, skip - groups.length),
|
|
19735
|
+
end: skip > 0 ? skip + limit - groups.length : remaining
|
|
19736
|
+
});
|
|
19737
|
+
if (archive && target.archive) text = text.split(archive.archivePath).join(target.archive.archivePath);
|
|
19738
|
+
if (target.sqlite) text = text.split(target.sqlite.databasePath).join(target.path.match(/^(.+?\.(?:sqlite3?|db3?))/i)?.[1] ?? target.sqlite.databasePath);
|
|
19739
|
+
text = text || "No matches found";
|
|
19740
|
+
text = filterTargetLineRanges(text, target, contextBefore, contextAfter);
|
|
19344
19741
|
const outputGroups = groupSearchOutput(text);
|
|
19345
19742
|
if (skip > 0) groups.push(...outputGroups.map((group) => ({
|
|
19346
19743
|
targetPath: target.path,
|
|
19347
|
-
virtual:
|
|
19744
|
+
virtual: isVirtualSearchTarget(target),
|
|
19348
19745
|
group
|
|
19349
19746
|
})));
|
|
19350
|
-
else if (
|
|
19747
|
+
else if (outputGroups.length > 0) {
|
|
19351
19748
|
const hadMore = outputGroups.length > remaining;
|
|
19352
19749
|
text = formatSearchGroups(outputGroups, remaining);
|
|
19353
19750
|
if (hadMore) {
|
|
19354
|
-
|
|
19355
|
-
...result.details ?? {},
|
|
19356
|
-
...fileLimitDetails(limit)
|
|
19357
|
-
};
|
|
19751
|
+
text += `\n\n${continuationHint(limit, skip)}`;
|
|
19358
19752
|
pageFullWithMore = true;
|
|
19359
19753
|
}
|
|
19360
19754
|
remaining -= Math.min(remaining, outputGroups.length);
|
|
19361
|
-
}
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19755
|
+
} else if (text && text !== "No matches found") remaining--;
|
|
19756
|
+
else text = "No matches found";
|
|
19757
|
+
if (skip === 0) results.push({
|
|
19758
|
+
content: [{
|
|
19759
|
+
type: "text",
|
|
19760
|
+
text
|
|
19761
|
+
}],
|
|
19762
|
+
details: void 0
|
|
19763
|
+
});
|
|
19764
|
+
continue;
|
|
19366
19765
|
}
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19766
|
+
if (targets.length > 1 && await stat(await resolveToCwdAsync(target.path, executionCwd)).then(() => false).catch(() => true)) {
|
|
19767
|
+
skippedMissingPaths.push(target.path);
|
|
19768
|
+
results.push({
|
|
19769
|
+
content: [{
|
|
19770
|
+
type: "text",
|
|
19771
|
+
text: "No matches found"
|
|
19772
|
+
}],
|
|
19773
|
+
details: void 0
|
|
19774
|
+
});
|
|
19775
|
+
continue;
|
|
19373
19776
|
}
|
|
19374
|
-
|
|
19375
|
-
|
|
19376
|
-
let
|
|
19377
|
-
|
|
19378
|
-
if (remainingMatches <= 0) break;
|
|
19379
|
-
const raw = formatSearchGroups([item.group], 1);
|
|
19380
|
-
remainingMatches--;
|
|
19381
|
-
if (raw) renderedPages.push(item.virtual ? raw : await cwdRelativeSearchOutput(raw, executionCwd, item.targetPath));
|
|
19382
|
-
}
|
|
19383
|
-
const hasMorePages = groups.slice(skip + limit).length > 0;
|
|
19384
|
-
const cappedBeforeRequestedPage = internalSearchCapped && skip >= groups.length;
|
|
19385
|
-
const capNotice = internalSearchCapped && !hasMorePages ? `\n\n${internalCapHint()}` : "";
|
|
19386
|
-
const output = `${renderedPages.join("\n\n") || `No more results (skip=${skip})`}${hasMorePages ? `\n\n${continuationHint(limit, skip)}` : ""}${capNotice}`;
|
|
19387
|
-
if (hasMorePages || cappedBeforeRequestedPage || capNotice) markFileLimit(details, limit);
|
|
19388
|
-
const truncation = truncateHead(output, { maxLines: Number.MAX_SAFE_INTEGER });
|
|
19389
|
-
let content = truncation.content;
|
|
19390
|
-
if (truncation.truncated) {
|
|
19391
|
-
details.truncation = truncation;
|
|
19392
|
-
content += `\n\n[${formatSize(DEFAULT_MAX_BYTES)} combined output limit reached]`;
|
|
19393
|
-
}
|
|
19394
|
-
return {
|
|
19777
|
+
const rangedText = await searchFileLineRanges(target, executionCwd, params.pattern, ignoreCase, contextBefore, contextAfter);
|
|
19778
|
+
if (rangedText !== void 0) {
|
|
19779
|
+
let text = applyDefaultSearchContext(rangedText, contextBefore, contextAfter) || "No matches found";
|
|
19780
|
+
const result = {
|
|
19395
19781
|
content: [{
|
|
19396
19782
|
type: "text",
|
|
19397
|
-
text
|
|
19783
|
+
text
|
|
19398
19784
|
}],
|
|
19399
|
-
details:
|
|
19785
|
+
details: void 0
|
|
19400
19786
|
};
|
|
19787
|
+
results.push(result);
|
|
19788
|
+
const outputGroups = groupSearchOutput(text);
|
|
19789
|
+
if (skip > 0) groups.push(...outputGroups.map((group) => ({
|
|
19790
|
+
targetPath: target.path,
|
|
19791
|
+
virtual: false,
|
|
19792
|
+
group
|
|
19793
|
+
})));
|
|
19794
|
+
else if (!isSingleFileSearch && outputGroups.length > 0) {
|
|
19795
|
+
const hadMore = outputGroups.length > remaining;
|
|
19796
|
+
text = formatSearchGroups(outputGroups, remaining);
|
|
19797
|
+
if (hadMore) {
|
|
19798
|
+
result.details = fileLimitDetails(limit);
|
|
19799
|
+
pageFullWithMore = true;
|
|
19800
|
+
}
|
|
19801
|
+
remaining -= Math.min(remaining, outputGroups.length);
|
|
19802
|
+
result.content = [{
|
|
19803
|
+
type: "text",
|
|
19804
|
+
text
|
|
19805
|
+
}];
|
|
19806
|
+
}
|
|
19807
|
+
continue;
|
|
19401
19808
|
}
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
|
|
19408
|
-
|
|
19409
|
-
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
|
|
19425
|
-
|
|
19426
|
-
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
}
|
|
19430
|
-
|
|
19809
|
+
const result = await grepDefinition.execute(toolCallId, {
|
|
19810
|
+
pattern: params.pattern,
|
|
19811
|
+
path: target.path,
|
|
19812
|
+
glob: target.glob,
|
|
19813
|
+
ignoreCase,
|
|
19814
|
+
literal: false,
|
|
19815
|
+
context: searchContext,
|
|
19816
|
+
maxCountPerFile: isSingleFileSearch ? SINGLE_FILE_MATCHES : MULTI_FILE_PER_FILE_MATCHES,
|
|
19817
|
+
limit: INTERNAL_SKIP_LIMIT,
|
|
19818
|
+
gitignore: params.gitignore
|
|
19819
|
+
}, signal, onUpdate, ctx);
|
|
19820
|
+
results.push(result);
|
|
19821
|
+
if (result.details?.matchLimitReached) internalSearchCapped = true;
|
|
19822
|
+
let text = result.content.map((item) => item.type === "text" ? item.text : void 0).filter((text) => typeof text === "string").join("\n");
|
|
19823
|
+
text = filterSearchOutputByLineRange(text, target.lineRanges, contextBefore, contextAfter);
|
|
19824
|
+
if (text !== "No matches found") text = applyDefaultSearchContext(text, contextBefore, contextAfter) || "No matches found";
|
|
19825
|
+
const outputGroups = groupSearchOutput(text);
|
|
19826
|
+
if (skip > 0) groups.push(...outputGroups.map((group) => ({
|
|
19827
|
+
targetPath: target.path,
|
|
19828
|
+
virtual: false,
|
|
19829
|
+
group
|
|
19830
|
+
})));
|
|
19831
|
+
else if (!isSingleFileSearch && outputGroups.length > 0) {
|
|
19832
|
+
const hadMore = outputGroups.length > remaining;
|
|
19833
|
+
text = formatSearchGroups(outputGroups, remaining);
|
|
19834
|
+
if (hadMore) {
|
|
19835
|
+
result.details = {
|
|
19836
|
+
...result.details ?? {},
|
|
19837
|
+
...fileLimitDetails(limit)
|
|
19431
19838
|
};
|
|
19839
|
+
pageFullWithMore = true;
|
|
19432
19840
|
}
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19841
|
+
remaining -= Math.min(remaining, outputGroups.length);
|
|
19842
|
+
}
|
|
19843
|
+
result.content = [{
|
|
19844
|
+
type: "text",
|
|
19845
|
+
text
|
|
19846
|
+
}];
|
|
19847
|
+
}
|
|
19848
|
+
const details = {};
|
|
19849
|
+
for (const result of results) {
|
|
19850
|
+
if (result.details?.truncation) details.truncation = result.details.truncation;
|
|
19851
|
+
if (result.details?.matchLimitReached) details.matchLimitReached = result.details.matchLimitReached;
|
|
19852
|
+
if (hasFileLimit(result.details)) markFileLimit(details, limit);
|
|
19853
|
+
if (result.details?.linesTruncated) details.linesTruncated = true;
|
|
19854
|
+
}
|
|
19855
|
+
if (skip > 0) {
|
|
19856
|
+
const renderedPages = [];
|
|
19857
|
+
let remainingMatches = limit;
|
|
19858
|
+
for (const item of groups.slice(skip)) {
|
|
19859
|
+
if (remainingMatches <= 0) break;
|
|
19860
|
+
const raw = formatSearchGroups([item.group], 1);
|
|
19861
|
+
remainingMatches--;
|
|
19862
|
+
if (raw) renderedPages.push(item.virtual ? raw : await cwdRelativeSearchOutput(raw, executionCwd, item.targetPath));
|
|
19437
19863
|
}
|
|
19438
|
-
const
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19444
|
-
|
|
19445
|
-
if (pageFullWithMore || internalSearchCapped) markFileLimit(details, limit);
|
|
19446
|
-
const truncation = truncateHead(content, { maxLines: Number.MAX_SAFE_INTEGER });
|
|
19447
|
-
let output = truncation.content;
|
|
19864
|
+
const hasMorePages = groups.slice(skip + limit).length > 0;
|
|
19865
|
+
const cappedBeforeRequestedPage = internalSearchCapped && skip >= groups.length;
|
|
19866
|
+
const capNotice = internalSearchCapped && !hasMorePages ? `\n\n${internalCapHint()}` : "";
|
|
19867
|
+
const output = `${renderedPages.join("\n\n") || `No more results (skip=${skip})`}${hasMorePages ? `\n\n${continuationHint(limit, skip)}` : ""}${capNotice}`;
|
|
19868
|
+
if (hasMorePages || cappedBeforeRequestedPage || capNotice) markFileLimit(details, limit);
|
|
19869
|
+
const truncation = truncateHead(output, { maxLines: Number.MAX_SAFE_INTEGER });
|
|
19870
|
+
let content = truncation.content;
|
|
19448
19871
|
if (truncation.truncated) {
|
|
19449
19872
|
details.truncation = truncation;
|
|
19450
|
-
|
|
19873
|
+
content += `\n\n[${formatSize(DEFAULT_MAX_BYTES)} combined output limit reached]`;
|
|
19451
19874
|
}
|
|
19452
19875
|
return {
|
|
19453
19876
|
content: [{
|
|
19454
19877
|
type: "text",
|
|
19455
|
-
text:
|
|
19878
|
+
text: content
|
|
19456
19879
|
}],
|
|
19457
|
-
details: buildSearchDetails(details,
|
|
19880
|
+
details: buildSearchDetails(details, content, executionCwd, scopePath, skippedMissingPaths)
|
|
19458
19881
|
};
|
|
19882
|
+
}
|
|
19883
|
+
if (results.length === 1) {
|
|
19884
|
+
const result = results[0];
|
|
19885
|
+
let text = result.content.map((item) => item.type === "text" ? item.text : void 0).filter((value) => typeof value === "string").join("\n");
|
|
19886
|
+
text = filterTargetLineRanges(text, targets[0], contextBefore, contextAfter);
|
|
19887
|
+
if (!isVirtualSearchTarget(targets[0]) && text !== "No matches found") text = applyDefaultSearchContext(text, contextBefore, contextAfter) || "No matches found";
|
|
19888
|
+
const skipNotice = singleFileSkipIgnored ? "\n\n[skip is ignored for single-file search; refine the pattern/path or search a directory to page matching files.]" : "";
|
|
19889
|
+
if (isSingleFileSearch && text !== "No matches found") text = formatSearchGroups(groupSearchOutput(text), limit, limit);
|
|
19890
|
+
if (text && text !== "No matches found") {
|
|
19891
|
+
const renderedText = isVirtualSearchTarget(targets[0]) ? text : await cwdRelativeSearchOutput(text, executionCwd, targets[0]?.path ?? ".");
|
|
19892
|
+
const pagedText = `${hasFileLimit(result.details) ? `${renderedText}\n\n${continuationHint(limit, skip)}` : renderedText}${skipNotice}`;
|
|
19893
|
+
const truncation = truncateHead(pagedText, { maxLines: Number.MAX_SAFE_INTEGER });
|
|
19894
|
+
if (truncation.truncated) return {
|
|
19895
|
+
...result,
|
|
19896
|
+
content: [{
|
|
19897
|
+
type: "text",
|
|
19898
|
+
text: `${truncation.content}\n\n[${formatSize(DEFAULT_MAX_BYTES)} combined output limit reached]`
|
|
19899
|
+
}],
|
|
19900
|
+
details: buildSearchDetails({
|
|
19901
|
+
...result.details ?? {},
|
|
19902
|
+
truncation
|
|
19903
|
+
}, truncation.content, executionCwd, scopePath, skippedMissingPaths)
|
|
19904
|
+
};
|
|
19905
|
+
return {
|
|
19906
|
+
...result,
|
|
19907
|
+
content: [{
|
|
19908
|
+
type: "text",
|
|
19909
|
+
text: pagedText
|
|
19910
|
+
}],
|
|
19911
|
+
details: buildSearchDetails(result.details, pagedText, executionCwd, scopePath, skippedMissingPaths)
|
|
19912
|
+
};
|
|
19913
|
+
}
|
|
19914
|
+
return {
|
|
19915
|
+
...result,
|
|
19916
|
+
details: buildSearchDetails(result.details, text || "No matches found", executionCwd, scopePath, skippedMissingPaths)
|
|
19917
|
+
};
|
|
19918
|
+
}
|
|
19919
|
+
const content = dedupeRenderedSearchOutput(`${(await Promise.all(results.map(async (result, index) => {
|
|
19920
|
+
let text = result.content.map((item) => item.type === "text" ? item.text : void 0).filter((value) => typeof value === "string" && value.length > 0).join("\n");
|
|
19921
|
+
text = filterTargetLineRanges(text, targets[index], contextBefore, contextAfter);
|
|
19922
|
+
if (!isVirtualSearchTarget(targets[index]) && text !== "No matches found") text = applyDefaultSearchContext(text, contextBefore, contextAfter);
|
|
19923
|
+
if (!text || text === "No matches found") return `# ${targets[index]?.path ?? "."}\n${text}`;
|
|
19924
|
+
return isVirtualSearchTarget(targets[index]) ? text : await cwdRelativeSearchOutput(text, executionCwd, targets[index]?.path ?? ".");
|
|
19925
|
+
}))).join("\n\n")}${skippedMissingPaths.length > 0 ? `\n\n[Skipped missing paths: ${skippedMissingPaths.join(", ")}]` : ""}${pageFullWithMore ? `\n\n${continuationHint(limit, skip)}` : ""}${internalSearchCapped && !pageFullWithMore ? `\n\n${internalCapHint()}` : ""}`);
|
|
19926
|
+
if (pageFullWithMore || internalSearchCapped) markFileLimit(details, limit);
|
|
19927
|
+
const truncation = truncateHead(content, { maxLines: Number.MAX_SAFE_INTEGER });
|
|
19928
|
+
let output = truncation.content;
|
|
19929
|
+
if (truncation.truncated) {
|
|
19930
|
+
details.truncation = truncation;
|
|
19931
|
+
output += `\n\n[${formatSize(DEFAULT_MAX_BYTES)} combined output limit reached]`;
|
|
19932
|
+
}
|
|
19933
|
+
return {
|
|
19934
|
+
content: [{
|
|
19935
|
+
type: "text",
|
|
19936
|
+
text: output
|
|
19937
|
+
}],
|
|
19938
|
+
details: buildSearchDetails(details, output, executionCwd, scopePath, skippedMissingPaths)
|
|
19939
|
+
};
|
|
19940
|
+
};
|
|
19941
|
+
return withBuiltinToolBlockRenderers({
|
|
19942
|
+
...grepDefinition,
|
|
19943
|
+
name: "search",
|
|
19944
|
+
label: "search",
|
|
19945
|
+
description: "Search file contents with a regex across files, directories, globs, and internal URLs, including history:// for past sessions.",
|
|
19946
|
+
promptSnippet: searchToolSystemPromptContribution.snippet,
|
|
19947
|
+
promptGuidelines: [...searchToolSystemPromptContribution.guidelines],
|
|
19948
|
+
...experimentalToolSamplingProperty(),
|
|
19949
|
+
parameters: searchSchema,
|
|
19950
|
+
prepareArguments: (args) => prepareHistoryAwareInput(args, "search", "pattern"),
|
|
19951
|
+
async execute(toolCallId, input, signal, onUpdate, ctx) {
|
|
19952
|
+
if (input.action !== void 0) return asSearchResult(await waitForHistoryTask(options?.historyTasks?.(), input, "search", signal));
|
|
19953
|
+
const { wait, ...params } = input;
|
|
19954
|
+
const policy = validateHistoryWait(wait);
|
|
19955
|
+
const registry = namesHistoryUrl(params.paths) ? options?.historyTasks?.() : void 0;
|
|
19956
|
+
if (!registry) return runSearch(toolCallId, params, signal, onUpdate, ctx);
|
|
19957
|
+
return asSearchResult(await registry.run({
|
|
19958
|
+
kind: "search",
|
|
19959
|
+
subject: `/${params.pattern}/ in ${typeof params.paths === "string" ? params.paths : (params.paths ?? []).join(", ")}`,
|
|
19960
|
+
wait: policy,
|
|
19961
|
+
signal,
|
|
19962
|
+
run: (callSignal) => runSearch(toolCallId, params, callSignal, onUpdate, ctx)
|
|
19963
|
+
}));
|
|
19459
19964
|
},
|
|
19460
19965
|
renderCall(args, theme, context) {
|
|
19461
19966
|
const text = context.lastComponent ?? new Text("", 0, 0);
|
|
@@ -28207,16 +28712,16 @@ function getArtifactManager(artifactsDir) {
|
|
|
28207
28712
|
}
|
|
28208
28713
|
return manager;
|
|
28209
28714
|
}
|
|
28210
|
-
export { ACTIONS_GITHUB_BASE_URL_ENV, BASH_SHELL_PRESENTATION, BLUEPRINT_FULL_BUILD_MAX_AGE_MS, BLUEPRINT_STEP_TIMEOUT_MS, DEGRADED_RESTORE_RETENTION_DAYS, ENGINE_SESSION_STORAGE_FLAG, ENGINE_SHUTDOWN_GRACE_MS, EVENT_REPORT_MESSAGE_TYPE, EVENT_SUBSCRIPTION_CHILD_ENTRY_TYPE, EVENT_SUBSCRIPTION_ENTRY_TYPE, EVENT_SUBSCRIPTION_PROCESSED_ENTRY_TYPE, FooterDataProvider, RpcClient, SETUP_COMMAND_ALIAS, STORAGE_ADAPTER_LOAD_TIMEOUT_MS, STORAGE_PROBE_TIMEOUT_MS, SUBSCRIPTION_REPORT_TOOL_NAME, SessionWorktreeSnapshotRecorder, SettingsFileChangedError, SettingsManager, TEAM_CONNECTION_TIMEOUT_MS, TEAM_PROFILE_SOURCE, adoptInlineSnapshotBlobs, agentPanelExtensionItems, agentPanelItems, agentPanelSourceHubOf, agentPanelSourcesGeneration, agentPanelTaskId, agentSessionSummaryMethods, agentSessionTreeMethods, answerAgentPanelItem, appendBoundedStderr, applyReadLineSelection, applyToolModifiers, assertTeamAdapterInstalled, bashToolSystemPromptContribution, bindTaskTranscriptFragments, blueprintNotices, blueprintRepository, boundExtensionRuntimes, buildInteractiveEngineArgs, builtinToolBlockPresentation, canIsolateSessionStore, cancelSessionSubscriptions, checkSharedStorageAdapter, checkoutsNeedingRebuild, collectEntriesForBranchSummary, collectStorageStatus, compareWorktreeSnapshot, composeInternalRouters, continueSessionWhereItWorked, copyPanelItemStableKey, createBashTool, createBashToolDefinition, createCodingTools, createEditTool, createEditToolDefinition, createExtensionAPI, createExtensionRuntime, createFindTool, createFindToolDefinition, createHistoryRouter, createLoadedToolDefinition, createLocalBashOperations, createLocalPowerShellOperations, createLsTool, createLsToolDefinition, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createReadToolDefinition, createSearchTool, createSearchToolDefinition, createSubscriberReportTool, createToolDefinitionsFor, createWriteTool, createWriteToolDefinition, currentWorktreeRestoreNotices, currentWorktreeRootMappings, currentWorktreeSnapshots, decodeReadableUrl, defaultToolSelectionFor, degradedRestorePin, deleteSessionWithSnapshotRefs, describeBlueprints, describeExportedSnapshots, describeLastCapture, describeSnapshotExport, describeStorageError, describeStorageSelection, describeWorktreeRestoreStatus, describeWorktreeSnapshot, discardDegradedRestore, dismissedAgentPanelItems, drainExtensionAPIWork, editToolSystemPromptContribution, effectiveSharedSelection, extractDocumentMarkdown, findToolSystemPromptContribution, findUnansweredToolCall, formatDegradedRestoreNotice, formatEventReport, formatToolBlockElapsed, formatUnrestoredNotice, formatWorktreeRestoreNotice, formatWorktreeRestoreWarning, generateBranchSummary, generateDiffString, generateUnifiedPatch, getArtifactManager, getEngineSessionStorage, hasSubagentCaptures, hostStoragePackagesRegistered, inheritChildSessionOptionsWithDefaults, inheritedRemotes, inlineSnapshotBlobs, isBuiltinToolCallRenderer, isBuiltinToolResultRenderer, isDocumentPath, isInside$1 as isInside, isInterruptedPanelTask, isPlainRuntimeMetadataCommand, joinSharedDatabase, joinTeam, joinTeamWith, latestSessionSnapshot, latestSessionSnapshotAsync, launchedTaskViewSource, lazyTaskPanelItem, leaveTeam, leaveTeamWith, liveTaskRowOrigin, loadProjectContextFiles, loadProjectContextFilesAsync, lsToolSystemPromptContribution, mapPathForCwd, mapPathForCwdAsync, mapRestoredPath, mapRestoredPathAsync, markInterruptedPanelTask, materializePanelItem, modelHasReasoning, needsRebuild, notifyAgentPanelChanged, notifyAgentPanelSourceHubRebound, onOwnerTaskAction, openAgentPanelItem, openSessionInWorktree, ownerTaskViewSource, panelItemStableKey, parentHistoryNotices, parseActionReference, pathExists, plainNoticeBlock, prepareBranchEntries, prepareInitialMessage, prepareSessionResume, prewarmHostDefaultModelApi, prewarmInteractiveEngineRpcMode, projectSettingsChooseSessionStorage, projectTrust, promptAnswerOptionsOf, readTaskDetailForView, readTaskPageForChat, readTaskPageForView, readToolSystemPromptContribution, recordBlueprintContext, recordRestoredWorktreeContext, registerHostStoragePackages, registerHostStoragePackagesAsync, releaseSessionWorktrees, removeSavedModelRoutingSettings, removeSavedModelRoutingSettingsAsync, resolveAppMode, resolveCliPaths, resolveExcludedToolsForAppMode, resolveExistingPromptSourcePath, resolveExistingPromptSourcePaths, resolvePackageStorageAdapter, resolvePromptInput, resolveSessionStore, resumeSessionWorktree, resumeStoreDir, retainTaskWindowReader, retireExtensionAPI, runAction, runBlueprintBuild, runExtensionAPICleanup, runMigrations, runMigrationsAsync, runResourceRegistrationBatch, sampleAgentPanelSources, savedBoundaryCursor, savedProjectTrust, savedProjectTrustAsync, sealExtensionAPI, searchToolSystemPromptContribution, seedEventPrompt, selectIntercomStorage, selectSessionSetting, selectSessionStorage, selectSessionStorageWithSettings, selectSessionStorageWithSettingsAsync, selectSharedStorage, selectTeamProfile, serializeConversation, sessionManagerContinuesIn, sessionManagerRunsInRecordedCheckout, sessionResumeOptions, sessionSnapshotBlobs, sessionStorageSettingsDiffer, setUpResumedBlueprints, settingsFileTarget, settingsFileTargetAsync, shellCommandPrefixFor, shortTaskTitle, shouldStartRpcCatalogRefresh, showDeprecationWarnings, snapshotBlobInliner, sourceError, stopAgentPanelItem, storageFingerprint, subscribeAgentPanel, subscribeAgentPanelExtensions, subscribeSession, takeEngineSessionStorageArg, taskCursorsAround, taskPanelItem, taskPanelItems, taskPanelModel, taskPanelRole, taskPanelState, taskRunGeneration, taskTranscriptFile, taskTranscriptFragments, taskTranscriptUnsavedAnswer, toPrintOutputMode, toolsWithReport, withTaskTranscriptArchive, withWorktreeRestoreNotices, withWorktreeRootMappings, worktreeNeedsRestore, worktreeRestoreNotices, writeSettingsFile, writeSettingsFileAsync, writeToolSystemPromptContribution };
|
|
28715
|
+
export { ACTIONS_GITHUB_BASE_URL_ENV, BASH_SHELL_PRESENTATION, BLUEPRINT_FULL_BUILD_MAX_AGE_MS, BLUEPRINT_STEP_TIMEOUT_MS, DEGRADED_RESTORE_RETENTION_DAYS, ENGINE_SESSION_STORAGE_FLAG, ENGINE_SHUTDOWN_GRACE_MS, EVENT_REPORT_MESSAGE_TYPE, EVENT_SUBSCRIPTION_CHILD_ENTRY_TYPE, EVENT_SUBSCRIPTION_ENTRY_TYPE, EVENT_SUBSCRIPTION_PROCESSED_ENTRY_TYPE, FooterDataProvider, HistoryTaskRegistry, RpcClient, SETUP_COMMAND_ALIAS, STORAGE_ADAPTER_LOAD_TIMEOUT_MS, STORAGE_PROBE_TIMEOUT_MS, SUBSCRIPTION_REPORT_TOOL_NAME, SessionWorktreeSnapshotRecorder, SettingsFileChangedError, SettingsManager, TEAM_CONNECTION_TIMEOUT_MS, TEAM_PROFILE_SOURCE, adoptInlineSnapshotBlobs, agentPanelExtensionItems, agentPanelItems, agentPanelSourceHubOf, agentPanelSourcesGeneration, agentPanelTaskId, agentSessionSummaryMethods, agentSessionTreeMethods, answerAgentPanelItem, appendBoundedStderr, applyReadLineSelection, applyToolModifiers, assertTeamAdapterInstalled, bashToolSystemPromptContribution, bindTaskTranscriptFragments, blueprintNotices, blueprintRepository, boundExtensionRuntimes, buildInteractiveEngineArgs, builtinToolBlockPresentation, canIsolateSessionStore, cancelSessionSubscriptions, checkSharedStorageAdapter, checkoutsNeedingRebuild, collectEntriesForBranchSummary, collectStorageStatus, compareWorktreeSnapshot, composeInternalRouters, continueSessionWhereItWorked, copyPanelItemStableKey, createBashTool, createBashToolDefinition, createCodingTools, createEditTool, createEditToolDefinition, createExtensionAPI, createExtensionRuntime, createFindTool, createFindToolDefinition, createHistoryRouter, createKillTool, createKillToolDefinition, createLoadedToolDefinition, createLocalBashOperations, createLocalPowerShellOperations, createLsTool, createLsToolDefinition, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createReadToolDefinition, createSearchTool, createSearchToolDefinition, createSubscriberReportTool, createToolDefinitionsFor, createWriteTool, createWriteToolDefinition, currentWorktreeRestoreNotices, currentWorktreeRootMappings, currentWorktreeSnapshots, decodeReadableUrl, defaultToolSelectionFor, degradedRestorePin, deleteSessionWithSnapshotRefs, describeBlueprints, describeExportedSnapshots, describeLastCapture, describeSnapshotExport, describeStorageError, describeStorageSelection, describeWorktreeRestoreStatus, describeWorktreeSnapshot, discardDegradedRestore, dismissedAgentPanelItems, drainExtensionAPIWork, editToolSystemPromptContribution, effectiveSharedSelection, extractDocumentMarkdown, findToolSystemPromptContribution, findUnansweredToolCall, formatDegradedRestoreNotice, formatEventReport, formatToolBlockElapsed, formatUnrestoredNotice, formatWorktreeRestoreNotice, formatWorktreeRestoreWarning, generateBranchSummary, generateDiffString, generateUnifiedPatch, getArtifactManager, getEngineSessionStorage, hasSubagentCaptures, hostStoragePackagesRegistered, inheritChildSessionOptionsWithDefaults, inheritedRemotes, inlineSnapshotBlobs, isBuiltinToolCallRenderer, isBuiltinToolResultRenderer, isDocumentPath, isInside$1 as isInside, isInterruptedPanelTask, isPlainRuntimeMetadataCommand, joinSharedDatabase, joinTeam, joinTeamWith, latestSessionSnapshot, latestSessionSnapshotAsync, launchedTaskViewSource, lazyTaskPanelItem, leaveTeam, leaveTeamWith, liveTaskRowOrigin, loadProjectContextFiles, loadProjectContextFilesAsync, lsToolSystemPromptContribution, mapPathForCwd, mapPathForCwdAsync, mapRestoredPath, mapRestoredPathAsync, markInterruptedPanelTask, materializePanelItem, modelHasReasoning, needsRebuild, notifyAgentPanelChanged, notifyAgentPanelSourceHubRebound, onOwnerTaskAction, openAgentPanelItem, openSessionInWorktree, ownerTaskViewSource, panelItemStableKey, parentHistoryNotices, parseActionReference, pathExists, plainNoticeBlock, prepareBranchEntries, prepareInitialMessage, prepareSessionResume, prewarmHostDefaultModelApi, prewarmInteractiveEngineRpcMode, projectSettingsChooseSessionStorage, projectTrust, promptAnswerOptionsOf, readTaskDetailForView, readTaskPageForChat, readTaskPageForView, readToolSystemPromptContribution, recordBlueprintContext, recordRestoredWorktreeContext, registerHostStoragePackages, registerHostStoragePackagesAsync, releaseSessionWorktrees, removeSavedModelRoutingSettings, removeSavedModelRoutingSettingsAsync, resolveAppMode, resolveCliPaths, resolveExcludedToolsForAppMode, resolveExistingPromptSourcePath, resolveExistingPromptSourcePaths, resolvePackageStorageAdapter, resolvePromptInput, resolveSessionStore, resumeSessionWorktree, resumeStoreDir, retainTaskWindowReader, retireExtensionAPI, runAction, runBlueprintBuild, runExtensionAPICleanup, runMigrations, runMigrationsAsync, runResourceRegistrationBatch, sampleAgentPanelSources, savedBoundaryCursor, savedProjectTrust, savedProjectTrustAsync, sealExtensionAPI, searchToolSystemPromptContribution, seedEventPrompt, selectIntercomStorage, selectSessionSetting, selectSessionStorage, selectSessionStorageWithSettings, selectSessionStorageWithSettingsAsync, selectSharedStorage, selectTeamProfile, serializeConversation, sessionManagerContinuesIn, sessionManagerRunsInRecordedCheckout, sessionResumeOptions, sessionSnapshotBlobs, sessionStorageSettingsDiffer, setUpResumedBlueprints, settingsFileTarget, settingsFileTargetAsync, shellCommandPrefixFor, shortTaskTitle, shouldStartRpcCatalogRefresh, showDeprecationWarnings, snapshotBlobInliner, sourceError, stopAgentPanelItem, storageFingerprint, subscribeAgentPanel, subscribeAgentPanelExtensions, subscribeSession, takeEngineSessionStorageArg, taskCursorsAround, taskPanelItem, taskPanelItems, taskPanelModel, taskPanelRole, taskPanelState, taskRunGeneration, taskTranscriptFile, taskTranscriptFragments, taskTranscriptUnsavedAnswer, toPrintOutputMode, toolsWithReport, withTaskTranscriptArchive, withWorktreeRestoreNotices, withWorktreeRootMappings, worktreeNeedsRestore, worktreeRestoreNotices, writeSettingsFile, writeSettingsFileAsync, writeToolSystemPromptContribution };
|
|
28211
28716
|
|
|
28212
|
-
//# sourceMappingURL=startup-8-1-
|
|
28717
|
+
//# sourceMappingURL=startup-8-1-X32CYSXB.js.map
|
|
28213
28718
|
// __atomicOnDemandFailed: written by the build (scripts/in-place-update-gate.mjs). An import of this release's code on
|
|
28214
28719
|
// demand that fails in a process an in-place update left running says to restart.
|
|
28215
28720
|
function __atomicOnDemandFailed(error, feature) {
|
|
28216
28721
|
return (async () => {
|
|
28217
28722
|
const root = new URL("../", import.meta.url);
|
|
28218
28723
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
28219
|
-
const key = `${root.href}#0.10.
|
|
28724
|
+
const key = `${root.href}#0.10.11-alpha.1`;
|
|
28220
28725
|
let release = releases.get(key);
|
|
28221
28726
|
if (release === undefined) {
|
|
28222
28727
|
const current = (async () => {
|
|
@@ -28244,7 +28749,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
28244
28749
|
} catch {
|
|
28245
28750
|
// No installation to read, as in a bundle of the package: the release the process runs decides.
|
|
28246
28751
|
}
|
|
28247
|
-
const updatedTo = typeof installed === "string" && installed !== "0.10.
|
|
28752
|
+
const updatedTo = typeof installed === "string" && installed !== "0.10.11-alpha.1" ? installed : running !== undefined && running.version !== "0.10.11-alpha.1" ? "0.10.11-alpha.1" : undefined;
|
|
28248
28753
|
if (updatedTo === undefined) throw error;
|
|
28249
28754
|
const application = typeof running?.name === "string" ? running.name : "atomic";
|
|
28250
28755
|
const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
|