@deepseek-harness-tui/dsh-tui 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +214 -34
- package/assets/plugin-icon.svg +13 -0
- package/assets/windows-installer.cs +308 -0
- package/assets/windows-installer.ps1 +17 -0
- package/bin/dsh-tui.js +64 -5
- package/cli/adapters/dsh/index.mjs +111 -0
- package/cli/adapters/dsh/locate.mjs +73 -0
- package/cli/adapters/dsh/management-plugin.mjs +111 -0
- package/cli/args.mjs +154 -0
- package/cli/contracts.d.ts +48 -0
- package/cli/engine.mjs +92 -0
- package/cli/entry.mjs +48 -0
- package/cli/process.mjs +118 -0
- package/cli/protocol.mjs +23 -0
- package/cli/schema-v1.json +33 -0
- package/cordis.patch.yml +3 -1
- package/cordis.yml +3 -1
- package/guide/dsh-tui-guide/SKILL.md +1 -0
- package/guide/dsh-tui-guide/claude-backend.en.md +8 -0
- package/guide/dsh-tui-guide/claude-backend.md +5 -0
- package/guide/dsh-tui-guide/cli.en.md +114 -0
- package/guide/dsh-tui-guide/cli.md +114 -0
- package/guide/dsh-tui-guide/configuration.en.md +6 -5
- package/guide/dsh-tui-guide/configuration.md +6 -5
- package/guide/dsh-tui-guide/getting-started.en.md +44 -10
- package/guide/dsh-tui-guide/getting-started.md +31 -9
- package/guide/dsh-tui-guide/interaction.en.md +22 -10
- package/guide/dsh-tui-guide/interaction.md +18 -8
- package/guide/dsh-tui-guide/plugins.en.md +35 -4
- package/guide/dsh-tui-guide/plugins.md +23 -2
- package/guide/dsh-tui-guide/user-guide.en.md +30 -23
- package/guide/dsh-tui-guide/user-guide.md +29 -22
- package/lib/settings.json +83 -40
- package/lib/types/adapter/channel/plugins.d.ts.map +1 -1
- package/lib/types/adapter/channel/plugins.js +8 -0
- package/lib/types/adapter/channel/ui-policy.d.ts +1 -1
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +3 -0
- package/lib/types/adapter/ports/channel-display.d.ts +10 -0
- package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-session.d.ts +2 -0
- package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-settings.d.ts +20 -0
- package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-ui.d.ts +17 -2
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +8 -1
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel.d.ts +7 -0
- package/lib/types/adapter/ports/channel.d.ts.map +1 -1
- package/lib/types/agent/capabilities.d.ts +2 -0
- package/lib/types/agent/capabilities.d.ts.map +1 -1
- package/lib/types/agent/events.d.ts +8 -0
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/api.d.ts +2 -2
- package/lib/types/api.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/events.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/events.js +2 -1
- package/lib/types/backends/codex/auth/status.js +1 -1
- package/lib/types/backends/codex/session/controls.d.ts.map +1 -1
- package/lib/types/backends/codex/session/controls.js +6 -5
- package/lib/types/backends/codex/session/goals.d.ts.map +1 -1
- package/lib/types/backends/codex/session/side-query.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/events.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/events.js +3 -1
- package/lib/types/backends/shared/channel-tokens.d.ts.map +1 -1
- package/lib/types/backends/shared/channel-tokens.js +9 -8
- package/lib/types/channel/history-restore.d.ts.map +1 -1
- package/lib/types/channel/history-restore.js +2 -0
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/projection.d.ts +1 -1
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +19 -4
- package/lib/types/channel/questions.d.ts +2 -0
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/sanitize.d.ts +14 -0
- package/lib/types/channel/sanitize.d.ts.map +1 -1
- package/lib/types/channel/sanitize.js +55 -0
- package/lib/types/channel/working-directory.d.ts +9 -0
- package/lib/types/channel/working-directory.d.ts.map +1 -0
- package/lib/types/channel/working-directory.js +7 -0
- package/lib/types/commands.d.ts +8 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +13 -4
- package/lib/types/components/ChatTitle.d.ts +7 -0
- package/lib/types/components/ChatTitle.d.ts.map +1 -0
- package/lib/types/components/ChatTitle.js +15 -0
- package/lib/types/components/CodeBlockFrame.d.ts.map +1 -1
- package/lib/types/components/CodeBlockFrame.js +10 -5
- package/lib/types/components/CompactionStatusRow.d.ts.map +1 -1
- package/lib/types/components/CompactionStatusRow.js +24 -3
- package/lib/types/components/GoalTodoPanel.d.ts +3 -1
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
- package/lib/types/components/GoalTodoPanel.js +2 -2
- package/lib/types/components/Markdown.d.ts +9 -1
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +5 -4
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +17 -12
- package/lib/types/components/PromptInput.d.ts +13 -5
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +189 -107
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +232 -22
- package/lib/types/components/SubagentDetailScene.d.ts +3 -1
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +5 -1
- package/lib/types/components/Whale.d.ts.map +1 -1
- package/lib/types/components/Whale.js +8 -5
- package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
- package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
- package/lib/types/components/approvals/ApprovalPanel.js +93 -11
- package/lib/types/components/bigfont.d.ts.map +1 -1
- package/lib/types/components/bigfont.js +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +13 -6
- package/lib/types/components/previewRows.d.ts +19 -0
- package/lib/types/components/previewRows.d.ts.map +1 -0
- package/lib/types/components/previewRows.js +46 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +75 -10
- package/lib/types/components/sessions/ForeignSessionRow.d.ts +3 -9
- package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -1
- package/lib/types/components/sessions/ForeignSessionRow.js +6 -10
- package/lib/types/components/sessions/SessionListRow.d.ts +4 -9
- package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
- package/lib/types/components/sessions/SessionListRow.js +18 -10
- package/lib/types/components/sidePanel/InfoPanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/InfoPanel.js +4 -3
- package/lib/types/components/sidePanel/SidePanelLayout.d.ts.map +1 -1
- package/lib/types/components/sidePanel/SidePanelLayout.js +5 -5
- package/lib/types/components/sidePanel/WorkspacePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/WorkspacePanel.js +19 -7
- package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
- package/lib/types/components/sidePanel/builtinPanels.js +22 -16
- package/lib/types/components/sidePanel/companion/CompanionPanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/companion/CompanionPanel.js +2 -1
- package/lib/types/components/sidePanel/panelMarkdown.d.ts +32 -0
- package/lib/types/components/sidePanel/panelMarkdown.d.ts.map +1 -0
- package/lib/types/components/sidePanel/panelMarkdown.js +45 -0
- package/lib/types/components/sidePanel/pluginPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/pluginPanelAdapter.js +6 -1
- package/lib/types/components/sidePanel/subagentFailureRead.d.ts +21 -0
- package/lib/types/components/sidePanel/subagentFailureRead.d.ts.map +1 -0
- package/lib/types/components/sidePanel/subagentFailureRead.js +66 -0
- package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/useSidePanel.js +24 -6
- package/lib/types/components/trajectory/MiniWake.d.ts +2 -2
- package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
- package/lib/types/components/trajectory/MiniWake.js +7 -3
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.js +4 -7
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +11 -1
- package/lib/types/dsh-adapter/backend-admission.d.ts +3 -3
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +5 -1
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +18 -1
- package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/command-completions.js +6 -8
- package/lib/types/dsh-adapter/channel/composer-images.d.ts +9 -1
- package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-images.js +111 -111
- package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-mentions.js +16 -10
- package/lib/types/dsh-adapter/channel/core/actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/core/actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/actions.js +23 -2
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.js +13 -2
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +2 -0
- package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/files.js +2 -1
- package/lib/types/dsh-adapter/channel/core/host.d.ts +14 -10
- package/lib/types/dsh-adapter/channel/core/host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/host.js +192 -13
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts +1 -0
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.js +32 -3
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +31 -5
- package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-actions.js +4 -0
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +24 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.js +7 -1
- package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-selection.js +6 -4
- package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-fork.js +1 -0
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-metadata.js +15 -2
- package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.js +4 -0
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +46 -33
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +10 -3
- package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +2 -2
- package/lib/types/dsh-adapter/channel/types.d.ts +13 -1
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/liveSession.d.ts +3 -3
- package/lib/types/dsh-adapter/compat/liveSession.js +3 -3
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.js +17 -1
- package/lib/types/dsh-adapter/contract.d.ts +6 -5
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +7 -5
- package/lib/types/dsh-adapter/effect-ledger.d.ts +1 -1
- package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -1
- package/lib/types/dsh-adapter/effect-ledger.js +1 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +26 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -0
- package/lib/types/dsh-adapter/experimental-bundles.js +11 -0
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-access.js +4 -0
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.js +2 -2
- package/lib/types/dsh-adapter/host-dsh.js +3 -3
- package/lib/types/dsh-adapter/host-entry.js +5 -3
- package/lib/types/dsh-adapter/index.d.ts +8 -4
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +9 -7
- package/lib/types/dsh-adapter/install/pnpm-profile-add.d.ts.map +1 -1
- package/lib/types/dsh-adapter/install/pnpm-profile-add.js +9 -3
- package/lib/types/dsh-adapter/panels.d.ts +21 -7
- package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
- package/lib/types/dsh-adapter/panels.js +11 -56
- package/lib/types/dsh-adapter/plugin.d.ts +81 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +318 -70
- package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugins-info.js +65 -10
- package/lib/types/dsh-adapter/presets.d.ts +15 -6
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +51 -12
- package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
- package/lib/types/dsh-adapter/process-exit.js +1 -1
- package/lib/types/dsh-adapter/session-tools.d.ts +34 -0
- package/lib/types/dsh-adapter/session-tools.d.ts.map +1 -0
- package/lib/types/dsh-adapter/session-tools.js +39 -0
- package/lib/types/dsh-adapter/settings-sections.d.ts +18 -1
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +73 -0
- package/lib/types/dsh-adapter/status.d.ts +88 -1
- package/lib/types/dsh-adapter/status.d.ts.map +1 -1
- package/lib/types/dsh-adapter/status.js +318 -3
- package/lib/types/dsh-adapter/team-mode.d.ts +42 -33
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +76 -112
- package/lib/types/extensions.d.ts +1 -1
- package/lib/types/extensions.d.ts.map +1 -1
- package/lib/types/force-production-react.js +3 -3
- package/lib/types/i18n.d.ts +195 -52
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +96 -30
- package/lib/types/ink/colorize.d.ts +7 -1
- package/lib/types/ink/colorize.d.ts.map +1 -1
- package/lib/types/ink/colorize.js +29 -8
- package/lib/types/ink/components/App.d.ts +2 -1
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +10 -3
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
- package/lib/types/ink/components/ScrollBox.js +1 -0
- package/lib/types/ink/dom.d.ts +1 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-program-status.d.ts +78 -0
- package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-program-status.js +96 -0
- package/lib/types/ink/ink.d.ts +13 -4
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +119 -25
- package/lib/types/ink/output.d.ts +17 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +85 -2
- package/lib/types/ink/parse-keypress.d.ts +1 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +5 -4
- package/lib/types/ink/render-node-to-output.d.ts +2 -0
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +79 -10
- package/lib/types/ink/root.d.ts +8 -0
- package/lib/types/ink/root.d.ts.map +1 -1
- package/lib/types/ink/root.js +12 -3
- package/lib/types/ink/screen.d.ts +11 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +44 -0
- package/lib/types/ink/selection.d.ts +7 -2
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +187 -44
- package/lib/types/ink/shutdown-input.d.ts +15 -0
- package/lib/types/ink/shutdown-input.d.ts.map +1 -0
- package/lib/types/ink/shutdown-input.js +28 -0
- package/lib/types/ink/sixel-cursor-heal.d.ts +21 -0
- package/lib/types/ink/sixel-cursor-heal.d.ts.map +1 -0
- package/lib/types/ink/sixel-cursor-heal.js +62 -0
- package/lib/types/ink/sixel-graphics.d.ts +6 -0
- package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
- package/lib/types/ink/sixel-graphics.js +18 -0
- package/lib/types/ink/styles.d.ts +8 -1
- package/lib/types/ink/styles.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.d.ts +195 -0
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -0
- package/lib/types/ink/terminal-notification-windows.js +433 -0
- package/lib/types/ink/terminal-notification.d.ts +3 -1
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +4 -1
- package/lib/types/ink/terminal-querier.d.ts +9 -1
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +32 -1
- package/lib/types/ink/terminal.d.ts +23 -2
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +32 -2
- package/lib/types/ink/termio/osc.d.ts +2 -1
- package/lib/types/ink/termio/osc.d.ts.map +1 -1
- package/lib/types/ink/termio/osc.js +37 -8
- package/lib/types/ink/termio/osc7501.d.ts +102 -0
- package/lib/types/ink/termio/osc7501.d.ts.map +1 -0
- package/lib/types/ink/termio/osc7501.js +229 -0
- package/lib/types/ink/termio/tokenize.js +5 -7
- package/lib/types/panels.d.ts +1 -1
- package/lib/types/panels.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.d.ts +3 -1
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +5 -1
- package/lib/types/screens/Chat.d.ts +6 -6
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +304 -111
- package/lib/types/screens/Launchpad.d.ts +8 -2
- package/lib/types/screens/Launchpad.d.ts.map +1 -1
- package/lib/types/screens/Launchpad.js +32 -12
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +31 -21
- package/lib/types/screens/Settings.d.ts +5 -1
- package/lib/types/screens/Settings.d.ts.map +1 -1
- package/lib/types/screens/Settings.js +528 -51
- package/lib/types/screens/StatusLine.d.ts +9 -3
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +91 -15
- package/lib/types/screens/StatusMetrics.d.ts +2 -11
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
- package/lib/types/screens/StatusMetrics.js +20 -14
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +13 -21
- package/lib/types/sessionMounts.d.ts +14 -0
- package/lib/types/sessionMounts.d.ts.map +1 -1
- package/lib/types/sessionMounts.js +20 -9
- package/lib/types/sessions/format.d.ts +39 -0
- package/lib/types/sessions/format.d.ts.map +1 -1
- package/lib/types/sessions/format.js +83 -0
- package/lib/types/sessions/resumeFailure.d.ts +4 -0
- package/lib/types/sessions/resumeFailure.d.ts.map +1 -1
- package/lib/types/sessions/resumeFailure.js +12 -4
- package/lib/types/sessions/workspaceCounts.d.ts +6 -0
- package/lib/types/sessions/workspaceCounts.d.ts.map +1 -0
- package/lib/types/sessions/workspaceCounts.js +24 -0
- package/lib/types/settings/definitions.d.ts +24 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +38 -13
- package/lib/types/tips.js +2 -2
- package/lib/types/tuiDisplayPrefs.d.ts +113 -5
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +276 -14
- package/lib/types/update.d.ts +46 -36
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +248 -157
- package/lib/types/updateProcess.d.ts +28 -0
- package/lib/types/updateProcess.d.ts.map +1 -0
- package/lib/types/updateProcess.js +135 -0
- package/lib/types/utils/inputWordBoundary.d.ts +5 -0
- package/lib/types/utils/inputWordBoundary.d.ts.map +1 -0
- package/lib/types/utils/inputWordBoundary.js +18 -0
- package/lib/types/utils/keymap.d.ts +1 -1
- package/lib/types/utils/keymap.d.ts.map +1 -1
- package/lib/types/utils/keymap.js +6 -1
- package/lib/types/windowsInstaller.d.ts +4 -0
- package/lib/types/windowsInstaller.d.ts.map +1 -0
- package/lib/types/windowsInstaller.js +237 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +127 -111
- package/presets/liangshen/custom-bash.mjs +13 -1
- package/presets/liangshen/instruction-hint.mjs +4 -1
- package/presets/liangshen/skill-search.mjs +14 -2
- package/presets/winbash.mjs +16 -4
- package/tui-profile/feed/README.md +17 -8
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { Box, Text } from '../ui.js';
|
|
4
4
|
import * as JsDiff from 'diff';
|
|
5
5
|
import { extname } from 'node:path';
|
|
6
|
+
import { stringWidth } from '../ink/stringWidth.js';
|
|
6
7
|
import { getCliHighlightPromise } from '../terminal-utils/cliHighlight.js';
|
|
7
8
|
import { highlightLines, syntaxThemeSignature } from '../terminal-utils/syntaxRuns.js';
|
|
8
9
|
// Backward-compatible re-export: repro scripts import chalkFromToken from
|
|
@@ -13,6 +14,7 @@ import { getTheme } from '../theme.js';
|
|
|
13
14
|
import { t } from '../i18n.js';
|
|
14
15
|
import { useTheme } from './design-system/ThemeProvider.js';
|
|
15
16
|
import { revealLinesOf } from './smoothReveal.js';
|
|
17
|
+
import { getGraphemeSegmenter } from '../utils/intl.js';
|
|
16
18
|
import { primaryComboString } from '../utils/keymap.js';
|
|
17
19
|
import { isPatchDiff, parseFilePatch, patchHeader, patchHeaderText } from './diffPatch.js';
|
|
18
20
|
/** Replace tabs so width math and alignment hold (pi convention). */
|
|
@@ -270,8 +272,140 @@ function alignPatchFile(fileIndex, parsed) {
|
|
|
270
272
|
});
|
|
271
273
|
return { rows, oldSide, newSide };
|
|
272
274
|
}
|
|
275
|
+
// --- visual rows ------------------------------------------------------------
|
|
276
|
+
/** Expanded bodies walk a bounded VISUAL-row window — the two-pane twin of the
|
|
277
|
+
* unified body's 400-line window. It bounds PAINTED rows, not the work: every
|
|
278
|
+
* shown line is still wrapped on each frame (O(body) per render). The row
|
|
279
|
+
* that crosses the window edge is cut there, so the painted body never
|
|
280
|
+
* exceeds the window; the rows above that edge are painted whole. */
|
|
281
|
+
const VERBOSE_VISUAL_ROW_WINDOW = 400;
|
|
282
|
+
/** Flatten styled runs into styled graphemes, segmenting the JOINED line.
|
|
283
|
+
*
|
|
284
|
+
* Cutting a run by code unit would split a surrogate pair or a combining
|
|
285
|
+
* sequence, so the wrap walks graphemes instead. Segmenting each run on its
|
|
286
|
+
* own is not enough either: the word diff tokenizes non-Latin text per code
|
|
287
|
+
* point (jsdiff's `extendedWordChars` only covers Latin-1 / Latin Extended),
|
|
288
|
+
* so a changed family emoji or an edited combining mark leaves runs that end
|
|
289
|
+
* inside one grapheme cluster — the ZWJ or the accent lands in the next run.
|
|
290
|
+
* Segmenting the flattened text reunites the cluster; each grapheme keeps the
|
|
291
|
+
* style of the run its first code unit came from. */
|
|
292
|
+
function graphemes(segments) {
|
|
293
|
+
if (segments.length === 0)
|
|
294
|
+
return [];
|
|
295
|
+
const text = segments.map(segment => segment.text).join('');
|
|
296
|
+
// One style slot per UTF-16 code unit: Intl.Segmenter reports code-unit
|
|
297
|
+
// indices, so this maps a cluster back to the run it starts in.
|
|
298
|
+
const styles = new Array(text.length);
|
|
299
|
+
let at = 0;
|
|
300
|
+
for (const segment of segments) {
|
|
301
|
+
for (let index = 0; index < segment.text.length; index++)
|
|
302
|
+
styles[at + index] = segment;
|
|
303
|
+
at += segment.text.length;
|
|
304
|
+
}
|
|
305
|
+
const out = [];
|
|
306
|
+
for (const { segment, index } of getGraphemeSegmenter().segment(text)) {
|
|
307
|
+
const style = styles[index];
|
|
308
|
+
out.push({ text: segment, changed: style.changed, color: style.color });
|
|
309
|
+
}
|
|
310
|
+
return out;
|
|
311
|
+
}
|
|
312
|
+
/** Join graphemes back into runs, merging neighbours that share a style so a
|
|
313
|
+
* wrapped row paints the same runs it would have painted unwrapped. */
|
|
314
|
+
function toSegments(line) {
|
|
315
|
+
const out = [];
|
|
316
|
+
for (const grapheme of line) {
|
|
317
|
+
const last = out[out.length - 1];
|
|
318
|
+
if (last !== undefined && last.changed === grapheme.changed && last.color === grapheme.color) {
|
|
319
|
+
out[out.length - 1] = { text: last.text + grapheme.text, changed: last.changed, color: last.color };
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
out.push({ text: grapheme.text, changed: grapheme.changed, color: grapheme.color });
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return out;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Split one logical line into visual rows no wider than `budget` display
|
|
329
|
+
* cells. A row prefers to end at the last space that fits, so prose breaks
|
|
330
|
+
* between words and only an unbroken run (a URL, a minified line) is cut
|
|
331
|
+
* mid-word. The space a break lands on stays at the end of the row it closes,
|
|
332
|
+
* so joining the rows reproduces the input exactly.
|
|
333
|
+
*
|
|
334
|
+
* Empty source text still occupies one row; only a missing side has no rows.
|
|
335
|
+
*/
|
|
336
|
+
function wrapSegments(segments, budget) {
|
|
337
|
+
const all = graphemes(segments);
|
|
338
|
+
const rows = [];
|
|
339
|
+
let start = 0;
|
|
340
|
+
while (start < all.length) {
|
|
341
|
+
let width = 0;
|
|
342
|
+
let end = start;
|
|
343
|
+
/** Exclusive index just past the last space that fits on this row. */
|
|
344
|
+
let breakAt = -1;
|
|
345
|
+
while (end < all.length) {
|
|
346
|
+
const grapheme = all[end];
|
|
347
|
+
const graphemeWidth = stringWidth(grapheme.text);
|
|
348
|
+
// A single grapheme wider than the whole budget still has to land
|
|
349
|
+
// somewhere: it keeps a row of its own instead of disappearing.
|
|
350
|
+
if (width + graphemeWidth > budget && end > start)
|
|
351
|
+
break;
|
|
352
|
+
width += graphemeWidth;
|
|
353
|
+
end += 1;
|
|
354
|
+
if (/^\s+$/u.test(grapheme.text) && end < all.length)
|
|
355
|
+
breakAt = end;
|
|
356
|
+
}
|
|
357
|
+
if (end < all.length && breakAt > start)
|
|
358
|
+
end = breakAt;
|
|
359
|
+
rows.push(toSegments(all.slice(start, end)));
|
|
360
|
+
start = end;
|
|
361
|
+
}
|
|
362
|
+
return rows.length > 0 ? rows : [[]];
|
|
363
|
+
}
|
|
364
|
+
/** How many graphemes of a pane line the renderer's `truncate` drops. It cuts
|
|
365
|
+
* only a line WIDER than the columns it is handed (`src/ink/wrap-text.ts`
|
|
366
|
+
* returns the text untouched when it fits); once it does cut, it spends one
|
|
367
|
+
* of those columns on `…` and keeps `budget - 1` cells of text. That "-1" is
|
|
368
|
+
* the renderer's, not this file's — so a line that fits its budget whole
|
|
369
|
+
* loses nothing. */
|
|
370
|
+
function clippedGraphemes(segments, budget) {
|
|
371
|
+
if (segments === undefined)
|
|
372
|
+
return 0;
|
|
373
|
+
const all = graphemes(segments);
|
|
374
|
+
const widths = all.map(grapheme => stringWidth(grapheme.text));
|
|
375
|
+
if (widths.reduce((total, width) => total + width, 0) <= budget)
|
|
376
|
+
return 0;
|
|
377
|
+
const fits = budget - 1;
|
|
378
|
+
let width = 0;
|
|
379
|
+
let visible = 0;
|
|
380
|
+
while (visible < all.length) {
|
|
381
|
+
const next = width + widths[visible];
|
|
382
|
+
if (next > fits)
|
|
383
|
+
break;
|
|
384
|
+
width = next;
|
|
385
|
+
visible += 1;
|
|
386
|
+
}
|
|
387
|
+
return all.length - visible;
|
|
388
|
+
}
|
|
273
389
|
// --- rendering --------------------------------------------------------------
|
|
274
|
-
|
|
390
|
+
/** Gutter text of one painted row: the status marker alone, or a right-aligned
|
|
391
|
+
* real line number plus the marker (patch diffs). The new pane keeps the
|
|
392
|
+
* leading cell the old pane spends on nothing, so the two text columns start
|
|
393
|
+
* the same distance from their divider; the one-cell gap between gutter and
|
|
394
|
+
* text is the caller's. */
|
|
395
|
+
function gutterText(kind, tone, lineNo, hasContent, lineNoWidth) {
|
|
396
|
+
// Status gutter instead of line numbers: ToolFileDiff has no file
|
|
397
|
+
// offsets, and an invented number misleads (issue #250, P2-3).
|
|
398
|
+
const marker = kind === 'context' ? ' ' : tone === 'old' ? '−' : '+';
|
|
399
|
+
const numbered = lineNoWidth > 0
|
|
400
|
+
? `${(lineNo === undefined || !hasContent ? '' : String(lineNo)).padStart(lineNoWidth)} ${marker}`
|
|
401
|
+
: marker;
|
|
402
|
+
return tone === 'new' ? ` ${numbered}` : numbered;
|
|
403
|
+
}
|
|
404
|
+
/** One pane of one terminal row. `prefix` is the gutter already padded to its
|
|
405
|
+
* final width — a continuation row of a wrapped line repeats that width in
|
|
406
|
+
* spaces so its text lines up with the row above. `segments` is undefined
|
|
407
|
+
* when this pane has nothing to paint here (blank side, or a shorter wrap). */
|
|
408
|
+
function PaneLine({ segments, prefix, kind, width, tone, toolBackground, paneId, padding, continuation, }) {
|
|
275
409
|
const ordinaryBackground = toolBackground === 'subtle'
|
|
276
410
|
? 'toolCardBackgroundDim'
|
|
277
411
|
: toolBackground === 'strong'
|
|
@@ -285,14 +419,10 @@ function PaneLine({ side, kind, width, tone, toolBackground, padLeft = false, li
|
|
|
285
419
|
? 'diffRemovedDimmed'
|
|
286
420
|
: 'diffAddedDimmed';
|
|
287
421
|
const wordColor = tone === 'old' ? 'diffRemovedWord' : 'diffAddedWord';
|
|
288
|
-
|
|
289
|
-
// offsets, and an invented number misleads (issue #250, P2-3).
|
|
290
|
-
const marker = kind === 'context' ? ' ' : tone === 'old' ? '−' : '+';
|
|
291
|
-
const numbered = lineNoWidth > 0 ? `${(lineNo === undefined || side === undefined ? '' : String(lineNo)).padStart(lineNoWidth)} ${marker}` : marker;
|
|
292
|
-
const prefix = padLeft ? ` ${numbered}` : numbered;
|
|
293
|
-
return (_jsxs(Box, { width: width, flexShrink: 0, backgroundColor: backgroundColor, children: [_jsx(Text, { dimColor: true, backgroundColor: backgroundColor, children: `${prefix} ` }), side === undefined ? (_jsx(Text, { backgroundColor: backgroundColor, children: " " })) : (_jsx(Text, { wrap: "truncate", backgroundColor: backgroundColor, children: side.segments.map((segment, index) => segment.changed ? (_jsx(Text, { color: wordColor, bold: true, backgroundColor: backgroundColor, children: segment.text }, index)) : (_jsx(Text, { color: segment.color, backgroundColor: backgroundColor, children: segment.text }, index))) }))] }));
|
|
422
|
+
return (_jsxs(Box, { width: width, flexShrink: 0, backgroundColor: backgroundColor, selectionPane: paneId, noSelect: padding, softWrapContinuation: continuation, children: [_jsx(Box, { noSelect: true, children: _jsx(Text, { dimColor: true, backgroundColor: backgroundColor, children: prefix }) }), segments === undefined ? (_jsx(Text, { backgroundColor: backgroundColor, children: " " })) : (_jsx(Text, { wrap: "truncate", backgroundColor: backgroundColor, children: segments.map((segment, index) => segment.changed ? (_jsx(Text, { color: wordColor, bold: true, backgroundColor: backgroundColor, children: segment.text }, index)) : (_jsx(Text, { color: segment.color, backgroundColor: backgroundColor, children: segment.text }, index))) }))] }));
|
|
294
423
|
}
|
|
295
424
|
export function SplitDiffView({ diffs, width, maxRows, verbose, toolBackground = 'none', reveal, }) {
|
|
425
|
+
const paneId = React.useId();
|
|
296
426
|
const [hl, setHl] = React.useState(null);
|
|
297
427
|
React.useEffect(() => {
|
|
298
428
|
let mounted = true;
|
|
@@ -338,6 +468,18 @@ export function SplitDiffView({ diffs, width, maxRows, verbose, toolBackground =
|
|
|
338
468
|
prevPath = diff.path;
|
|
339
469
|
rows.push(...alignFileDiff(fileIndex, diff.oldText, diff.newText));
|
|
340
470
|
});
|
|
471
|
+
// Determine each file's sides from its complete alignment, before folding
|
|
472
|
+
// or smooth reveal can hide the opposite side and make the layout jump.
|
|
473
|
+
const oldFiles = new Set();
|
|
474
|
+
const newFiles = new Set();
|
|
475
|
+
for (const row of rows) {
|
|
476
|
+
if ('separator' in row)
|
|
477
|
+
continue;
|
|
478
|
+
if (row.oldIndex !== undefined)
|
|
479
|
+
oldFiles.add(row.fileIndex);
|
|
480
|
+
if (row.newIndex !== undefined)
|
|
481
|
+
newFiles.add(row.fileIndex);
|
|
482
|
+
}
|
|
341
483
|
const totalRows = rows.length;
|
|
342
484
|
const capped = verbose || totalRows <= maxRows || totalRows - maxRows === 1;
|
|
343
485
|
const visible = capped ? rows : rows.slice(0, maxRows);
|
|
@@ -349,6 +491,7 @@ export function SplitDiffView({ diffs, width, maxRows, verbose, toolBackground =
|
|
|
349
491
|
: visible.length;
|
|
350
492
|
const shown = revealedRows >= visible.length ? visible : visible.slice(0, revealedRows);
|
|
351
493
|
const paneWidth = Math.max(20, Math.floor((width - 1) / 2));
|
|
494
|
+
const blockWidth = Math.max(width, paneWidth * 2 + 1);
|
|
352
495
|
// Whole-hunk highlight per file (multi-line lexer state preserved);
|
|
353
496
|
// only the visible rows merge syntax runs with word flags below.
|
|
354
497
|
const fileSyntax = diffs.map((diff, fileIndex) => {
|
|
@@ -368,20 +511,87 @@ export function SplitDiffView({ diffs, width, maxRows, verbose, toolBackground =
|
|
|
368
511
|
next: highlightLines(expandTabs(diff.newText), language, hl, syntaxTheme, themeSig),
|
|
369
512
|
};
|
|
370
513
|
});
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
514
|
+
// Resolve the shown rows into paint plans. Collapsed paints one terminal row
|
|
515
|
+
// per logical row (#245's height contract); expanded pre-wraps each pane and
|
|
516
|
+
// both panes paint the taller column's row count.
|
|
517
|
+
const windowLimit = verbose ? VERBOSE_VISUAL_ROW_WINDOW : Number.POSITIVE_INFINITY;
|
|
518
|
+
const paint = [];
|
|
519
|
+
/** Collapsed: graphemes the renderer clipped on the painted rows of both
|
|
520
|
+
* panes (0 = nothing was clipped, so no hint). */
|
|
521
|
+
let clippedChars = 0;
|
|
522
|
+
let paintedRows = 0;
|
|
523
|
+
/** Visual rows the whole shown body needs — what the window reports. */
|
|
524
|
+
let totalVisualRows = 0;
|
|
525
|
+
for (const row of shown) {
|
|
526
|
+
if ('separator' in row) {
|
|
527
|
+
totalVisualRows += 1;
|
|
528
|
+
if (paintedRows < windowLimit) {
|
|
529
|
+
paint.push({ separator: row.separator });
|
|
530
|
+
paintedRows += 1;
|
|
531
|
+
}
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
const syntax = fileSyntax[row.fileIndex];
|
|
535
|
+
const oldRuns = row.oldIndex !== undefined ? syntax?.old?.[row.oldIndex] : undefined;
|
|
536
|
+
const newRuns = row.newIndex !== undefined ? syntax?.next?.[row.newIndex] : undefined;
|
|
537
|
+
const oldSegments = row.oldWords === undefined
|
|
538
|
+
? undefined
|
|
539
|
+
: oldRuns !== undefined ? mergeRuns(oldRuns, row.oldWords) : row.oldWords;
|
|
540
|
+
const newSegments = row.newWords === undefined
|
|
541
|
+
? undefined
|
|
542
|
+
: newRuns !== undefined ? mergeRuns(newRuns, row.newWords) : row.newWords;
|
|
543
|
+
const lineNoWidth = patchFiles.get(row.fileIndex)?.lineNoWidth ?? 0;
|
|
544
|
+
// An add row leaves the old pane blank and vice versa, so the blank side
|
|
545
|
+
// paints the "context" tone there — and, being empty, no line number.
|
|
546
|
+
const leftKind = row.kind === 'add' ? 'context' : row.kind;
|
|
547
|
+
const rightKind = row.kind === 'del' ? 'context' : row.kind;
|
|
548
|
+
const leftPrefix = `${gutterText(leftKind, 'old', row.oldNo, oldSegments !== undefined, lineNoWidth)} `;
|
|
549
|
+
const rightPrefix = `${gutterText(rightKind, 'new', row.newNo, newSegments !== undefined, lineNoWidth)} `;
|
|
550
|
+
const singleSide = oldFiles.has(row.fileIndex) === newFiles.has(row.fileIndex)
|
|
551
|
+
? undefined : oldFiles.has(row.fileIndex) ? 'old' : 'new';
|
|
552
|
+
const rowPaneWidth = singleSide === undefined ? paneWidth : blockWidth;
|
|
553
|
+
const leftBudget = rowPaneWidth - stringWidth(leftPrefix);
|
|
554
|
+
const rightBudget = rowPaneWidth - stringWidth(rightPrefix);
|
|
555
|
+
if (!verbose) {
|
|
556
|
+
clippedChars += clippedGraphemes(oldSegments, leftBudget);
|
|
557
|
+
clippedChars += clippedGraphemes(newSegments, rightBudget);
|
|
558
|
+
}
|
|
559
|
+
const leftRows = oldSegments === undefined
|
|
560
|
+
? []
|
|
561
|
+
: verbose ? wrapSegments(oldSegments, leftBudget) : [oldSegments];
|
|
562
|
+
const rightRows = newSegments === undefined
|
|
563
|
+
? []
|
|
564
|
+
: verbose ? wrapSegments(newSegments, rightBudget) : [newSegments];
|
|
565
|
+
// Neither pane can run ahead: the next logical row starts below the
|
|
566
|
+
// taller column. A row with no content on either side still paints one.
|
|
567
|
+
const height = Math.max(leftRows.length, rightRows.length, 1);
|
|
568
|
+
totalVisualRows += height;
|
|
569
|
+
if (paintedRows < windowLimit) {
|
|
570
|
+
// One logical line has no height bound of its own (a single 40k-cell
|
|
571
|
+
// line wraps into ~740 rows), so the row that crosses the window edge is
|
|
572
|
+
// cut to the rows left in it. Only that last row is ever cut; leaving
|
|
573
|
+
// paintedRows short of totalVisualRows is what shows the window notice.
|
|
574
|
+
const take = Math.min(height, windowLimit - paintedRows);
|
|
575
|
+
paint.push({
|
|
576
|
+
singleSide,
|
|
577
|
+
paneWidth: rowPaneWidth,
|
|
578
|
+
leftPrefix,
|
|
579
|
+
rightPrefix,
|
|
580
|
+
leftRows: take < height ? leftRows.slice(0, take) : leftRows,
|
|
581
|
+
rightRows: take < height ? rightRows.slice(0, take) : rightRows,
|
|
582
|
+
leftKind,
|
|
583
|
+
rightKind,
|
|
584
|
+
height: take,
|
|
585
|
+
});
|
|
586
|
+
paintedRows += take;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return (_jsxs(Box, { flexDirection: "column", width: blockWidth, children: [paint.map((plan, index) => {
|
|
590
|
+
if ('separator' in plan) {
|
|
591
|
+
return (_jsx(Box, { width: blockWidth, children: _jsx(Text, { dimColor: true, wrap: "truncate", children: plan.separator === '⋯' ? '⋯' : ` ${plan.separator}` }) }, index));
|
|
374
592
|
}
|
|
375
|
-
const
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
? undefined
|
|
380
|
-
: { segments: oldRuns !== undefined ? mergeRuns(oldRuns, row.oldWords) : row.oldWords };
|
|
381
|
-
const newSide = row.newWords === undefined
|
|
382
|
-
? undefined
|
|
383
|
-
: { segments: newRuns !== undefined ? mergeRuns(newRuns, row.newWords) : row.newWords };
|
|
384
|
-
const lineNoWidth = patchFiles.get(row.fileIndex)?.lineNoWidth ?? 0;
|
|
385
|
-
return (_jsxs(Box, { flexDirection: "row", children: [_jsx(PaneLine, { side: oldSide, kind: row.kind === 'add' ? 'context' : row.kind, tone: "old", width: paneWidth, toolBackground: toolBackground, lineNo: row.oldNo, lineNoWidth: lineNoWidth }), _jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: "\u2502" }) }), _jsx(PaneLine, { side: newSide, kind: row.kind === 'del' ? 'context' : row.kind, tone: "new", width: paneWidth, toolBackground: toolBackground, padLeft: true, lineNo: row.newNo, lineNoWidth: lineNoWidth })] }, index));
|
|
386
|
-
}), hidden > 0 && (_jsx(Text, { dimColor: true, children: t('lines-folded-expand', { n: hidden, key: primaryComboString('transcript') }) }))] }));
|
|
593
|
+
const leftPad = ' '.repeat(stringWidth(plan.leftPrefix));
|
|
594
|
+
const rightPad = ' '.repeat(stringWidth(plan.rightPrefix));
|
|
595
|
+
return Array.from({ length: plan.height }, (_, visual) => (_jsxs(Box, { flexDirection: "row", children: [plan.singleSide !== 'new' && _jsx(PaneLine, { padding: plan.leftRows[visual] === undefined, paneId: paneId + '-old', continuation: visual > 0 && plan.leftRows[visual] !== undefined ? stringWidth(plan.leftPrefix) + stringWidth(plan.leftRows[visual - 1].map(s => s.text).join('')) : undefined, segments: plan.leftRows[visual], prefix: visual === 0 ? plan.leftPrefix : leftPad, kind: plan.leftKind, tone: "old", width: plan.paneWidth, toolBackground: toolBackground }), plan.singleSide === undefined && _jsx(Box, { width: 1, flexShrink: 0, noSelect: true, children: _jsx(Text, { dimColor: true, children: "\u2502" }) }), plan.singleSide !== 'old' && _jsx(PaneLine, { padding: plan.rightRows[visual] === undefined, paneId: paneId + '-new', continuation: visual > 0 && plan.rightRows[visual] !== undefined ? stringWidth(plan.rightPrefix) + stringWidth(plan.rightRows[visual - 1].map(s => s.text).join('')) : undefined, segments: plan.rightRows[visual], prefix: visual === 0 ? plan.rightPrefix : rightPad, kind: plan.rightKind, tone: "new", width: plan.paneWidth, toolBackground: toolBackground })] }, `${index}-${visual}`)));
|
|
596
|
+
}), hidden > 0 && (_jsx(Text, { dimColor: true, children: t('lines-folded-expand', { n: hidden, key: primaryComboString('transcript') }) })), clippedChars > 0 && (_jsx(Text, { dimColor: true, children: t('tool-card-lines-hidden', { parts: t('tool-card-chars-unit', { n: clippedChars }), key: primaryComboString('transcript') }) })), paintedRows < totalVisualRows && (_jsx(Text, { dimColor: true, children: t('tool-card-window-shown-wrapped', { shown: paintedRows, total: totalVisualRows }) }))] }));
|
|
387
597
|
}
|
|
@@ -4,6 +4,8 @@ import type { AgentComposeTarget, AgentMessageControl, AgentMessageView } from '
|
|
|
4
4
|
import { type TranscriptLoader } from './messages/subagentTranscript.js';
|
|
5
5
|
export interface SubagentDetailSceneProps {
|
|
6
6
|
subagent: SubagentState;
|
|
7
|
+
/** Called only while this specific failed child is visible. */
|
|
8
|
+
onFailureRead?: (subagent: SubagentState) => void;
|
|
7
9
|
onBack: () => void;
|
|
8
10
|
onInterrupt?: (agentId: string) => void;
|
|
9
11
|
/** The child's full transcript (`subagentControl.history`). Absent = no
|
|
@@ -33,5 +35,5 @@ export interface SubagentDetailSceneProps {
|
|
|
33
35
|
* seam only accepts continuable children, and one-shot spawn children are
|
|
34
36
|
* disposed at settlement, so the affordance would be a dead control.
|
|
35
37
|
*/
|
|
36
|
-
export declare function SubagentDetailScene({ subagent, onBack, onInterrupt, loadTranscript, onOpenView, messages, compose, variant, focused, visible, }: SubagentDetailSceneProps): React.ReactNode;
|
|
38
|
+
export declare function SubagentDetailScene({ subagent, onFailureRead, onBack, onInterrupt, loadTranscript, onOpenView, messages, compose, variant, focused, visible, }: SubagentDetailSceneProps): React.ReactNode;
|
|
37
39
|
//# sourceMappingURL=SubagentDetailScene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubagentDetailScene.d.ts","sourceRoot":"","sources":["../../../src/components/SubagentDetailScene.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAIpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAExG,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAA;AA8JzC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,aAAa,CAAA;IACvB,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC;;qDAEiD;IACjD,cAAc,CAAC,EAAE,gBAAgB,CAAA;IACjC,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACtC,gDAAgD;IAChD,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;KAAE,CAAA;IACxF;iCAC6B;IAC7B,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAA;IAC7B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,MAAM,EACN,WAAW,EACX,cAAc,EACd,UAAU,EACV,QAAa,EACb,OAAO,EACP,OAAmB,EACnB,OAAc,EACd,OAAc,GACf,EAAE,wBAAwB,GAAG,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"SubagentDetailScene.d.ts","sourceRoot":"","sources":["../../../src/components/SubagentDetailScene.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAIpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAExG,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAA;AA8JzC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,aAAa,CAAA;IACvB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAA;IACjD,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC;;qDAEiD;IACjD,cAAc,CAAC,EAAE,gBAAgB,CAAA;IACjC,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACtC,gDAAgD;IAChD,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;KAAE,CAAA;IACxF;iCAC6B;IAC7B,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAA;IAC7B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,aAAa,EACb,MAAM,EACN,WAAW,EACX,cAAc,EACd,UAAU,EACV,QAAa,EACb,OAAO,EACP,OAAmB,EACnB,OAAc,EACd,OAAc,GACf,EAAE,wBAAwB,GAAG,KAAK,CAAC,SAAS,CA2lB5C"}
|
|
@@ -116,7 +116,11 @@ function isActivityLine(text) {
|
|
|
116
116
|
* seam only accepts continuable children, and one-shot spawn children are
|
|
117
117
|
* disposed at settlement, so the affordance would be a dead control.
|
|
118
118
|
*/
|
|
119
|
-
export function SubagentDetailScene({ subagent, onBack, onInterrupt, loadTranscript, onOpenView, messages = [], compose, variant = 'default', focused = true, visible = true, }) {
|
|
119
|
+
export function SubagentDetailScene({ subagent, onFailureRead, onBack, onInterrupt, loadTranscript, onOpenView, messages = [], compose, variant = 'default', focused = true, visible = true, }) {
|
|
120
|
+
React.useEffect(() => {
|
|
121
|
+
if (visible && subagent.status === 'failed')
|
|
122
|
+
onFailureRead?.(subagent);
|
|
123
|
+
}, [visible, subagent, onFailureRead]);
|
|
120
124
|
const panelMode = variant === 'panel';
|
|
121
125
|
const scrollRef = React.useRef(null);
|
|
122
126
|
const { rows, columns } = useTerminalSize();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Whale.d.ts","sourceRoot":"","sources":["../../../src/components/Whale.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Whale.d.ts","sourceRoot":"","sources":["../../../src/components/Whale.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjF;;;;;;;;GAQG;AAEH,KAAK,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAoB5C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,GAAG,GAAG,SAAS,GAC/C,MAAM,EAAE,CA2CV;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,SAAS,CAAC,GAAG,MAAM,EAAE,CAG9G;AAWD,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,EAAE,CAO/D;AAGD,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAErC;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EACvB,UAAiC,EACjC,IAAI,EACJ,KAAK,GACN,EAAE;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,KAAK,CAAC,SAAS,CAWlB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { backgroundOpenCode, foregroundOpenCode } from '../ink/colorize.js';
|
|
2
3
|
import { Box, Text } from '../ui.js';
|
|
3
4
|
import { WHALE_FRAMES } from './whaleFrames.js';
|
|
4
5
|
import { composeWhaleGrid, poseKey } from './whaleLayers.js';
|
|
@@ -11,8 +12,8 @@ const PALETTE = {
|
|
|
11
12
|
H: [204, 51, 153],
|
|
12
13
|
Z: [128, 128, 128],
|
|
13
14
|
};
|
|
14
|
-
const fg = (rgb) =>
|
|
15
|
-
const bg = (rgb) =>
|
|
15
|
+
const fg = (rgb) => foregroundOpenCode(`rgb(${rgb[0]},${rgb[1]},${rgb[2]})`);
|
|
16
|
+
const bg = (rgb) => backgroundOpenCode(`rgb(${rgb[0]},${rgb[1]},${rgb[2]})`);
|
|
16
17
|
const RESET = '\x1b[0m';
|
|
17
18
|
/** Erase from the cursor to the end of the physical line (default colors). */
|
|
18
19
|
const ERASE_TO_EOL = '\x1b[K';
|
|
@@ -51,11 +52,13 @@ export function renderCellRows(width, height, pixel) {
|
|
|
51
52
|
// background, and SGR persists across cells — a bg left over from
|
|
52
53
|
// the previous cell would paint a phantom pixel into the empty half
|
|
53
54
|
// (the contour noise of the sprite). Reset it explicitly.
|
|
54
|
-
|
|
55
|
+
const color = fg(up);
|
|
56
|
+
seq = color === '' ? '' : color + BG_DEFAULT;
|
|
55
57
|
ch = '▀';
|
|
56
58
|
}
|
|
57
59
|
else if (lo !== undefined) {
|
|
58
|
-
|
|
60
|
+
const color = fg(lo);
|
|
61
|
+
seq = color === '' ? '' : color + BG_DEFAULT;
|
|
59
62
|
ch = '▄';
|
|
60
63
|
}
|
|
61
64
|
else {
|
|
@@ -72,7 +75,7 @@ export function renderCellRows(width, height, pixel) {
|
|
|
72
75
|
// otherwise leak its SGR into the line's remaining padding — then append
|
|
73
76
|
// the erase pass (see the doc above).
|
|
74
77
|
let row = out;
|
|
75
|
-
if (!row.endsWith(RESET))
|
|
78
|
+
if (foregroundOpenCode('ansi:white') !== '' && !row.endsWith(RESET))
|
|
76
79
|
row += RESET;
|
|
77
80
|
rows.push(row + ERASE_TO_EOL);
|
|
78
81
|
}
|
|
@@ -42,6 +42,6 @@ export type ApprovalPanelProps = {
|
|
|
42
42
|
* the reason does not fit, its tail (the typing position) is shown after an
|
|
43
43
|
* ellipsis.
|
|
44
44
|
*/
|
|
45
|
-
export declare function feedbackRowLines(prefix: string, label: string, reason: string, columns: number): string[];
|
|
45
|
+
export declare function feedbackRowLines(prefix: string, label: string, reason: string, columns: number, maxLines?: 1 | 2): string[];
|
|
46
46
|
export declare function ApprovalPanel({ approval, background, onDecide }: ApprovalPanelProps): React.ReactNode;
|
|
47
47
|
//# sourceMappingURL=ApprovalPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApprovalPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/approvals/ApprovalPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ApprovalPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/approvals/ApprovalPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAA;AAGrC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAA;IAC1C;2EACuE;IACvE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,uBAAuB,KAAK,IAAI,CAAA;CAChG,CAAA;AAmED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,CAAC,GAAG,CAAsB,GAAG,MAAM,EAAE,CAM/I;AAQD,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,UAAkB,EAAE,QAAQ,EAAE,EAAE,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAsP7G"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* The approval panel — the permission prompt every backend renders
|
|
4
4
|
* through. One ask per panel: a
|
|
@@ -26,11 +26,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
26
26
|
import React from 'react';
|
|
27
27
|
import { t } from '../../i18n.js';
|
|
28
28
|
import { stringWidth } from '../../ink/stringWidth.js';
|
|
29
|
-
import { Box, Text, useInput, useTerminalSize } from '../../ui.js';
|
|
29
|
+
import { Box, Text, ScrollBox, useInput, useTerminalSize } from '../../ui.js';
|
|
30
|
+
import wrapText from '../../ink/wrap-text.js';
|
|
31
|
+
import { actionMatches, effectiveComboDisplay } from '../../utils/keymap.js';
|
|
30
32
|
import { isPlainReturnInput } from '../../utils/modifiers.js';
|
|
31
33
|
import { Divider } from '../design-system/Divider.js';
|
|
32
34
|
import { POINTER } from '../../terminal-utils/figures.js';
|
|
33
35
|
import { flattenPasteInline } from '../../channel/sanitize.js';
|
|
36
|
+
import { clipPreviewRows, pagePreview } from '../previewRows.js';
|
|
34
37
|
import { panelOutcomeOf, visiblePermissionOptions, } from '../../channel/permissions.js';
|
|
35
38
|
/** A feedback reason is a short sentence, not a document. */
|
|
36
39
|
const FEEDBACK_MAX_POINTS = 2000;
|
|
@@ -39,6 +42,27 @@ const FEEDBACK_MAX_POINTS = 2000;
|
|
|
39
42
|
const ROW_CHROME_CELLS = 5;
|
|
40
43
|
/** The reason never takes more than this many rows of the option list. */
|
|
41
44
|
const FEEDBACK_MAX_LINES = 2;
|
|
45
|
+
/**
|
|
46
|
+
* Preview caps. The panel is in-flow in the bottom chrome, so its height is
|
|
47
|
+
* its content height: an unbounded command pushed the question, the option
|
|
48
|
+
* rows and the hint off screen and left the user nothing to answer (#1664).
|
|
49
|
+
* These caps are the worst case; the terminal-row budget below shrinks them
|
|
50
|
+
* further on a short terminal.
|
|
51
|
+
*/
|
|
52
|
+
const COMMAND_MAX_LINES = 8;
|
|
53
|
+
const TITLE_MAX_LINES = 3;
|
|
54
|
+
const REASON_MAX_LINES = 3;
|
|
55
|
+
/**
|
|
56
|
+
* Rows kept for the rest of the bottom chrome while this panel is up: the
|
|
57
|
+
* status line plus a floor of transcript rows. The composer does not count —
|
|
58
|
+
* Chat replaces it with this panel (`PromptInput` stays mounted but suspended,
|
|
59
|
+
* rendering nothing). The value deliberately matches the picker overlay's
|
|
60
|
+
* prompt-slot reserve so both surfaces leave the same footer budget; the two
|
|
61
|
+
* stay separate literals because the overlay's composer IS on screen.
|
|
62
|
+
*/
|
|
63
|
+
const CHROME_RESERVED_ROWS = 8;
|
|
64
|
+
/** Compact prompts spend the transcript reserve but keep the three-row footer. */
|
|
65
|
+
const COMPACT_FOOTER_ROWS = 3;
|
|
42
66
|
/** The longest tail of `text` that fits in `cells` display cells. */
|
|
43
67
|
function tailWithin(text, cells) {
|
|
44
68
|
const points = [...text];
|
|
@@ -77,12 +101,12 @@ function hardWrap(text, cells) {
|
|
|
77
101
|
* the reason does not fit, its tail (the typing position) is shown after an
|
|
78
102
|
* ellipsis.
|
|
79
103
|
*/
|
|
80
|
-
export function feedbackRowLines(prefix, label, reason, columns) {
|
|
104
|
+
export function feedbackRowLines(prefix, label, reason, columns, maxLines = FEEDBACK_MAX_LINES) {
|
|
81
105
|
const cells = Math.max(8, columns - ROW_CHROME_CELLS);
|
|
82
106
|
const head = `${prefix}${t('approval-feedback-row', { label, reason: '' })}`;
|
|
83
|
-
const budget =
|
|
107
|
+
const budget = maxLines * cells - stringWidth(head);
|
|
84
108
|
const shown = stringWidth(reason) <= budget ? reason : `…${tailWithin(reason, Math.max(0, budget - 1))}`;
|
|
85
|
-
return hardWrap(`${prefix}${t('approval-feedback-row', { label, reason: shown })}`, cells).slice(0,
|
|
109
|
+
return hardWrap(`${prefix}${t('approval-feedback-row', { label, reason: shown })}`, cells).slice(0, maxLines);
|
|
86
110
|
}
|
|
87
111
|
/** The localized label of an option without backend wording. */
|
|
88
112
|
function optionLabel(option) {
|
|
@@ -92,7 +116,7 @@ function optionLabel(option) {
|
|
|
92
116
|
}
|
|
93
117
|
export function ApprovalPanel({ approval, background = false, onDecide }) {
|
|
94
118
|
const options = visiblePermissionOptions(approval);
|
|
95
|
-
const { columns } = useTerminalSize();
|
|
119
|
+
const { columns, rows } = useTerminalSize();
|
|
96
120
|
// `defaultToNo` opens on the rejection (sorted first); otherwise on the
|
|
97
121
|
// first option, as the DSH panel always has. The ref is the synchronous
|
|
98
122
|
// source of truth: one stdin chunk can carry a focus move and the typing
|
|
@@ -111,6 +135,7 @@ export function ApprovalPanel({ approval, background = false, onDecide }) {
|
|
|
111
135
|
// One stdin chunk can carry several key events inside a single React
|
|
112
136
|
// batch: the ref is the synchronous source of truth for the handlers.
|
|
113
137
|
const feedbackRef = React.useRef('');
|
|
138
|
+
const previewScrollRef = React.useRef(null);
|
|
114
139
|
const applyFeedback = (next) => {
|
|
115
140
|
feedbackRef.current = next;
|
|
116
141
|
setFeedback(next);
|
|
@@ -141,7 +166,16 @@ export function ApprovalPanel({ approval, background = false, onDecide }) {
|
|
|
141
166
|
const points = [...feedbackRef.current, ...text];
|
|
142
167
|
applyFeedback(points.slice(0, FEEDBACK_MAX_POINTS).join(''));
|
|
143
168
|
};
|
|
144
|
-
useInput((input, key) => {
|
|
169
|
+
useInput((input, key, event) => {
|
|
170
|
+
if (compact && hasPreview) {
|
|
171
|
+
const up = actionMatches('questionDetailUp', input, key);
|
|
172
|
+
const down = actionMatches('questionDetailDown', input, key);
|
|
173
|
+
if (up || down) {
|
|
174
|
+
pagePreview(previewScrollRef.current, up ? -1 : 1);
|
|
175
|
+
event.stopImmediatePropagation();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
145
179
|
if (key.escape || (key.ctrl && input === 'c')) {
|
|
146
180
|
reject();
|
|
147
181
|
return;
|
|
@@ -189,13 +223,61 @@ export function ApprovalPanel({ approval, background = false, onDecide }) {
|
|
|
189
223
|
decide(index, false);
|
|
190
224
|
}
|
|
191
225
|
}, { isActive: true });
|
|
192
|
-
|
|
226
|
+
// ── Preview budget ─────────────────────────────────────────────────────
|
|
227
|
+
// The divider, the proceed question, the option rows and the key hint are
|
|
228
|
+
// always painted; the preview text between them must fold instead of
|
|
229
|
+
// growing the panel past the viewport (#1664).
|
|
230
|
+
const contentCells = Math.max(8, columns - 4);
|
|
231
|
+
// The command sits in a Box with paddingX={2} inside the panel's 2+2.
|
|
232
|
+
const commandCells = Math.max(8, columns - 8);
|
|
233
|
+
const warningRows = (background ? 1 : 0)
|
|
234
|
+
+ (approval.subagentId === undefined ? 0 : 1)
|
|
235
|
+
+ (approval.external === true ? 1 : 0)
|
|
236
|
+
+ (approval.blockedPath === undefined ? 0 : 1);
|
|
237
|
+
// root margin + divider + content margin + warnings + "proceed" + options
|
|
238
|
+
// margin + option rows + the focused row's spacer + hint margin + hint.
|
|
239
|
+
const fixedRows = 8 + warningRows + options.length;
|
|
240
|
+
const previewBlockCount = (approval.title === undefined ? 0 : 1)
|
|
241
|
+
+ (approval.command === undefined ? 0 : 1)
|
|
242
|
+
+ (approval.reason === undefined ? 0 : 1);
|
|
243
|
+
const hasPreview = previewBlockCount + warningRows > 0;
|
|
244
|
+
// Below this floor even one marker per block would hide a decision row.
|
|
245
|
+
// Remove decorative gaps and put all request text in one bounded viewport.
|
|
246
|
+
const compact = rows < fixedRows + previewBlockCount + COMPACT_FOOTER_ROWS;
|
|
247
|
+
const hint = compact && hasPreview
|
|
248
|
+
? t('approval-hint-preview', { up: effectiveComboDisplay('questionDetailUp'), down: effectiveComboDisplay('questionDetailDown') })
|
|
249
|
+
: acceptsFeedback ? t('approval-hint-feedback') : t('approval-hint');
|
|
250
|
+
const hintRows = wrapText(hint, contentCells, 'wrap').split('\n').length;
|
|
251
|
+
// The divider and choices already identify the decision. On a tiny
|
|
252
|
+
// three-choice prompt, drop the repeated question before any request text.
|
|
253
|
+
const showProceed = !compact || rows >= COMPACT_FOOTER_ROWS + 2 + options.length + hintRows + (hasPreview ? 1 : 0);
|
|
254
|
+
const compactPreviewRows = Math.max(1, rows - COMPACT_FOOTER_ROWS - 1 - (showProceed ? 1 : 0) - options.length - hintRows);
|
|
255
|
+
let previewRowsLeft = Math.max(1, rows - fixedRows - CHROME_RESERVED_ROWS);
|
|
256
|
+
// A present text is never dropped: once the budget is spent it still keeps
|
|
257
|
+
// its omitted marker, overdrawing the chrome reserve by at most one row per
|
|
258
|
+
// block. Silently hiding the asker's reason reads as "there was none".
|
|
259
|
+
const takePreview = (text, cells, cap) => {
|
|
260
|
+
if (text === undefined)
|
|
261
|
+
return undefined;
|
|
262
|
+
const view = clipPreviewRows(text, cells, Math.max(1, Math.min(cap, previewRowsLeft)));
|
|
263
|
+
previewRowsLeft = Math.max(0, previewRowsLeft - view.rows.length - (view.omitted > 0 ? 1 : 0));
|
|
264
|
+
return view;
|
|
265
|
+
};
|
|
266
|
+
// The gated command is what the decision is about: it takes the budget
|
|
267
|
+
// first, then the backend's reason, then the prompt sentence.
|
|
268
|
+
const commandView = takePreview(approval.command, commandCells, COMMAND_MAX_LINES);
|
|
269
|
+
const reasonView = takePreview(approval.reason, contentCells, REASON_MAX_LINES);
|
|
270
|
+
const titleView = takePreview(approval.title, contentCells, TITLE_MAX_LINES);
|
|
271
|
+
/** Preview rows (already wrapped to one row each) and the omitted marker. */
|
|
272
|
+
const preview = (view, dim = false) => view === undefined ? null : (_jsxs(_Fragment, { children: [view.rows.length > 0 && (_jsx(Text, { dimColor: dim, wrap: "wrap", children: view.rows.join('\n') })), view.omitted > 0 && (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: t('panel-preview-omitted', { count: view.omitted }) }))] }));
|
|
273
|
+
const previewContent = (_jsxs(_Fragment, { children: [background && (_jsx(Text, { color: "warning", children: t('approval-background-agent', { id: approval.agentId.slice(0, 8) }) })), approval.subagentId !== undefined && (_jsx(Text, { color: "warning", children: t('approval-subagent', { id: approval.subagentId.slice(0, 8) }) })), approval.external === true && (_jsxs(Text, { color: "warning", wrap: "wrap", children: ["[external] ", t('approval-external-hint')] })), compact && approval.title !== undefined ? _jsx(Text, { wrap: "wrap", children: approval.title }) : preview(titleView), approval.command !== undefined && (_jsx(Box, { flexDirection: "column", paddingX: 2, children: compact ? _jsx(Text, { dimColor: true, wrap: "wrap", children: approval.command }) : preview(commandView, true) })), compact && approval.reason !== undefined ? _jsx(Text, { dimColor: true, wrap: "wrap", children: approval.reason }) : preview(reasonView, true), approval.blockedPath !== undefined && (_jsx(Text, { color: "warning", wrap: "wrap", children: t('approval-blocked-path', { path: approval.blockedPath }) }))] }));
|
|
274
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: compact ? 0 : 1, paddingLeft: 2, paddingRight: 2, width: "100%", children: [_jsx(Divider, { color: "permission", title: t('approval-waiting', { tool: approval.toolName }) }), _jsxs(Box, { flexDirection: "column", marginTop: compact ? 0 : 1, children: [compact && hasPreview ? (_jsx(ScrollBox, { ref: previewScrollRef, flexDirection: "column", height: compactPreviewRows, flexShrink: 0, children: previewContent })) : previewContent, showProceed && _jsx(Text, { dimColor: true, wrap: compact ? 'truncate-end' : 'wrap', children: t('approval-proceed') })] }), _jsx(Box, { flexDirection: "column", marginTop: compact ? 0 : 1, children: options.map((option, index) => {
|
|
193
275
|
const focused = index === focusIndex;
|
|
194
276
|
const hovered = index === hoverIndex;
|
|
195
277
|
const label = optionLabel(option);
|
|
196
278
|
const reasonLines = acceptsFeedback && option.kind === 'reject' && feedback !== ''
|
|
197
|
-
? feedbackRowLines(`${index + 1}. `, label, feedback, columns)
|
|
279
|
+
? feedbackRowLines(`${index + 1}. `, label, feedback, columns, compact ? 1 : FEEDBACK_MAX_LINES)
|
|
198
280
|
: undefined;
|
|
199
|
-
return (_jsxs(Box, { flexDirection: "row", marginTop: focused ? 1 : 0, onClick: () => decide(index, true), onMouseEnter: () => setHoverIndex(index), onMouseLeave: () => setHoverIndex(current => (current === index ? -1 : current)), backgroundColor: hovered && !focused ? 'userMessageBackgroundHover' : undefined, children: [_jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { color: focused ? 'accent' : undefined, bold: focused, children: focused ? POINTER : ' ' }) }), reasonLines === undefined ? (_jsxs(Text, { bold: focused, color: focused ? 'accent' : undefined, wrap:
|
|
200
|
-
}) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children:
|
|
281
|
+
return (_jsxs(Box, { flexDirection: "row", marginTop: !compact && focused ? 1 : 0, onClick: () => decide(index, true), onMouseEnter: () => setHoverIndex(index), onMouseLeave: () => setHoverIndex(current => (current === index ? -1 : current)), backgroundColor: hovered && !focused ? 'userMessageBackgroundHover' : undefined, children: [_jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { color: focused ? 'accent' : undefined, bold: focused, children: focused ? POINTER : ' ' }) }), reasonLines === undefined ? (_jsxs(Text, { bold: focused, color: focused ? 'accent' : undefined, wrap: compact ? 'truncate-end' : 'wrap', children: [index + 1, ". ", label] })) : (_jsx(Box, { flexDirection: "column", children: reasonLines.map((line, row) => (_jsx(Text, { bold: focused, color: focused ? 'accent' : undefined, wrap: "truncate-end", children: line }, row))) }))] }, option.id));
|
|
282
|
+
}) }), _jsx(Box, { marginTop: compact ? 0 : 1, children: _jsx(Text, { dimColor: true, children: hint }) })] }));
|
|
201
283
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigfont.d.ts","sourceRoot":"","sources":["../../../src/components/bigfont.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bigfont.d.ts","sourceRoot":"","sources":["../../../src/components/bigfont.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD;;;;;;GAMG;AAEH,YAAY;AACZ,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,eAAe;IACf,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAYD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAItF;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAKlF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,GAAG,EACT,EAAE,EAAE,GAAG,EACP,KAAK,EAAE,GAAG,EACV,MAAM,SAAK,EACX,OAAO,SAAI,EACX,MAAM,SAAI,GACT,MAAM,EAAE,CAgDV"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { foregroundOpenCode } from '../ink/colorize.js';
|
|
1
2
|
import { interpolateColor } from './Spinner/spinnerUtils.js';
|
|
2
3
|
/** 词组之间的间隔列数。 */
|
|
3
4
|
const WORD_GAP = 2;
|
|
@@ -5,7 +6,7 @@ const WORD_GAP = 2;
|
|
|
5
6
|
const SWEEP_WINDOW = 8;
|
|
6
7
|
/** 一行字画几行。 */
|
|
7
8
|
const ROWS = 5;
|
|
8
|
-
const esc = (rgb) =>
|
|
9
|
+
const esc = (rgb) => foregroundOpenCode(`rgb(${rgb.r},${rgb.g},${rgb.b})`);
|
|
9
10
|
const RESET = '\x1b[39m';
|
|
10
11
|
/**
|
|
11
12
|
* `text` 在该字身宽度、该字距下画出来的列数(含末尾那格字距留白)——与渲染循环
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantToolUseMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/AssistantToolUseMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAA8C,OAAO,EAAE,MAAM,8BAA8B,CAAA;AASvG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AASjE,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,OAAO,CAAA;IACb,4CAA4C;IAC5C,eAAe,EAAE,OAAO,CAAA;IACxB,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAA;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;OAIG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;IACzC,2EAA2E;IAC3E,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;8CAC0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qFAAqF;IACrF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;4BAGwB;IACxB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;6BAEyB;IACzB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AA2LD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,KAAK,CAS9F;
|
|
1
|
+
{"version":3,"file":"AssistantToolUseMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/AssistantToolUseMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAA8C,OAAO,EAAE,MAAM,8BAA8B,CAAA;AASvG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AASjE,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,OAAO,CAAA;IACb,4CAA4C;IAC5C,eAAe,EAAE,OAAO,CAAA;IACxB,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAA;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;OAIG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;IACzC,2EAA2E;IAC3E,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;8CAC0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qFAAqF;IACrF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;4BAGwB;IACxB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;6BAEyB;IACzB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AA2LD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,KAAK,CAS9F;AAoZD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,eAAe,EACf,OAAO,EACP,UAAkB,EAClB,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,UAAmB,EACnB,cAAuB,EACvB,UAAU,EACV,mBAA2B,EAC3B,YAAoB,EACpB,KAAa,EACb,aAAa,EACb,YAAoB,EACpB,UAAkB,GACnB,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CA2XzB"}
|