@bastani/atomic 0.9.13-alpha.2 → 0.9.13-alpha.4
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 +30 -0
- package/README.md +1 -1
- package/dist/builtin/i-have-adhd/package.json +1 -1
- package/dist/builtin/intercom/CHANGELOG.md +14 -0
- package/dist/builtin/intercom/README.md +12 -12
- package/dist/builtin/intercom/incoming-message-delivery.ts +1 -1
- package/dist/builtin/intercom/index.ts +1 -1
- package/dist/builtin/intercom/intercom-tool.ts +1 -1
- package/dist/builtin/intercom/intercom-utils.ts +3 -6
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/result-renderers.ts +1 -1
- package/dist/builtin/intercom/session-target.ts +1 -15
- package/dist/builtin/intercom/skills/intercom/SKILL.md +6 -6
- package/dist/builtin/intercom/terminal-ordering-barrier.ts +2 -2
- package/dist/builtin/intercom/ui/inline-message.ts +7 -5
- package/dist/builtin/intercom/ui/session-list.ts +23 -10
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +19 -0
- package/dist/builtin/subagents/README.md +29 -73
- package/dist/builtin/subagents/package.json +2 -2
- package/dist/builtin/subagents/prompts/parallel-cleanup.md +1 -1
- package/dist/builtin/subagents/prompts/parallel-review.md +1 -1
- package/dist/builtin/subagents/prompts/review-loop.md +2 -2
- package/dist/builtin/subagents/skills/subagent/SKILL.md +23 -59
- package/dist/builtin/subagents/skills/tmux/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/control-notices.ts +2 -3
- package/dist/builtin/subagents/src/extension/doctor.ts +2 -14
- package/dist/builtin/subagents/src/extension/fanout-child.ts +1 -17
- package/dist/builtin/subagents/src/extension/index.ts +9 -70
- package/dist/builtin/subagents/src/extension/notification-content.ts +1 -1
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +2 -2
- package/dist/builtin/subagents/src/extension/schemas.ts +2 -8
- package/dist/builtin/subagents/src/extension/tool-description.ts +2 -3
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +1 -1
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +5 -46
- package/dist/builtin/subagents/src/runs/{background → foreground}/completion-notification.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts +25 -88
- package/dist/builtin/subagents/src/runs/{background → foreground}/notify.ts +5 -5
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +11 -28
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +3 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-runtime.ts +0 -5
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +30 -20
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +4 -4
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +0 -13
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +104 -48
- package/dist/builtin/subagents/src/runs/inprocess/index.ts +1 -1
- package/dist/builtin/subagents/src/runs/inprocess/runner.ts +5 -5
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-api.ts +0 -7
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-core.ts +0 -10
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-projection.ts +3 -108
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-sanitize.ts +0 -4
- package/dist/builtin/subagents/src/runs/shared/subagent-control.ts +1 -1
- package/dist/builtin/subagents/src/shared/formatters.ts +3 -5
- package/dist/builtin/subagents/src/shared/model-resolution.ts +78 -0
- package/dist/builtin/subagents/src/shared/status-format.ts +4 -11
- package/dist/builtin/subagents/src/shared/types-config.ts +10 -9
- package/dist/builtin/subagents/src/shared/types-nested.ts +127 -0
- package/dist/builtin/subagents/src/shared/types-results.ts +2 -8
- package/dist/builtin/subagents/src/shared/types-runtime.ts +0 -9
- package/dist/builtin/subagents/src/shared/types.ts +1 -1
- package/dist/builtin/subagents/src/shared/utils.ts +1 -109
- package/dist/builtin/subagents/src/slash/slash-commands.ts +7 -17
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +2 -252
- package/dist/builtin/subagents/src/tui/render-layout.ts +4 -4
- package/dist/builtin/subagents/src/tui/render-result.ts +0 -9
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +1 -34
- package/dist/builtin/subagents/src/tui/render.ts +0 -2
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +23 -0
- package/dist/builtin/workflows/README.md +3 -3
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/durable/backend.ts +11 -0
- package/dist/builtin/workflows/src/durable/completed-catalog-stage-groups.ts +63 -25
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +166 -25
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +42 -24
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +2 -1
- package/dist/builtin/workflows/src/durable/run-timing.ts +28 -7
- package/dist/builtin/workflows/src/durable/scoped-backend.ts +4 -0
- package/dist/builtin/workflows/src/durable/targeted-inspection.ts +110 -0
- package/dist/builtin/workflows/src/engine/run-durable-stage-session.ts +2 -2
- package/dist/builtin/workflows/src/engine/runtime.ts +19 -2
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +3 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +750 -168
- package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +6 -0
- package/dist/builtin/workflows/src/extension/ui-surface.ts +4 -0
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +6 -1
- package/dist/builtin/workflows/src/extension/workflow-targets.ts +18 -10
- package/dist/builtin/workflows/src/extension/workflow-tool-inspection.ts +31 -16
- package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +75 -3
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +53 -6
- package/dist/builtin/workflows/src/runs/background/run-inspect.ts +5 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +94 -60
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-context.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +7 -7
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +25 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +4 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +142 -4
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-session-heartbeat.ts +88 -0
- package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +1 -0
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +1 -0
- package/dist/builtin/workflows/src/tui/run-detail.ts +25 -12
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +27 -8
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +17 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +20 -3
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +10 -1
- package/dist/builtin/workflows/src/tui/workflow-resume-selector.ts +1 -0
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +22 -5
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.d.ts.map +1 -1
- package/dist/core/agent-session-export.js +2 -1
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +10 -4
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +68 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
- package/dist/core/agent-session-queue-pause.js +6 -0
- package/dist/core/agent-session-queue-pause.js.map +1 -1
- package/dist/core/agent-session-summary.d.ts +21 -0
- package/dist/core/agent-session-summary.d.ts.map +1 -0
- package/dist/core/agent-session-summary.js +156 -0
- package/dist/core/agent-session-summary.js.map +1 -0
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +0 -4
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-transfer.d.ts.map +1 -1
- package/dist/core/agent-session-transfer.js +0 -2
- package/dist/core/agent-session-transfer.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +6 -0
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session.d.ts +21 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +22 -5
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.js +2 -2
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/session-summarization.d.ts +41 -0
- package/dist/core/compaction/session-summarization.d.ts.map +1 -0
- package/dist/core/compaction/session-summarization.js +97 -0
- package/dist/core/compaction/session-summarization.js.map +1 -0
- package/dist/core/extensions/ui-types.d.ts +4 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/keybindings.d.ts +0 -5
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +3 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +9 -1
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts +24 -1
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js +48 -0
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +10 -0
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +10 -1
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +3 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +5 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-types.d.ts +4 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.js +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash.d.ts +0 -15
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -81
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/fetch-url.d.ts +12 -0
- package/dist/core/tools/fetch-url.d.ts.map +1 -1
- package/dist/core/tools/fetch-url.js +76 -10
- package/dist/core/tools/fetch-url.js.map +1 -1
- package/dist/core/tools/index.js +4 -4
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/session-temp-dir.d.ts +2 -2
- package/dist/core/tools/session-temp-dir.d.ts.map +1 -1
- package/dist/core/tools/session-temp-dir.js +6 -7
- package/dist/core/tools/session-temp-dir.js.map +1 -1
- package/dist/core/usage-totals.js +1 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/host-session-picker.d.ts.map +1 -1
- package/dist/modes/interactive/components/host-session-picker.js +1 -0
- package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +29 -4
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/transcript-follow-indicator.d.ts +14 -0
- package/dist/modes/interactive/components/transcript-follow-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/transcript-follow-indicator.js +36 -0
- package/dist/modes/interactive/components/transcript-follow-indicator.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-content.js +6 -0
- package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +3 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +0 -3
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +7 -1
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +3 -3
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +2 -5
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +6 -0
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-transcript-follow.d.ts +2 -0
- package/dist/modes/interactive/interactive-transcript-follow.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-transcript-follow.js +6 -0
- package/dist/modes/interactive/interactive-transcript-follow.js.map +1 -0
- package/dist/modes/interactive/interactive-tui.d.ts +13 -1
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +59 -1
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +2 -0
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +1 -0
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +1 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +5 -1
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +21 -9
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/docs/environment-variables.md +1 -1
- package/docs/intercom.md +20 -21
- package/docs/keybindings.md +2 -5
- package/docs/quickstart.md +5 -1
- package/docs/sdk.md +1 -1
- package/docs/session-format.md +15 -0
- package/docs/sessions.md +8 -0
- package/docs/settings.md +6 -0
- package/docs/subagents.md +19 -31
- package/docs/tools.md +3 -5
- package/docs/usage.md +3 -1
- package/docs/windows.md +1 -1
- package/docs/workflows.md +60 -32
- package/npm-shrinkwrap.json +29 -29
- package/package.json +2 -2
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +0 -331
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +0 -161
- package/dist/builtin/subagents/src/runs/inprocess/background-single.ts +0 -195
- package/dist/builtin/subagents/src/runs/inprocess/background.ts +0 -90
- package/dist/builtin/subagents/src/shared/types-async.ts +0 -247
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +0 -217
- package/dist/builtin/subagents/src/tui/render-widget.ts +0 -366
- package/dist/core/async/format.d.ts +0 -3
- package/dist/core/async/format.d.ts.map +0 -1
- package/dist/core/async/format.js +0 -52
- package/dist/core/async/format.js.map +0 -1
- package/dist/core/async/job-manager.d.ts +0 -40
- package/dist/core/async/job-manager.d.ts.map +0 -1
- package/dist/core/async/job-manager.js +0 -293
- package/dist/core/async/job-manager.js.map +0 -1
- package/dist/core/async/session-manager.d.ts +0 -16
- package/dist/core/async/session-manager.d.ts.map +0 -1
- package/dist/core/async/session-manager.js +0 -34
- package/dist/core/async/session-manager.js.map +0 -1
- package/dist/core/async/types.d.ts +0 -23
- package/dist/core/async/types.d.ts.map +0 -1
- package/dist/core/async/types.js +0 -2
- package/dist/core/async/types.js.map +0 -1
- package/dist/core/tools/bash-async-execution.d.ts +0 -27
- package/dist/core/tools/bash-async-execution.d.ts.map +0 -1
- package/dist/core/tools/bash-async-execution.js +0 -81
- package/dist/core/tools/bash-async-execution.js.map +0 -1
- package/dist/core/tools/bash-async-jobs.d.ts +0 -30
- package/dist/core/tools/bash-async-jobs.d.ts.map +0 -1
- package/dist/core/tools/bash-async-jobs.js +0 -87
- package/dist/core/tools/bash-async-jobs.js.map +0 -1
- package/dist/core/tools/bash-async-output.d.ts +0 -13
- package/dist/core/tools/bash-async-output.d.ts.map +0 -1
- package/dist/core/tools/bash-async-output.js +0 -122
- package/dist/core/tools/bash-async-output.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,EACN,cAAc,EACd,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,uBAAuB,GACvB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAEN,+BAA+B,EAC/B,8BAA8B,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC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ACF,CAAC;YACD,MAAM,SAAS,GACb,OAAO,CAAC,aAAuD,IAAI,IAAI,yBAAyB,EAAE,CAAC;YACrG,gCAAgC,CAC/B,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,CAAC,UAAU,EAClB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,OAAO,CACb,CAAC;YACF,SAAS,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QAClB,CAAC;KACD,CAAC;AACH,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAyB;IACpE,OAAO,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import { constants } from \"node:fs\";\nimport { access as fsAccess, stat as fsStat } from \"node:fs/promises\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Container, Text, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport { spawn } from \"child_process\";\nimport { type Static, Type } from \"typebox\";\nimport { APP_NAME } from \"../../config.ts\";\nimport { parenthesizedKeyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport { truncateToVisualLines } from \"../../modes/interactive/components/visual-truncate.ts\";\nimport { theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { createChildProcessEnvironment, waitForChildProcess } from \"../../utils/child-process.ts\";\nimport {\n\tgetShellConfig,\n\tgetShellEnv,\n\tkillProcessTree,\n\ttrackDetachedChildPid,\n\tuntrackDetachedChildPid,\n} from \"../../utils/shell.ts\";\nimport type { AsyncJobManager } from \"../async/job-manager.js\";\nimport type { AsyncJobDeliveryMessage } from \"../async/types.js\";\nimport type { BashResult } from \"../bash-executor.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport { startAsyncBashCommand } from \"./bash-async-execution.js\";\nimport { abortManagedBashJob, getManagedBashJob } from \"./bash-async-jobs.js\";\nimport {\n\ttype BashInterceptorRule,\n\tcheckBashInterceptionCandidates,\n\tDEFAULT_BASH_INTERCEPTOR_RULES,\n} from \"./bash-interceptor.ts\";\nimport { stripLeadingCdCommand } from \"./bash-leading-cd.ts\";\nimport { executeNativePty } from \"./bash-pty-native.ts\";\nimport { applyBashSessionEnvironment, snapshotBashSessionEnvironment } from \"./bash-session-environment.ts\";\nimport { OutputAccumulator } from \"./output-accumulator.ts\";\nimport { getTextOutput, invalidArgText, str } from \"./render-utils.ts\";\nimport { expandShellInternalUrls, type InternalResourceContext } from \"./resource-selectors.ts\";\nimport { invalidateNativeSearchCache } from \"./search-native.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize, type TruncationResult } from \"./truncate.ts\";\n\nconst envSchema = Type.Unsafe<Record<string, string>>({\n\ttype: \"object\",\n\tdescription: \"Environment variables to add or override.\",\n\tadditionalProperties: { type: \"string\" },\n\tpropertyNames: { pattern: \"^[A-Za-z_][A-Za-z0-9_]*$\" },\n});\nconst bashBaseSchema = Type.Object(\n\t{\n\t\tcommand: Type.String({ description: \"Shell command to execute.\" }),\n\t\tenv: Type.Optional(envSchema),\n\t\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds.\" })),\n\t\tcwd: Type.Optional(Type.String({ description: \"Working directory for the command.\" })),\n\t\tpty: Type.Optional(Type.Boolean({ description: \"Run with PTY handling.\" })),\n\t},\n\t{ additionalProperties: false },\n);\nconst bashSchema = Type.Object(\n\t{ ...bashBaseSchema.properties, async: Type.Optional(Type.Boolean({ description: \"Run as a background job.\" })) },\n\t{ additionalProperties: false },\n);\nexport const bashToolSystemPromptContribution = Object.freeze({\n\tsnippet: \"Execute a shell command.\",\n\tguidelines: Object.freeze([\n\t\t\"You can inspect ATOMIC_* or PI_* environment variables for current model and session details.\",\n\t] as const),\n} as const);\nexport type BashToolInput = Static<typeof bashSchema>;\nexport interface BashToolDetails {\n\ttruncation?: TruncationResult;\n\tfullOutputPath?: string;\n\texitCode?: number | null;\n\tasync?: {\n\t\tjobId: string;\n\t\ttype: \"bash\";\n\t\tstate: \"running\" | \"completed\" | \"failed\";\n\t\tcommand?: string;\n\t\tstatus?: \"running\" | \"completed\" | \"failed\";\n\t};\n\ttimeoutSeconds?: number;\n\trequestedTimeoutSeconds?: number;\n\twallTimeMs?: number;\n}\nconst DEFAULT_TIMEOUT_SECONDS = 300,\n\tMAX_TIMEOUT_SECONDS = 3600;\nfunction validateExplicitTimeoutSeconds(timeout: number): void {\n\tif (!Number.isFinite(timeout) || timeout <= 0 || timeout > MAX_TIMEOUT_SECONDS)\n\t\tthrow new Error(\n\t\t\t`Invalid timeout ${String(timeout)}: timeout must be a finite number greater than 0 and no more than ${MAX_TIMEOUT_SECONDS} seconds`,\n\t\t);\n}\nfunction normalizeTimeoutSeconds(timeout: number | undefined): number {\n\tif (timeout === undefined) return DEFAULT_TIMEOUT_SECONDS;\n\tvalidateExplicitTimeoutSeconds(timeout);\n\treturn Math.max(1, Math.floor(timeout));\n}\nexport type BashOutputChannel = \"stdout\" | \"stderr\";\nexport interface BashOperations {\n\texec: (\n\t\tcommand: string,\n\t\tcwd: string,\n\t\toptions: {\n\t\t\tonData: (data: Buffer, channel?: BashOutputChannel) => void;\n\t\t\tsignal?: AbortSignal;\n\t\t\ttimeout?: number;\n\t\t\tenv?: NodeJS.ProcessEnv;\n\t\t\tpty?: boolean;\n\t\t},\n\t) => Promise<{ exitCode: number | null }>;\n}\nexport function createLocalBashOperations(options?: { shellPath?: string }): BashOperations {\n\treturn {\n\t\texec: async (command, cwd, { onData, signal, timeout, env, pty }) => {\n\t\t\tif (timeout !== undefined) validateExplicitTimeoutSeconds(timeout);\n\t\t\tif (pty && process.env.PI_NO_PTY !== \"1\" && process.env.ATOMIC_NO_PTY !== \"1\") {\n\t\t\t\ttry {\n\t\t\t\t\treturn await executeNativePty(command, cwd, {\n\t\t\t\t\t\tonData: (data) => onData(data, \"stdout\"),\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\tenv,\n\t\t\t\t\t\tshellPath: options?.shellPath,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst message = String(error instanceof Error ? error.message : error);\n\t\t\t\t\tif (!message.includes(\"Native PTY\") && !message.includes(\"PtySession\")) throw error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst shellConfig = getShellConfig(options?.shellPath);\n\t\t\ttry {\n\t\t\t\tconst cwdStat = await fsStat(cwd);\n\t\t\t\tif (!cwdStat.isDirectory()) throw new Error(`Working directory is not a directory: ${cwd}`);\n\t\t\t\tawait fsAccess(cwd, constants.F_OK);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof Error && error.message.startsWith(\"Working directory is not a directory\")) throw error;\n\t\t\t\tthrow new Error(`Working directory does not exist: ${cwd}\\nCannot execute bash commands.`);\n\t\t\t}\n\t\t\tif (signal?.aborted) throw new Error(\"aborted\");\n\t\t\tconst commandFromStdin = shellConfig.commandTransport === \"stdin\";\n\t\t\tconst child = spawn(shellConfig.shell, commandFromStdin ? shellConfig.args : [...shellConfig.args, command], {\n\t\t\t\tcwd,\n\t\t\t\tdetached: process.platform !== \"win32\",\n\t\t\t\tenv: createChildProcessEnvironment(undefined, env ?? getShellEnv()),\n\t\t\t\tstdio: [commandFromStdin ? \"pipe\" : \"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\tif (commandFromStdin) {\n\t\t\t\tchild.stdin?.on(\"error\", () => {});\n\t\t\t\tchild.stdin?.end(command);\n\t\t\t}\n\t\t\tif (child.pid) trackDetachedChildPid(child.pid);\n\t\t\tlet timedOut = false;\n\t\t\tlet timeoutHandle: NodeJS.Timeout | undefined;\n\t\t\tconst onAbort = () => {\n\t\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tif (timeout !== undefined && timeout > 0) {\n\t\t\t\t\ttimeoutHandle = setTimeout(() => {\n\t\t\t\t\t\ttimedOut = true;\n\t\t\t\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\t\t\t}, timeout * 1000);\n\t\t\t\t}\n\t\t\t\tchild.stdout?.on(\"data\", (data: Buffer) => onData(data, \"stdout\"));\n\t\t\t\tchild.stderr?.on(\"data\", (data: Buffer) => onData(data, \"stderr\"));\n\t\t\t\tif (signal) {\n\t\t\t\t\tif (signal.aborted) onAbort();\n\t\t\t\t\telse signal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t}\n\t\t\t\tconst exitCode = await waitForChildProcess(child);\n\t\t\t\tif (signal?.aborted) throw new Error(\"aborted\");\n\t\t\t\tif (timedOut) {\n\t\t\t\t\tthrow new Error(`timeout:${timeout}`);\n\t\t\t\t}\n\t\t\t\treturn { exitCode };\n\t\t\t} finally {\n\t\t\t\tif (child.pid) untrackDetachedChildPid(child.pid);\n\t\t\t\tif (timeoutHandle) clearTimeout(timeoutHandle);\n\t\t\t\tif (signal) signal.removeEventListener(\"abort\", onAbort);\n\t\t\t}\n\t\t},\n\t};\n}\nexport interface BashSpawnContext {\n\tcommand: string;\n\tcwd: string;\n\tenv: NodeJS.ProcessEnv;\n}\nexport type BashSpawnHook = (context: BashSpawnContext) => BashSpawnContext;\nfunction resolveSpawnContext(\n\tcommand: string,\n\tcwd: string,\n\tsessionEnvironment: NodeJS.ProcessEnv,\n\tspawnHook?: BashSpawnHook,\n): BashSpawnContext {\n\tconst baseContext: BashSpawnContext = { command, cwd, env: { ...getShellEnv() } };\n\tapplyBashSessionEnvironment(baseContext.env, sessionEnvironment);\n\treturn spawnHook ? spawnHook(baseContext) : baseContext;\n}\nexport interface BashInterceptorResult {\n\toperations?: BashOperations;\n\tresult?: BashResult;\n}\nexport type BashInterceptor = (\n\tcontext: BashSpawnContext,\n) => Promise<BashInterceptorResult | undefined> | BashInterceptorResult | undefined;\nexport interface BashToolOptions {\n\toperations?: BashOperations;\n\t/** Expose the execution-time Atomic session snapshot and PI compatibility aliases. Default: true. */\n\texposeSessionEnvironment?: boolean;\n\t/** Prefix prepended to every shell command before execution. */\n\tcommandPrefix?: string;\n\t/** Override shell executable resolution for local bash operations. */\n\tshellPath?: string;\n\t/** Last-mile hook for rewriting the command/cwd/env spawn context. */\n\tspawnHook?: BashSpawnHook;\n\t/** Optional command interceptor used by extensions and parity tests. */\n\tinterceptor?: BashInterceptor;\n\tinterceptorEnabled?: boolean | (() => boolean);\n\tavailableTools?: string[];\n\tinterceptorRules?: BashInterceptorRule[];\n\t/** Enable background bash jobs and session-managed async result delivery. */\n\tasyncEnabled?: boolean;\n\tasyncJobManager?: AsyncJobManager;\n\tasyncJobDeliveryHandler?: (message: AsyncJobDeliveryMessage) => void | Promise<void>;\n\tasyncJobSessionId?: symbol;\n\t/**\n\t * Session-scoped directory for overflow logs, resolved per execution so a\n\t * session switch (fork, branch, resume) follows the live transcript session.\n\t */\n\tsessionTempDir?: string | (() => string | undefined);\n}\nconst BASH_PREVIEW_LINES = 5,\n\tBASH_UPDATE_THROTTLE_MS = 100;\nfunction bashResultToToolResult(result: BashResult): {\n\tcontent: Array<{ type: \"text\"; text: string }>;\n\tdetails: BashToolDetails | undefined;\n} {\n\tconst details: BashToolDetails | undefined = result.truncated\n\t\t? { fullOutputPath: result.fullOutputPath }\n\t\t: undefined;\n\tconst status = result.cancelled\n\t\t? \"Command aborted\"\n\t\t: result.exitCode && result.exitCode !== 0\n\t\t\t? `Command exited with code ${result.exitCode}`\n\t\t\t: undefined;\n\tconst text = `${result.output || \"(no output)\"}${status ? `\\n\\n${status}` : \"\"}`;\n\treturn { content: [{ type: \"text\", text }], details };\n}\ntype BashRenderState = {\n\tstartedAt: number | undefined;\n\tendedAt: number | undefined;\n\tinterval: NodeJS.Timeout | undefined;\n};\ntype BashResultRenderState = {\n\tcachedWidth: number | undefined;\n\tcachedLines: string[] | undefined;\n\tcachedSkipped: number | undefined;\n};\nclass BashResultRenderComponent extends Container {\n\tstate: BashResultRenderState = {\n\t\tcachedWidth: undefined,\n\t\tcachedLines: undefined,\n\t\tcachedSkipped: undefined,\n\t};\n}\nfunction formatDuration(ms: number): string {\n\tconst totalSeconds = Math.floor(Math.max(0, ms) / 1000);\n\tconst hours = Math.floor(totalSeconds / 3600);\n\tconst minutes = Math.floor((totalSeconds % 3600) / 60);\n\tconst seconds = totalSeconds % 60;\n\tif (hours > 0) return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;\n\tif (minutes > 0) return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;\n\treturn `${seconds}s`;\n}\nfunction formatBashCall(args: { command?: string; timeout?: number } | undefined): string {\n\tconst command = str(args?.command);\n\tconst timeout = args?.timeout as number | undefined;\n\tconst timeoutSuffix = timeout ? theme.fg(\"muted\", ` (timeout ${timeout}s)`) : \"\";\n\tconst commandDisplay = command === null ? invalidArgText(theme) : command ? command : theme.fg(\"toolOutput\", \"...\");\n\treturn theme.fg(\"toolTitle\", theme.bold(`$ ${commandDisplay}`)) + timeoutSuffix;\n}\nfunction rebuildBashResultRenderComponent(\n\tcomponent: BashResultRenderComponent,\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: BashToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\tshowImages: boolean,\n\tstartedAt: number | undefined,\n\tendedAt: number | undefined,\n): void {\n\tconst state = component.state;\n\tcomponent.clear();\n\tlet output = getTextOutput(result, showImages).trim();\n\tconst truncation = result.details?.truncation;\n\tconst fullOutputPath = result.details?.fullOutputPath;\n\tif (!options.isPartial && truncation?.truncated && fullOutputPath && output.endsWith(\"]\")) {\n\t\tconst footerStart = output.lastIndexOf(\"\\n\\n[\");\n\t\tif (footerStart !== -1 && output.slice(footerStart).includes(fullOutputPath)) {\n\t\t\toutput = output.slice(0, footerStart).trimEnd();\n\t\t}\n\t}\n\tif (output) {\n\t\tconst styledOutput = output\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t\t.join(\"\\n\");\n\t\tif (options.expanded) {\n\t\t\tcomponent.addChild(new Text(`\\n${styledOutput}`, 0, 0));\n\t\t} else {\n\t\t\tcomponent.addChild({\n\t\t\t\trender: (width: number) => {\n\t\t\t\t\tif (state.cachedLines === undefined || state.cachedWidth !== width) {\n\t\t\t\t\t\tconst preview = truncateToVisualLines(styledOutput, BASH_PREVIEW_LINES, width);\n\t\t\t\t\t\tstate.cachedLines = preview.visualLines;\n\t\t\t\t\t\tstate.cachedSkipped = preview.skippedCount;\n\t\t\t\t\t\tstate.cachedWidth = width;\n\t\t\t\t\t}\n\t\t\t\t\tif (state.cachedSkipped && state.cachedSkipped > 0) {\n\t\t\t\t\t\tconst hint =\n\t\t\t\t\t\t\ttheme.fg(\"muted\", \"... \") +\n\t\t\t\t\t\t\tparenthesizedKeyHint(\"app.tools.expand\", \"Expand\", `${state.cachedSkipped} earlier lines`);\n\t\t\t\t\t\treturn [\"\", truncateToWidth(hint, width, \"...\"), ...(state.cachedLines ?? [])];\n\t\t\t\t\t}\n\t\t\t\t\treturn [\"\", ...(state.cachedLines ?? [])];\n\t\t\t\t},\n\t\t\t\tinvalidate: () => {\n\t\t\t\t\tstate.cachedWidth = undefined;\n\t\t\t\t\tstate.cachedLines = undefined;\n\t\t\t\t\tstate.cachedSkipped = undefined;\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\tif (truncation?.truncated || fullOutputPath) {\n\t\tconst warnings: string[] = [];\n\t\tif (fullOutputPath) {\n\t\t\twarnings.push(`Full output: ${fullOutputPath}`);\n\t\t}\n\t\tif (truncation?.truncated) {\n\t\t\tif (truncation.truncatedBy === \"lines\") {\n\t\t\t\twarnings.push(`Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`);\n\t\t\t} else {\n\t\t\t\twarnings.push(\n\t\t\t\t\t`Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tcomponent.addChild(new Text(`\\n${theme.fg(\"warning\", `[${warnings.join(\". \")}]`)}`, 0, 0));\n\t}\n\tif (startedAt !== undefined) {\n\t\tconst label = options.isPartial ? \"Elapsed\" : \"Took\";\n\t\tconst endTime = endedAt ?? Date.now();\n\t\tcomponent.addChild(new Text(`\\n${theme.fg(\"muted\", `${label} ${formatDuration(endTime - startedAt)}`)}`, 0, 0));\n\t}\n}\nexport function createBashToolDefinition(\n\tcwd: string,\n\toptions?: BashToolOptions,\n): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState> {\n\tconst defaultOps = options?.operations ?? createLocalBashOperations({ shellPath: options?.shellPath });\n\tconst commandPrefix = options?.commandPrefix,\n\t\texposeSessionEnvironment = options?.exposeSessionEnvironment ?? true;\n\tconst spawnHook = options?.spawnHook;\n\tconst interceptor = options?.interceptor;\n\tconst isInterceptorEnabled = (): boolean =>\n\t\ttypeof options?.interceptorEnabled === \"function\"\n\t\t\t? options.interceptorEnabled()\n\t\t\t: (options?.interceptorEnabled ?? !!interceptor);\n\tconst availableTools = options?.availableTools ?? [\"read\", \"search\", \"find\", \"edit\", \"write\"];\n\tconst interceptorRules = options?.interceptorRules ?? DEFAULT_BASH_INTERCEPTOR_RULES;\n\tconst asyncEnabled = options?.asyncEnabled ?? false;\n\tconst asyncJobManager = options?.asyncJobManager,\n\t\tasyncJobDeliveryHandler = options?.asyncJobDeliveryHandler,\n\t\tasyncJobSessionId = options?.asyncJobSessionId;\n\tconst sessionTempDirOption = options?.sessionTempDir;\n\tconst resolveSessionTempDir = (): string | undefined =>\n\t\ttypeof sessionTempDirOption === \"function\" ? sessionTempDirOption() : sessionTempDirOption;\n\treturn {\n\t\tname: \"bash\",\n\t\tlabel: \"bash\",\n\t\tdescription: \"Execute a shell command in the session workspace, with optional PTY or background-job handling.\",\n\t\tpromptSnippet: bashToolSystemPromptContribution.snippet,\n\t\tpromptGuidelines: exposeSessionEnvironment ? [...bashToolSystemPromptContribution.guidelines] : undefined,\n\t\tparameters: asyncEnabled ? bashSchema : (bashBaseSchema as typeof bashSchema),\n\t\tmaxResultSizeChars: Infinity,\n\t\tasync execute(_toolCallId, bashCommand: BashToolInput, signal?: AbortSignal, onUpdate?, _ctx?) {\n\t\t\tconst { command } = bashCommand;\n\t\t\tconst jobStatusMatch = command.match(/^__atomic_bash_job\\s+(\\S+)$/);\n\t\t\tif (jobStatusMatch) {\n\t\t\t\tconst job = getManagedBashJob(jobStatusMatch[1]!);\n\t\t\t\tif (!job) throw new Error(`Unknown bash async job: ${jobStatusMatch[1]}`);\n\t\t\t\tif (job.status !== \"running\") asyncJobManager?.acknowledgeDeliveries([job.jobId]);\n\t\t\t\tconst text = [\n\t\t\t\t\t`Job ${job.jobId}: ${job.status}`,\n\t\t\t\t\t`Command: ${job.command}`,\n\t\t\t\t\tjob.error ? `Error: ${job.error}` : undefined,\n\t\t\t\t\tjob.output,\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\"\\n\");\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text }],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tasync: {\n\t\t\t\t\t\t\tjobId: job.jobId,\n\t\t\t\t\t\t\ttype: \"bash\",\n\t\t\t\t\t\t\tstate: job.status,\n\t\t\t\t\t\t\tcommand: job.command,\n\t\t\t\t\t\t\tstatus: job.status,\n\t\t\t\t\t\t},\n\t\t\t\t\t\texitCode: job.exitCode,\n\t\t\t\t\t\ttimeoutSeconds: job.timeoutSeconds,\n\t\t\t\t\t\t...(job.requestedTimeoutSeconds !== undefined\n\t\t\t\t\t\t\t? { requestedTimeoutSeconds: job.requestedTimeoutSeconds }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(job.fullOutputPath ? { fullOutputPath: job.fullOutputPath } : {}),\n\t\t\t\t\t\twallTimeMs: (job.endedAt ?? Date.now()) - job.startedAt,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst jobCancelMatch = command.match(/^__atomic_bash_job_cancel\\s+(\\S+)$/);\n\t\t\tif (jobCancelMatch) {\n\t\t\t\tconst job = abortManagedBashJob(jobCancelMatch[1]!);\n\t\t\t\tif (!job) throw new Error(`Unknown bash async job: ${jobCancelMatch[1]}`);\n\t\t\t\tasyncJobManager?.acknowledgeDeliveries([job.jobId]);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `Cancellation requested for bash job ${job.jobId}` }],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tasync: {\n\t\t\t\t\t\t\tjobId: job.jobId,\n\t\t\t\t\t\t\ttype: \"bash\",\n\t\t\t\t\t\t\tstate: job.status,\n\t\t\t\t\t\t\tcommand: job.command,\n\t\t\t\t\t\t\tstatus: job.status,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst timeout = normalizeTimeoutSeconds(bashCommand.timeout);\n\t\t\tconst sessionEnvironment = snapshotBashSessionEnvironment(_ctx, exposeSessionEnvironment);\n\t\t\tconst resourceCtx = _ctx as InternalResourceContext | undefined;\n\t\t\tconst hasExplicitCwd = typeof bashCommand.cwd === \"string\";\n\t\t\tconst rawStrippedContext = hasExplicitCwd ? undefined : stripLeadingCdCommand(command, cwd);\n\t\t\tconst interceptorEnabled = isInterceptorEnabled();\n\t\t\tif (interceptorEnabled)\n\t\t\t\tcheckBashInterceptionCandidates([command, rawStrippedContext?.command], availableTools, interceptorRules);\n\t\t\tconst cwdInput = hasExplicitCwd ? await expandShellInternalUrls(bashCommand.cwd!, cwd, resourceCtx) : cwd,\n\t\t\t\trequestedCwd = resolvePath(cwd, cwdInput);\n\t\t\tconst expandedCommand = await expandShellInternalUrls(command, cwd, resourceCtx, true);\n\t\t\tconst strippedExpandedContext = hasExplicitCwd\n\t\t\t\t? undefined\n\t\t\t\t: stripLeadingCdCommand(expandedCommand, requestedCwd);\n\t\t\tconst resolvedCommand = commandPrefix ? `${commandPrefix}\\n${expandedCommand}` : expandedCommand;\n\t\t\tconst spawnContext = resolveSpawnContext(resolvedCommand, requestedCwd, sessionEnvironment, spawnHook);\n\t\t\tconst strippedCdContext = strippedExpandedContext\n\t\t\t\t? resolveSpawnContext(\n\t\t\t\t\t\tcommandPrefix\n\t\t\t\t\t\t\t? `${commandPrefix}\\n${strippedExpandedContext.command}`\n\t\t\t\t\t\t\t: strippedExpandedContext.command,\n\t\t\t\t\t\tstrippedExpandedContext.cwd,\n\t\t\t\t\t\tsessionEnvironment,\n\t\t\t\t\t\tspawnHook,\n\t\t\t\t\t)\n\t\t\t\t: undefined;\n\t\t\tif (interceptorEnabled)\n\t\t\t\tcheckBashInterceptionCandidates(\n\t\t\t\t\t[\n\t\t\t\t\t\texpandedCommand,\n\t\t\t\t\t\tstrippedExpandedContext?.command,\n\t\t\t\t\t\tresolvedCommand,\n\t\t\t\t\t\tspawnContext.command,\n\t\t\t\t\t\tstrippedCdContext?.command,\n\t\t\t\t\t],\n\t\t\t\t\tavailableTools,\n\t\t\t\t\tinterceptorRules,\n\t\t\t\t);\n\t\t\tlet expandedEnv: NodeJS.ProcessEnv | undefined;\n\t\t\tif (bashCommand.env) {\n\t\t\t\texpandedEnv = {};\n\t\t\t\tfor (const [key, value] of Object.entries(bashCommand.env)) {\n\t\t\t\t\tif (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) throw new Error(`Invalid bash env name: ${key}`);\n\t\t\t\t\texpandedEnv[key] = await expandShellInternalUrls(value, cwd, resourceCtx);\n\t\t\t\t}\n\t\t\t\tspawnContext.env = { ...spawnContext.env, ...expandedEnv };\n\t\t\t}\n\t\t\tif (strippedCdContext && expandedEnv) strippedCdContext.env = { ...strippedCdContext.env, ...expandedEnv };\n\t\t\tapplyBashSessionEnvironment(spawnContext.env, sessionEnvironment);\n\t\t\tif (strippedCdContext) applyBashSessionEnvironment(strippedCdContext.env, sessionEnvironment);\n\t\t\tconst primaryInterception = interceptorEnabled && interceptor ? await interceptor(spawnContext) : undefined;\n\t\t\tconst fallbackInterception =\n\t\t\t\t!primaryInterception && strippedCdContext && interceptorEnabled && interceptor\n\t\t\t\t\t? await interceptor(strippedCdContext)\n\t\t\t\t\t: undefined;\n\t\t\tconst intercepted = primaryInterception ?? fallbackInterception;\n\t\t\tif (intercepted?.result) return bashResultToToolResult(intercepted.result);\n\t\t\tconst ops = intercepted?.operations ?? defaultOps;\n\t\t\tconst executionContext = primaryInterception ? spawnContext : (strippedCdContext ?? spawnContext);\n\t\t\tif (bashCommand.async) {\n\t\t\t\tif (!asyncEnabled) throw new Error(\"bash async execution is disabled\");\n\t\t\t\treturn startAsyncBashCommand({\n\t\t\t\t\tcommand: executionContext.command,\n\t\t\t\t\tcwd: executionContext.cwd,\n\t\t\t\t\tenv: executionContext.env,\n\t\t\t\t\tpty: bashCommand.pty,\n\t\t\t\t\ttimeoutSeconds: timeout,\n\t\t\t\t\trequestedTimeoutSeconds:\n\t\t\t\t\t\tbashCommand.timeout !== undefined && bashCommand.timeout !== timeout\n\t\t\t\t\t\t\t? bashCommand.timeout\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tsignal,\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tmanager: asyncJobManager,\n\t\t\t\t\tdeliveryHandler: asyncJobDeliveryHandler,\n\t\t\t\t\tsessionId: asyncJobSessionId,\n\t\t\t\t\tsessionTempDir: resolveSessionTempDir(),\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst output = new OutputAccumulator({\n\t\t\t\ttempFilePrefix: `${APP_NAME}-bash`,\n\t\t\t\ttempDir: resolveSessionTempDir(),\n\t\t\t});\n\t\t\tlet acceptingOutput = true;\n\t\t\tlet updateTimer: NodeJS.Timeout | undefined;\n\t\t\tlet updateDirty = false;\n\t\t\tlet lastUpdateAt = 0;\n\t\t\tconst emitOutputUpdate = () => {\n\t\t\t\tif (!onUpdate || !updateDirty) return;\n\t\t\t\tupdateDirty = false;\n\t\t\t\tlastUpdateAt = Date.now();\n\t\t\t\tconst snapshot = output.snapshot({ persistIfTruncated: true });\n\t\t\t\tonUpdate({\n\t\t\t\t\tcontent: [{ type: \"text\", text: snapshot.content || \"\" }],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\ttruncation: snapshot.truncation.truncated ? snapshot.truncation : undefined,\n\t\t\t\t\t\tfullOutputPath: snapshot.fullOutputPath,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst clearUpdateTimer = () => {\n\t\t\t\tif (updateTimer) {\n\t\t\t\t\tclearTimeout(updateTimer);\n\t\t\t\t\tupdateTimer = undefined;\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst scheduleOutputUpdate = () => {\n\t\t\t\tif (!onUpdate) return;\n\t\t\t\tupdateDirty = true;\n\t\t\t\tconst delay = BASH_UPDATE_THROTTLE_MS - (Date.now() - lastUpdateAt);\n\t\t\t\tif (delay <= 0) {\n\t\t\t\t\tclearUpdateTimer();\n\t\t\t\t\temitOutputUpdate();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tupdateTimer ??= setTimeout(() => {\n\t\t\t\t\tupdateTimer = undefined;\n\t\t\t\t\temitOutputUpdate();\n\t\t\t\t}, delay);\n\t\t\t};\n\t\t\tif (onUpdate) {\n\t\t\t\tonUpdate({ content: [], details: undefined });\n\t\t\t}\n\t\t\tconst handleData = (data: Buffer) => {\n\t\t\t\tif (!acceptingOutput) return;\n\t\t\t\toutput.append(data);\n\t\t\t\tscheduleOutputUpdate();\n\t\t\t};\n\t\t\tconst finishOutput = async () => {\n\t\t\t\tacceptingOutput = false;\n\t\t\t\toutput.finish();\n\t\t\t\tclearUpdateTimer();\n\t\t\t\temitOutputUpdate();\n\t\t\t\tconst snapshot = output.snapshot({ persistIfTruncated: true });\n\t\t\t\ttry {\n\t\t\t\t\tawait output.closeTempFile();\n\t\t\t\t} catch {\n\t\t\t\t\t// The spill file could not be flushed. Keep the truncated result, but\n\t\t\t\t\t// re-read the snapshot so the now-cleared path is not advertised.\n\t\t\t\t\treturn output.snapshot();\n\t\t\t\t}\n\t\t\t\treturn snapshot;\n\t\t\t};\n\t\t\tconst formatOutput = (snapshot: Awaited<ReturnType<typeof finishOutput>>, emptyText = \"(no output)\") => {\n\t\t\t\tconst truncation = snapshot.truncation;\n\t\t\t\tlet text = snapshot.content || emptyText;\n\t\t\t\tlet details: BashToolDetails | undefined;\n\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\tdetails = { truncation, fullOutputPath: snapshot.fullOutputPath };\n\t\t\t\t\tconst startLine = truncation.totalLines - truncation.outputLines + 1;\n\t\t\t\t\tconst endLine = truncation.totalLines;\n\t\t\t\t\t// Persistence can be refused (a temp directory we will not write\n\t\t\t\t\t// through, a full or read-only disk), and then there is no path to\n\t\t\t\t\t// name. Every other renderer already omits the clause; this one must\n\t\t\t\t\t// too, rather than handing the model the string \"undefined\".\n\t\t\t\t\tconst fullOutputNote = snapshot.fullOutputPath ? ` Full output: ${snapshot.fullOutputPath}` : \"\";\n\t\t\t\t\tif (truncation.lastLinePartial) {\n\t\t\t\t\t\tconst lastLineSize = formatSize(output.getLastLineBytes());\n\t\t\t\t\t\ttext += `\\n\\n[Showing last ${formatSize(truncation.outputBytes)} of line ${endLine} (line is ${lastLineSize}).${fullOutputNote}]`;\n\t\t\t\t\t} else if (truncation.truncatedBy === \"lines\") {\n\t\t\t\t\t\ttext += `\\n\\n[Showing lines ${startLine}-${endLine} of ${truncation.totalLines}.${fullOutputNote}]`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttext += `\\n\\n[Showing lines ${startLine}-${endLine} of ${truncation.totalLines} (${formatSize(DEFAULT_MAX_BYTES)} limit).${fullOutputNote}]`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn { text, details };\n\t\t\t};\n\t\t\tconst startedAt = Date.now();\n\t\t\tconst withTiming = (details: BashToolDetails | undefined): BashToolDetails => ({\n\t\t\t\t...details,\n\t\t\t\ttimeoutSeconds: timeout,\n\t\t\t\t...(bashCommand.timeout !== undefined && bashCommand.timeout !== timeout\n\t\t\t\t\t? { requestedTimeoutSeconds: bashCommand.timeout }\n\t\t\t\t\t: {}),\n\t\t\t\twallTimeMs: Date.now() - startedAt,\n\t\t\t});\n\t\t\tconst appendStatus = (text: string, status: string) => `${text ? `${text}\\n\\n` : \"\"}${status}`;\n\t\t\ttry {\n\t\t\t\tlet exitCode: number | null;\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await ops.exec(executionContext.command, executionContext.cwd, {\n\t\t\t\t\t\tonData: handleData,\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\tenv: executionContext.env,\n\t\t\t\t\t\tpty: bashCommand.pty,\n\t\t\t\t\t});\n\t\t\t\t\texitCode = result.exitCode;\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst snapshot = await finishOutput();\n\t\t\t\t\tconst { text } = formatOutput(snapshot, \"\");\n\t\t\t\t\tif (err instanceof Error && err.message === \"aborted\") {\n\t\t\t\t\t\tthrow new Error(appendStatus(text, \"Command aborted\"));\n\t\t\t\t\t}\n\t\t\t\t\tif (err instanceof Error && err.message.startsWith(\"timeout:\")) {\n\t\t\t\t\t\tconst timeoutSecs = err.message.split(\":\")[1];\n\t\t\t\t\t\tthrow new Error(appendStatus(text, `Command timed out after ${timeoutSecs} seconds`));\n\t\t\t\t\t}\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tconst snapshot = await finishOutput();\n\t\t\t\tconst { text: outputText, details } = formatOutput(snapshot);\n\t\t\t\tif (exitCode !== 0 && exitCode !== null) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: appendStatus(outputText, `Command exited with code ${exitCode}`) }],\n\t\t\t\t\t\tdetails: { ...withTiming(details), exitCode },\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn { content: [{ type: \"text\", text: outputText }], details: withTiming(details) };\n\t\t\t} finally {\n\t\t\t\tinvalidateNativeSearchCache();\n\t\t\t\tclearUpdateTimer();\n\t\t\t}\n\t\t},\n\t\trenderCall(args, _theme, context) {\n\t\t\tconst state = context.state;\n\t\t\tif (context.executionStarted && state.startedAt === undefined) {\n\t\t\t\tstate.startedAt = Date.now();\n\t\t\t\tstate.endedAt = undefined;\n\t\t\t}\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatBashCall(args));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, _theme, context) {\n\t\t\tconst state = context.state;\n\t\t\tif (state.startedAt !== undefined && options.isPartial && !state.interval) {\n\t\t\t\tstate.interval = setInterval(() => context.invalidate(), 1000);\n\t\t\t}\n\t\t\tif (!options.isPartial || context.isError) {\n\t\t\t\tstate.endedAt ??= Date.now();\n\t\t\t\tif (state.interval) {\n\t\t\t\t\tclearInterval(state.interval);\n\t\t\t\t\tstate.interval = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst component =\n\t\t\t\t(context.lastComponent as BashResultRenderComponent | undefined) ?? new BashResultRenderComponent();\n\t\t\trebuildBashResultRenderComponent(\n\t\t\t\tcomponent,\n\t\t\t\tresult,\n\t\t\t\toptions,\n\t\t\t\tcontext.showImages,\n\t\t\t\tstate.startedAt,\n\t\t\t\tstate.endedAt,\n\t\t\t);\n\t\t\tcomponent.invalidate();\n\t\t\treturn component;\n\t\t},\n\t};\n}\nexport function createBashTool(cwd: string, options?: BashToolOptions): AgentTool<typeof bashSchema> {\n\treturn wrapToolDefinition(createBashToolDefinition(cwd, options));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,QAAQ,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,IAAI,IAAI,yBAAyB,EAAE,CAAC;YACrG,gCAAgC,CAC/B,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,CAAC,UAAU,EAClB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,OAAO,CACb,CAAC;YACF,SAAS,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QAClB,CAAC;KACD,CAAC;AACH,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAyB;IACpE,OAAO,kBAAkB,CAAC,wBAAwB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import { constants } from \"node:fs\";\nimport { access as fsAccess, stat as fsStat } from \"node:fs/promises\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Container, Text, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport { spawn } from \"child_process\";\nimport { type Static, Type } from \"typebox\";\nimport { APP_NAME } from \"../../config.ts\";\nimport { parenthesizedKeyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport { truncateToVisualLines } from \"../../modes/interactive/components/visual-truncate.ts\";\nimport { theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { createChildProcessEnvironment, waitForChildProcess } from \"../../utils/child-process.ts\";\nimport {\n\tgetShellConfig,\n\tgetShellEnv,\n\tkillProcessTree,\n\ttrackDetachedChildPid,\n\tuntrackDetachedChildPid,\n} from \"../../utils/shell.ts\";\nimport type { BashResult } from \"../bash-executor.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport {\n\ttype BashInterceptorRule,\n\tcheckBashInterceptionCandidates,\n\tDEFAULT_BASH_INTERCEPTOR_RULES,\n} from \"./bash-interceptor.ts\";\nimport { stripLeadingCdCommand } from \"./bash-leading-cd.ts\";\nimport { executeNativePty } from \"./bash-pty-native.ts\";\nimport { applyBashSessionEnvironment, snapshotBashSessionEnvironment } from \"./bash-session-environment.ts\";\nimport { OutputAccumulator } from \"./output-accumulator.ts\";\nimport { getTextOutput, invalidArgText, str } from \"./render-utils.ts\";\nimport { expandShellInternalUrls, type InternalResourceContext } from \"./resource-selectors.ts\";\nimport { invalidateNativeSearchCache } from \"./search-native.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport { DEFAULT_MAX_BYTES, formatSize, type TruncationResult } from \"./truncate.ts\";\n\nconst envSchema = Type.Unsafe<Record<string, string>>({\n\ttype: \"object\",\n\tdescription: \"Environment variables to add or override.\",\n\tadditionalProperties: { type: \"string\" },\n\tpropertyNames: { pattern: \"^[A-Za-z_][A-Za-z0-9_]*$\" },\n});\nconst bashBaseSchema = Type.Object(\n\t{\n\t\tcommand: Type.String({ description: \"Shell command to execute.\" }),\n\t\tenv: Type.Optional(envSchema),\n\t\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds.\" })),\n\t\tcwd: Type.Optional(Type.String({ description: \"Working directory for the command.\" })),\n\t\tpty: Type.Optional(Type.Boolean({ description: \"Run with PTY handling.\" })),\n\t},\n\t{ additionalProperties: false },\n);\nconst bashSchema = bashBaseSchema;\nexport const bashToolSystemPromptContribution = Object.freeze({\n\tsnippet: \"Execute a shell command.\",\n\tguidelines: Object.freeze([\n\t\t\"You can inspect ATOMIC_* or PI_* environment variables for current model and session details.\",\n\t] as const),\n} as const);\nexport type BashToolInput = Static<typeof bashSchema>;\nexport interface BashToolDetails {\n\ttruncation?: TruncationResult;\n\tfullOutputPath?: string;\n\texitCode?: number | null;\n\ttimeoutSeconds?: number;\n\trequestedTimeoutSeconds?: number;\n\twallTimeMs?: number;\n}\nconst DEFAULT_TIMEOUT_SECONDS = 300,\n\tMAX_TIMEOUT_SECONDS = 3600;\nfunction validateExplicitTimeoutSeconds(timeout: number): void {\n\tif (!Number.isFinite(timeout) || timeout <= 0 || timeout > MAX_TIMEOUT_SECONDS)\n\t\tthrow new Error(\n\t\t\t`Invalid timeout ${String(timeout)}: timeout must be a finite number greater than 0 and no more than ${MAX_TIMEOUT_SECONDS} seconds`,\n\t\t);\n}\nfunction normalizeTimeoutSeconds(timeout: number | undefined): number {\n\tif (timeout === undefined) return DEFAULT_TIMEOUT_SECONDS;\n\tvalidateExplicitTimeoutSeconds(timeout);\n\treturn Math.max(1, Math.floor(timeout));\n}\nexport type BashOutputChannel = \"stdout\" | \"stderr\";\nexport interface BashOperations {\n\texec: (\n\t\tcommand: string,\n\t\tcwd: string,\n\t\toptions: {\n\t\t\tonData: (data: Buffer, channel?: BashOutputChannel) => void;\n\t\t\tsignal?: AbortSignal;\n\t\t\ttimeout?: number;\n\t\t\tenv?: NodeJS.ProcessEnv;\n\t\t\tpty?: boolean;\n\t\t},\n\t) => Promise<{ exitCode: number | null }>;\n}\nexport function createLocalBashOperations(options?: { shellPath?: string }): BashOperations {\n\treturn {\n\t\texec: async (command, cwd, { onData, signal, timeout, env, pty }) => {\n\t\t\tif (timeout !== undefined) validateExplicitTimeoutSeconds(timeout);\n\t\t\tif (pty && process.env.PI_NO_PTY !== \"1\" && process.env.ATOMIC_NO_PTY !== \"1\") {\n\t\t\t\ttry {\n\t\t\t\t\treturn await executeNativePty(command, cwd, {\n\t\t\t\t\t\tonData: (data) => onData(data, \"stdout\"),\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\tenv,\n\t\t\t\t\t\tshellPath: options?.shellPath,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst message = String(error instanceof Error ? error.message : error);\n\t\t\t\t\tif (!message.includes(\"Native PTY\") && !message.includes(\"PtySession\")) throw error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst shellConfig = getShellConfig(options?.shellPath);\n\t\t\ttry {\n\t\t\t\tconst cwdStat = await fsStat(cwd);\n\t\t\t\tif (!cwdStat.isDirectory()) throw new Error(`Working directory is not a directory: ${cwd}`);\n\t\t\t\tawait fsAccess(cwd, constants.F_OK);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof Error && error.message.startsWith(\"Working directory is not a directory\")) throw error;\n\t\t\t\tthrow new Error(`Working directory does not exist: ${cwd}\\nCannot execute bash commands.`);\n\t\t\t}\n\t\t\tif (signal?.aborted) throw new Error(\"aborted\");\n\t\t\tconst commandFromStdin = shellConfig.commandTransport === \"stdin\";\n\t\t\tconst child = spawn(shellConfig.shell, commandFromStdin ? shellConfig.args : [...shellConfig.args, command], {\n\t\t\t\tcwd,\n\t\t\t\tdetached: process.platform !== \"win32\",\n\t\t\t\tenv: createChildProcessEnvironment(undefined, env ?? getShellEnv()),\n\t\t\t\tstdio: [commandFromStdin ? \"pipe\" : \"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\tif (commandFromStdin) {\n\t\t\t\tchild.stdin?.on(\"error\", () => {});\n\t\t\t\tchild.stdin?.end(command);\n\t\t\t}\n\t\t\tif (child.pid) trackDetachedChildPid(child.pid);\n\t\t\tlet timedOut = false;\n\t\t\tlet timeoutHandle: NodeJS.Timeout | undefined;\n\t\t\tconst onAbort = () => {\n\t\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tif (timeout !== undefined && timeout > 0) {\n\t\t\t\t\ttimeoutHandle = setTimeout(() => {\n\t\t\t\t\t\ttimedOut = true;\n\t\t\t\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\t\t\t}, timeout * 1000);\n\t\t\t\t}\n\t\t\t\tchild.stdout?.on(\"data\", (data: Buffer) => onData(data, \"stdout\"));\n\t\t\t\tchild.stderr?.on(\"data\", (data: Buffer) => onData(data, \"stderr\"));\n\t\t\t\tif (signal) {\n\t\t\t\t\tif (signal.aborted) onAbort();\n\t\t\t\t\telse signal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t}\n\t\t\t\tconst exitCode = await waitForChildProcess(child);\n\t\t\t\tif (signal?.aborted) throw new Error(\"aborted\");\n\t\t\t\tif (timedOut) {\n\t\t\t\t\tthrow new Error(`timeout:${timeout}`);\n\t\t\t\t}\n\t\t\t\treturn { exitCode };\n\t\t\t} finally {\n\t\t\t\tif (child.pid) untrackDetachedChildPid(child.pid);\n\t\t\t\tif (timeoutHandle) clearTimeout(timeoutHandle);\n\t\t\t\tif (signal) signal.removeEventListener(\"abort\", onAbort);\n\t\t\t}\n\t\t},\n\t};\n}\nexport interface BashSpawnContext {\n\tcommand: string;\n\tcwd: string;\n\tenv: NodeJS.ProcessEnv;\n}\nexport type BashSpawnHook = (context: BashSpawnContext) => BashSpawnContext;\nfunction resolveSpawnContext(\n\tcommand: string,\n\tcwd: string,\n\tsessionEnvironment: NodeJS.ProcessEnv,\n\tspawnHook?: BashSpawnHook,\n): BashSpawnContext {\n\tconst baseContext: BashSpawnContext = { command, cwd, env: { ...getShellEnv() } };\n\tapplyBashSessionEnvironment(baseContext.env, sessionEnvironment);\n\treturn spawnHook ? spawnHook(baseContext) : baseContext;\n}\nexport interface BashInterceptorResult {\n\toperations?: BashOperations;\n\tresult?: BashResult;\n}\nexport type BashInterceptor = (\n\tcontext: BashSpawnContext,\n) => Promise<BashInterceptorResult | undefined> | BashInterceptorResult | undefined;\nexport interface BashToolOptions {\n\toperations?: BashOperations;\n\t/** Expose the execution-time Atomic session snapshot and PI compatibility aliases. Default: true. */\n\texposeSessionEnvironment?: boolean;\n\t/** Prefix prepended to every shell command before execution. */\n\tcommandPrefix?: string;\n\t/** Override shell executable resolution for local bash operations. */\n\tshellPath?: string;\n\t/** Last-mile hook for rewriting the command/cwd/env spawn context. */\n\tspawnHook?: BashSpawnHook;\n\t/** Optional command interceptor used by extensions and parity tests. */\n\tinterceptor?: BashInterceptor;\n\tinterceptorEnabled?: boolean | (() => boolean);\n\tavailableTools?: string[];\n\tinterceptorRules?: BashInterceptorRule[];\n\t/**\n\t * Session-scoped directory for overflow logs, resolved per execution so a\n\t * session switch (fork, branch, resume) follows the live transcript session.\n\t */\n\tsessionTempDir?: string | (() => string | undefined);\n}\nconst BASH_PREVIEW_LINES = 5,\n\tBASH_UPDATE_THROTTLE_MS = 100;\nfunction bashResultToToolResult(result: BashResult): {\n\tcontent: Array<{ type: \"text\"; text: string }>;\n\tdetails: BashToolDetails | undefined;\n} {\n\tconst details: BashToolDetails | undefined = result.truncated\n\t\t? { fullOutputPath: result.fullOutputPath }\n\t\t: undefined;\n\tconst status = result.cancelled\n\t\t? \"Command aborted\"\n\t\t: result.exitCode && result.exitCode !== 0\n\t\t\t? `Command exited with code ${result.exitCode}`\n\t\t\t: undefined;\n\tconst text = `${result.output || \"(no output)\"}${status ? `\\n\\n${status}` : \"\"}`;\n\treturn { content: [{ type: \"text\", text }], details };\n}\ntype BashRenderState = {\n\tstartedAt: number | undefined;\n\tendedAt: number | undefined;\n\tinterval: NodeJS.Timeout | undefined;\n};\ntype BashResultRenderState = {\n\tcachedWidth: number | undefined;\n\tcachedLines: string[] | undefined;\n\tcachedSkipped: number | undefined;\n};\nclass BashResultRenderComponent extends Container {\n\tstate: BashResultRenderState = {\n\t\tcachedWidth: undefined,\n\t\tcachedLines: undefined,\n\t\tcachedSkipped: undefined,\n\t};\n}\nfunction formatDuration(ms: number): string {\n\tconst totalSeconds = Math.floor(Math.max(0, ms) / 1000);\n\tconst hours = Math.floor(totalSeconds / 3600);\n\tconst minutes = Math.floor((totalSeconds % 3600) / 60);\n\tconst seconds = totalSeconds % 60;\n\tif (hours > 0) return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;\n\tif (minutes > 0) return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;\n\treturn `${seconds}s`;\n}\nfunction formatBashCall(args: { command?: string; timeout?: number } | undefined): string {\n\tconst command = str(args?.command);\n\tconst timeout = args?.timeout as number | undefined;\n\tconst timeoutSuffix = timeout ? theme.fg(\"muted\", ` (timeout ${timeout}s)`) : \"\";\n\tconst commandDisplay = command === null ? invalidArgText(theme) : command ? command : theme.fg(\"toolOutput\", \"...\");\n\treturn theme.fg(\"toolTitle\", theme.bold(`$ ${commandDisplay}`)) + timeoutSuffix;\n}\nfunction rebuildBashResultRenderComponent(\n\tcomponent: BashResultRenderComponent,\n\tresult: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tdetails?: BashToolDetails;\n\t},\n\toptions: ToolRenderResultOptions,\n\tshowImages: boolean,\n\tstartedAt: number | undefined,\n\tendedAt: number | undefined,\n): void {\n\tconst state = component.state;\n\tcomponent.clear();\n\tlet output = getTextOutput(result, showImages).trim();\n\tconst truncation = result.details?.truncation;\n\tconst fullOutputPath = result.details?.fullOutputPath;\n\tif (!options.isPartial && truncation?.truncated && fullOutputPath && output.endsWith(\"]\")) {\n\t\tconst footerStart = output.lastIndexOf(\"\\n\\n[\");\n\t\tif (footerStart !== -1 && output.slice(footerStart).includes(fullOutputPath)) {\n\t\t\toutput = output.slice(0, footerStart).trimEnd();\n\t\t}\n\t}\n\tif (output) {\n\t\tconst styledOutput = output\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t\t.join(\"\\n\");\n\t\tif (options.expanded) {\n\t\t\tcomponent.addChild(new Text(`\\n${styledOutput}`, 0, 0));\n\t\t} else {\n\t\t\tcomponent.addChild({\n\t\t\t\trender: (width: number) => {\n\t\t\t\t\tif (state.cachedLines === undefined || state.cachedWidth !== width) {\n\t\t\t\t\t\tconst preview = truncateToVisualLines(styledOutput, BASH_PREVIEW_LINES, width);\n\t\t\t\t\t\tstate.cachedLines = preview.visualLines;\n\t\t\t\t\t\tstate.cachedSkipped = preview.skippedCount;\n\t\t\t\t\t\tstate.cachedWidth = width;\n\t\t\t\t\t}\n\t\t\t\t\tif (state.cachedSkipped && state.cachedSkipped > 0) {\n\t\t\t\t\t\tconst hint =\n\t\t\t\t\t\t\ttheme.fg(\"muted\", \"... \") +\n\t\t\t\t\t\t\tparenthesizedKeyHint(\"app.tools.expand\", \"Expand\", `${state.cachedSkipped} earlier lines`);\n\t\t\t\t\t\treturn [\"\", truncateToWidth(hint, width, \"...\"), ...(state.cachedLines ?? [])];\n\t\t\t\t\t}\n\t\t\t\t\treturn [\"\", ...(state.cachedLines ?? [])];\n\t\t\t\t},\n\t\t\t\tinvalidate: () => {\n\t\t\t\t\tstate.cachedWidth = undefined;\n\t\t\t\t\tstate.cachedLines = undefined;\n\t\t\t\t\tstate.cachedSkipped = undefined;\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\tif (truncation?.truncated || fullOutputPath) {\n\t\tconst warnings: string[] = [];\n\t\tif (fullOutputPath) {\n\t\t\twarnings.push(`Full output: ${fullOutputPath}`);\n\t\t}\n\t\tif (truncation?.truncated) {\n\t\t\tif (truncation.truncatedBy === \"lines\") {\n\t\t\t\twarnings.push(`Truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`);\n\t\t\t} else {\n\t\t\t\twarnings.push(\n\t\t\t\t\t`Truncated: ${truncation.outputLines} lines shown (${formatSize(truncation.maxBytes ?? DEFAULT_MAX_BYTES)} limit)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tcomponent.addChild(new Text(`\\n${theme.fg(\"warning\", `[${warnings.join(\". \")}]`)}`, 0, 0));\n\t}\n\tif (startedAt !== undefined) {\n\t\tconst label = options.isPartial ? \"Elapsed\" : \"Took\";\n\t\tconst endTime = endedAt ?? Date.now();\n\t\tcomponent.addChild(new Text(`\\n${theme.fg(\"muted\", `${label} ${formatDuration(endTime - startedAt)}`)}`, 0, 0));\n\t}\n}\nexport function createBashToolDefinition(\n\tcwd: string,\n\toptions?: BashToolOptions,\n): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState> {\n\tconst defaultOps = options?.operations ?? createLocalBashOperations({ shellPath: options?.shellPath });\n\tconst commandPrefix = options?.commandPrefix,\n\t\texposeSessionEnvironment = options?.exposeSessionEnvironment ?? true;\n\tconst spawnHook = options?.spawnHook;\n\tconst interceptor = options?.interceptor;\n\tconst isInterceptorEnabled = (): boolean =>\n\t\ttypeof options?.interceptorEnabled === \"function\"\n\t\t\t? options.interceptorEnabled()\n\t\t\t: (options?.interceptorEnabled ?? !!interceptor);\n\tconst availableTools = options?.availableTools ?? [\"read\", \"search\", \"find\", \"edit\", \"write\"];\n\tconst interceptorRules = options?.interceptorRules ?? DEFAULT_BASH_INTERCEPTOR_RULES;\n\tconst sessionTempDirOption = options?.sessionTempDir;\n\tconst resolveSessionTempDir = (): string | undefined =>\n\t\ttypeof sessionTempDirOption === \"function\" ? sessionTempDirOption() : sessionTempDirOption;\n\treturn {\n\t\tname: \"bash\",\n\t\tlabel: \"bash\",\n\t\tdescription: \"Execute a shell command in the session workspace, with optional PTY handling.\",\n\t\tpromptSnippet: bashToolSystemPromptContribution.snippet,\n\t\tpromptGuidelines: exposeSessionEnvironment ? [...bashToolSystemPromptContribution.guidelines] : undefined,\n\t\tparameters: bashSchema,\n\t\tmaxResultSizeChars: Infinity,\n\t\tasync execute(_toolCallId, bashCommand: BashToolInput, signal?: AbortSignal, onUpdate?, _ctx?) {\n\t\t\tconst { command } = bashCommand;\n\t\t\tconst timeout = normalizeTimeoutSeconds(bashCommand.timeout);\n\t\t\tconst sessionEnvironment = snapshotBashSessionEnvironment(_ctx, exposeSessionEnvironment);\n\t\t\tconst resourceCtx = _ctx as InternalResourceContext | undefined;\n\t\t\tconst hasExplicitCwd = typeof bashCommand.cwd === \"string\";\n\t\t\tconst rawStrippedContext = hasExplicitCwd ? undefined : stripLeadingCdCommand(command, cwd);\n\t\t\tconst interceptorEnabled = isInterceptorEnabled();\n\t\t\tif (interceptorEnabled)\n\t\t\t\tcheckBashInterceptionCandidates([command, rawStrippedContext?.command], availableTools, interceptorRules);\n\t\t\tconst cwdInput = hasExplicitCwd ? await expandShellInternalUrls(bashCommand.cwd!, cwd, resourceCtx) : cwd,\n\t\t\t\trequestedCwd = resolvePath(cwd, cwdInput);\n\t\t\tconst expandedCommand = await expandShellInternalUrls(command, cwd, resourceCtx, true);\n\t\t\tconst strippedExpandedContext = hasExplicitCwd\n\t\t\t\t? undefined\n\t\t\t\t: stripLeadingCdCommand(expandedCommand, requestedCwd);\n\t\t\tconst resolvedCommand = commandPrefix ? `${commandPrefix}\\n${expandedCommand}` : expandedCommand;\n\t\t\tconst spawnContext = resolveSpawnContext(resolvedCommand, requestedCwd, sessionEnvironment, spawnHook);\n\t\t\tconst strippedCdContext = strippedExpandedContext\n\t\t\t\t? resolveSpawnContext(\n\t\t\t\t\t\tcommandPrefix\n\t\t\t\t\t\t\t? `${commandPrefix}\\n${strippedExpandedContext.command}`\n\t\t\t\t\t\t\t: strippedExpandedContext.command,\n\t\t\t\t\t\tstrippedExpandedContext.cwd,\n\t\t\t\t\t\tsessionEnvironment,\n\t\t\t\t\t\tspawnHook,\n\t\t\t\t\t)\n\t\t\t\t: undefined;\n\t\t\tif (interceptorEnabled)\n\t\t\t\tcheckBashInterceptionCandidates(\n\t\t\t\t\t[\n\t\t\t\t\t\texpandedCommand,\n\t\t\t\t\t\tstrippedExpandedContext?.command,\n\t\t\t\t\t\tresolvedCommand,\n\t\t\t\t\t\tspawnContext.command,\n\t\t\t\t\t\tstrippedCdContext?.command,\n\t\t\t\t\t],\n\t\t\t\t\tavailableTools,\n\t\t\t\t\tinterceptorRules,\n\t\t\t\t);\n\t\t\tlet expandedEnv: NodeJS.ProcessEnv | undefined;\n\t\t\tif (bashCommand.env) {\n\t\t\t\texpandedEnv = {};\n\t\t\t\tfor (const [key, value] of Object.entries(bashCommand.env)) {\n\t\t\t\t\tif (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) throw new Error(`Invalid bash env name: ${key}`);\n\t\t\t\t\texpandedEnv[key] = await expandShellInternalUrls(value, cwd, resourceCtx);\n\t\t\t\t}\n\t\t\t\tspawnContext.env = { ...spawnContext.env, ...expandedEnv };\n\t\t\t}\n\t\t\tif (strippedCdContext && expandedEnv) strippedCdContext.env = { ...strippedCdContext.env, ...expandedEnv };\n\t\t\tapplyBashSessionEnvironment(spawnContext.env, sessionEnvironment);\n\t\t\tif (strippedCdContext) applyBashSessionEnvironment(strippedCdContext.env, sessionEnvironment);\n\t\t\tconst primaryInterception = interceptorEnabled && interceptor ? await interceptor(spawnContext) : undefined;\n\t\t\tconst fallbackInterception =\n\t\t\t\t!primaryInterception && strippedCdContext && interceptorEnabled && interceptor\n\t\t\t\t\t? await interceptor(strippedCdContext)\n\t\t\t\t\t: undefined;\n\t\t\tconst intercepted = primaryInterception ?? fallbackInterception;\n\t\t\tif (intercepted?.result) return bashResultToToolResult(intercepted.result);\n\t\t\tconst ops = intercepted?.operations ?? defaultOps;\n\t\t\tconst executionContext = primaryInterception ? spawnContext : (strippedCdContext ?? spawnContext);\n\t\t\tconst output = new OutputAccumulator({\n\t\t\t\ttempFilePrefix: `${APP_NAME}-bash`,\n\t\t\t\ttempDir: resolveSessionTempDir(),\n\t\t\t});\n\t\t\tlet acceptingOutput = true;\n\t\t\tlet updateTimer: NodeJS.Timeout | undefined;\n\t\t\tlet updateDirty = false;\n\t\t\tlet lastUpdateAt = 0;\n\t\t\tconst emitOutputUpdate = () => {\n\t\t\t\tif (!onUpdate || !updateDirty) return;\n\t\t\t\tupdateDirty = false;\n\t\t\t\tlastUpdateAt = Date.now();\n\t\t\t\tconst snapshot = output.snapshot({ persistIfTruncated: true });\n\t\t\t\tonUpdate({\n\t\t\t\t\tcontent: [{ type: \"text\", text: snapshot.content || \"\" }],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\ttruncation: snapshot.truncation.truncated ? snapshot.truncation : undefined,\n\t\t\t\t\t\tfullOutputPath: snapshot.fullOutputPath,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst clearUpdateTimer = () => {\n\t\t\t\tif (updateTimer) {\n\t\t\t\t\tclearTimeout(updateTimer);\n\t\t\t\t\tupdateTimer = undefined;\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst scheduleOutputUpdate = () => {\n\t\t\t\tif (!onUpdate) return;\n\t\t\t\tupdateDirty = true;\n\t\t\t\tconst delay = BASH_UPDATE_THROTTLE_MS - (Date.now() - lastUpdateAt);\n\t\t\t\tif (delay <= 0) {\n\t\t\t\t\tclearUpdateTimer();\n\t\t\t\t\temitOutputUpdate();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tupdateTimer ??= setTimeout(() => {\n\t\t\t\t\tupdateTimer = undefined;\n\t\t\t\t\temitOutputUpdate();\n\t\t\t\t}, delay);\n\t\t\t};\n\t\t\tif (onUpdate) {\n\t\t\t\tonUpdate({ content: [], details: undefined });\n\t\t\t}\n\t\t\tconst handleData = (data: Buffer) => {\n\t\t\t\tif (!acceptingOutput) return;\n\t\t\t\toutput.append(data);\n\t\t\t\tscheduleOutputUpdate();\n\t\t\t};\n\t\t\tconst finishOutput = async () => {\n\t\t\t\tacceptingOutput = false;\n\t\t\t\toutput.finish();\n\t\t\t\tclearUpdateTimer();\n\t\t\t\temitOutputUpdate();\n\t\t\t\tconst snapshot = output.snapshot({ persistIfTruncated: true });\n\t\t\t\ttry {\n\t\t\t\t\tawait output.closeTempFile();\n\t\t\t\t} catch {\n\t\t\t\t\t// The spill file could not be flushed. Keep the truncated result, but\n\t\t\t\t\t// re-read the snapshot so the now-cleared path is not advertised.\n\t\t\t\t\treturn output.snapshot();\n\t\t\t\t}\n\t\t\t\treturn snapshot;\n\t\t\t};\n\t\t\tconst formatOutput = (snapshot: Awaited<ReturnType<typeof finishOutput>>, emptyText = \"(no output)\") => {\n\t\t\t\tconst truncation = snapshot.truncation;\n\t\t\t\tlet text = snapshot.content || emptyText;\n\t\t\t\tlet details: BashToolDetails | undefined;\n\t\t\t\tif (truncation.truncated) {\n\t\t\t\t\tdetails = { truncation, fullOutputPath: snapshot.fullOutputPath };\n\t\t\t\t\tconst startLine = truncation.totalLines - truncation.outputLines + 1;\n\t\t\t\t\tconst endLine = truncation.totalLines;\n\t\t\t\t\t// Persistence can be refused (a temp directory we will not write\n\t\t\t\t\t// through, a full or read-only disk), and then there is no path to\n\t\t\t\t\t// name. Every other renderer already omits the clause; this one must\n\t\t\t\t\t// too, rather than handing the model the string \"undefined\".\n\t\t\t\t\tconst fullOutputNote = snapshot.fullOutputPath ? ` Full output: ${snapshot.fullOutputPath}` : \"\";\n\t\t\t\t\tif (truncation.lastLinePartial) {\n\t\t\t\t\t\tconst lastLineSize = formatSize(output.getLastLineBytes());\n\t\t\t\t\t\ttext += `\\n\\n[Showing last ${formatSize(truncation.outputBytes)} of line ${endLine} (line is ${lastLineSize}).${fullOutputNote}]`;\n\t\t\t\t\t} else if (truncation.truncatedBy === \"lines\") {\n\t\t\t\t\t\ttext += `\\n\\n[Showing lines ${startLine}-${endLine} of ${truncation.totalLines}.${fullOutputNote}]`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttext += `\\n\\n[Showing lines ${startLine}-${endLine} of ${truncation.totalLines} (${formatSize(DEFAULT_MAX_BYTES)} limit).${fullOutputNote}]`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn { text, details };\n\t\t\t};\n\t\t\tconst startedAt = Date.now();\n\t\t\tconst withTiming = (details: BashToolDetails | undefined): BashToolDetails => ({\n\t\t\t\t...details,\n\t\t\t\ttimeoutSeconds: timeout,\n\t\t\t\t...(bashCommand.timeout !== undefined && bashCommand.timeout !== timeout\n\t\t\t\t\t? { requestedTimeoutSeconds: bashCommand.timeout }\n\t\t\t\t\t: {}),\n\t\t\t\twallTimeMs: Date.now() - startedAt,\n\t\t\t});\n\t\t\tconst appendStatus = (text: string, status: string) => `${text ? `${text}\\n\\n` : \"\"}${status}`;\n\t\t\ttry {\n\t\t\t\tlet exitCode: number | null;\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await ops.exec(executionContext.command, executionContext.cwd, {\n\t\t\t\t\t\tonData: handleData,\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\tenv: executionContext.env,\n\t\t\t\t\t\tpty: bashCommand.pty,\n\t\t\t\t\t});\n\t\t\t\t\texitCode = result.exitCode;\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst snapshot = await finishOutput();\n\t\t\t\t\tconst { text } = formatOutput(snapshot, \"\");\n\t\t\t\t\tif (err instanceof Error && err.message === \"aborted\") {\n\t\t\t\t\t\tthrow new Error(appendStatus(text, \"Command aborted\"));\n\t\t\t\t\t}\n\t\t\t\t\tif (err instanceof Error && err.message.startsWith(\"timeout:\")) {\n\t\t\t\t\t\tconst timeoutSecs = err.message.split(\":\")[1];\n\t\t\t\t\t\tthrow new Error(appendStatus(text, `Command timed out after ${timeoutSecs} seconds`));\n\t\t\t\t\t}\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tconst snapshot = await finishOutput();\n\t\t\t\tconst { text: outputText, details } = formatOutput(snapshot);\n\t\t\t\tif (exitCode !== 0 && exitCode !== null) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\", text: appendStatus(outputText, `Command exited with code ${exitCode}`) }],\n\t\t\t\t\t\tdetails: { ...withTiming(details), exitCode },\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn { content: [{ type: \"text\", text: outputText }], details: withTiming(details) };\n\t\t\t} finally {\n\t\t\t\tinvalidateNativeSearchCache();\n\t\t\t\tclearUpdateTimer();\n\t\t\t}\n\t\t},\n\t\trenderCall(args, _theme, context) {\n\t\t\tconst state = context.state;\n\t\t\tif (context.executionStarted && state.startedAt === undefined) {\n\t\t\t\tstate.startedAt = Date.now();\n\t\t\t\tstate.endedAt = undefined;\n\t\t\t}\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(formatBashCall(args));\n\t\t\treturn text;\n\t\t},\n\t\trenderResult(result, options, _theme, context) {\n\t\t\tconst state = context.state;\n\t\t\tif (state.startedAt !== undefined && options.isPartial && !state.interval) {\n\t\t\t\tstate.interval = setInterval(() => context.invalidate(), 1000);\n\t\t\t}\n\t\t\tif (!options.isPartial || context.isError) {\n\t\t\t\tstate.endedAt ??= Date.now();\n\t\t\t\tif (state.interval) {\n\t\t\t\t\tclearInterval(state.interval);\n\t\t\t\t\tstate.interval = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst component =\n\t\t\t\t(context.lastComponent as BashResultRenderComponent | undefined) ?? new BashResultRenderComponent();\n\t\t\trebuildBashResultRenderComponent(\n\t\t\t\tcomponent,\n\t\t\t\tresult,\n\t\t\t\toptions,\n\t\t\t\tcontext.showImages,\n\t\t\t\tstate.startedAt,\n\t\t\t\tstate.endedAt,\n\t\t\t);\n\t\t\tcomponent.invalidate();\n\t\t\treturn component;\n\t\t},\n\t};\n}\nexport function createBashTool(cwd: string, options?: BashToolOptions): AgentTool<typeof bashSchema> {\n\treturn wrapToolDefinition(createBashToolDefinition(cwd, options));\n}\n"]}
|
|
@@ -35,6 +35,17 @@ export declare function repairCollapsedScheme(url: string): string;
|
|
|
35
35
|
export declare function isReadableUrlPath(readPath: string): boolean;
|
|
36
36
|
export declare function parseReadUrlTarget(readPath: string): ParsedReadUrlTarget | null;
|
|
37
37
|
export declare function getReadUrlCacheKey(scope: string, requestedUrl: string, raw: boolean): string;
|
|
38
|
+
interface ResponseBodyStream extends NodeJS.ReadableStream {
|
|
39
|
+
on(event: "data", listener: (chunk: Buffer) => void): this;
|
|
40
|
+
on(event: "end" | "close", listener: () => void): this;
|
|
41
|
+
on(event: "error", listener: (error: unknown) => void): this;
|
|
42
|
+
removeListener(event: "data", listener: (chunk: Buffer) => void): this;
|
|
43
|
+
removeListener(event: "end" | "close", listener: () => void): this;
|
|
44
|
+
removeListener(event: "error", listener: (error: unknown) => void): this;
|
|
45
|
+
destroy(error?: Error): this;
|
|
46
|
+
pause(): this;
|
|
47
|
+
}
|
|
48
|
+
export declare function createPinnedResponseBodyStream(body: ResponseBodyStream): ReadableStream<Uint8Array>;
|
|
38
49
|
export declare function loadPage(url: string, timeoutMs: number, signal?: AbortSignal, accept?: string): Promise<LoadedPage>;
|
|
39
50
|
export interface RenderedUrl {
|
|
40
51
|
content: string;
|
|
@@ -71,4 +82,5 @@ export declare function executeReadUrl(scope: string, params: {
|
|
|
71
82
|
raw?: boolean;
|
|
72
83
|
}, artifactsDir: string | undefined, signal?: AbortSignal): Promise<ExecuteReadUrlResult>;
|
|
73
84
|
export declare function resetReadUrlCache(): void;
|
|
85
|
+
export {};
|
|
74
86
|
//# sourceMappingURL=fetch-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-url.d.ts","sourceRoot":"","sources":["../../../src/core/tools/fetch-url.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAM9C,MAAM,WAAW,SAAS;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,mBAAmB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;KAAE,CAAC;CAC9D;AAQD,MAAM,WAAW,UAAU;IAC1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MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,EACvC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,aAAa,CAAC,CAwBxB;AAED,wBAAsB,cAAc,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,EACvC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,oBAAoB,CAAC,CA0C/B;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -173,6 +173,81 @@ function createPinnedDispatcher(pinned) {
|
|
|
173
173
|
},
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
+
function toReadableStreamError(error) {
|
|
177
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
178
|
+
}
|
|
179
|
+
export function createPinnedResponseBodyStream(body) {
|
|
180
|
+
let controller;
|
|
181
|
+
let terminal = false;
|
|
182
|
+
let ended = false;
|
|
183
|
+
let cleanedUp = false;
|
|
184
|
+
const detachDataListeners = () => {
|
|
185
|
+
body.removeListener("data", onData);
|
|
186
|
+
body.removeListener("end", onEnd);
|
|
187
|
+
};
|
|
188
|
+
const cleanup = () => {
|
|
189
|
+
if (cleanedUp)
|
|
190
|
+
return;
|
|
191
|
+
cleanedUp = true;
|
|
192
|
+
detachDataListeners();
|
|
193
|
+
body.removeListener("error", onError);
|
|
194
|
+
body.removeListener("close", onClose);
|
|
195
|
+
};
|
|
196
|
+
const closeStream = () => {
|
|
197
|
+
if (terminal)
|
|
198
|
+
return;
|
|
199
|
+
terminal = true;
|
|
200
|
+
detachDataListeners();
|
|
201
|
+
controller?.close();
|
|
202
|
+
};
|
|
203
|
+
const onData = (chunk) => {
|
|
204
|
+
if (terminal)
|
|
205
|
+
return;
|
|
206
|
+
controller?.enqueue(new Uint8Array(chunk));
|
|
207
|
+
};
|
|
208
|
+
const onEnd = () => {
|
|
209
|
+
ended = true;
|
|
210
|
+
closeStream();
|
|
211
|
+
};
|
|
212
|
+
const onError = (error) => {
|
|
213
|
+
if (terminal)
|
|
214
|
+
return;
|
|
215
|
+
terminal = true;
|
|
216
|
+
detachDataListeners();
|
|
217
|
+
controller?.error(toReadableStreamError(error));
|
|
218
|
+
};
|
|
219
|
+
const onClose = () => {
|
|
220
|
+
// `close` without a preceding `end` is a premature termination (reset,
|
|
221
|
+
// abort, truncation). Reporting it as a clean EOF would hand partial
|
|
222
|
+
// response content to the consumer as a successful read.
|
|
223
|
+
if (!terminal && !ended) {
|
|
224
|
+
terminal = true;
|
|
225
|
+
detachDataListeners();
|
|
226
|
+
controller?.error(new Error("response body closed before the stream ended"));
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
closeStream();
|
|
230
|
+
}
|
|
231
|
+
cleanup();
|
|
232
|
+
};
|
|
233
|
+
return new ReadableStream({
|
|
234
|
+
start(streamController) {
|
|
235
|
+
controller = streamController;
|
|
236
|
+
body.on("data", onData);
|
|
237
|
+
body.on("end", onEnd);
|
|
238
|
+
body.on("error", onError);
|
|
239
|
+
body.on("close", onClose);
|
|
240
|
+
},
|
|
241
|
+
cancel() {
|
|
242
|
+
if (terminal)
|
|
243
|
+
return;
|
|
244
|
+
terminal = true;
|
|
245
|
+
detachDataListeners();
|
|
246
|
+
body.pause?.();
|
|
247
|
+
body.destroy();
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
}
|
|
176
251
|
async function closePinnedDispatcher(dispatcher) {
|
|
177
252
|
const close = dispatcher?.close;
|
|
178
253
|
if (typeof close === "function")
|
|
@@ -203,16 +278,7 @@ async function pinnedFetch(url, dispatcher, options) {
|
|
|
203
278
|
for (const entry of values)
|
|
204
279
|
headers.append(key, entry);
|
|
205
280
|
}
|
|
206
|
-
const stream =
|
|
207
|
-
start(controller) {
|
|
208
|
-
body.on("data", (chunk) => controller.enqueue(new Uint8Array(chunk)));
|
|
209
|
-
body.on("end", () => controller.close());
|
|
210
|
-
body.on("error", (error) => controller.error(error));
|
|
211
|
-
},
|
|
212
|
-
cancel() {
|
|
213
|
-
body.destroy();
|
|
214
|
-
},
|
|
215
|
-
});
|
|
281
|
+
const stream = createPinnedResponseBodyStream(body);
|
|
216
282
|
return new Response(stream, { status, headers });
|
|
217
283
|
}
|
|
218
284
|
async function assertSafeFetchUrl(url) {
|