@pentoshi/clai 3.18.2 → 4.0.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/README.md +44 -24
- package/bin/postinstall-policy.mjs +3 -0
- package/bin/postinstall.mjs +6 -3
- package/dist/agent/confirm-port.d.ts +5 -17
- package/dist/agent/confirm-port.js +8 -65
- package/dist/agent/confirm-port.js.map +1 -1
- package/dist/agent/evidence-governor.d.ts +1 -1
- package/dist/agent/evidence-governor.js +2 -2
- package/dist/agent/evidence-governor.js.map +1 -1
- package/dist/agent/loop-guard.d.ts +1 -0
- package/dist/agent/loop-guard.js +34 -1
- package/dist/agent/loop-guard.js.map +1 -1
- package/dist/agent/plan-decision.d.ts +0 -29
- package/dist/agent/plan-decision.js +0 -96
- package/dist/agent/plan-decision.js.map +1 -1
- package/dist/agent/plan-tool.js +19 -14
- package/dist/agent/plan-tool.js.map +1 -1
- package/dist/agent/progress-pause-policy.d.ts +0 -15
- package/dist/agent/progress-pause-policy.js +0 -15
- package/dist/agent/progress-pause-policy.js.map +1 -1
- package/dist/agent/runner.js +152 -392
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/task-evidence.d.ts +6 -0
- package/dist/agent/task-evidence.js +48 -3
- package/dist/agent/task-evidence.js.map +1 -1
- package/dist/agent/tool-history.js +11 -4
- package/dist/agent/tool-history.js.map +1 -1
- package/dist/app/commands/catalog.js +397 -0
- package/dist/app/commands/catalog.js.map +1 -0
- package/dist/app/commands/registry.js +1 -1
- package/dist/app/commands/registry.js.map +1 -1
- package/dist/app/confirm-prompt-text.d.ts +17 -0
- package/dist/app/confirm-prompt-text.js +34 -0
- package/dist/app/confirm-prompt-text.js.map +1 -0
- package/dist/app/controllers/session-controller.d.ts +1 -1
- package/dist/app/controllers/session-controller.js +3 -1
- package/dist/app/controllers/session-controller.js.map +1 -1
- package/dist/app/controllers/session-prompt-queue.d.ts +5 -1
- package/dist/app/controllers/session-prompt-queue.js +47 -30
- package/dist/app/controllers/session-prompt-queue.js.map +1 -1
- package/dist/app/controllers/turn-controller.js +41 -3
- package/dist/app/controllers/turn-controller.js.map +1 -1
- package/dist/app/ports/confirm-port.d.ts +0 -1
- package/dist/app/ports/persistence-port.d.ts +1 -1
- package/dist/app/ports/transcript-item.d.ts +63 -0
- package/dist/app/ports/transcript-item.js +2 -0
- package/dist/app/ports/transcript-item.js.map +1 -0
- package/dist/classic/app/ClassicApp.d.ts +12 -0
- package/dist/classic/app/ClassicApp.js +117 -0
- package/dist/classic/app/ClassicApp.js.map +1 -0
- package/dist/classic/app/action-handlers.d.ts +45 -0
- package/dist/classic/app/action-handlers.js +280 -0
- package/dist/classic/app/action-handlers.js.map +1 -0
- package/dist/classic/app/app-wiring.d.ts +133 -0
- package/dist/classic/app/app-wiring.js +383 -0
- package/dist/classic/app/app-wiring.js.map +1 -0
- package/dist/classic/app/use-feed.d.ts +40 -0
- package/dist/classic/app/use-feed.js +52 -0
- package/dist/classic/app/use-feed.js.map +1 -0
- package/dist/classic/app/wiring-interactions.d.ts +40 -0
- package/dist/classic/app/wiring-interactions.js +430 -0
- package/dist/classic/app/wiring-interactions.js.map +1 -0
- package/dist/classic/app/wiring-lifecycle.d.ts +10 -0
- package/dist/classic/app/wiring-lifecycle.js +240 -0
- package/dist/classic/app/wiring-lifecycle.js.map +1 -0
- package/dist/classic/app/wiring-selection.d.ts +3 -0
- package/dist/classic/app/wiring-selection.js +113 -0
- package/dist/classic/app/wiring-selection.js.map +1 -0
- package/dist/classic/app/wiring-types.d.ts +157 -0
- package/dist/classic/app/wiring-types.js +2 -0
- package/dist/classic/app/wiring-types.js.map +1 -0
- package/dist/classic/blocks/AssistantBlock.d.ts +3 -0
- package/dist/classic/blocks/AssistantBlock.js +6 -0
- package/dist/classic/blocks/AssistantBlock.js.map +1 -0
- package/dist/classic/blocks/BatchBlock.d.ts +3 -0
- package/dist/classic/blocks/BatchBlock.js +6 -0
- package/dist/classic/blocks/BatchBlock.js.map +1 -0
- package/dist/classic/blocks/CompactedBlock.d.ts +3 -0
- package/dist/classic/blocks/CompactedBlock.js +6 -0
- package/dist/classic/blocks/CompactedBlock.js.map +1 -0
- package/dist/classic/blocks/DiffBlock.d.ts +3 -0
- package/dist/classic/blocks/DiffBlock.js +6 -0
- package/dist/classic/blocks/DiffBlock.js.map +1 -0
- package/dist/classic/blocks/IntroBlock.d.ts +3 -0
- package/dist/classic/blocks/IntroBlock.js +6 -0
- package/dist/classic/blocks/IntroBlock.js.map +1 -0
- package/dist/classic/blocks/NoticeBlock.d.ts +3 -0
- package/dist/classic/blocks/NoticeBlock.js +6 -0
- package/dist/classic/blocks/NoticeBlock.js.map +1 -0
- package/dist/classic/blocks/ThinkingBlock.d.ts +3 -0
- package/dist/classic/blocks/ThinkingBlock.js +6 -0
- package/dist/classic/blocks/ThinkingBlock.js.map +1 -0
- package/dist/classic/blocks/ToolBlock.d.ts +3 -0
- package/dist/classic/blocks/ToolBlock.js +6 -0
- package/dist/classic/blocks/ToolBlock.js.map +1 -0
- package/dist/classic/blocks/UserBlock.d.ts +3 -0
- package/dist/classic/blocks/UserBlock.js +6 -0
- package/dist/classic/blocks/UserBlock.js.map +1 -0
- package/dist/classic/blocks/assistant-lines.d.ts +10 -0
- package/dist/classic/blocks/assistant-lines.js +43 -0
- package/dist/classic/blocks/assistant-lines.js.map +1 -0
- package/dist/classic/blocks/batch-lines.d.ts +7 -0
- package/dist/classic/blocks/batch-lines.js +79 -0
- package/dist/classic/blocks/batch-lines.js.map +1 -0
- package/dist/classic/blocks/block-context.d.ts +33 -0
- package/dist/classic/blocks/block-context.js +41 -0
- package/dist/classic/blocks/block-context.js.map +1 -0
- package/dist/classic/blocks/compacted-lines.d.ts +5 -0
- package/dist/classic/blocks/compacted-lines.js +54 -0
- package/dist/classic/blocks/compacted-lines.js.map +1 -0
- package/dist/classic/blocks/diff-lines.d.ts +13 -0
- package/dist/classic/blocks/diff-lines.js +116 -0
- package/dist/classic/blocks/diff-lines.js.map +1 -0
- package/dist/classic/blocks/intro-lines.d.ts +16 -0
- package/dist/classic/blocks/intro-lines.js +23 -0
- package/dist/classic/blocks/intro-lines.js.map +1 -0
- package/dist/classic/blocks/notice-lines.d.ts +7 -0
- package/dist/classic/blocks/notice-lines.js +28 -0
- package/dist/classic/blocks/notice-lines.js.map +1 -0
- package/dist/classic/blocks/thinking-lines.d.ts +5 -0
- package/dist/classic/blocks/thinking-lines.js +34 -0
- package/dist/classic/blocks/thinking-lines.js.map +1 -0
- package/dist/classic/blocks/tool-lines.d.ts +22 -0
- package/dist/classic/blocks/tool-lines.js +135 -0
- package/dist/classic/blocks/tool-lines.js.map +1 -0
- package/dist/classic/blocks/user-lines.d.ts +5 -0
- package/dist/classic/blocks/user-lines.js +26 -0
- package/dist/classic/blocks/user-lines.js.map +1 -0
- package/dist/classic/bootstrap/osc52-renderer.d.ts +10 -0
- package/dist/classic/bootstrap/osc52-renderer.js +38 -0
- package/dist/classic/bootstrap/osc52-renderer.js.map +1 -0
- package/dist/classic/bootstrap/renderer-handle.d.ts +15 -0
- package/dist/classic/bootstrap/renderer-handle.js +22 -0
- package/dist/classic/bootstrap/renderer-handle.js.map +1 -0
- package/dist/classic/bootstrap/start-classic.d.ts +8 -0
- package/dist/classic/bootstrap/start-classic.js +130 -0
- package/dist/classic/bootstrap/start-classic.js.map +1 -0
- package/dist/classic/bootstrap/suspend-port.d.ts +14 -0
- package/dist/classic/bootstrap/suspend-port.js +29 -0
- package/dist/classic/bootstrap/suspend-port.js.map +1 -0
- package/dist/classic/bootstrap/terminal-session.d.ts +58 -0
- package/dist/classic/bootstrap/terminal-session.js +136 -0
- package/dist/classic/bootstrap/terminal-session.js.map +1 -0
- package/dist/classic/chrome/Chrome.d.ts +19 -0
- package/dist/classic/chrome/Chrome.js +30 -0
- package/dist/classic/chrome/Chrome.js.map +1 -0
- package/dist/classic/chrome/Composer.d.ts +12 -0
- package/dist/classic/chrome/Composer.js +61 -0
- package/dist/classic/chrome/Composer.js.map +1 -0
- package/dist/classic/chrome/QueuePanel.d.ts +3 -0
- package/dist/classic/chrome/QueuePanel.js +10 -0
- package/dist/classic/chrome/QueuePanel.js.map +1 -0
- package/dist/classic/chrome/ResponderStrip.d.ts +3 -0
- package/dist/classic/chrome/ResponderStrip.js +9 -0
- package/dist/classic/chrome/ResponderStrip.js.map +1 -0
- package/dist/classic/chrome/StatusBar.d.ts +3 -0
- package/dist/classic/chrome/StatusBar.js +7 -0
- package/dist/classic/chrome/StatusBar.js.map +1 -0
- package/dist/classic/chrome/ToastRow.d.ts +3 -0
- package/dist/classic/chrome/ToastRow.js +10 -0
- package/dist/classic/chrome/ToastRow.js.map +1 -0
- package/dist/classic/chrome/composer-controller.d.ts +57 -0
- package/dist/classic/chrome/composer-controller.js +345 -0
- package/dist/classic/chrome/composer-controller.js.map +1 -0
- package/dist/classic/chrome/composer-frame.d.ts +35 -0
- package/dist/classic/chrome/composer-frame.js +46 -0
- package/dist/classic/chrome/composer-frame.js.map +1 -0
- package/dist/classic/chrome/composer-keys.d.ts +4 -0
- package/dist/classic/chrome/composer-keys.js +45 -0
- package/dist/classic/chrome/composer-keys.js.map +1 -0
- package/dist/classic/chrome/context-limit-editor.d.ts +7 -0
- package/dist/classic/chrome/context-limit-editor.js +13 -0
- package/dist/classic/chrome/context-limit-editor.js.map +1 -0
- package/dist/classic/chrome/directory-row.d.ts +14 -0
- package/dist/classic/chrome/directory-row.js +26 -0
- package/dist/classic/chrome/directory-row.js.map +1 -0
- package/dist/classic/chrome/editor-model.d.ts +37 -0
- package/dist/classic/chrome/editor-model.js +195 -0
- package/dist/classic/chrome/editor-model.js.map +1 -0
- package/dist/classic/chrome/editor-view.d.ts +34 -0
- package/dist/classic/chrome/editor-view.js +133 -0
- package/dist/classic/chrome/editor-view.js.map +1 -0
- package/dist/classic/chrome/queue-rows.d.ts +10 -0
- package/dist/classic/chrome/queue-rows.js +32 -0
- package/dist/classic/chrome/queue-rows.js.map +1 -0
- package/dist/classic/chrome/responder-row.d.ts +9 -0
- package/dist/classic/chrome/responder-row.js +17 -0
- package/dist/classic/chrome/responder-row.js.map +1 -0
- package/dist/classic/chrome/row-budget.d.ts +43 -0
- package/dist/classic/chrome/row-budget.js +78 -0
- package/dist/classic/chrome/row-budget.js.map +1 -0
- package/dist/classic/chrome/status-rows.d.ts +44 -0
- package/dist/classic/chrome/status-rows.js +165 -0
- package/dist/classic/chrome/status-rows.js.map +1 -0
- package/dist/classic/chrome/toast-rows.d.ts +14 -0
- package/dist/classic/chrome/toast-rows.js +82 -0
- package/dist/classic/chrome/toast-rows.js.map +1 -0
- package/dist/classic/chrome/use-terminal-size.d.ts +14 -0
- package/dist/classic/chrome/use-terminal-size.js +38 -0
- package/dist/classic/chrome/use-terminal-size.js.map +1 -0
- package/dist/classic/feed/Feed.d.ts +17 -0
- package/dist/classic/feed/Feed.js +37 -0
- package/dist/classic/feed/Feed.js.map +1 -0
- package/dist/classic/feed/FeedStatic.d.ts +13 -0
- package/dist/classic/feed/FeedStatic.js +15 -0
- package/dist/classic/feed/FeedStatic.js.map +1 -0
- package/dist/classic/feed/LiveTail.d.ts +10 -0
- package/dist/classic/feed/LiveTail.js +20 -0
- package/dist/classic/feed/LiveTail.js.map +1 -0
- package/dist/classic/feed/ScrollbarGutter.d.ts +9 -0
- package/dist/classic/feed/ScrollbarGutter.js +42 -0
- package/dist/classic/feed/ScrollbarGutter.js.map +1 -0
- package/dist/classic/feed/block-height.d.ts +12 -0
- package/dist/classic/feed/block-height.js +34 -0
- package/dist/classic/feed/block-height.js.map +1 -0
- package/dist/classic/feed/commit-ledger.d.ts +26 -0
- package/dist/classic/feed/commit-ledger.js +52 -0
- package/dist/classic/feed/commit-ledger.js.map +1 -0
- package/dist/classic/feed/feed-blocks.d.ts +39 -0
- package/dist/classic/feed/feed-blocks.js +124 -0
- package/dist/classic/feed/feed-blocks.js.map +1 -0
- package/dist/classic/feed/live-tail-policy.d.ts +35 -0
- package/dist/classic/feed/live-tail-policy.js +80 -0
- package/dist/classic/feed/live-tail-policy.js.map +1 -0
- package/dist/classic/feed/scrollbar-rows.d.ts +6 -0
- package/dist/classic/feed/scrollbar-rows.js +18 -0
- package/dist/classic/feed/scrollbar-rows.js.map +1 -0
- package/dist/classic/feed/transcript-selection.d.ts +16 -0
- package/dist/classic/feed/transcript-selection.js +92 -0
- package/dist/classic/feed/transcript-selection.js.map +1 -0
- package/dist/classic/feed/transcript-window.d.ts +33 -0
- package/dist/classic/feed/transcript-window.js +53 -0
- package/dist/classic/feed/transcript-window.js.map +1 -0
- package/dist/classic/input/cancel-ladder.d.ts +47 -0
- package/dist/classic/input/cancel-ladder.js +100 -0
- package/dist/classic/input/cancel-ladder.js.map +1 -0
- package/dist/classic/input/chord-from-key.d.ts +2 -0
- package/dist/classic/input/chord-from-key.js +25 -0
- package/dist/classic/input/chord-from-key.js.map +1 -0
- package/dist/classic/input/input-router.d.ts +33 -0
- package/dist/classic/input/input-router.js +146 -0
- package/dist/classic/input/input-router.js.map +1 -0
- package/dist/classic/input/key-event.d.ts +39 -0
- package/dist/classic/input/key-event.js +12 -0
- package/dist/classic/input/key-event.js.map +1 -0
- package/dist/classic/input/paste-decoder.d.ts +1 -0
- package/dist/classic/input/paste-decoder.js +9 -0
- package/dist/classic/input/paste-decoder.js.map +1 -0
- package/dist/classic/input/raw-decoder.d.ts +31 -0
- package/dist/classic/input/raw-decoder.js +325 -0
- package/dist/classic/input/raw-decoder.js.map +1 -0
- package/dist/classic/input/sgr-mouse.d.ts +2 -0
- package/dist/classic/input/sgr-mouse.js +37 -0
- package/dist/classic/input/sgr-mouse.js.map +1 -0
- package/dist/classic/input/terminal-sequences.d.ts +38 -0
- package/dist/classic/input/terminal-sequences.js +111 -0
- package/dist/classic/input/terminal-sequences.js.map +1 -0
- package/dist/classic/panels/CompletionPanel.d.ts +3 -0
- package/dist/classic/panels/CompletionPanel.js +10 -0
- package/dist/classic/panels/CompletionPanel.js.map +1 -0
- package/dist/classic/panels/ConfirmPanel.d.ts +3 -0
- package/dist/classic/panels/ConfirmPanel.js +7 -0
- package/dist/classic/panels/ConfirmPanel.js.map +1 -0
- package/dist/classic/panels/JobsPanel.d.ts +3 -0
- package/dist/classic/panels/JobsPanel.js +7 -0
- package/dist/classic/panels/JobsPanel.js.map +1 -0
- package/dist/classic/panels/KeysPanel.d.ts +3 -0
- package/dist/classic/panels/KeysPanel.js +7 -0
- package/dist/classic/panels/KeysPanel.js.map +1 -0
- package/dist/classic/panels/PagerPanel.d.ts +3 -0
- package/dist/classic/panels/PagerPanel.js +7 -0
- package/dist/classic/panels/PagerPanel.js.map +1 -0
- package/dist/classic/panels/PanelFrame.d.ts +3 -0
- package/dist/classic/panels/PanelFrame.js +8 -0
- package/dist/classic/panels/PanelFrame.js.map +1 -0
- package/dist/classic/panels/PickerPanel.d.ts +3 -0
- package/dist/classic/panels/PickerPanel.js +7 -0
- package/dist/classic/panels/PickerPanel.js.map +1 -0
- package/dist/classic/panels/PlanPanel.d.ts +3 -0
- package/dist/classic/panels/PlanPanel.js +7 -0
- package/dist/classic/panels/PlanPanel.js.map +1 -0
- package/dist/classic/panels/PromptActionsPanel.d.ts +3 -0
- package/dist/classic/panels/PromptActionsPanel.js +7 -0
- package/dist/classic/panels/PromptActionsPanel.js.map +1 -0
- package/dist/classic/panels/ScopePanel.d.ts +3 -0
- package/dist/classic/panels/ScopePanel.js +7 -0
- package/dist/classic/panels/ScopePanel.js.map +1 -0
- package/dist/classic/panels/SearchPanel.d.ts +3 -0
- package/dist/classic/panels/SearchPanel.js +7 -0
- package/dist/classic/panels/SearchPanel.js.map +1 -0
- package/dist/classic/panels/SecretPanel.d.ts +3 -0
- package/dist/classic/panels/SecretPanel.js +7 -0
- package/dist/classic/panels/SecretPanel.js.map +1 -0
- package/dist/classic/panels/completion-accept.d.ts +17 -0
- package/dist/classic/panels/completion-accept.js +58 -0
- package/dist/classic/panels/completion-accept.js.map +1 -0
- package/dist/classic/panels/completion-rows.d.ts +29 -0
- package/dist/classic/panels/completion-rows.js +135 -0
- package/dist/classic/panels/completion-rows.js.map +1 -0
- package/dist/classic/panels/confirm-panel.d.ts +24 -0
- package/dist/classic/panels/confirm-panel.js +115 -0
- package/dist/classic/panels/confirm-panel.js.map +1 -0
- package/dist/classic/panels/jobs-panel.d.ts +32 -0
- package/dist/classic/panels/jobs-panel.js +116 -0
- package/dist/classic/panels/jobs-panel.js.map +1 -0
- package/dist/classic/panels/keys-panel.d.ts +40 -0
- package/dist/classic/panels/keys-panel.js +174 -0
- package/dist/classic/panels/keys-panel.js.map +1 -0
- package/dist/classic/panels/list-rows.d.ts +27 -0
- package/dist/classic/panels/list-rows.js +42 -0
- package/dist/classic/panels/list-rows.js.map +1 -0
- package/dist/classic/panels/list-window.d.ts +15 -0
- package/dist/classic/panels/list-window.js +25 -0
- package/dist/classic/panels/list-window.js.map +1 -0
- package/dist/classic/panels/pager-panel.d.ts +50 -0
- package/dist/classic/panels/pager-panel.js +238 -0
- package/dist/classic/panels/pager-panel.js.map +1 -0
- package/dist/classic/panels/panel-controller.d.ts +29 -0
- package/dist/classic/panels/panel-controller.js +320 -0
- package/dist/classic/panels/panel-controller.js.map +1 -0
- package/dist/classic/panels/panel-effect.d.ts +74 -0
- package/dist/classic/panels/panel-effect.js +7 -0
- package/dist/classic/panels/panel-effect.js.map +1 -0
- package/dist/classic/panels/panel-effects.d.ts +11 -0
- package/dist/classic/panels/panel-effects.js +105 -0
- package/dist/classic/panels/panel-effects.js.map +1 -0
- package/dist/classic/panels/panel-frame.d.ts +20 -0
- package/dist/classic/panels/panel-frame.js +47 -0
- package/dist/classic/panels/panel-frame.js.map +1 -0
- package/dist/classic/panels/panel-host.d.ts +16 -0
- package/dist/classic/panels/panel-host.js +49 -0
- package/dist/classic/panels/panel-host.js.map +1 -0
- package/dist/classic/panels/panel-initial-states.d.ts +18 -0
- package/dist/classic/panels/panel-initial-states.js +33 -0
- package/dist/classic/panels/panel-initial-states.js.map +1 -0
- package/dist/classic/panels/panel-types.d.ts +47 -0
- package/dist/classic/panels/panel-types.js +2 -0
- package/dist/classic/panels/panel-types.js.map +1 -0
- package/dist/classic/panels/panel-wheel.d.ts +20 -0
- package/dist/classic/panels/panel-wheel.js +82 -0
- package/dist/classic/panels/panel-wheel.js.map +1 -0
- package/dist/classic/panels/picker-panel.d.ts +35 -0
- package/dist/classic/panels/picker-panel.js +150 -0
- package/dist/classic/panels/picker-panel.js.map +1 -0
- package/dist/classic/panels/plan-panel.d.ts +27 -0
- package/dist/classic/panels/plan-panel.js +98 -0
- package/dist/classic/panels/plan-panel.js.map +1 -0
- package/dist/classic/panels/prompt-actions-panel.d.ts +25 -0
- package/dist/classic/panels/prompt-actions-panel.js +57 -0
- package/dist/classic/panels/prompt-actions-panel.js.map +1 -0
- package/dist/classic/panels/scope-panel.d.ts +27 -0
- package/dist/classic/panels/scope-panel.js +122 -0
- package/dist/classic/panels/scope-panel.js.map +1 -0
- package/dist/classic/panels/search-panel.d.ts +32 -0
- package/dist/classic/panels/search-panel.js +126 -0
- package/dist/classic/panels/search-panel.js.map +1 -0
- package/dist/classic/panels/secret-panel.d.ts +28 -0
- package/dist/classic/panels/secret-panel.js +70 -0
- package/dist/classic/panels/secret-panel.js.map +1 -0
- package/dist/classic/render/ansi-text.d.ts +36 -0
- package/dist/classic/render/ansi-text.js +234 -0
- package/dist/classic/render/ansi-text.js.map +1 -0
- package/dist/classic/render/glyphs.d.ts +49 -0
- package/dist/classic/render/glyphs.js +111 -0
- package/dist/classic/render/glyphs.js.map +1 -0
- package/dist/classic/render/ink-theme.d.ts +49 -0
- package/dist/classic/render/ink-theme.js +73 -0
- package/dist/classic/render/ink-theme.js.map +1 -0
- package/dist/classic/render/measure.d.ts +17 -0
- package/dist/classic/render/measure.js +33 -0
- package/dist/classic/render/measure.js.map +1 -0
- package/dist/classic/render/shell-width.d.ts +12 -0
- package/dist/classic/render/shell-width.js +23 -0
- package/dist/classic/render/shell-width.js.map +1 -0
- package/dist/classic/render/wrap.d.ts +19 -0
- package/dist/classic/render/wrap.js +102 -0
- package/dist/classic/render/wrap.js.map +1 -0
- package/dist/commands/doctor.js +9 -8
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/providers.js +43 -50
- package/dist/commands/providers.js.map +1 -1
- package/dist/commands/search-providers.js +3 -5
- package/dist/commands/search-providers.js.map +1 -1
- package/dist/index.js +76 -84
- package/dist/index.js.map +1 -1
- package/dist/llm/capabilities.js +5 -2
- package/dist/llm/capabilities.js.map +1 -1
- package/dist/llm/custom-providers.js +16 -3
- package/dist/llm/custom-providers.js.map +1 -1
- package/dist/llm/http.d.ts +5 -0
- package/dist/llm/http.js +38 -8
- package/dist/llm/http.js.map +1 -1
- package/dist/llm/meta.js +56 -24
- package/dist/llm/meta.js.map +1 -1
- package/dist/llm/modal.js +3 -2
- package/dist/llm/modal.js.map +1 -1
- package/dist/llm/router.js +36 -23
- package/dist/llm/router.js.map +1 -1
- package/dist/llm/system-messages.d.ts +1 -0
- package/dist/llm/system-messages.js +6 -0
- package/dist/llm/system-messages.js.map +1 -1
- package/dist/llm/token-usage.js +11 -1
- package/dist/llm/token-usage.js.map +1 -1
- package/dist/llm/tool-protocol.js +10 -3
- package/dist/llm/tool-protocol.js.map +1 -1
- package/dist/modes/agent.d.ts +3 -0
- package/dist/modes/agent.js +10 -3
- package/dist/modes/agent.js.map +1 -1
- package/dist/modes/ask.js +2 -2
- package/dist/modes/ask.js.map +1 -1
- package/dist/noninteractive/read-stdin.d.ts +1 -0
- package/dist/noninteractive/read-stdin.js +8 -0
- package/dist/noninteractive/read-stdin.js.map +1 -0
- package/dist/noninteractive/readline-prompts.d.ts +47 -0
- package/dist/noninteractive/readline-prompts.js +201 -0
- package/dist/noninteractive/readline-prompts.js.map +1 -0
- package/dist/noninteractive/start-noninteractive.d.ts +32 -0
- package/dist/noninteractive/start-noninteractive.js +100 -0
- package/dist/noninteractive/start-noninteractive.js.map +1 -0
- package/dist/noninteractive/stdio-confirm-port.d.ts +15 -0
- package/dist/noninteractive/stdio-confirm-port.js +45 -0
- package/dist/noninteractive/stdio-confirm-port.js.map +1 -0
- package/dist/noninteractive/stream-blocks.d.ts +117 -0
- package/dist/noninteractive/stream-blocks.js +445 -0
- package/dist/noninteractive/stream-blocks.js.map +1 -0
- package/dist/noninteractive/stream-renderer.d.ts +40 -0
- package/dist/noninteractive/stream-renderer.js +164 -0
- package/dist/noninteractive/stream-renderer.js.map +1 -0
- package/dist/noninteractive/stream-spinner.d.ts +28 -0
- package/dist/noninteractive/stream-spinner.js +45 -0
- package/dist/noninteractive/stream-spinner.js.map +1 -0
- package/dist/os/bun-runtime.js +207 -0
- package/dist/os/bun-runtime.js.map +1 -0
- package/dist/prompts/embedded.js +1 -1
- package/dist/prompts/embedded.js.map +1 -1
- package/dist/prompts/system.agent.md +11 -7
- package/dist/store/config.d.ts +3 -1
- package/dist/store/config.js +37 -5
- package/dist/store/config.js.map +1 -1
- package/dist/store/history.d.ts +1 -1
- package/dist/store/history.js +3 -0
- package/dist/store/history.js.map +1 -1
- package/dist/store/keys.d.ts +5 -2
- package/dist/store/keys.js +97 -14
- package/dist/store/keys.js.map +1 -1
- package/dist/tools/definitions.js +1 -1
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/registry.js +27 -4
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/web/providers/duckduckgo.js +1 -1
- package/dist/tools/web/providers/duckduckgo.js.map +1 -1
- package/dist/tools/web/readable.js +1 -1
- package/dist/tools/web/readable.js.map +1 -1
- package/dist/tui-v2/app/App.js +20 -28
- package/dist/tui-v2/app/App.js.map +1 -1
- package/dist/tui-v2/bootstrap/pager-export.d.ts +9 -18
- package/dist/tui-v2/bootstrap/pager-export.js +15 -72
- package/dist/tui-v2/bootstrap/pager-export.js.map +1 -1
- package/dist/tui-v2/bootstrap/start-tui-v2.js +8 -8
- package/dist/tui-v2/bootstrap/start-tui-v2.js.map +1 -1
- package/dist/tui-v2/components/completion/completion-menu.d.ts +2 -2
- package/dist/tui-v2/components/composer/composer-input-box.d.ts +1 -1
- package/dist/tui-v2/components/composer/paste-chip.d.ts +2 -2
- package/dist/tui-v2/components/composer/paste-chip.js +1 -1
- package/dist/tui-v2/components/composer/paste-chip.js.map +1 -1
- package/dist/tui-v2/components/jobs/jobs-panel.d.ts +2 -2
- package/dist/tui-v2/components/jobs/jobs-panel.js +4 -4
- package/dist/tui-v2/components/jobs/jobs-panel.js.map +1 -1
- package/dist/tui-v2/components/modal/confirm-modal.d.ts +3 -3
- package/dist/tui-v2/components/modal/confirm-modal.js +6 -6
- package/dist/tui-v2/components/modal/confirm-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/keys-modal.d.ts +3 -3
- package/dist/tui-v2/components/modal/keys-modal.js +24 -9
- package/dist/tui-v2/components/modal/keys-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/prompt-actions-modal.d.ts +3 -3
- package/dist/tui-v2/components/modal/prompt-actions-modal.js +2 -2
- package/dist/tui-v2/components/modal/prompt-actions-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/scope-modal.d.ts +3 -3
- package/dist/tui-v2/components/modal/scope-modal.js +1 -1
- package/dist/tui-v2/components/modal/scope-modal.js.map +1 -1
- package/dist/tui-v2/components/modal/secret-modal.d.ts +3 -3
- package/dist/tui-v2/components/modal/secret-modal.js +2 -2
- package/dist/tui-v2/components/modal/secret-modal.js.map +1 -1
- package/dist/tui-v2/components/overlay/overlay-host.d.ts +2 -2
- package/dist/tui-v2/components/overlay/overlay-host.js +1 -1
- package/dist/tui-v2/components/overlay/overlay-host.js.map +1 -1
- package/dist/tui-v2/components/pager/pager-line.d.ts +3 -3
- package/dist/tui-v2/components/pager/pager-line.js +3 -3
- package/dist/tui-v2/components/pager/pager-line.js.map +1 -1
- package/dist/tui-v2/components/pager/pager.d.ts +3 -3
- package/dist/tui-v2/components/pager/pager.js +6 -5
- package/dist/tui-v2/components/pager/pager.js.map +1 -1
- package/dist/tui-v2/components/picker/picker.d.ts +3 -3
- package/dist/tui-v2/components/picker/picker.js +2 -2
- package/dist/tui-v2/components/picker/picker.js.map +1 -1
- package/dist/tui-v2/components/plan/plan-pane-anim.js +1 -1
- package/dist/tui-v2/components/plan/plan-pane-anim.js.map +1 -1
- package/dist/tui-v2/components/plan/plan-view.d.ts +2 -2
- package/dist/tui-v2/components/plan/plan-view.js +2 -2
- package/dist/tui-v2/components/plan/plan-view.js.map +1 -1
- package/dist/tui-v2/components/queue/queue-panel.d.ts +2 -2
- package/dist/tui-v2/components/queue/queue-panel.js +3 -3
- package/dist/tui-v2/components/queue/queue-panel.js.map +1 -1
- package/dist/tui-v2/components/status/context-limit-chip.d.ts +1 -5
- package/dist/tui-v2/components/status/context-limit-chip.js +1 -38
- package/dist/tui-v2/components/status/context-limit-chip.js.map +1 -1
- package/dist/tui-v2/components/status/status-line.d.ts +5 -34
- package/dist/tui-v2/components/status/status-line.js +7 -99
- package/dist/tui-v2/components/status/status-line.js.map +1 -1
- package/dist/tui-v2/components/toast/toast-anim.d.ts +0 -1
- package/dist/tui-v2/components/toast/toast-anim.js +2 -3
- package/dist/tui-v2/components/toast/toast-anim.js.map +1 -1
- package/dist/tui-v2/components/toast/toast-host.d.ts +2 -2
- package/dist/tui-v2/components/toast/toast-host.js +2 -2
- package/dist/tui-v2/components/toast/toast-host.js.map +1 -1
- package/dist/tui-v2/components/transcript/assistant-message.d.ts +2 -2
- package/dist/tui-v2/components/transcript/assistant-message.js +3 -2
- package/dist/tui-v2/components/transcript/assistant-message.js.map +1 -1
- package/dist/tui-v2/components/transcript/compacted-row.d.ts +3 -3
- package/dist/tui-v2/components/transcript/compacted-row.js +6 -5
- package/dist/tui-v2/components/transcript/compacted-row.js.map +1 -1
- package/dist/tui-v2/components/transcript/file-diff-card.d.ts +1 -1
- package/dist/tui-v2/components/transcript/file-diff-card.js +1 -1
- package/dist/tui-v2/components/transcript/file-diff-card.js.map +1 -1
- package/dist/tui-v2/components/transcript/intro-card.d.ts +2 -2
- package/dist/tui-v2/components/transcript/intro-card.js +1 -1
- package/dist/tui-v2/components/transcript/intro-card.js.map +1 -1
- package/dist/tui-v2/components/transcript/linkable-text.d.ts +1 -1
- package/dist/tui-v2/components/transcript/linkable-text.js +1 -1
- package/dist/tui-v2/components/transcript/linkable-text.js.map +1 -1
- package/dist/tui-v2/components/transcript/notice-row.d.ts +2 -2
- package/dist/tui-v2/components/transcript/search-bar.d.ts +1 -1
- package/dist/tui-v2/components/transcript/thinking-block.d.ts +2 -2
- package/dist/tui-v2/components/transcript/thinking-block.js +3 -3
- package/dist/tui-v2/components/transcript/thinking-block.js.map +1 -1
- package/dist/tui-v2/components/transcript/tool-card.d.ts +3 -3
- package/dist/tui-v2/components/transcript/tool-card.js +7 -7
- package/dist/tui-v2/components/transcript/tool-card.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-row.d.ts +4 -4
- package/dist/tui-v2/components/transcript/transcript-scrollbar.d.ts +1 -1
- package/dist/tui-v2/components/transcript/transcript-scrollbar.js +42 -9
- package/dist/tui-v2/components/transcript/transcript-scrollbar.js.map +1 -1
- package/dist/tui-v2/components/transcript/transcript-view.d.ts +3 -3
- package/dist/tui-v2/components/transcript/transcript-view.js +6 -6
- package/dist/tui-v2/components/transcript/transcript-view.js.map +1 -1
- package/dist/tui-v2/components/transcript/use-native-selection-copy.d.ts +1 -1
- package/dist/tui-v2/components/transcript/use-transcript-selection.d.ts +2 -2
- package/dist/tui-v2/components/transcript/use-transcript-selection.js +3 -3
- package/dist/tui-v2/components/transcript/use-transcript-selection.js.map +1 -1
- package/dist/tui-v2/components/transcript/user-message.d.ts +2 -2
- package/dist/tui-v2/components/transcript/user-message.js +1 -1
- package/dist/tui-v2/components/transcript/user-message.js.map +1 -1
- package/dist/tui-v2/composer/composer-editor.d.ts +2 -2
- package/dist/tui-v2/composer/composer-editor.js +21 -20
- package/dist/tui-v2/composer/composer-editor.js.map +1 -1
- package/dist/tui-v2/composer/composer-image-paste.d.ts +1 -1
- package/dist/tui-v2/composer/composer-image-paste.js +1 -1
- package/dist/tui-v2/composer/composer-image-paste.js.map +1 -1
- package/dist/tui-v2/composer/use-draft-actions.d.ts +2 -2
- package/dist/tui-v2/composer/use-draft-actions.js +2 -2
- package/dist/tui-v2/composer/use-draft-actions.js.map +1 -1
- package/dist/tui-v2/input/chord-from-opentui-key.d.ts +20 -0
- package/dist/tui-v2/input/chord-from-opentui-key.js +51 -0
- package/dist/tui-v2/input/chord-from-opentui-key.js.map +1 -0
- package/dist/tui-v2/rendering/pager-markdown.d.ts +2 -22
- package/dist/tui-v2/rendering/pager-markdown.js +4 -103
- package/dist/tui-v2/rendering/pager-markdown.js.map +1 -1
- package/dist/tui-v2/rendering/styled-markdown.d.ts +20 -0
- package/dist/tui-v2/rendering/styled-markdown.js +35 -0
- package/dist/tui-v2/rendering/styled-markdown.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/ui/mentions.d.ts +5 -8
- package/dist/ui/mentions.js +26 -8
- package/dist/ui/mentions.js.map +1 -1
- package/dist/ui/warn-once.d.ts +2 -0
- package/dist/ui/warn-once.js +13 -0
- package/dist/ui/warn-once.js.map +1 -0
- package/dist/ui-core/actions/action-id.d.ts +14 -0
- package/dist/ui-core/actions/action-id.js +123 -0
- package/dist/ui-core/actions/action-id.js.map +1 -0
- package/dist/ui-core/actions/action-router.js.map +1 -0
- package/dist/ui-core/actions/chord.d.ts +20 -0
- package/dist/ui-core/actions/chord.js +28 -0
- package/dist/ui-core/actions/chord.js.map +1 -0
- package/dist/ui-core/actions/format-shortcuts.js +267 -0
- package/dist/ui-core/actions/format-shortcuts.js.map +1 -0
- package/dist/ui-core/actions/keymap.d.ts +23 -0
- package/dist/ui-core/actions/keymap.js +147 -0
- package/dist/ui-core/actions/keymap.js.map +1 -0
- package/dist/ui-core/actions/mode-cycle.js.map +1 -0
- package/dist/ui-core/bootstrap/can-use-tui.js.map +1 -0
- package/dist/ui-core/bootstrap/capabilities.js +96 -0
- package/dist/ui-core/bootstrap/capabilities.js.map +1 -0
- package/dist/ui-core/bootstrap/composition-root.d.ts +92 -0
- package/dist/ui-core/bootstrap/composition-root.js.map +1 -0
- package/dist/ui-core/bootstrap/console-guard.js.map +1 -0
- package/dist/ui-core/bootstrap/console-suppress.js.map +1 -0
- package/dist/ui-core/bootstrap/lifecycle.js.map +1 -0
- package/dist/ui-core/bootstrap/overlay-ports.js +92 -0
- package/dist/ui-core/bootstrap/overlay-ports.js.map +1 -0
- package/dist/ui-core/bootstrap/ui-selection.d.ts +27 -0
- package/dist/ui-core/bootstrap/ui-selection.js +109 -0
- package/dist/ui-core/bootstrap/ui-selection.js.map +1 -0
- package/dist/ui-core/commands/command-handlers.js +86 -0
- package/dist/ui-core/commands/command-handlers.js.map +1 -0
- package/dist/ui-core/commands/config-commands.d.ts +14 -0
- package/dist/ui-core/commands/config-commands.js +315 -0
- package/dist/ui-core/commands/config-commands.js.map +1 -0
- package/dist/ui-core/commands/key-commands.d.ts +9 -0
- package/dist/ui-core/commands/key-commands.js +532 -0
- package/dist/ui-core/commands/key-commands.js.map +1 -0
- package/dist/ui-core/commands/picker-commands.d.ts +25 -0
- package/dist/ui-core/commands/picker-commands.js +1045 -0
- package/dist/ui-core/commands/picker-commands.js.map +1 -0
- package/dist/ui-core/commands/session-commands.d.ts +19 -0
- package/dist/ui-core/commands/session-commands.js +183 -0
- package/dist/ui-core/commands/session-commands.js.map +1 -0
- package/dist/ui-core/commands/startup-update.js.map +1 -0
- package/dist/ui-core/composer/arrow-intent.js.map +1 -0
- package/dist/ui-core/composer/completion.js.map +1 -0
- package/dist/ui-core/composer/composer-action-port.js.map +1 -0
- package/dist/ui-core/composer/composer-height.js +29 -0
- package/dist/ui-core/composer/composer-height.js.map +1 -0
- package/dist/ui-core/composer/composer-image-paste.d.ts +20 -0
- package/dist/ui-core/composer/composer-image-paste.js +77 -0
- package/dist/ui-core/composer/composer-image-paste.js.map +1 -0
- package/dist/ui-core/composer/composer-meta.d.ts +2 -0
- package/dist/ui-core/composer/composer-meta.js +31 -0
- package/dist/ui-core/composer/composer-meta.js.map +1 -0
- package/dist/ui-core/composer/composer-wheel.d.ts +58 -0
- package/dist/ui-core/composer/composer-wheel.js +108 -0
- package/dist/ui-core/composer/composer-wheel.js.map +1 -0
- package/dist/ui-core/composer/draft-actions.d.ts +31 -0
- package/dist/ui-core/composer/draft-actions.js +45 -0
- package/dist/ui-core/composer/draft-actions.js.map +1 -0
- package/dist/ui-core/composer/history-nav.js.map +1 -0
- package/dist/ui-core/composer/input-history.js +9 -0
- package/dist/ui-core/composer/input-history.js.map +1 -0
- package/dist/ui-core/composer/newline-hint.d.ts +13 -0
- package/dist/ui-core/composer/newline-hint.js.map +1 -0
- package/dist/ui-core/composer/paste-placeholder.js.map +1 -0
- package/dist/ui-core/composer/prompt-history.js.map +1 -0
- package/dist/ui-core/composer/secret-buffer.js.map +1 -0
- package/dist/ui-core/composer/textarea-keybindings.d.ts +25 -0
- package/dist/ui-core/composer/textarea-keybindings.js +84 -0
- package/dist/ui-core/composer/textarea-keybindings.js.map +1 -0
- package/dist/ui-core/controllers/focus-controller.js.map +1 -0
- package/dist/ui-core/controllers/interruptible-controller.js.map +1 -0
- package/dist/ui-core/controllers/overlay-controller.d.ts +211 -0
- package/dist/ui-core/controllers/overlay-controller.js.map +1 -0
- package/dist/ui-core/controllers/selection-controller.js.map +1 -0
- package/dist/ui-core/controllers/toast-controller.js.map +1 -0
- package/dist/ui-core/layout/compute-layout.js.map +1 -0
- package/dist/ui-core/motion/ease.js.map +1 -0
- package/dist/ui-core/notify.js.map +1 -0
- package/dist/ui-core/plan/plan-lifecycle.js.map +1 -0
- package/dist/ui-core/ports/clipboard-osc52.js +44 -0
- package/dist/ui-core/ports/clipboard-osc52.js.map +1 -0
- package/dist/ui-core/ports/pager-export-port.d.ts +16 -0
- package/dist/ui-core/ports/pager-export-port.js +70 -0
- package/dist/ui-core/ports/pager-export-port.js.map +1 -0
- package/dist/ui-core/ports/renderer-port.d.ts +10 -0
- package/dist/ui-core/ports/renderer-port.js +2 -0
- package/dist/ui-core/ports/renderer-port.js.map +1 -0
- package/dist/ui-core/react/providers.d.ts +16 -0
- package/dist/ui-core/react/providers.js +31 -0
- package/dist/ui-core/react/providers.js.map +1 -0
- package/dist/ui-core/react/use-has-draft.js.map +1 -0
- package/dist/ui-core/react/use-overlay.js.map +1 -0
- package/dist/ui-core/react/use-plan.js.map +1 -0
- package/dist/ui-core/react/use-session-state.js.map +1 -0
- package/dist/ui-core/react/use-toast.js.map +1 -0
- package/dist/ui-core/react/use-transcript-store.d.ts +10 -0
- package/dist/ui-core/react/use-transcript-store.js.map +1 -0
- package/dist/ui-core/rendering/artifact-pager-source.js.map +1 -0
- package/dist/ui-core/rendering/batch-sections.js.map +1 -0
- package/dist/ui-core/rendering/code-block.d.ts +48 -0
- package/dist/ui-core/rendering/code-block.js +407 -0
- package/dist/ui-core/rendering/code-block.js.map +1 -0
- package/dist/ui-core/rendering/context-limit.d.ts +8 -0
- package/dist/ui-core/rendering/context-limit.js +49 -0
- package/dist/ui-core/rendering/context-limit.js.map +1 -0
- package/dist/ui-core/rendering/file-diff-view.js.map +1 -0
- package/dist/ui-core/rendering/format-help.js.map +1 -0
- package/dist/ui-core/rendering/format-keys.d.ts +14 -0
- package/dist/ui-core/rendering/format-keys.js +78 -0
- package/dist/ui-core/rendering/format-keys.js.map +1 -0
- package/dist/ui-core/rendering/incremental-strip.js.map +1 -0
- package/dist/ui-core/rendering/intro-header.d.ts +11 -0
- package/dist/ui-core/rendering/intro-header.js +208 -0
- package/dist/ui-core/rendering/intro-header.js.map +1 -0
- package/dist/ui-core/rendering/job-tail-source.js.map +1 -0
- package/dist/ui-core/rendering/link-detector.js.map +1 -0
- package/dist/ui-core/rendering/markdown.js.map +1 -0
- package/dist/ui-core/rendering/open-tool-output.js +346 -0
- package/dist/ui-core/rendering/open-tool-output.js.map +1 -0
- package/dist/ui-core/rendering/pager-chrome.js +119 -0
- package/dist/ui-core/rendering/pager-chrome.js.map +1 -0
- package/dist/ui-core/rendering/pager-source.d.ts +20 -0
- package/dist/ui-core/rendering/pager-source.js +101 -0
- package/dist/ui-core/rendering/pager-source.js.map +1 -0
- package/dist/ui-core/rendering/pager-text.d.ts +24 -0
- package/dist/ui-core/rendering/pager-text.js +105 -0
- package/dist/ui-core/rendering/pager-text.js.map +1 -0
- package/dist/ui-core/rendering/pager-view-policy.js +98 -0
- package/dist/ui-core/rendering/pager-view-policy.js.map +1 -0
- package/dist/ui-core/rendering/picker-filter.js.map +1 -0
- package/dist/ui-core/rendering/plan-view.js.map +1 -0
- package/dist/ui-core/rendering/prompt-preview.js.map +1 -0
- package/dist/ui-core/rendering/render-markdown-lines.d.ts +7 -0
- package/dist/ui-core/rendering/render-markdown-lines.js +26 -0
- package/dist/ui-core/rendering/render-markdown-lines.js.map +1 -0
- package/dist/ui-core/rendering/sanitize-display.js.map +1 -0
- package/dist/ui-core/rendering/status-segments.d.ts +25 -0
- package/dist/ui-core/rendering/status-segments.js +88 -0
- package/dist/ui-core/rendering/status-segments.js.map +1 -0
- package/dist/ui-core/rendering/streaming-markdown.d.ts +23 -0
- package/dist/ui-core/rendering/streaming-markdown.js +118 -0
- package/dist/ui-core/rendering/streaming-markdown.js.map +1 -0
- package/dist/ui-core/rendering/strip-tool-surfaces.js.map +1 -0
- package/dist/ui-core/rendering/syntax-highlight.js.map +1 -0
- package/dist/ui-core/rendering/text-format.js.map +1 -0
- package/dist/ui-core/rendering/text-width.js.map +1 -0
- package/dist/ui-core/rendering/theme.js.map +1 -0
- package/dist/ui-core/rendering/thinking-tail.js.map +1 -0
- package/dist/ui-core/rendering/tool-presenter.d.ts +68 -0
- package/dist/ui-core/rendering/tool-presenter.js +371 -0
- package/dist/ui-core/rendering/tool-presenter.js.map +1 -0
- package/dist/ui-core/rendering/transcript-export.d.ts +11 -0
- package/dist/ui-core/rendering/transcript-export.js +18 -0
- package/dist/ui-core/rendering/transcript-export.js.map +1 -0
- package/dist/ui-core/rendering/transcript-semantic.js.map +1 -0
- package/dist/ui-core/rendering/user-message-wrap.d.ts +18 -0
- package/dist/ui-core/rendering/user-message-wrap.js +23 -0
- package/dist/ui-core/rendering/user-message-wrap.js.map +1 -0
- package/dist/ui-core/rendering/wordmark.js.map +1 -0
- package/dist/ui-core/state/pager-search.js.map +1 -0
- package/dist/ui-core/state/semantic-document.js.map +1 -0
- package/dist/ui-core/state/transcript-compaction.js.map +1 -0
- package/dist/ui-core/state/transcript-hydrate.d.ts +67 -0
- package/dist/ui-core/state/transcript-hydrate.js +665 -0
- package/dist/ui-core/state/transcript-hydrate.js.map +1 -0
- package/dist/ui-core/state/transcript-reducer.js +484 -0
- package/dist/ui-core/state/transcript-reducer.js.map +1 -0
- package/dist/ui-core/state/transcript-search.js.map +1 -0
- package/dist/ui-core/state/transcript-store.js.map +1 -0
- package/dist/ui-core/state/transcript-struct.js.map +1 -0
- package/dist/ui-core/state/transcript-types.d.ts +103 -0
- package/dist/ui-core/state/transcript-types.js.map +1 -0
- package/dist/version.generated.d.ts +2 -2
- package/dist/version.generated.js +2 -2
- package/dist/version.generated.js.map +1 -1
- package/package.json +17 -13
- package/dist/agent/classic-renderer.d.ts +0 -5
- package/dist/agent/classic-renderer.js +0 -136
- package/dist/agent/classic-renderer.js.map +0 -1
- package/dist/app/adapters/current-terminal-adapter.d.ts +0 -2
- package/dist/app/adapters/current-terminal-adapter.js +0 -24
- package/dist/app/adapters/current-terminal-adapter.js.map +0 -1
- package/dist/app/controllers/job-controller.d.ts +0 -28
- package/dist/app/controllers/job-controller.js +0 -70
- package/dist/app/controllers/job-controller.js.map +0 -1
- package/dist/repl/prompt-line.d.ts +0 -24
- package/dist/repl/prompt-line.js +0 -558
- package/dist/repl/prompt-line.js.map +0 -1
- package/dist/repl/slash-commands.js +0 -392
- package/dist/repl/slash-commands.js.map +0 -1
- package/dist/repl.d.ts +0 -18
- package/dist/repl.js +0 -1868
- package/dist/repl.js.map +0 -1
- package/dist/safety/path-permissions.d.ts +0 -14
- package/dist/safety/path-permissions.js +0 -43
- package/dist/safety/path-permissions.js.map +0 -1
- package/dist/tools/reducers/generic.d.ts +0 -14
- package/dist/tools/reducers/generic.js +0 -5
- package/dist/tools/reducers/generic.js.map +0 -1
- package/dist/tui/can-use-tui.js.map +0 -1
- package/dist/tui/format-keys.d.ts +0 -13
- package/dist/tui/format-keys.js +0 -78
- package/dist/tui/format-keys.js.map +0 -1
- package/dist/tui/input-history.js +0 -9
- package/dist/tui/input-history.js.map +0 -1
- package/dist/tui/runtime.js +0 -207
- package/dist/tui/runtime.js.map +0 -1
- package/dist/tui/state.d.ts +0 -124
- package/dist/tui/state.js +0 -496
- package/dist/tui/state.js.map +0 -1
- package/dist/tui/text-format.js.map +0 -1
- package/dist/tui-v2/actions/action-id.d.ts +0 -14
- package/dist/tui-v2/actions/action-id.js +0 -117
- package/dist/tui-v2/actions/action-id.js.map +0 -1
- package/dist/tui-v2/actions/action-router.js.map +0 -1
- package/dist/tui-v2/actions/chord-from-key.d.ts +0 -26
- package/dist/tui-v2/actions/chord-from-key.js +0 -47
- package/dist/tui-v2/actions/chord-from-key.js.map +0 -1
- package/dist/tui-v2/actions/format-shortcuts.js +0 -267
- package/dist/tui-v2/actions/format-shortcuts.js.map +0 -1
- package/dist/tui-v2/actions/keymap.d.ts +0 -24
- package/dist/tui-v2/actions/keymap.js +0 -151
- package/dist/tui-v2/actions/keymap.js.map +0 -1
- package/dist/tui-v2/app/command-handlers.js +0 -86
- package/dist/tui-v2/app/command-handlers.js.map +0 -1
- package/dist/tui-v2/app/commands/config-commands.d.ts +0 -14
- package/dist/tui-v2/app/commands/config-commands.js +0 -315
- package/dist/tui-v2/app/commands/config-commands.js.map +0 -1
- package/dist/tui-v2/app/commands/key-commands.d.ts +0 -9
- package/dist/tui-v2/app/commands/key-commands.js +0 -496
- package/dist/tui-v2/app/commands/key-commands.js.map +0 -1
- package/dist/tui-v2/app/commands/picker-commands.d.ts +0 -25
- package/dist/tui-v2/app/commands/picker-commands.js +0 -1006
- package/dist/tui-v2/app/commands/picker-commands.js.map +0 -1
- package/dist/tui-v2/app/commands/session-commands.d.ts +0 -19
- package/dist/tui-v2/app/commands/session-commands.js +0 -183
- package/dist/tui-v2/app/commands/session-commands.js.map +0 -1
- package/dist/tui-v2/app/mode-cycle.js.map +0 -1
- package/dist/tui-v2/app/plan-lifecycle.js.map +0 -1
- package/dist/tui-v2/app/providers.d.ts +0 -17
- package/dist/tui-v2/app/providers.js +0 -32
- package/dist/tui-v2/app/providers.js.map +0 -1
- package/dist/tui-v2/app/startup-update.js.map +0 -1
- package/dist/tui-v2/bootstrap/capabilities.js +0 -93
- package/dist/tui-v2/bootstrap/capabilities.js.map +0 -1
- package/dist/tui-v2/bootstrap/composition-root.d.ts +0 -92
- package/dist/tui-v2/bootstrap/composition-root.js.map +0 -1
- package/dist/tui-v2/bootstrap/console-guard.js.map +0 -1
- package/dist/tui-v2/bootstrap/console-suppress.js.map +0 -1
- package/dist/tui-v2/bootstrap/disable-native-selection.d.ts +0 -11
- package/dist/tui-v2/bootstrap/disable-native-selection.js +0 -13
- package/dist/tui-v2/bootstrap/disable-native-selection.js.map +0 -1
- package/dist/tui-v2/bootstrap/lifecycle.js.map +0 -1
- package/dist/tui-v2/bootstrap/osc52-clipboard.js +0 -44
- package/dist/tui-v2/bootstrap/osc52-clipboard.js.map +0 -1
- package/dist/tui-v2/bootstrap/overlay-ports.js +0 -114
- package/dist/tui-v2/bootstrap/overlay-ports.js.map +0 -1
- package/dist/tui-v2/bootstrap/ui-selection.d.ts +0 -30
- package/dist/tui-v2/bootstrap/ui-selection.js +0 -59
- package/dist/tui-v2/bootstrap/ui-selection.js.map +0 -1
- package/dist/tui-v2/composer/arrow-intent.js.map +0 -1
- package/dist/tui-v2/composer/completion.js.map +0 -1
- package/dist/tui-v2/composer/composer-action-port.js.map +0 -1
- package/dist/tui-v2/composer/composer-height.js +0 -29
- package/dist/tui-v2/composer/composer-height.js.map +0 -1
- package/dist/tui-v2/composer/composer-meta.d.ts +0 -9
- package/dist/tui-v2/composer/composer-meta.js +0 -38
- package/dist/tui-v2/composer/composer-meta.js.map +0 -1
- package/dist/tui-v2/composer/draft-actions.d.ts +0 -31
- package/dist/tui-v2/composer/draft-actions.js +0 -45
- package/dist/tui-v2/composer/draft-actions.js.map +0 -1
- package/dist/tui-v2/composer/history-nav.js.map +0 -1
- package/dist/tui-v2/composer/newline-hint.d.ts +0 -13
- package/dist/tui-v2/composer/newline-hint.js.map +0 -1
- package/dist/tui-v2/composer/paste-placeholder.js.map +0 -1
- package/dist/tui-v2/composer/prompt-history.js.map +0 -1
- package/dist/tui-v2/composer/secret-buffer.js.map +0 -1
- package/dist/tui-v2/controllers/focus-controller.js.map +0 -1
- package/dist/tui-v2/controllers/interruptible-controller.js.map +0 -1
- package/dist/tui-v2/controllers/overlay-controller.d.ts +0 -209
- package/dist/tui-v2/controllers/overlay-controller.js.map +0 -1
- package/dist/tui-v2/controllers/selection-controller.js.map +0 -1
- package/dist/tui-v2/controllers/toast-controller.js.map +0 -1
- package/dist/tui-v2/layout/compute-layout.js.map +0 -1
- package/dist/tui-v2/motion/ease.js.map +0 -1
- package/dist/tui-v2/notify.js.map +0 -1
- package/dist/tui-v2/rendering/artifact-pager-source.js.map +0 -1
- package/dist/tui-v2/rendering/batch-sections.js.map +0 -1
- package/dist/tui-v2/rendering/file-diff-view.js.map +0 -1
- package/dist/tui-v2/rendering/format-help.js.map +0 -1
- package/dist/tui-v2/rendering/incremental-strip.js.map +0 -1
- package/dist/tui-v2/rendering/job-tail-source.js.map +0 -1
- package/dist/tui-v2/rendering/link-detector.js.map +0 -1
- package/dist/tui-v2/rendering/open-tool-output.js +0 -346
- package/dist/tui-v2/rendering/open-tool-output.js.map +0 -1
- package/dist/tui-v2/rendering/pager-chrome.js +0 -119
- package/dist/tui-v2/rendering/pager-chrome.js.map +0 -1
- package/dist/tui-v2/rendering/pager-view-policy.js +0 -98
- package/dist/tui-v2/rendering/pager-view-policy.js.map +0 -1
- package/dist/tui-v2/rendering/picker-filter.js.map +0 -1
- package/dist/tui-v2/rendering/plan-view.js.map +0 -1
- package/dist/tui-v2/rendering/prompt-preview.js.map +0 -1
- package/dist/tui-v2/rendering/render-markdown-lines.d.ts +0 -29
- package/dist/tui-v2/rendering/render-markdown-lines.js +0 -46
- package/dist/tui-v2/rendering/render-markdown-lines.js.map +0 -1
- package/dist/tui-v2/rendering/sanitize-display.js.map +0 -1
- package/dist/tui-v2/rendering/streaming-markdown.d.ts +0 -25
- package/dist/tui-v2/rendering/streaming-markdown.js +0 -117
- package/dist/tui-v2/rendering/streaming-markdown.js.map +0 -1
- package/dist/tui-v2/rendering/strip-tool-surfaces.js.map +0 -1
- package/dist/tui-v2/rendering/syntax-highlight.js.map +0 -1
- package/dist/tui-v2/rendering/theme.js.map +0 -1
- package/dist/tui-v2/rendering/thinking-tail.js.map +0 -1
- package/dist/tui-v2/rendering/tool-presenter.d.ts +0 -63
- package/dist/tui-v2/rendering/tool-presenter.js +0 -376
- package/dist/tui-v2/rendering/tool-presenter.js.map +0 -1
- package/dist/tui-v2/rendering/transcript-export.d.ts +0 -11
- package/dist/tui-v2/rendering/transcript-export.js +0 -18
- package/dist/tui-v2/rendering/transcript-export.js.map +0 -1
- package/dist/tui-v2/rendering/transcript-semantic.js.map +0 -1
- package/dist/tui-v2/rendering/user-message-wrap.d.ts +0 -16
- package/dist/tui-v2/rendering/user-message-wrap.js +0 -21
- package/dist/tui-v2/rendering/user-message-wrap.js.map +0 -1
- package/dist/tui-v2/state/pager-search.js.map +0 -1
- package/dist/tui-v2/state/semantic-document.js.map +0 -1
- package/dist/tui-v2/state/transcript-compaction.js.map +0 -1
- package/dist/tui-v2/state/transcript-hydrate.d.ts +0 -67
- package/dist/tui-v2/state/transcript-hydrate.js +0 -648
- package/dist/tui-v2/state/transcript-hydrate.js.map +0 -1
- package/dist/tui-v2/state/transcript-reducer.js +0 -482
- package/dist/tui-v2/state/transcript-reducer.js.map +0 -1
- package/dist/tui-v2/state/transcript-search.js.map +0 -1
- package/dist/tui-v2/state/transcript-store.js.map +0 -1
- package/dist/tui-v2/state/transcript-struct.js.map +0 -1
- package/dist/tui-v2/state/transcript-types.d.ts +0 -101
- package/dist/tui-v2/state/transcript-types.js.map +0 -1
- package/dist/tui-v2/state/use-has-draft.js.map +0 -1
- package/dist/tui-v2/state/use-overlay.js.map +0 -1
- package/dist/tui-v2/state/use-plan.js.map +0 -1
- package/dist/tui-v2/state/use-session-state.js.map +0 -1
- package/dist/tui-v2/state/use-toast.js.map +0 -1
- package/dist/tui-v2/state/use-transcript-store.d.ts +0 -10
- package/dist/tui-v2/state/use-transcript-store.js.map +0 -1
- package/dist/ui/ansi-box.d.ts +0 -9
- package/dist/ui/ansi-box.js +0 -25
- package/dist/ui/ansi-box.js.map +0 -1
- package/dist/ui/banner.d.ts +0 -3
- package/dist/ui/banner.js +0 -13
- package/dist/ui/banner.js.map +0 -1
- package/dist/ui/code-block.d.ts +0 -48
- package/dist/ui/code-block.js +0 -407
- package/dist/ui/code-block.js.map +0 -1
- package/dist/ui/intro-card.d.ts +0 -11
- package/dist/ui/intro-card.js +0 -74
- package/dist/ui/intro-card.js.map +0 -1
- package/dist/ui/intro-header.d.ts +0 -24
- package/dist/ui/intro-header.js +0 -233
- package/dist/ui/intro-header.js.map +0 -1
- package/dist/ui/keys.d.ts +0 -23
- package/dist/ui/keys.js +0 -23
- package/dist/ui/keys.js.map +0 -1
- package/dist/ui/markdown.js.map +0 -1
- package/dist/ui/output-pane.d.ts +0 -59
- package/dist/ui/output-pane.js +0 -398
- package/dist/ui/output-pane.js.map +0 -1
- package/dist/ui/spinner.d.ts +0 -8
- package/dist/ui/spinner.js +0 -185
- package/dist/ui/spinner.js.map +0 -1
- package/dist/ui/task-pane.d.ts +0 -17
- package/dist/ui/task-pane.js +0 -80
- package/dist/ui/task-pane.js.map +0 -1
- package/dist/ui/text-width.js.map +0 -1
- package/dist/ui/wordmark.js.map +0 -1
- /package/dist/{repl/slash-commands.d.ts → app/commands/catalog.d.ts} +0 -0
- /package/dist/{tui/runtime.d.ts → os/bun-runtime.d.ts} +0 -0
- /package/dist/{tui-v2 → ui-core}/actions/action-router.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/actions/action-router.js +0 -0
- /package/dist/{tui-v2 → ui-core}/actions/format-shortcuts.d.ts +0 -0
- /package/dist/{tui-v2/app → ui-core/actions}/mode-cycle.d.ts +0 -0
- /package/dist/{tui-v2/app → ui-core/actions}/mode-cycle.js +0 -0
- /package/dist/{tui → ui-core/bootstrap}/can-use-tui.d.ts +0 -0
- /package/dist/{tui → ui-core/bootstrap}/can-use-tui.js +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/capabilities.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/composition-root.js +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/console-guard.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/console-guard.js +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/console-suppress.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/console-suppress.js +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/lifecycle.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/lifecycle.js +0 -0
- /package/dist/{tui-v2 → ui-core}/bootstrap/overlay-ports.d.ts +0 -0
- /package/dist/{tui-v2/app → ui-core/commands}/command-handlers.d.ts +0 -0
- /package/dist/{tui-v2/app → ui-core/commands}/startup-update.d.ts +0 -0
- /package/dist/{tui-v2/app → ui-core/commands}/startup-update.js +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/arrow-intent.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/arrow-intent.js +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/completion.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/completion.js +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/composer-action-port.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/composer-action-port.js +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/composer-height.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/history-nav.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/history-nav.js +0 -0
- /package/dist/{tui → ui-core/composer}/input-history.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/newline-hint.js +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/paste-placeholder.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/paste-placeholder.js +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/prompt-history.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/prompt-history.js +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/secret-buffer.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/composer/secret-buffer.js +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/focus-controller.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/focus-controller.js +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/interruptible-controller.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/interruptible-controller.js +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/overlay-controller.js +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/selection-controller.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/selection-controller.js +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/toast-controller.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/controllers/toast-controller.js +0 -0
- /package/dist/{tui-v2 → ui-core}/layout/compute-layout.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/layout/compute-layout.js +0 -0
- /package/dist/{tui-v2 → ui-core}/motion/ease.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/motion/ease.js +0 -0
- /package/dist/{tui-v2 → ui-core}/notify.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/notify.js +0 -0
- /package/dist/{tui-v2/app → ui-core/plan}/plan-lifecycle.d.ts +0 -0
- /package/dist/{tui-v2/app → ui-core/plan}/plan-lifecycle.js +0 -0
- /package/dist/{tui-v2/bootstrap/osc52-clipboard.d.ts → ui-core/ports/clipboard-osc52.d.ts} +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-has-draft.d.ts +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-has-draft.js +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-overlay.d.ts +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-overlay.js +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-plan.d.ts +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-plan.js +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-session-state.d.ts +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-session-state.js +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-toast.d.ts +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-toast.js +0 -0
- /package/dist/{tui-v2/state → ui-core/react}/use-transcript-store.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/artifact-pager-source.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/artifact-pager-source.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/batch-sections.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/batch-sections.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/file-diff-view.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/file-diff-view.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/format-help.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/format-help.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/incremental-strip.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/incremental-strip.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/job-tail-source.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/job-tail-source.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/link-detector.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/link-detector.js +0 -0
- /package/dist/{ui → ui-core/rendering}/markdown.d.ts +0 -0
- /package/dist/{ui → ui-core/rendering}/markdown.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/open-tool-output.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/pager-chrome.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/pager-view-policy.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/picker-filter.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/picker-filter.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/plan-view.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/plan-view.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/prompt-preview.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/prompt-preview.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/sanitize-display.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/sanitize-display.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/strip-tool-surfaces.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/strip-tool-surfaces.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/syntax-highlight.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/syntax-highlight.js +0 -0
- /package/dist/{tui → ui-core/rendering}/text-format.d.ts +0 -0
- /package/dist/{tui → ui-core/rendering}/text-format.js +0 -0
- /package/dist/{ui → ui-core/rendering}/text-width.d.ts +0 -0
- /package/dist/{ui → ui-core/rendering}/text-width.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/theme.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/theme.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/thinking-tail.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/thinking-tail.js +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/transcript-semantic.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/rendering/transcript-semantic.js +0 -0
- /package/dist/{ui → ui-core/rendering}/wordmark.d.ts +0 -0
- /package/dist/{ui → ui-core/rendering}/wordmark.js +0 -0
- /package/dist/{tui-v2 → ui-core}/state/pager-search.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/state/pager-search.js +0 -0
- /package/dist/{tui-v2 → ui-core}/state/semantic-document.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/state/semantic-document.js +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-compaction.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-compaction.js +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-reducer.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-search.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-search.js +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-store.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-store.js +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-struct.d.ts +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-struct.js +0 -0
- /package/dist/{tui-v2 → ui-core}/state/transcript-types.js +0 -0
package/dist/agent/runner.js
CHANGED
|
@@ -6,12 +6,12 @@ import { streamAlreadyEmitted } from "../llm/stream-progress.js";
|
|
|
6
6
|
import { classifyStreamFailure, planStreamRecovery, recordRecoveryAttempt, createStreamRecoveryState, resetStreamRecoveryState, } from "./stream-recovery.js";
|
|
7
7
|
import { modelSupportsVision, resolveToolDialect } from "../llm/capabilities.js";
|
|
8
8
|
import { syntheticToolCallId, isTextOnlyModel, markTextOnlyModel, fromWireName, } from "../llm/tool-protocol.js";
|
|
9
|
-
import { sanitizeAssistantText } from "../ui/
|
|
9
|
+
import { sanitizeDisplayText as sanitizeAssistantText } from "../ui-core/rendering/sanitize-display.js";
|
|
10
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
11
11
|
import { jobManager, } from "../tools/jobs.js";
|
|
12
12
|
import { isResponderResultLedgerMessage, responderContextMessage, upsertResponderContextMessage, upsertResponderResultLedger, } from "./responder-context.js";
|
|
13
13
|
import { agentModeDirective, planModeDirective, renderAgentSystemPrompt, renderCompactAgentSystemPrompt, renderRequestEnvironmentContext, scratchDirFor, toolNudge, } from "../prompts/index.js";
|
|
14
|
-
import { getConfig } from "../store/config.js";
|
|
14
|
+
import { getConfig, getProviderModel } from "../store/config.js";
|
|
15
15
|
import { beginSessionWorkspace, getActiveSessionWorkspace, } from "../store/session-workspace.js";
|
|
16
16
|
import { groqInputTokenBudget } from "../llm/groq.js";
|
|
17
17
|
import { classifyToolCall, isPentestToolCall, scopeTargetForToolCall, } from "../safety/classifier.js";
|
|
@@ -41,7 +41,6 @@ import { availableToolNames, normalizeToolCall, runToolCall, BATCH_SAFE_TOOLS, }
|
|
|
41
41
|
import { getToolDefinitions, getCompactToolDefinitions, RUNNER_META_TOOL_NAMES, } from "../tools/definitions.js";
|
|
42
42
|
import { elidedStubReuseMessage, findElidedStubArg, } from "./message-slim.js";
|
|
43
43
|
import { appendAssistantWithTools, ensureUniqueToolCallIds, toolCallIdsInHistory, appendToolResult, assertValidToolProtocol, fillMissingToolResults, repairToolProtocol, } from "./tool-history.js";
|
|
44
|
-
import { formatViewportHint, registerViewport } from "../ui/output-pane.js";
|
|
45
44
|
import { compactMessagesWithSummary, shouldApplyAutoCompact, COMPACTION_MEMORY_PREFIX, PLAN_IMPLEMENT_MEMORY_PREFIX, isCompactionMemoryMessage, } from "./context-manager.js";
|
|
46
45
|
import { buildContextBreakdown, contextBreakdownAuditPayload, describeDominantContextBlock, toolSchemaHash, } from "./context-breakdown.js";
|
|
47
46
|
import { autoCompactTriggerTokens, dedupeToolContextOutput, freeTierGuardNotices, getReliabilityPolicy, resolveStepMaxTokens, } from "./reliability-policy.js";
|
|
@@ -49,10 +48,8 @@ import { auditLog } from "../store/logs.js";
|
|
|
49
48
|
import { loadProjectContext } from "../store/project.js";
|
|
50
49
|
import { loadScope, isScopeActive } from "../store/scope.js";
|
|
51
50
|
import { ensureProviderConfigured } from "../commands/providers.js";
|
|
52
|
-
import { createThinkingStreamParser, rememberThinkingFromText,
|
|
53
|
-
import { hasReasoningMarker, REASONING_CLOSE, REASONING_OPEN,
|
|
54
|
-
import { renderMarkdown, indentAndWrapText } from "../ui/markdown.js";
|
|
55
|
-
import { startThinkingSpinner } from "../ui/spinner.js";
|
|
51
|
+
import { createThinkingStreamParser, rememberThinkingFromText, stripThinking, } from "../ui/thinking.js";
|
|
52
|
+
import { hasReasoningMarker, REASONING_CLOSE, REASONING_OPEN, } from "../llm/reasoning-marker.js";
|
|
56
53
|
import { safeCwd } from "../os/cwd.js";
|
|
57
54
|
import { analyzeTask, formatTaskAnalysisHint, isNarrowExplicitNmapOperation, } from "./task-analyzer.js";
|
|
58
55
|
import { computeMaxIterations, computeStepBudget } from "./step-budget.js";
|
|
@@ -68,9 +65,9 @@ import { stat } from "node:fs/promises";
|
|
|
68
65
|
import { isOutsideWorkingDirectory, resolveFsToolPath, } from "../tools/fs.js";
|
|
69
66
|
import { stripSentinelTokens, parseToolCall, recognizeBareToolJson, looksLikeTruncatedToolCall, salvageTruncatedWrite, salvageTruncatedWriteFromNative, countToolFences, parseAllToolCalls, groupToolCallsForExecution, buildTurnHistory, collapseRepeatedText, textBeforeToolCall, formatToolArgs, looksLikePentestTask, looksLikeBuildTask, looksLikeInformationalQuery, looksLikeIdleOrSocialPrompt, looksLikeActionNarration, looksLikeWebActionNarration, localHttpProbeIsFailure, localHttpProbeIsSuccess, buildWorkflowDirective, narrowNmapOperationDirective, pentestWorkflowDirective, pentestNoLocalServerDirective, shouldDimToolChatter, looksLikePromptLeak, } from "./tool-call-parser.js";
|
|
70
67
|
import { createSessionPolicy, isPreApprovalAllowedTool, isPlanModeAllowedShellCommand, isPlanModeAllowedTool, isPlanApprovedByStatus, planHasOpenWork, isAbortError, shouldEnableImageOcr, } from "./session-policy.js";
|
|
71
|
-
import { saveToolOutput,
|
|
72
|
-
import { codingSessionFromContext, isProtocolPlaceholderOutput,
|
|
73
|
-
import {
|
|
68
|
+
import { saveToolOutput, formatToolContext, } from "./tool-output-formatting.js";
|
|
69
|
+
import { codingSessionFromContext, isProtocolPlaceholderOutput, } from "./progress-pause-policy.js";
|
|
70
|
+
import { planContextMessage, removePlanContextMessage, upsertPlanContextMessage, handlePlanTool, resolvePlanTaskId, } from "./plan-tool.js";
|
|
74
71
|
import { readDeclaredParentTaskId, resolveResponderParent, isExplicitResponderDelegation, delegationTaskTitle, } from "./responder-parent.js";
|
|
75
72
|
import { readTaskUpdateArgs, distinctAdvancingTaskIds, isSimultaneousTaskAdvance, batchUpdateSignature, buildMultiUpdateReminder, buildMultiOpenRejection, multiUpdateToast, multiOpenToast, openingTaskIds, } from "./task-sync.js";
|
|
76
73
|
import { absorbLooseWorkIntoLedger, applyDestinationCwd, canMarkTaskDone, hasLocalRuntimeProof, hasRemoteWorkProof, isDevServerCall, isEvidenceWorkTool, isFeatureImplementationCall, isPackageInstallCommand, isPlanPreflightTool, isPortListeningOutput, isReadOnlyReconTool, isRemoteActiveTestCall, isRemoteReconToolCall, isScaffoldCreateCommand, isServerReadyOutput, ledgerFromTaskEvidence, pickPendingTaskForToolCall, recordTaskWorkSuccess, resolveUserDestinationHint, taskEvidenceFromLedger, TOOL_ABORT_GRACE_MS, toolHardBudgetMs, toolStallBudgetMs, userAskedForFeatureApp, } from "./task-evidence.js";
|
|
@@ -84,7 +81,7 @@ import { EngagementPolicyEngine, actionFromUrl, engagementActionsForToolCall, ev
|
|
|
84
81
|
import { patchPlanMeta } from "../store/plan.js";
|
|
85
82
|
import { extractProjectRootFromPlan, extractProjectRootFromScaffold, extractProjectRootFromText, getActiveProjectRoot, setActiveProjectRootIfValid, } from "./project-root.js";
|
|
86
83
|
import { buildWorkspaceOrientation, discoverImmediateProjectRoots, guessProjectFolderName, isBareParentDirectory, isScaffoldCancelledOutput, scaffoldLooksMaterialized, scaffoldTargetConflictMessage, resolveScaffoldTargetPath, } from "./workspace-orient.js";
|
|
87
|
-
import {
|
|
84
|
+
import { stdioConfirmPort, stdioSecretRequester, restoreInteractiveStdin, ensurePentestAuthorization, confirmToolExecution, } from "./confirm-port.js";
|
|
88
85
|
import { buildRichStopSummary } from "./stop-summary.js";
|
|
89
86
|
import { composeAgentSystemPrompt } from "./prompt-composer.js";
|
|
90
87
|
import { createGovernorState, governProgress, } from "./evidence-governor.js";
|
|
@@ -205,14 +202,8 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
205
202
|
}
|
|
206
203
|
return matched >= minLength ? current.slice(matched) : current;
|
|
207
204
|
};
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
bumpReasoning: () => { },
|
|
211
|
-
pushPreview: () => { },
|
|
212
|
-
stop: () => { },
|
|
213
|
-
};
|
|
214
|
-
const writeStatus = (text, rendered = chalk.dim(text)) => {
|
|
215
|
-
// Footer activity is single-line; strip classic stdout newlines/indents.
|
|
205
|
+
const writeStatus = (text) => {
|
|
206
|
+
// Footer activity is single-line; collapse newlines and indents.
|
|
216
207
|
// Never surface /output path hints as activity (garbles the status bar).
|
|
217
208
|
let cleaned = text.replace(/\s+/g, " ").trim();
|
|
218
209
|
if (/\/output\b|open full output|Ctrl\+O or|\.clai\/outputs/i.test(cleaned)) {
|
|
@@ -231,41 +222,29 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
231
222
|
}
|
|
232
223
|
}
|
|
233
224
|
emit({ type: "status", text: cleaned || "working" });
|
|
234
|
-
if (writesDirectly)
|
|
235
|
-
process.stdout.write(rendered);
|
|
236
225
|
};
|
|
237
|
-
const writeNotice = (level, text
|
|
226
|
+
const writeNotice = (level, text) => {
|
|
238
227
|
emit({ type: "notice", level, text });
|
|
239
|
-
if (writesDirectly)
|
|
240
|
-
process.stdout.write(rendered);
|
|
241
228
|
};
|
|
242
229
|
const writeAssistantMessage = (text) => {
|
|
243
|
-
// Never surface an empty message: the reducer drops it and a
|
|
244
|
-
//
|
|
230
|
+
// Never surface an empty message: the reducer drops it and a consumer
|
|
231
|
+
// would paint a stray blank row.
|
|
245
232
|
const clean = sanitizeAssistantText(text);
|
|
246
233
|
if (!clean.trim())
|
|
247
234
|
return;
|
|
248
235
|
visibleCommitted = true;
|
|
249
236
|
emit({ type: "assistant-message", text: clean });
|
|
250
|
-
const rendered = renderMarkdown(clean);
|
|
251
|
-
if (writesDirectly) {
|
|
252
|
-
process.stdout.write(clean.endsWith("\n") ? rendered : `${rendered}\n`);
|
|
253
|
-
}
|
|
254
237
|
};
|
|
255
238
|
const writeThinkingBlock = (content) => {
|
|
256
239
|
emit({ type: "thinking-block", content });
|
|
257
|
-
if (writesDirectly)
|
|
258
|
-
process.stdout.write(`${renderThinkingSummary(content)}\n`);
|
|
259
240
|
};
|
|
260
|
-
const writeToolOutput = (id, chunk,
|
|
241
|
+
const writeToolOutput = (id, chunk, options) => {
|
|
261
242
|
emit({
|
|
262
243
|
type: "tool-output",
|
|
263
244
|
id,
|
|
264
245
|
chunk,
|
|
265
246
|
...(options?.replace ? { replace: true } : {}),
|
|
266
247
|
});
|
|
267
|
-
if (writesDirectly && rendered)
|
|
268
|
-
process.stdout.write(rendered);
|
|
269
248
|
};
|
|
270
249
|
const writeToolCall = (id, call, rendered) => {
|
|
271
250
|
emit({
|
|
@@ -277,20 +256,14 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
277
256
|
if (writesDirectly)
|
|
278
257
|
process.stdout.write(rendered);
|
|
279
258
|
};
|
|
280
|
-
const writePlanUpdate = (plan
|
|
259
|
+
const writePlanUpdate = (plan) => {
|
|
281
260
|
emit({ type: "plan-update", plan });
|
|
282
|
-
if (writesDirectly)
|
|
283
|
-
process.stdout.write(rendered);
|
|
284
261
|
};
|
|
285
|
-
const writeToolBlocked = (id, name, reason
|
|
262
|
+
const writeToolBlocked = (id, name, reason) => {
|
|
286
263
|
emit({ type: "tool-blocked", id, name, reason });
|
|
287
|
-
if (writesDirectly)
|
|
288
|
-
process.stdout.write(rendered);
|
|
289
264
|
};
|
|
290
265
|
const writeAbort = () => {
|
|
291
266
|
emit({ type: "turn-aborted" });
|
|
292
|
-
if (writesDirectly)
|
|
293
|
-
process.stdout.write(chalk.yellow(" ⏹ Aborted.\n"));
|
|
294
267
|
};
|
|
295
268
|
const emitToolResult = (id, result, summary, artifactPath) => {
|
|
296
269
|
const event = {
|
|
@@ -314,9 +287,6 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
314
287
|
const insertedText = (value, prefix) => value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
315
288
|
const writeCompactionStarted = (id, beforeTokens) => {
|
|
316
289
|
emit({ type: "compaction-start", id, beforeTokens });
|
|
317
|
-
if (writesDirectly) {
|
|
318
|
-
process.stdout.write(chalk.dim(" ✦ Compacted Context · streaming Markdown\n\n"));
|
|
319
|
-
}
|
|
320
290
|
};
|
|
321
291
|
const writeCompactionDelta = (id, text, replace = false) => {
|
|
322
292
|
if (!text && !replace)
|
|
@@ -327,12 +297,6 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
327
297
|
text,
|
|
328
298
|
...(replace ? { replace: true } : {}),
|
|
329
299
|
});
|
|
330
|
-
if (writesDirectly) {
|
|
331
|
-
if (replace)
|
|
332
|
-
process.stdout.write(chalk.dim("\n ↻ rewriting compacted context\n\n"));
|
|
333
|
-
if (text)
|
|
334
|
-
process.stdout.write(text);
|
|
335
|
-
}
|
|
336
300
|
};
|
|
337
301
|
const writeCompactionCompleted = (id, summary, beforeTokens, afterTokens) => {
|
|
338
302
|
emit({
|
|
@@ -342,16 +306,9 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
342
306
|
beforeTokens,
|
|
343
307
|
afterTokens,
|
|
344
308
|
});
|
|
345
|
-
if (writesDirectly) {
|
|
346
|
-
const footer = chalk.dim(`\n ~${beforeTokens.toLocaleString()} → ~${afterTokens.toLocaleString()} tokens`);
|
|
347
|
-
process.stdout.write(`${footer}\n`);
|
|
348
|
-
}
|
|
349
309
|
};
|
|
350
310
|
const writeCompactionFailed = (id, message, retainedTokens) => {
|
|
351
311
|
emit({ type: "compaction-failed", id, message, retainedTokens });
|
|
352
|
-
if (writesDirectly) {
|
|
353
|
-
process.stdout.write(chalk.yellow(`\n Compaction failed: ${message} (~${retainedTokens.toLocaleString()} tokens retained)\n`));
|
|
354
|
-
}
|
|
355
312
|
};
|
|
356
313
|
// Points at the live message array so finishTurn can hand the full
|
|
357
314
|
// conversation back to the caller. Assigned once `messages` is built below;
|
|
@@ -397,7 +354,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
397
354
|
if (displayRendered.trim()) {
|
|
398
355
|
writeAssistantMessage(displayRendered);
|
|
399
356
|
}
|
|
400
|
-
else
|
|
357
|
+
else {
|
|
401
358
|
emit({ type: "assistant-message", text: "" });
|
|
402
359
|
}
|
|
403
360
|
if (options.onMessages) {
|
|
@@ -422,12 +379,12 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
422
379
|
});
|
|
423
380
|
const config = getConfig();
|
|
424
381
|
const maxSteps = options.maxSteps ?? 70;
|
|
425
|
-
const confirmPort = options.confirm ??
|
|
382
|
+
const confirmPort = options.confirm ?? stdioConfirmPort;
|
|
426
383
|
const projectContext = await loadProjectContext();
|
|
427
384
|
const hasAttachedImages = Boolean(options.images?.length);
|
|
428
385
|
const imageOcrEnabled = shouldEnableImageOcr(prompt, hasAttachedImages, options.visionProven !== false);
|
|
429
386
|
const initialProvider = options.provider ?? config.defaultProvider;
|
|
430
|
-
const initialModel = options.model ??
|
|
387
|
+
const initialModel = options.model ?? getProviderModel(initialProvider);
|
|
431
388
|
// image.view is different from optimistic user-attachment handling: once
|
|
432
389
|
// the tool succeeds, the model must actually receive and inspect its bytes.
|
|
433
390
|
// Offer it only with affirmative capability evidence for the active route.
|
|
@@ -1122,15 +1079,10 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1122
1079
|
const hasHistory = (options.history?.length ?? 0) > 0;
|
|
1123
1080
|
const buildLike = buildLikeTurn;
|
|
1124
1081
|
const pentestLike = looksLikePentestTask(prompt, options.history);
|
|
1125
|
-
/** Coding/build sessions never hard-pause mid-turn for the progress governor. */
|
|
1126
1082
|
let codingSession = codingSessionFromContext({
|
|
1127
1083
|
buildLike,
|
|
1128
1084
|
planKind: activePlan?.kind,
|
|
1129
1085
|
});
|
|
1130
|
-
let pauseMode = progressPauseMode({
|
|
1131
|
-
codingSession,
|
|
1132
|
-
autoConfirm: Boolean(options.autoConfirm),
|
|
1133
|
-
});
|
|
1134
1086
|
const continueExistingOutcome = /^(?:continue|resume|proceed|keep\s+going|finish|next)\b/i.test(prompt.trim()) ||
|
|
1135
1087
|
Boolean(activePlan && !isPlanTerminal(activePlan));
|
|
1136
1088
|
const outcomeState = await openOutcomeState({
|
|
@@ -1144,7 +1096,6 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1144
1096
|
// Canonical mutation/artifact ledger feeding the durable compaction envelope.
|
|
1145
1097
|
const workLedger = new WorkLedger();
|
|
1146
1098
|
let governorState = createGovernorState();
|
|
1147
|
-
let governorPauseReason;
|
|
1148
1099
|
let turnState = createTurnState();
|
|
1149
1100
|
const moveTurn = (to, reason) => {
|
|
1150
1101
|
if (turnState.state === to)
|
|
@@ -1247,16 +1198,15 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1247
1198
|
let call = normalizeToolCall(rawCall);
|
|
1248
1199
|
const emitVisibleSyntheticReceipt = (result, summary) => {
|
|
1249
1200
|
if (!alreadyPrintedIds.has(toolEventId)) {
|
|
1250
|
-
|
|
1251
|
-
chalk.gray(` ${formatToolArgs(call)}`);
|
|
1252
|
-
writeToolCall(toolEventId, call, styleToolChatter(call, toolCallLine) + "\n");
|
|
1201
|
+
writeToolCall(toolEventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
1202
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
1253
1203
|
alreadyPrintedIds.add(toolEventId);
|
|
1254
1204
|
}
|
|
1255
1205
|
emit({ type: "tool-start", id: toolEventId });
|
|
1256
1206
|
const output = result.output.endsWith("\n")
|
|
1257
1207
|
? result.output
|
|
1258
1208
|
: `${result.output}\n`;
|
|
1259
|
-
writeToolOutput(toolEventId, output
|
|
1209
|
+
writeToolOutput(toolEventId, output);
|
|
1260
1210
|
emitToolResult(toolEventId, result, summary);
|
|
1261
1211
|
};
|
|
1262
1212
|
let dispatchedTaskId;
|
|
@@ -1281,7 +1231,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1281
1231
|
return { ok: false, call, result, contextOutput: reason };
|
|
1282
1232
|
}
|
|
1283
1233
|
if (call.name === "image.ocr" && !imageOcrEnabled) {
|
|
1284
|
-
writeNotice("info", "skipped OCR because the original image is attached to the vision model"
|
|
1234
|
+
writeNotice("info", "skipped OCR because the original image is attached to the vision model");
|
|
1285
1235
|
const recoveryText = "The original image is attached to this message and you can inspect it directly. " +
|
|
1286
1236
|
"Do not call image.ocr or infer text from OCR. Answer the user's question from the actual image pixels now.";
|
|
1287
1237
|
const result = { ok: true, output: recoveryText };
|
|
@@ -1317,14 +1267,13 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1317
1267
|
// no execution, until the model re-issues the identical batch to confirm.
|
|
1318
1268
|
if (call.name === "task.update" && batchRemindCalls.has(rawCall)) {
|
|
1319
1269
|
if (!alreadyPrintedIds.has(toolEventId)) {
|
|
1320
|
-
|
|
1321
|
-
chalk.gray(` ${formatToolArgs(call)}`);
|
|
1322
|
-
writeToolCall(toolEventId, call, styleToolChatter(call, toolCallLine) + "\n");
|
|
1270
|
+
writeToolCall(toolEventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
1271
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
1323
1272
|
alreadyPrintedIds.add(toolEventId);
|
|
1324
1273
|
}
|
|
1325
1274
|
const result = { ok: false, output: batchReminderNote, exitCode: 1 };
|
|
1326
1275
|
emitToolResult(toolEventId, result, batchReminderNote);
|
|
1327
|
-
writeToolOutput(toolEventId, "held\n"
|
|
1276
|
+
writeToolOutput(toolEventId, "held\n");
|
|
1328
1277
|
return { ok: false, call, result, contextOutput: batchReminderNote };
|
|
1329
1278
|
}
|
|
1330
1279
|
const retryReasonRaw = call.args._retryReason;
|
|
@@ -1361,7 +1310,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1361
1310
|
suppressedRepeat: true,
|
|
1362
1311
|
};
|
|
1363
1312
|
}
|
|
1364
|
-
writeNotice("warn", reason
|
|
1313
|
+
writeNotice("warn", reason);
|
|
1365
1314
|
const result = { ok: false, output: reason, exitCode: 1 };
|
|
1366
1315
|
emitToolResult(toolEventId, result, reason);
|
|
1367
1316
|
return {
|
|
@@ -1436,9 +1385,8 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1436
1385
|
unreadResponderNotificationIds.delete(responderWakeNotificationId);
|
|
1437
1386
|
}
|
|
1438
1387
|
if (!alreadyPrintedIds.has(toolEventId)) {
|
|
1439
|
-
|
|
1440
|
-
chalk.gray(` ${formatToolArgs(call)}`);
|
|
1441
|
-
writeToolCall(toolEventId, call, styleToolChatter(call, toolCallLine) + "\n");
|
|
1388
|
+
writeToolCall(toolEventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
1389
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
1442
1390
|
alreadyPrintedIds.add(toolEventId);
|
|
1443
1391
|
}
|
|
1444
1392
|
const result = {
|
|
@@ -1448,7 +1396,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1448
1396
|
};
|
|
1449
1397
|
loopGuard.recordAttempt(step, call.name, call.args, marked, 0);
|
|
1450
1398
|
emitToolResult(toolEventId, result, output);
|
|
1451
|
-
writeToolOutput(toolEventId, marked ? "read\n" : "failed\n"
|
|
1399
|
+
writeToolOutput(toolEventId, marked ? "read\n" : "failed\n");
|
|
1452
1400
|
return {
|
|
1453
1401
|
ok: marked,
|
|
1454
1402
|
call,
|
|
@@ -1496,11 +1444,10 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1496
1444
|
reason: `Task ${resolved} must be in_progress before it can be marked done. Start or retry the task, perform fresh work, then complete it.`,
|
|
1497
1445
|
};
|
|
1498
1446
|
if (!gate.ok) {
|
|
1499
|
-
writeNotice("warn", gate.reason
|
|
1447
|
+
writeNotice("warn", gate.reason);
|
|
1500
1448
|
if (!alreadyPrintedIds.has(toolEventId)) {
|
|
1501
|
-
|
|
1502
|
-
chalk.gray(` ${formatToolArgs(call)}`);
|
|
1503
|
-
writeToolCall(toolEventId, call, styleToolChatter(call, toolCallLine) + "\n");
|
|
1449
|
+
writeToolCall(toolEventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
1450
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
1504
1451
|
alreadyPrintedIds.add(toolEventId);
|
|
1505
1452
|
}
|
|
1506
1453
|
const result = {
|
|
@@ -1509,7 +1456,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1509
1456
|
exitCode: 1,
|
|
1510
1457
|
};
|
|
1511
1458
|
emitToolResult(toolEventId, result, gate.reason);
|
|
1512
|
-
writeToolOutput(toolEventId, "failed\n"
|
|
1459
|
+
writeToolOutput(toolEventId, "failed\n");
|
|
1513
1460
|
return {
|
|
1514
1461
|
ok: false,
|
|
1515
1462
|
call,
|
|
@@ -1576,15 +1523,15 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1576
1523
|
pendingSessionStatePlan = planResult.plan;
|
|
1577
1524
|
}
|
|
1578
1525
|
if (!alreadyPrintedIds.has(toolEventId)) {
|
|
1579
|
-
|
|
1580
|
-
|
|
1526
|
+
writeToolCall(toolEventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
1527
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
1581
1528
|
alreadyPrintedIds.add(toolEventId);
|
|
1582
1529
|
}
|
|
1583
1530
|
if (planResult.reminder && planResult.toast) {
|
|
1584
|
-
writeNotice("warn", planResult.toast
|
|
1531
|
+
writeNotice("warn", planResult.toast);
|
|
1585
1532
|
}
|
|
1586
1533
|
if (planResult.plan) {
|
|
1587
|
-
writePlanUpdate(planResult.plan
|
|
1534
|
+
writePlanUpdate(planResult.plan);
|
|
1588
1535
|
// Refresh sticky root only if path already exists (not bare Desktop).
|
|
1589
1536
|
const root = extractProjectRootFromPlan(planResult.plan);
|
|
1590
1537
|
if (root)
|
|
@@ -1599,8 +1546,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1599
1546
|
}
|
|
1600
1547
|
const result = { ok: planResult.ok, output: planResult.modelNote };
|
|
1601
1548
|
emitToolResult(toolEventId, result, planResult.modelNote);
|
|
1602
|
-
|
|
1603
|
-
writeToolOutput(toolEventId, result.ok ? "ok\n" : "failed\n", statusIcon + "\n");
|
|
1549
|
+
writeToolOutput(toolEventId, result.ok ? "ok\n" : "failed\n");
|
|
1604
1550
|
return {
|
|
1605
1551
|
ok: planResult.ok,
|
|
1606
1552
|
call,
|
|
@@ -1640,16 +1586,15 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1640
1586
|
`Use any recon/enum/scan/research tool; do not write project files or run active exploits. ` +
|
|
1641
1587
|
`Put exploit/implement steps in plan.create tasks for after accept. ` +
|
|
1642
1588
|
`Accept the plan (y/i or /implement) to switch to agent and execute.`;
|
|
1643
|
-
writeNotice("warn", reason
|
|
1589
|
+
writeNotice("warn", reason);
|
|
1644
1590
|
if (!alreadyPrintedIds.has(toolEventId)) {
|
|
1645
|
-
|
|
1646
|
-
chalk.gray(` ${formatToolArgs(call)}`);
|
|
1647
|
-
writeToolCall(toolEventId, call, styleToolChatter(call, toolCallLine) + "\n");
|
|
1591
|
+
writeToolCall(toolEventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
1592
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
1648
1593
|
alreadyPrintedIds.add(toolEventId);
|
|
1649
1594
|
}
|
|
1650
1595
|
const result = { ok: false, output: reason, exitCode: 1 };
|
|
1651
1596
|
emitToolResult(toolEventId, result, reason);
|
|
1652
|
-
writeToolOutput(toolEventId, "failed\n"
|
|
1597
|
+
writeToolOutput(toolEventId, "failed\n");
|
|
1653
1598
|
return {
|
|
1654
1599
|
ok: false,
|
|
1655
1600
|
call,
|
|
@@ -1666,7 +1611,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1666
1611
|
(await loadPlan(session.sessionId).catch(() => undefined));
|
|
1667
1612
|
if (planNow && !session.planApproved.value) {
|
|
1668
1613
|
const reason = `plan awaiting approval — ${call.name} is blocked until the plan is accepted (/implement or Accept)`;
|
|
1669
|
-
writeNotice("warn", reason
|
|
1614
|
+
writeNotice("warn", reason);
|
|
1670
1615
|
const result = { ok: false, output: reason, exitCode: 1 };
|
|
1671
1616
|
return {
|
|
1672
1617
|
ok: false,
|
|
@@ -1721,8 +1666,8 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1721
1666
|
taskWorkLedger.taskId !== nextPending.id) {
|
|
1722
1667
|
taskWorkLedger = ledgerFromTaskEvidence(nextPending.id, nextPending.evidence);
|
|
1723
1668
|
}
|
|
1724
|
-
writePlanUpdate(livePlanForGate
|
|
1725
|
-
writeNotice("info", `auto-started [${nextPending.id}] so work can continue
|
|
1669
|
+
writePlanUpdate(livePlanForGate);
|
|
1670
|
+
writeNotice("info", `auto-started [${nextPending.id}] so work can continue`);
|
|
1726
1671
|
}
|
|
1727
1672
|
}
|
|
1728
1673
|
}
|
|
@@ -1745,16 +1690,15 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1745
1690
|
const message = materialized
|
|
1746
1691
|
? `Scaffold skipped: the target already contains a usable project${target ? ` at ${target}` : ""}. Continue that project directly; do not re-run the scaffolder.`
|
|
1747
1692
|
: `Scaffold was not run: the existing target${target ? ` at ${target}` : ""} is incomplete. Inspect and repair it before completing the scaffold task; do not retry the scaffolder into this non-empty directory.`;
|
|
1748
|
-
writeNotice("info", message
|
|
1693
|
+
writeNotice("info", message);
|
|
1749
1694
|
if (!alreadyPrintedIds.has(toolEventId)) {
|
|
1750
|
-
|
|
1751
|
-
chalk.gray(` ${formatToolArgs(call)}`);
|
|
1752
|
-
writeToolCall(toolEventId, call, styleToolChatter(call, toolCallLine) + "\n");
|
|
1695
|
+
writeToolCall(toolEventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
1696
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
1753
1697
|
alreadyPrintedIds.add(toolEventId);
|
|
1754
1698
|
}
|
|
1755
1699
|
const result = { ok: true, output: message, exitCode: 0 };
|
|
1756
1700
|
emitToolResult(toolEventId, result, message);
|
|
1757
|
-
writeToolOutput(toolEventId, "ok\n"
|
|
1701
|
+
writeToolOutput(toolEventId, "ok\n");
|
|
1758
1702
|
return {
|
|
1759
1703
|
ok: true,
|
|
1760
1704
|
call,
|
|
@@ -1764,8 +1708,8 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1764
1708
|
}
|
|
1765
1709
|
}
|
|
1766
1710
|
if (!alreadyPrintedIds.has(toolEventId)) {
|
|
1767
|
-
|
|
1768
|
-
|
|
1711
|
+
writeToolCall(toolEventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
1712
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
1769
1713
|
alreadyPrintedIds.add(toolEventId);
|
|
1770
1714
|
}
|
|
1771
1715
|
const scopeTarget = safeScopeTargetForToolCall(call);
|
|
@@ -1815,14 +1759,14 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1815
1759
|
reason: decisionForAction.reason,
|
|
1816
1760
|
allowed: scope?.authorizedTargets,
|
|
1817
1761
|
});
|
|
1818
|
-
writeToolBlocked(toolEventId, call.name, reason
|
|
1762
|
+
writeToolBlocked(toolEventId, call.name, reason);
|
|
1819
1763
|
const result = { ok: false, output: reason, exitCode: 1 };
|
|
1820
1764
|
emitToolResult(toolEventId, result, reason);
|
|
1821
1765
|
return { ok: false, call, result, contextOutput: reason };
|
|
1822
1766
|
}
|
|
1823
1767
|
}
|
|
1824
1768
|
if (decision.level === "block") {
|
|
1825
|
-
writeToolBlocked(toolEventId, call.name, decision.reason
|
|
1769
|
+
writeToolBlocked(toolEventId, call.name, decision.reason);
|
|
1826
1770
|
const message = `Blocked: ${call.name} — ${decision.reason}`;
|
|
1827
1771
|
const result = { ok: false, output: message, exitCode: 1 };
|
|
1828
1772
|
return {
|
|
@@ -1844,7 +1788,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1844
1788
|
restoreInteractiveStdin();
|
|
1845
1789
|
if (!authorized) {
|
|
1846
1790
|
const lastAnswer = "Pentest authorization not confirmed.";
|
|
1847
|
-
writeToolBlocked(toolEventId, call.name, lastAnswer
|
|
1791
|
+
writeToolBlocked(toolEventId, call.name, lastAnswer);
|
|
1848
1792
|
const result = { ok: false, output: lastAnswer, exitCode: 1 };
|
|
1849
1793
|
return {
|
|
1850
1794
|
ok: false,
|
|
@@ -1898,7 +1842,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1898
1842
|
restoreInteractiveStdin();
|
|
1899
1843
|
if (!ok) {
|
|
1900
1844
|
const lastAnswer = "Cancelled.";
|
|
1901
|
-
writeToolBlocked(toolEventId, call.name, lastAnswer
|
|
1845
|
+
writeToolBlocked(toolEventId, call.name, lastAnswer);
|
|
1902
1846
|
const result = { ok: false, output: lastAnswer, exitCode: 1 };
|
|
1903
1847
|
return {
|
|
1904
1848
|
ok: false,
|
|
@@ -1961,11 +1905,11 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1961
1905
|
}).catch(() => undefined);
|
|
1962
1906
|
if (!created?.ok || !delegation.taskId) {
|
|
1963
1907
|
delegation = undefined;
|
|
1964
|
-
writeNotice("warn", "Responder delegation record could not be persisted — the job will be linked after launch"
|
|
1908
|
+
writeNotice("warn", "Responder delegation record could not be persisted — the job will be linked after launch");
|
|
1965
1909
|
}
|
|
1966
1910
|
else if (created.plan) {
|
|
1967
1911
|
pendingSessionStatePlan = created.plan;
|
|
1968
|
-
writePlanUpdate(created.plan
|
|
1912
|
+
writePlanUpdate(created.plan);
|
|
1969
1913
|
}
|
|
1970
1914
|
}
|
|
1971
1915
|
if (dispatchedTaskId &&
|
|
@@ -1993,7 +1937,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
1993
1937
|
options.onToolStart?.(call);
|
|
1994
1938
|
// Card was "queued" since writeToolCall; flip to running only when work starts.
|
|
1995
1939
|
emit({ type: "tool-start", id: toolEventId });
|
|
1996
|
-
writeStatus(call.name
|
|
1940
|
+
writeStatus(call.name);
|
|
1997
1941
|
// Elevation uses the secure secret modal (TUI) or is refused — never
|
|
1998
1942
|
// a raw TTY "Password:" that freezes the UI. No misleading notice.
|
|
1999
1943
|
const toolAc = new AbortController();
|
|
@@ -2013,7 +1957,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2013
1957
|
liveBytes += chunk.length;
|
|
2014
1958
|
const indented = chunk.replace(/\r/g, "").replace(/\n(?!$)/g, "\n ");
|
|
2015
1959
|
const body = indented.startsWith("\n") ? indented : ` ${indented}`;
|
|
2016
|
-
writeToolOutput(toolEventId, chunk
|
|
1960
|
+
writeToolOutput(toolEventId, chunk);
|
|
2017
1961
|
};
|
|
2018
1962
|
const jobId = randomUUID().slice(0, 8);
|
|
2019
1963
|
const emptyJobArtifact = () => ({
|
|
@@ -2057,7 +2001,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2057
2001
|
stallTimer = setTimeout(() => {
|
|
2058
2002
|
if (!toolAc.signal.aborted) {
|
|
2059
2003
|
stalledByWatchdog = true;
|
|
2060
|
-
writeNotice("warn", `${call.name} has been running for >${stallSecs}s without output — cancelling stalled tool
|
|
2004
|
+
writeNotice("warn", `${call.name} has been running for >${stallSecs}s without output — cancelling stalled tool`);
|
|
2061
2005
|
toolAc.abort();
|
|
2062
2006
|
}
|
|
2063
2007
|
}, TOOL_STALL_ABORT_MS);
|
|
@@ -2073,7 +2017,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2073
2017
|
const runToolWithForcedSettle = () => {
|
|
2074
2018
|
const work = runToolCall(call, {
|
|
2075
2019
|
signal: toolAc.signal,
|
|
2076
|
-
requestSecret: options.requestSecret ??
|
|
2020
|
+
requestSecret: options.requestSecret ?? stdioSecretRequester,
|
|
2077
2021
|
onOutput: (chunk) => {
|
|
2078
2022
|
if (toolAc.signal.aborted)
|
|
2079
2023
|
return;
|
|
@@ -2169,7 +2113,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2169
2113
|
graceTimer = setTimeout(() => {
|
|
2170
2114
|
if (settled)
|
|
2171
2115
|
return;
|
|
2172
|
-
writeNotice("warn", `${call.name} did not stop after cancel — force-settling
|
|
2116
|
+
writeNotice("warn", `${call.name} did not stop after cancel — force-settling`);
|
|
2173
2117
|
finishOk(forceCancelResult());
|
|
2174
2118
|
}, TOOL_ABORT_GRACE_MS);
|
|
2175
2119
|
graceTimer.unref?.();
|
|
@@ -2180,7 +2124,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2180
2124
|
if (settled)
|
|
2181
2125
|
return;
|
|
2182
2126
|
hardTimedOut = true;
|
|
2183
|
-
writeNotice("warn", `${call.name} exceeded ${hardSecs}s hard budget — cancelling
|
|
2127
|
+
writeNotice("warn", `${call.name} exceeded ${hardSecs}s hard budget — cancelling`);
|
|
2184
2128
|
if (!toolAc.signal.aborted)
|
|
2185
2129
|
toolAc.abort();
|
|
2186
2130
|
armGraceForceSettle();
|
|
@@ -2215,7 +2159,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2215
2159
|
};
|
|
2216
2160
|
}
|
|
2217
2161
|
if (liveBytes > 0) {
|
|
2218
|
-
writeToolOutput(toolEventId, "\n"
|
|
2162
|
+
writeToolOutput(toolEventId, "\n");
|
|
2219
2163
|
}
|
|
2220
2164
|
jobManager.updateJobStatus(jobId, result.ok ? "exited" : "failed", result.exitCode);
|
|
2221
2165
|
}
|
|
@@ -2267,7 +2211,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2267
2211
|
const output = result.output.endsWith("\n")
|
|
2268
2212
|
? result.output
|
|
2269
2213
|
: `${result.output}\n`;
|
|
2270
|
-
writeToolOutput(toolEventId, output,
|
|
2214
|
+
writeToolOutput(toolEventId, output, { replace: true });
|
|
2271
2215
|
emitToolResult(toolEventId, result, contextOutput);
|
|
2272
2216
|
options.onToolResult?.(call, result);
|
|
2273
2217
|
// Record it as an observation-free success so the per-call guard can
|
|
@@ -2326,7 +2270,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2326
2270
|
`(package/manifest present). Treat this as resumable: do NOT re-run the scaffolder. ` +
|
|
2327
2271
|
`Inspect the existing files, finish any missing install, implement the requested feature, then run/verify.`,
|
|
2328
2272
|
};
|
|
2329
|
-
writeNotice("info", `project root → ${fromScaffold} (existing materialized scaffold — continue)
|
|
2273
|
+
writeNotice("info", `project root → ${fromScaffold} (existing materialized scaffold — continue)`);
|
|
2330
2274
|
}
|
|
2331
2275
|
else if (result.ok && cancelled && !materialized) {
|
|
2332
2276
|
result = {
|
|
@@ -2357,13 +2301,13 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2357
2301
|
else if (fromScaffold) {
|
|
2358
2302
|
setActiveProjectRootIfValid(fromScaffold, { force: true });
|
|
2359
2303
|
await persistProjectRootOnPlan(fromScaffold);
|
|
2360
|
-
writeNotice("info", `project root → ${fromScaffold} (scaffold output claimed success — continue)
|
|
2304
|
+
writeNotice("info", `project root → ${fromScaffold} (scaffold output claimed success — continue)`);
|
|
2361
2305
|
}
|
|
2362
2306
|
}
|
|
2363
2307
|
else if (result.ok && fromScaffold && materialized) {
|
|
2364
2308
|
setActiveProjectRootIfValid(fromScaffold, { force: true });
|
|
2365
2309
|
await persistProjectRootOnPlan(fromScaffold);
|
|
2366
|
-
writeNotice("info", `project root → ${fromScaffold}
|
|
2310
|
+
writeNotice("info", `project root → ${fromScaffold}`);
|
|
2367
2311
|
}
|
|
2368
2312
|
}
|
|
2369
2313
|
if (delegation?.taskId && !result.backgroundJob) {
|
|
@@ -2383,7 +2327,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2383
2327
|
}).catch(() => undefined);
|
|
2384
2328
|
if (settlement?.ok && settlement.plan) {
|
|
2385
2329
|
pendingSessionStatePlan = settlement.plan;
|
|
2386
|
-
writePlanUpdate(settlement.plan
|
|
2330
|
+
writePlanUpdate(settlement.plan);
|
|
2387
2331
|
}
|
|
2388
2332
|
delegation = undefined;
|
|
2389
2333
|
}
|
|
@@ -2461,7 +2405,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2461
2405
|
return true;
|
|
2462
2406
|
}).catch(() => undefined);
|
|
2463
2407
|
if (!upsert?.ok || !responderChildId) {
|
|
2464
|
-
writeNotice("warn", `Responder job ${durableJob.id} started, but its plan subtask could not be persisted
|
|
2408
|
+
writeNotice("warn", `Responder job ${durableJob.id} started, but its plan subtask could not be persisted`);
|
|
2465
2409
|
}
|
|
2466
2410
|
else {
|
|
2467
2411
|
linkedTaskId = responderChildId;
|
|
@@ -2469,7 +2413,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2469
2413
|
responderTaskId = responderChildId;
|
|
2470
2414
|
pendingSessionStatePlan = upsert.plan ?? livePlan;
|
|
2471
2415
|
const rendered = upsert.plan ?? livePlan;
|
|
2472
|
-
writePlanUpdate(rendered
|
|
2416
|
+
writePlanUpdate(rendered);
|
|
2473
2417
|
}
|
|
2474
2418
|
}
|
|
2475
2419
|
if (durableJob) {
|
|
@@ -2487,7 +2431,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2487
2431
|
},
|
|
2488
2432
|
});
|
|
2489
2433
|
if (!linkedJob) {
|
|
2490
|
-
writeNotice("warn", `Responder job ${durableJob.id} started, but durable task linkage will be retried on completion
|
|
2434
|
+
writeNotice("warn", `Responder job ${durableJob.id} started, but durable task linkage will be retried on completion`);
|
|
2491
2435
|
}
|
|
2492
2436
|
else if (responderTaskId) {
|
|
2493
2437
|
result = {
|
|
@@ -2618,23 +2562,6 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2618
2562
|
: ""),
|
|
2619
2563
|
});
|
|
2620
2564
|
}
|
|
2621
|
-
else if (governed.recommendation === "paused_budget") {
|
|
2622
|
-
if (pauseMode === "never") {
|
|
2623
|
-
// Soft reset so we do not re-trip every subsequent tool.
|
|
2624
|
-
governorState = {
|
|
2625
|
-
...governed.state,
|
|
2626
|
-
consecutiveNoDelta: 0,
|
|
2627
|
-
};
|
|
2628
|
-
deferredPostToolMessages.push({
|
|
2629
|
-
role: "system",
|
|
2630
|
-
content: `PROGRESS GOVERNOR (soft, coding build): ${governed.reason}. ` +
|
|
2631
|
-
"Change approach if stuck, but keep implementing — do not stop for user confirmation.",
|
|
2632
|
-
});
|
|
2633
|
-
}
|
|
2634
|
-
else {
|
|
2635
|
-
governorPauseReason = governed.reason;
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
2565
|
}
|
|
2639
2566
|
await saveOutcomeState(outcomeState);
|
|
2640
2567
|
loopGuard.recordAttempt(step, call.name, call.args, result.ok, result.exitCode, result.output, completedProbeState ? { stateKey: completedProbeState } : undefined);
|
|
@@ -2735,51 +2662,14 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
2735
2662
|
if (reflection) {
|
|
2736
2663
|
deferredPostToolMessages.push({ role: "system", content: reflection });
|
|
2737
2664
|
const failCount = loopGuard.consecutiveFailureCount();
|
|
2738
|
-
writeNotice("warn", `${failCount} consecutive failures — model evaluating approach
|
|
2665
|
+
writeNotice("warn", `${failCount} consecutive failures — model evaluating approach`);
|
|
2739
2666
|
}
|
|
2740
2667
|
}
|
|
2741
|
-
const statusIcon = result.ok ? chalk.green(" ✓") : chalk.red(" ✗");
|
|
2742
|
-
// Classic stdout gets a short status glyph; the event stream / spool
|
|
2743
|
-
// must NOT be polluted with "ok"/"failed" (the card already shows status).
|
|
2744
|
-
if (writesDirectly) {
|
|
2745
|
-
process.stdout.write(statusIcon + "\n");
|
|
2746
|
-
}
|
|
2747
2668
|
if (output) {
|
|
2748
2669
|
// Authoritative FULL body — replace any live stream so the pager
|
|
2749
2670
|
// never shows a truncated mid-run preview. Never cap for the UI.
|
|
2750
2671
|
const fullChunk = output.endsWith("\n") ? output : `${output}\n`;
|
|
2751
|
-
|
|
2752
|
-
writeToolOutput(toolEventId, fullChunk, "", { replace: true });
|
|
2753
|
-
}
|
|
2754
|
-
else {
|
|
2755
|
-
// Classic stdout: short preview only; full text is on disk.
|
|
2756
|
-
const displayMax = 6_000;
|
|
2757
|
-
const displaySummary = summarizeOutput(output, displayMax);
|
|
2758
|
-
const displayText = displaySummary.truncated
|
|
2759
|
-
? `${displaySummary.text}${savedOutputPath ? chalk.dim(`\n ... full output saved to ${savedOutputPath}`) : ""}`
|
|
2760
|
-
: displaySummary.text;
|
|
2761
|
-
const renderedOutput = indentAndWrapText(displayText);
|
|
2762
|
-
process.stdout.write(styleToolChatter(call, renderedOutput) + "\n");
|
|
2763
|
-
if (savedOutputPath && displaySummary.truncated) {
|
|
2764
|
-
process.stdout.write(chalk.dim(` full output saved to ${savedOutputPath}\n`));
|
|
2765
|
-
}
|
|
2766
|
-
}
|
|
2767
|
-
}
|
|
2768
|
-
if (output) {
|
|
2769
|
-
const viewport = registerViewport({
|
|
2770
|
-
toolName: call.name,
|
|
2771
|
-
argsDisplay: formatToolArgs(call),
|
|
2772
|
-
artifactPath: savedOutputPath,
|
|
2773
|
-
summary: contextOutput,
|
|
2774
|
-
});
|
|
2775
|
-
if (writesDirectly && savedOutputPath) {
|
|
2776
|
-
const short = chalk.dim(` saved ${savedOutputPath}\n`);
|
|
2777
|
-
process.stdout.write(short);
|
|
2778
|
-
}
|
|
2779
|
-
else if (writesDirectly) {
|
|
2780
|
-
const viewportHint = `${formatViewportHint(viewport)}\n`;
|
|
2781
|
-
process.stdout.write(viewportHint);
|
|
2782
|
-
}
|
|
2672
|
+
writeToolOutput(toolEventId, fullChunk, { replace: true });
|
|
2783
2673
|
}
|
|
2784
2674
|
return { ok: result.ok, call, result, contextOutput };
|
|
2785
2675
|
}
|
|
@@ -3023,7 +2913,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3023
2913
|
trigger: compactTrigger,
|
|
3024
2914
|
dominant,
|
|
3025
2915
|
});
|
|
3026
|
-
writeNotice("warn", `context is still ~${candidateTokens.toLocaleString()} tokens after compaction (limit ~${compactTrigger.toLocaleString()}) — largest block: ${dominant}
|
|
2916
|
+
writeNotice("warn", `context is still ~${candidateTokens.toLocaleString()} tokens after compaction (limit ~${compactTrigger.toLocaleString()}) — largest block: ${dominant}`);
|
|
3027
2917
|
writeCompactionFailed(compactionId, `Summary remained over the context limit; largest block: ${dominant}.`, beforeTokens);
|
|
3028
2918
|
return;
|
|
3029
2919
|
}
|
|
@@ -3060,7 +2950,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3060
2950
|
// Report the final assembled request, including live plan and session
|
|
3061
2951
|
// state reinjection, so the card and the next provider request agree.
|
|
3062
2952
|
writeCompactionCompleted(compactionId, summaryText, beforeTokens, afterTokens);
|
|
3063
|
-
writeNotice("info", `context auto-compacted to fit the window (~${beforeTokens.toLocaleString()} → ~${afterTokens.toLocaleString()} tokens)
|
|
2953
|
+
writeNotice("info", `context auto-compacted to fit the window (~${beforeTokens.toLocaleString()} → ~${afterTokens.toLocaleString()} tokens)`);
|
|
3064
2954
|
}
|
|
3065
2955
|
catch (error) {
|
|
3066
2956
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -3082,55 +2972,6 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3082
2972
|
// `step` is the productive-step index (used for display + audit). It only
|
|
3083
2973
|
// advances when the previous iteration actually executed a tool.
|
|
3084
2974
|
step = productiveSteps;
|
|
3085
|
-
if (governorPauseReason) {
|
|
3086
|
-
// Non-coding: always ask continue/stop. Coding never sets this reason
|
|
3087
|
-
// (pauseMode === "never"), but guard anyway.
|
|
3088
|
-
if (pauseMode === "never") {
|
|
3089
|
-
governorPauseReason = undefined;
|
|
3090
|
-
governorState = {
|
|
3091
|
-
...governorState,
|
|
3092
|
-
consecutiveNoDelta: 0,
|
|
3093
|
-
};
|
|
3094
|
-
}
|
|
3095
|
-
else {
|
|
3096
|
-
const confirmPort = options.confirm;
|
|
3097
|
-
let keepGoing = false;
|
|
3098
|
-
if (confirmPort?.confirmContinue) {
|
|
3099
|
-
try {
|
|
3100
|
-
keepGoing = await confirmPort.confirmContinue(productiveSteps, governorPauseReason);
|
|
3101
|
-
}
|
|
3102
|
-
catch {
|
|
3103
|
-
keepGoing = false;
|
|
3104
|
-
}
|
|
3105
|
-
finally {
|
|
3106
|
-
restoreInteractiveStdin();
|
|
3107
|
-
}
|
|
3108
|
-
}
|
|
3109
|
-
if (keepGoing) {
|
|
3110
|
-
writeNotice("info", "continuing after progress pause", chalk.dim(` ℹ continuing after pause (${governorPauseReason}) — change approach if stuck\n`));
|
|
3111
|
-
deferredPostToolMessages.push({
|
|
3112
|
-
role: "system",
|
|
3113
|
-
content: `User chose CONTINUE after progress pause (${governorPauseReason}). ` +
|
|
3114
|
-
"Do not repeat the same failing step; change approach and produce new evidence.",
|
|
3115
|
-
});
|
|
3116
|
-
governorPauseReason = undefined;
|
|
3117
|
-
governorState = {
|
|
3118
|
-
...governorState,
|
|
3119
|
-
consecutiveNoDelta: 0,
|
|
3120
|
-
};
|
|
3121
|
-
}
|
|
3122
|
-
else {
|
|
3123
|
-
const richSummary = await buildRichStopSummary(messages, session, productiveSteps);
|
|
3124
|
-
outcomeState.outcome.status = "paused_budget";
|
|
3125
|
-
await saveOutcomeState(outcomeState);
|
|
3126
|
-
moveTurn("paused_budget", governorPauseReason);
|
|
3127
|
-
lastAnswer = richSummary;
|
|
3128
|
-
return finishTurn(lastAnswer, productiveSteps, "paused_budget", outcomeState.outcome.criteria
|
|
3129
|
-
.filter((criterion) => criterion.required && criterion.status !== "proven")
|
|
3130
|
-
.map((criterion) => criterion.statement), governorPauseReason);
|
|
3131
|
-
}
|
|
3132
|
-
}
|
|
3133
|
-
}
|
|
3134
2975
|
options.signal?.throwIfAborted();
|
|
3135
2976
|
let call;
|
|
3136
2977
|
let assistantText;
|
|
@@ -3140,7 +2981,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3140
2981
|
call = pendingCalls.shift();
|
|
3141
2982
|
assistantText = { visible: "", thinkContent: "", hasThinking: false };
|
|
3142
2983
|
const batchStatus = ` ↳ continuing batch (${pendingCalls.length} more queued)\n`;
|
|
3143
|
-
writeStatus(batchStatus
|
|
2984
|
+
writeStatus(batchStatus);
|
|
3144
2985
|
}
|
|
3145
2986
|
else {
|
|
3146
2987
|
await maybeAutoCompact("auto-token-budget");
|
|
@@ -3150,12 +2991,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3150
2991
|
// tool protocol or forcing a separate busy-wait loop.
|
|
3151
2992
|
const responderDelivery = refreshResponderInbox();
|
|
3152
2993
|
const streamLabel = step === 0 ? "waiting for model" : `step ${step + 1}`;
|
|
3153
|
-
|
|
3154
|
-
? startThinkingSpinner(streamLabel, options.signal)
|
|
3155
|
-
: noopSpinner;
|
|
3156
|
-
if (!writesDirectly) {
|
|
3157
|
-
emit({ type: "status", text: streamLabel });
|
|
3158
|
-
}
|
|
2994
|
+
emit({ type: "status", text: streamLabel });
|
|
3159
2995
|
let sawReasoning = false;
|
|
3160
2996
|
let inThinking = false;
|
|
3161
2997
|
let emittedThinkingStatus = false;
|
|
@@ -3175,24 +3011,18 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3175
3011
|
return "waiting for model";
|
|
3176
3012
|
};
|
|
3177
3013
|
const heartbeat = setInterval(() => {
|
|
3178
|
-
|
|
3179
|
-
if (writesDirectly)
|
|
3180
|
-
spinner.setLabel(text);
|
|
3181
|
-
else
|
|
3182
|
-
emit({ type: "status", text });
|
|
3014
|
+
emit({ type: "status", text: streamPhase() });
|
|
3183
3015
|
}, 10_000);
|
|
3184
3016
|
heartbeat.unref?.();
|
|
3185
3017
|
const deferredToolCalls = [];
|
|
3186
3018
|
const streamedNativeCallNames = new Map();
|
|
3187
|
-
const deltaParser =
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
emit({ type: "thinking-delta", text });
|
|
3195
|
-
});
|
|
3019
|
+
const deltaParser = createThinkingStreamParser((text) => emit({ type: "assistant-delta", text }), (text) => {
|
|
3020
|
+
if (!emittedThinkingStatus) {
|
|
3021
|
+
emittedThinkingStatus = true;
|
|
3022
|
+
emit({ type: "status", text: "thinking" });
|
|
3023
|
+
}
|
|
3024
|
+
emit({ type: "thinking-delta", text });
|
|
3025
|
+
});
|
|
3196
3026
|
let completion;
|
|
3197
3027
|
let toolsAttached = false;
|
|
3198
3028
|
try {
|
|
@@ -3230,7 +3060,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3230
3060
|
if (notice.includes("Large context")) {
|
|
3231
3061
|
freeTierLargeContextWarned = true;
|
|
3232
3062
|
}
|
|
3233
|
-
writeNotice("info", notice
|
|
3063
|
+
writeNotice("info", notice);
|
|
3234
3064
|
}
|
|
3235
3065
|
}
|
|
3236
3066
|
const contextLimitTokens = currentContextLimitTokens();
|
|
@@ -3299,23 +3129,17 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3299
3129
|
return;
|
|
3300
3130
|
const name = fromWireName(delta.name) ?? delta.name;
|
|
3301
3131
|
streamedNativeCallNames.set(delta.index, name);
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
});
|
|
3309
|
-
}
|
|
3310
|
-
else {
|
|
3311
|
-
spinner.stop();
|
|
3312
|
-
spinner = startThinkingSpinner(`tool ${name}…`, options.signal);
|
|
3313
|
-
}
|
|
3132
|
+
emit({
|
|
3133
|
+
type: "status",
|
|
3134
|
+
text: delta.argumentsBytes && delta.argumentsBytes >= 4096
|
|
3135
|
+
? `${name} (${Math.round(delta.argumentsBytes / 1024)}KB args)`
|
|
3136
|
+
: name,
|
|
3137
|
+
});
|
|
3314
3138
|
},
|
|
3315
3139
|
}
|
|
3316
3140
|
: {}),
|
|
3317
3141
|
}, (token) => {
|
|
3318
|
-
deltaParser
|
|
3142
|
+
deltaParser.push(token);
|
|
3319
3143
|
generatedTokens += 1;
|
|
3320
3144
|
accumulatedText += token;
|
|
3321
3145
|
// Early UI cards from text fences only when native tools are off
|
|
@@ -3323,33 +3147,22 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3323
3147
|
if (!toolsAttached) {
|
|
3324
3148
|
const parsedCalls = parseAllToolCalls(accumulatedText);
|
|
3325
3149
|
if (parsedCalls.length > streamedCallsCount) {
|
|
3326
|
-
if (writesDirectly) {
|
|
3327
|
-
spinner.stop();
|
|
3328
|
-
}
|
|
3329
3150
|
while (streamedCallsCount < parsedCalls.length) {
|
|
3330
3151
|
const call = normalizeToolCall(parsedCalls[streamedCallsCount]);
|
|
3331
3152
|
const eventId = `tool-${++nextToolEventId}`;
|
|
3332
3153
|
callIds[streamedCallsCount] = eventId;
|
|
3333
3154
|
alreadyPrintedIds.add(eventId);
|
|
3334
|
-
|
|
3335
|
-
chalk.gray(` ${formatToolArgs(call)}`);
|
|
3336
|
-
const entry = {
|
|
3155
|
+
deferredToolCalls.push({
|
|
3337
3156
|
eventId,
|
|
3338
3157
|
call,
|
|
3339
|
-
rendered:
|
|
3340
|
-
shown:
|
|
3341
|
-
};
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
entry.shown = true;
|
|
3346
|
-
emit({ type: "status", text: call.name });
|
|
3347
|
-
}
|
|
3158
|
+
rendered: "",
|
|
3159
|
+
shown: true,
|
|
3160
|
+
});
|
|
3161
|
+
writeToolCall(eventId, call, styleToolChatter(call, chalk.cyan(` ▶ ${call.name}`) +
|
|
3162
|
+
chalk.gray(` ${formatToolArgs(call)}`)) + "\n");
|
|
3163
|
+
emit({ type: "status", text: call.name });
|
|
3348
3164
|
streamedCallsCount += 1;
|
|
3349
3165
|
}
|
|
3350
|
-
if (writesDirectly) {
|
|
3351
|
-
spinner = startThinkingSpinner(`generating response (${generatedTokens} tokens)`, options.signal);
|
|
3352
|
-
}
|
|
3353
3166
|
}
|
|
3354
3167
|
}
|
|
3355
3168
|
if (!sawReasoning &&
|
|
@@ -3357,37 +3170,19 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3357
3170
|
/^\s*<think(?:ing)?\b/i.test(accumulatedText))) {
|
|
3358
3171
|
sawReasoning = true;
|
|
3359
3172
|
inThinking = true;
|
|
3360
|
-
|
|
3361
|
-
if (!writesDirectly)
|
|
3362
|
-
emit({ type: "status", text: "thinking" });
|
|
3173
|
+
emit({ type: "status", text: "thinking" });
|
|
3363
3174
|
}
|
|
3364
3175
|
if (token.includes(REASONING_CLOSE) ||
|
|
3365
3176
|
(inThinking && /<\/think(?:ing)?>/i.test(token))) {
|
|
3366
3177
|
inThinking = false;
|
|
3367
|
-
spinner.setLabel("generating response (0 tokens)");
|
|
3368
3178
|
generatedTokens = 0;
|
|
3369
3179
|
}
|
|
3370
|
-
if (inThinking) {
|
|
3371
|
-
const cleaned = stripReasoningMarkers(token).replace(/<\/?think(?:ing)?[^>]*>/gi, "");
|
|
3372
|
-
if (cleaned) {
|
|
3373
|
-
spinner.pushPreview(cleaned);
|
|
3374
|
-
const approx = cleaned.split(/\s+/).filter(Boolean).length;
|
|
3375
|
-
if (approx > 0)
|
|
3376
|
-
spinner.bumpReasoning(approx);
|
|
3377
|
-
}
|
|
3378
|
-
}
|
|
3379
|
-
else {
|
|
3380
|
-
if (generatedTokens % 10 === 0) {
|
|
3381
|
-
spinner.setLabel(`generating response (${generatedTokens} tokens)`);
|
|
3382
|
-
}
|
|
3383
|
-
}
|
|
3384
3180
|
}, (status) => {
|
|
3385
|
-
|
|
3386
|
-
writeStatus(status, chalk.dim(status));
|
|
3181
|
+
writeStatus(status);
|
|
3387
3182
|
// Toast only on key *switch* after a failure — never on sticky
|
|
3388
3183
|
// "using" or retry countdown ticks (those stay in composer status).
|
|
3389
3184
|
if (/^switching /i.test(status.trim())) {
|
|
3390
|
-
writeNotice("warn", status.trim()
|
|
3185
|
+
writeNotice("warn", status.trim());
|
|
3391
3186
|
}
|
|
3392
3187
|
});
|
|
3393
3188
|
freeTierConsecutiveFailures = 0;
|
|
@@ -3413,7 +3208,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3413
3208
|
})) {
|
|
3414
3209
|
if (notice.includes("Large context"))
|
|
3415
3210
|
continue; // already shown above
|
|
3416
|
-
writeNotice("warn", notice
|
|
3211
|
+
writeNotice("warn", notice);
|
|
3417
3212
|
freeTierAdvisoryShown = true;
|
|
3418
3213
|
}
|
|
3419
3214
|
}
|
|
@@ -3451,8 +3246,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3451
3246
|
const terminalFailure = plan.action === "give-up";
|
|
3452
3247
|
let continuationNudge = "";
|
|
3453
3248
|
if (partialStream) {
|
|
3454
|
-
|
|
3455
|
-
deltaParser?.finish();
|
|
3249
|
+
deltaParser.finish();
|
|
3456
3250
|
const hasShownToolCall = deferredToolCalls.some((entry) => entry.shown);
|
|
3457
3251
|
if (partialVisible) {
|
|
3458
3252
|
// Finalizing here would close the streaming card and split one
|
|
@@ -3471,7 +3265,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3471
3265
|
});
|
|
3472
3266
|
interruptedVisible += normalizedPartialVisible;
|
|
3473
3267
|
}
|
|
3474
|
-
else if (terminalFailure
|
|
3268
|
+
else if (terminalFailure) {
|
|
3475
3269
|
emit({ type: "assistant-message", text: "" });
|
|
3476
3270
|
}
|
|
3477
3271
|
if (partial.hasThinking && !hasShownToolCall) {
|
|
@@ -3483,7 +3277,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3483
3277
|
for (const deferred of deferredToolCalls) {
|
|
3484
3278
|
if (!deferred.shown || deferred.call.name === "…")
|
|
3485
3279
|
continue;
|
|
3486
|
-
writeToolBlocked(deferred.eventId, deferred.call.name, "Incomplete tool call discarded after the provider stream was interrupted."
|
|
3280
|
+
writeToolBlocked(deferred.eventId, deferred.call.name, "Incomplete tool call discarded after the provider stream was interrupted.");
|
|
3487
3281
|
}
|
|
3488
3282
|
continuationNudge = [
|
|
3489
3283
|
partialVisible
|
|
@@ -3498,7 +3292,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3498
3292
|
: lowYieldResumptions > 1
|
|
3499
3293
|
? `route is dropping after almost no output (${lowYieldResumptions} in a row) — switching model`
|
|
3500
3294
|
: "partial response preserved — resuming from the interruption";
|
|
3501
|
-
writeNotice("warn", restartNotice
|
|
3295
|
+
writeNotice("warn", restartNotice);
|
|
3502
3296
|
}
|
|
3503
3297
|
if (terminalFailure) {
|
|
3504
3298
|
throw streamError;
|
|
@@ -3509,7 +3303,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3509
3303
|
preferModelFallback = true;
|
|
3510
3304
|
}
|
|
3511
3305
|
if (plan.notice) {
|
|
3512
|
-
writeNotice("warn", plan.notice
|
|
3306
|
+
writeNotice("warn", plan.notice);
|
|
3513
3307
|
}
|
|
3514
3308
|
if (plan.disableThinking)
|
|
3515
3309
|
retryWithoutThinking = true;
|
|
@@ -3537,9 +3331,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3537
3331
|
}
|
|
3538
3332
|
}
|
|
3539
3333
|
finally {
|
|
3540
|
-
// Always clear the spinner — abort, network error, or success.
|
|
3541
3334
|
clearInterval(heartbeat);
|
|
3542
|
-
spinner.stop();
|
|
3543
3335
|
}
|
|
3544
3336
|
if (responderDelivery) {
|
|
3545
3337
|
// The result text is now part of this turn, so consumption is durable.
|
|
@@ -3577,7 +3369,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3577
3369
|
});
|
|
3578
3370
|
}
|
|
3579
3371
|
}
|
|
3580
|
-
deltaParser
|
|
3372
|
+
deltaParser.finish();
|
|
3581
3373
|
// Sticky text-only may have flipped dialect during stream retry.
|
|
3582
3374
|
({ dialect: toolDialect, native: nativeToolsActive } =
|
|
3583
3375
|
resolveNativeTools(provider, model));
|
|
@@ -3599,10 +3391,10 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3599
3391
|
if (displayText) {
|
|
3600
3392
|
writeAssistantMessage(displayText);
|
|
3601
3393
|
}
|
|
3602
|
-
else
|
|
3394
|
+
else {
|
|
3603
3395
|
emit({ type: "assistant-message", text: "" });
|
|
3604
3396
|
}
|
|
3605
|
-
if (assistantText.hasThinking
|
|
3397
|
+
if (assistantText.hasThinking) {
|
|
3606
3398
|
emit({
|
|
3607
3399
|
type: "thinking-block",
|
|
3608
3400
|
content: assistantText.thinkContent,
|
|
@@ -3614,18 +3406,6 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3614
3406
|
interruptedReasoning = "";
|
|
3615
3407
|
lowYieldResumptions = 0;
|
|
3616
3408
|
};
|
|
3617
|
-
// Only emit a thinking-block event when the classic renderer is
|
|
3618
|
-
// active (writesDirectly / no deltaParser). In TUI v2 the
|
|
3619
|
-
// deltaParser already streamed thinking-delta events that created
|
|
3620
|
-
// the thinking item in the correct transcript position; emitting
|
|
3621
|
-
// a redundant thinking-block after tool-call events have cleared
|
|
3622
|
-
// pendingThinkingId causes the reducer to append a *duplicate*
|
|
3623
|
-
// thinking item at the end of the transcript — the root cause of
|
|
3624
|
-
// the "ghost thinking blocks below the response" bug seen with
|
|
3625
|
-
// models that use reasoning_content (e.g. Kimi K2-thinking).
|
|
3626
|
-
if (assistantText.hasThinking && !deltaParser) {
|
|
3627
|
-
writeThinkingBlock(assistantText.thinkContent);
|
|
3628
|
-
}
|
|
3629
3409
|
// Native-first: prefer structured toolCalls from the provider.
|
|
3630
3410
|
let nativeToolCalls = completion.toolCalls ?? [];
|
|
3631
3411
|
// Early UI cards: refresh args if stream deltas already opened cards;
|
|
@@ -3641,12 +3421,10 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3641
3421
|
const eventId = `tool-${++nextToolEventId}`;
|
|
3642
3422
|
callIds[i] = eventId;
|
|
3643
3423
|
alreadyPrintedIds.add(eventId);
|
|
3644
|
-
const toolCallLine = chalk.cyan(` ▶ ${normalized.name}`) +
|
|
3645
|
-
chalk.gray(` ${formatToolArgs(normalized)}`);
|
|
3646
3424
|
deferredToolCalls.push({
|
|
3647
3425
|
eventId,
|
|
3648
3426
|
call: normalized,
|
|
3649
|
-
rendered:
|
|
3427
|
+
rendered: "",
|
|
3650
3428
|
shown: false,
|
|
3651
3429
|
});
|
|
3652
3430
|
}
|
|
@@ -3662,21 +3440,15 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3662
3440
|
if (existing && existing.call.name !== "…") {
|
|
3663
3441
|
callIds[i] = existing.eventId;
|
|
3664
3442
|
existing.call = normalized;
|
|
3665
|
-
const toolCallLine = chalk.cyan(` ▶ ${normalized.name}`) +
|
|
3666
|
-
chalk.gray(` ${formatToolArgs(normalized)}`);
|
|
3667
|
-
existing.rendered =
|
|
3668
|
-
styleToolChatter(normalized, toolCallLine) + "\n";
|
|
3669
3443
|
}
|
|
3670
3444
|
else if (!existing || existing.call.name === "…") {
|
|
3671
3445
|
const eventId = existing?.eventId ?? `tool-${++nextToolEventId}`;
|
|
3672
3446
|
callIds[i] = eventId;
|
|
3673
3447
|
alreadyPrintedIds.add(eventId);
|
|
3674
|
-
const toolCallLine = chalk.cyan(` ▶ ${normalized.name}`) +
|
|
3675
|
-
chalk.gray(` ${formatToolArgs(normalized)}`);
|
|
3676
3448
|
const entry = {
|
|
3677
3449
|
eventId,
|
|
3678
3450
|
call: normalized,
|
|
3679
|
-
rendered:
|
|
3451
|
+
rendered: "",
|
|
3680
3452
|
shown: existing?.shown ?? false,
|
|
3681
3453
|
};
|
|
3682
3454
|
if (existing)
|
|
@@ -3708,13 +3480,13 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3708
3480
|
strict: getConfig().parserStrict,
|
|
3709
3481
|
});
|
|
3710
3482
|
if (call) {
|
|
3711
|
-
writeNotice("info", "recovered tool call from thinking content"
|
|
3483
|
+
writeNotice("info", "recovered tool call from thinking content");
|
|
3712
3484
|
}
|
|
3713
3485
|
}
|
|
3714
3486
|
}
|
|
3715
3487
|
if (looksLikePromptLeak(assistantText.visible)) {
|
|
3716
3488
|
if (call || nativeToolCalls.length) {
|
|
3717
|
-
writeNotice("warn", "suppressed tool call from apparent prompt leak"
|
|
3489
|
+
writeNotice("warn", "suppressed tool call from apparent prompt leak");
|
|
3718
3490
|
}
|
|
3719
3491
|
call = undefined;
|
|
3720
3492
|
nativeToolCalls = [];
|
|
@@ -3742,7 +3514,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3742
3514
|
const writeResult = await applySalvagedWrite(salvaged);
|
|
3743
3515
|
if (writeResult.ok) {
|
|
3744
3516
|
const lineCount = salvaged.content.split("\n").length;
|
|
3745
|
-
writeNotice("info", `native tool call was truncated — salvaged ${lineCount} lines and wrote to ${salvaged.path}
|
|
3517
|
+
writeNotice("info", `native tool call was truncated — salvaged ${lineCount} lines and wrote to ${salvaged.path}`);
|
|
3746
3518
|
// Pair assistant tool_calls with synthetic results so the
|
|
3747
3519
|
// next turn is not orphaned, then nudge for append.
|
|
3748
3520
|
const salvageHistoryCalls = ensureUniqueToolCallIds(nativeToolCalls, toolCallIdsInHistory(messages));
|
|
@@ -3800,10 +3572,10 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3800
3572
|
for (const entry of deferredToolCalls) {
|
|
3801
3573
|
if (!entry.shown || entry.call.name === "…")
|
|
3802
3574
|
continue;
|
|
3803
|
-
writeToolBlocked(entry.eventId, entry.call.name, "Native tool arguments were unusable again; nothing ran. Reissue as a fenced tool block."
|
|
3575
|
+
writeToolBlocked(entry.eventId, entry.call.name, "Native tool arguments were unusable again; nothing ran. Reissue as a fenced tool block.");
|
|
3804
3576
|
}
|
|
3805
3577
|
markTextOnlyModel(provider, model);
|
|
3806
|
-
writeNotice("warn", "native tool arguments keep arriving unusable — switching this model to the text tool protocol"
|
|
3578
|
+
writeNotice("warn", "native tool arguments keep arriving unusable — switching this model to the text tool protocol");
|
|
3807
3579
|
commitAssistantRetry(assistantText.visible);
|
|
3808
3580
|
messages.push(recoveryUserMessage(`Your native ${names || "tool"} call arguments were not usable, so nothing ran. ` +
|
|
3809
3581
|
"Do not repeat that call. Emit exactly one complete fenced ```tool block with valid JSON arguments now."));
|
|
@@ -3824,7 +3596,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3824
3596
|
const truncatedRoundText = collapseRepeatedText(completion.text ?? "");
|
|
3825
3597
|
if (hitOutputLimit && truncatedRoundText.trim() && truncatedBudgetRounds < 2) {
|
|
3826
3598
|
truncatedBudgetRounds += 1;
|
|
3827
|
-
writeNotice("warn", "response hit the output token limit — continuing from where it stopped"
|
|
3599
|
+
writeNotice("warn", "response hit the output token limit — continuing from where it stopped");
|
|
3828
3600
|
messages.push({
|
|
3829
3601
|
role: "assistant",
|
|
3830
3602
|
content: sanitizeAssistantText(truncatedRoundText),
|
|
@@ -3841,18 +3613,18 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3841
3613
|
for (const deferred of deferredToolCalls) {
|
|
3842
3614
|
if (!deferred.shown || deferred.call.name === "…")
|
|
3843
3615
|
continue;
|
|
3844
|
-
writeToolBlocked(deferred.eventId, deferred.call.name, reason
|
|
3616
|
+
writeToolBlocked(deferred.eventId, deferred.call.name, reason);
|
|
3845
3617
|
}
|
|
3846
3618
|
markTextOnlyModel(provider, model);
|
|
3847
|
-
writeNotice("warn", "provider abandoned a native tool call — switching this model to the text tool protocol"
|
|
3619
|
+
writeNotice("warn", "provider abandoned a native tool call — switching this model to the text tool protocol");
|
|
3848
3620
|
}
|
|
3849
3621
|
emptyVisibleRetries += 1;
|
|
3850
3622
|
if (emptyVisibleRetries <= 3) {
|
|
3851
3623
|
if (assistantText.hasThinking) {
|
|
3852
|
-
writeNotice("warn", "model produced only thinking — nudging it to take action"
|
|
3624
|
+
writeNotice("warn", "model produced only thinking — nudging it to take action");
|
|
3853
3625
|
}
|
|
3854
3626
|
else {
|
|
3855
|
-
writeNotice("warn", "model returned an empty response — nudging it to answer"
|
|
3627
|
+
writeNotice("warn", "model returned an empty response — nudging it to answer");
|
|
3856
3628
|
}
|
|
3857
3629
|
if (assistantText.hasThinking)
|
|
3858
3630
|
retryWithoutThinking = true;
|
|
@@ -3872,7 +3644,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3872
3644
|
messages.push(recoveryUserMessage(buildNudge));
|
|
3873
3645
|
continue;
|
|
3874
3646
|
}
|
|
3875
|
-
writeNotice("warn", "model returned an empty response after retries — no answer produced"
|
|
3647
|
+
writeNotice("warn", "model returned an empty response after retries — no answer produced");
|
|
3876
3648
|
return finishTurn("Model returned an empty response after retries.", step + 1);
|
|
3877
3649
|
}
|
|
3878
3650
|
else {
|
|
@@ -3888,7 +3660,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3888
3660
|
if (bare?.call) {
|
|
3889
3661
|
call = bare.call;
|
|
3890
3662
|
recoveredFromBareJson = true;
|
|
3891
|
-
writeNotice("info", "recovered an unfenced tool call from bare JSON"
|
|
3663
|
+
writeNotice("info", "recovered an unfenced tool call from bare JSON");
|
|
3892
3664
|
}
|
|
3893
3665
|
else if (bare?.argsOnly) {
|
|
3894
3666
|
bareArgsOnly = true;
|
|
@@ -3900,7 +3672,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3900
3672
|
if (bareThink?.call) {
|
|
3901
3673
|
call = bareThink.call;
|
|
3902
3674
|
recoveredFromBareJson = true;
|
|
3903
|
-
writeNotice("info", "recovered an unfenced tool call from thinking content"
|
|
3675
|
+
writeNotice("info", "recovered an unfenced tool call from thinking content");
|
|
3904
3676
|
}
|
|
3905
3677
|
else if (bareThink?.argsOnly) {
|
|
3906
3678
|
bareArgsOnly = true;
|
|
@@ -3913,9 +3685,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3913
3685
|
if (bareToolJsonRetries <= 3) {
|
|
3914
3686
|
writeNotice("warn", toolsAttached
|
|
3915
3687
|
? "tool call missing its name — asking the model to call a tool properly"
|
|
3916
|
-
: "tool call missing its name/fence — asking the model to re-emit a proper ```tool block"
|
|
3917
|
-
? " ⚠ tool call missing its name — asking the model to call a tool properly\n"
|
|
3918
|
-
: " ⚠ tool call missing its name/fence — asking the model to re-emit a proper ```tool block\n"));
|
|
3688
|
+
: "tool call missing its name/fence — asking the model to re-emit a proper ```tool block");
|
|
3919
3689
|
commitAssistantRetry(assistantText.visible);
|
|
3920
3690
|
messages.push(recoveryUserMessage(isPlanMode && !activePlan
|
|
3921
3691
|
? toolsAttached
|
|
@@ -3938,7 +3708,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3938
3708
|
// Exhausted retries — fall through to the normal answer path.
|
|
3939
3709
|
}
|
|
3940
3710
|
if (/<\|tool_call(?:s_section)?_begin\|>|<\|tool_call_argument_begin\|>|<[||]+DSML[||]+(?:tool_calls|invoke|parameter)\b|<[||]+tool[_▁](?:calls?[_▁]begin|sep)[||]+>/i.test(assistantText.visible)) {
|
|
3941
|
-
writeNotice("warn", "tool call was malformed or cut off — asking the model to retry in JSON form"
|
|
3711
|
+
writeNotice("warn", "tool call was malformed or cut off — asking the model to retry in JSON form");
|
|
3942
3712
|
commitAssistantRetry(assistantText.visible);
|
|
3943
3713
|
messages.push(recoveryUserMessage(toolsAttached
|
|
3944
3714
|
? "Your previous tool call was malformed or truncated. " +
|
|
@@ -3960,7 +3730,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3960
3730
|
const writeResult = await applySalvagedWrite(salvaged);
|
|
3961
3731
|
if (writeResult.ok) {
|
|
3962
3732
|
const lineCount = salvaged.content.split("\n").length;
|
|
3963
|
-
writeNotice("info", `tool call was truncated — salvaged ${lineCount} lines and wrote to ${salvaged.path}
|
|
3733
|
+
writeNotice("info", `tool call was truncated — salvaged ${lineCount} lines and wrote to ${salvaged.path}`);
|
|
3964
3734
|
commitAssistantRetry(stripThinking(assistantText.visible).visible);
|
|
3965
3735
|
const priorBytes = writeResult.bytesOnDisk;
|
|
3966
3736
|
const salvagedToolName = salvaged.operation === "append" ? "fs.append" : "fs.write";
|
|
@@ -3989,7 +3759,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
3989
3759
|
}
|
|
3990
3760
|
}
|
|
3991
3761
|
if (truncatedToolRetries <= 3) {
|
|
3992
|
-
writeNotice("warn", "tool call was cut off (output too long) — asking the model to retry safely"
|
|
3762
|
+
writeNotice("warn", "tool call was cut off (output too long) — asking the model to retry safely");
|
|
3993
3763
|
commitAssistantRetry(stripThinking(assistantText.visible).visible);
|
|
3994
3764
|
messages.push({
|
|
3995
3765
|
role: "user",
|
|
@@ -4022,7 +3792,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4022
3792
|
const writeResult = await applySalvagedWrite(salvaged);
|
|
4023
3793
|
if (writeResult.ok) {
|
|
4024
3794
|
const lineCount = salvaged.content.split("\n").length;
|
|
4025
|
-
writeNotice("info", `malformed tool call salvaged — wrote ${lineCount} lines to ${salvaged.path}
|
|
3795
|
+
writeNotice("info", `malformed tool call salvaged — wrote ${lineCount} lines to ${salvaged.path}`);
|
|
4026
3796
|
commitAssistantRetry(stripThinking(assistantText.visible).visible);
|
|
4027
3797
|
messages.push({
|
|
4028
3798
|
role: "user",
|
|
@@ -4040,7 +3810,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4040
3810
|
}
|
|
4041
3811
|
malformedFenceRetries += 1;
|
|
4042
3812
|
if (malformedFenceRetries <= 3) {
|
|
4043
|
-
writeNotice("warn", "tool block present but its JSON didn't parse — asking the model to re-emit valid JSON"
|
|
3813
|
+
writeNotice("warn", "tool block present but its JSON didn't parse — asking the model to re-emit valid JSON");
|
|
4044
3814
|
commitAssistantRetry(stripThinking(assistantText.visible).visible);
|
|
4045
3815
|
messages.push({
|
|
4046
3816
|
role: "user",
|
|
@@ -4085,7 +3855,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4085
3855
|
consecutiveModelOnlyRounds === 2) {
|
|
4086
3856
|
markTextOnlyModel(provider, model);
|
|
4087
3857
|
commitAssistantRetry(assistantText.visible);
|
|
4088
|
-
writeNotice("warn", "model repeatedly returned prose instead of a native tool call — switching this model to the text tool protocol"
|
|
3858
|
+
writeNotice("warn", "model repeatedly returned prose instead of a native tool call — switching this model to the text tool protocol");
|
|
4089
3859
|
messages.push(recoveryUserMessage("Native tool calling did not produce an executable call. Continue now with exactly one complete fenced ```tool block. Do not repeat the prior narration."));
|
|
4090
3860
|
continue;
|
|
4091
3861
|
}
|
|
@@ -4222,7 +3992,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4222
3992
|
if (beforeTool) {
|
|
4223
3993
|
writeAssistantMessage(beforeTool);
|
|
4224
3994
|
}
|
|
4225
|
-
else
|
|
3995
|
+
else {
|
|
4226
3996
|
emit({ type: "assistant-message", text: "" });
|
|
4227
3997
|
}
|
|
4228
3998
|
interruptedVisible = "";
|
|
@@ -4269,7 +4039,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4269
4039
|
activeDeferredToolCalls = deferredToolCalls.slice(0, planCallIndex);
|
|
4270
4040
|
deferReason =
|
|
4271
4041
|
"Deferred — plan.create must wait until reconnaissance results exist.";
|
|
4272
|
-
writeNotice("info", "deferring plan.create until reconnaissance results are available"
|
|
4042
|
+
writeNotice("info", "deferring plan.create until reconnaissance results are available");
|
|
4273
4043
|
messages.push({
|
|
4274
4044
|
role: "system",
|
|
4275
4045
|
content: `The prior response included plan.create before its reconnaissance results existed. ` +
|
|
@@ -4283,7 +4053,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4283
4053
|
activeDeferredToolCalls = deferredToolCalls.slice(0, 1);
|
|
4284
4054
|
deferReason =
|
|
4285
4055
|
"Deferred — waiting for plan approval before follow-on tools.";
|
|
4286
|
-
writeNotice("info", "creating the plan now; deferring follow-on calls until it is approved"
|
|
4056
|
+
writeNotice("info", "creating the plan now; deferring follow-on calls until it is approved");
|
|
4287
4057
|
messages.push({
|
|
4288
4058
|
role: "system",
|
|
4289
4059
|
content: `You emitted plan.create alongside ${deferredCount} follow-on call(s). Only plan.create was run; ` +
|
|
@@ -4333,7 +4103,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4333
4103
|
: sequenceDecision.oscillation
|
|
4334
4104
|
? "This exact action sequence already completed earlier this turn (the agent is oscillating back to finished work). No commands were run again; every one of these results is already in context — synthesize them and either advance to a genuinely new action or finish."
|
|
4335
4105
|
: "The same action sequence already ran in the previous model round. No commands were run again; reuse the existing results and choose a materially different next action or finish.";
|
|
4336
|
-
writeNotice("warn", reason
|
|
4106
|
+
writeNotice("warn", reason);
|
|
4337
4107
|
const suppressedResults = bound.map((b) => {
|
|
4338
4108
|
const duplicate = runIds.has(b.id);
|
|
4339
4109
|
const priorObservation = duplicate
|
|
@@ -4359,15 +4129,14 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4359
4129
|
for (const { b, resultReason, result } of suppressedResults) {
|
|
4360
4130
|
const queued = deferredToolCalls[b.index];
|
|
4361
4131
|
const eventId = queued?.eventId ?? `tool-${++nextToolEventId}`;
|
|
4362
|
-
|
|
4363
|
-
chalk.gray(` ${formatToolArgs(b.call)}`);
|
|
4364
|
-
writeToolCall(eventId, b.call, styleToolChatter(b.call, toolCallLine) + "\n");
|
|
4132
|
+
writeToolCall(eventId, b.call, styleToolChatter(b.call, chalk.cyan(` ▶ ${b.call.name}`) +
|
|
4133
|
+
chalk.gray(` ${formatToolArgs(b.call)}`)) + "\n");
|
|
4365
4134
|
alreadyPrintedIds.add(eventId);
|
|
4366
4135
|
emit({ type: "tool-start", id: eventId });
|
|
4367
4136
|
const output = resultReason.endsWith("\n")
|
|
4368
4137
|
? resultReason
|
|
4369
4138
|
: `${resultReason}\n`;
|
|
4370
|
-
writeToolOutput(eventId, output
|
|
4139
|
+
writeToolOutput(eventId, output);
|
|
4371
4140
|
emitToolResult(eventId, result, resultReason);
|
|
4372
4141
|
}
|
|
4373
4142
|
const suppressedCallList = suppressedResults
|
|
@@ -4422,13 +4191,13 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4422
4191
|
continue;
|
|
4423
4192
|
}
|
|
4424
4193
|
if (sequenceDecision.warn && sequenceDecision.warnMessage) {
|
|
4425
|
-
writeNotice("warn", sequenceDecision.warnMessage
|
|
4194
|
+
writeNotice("warn", sequenceDecision.warnMessage);
|
|
4426
4195
|
messages.push(recoveryUserMessage(sequenceDecision.warnMessage));
|
|
4427
4196
|
}
|
|
4428
4197
|
// Notice BEFORE tool cards so the transcript reads:
|
|
4429
4198
|
// thinking → response → "N tool calls…" → tool cards (not tools then info).
|
|
4430
4199
|
if (allCalls.length > 1) {
|
|
4431
|
-
writeNotice("info", `${allCalls.length} tool calls in this message — read-only in parallel, writes in order (failures do not cancel siblings)
|
|
4200
|
+
writeNotice("info", `${allCalls.length} tool calls in this message — read-only in parallel, writes in order (failures do not cancel siblings)`);
|
|
4432
4201
|
}
|
|
4433
4202
|
// Cards streamed from partial text can predate their arguments. The
|
|
4434
4203
|
// executed call is authoritative, so refresh a stale card in place
|
|
@@ -4565,7 +4334,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4565
4334
|
if (reminded.reminded) {
|
|
4566
4335
|
planRemindedAt.add(productiveSteps);
|
|
4567
4336
|
// Chrome only — model already has the note on this tool result.
|
|
4568
|
-
writeNotice("info", PLAN_REMINDER_TOAST
|
|
4337
|
+
writeNotice("info", PLAN_REMINDER_TOAST);
|
|
4569
4338
|
}
|
|
4570
4339
|
if (historyNativeCalls.length) {
|
|
4571
4340
|
appendToolResult(messages, boundCall.id, toolContent, res.call.name, res.result.ok);
|
|
@@ -4701,8 +4470,6 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4701
4470
|
else {
|
|
4702
4471
|
session.planApproved.value = true;
|
|
4703
4472
|
}
|
|
4704
|
-
// Re-derive pause policy from the new plan kind (coding builds
|
|
4705
|
-
// must not hard-pause even if the free-text prompt was generic).
|
|
4706
4473
|
const kindArg = typeof res.call.args.kind === "string"
|
|
4707
4474
|
? res.call.args.kind
|
|
4708
4475
|
: undefined;
|
|
@@ -4710,10 +4477,6 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4710
4477
|
buildLike,
|
|
4711
4478
|
planKind: kindArg,
|
|
4712
4479
|
});
|
|
4713
|
-
pauseMode = progressPauseMode({
|
|
4714
|
-
codingSession,
|
|
4715
|
-
autoConfirm: Boolean(options.autoConfirm),
|
|
4716
|
-
});
|
|
4717
4480
|
}
|
|
4718
4481
|
// User Esc/Ctrl+C only — never cancel siblings because a delete failed
|
|
4719
4482
|
// or a confirm was declined; the model must see every tool result.
|
|
@@ -4753,13 +4516,13 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4753
4516
|
if (intent.state === "in_progress")
|
|
4754
4517
|
batchRemindCalls.add(intent.call);
|
|
4755
4518
|
}
|
|
4756
|
-
writeNotice("warn", multiOpenToast(openIds.length)
|
|
4519
|
+
writeNotice("warn", multiOpenToast(openIds.length));
|
|
4757
4520
|
}
|
|
4758
4521
|
else if (isSimultaneousTaskAdvance(intents)) {
|
|
4759
4522
|
const signature = batchUpdateSignature(intents);
|
|
4760
4523
|
if (session.pendingTaskBatch.value === signature) {
|
|
4761
4524
|
session.pendingTaskBatch.value = undefined;
|
|
4762
|
-
writeNotice("info", "confirmed batch task update — applying"
|
|
4525
|
+
writeNotice("info", "confirmed batch task update — applying");
|
|
4763
4526
|
}
|
|
4764
4527
|
else {
|
|
4765
4528
|
session.pendingTaskBatch.value = signature;
|
|
@@ -4773,7 +4536,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4773
4536
|
for (const intent of intents)
|
|
4774
4537
|
batchRemindCalls.add(intent.call);
|
|
4775
4538
|
const advancing = distinctAdvancingTaskIds(intents).length;
|
|
4776
|
-
writeNotice("warn", multiUpdateToast(advancing)
|
|
4539
|
+
writeNotice("warn", multiUpdateToast(advancing));
|
|
4777
4540
|
}
|
|
4778
4541
|
}
|
|
4779
4542
|
else {
|
|
@@ -4782,7 +4545,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4782
4545
|
}
|
|
4783
4546
|
const groups = groupToolCallsForExecution(allCalls, isParallelSafe, PARALLEL_LIMIT);
|
|
4784
4547
|
for (const group of groups) {
|
|
4785
|
-
if (aborted || awaitingPlanApproval
|
|
4548
|
+
if (aborted || awaitingPlanApproval)
|
|
4786
4549
|
break;
|
|
4787
4550
|
if (group.length === 1) {
|
|
4788
4551
|
const call = group[0];
|
|
@@ -4830,9 +4593,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4830
4593
|
? "Cancelled — turn aborted before this call ran."
|
|
4831
4594
|
: awaitingPlanApproval
|
|
4832
4595
|
? "Deferred — waiting for plan approval."
|
|
4833
|
-
:
|
|
4834
|
-
? `Deferred — progress governor paused execution: ${governorPauseReason}`
|
|
4835
|
-
: "Cancelled — not executed.";
|
|
4596
|
+
: "Cancelled — not executed.";
|
|
4836
4597
|
const result = {
|
|
4837
4598
|
ok: false,
|
|
4838
4599
|
output: reason,
|
|
@@ -4870,8 +4631,7 @@ export async function runAgentTurn(prompt, options = {}) {
|
|
|
4870
4631
|
toRun.length === bound.length &&
|
|
4871
4632
|
actionSequenceExecuted === allCalls.length &&
|
|
4872
4633
|
!aborted &&
|
|
4873
|
-
!awaitingPlanApproval
|
|
4874
|
-
!governorPauseReason, actionSequenceOutcome);
|
|
4634
|
+
!awaitingPlanApproval, actionSequenceOutcome);
|
|
4875
4635
|
consecutiveSynthesizedRounds =
|
|
4876
4636
|
!aborted && actionSequenceExecuted > 0 && roundSuppressedCount === actionSequenceExecuted
|
|
4877
4637
|
? consecutiveSynthesizedRounds + 1
|