@deepseek-harness-tui/dsh-tui 0.18.0 → 0.20.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 +90 -59
- package/bin/dsh-tui.js +46 -3
- package/cordis.patch.yml +5 -3
- package/cordis.yml +3 -2
- package/guide/dsh-tui-guide/codex-backend.en.md +2 -2
- package/guide/dsh-tui-guide/codex-backend.md +2 -2
- package/guide/dsh-tui-guide/configuration.en.md +7 -2
- package/guide/dsh-tui-guide/configuration.md +7 -2
- package/guide/dsh-tui-guide/getting-started.en.md +168 -4
- package/guide/dsh-tui-guide/getting-started.md +121 -14
- package/guide/dsh-tui-guide/interaction.en.md +11 -10
- package/guide/dsh-tui-guide/interaction.md +5 -4
- package/guide/dsh-tui-guide/user-guide.en.md +12 -6
- package/guide/dsh-tui-guide/user-guide.md +12 -6
- package/lib/settings.json +24 -8
- package/lib/types/adapter/ports/channel-ui.d.ts +10 -7
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +67 -8
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/agent/events.d.ts +14 -5
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/agent/session.d.ts +5 -0
- package/lib/types/agent/session.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.js +8 -3
- package/lib/types/backends/claude/translate/core.d.ts +2 -2
- package/lib/types/backends/claude/translate/core.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/core.js +10 -6
- package/lib/types/backends/codex/session/commands.d.ts +2 -0
- package/lib/types/backends/codex/session/commands.d.ts.map +1 -1
- package/lib/types/backends/codex/session/commands.js +8 -4
- package/lib/types/backends/codex/session/input.d.ts +11 -7
- package/lib/types/backends/codex/session/input.d.ts.map +1 -1
- package/lib/types/backends/codex/session/input.js +68 -15
- package/lib/types/backends/codex/session/session.d.ts.map +1 -1
- package/lib/types/backends/codex/session/session.js +2 -3
- package/lib/types/backends/codex/translate/presentation.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/presentation.js +5 -2
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/permissions.d.ts +15 -0
- package/lib/types/channel/permissions.d.ts.map +1 -1
- package/lib/types/channel/permissions.js +28 -0
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +89 -11
- package/lib/types/channel/questions.d.ts +45 -3
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/questions.js +43 -0
- package/lib/types/channel/sanitize.d.ts.map +1 -1
- package/lib/types/channel/sanitize.js +8 -4
- package/lib/types/channel/subagent-failure.d.ts +49 -0
- package/lib/types/channel/subagent-failure.d.ts.map +1 -0
- package/lib/types/channel/subagent-failure.js +59 -0
- package/lib/types/channel/transcript.d.ts +17 -0
- package/lib/types/channel/transcript.d.ts.map +1 -1
- package/lib/types/channel/transcript.js +35 -0
- package/lib/types/commands.js +2 -2
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +14 -10
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +61 -6
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +3 -2
- package/lib/types/components/StarPrompt.d.ts +5 -3
- package/lib/types/components/StarPrompt.d.ts.map +1 -1
- package/lib/types/components/StarPrompt.js +56 -6
- package/lib/types/components/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +1 -1
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +9 -2
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +126 -25
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -8
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +7 -4
- package/lib/types/components/questions/PlanReviewPanel.d.ts +3 -6
- package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
- package/lib/types/components/revealScope.d.ts +15 -0
- package/lib/types/components/revealScope.d.ts.map +1 -0
- package/lib/types/components/revealScope.js +17 -0
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +34 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.js +108 -7
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.js +1 -1
- package/lib/types/components/smoothReveal.d.ts +36 -6
- package/lib/types/components/smoothReveal.d.ts.map +1 -1
- package/lib/types/components/smoothReveal.js +92 -21
- package/lib/types/components/teamRoster.d.ts +6 -3
- package/lib/types/components/teamRoster.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +4 -14
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.js +26 -17
- package/lib/types/dsh-adapter/approvals.d.ts +19 -0
- package/lib/types/dsh-adapter/approvals.d.ts.map +1 -1
- package/lib/types/dsh-adapter/approvals.js +17 -1
- package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/session.js +12 -0
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +21 -4
- package/lib/types/dsh-adapter/channel/attached-context.d.ts +15 -2
- package/lib/types/dsh-adapter/channel/attached-context.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/attached-context.js +26 -3
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +3 -0
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +43 -2
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +2 -6
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.js +7 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +2 -6
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.js +3 -26
- package/lib/types/dsh-adapter/channel/emitter.js +1 -1
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +15 -4
- package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
- package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-actions.js +34 -10
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +3 -7
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +14 -5
- package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +7 -3
- package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.js +26 -9
- package/lib/types/dsh-adapter/channel/model-selection.d.ts +27 -2
- package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-selection.js +81 -37
- package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection-helpers.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection-helpers.js +4 -2
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.js +6 -2
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.js +8 -4
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +185 -36
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +55 -4
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.js +80 -16
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.js +6 -5
- package/lib/types/dsh-adapter/channel/task-completion.js +2 -10
- package/lib/types/dsh-adapter/channel/transcript.d.ts +3 -2
- package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/transcript.js +13 -4
- package/lib/types/dsh-adapter/channel/types.d.ts +11 -2
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts +11 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.js +38 -0
- package/lib/types/dsh-adapter/compat/messages.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/messages.js +2 -2
- package/lib/types/dsh-adapter/contract.d.ts +29 -3
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +48 -5
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +5 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.js +0 -2
- package/lib/types/dsh-adapter/fresh-agent.d.ts +1 -1
- package/lib/types/dsh-adapter/fresh-agent.d.ts.map +1 -1
- package/lib/types/dsh-adapter/fresh-agent.js +60 -11
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-access.js +60 -11
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-contract.js +5 -3
- package/lib/types/dsh-adapter/host-dsh.d.ts +2 -8
- package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-dsh.js +30 -6
- package/lib/types/dsh-adapter/host-entry.js +4 -0
- package/lib/types/dsh-adapter/index.d.ts +9 -1
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +5 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts +73 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts.map +1 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.js +250 -0
- package/lib/types/dsh-adapter/oauth/bonus.d.ts +34 -9
- package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/bonus.js +47 -5
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts +7 -2
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/deepseek.js +6 -1
- package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/index.js +44 -0
- package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/profiles.js +14 -1
- package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/service.js +5 -6
- package/lib/types/dsh-adapter/plugin-manage.d.ts +6 -4
- package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-manage.js +3 -2
- package/lib/types/dsh-adapter/plugin.d.ts +237 -6
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +751 -67
- package/lib/types/dsh-adapter/presets.d.ts +38 -11
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +46 -17
- 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/questions.d.ts +3 -4
- package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/questions.js +1 -1
- package/lib/types/dsh-adapter/session-list-metadata.js +2 -2
- package/lib/types/dsh-adapter/session-projection-store.d.ts +1 -1
- package/lib/types/dsh-adapter/session-projection-store.d.ts.map +1 -1
- package/lib/types/dsh-adapter/session-projection-store.js +30 -23
- package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessionTree.js +4 -1
- package/lib/types/dsh-adapter/subagents.d.ts +6 -0
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +32 -3
- package/lib/types/dsh-adapter/team-mode.d.ts +46 -27
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +157 -29
- package/lib/types/dsh-adapter/team-roster.d.ts +53 -18
- package/lib/types/dsh-adapter/team-roster.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-roster.js +206 -39
- package/lib/types/dsh-adapter/team-tools.d.ts +25 -12
- package/lib/types/dsh-adapter/team-tools.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-tools.js +81 -26
- package/lib/types/dsh-adapter/tool-scope.d.ts +24 -0
- package/lib/types/dsh-adapter/tool-scope.d.ts.map +1 -0
- package/lib/types/dsh-adapter/tool-scope.js +127 -0
- package/lib/types/dsh-adapter/types.d.ts +2 -1
- package/lib/types/dsh-adapter/types.d.ts.map +1 -1
- package/lib/types/heldInputs.d.ts +55 -16
- package/lib/types/heldInputs.d.ts.map +1 -1
- package/lib/types/heldInputs.js +277 -41
- package/lib/types/i18n.d.ts +292 -20
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +89 -13
- package/lib/types/ink/components/App.d.ts +2 -0
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +8 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/dom.js +13 -3
- package/lib/types/ink/events/input-event.d.ts.map +1 -1
- package/lib/types/ink/events/input-event.js +7 -6
- package/lib/types/ink/flush-tick.d.ts +6 -0
- package/lib/types/ink/flush-tick.d.ts.map +1 -1
- package/lib/types/ink/flush-tick.js +31 -0
- package/lib/types/ink/hit-test.d.ts +2 -0
- package/lib/types/ink/hit-test.d.ts.map +1 -1
- package/lib/types/ink/hit-test.js +10 -0
- package/lib/types/ink/hooks/use-program-status.d.ts +1 -1
- package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-program-status.js +3 -2
- package/lib/types/ink/hooks/use-terminal-title.d.ts +15 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-terminal-title.js +23 -3
- package/lib/types/ink/ink.d.ts +1 -0
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +7 -4
- package/lib/types/ink/jumpback-state.d.ts +33 -0
- package/lib/types/ink/jumpback-state.d.ts.map +1 -0
- package/lib/types/ink/jumpback-state.js +51 -0
- package/lib/types/ink/jumpback.d.ts +78 -0
- package/lib/types/ink/jumpback.d.ts.map +1 -0
- package/lib/types/ink/jumpback.js +515 -0
- package/lib/types/ink/log-update.js +37 -14
- package/lib/types/ink/notify-helper/activate.cs +836 -0
- package/lib/types/ink/notify-helper/compile.d.ts +30 -0
- package/lib/types/ink/notify-helper/compile.d.ts.map +1 -0
- package/lib/types/ink/notify-helper/compile.js +235 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +25 -0
- package/lib/types/ink/terminal-notification-windows.d.ts +8 -4
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.js +14 -21
- package/lib/types/ink/terminal-notification.d.ts +31 -2
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +51 -0
- package/lib/types/ink/terminal.d.ts +15 -3
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +38 -9
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +1 -1
- package/lib/types/screens/Chat.d.ts +4 -3
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +81 -11
- package/lib/types/screens/SessionSupervisor.d.ts +3 -6
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +5 -8
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +1 -2
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +2 -2
- package/lib/types/screens/sessionSupervisor/model.d.ts +1 -1
- package/lib/types/screens/sessionSupervisor/model.js +1 -1
- package/lib/types/sessionMounts.d.ts +12 -5
- package/lib/types/sessionMounts.d.ts.map +1 -1
- package/lib/types/sessionMounts.js +33 -6
- package/lib/types/settings/definitions.d.ts +12 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +15 -7
- package/lib/types/update.d.ts +412 -20
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +2094 -193
- package/lib/types/updateHost.d.ts +198 -0
- package/lib/types/updateHost.d.ts.map +1 -0
- package/lib/types/updateHost.js +608 -0
- package/lib/types/utils/processName.d.ts +16 -0
- package/lib/types/utils/processName.d.ts.map +1 -0
- package/lib/types/utils/processName.js +27 -0
- package/package.json +114 -111
- package/presets/liangshen/agent.cordis.yml +4 -0
- package/tui-profile/feed/README.md +1 -1
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantToolUseMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/AssistantToolUseMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"AssistantToolUseMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/AssistantToolUseMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,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;AAUjE,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;qCACiC;IACjC,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;AAmfD;;;;;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,CA4YzB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { extname } from 'node:path';
|
|
4
|
+
import * as JsDiff from 'diff';
|
|
4
5
|
import { Box, Text, useTerminalSize } from '../../ui.js';
|
|
5
6
|
import { stringWidth } from '../../ink/stringWidth.js';
|
|
6
7
|
import { useAnimationFrame } from '../../ink/hooks/use-animation-frame.js';
|
|
@@ -12,7 +13,8 @@ import { formatDuration } from '../../terminal-utils/format.js';
|
|
|
12
13
|
import { formatClock } from '../../trajectory/format.js';
|
|
13
14
|
import { foldLongLines } from '../../utils/fold-long-lines.js';
|
|
14
15
|
import { getLang, t, tOr } from '../../i18n.js';
|
|
15
|
-
import { revealLinesOf, snapReveal } from '../smoothReveal.js';
|
|
16
|
+
import { revealLinesOf, scopeRevealKey, snapReveal } from '../smoothReveal.js';
|
|
17
|
+
import { useRevealScope } from '../revealScope.js';
|
|
16
18
|
import { useRevealVersion } from '../../hooks/useRevealVersion.js';
|
|
17
19
|
import { primaryComboString } from '../../utils/keymap.js';
|
|
18
20
|
import { agentMessageStateColor, agentMessageStateText } from './TranscriptLeaves.js';
|
|
@@ -186,16 +188,57 @@ export function toolNameColor(raw, category) {
|
|
|
186
188
|
return 'toolNameExec';
|
|
187
189
|
return 'accent';
|
|
188
190
|
}
|
|
189
|
-
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
191
|
+
/** Context lines a unified diff keeps around each change block (git's
|
|
192
|
+
* default). The card locates a change instead of replaying the whole file
|
|
193
|
+
* (issue #1777). */
|
|
194
|
+
const DIFF_CONTEXT_LINES = 3;
|
|
195
|
+
/** Budget for the structured re-diff. A whole-file before/after image (the
|
|
196
|
+
* Claude backend) can be arbitrarily large, and jsdiff's Myers pass runs
|
|
197
|
+
* synchronously during render — a full rewrite of a big file took seconds.
|
|
198
|
+
* Past this budget jsdiff aborts (returns undefined) and the card falls back
|
|
199
|
+
* to the bounded whole-text listing; the ordinary line caps bound the rows
|
|
200
|
+
* either way. */
|
|
201
|
+
const DIFF_MAX_EDIT_LENGTH = 4000;
|
|
202
|
+
const DIFF_TIMEOUT_MS = 100;
|
|
203
|
+
/** `start,count` as a unified-diff range: git drops `,1` for a one-line
|
|
204
|
+
* range. */
|
|
205
|
+
function diffRange(start, count) {
|
|
206
|
+
return count === 1 ? String(start) : `${start},${count}`;
|
|
207
|
+
}
|
|
208
|
+
/** One side's range in a unified hunk header: `start,count` in file lines, or
|
|
209
|
+
* undefined when the side's file position is unknown. A zero-line side names
|
|
210
|
+
* the line BEFORE the range (git's convention), so a known start S maps to
|
|
211
|
+
* `S + hunkStart - 2` — a whole-file image at 1 keeps the `0,0` spelling.
|
|
212
|
+
* Without a start the side is a whole empty image (a new file's before-image
|
|
213
|
+
* or a deleted file's after-image), which is also `0,0`. */
|
|
214
|
+
function hunkRange(start, hunkStart, lines) {
|
|
215
|
+
if (lines === 0)
|
|
216
|
+
return start === undefined ? '0,0' : diffRange(Math.max(0, start + hunkStart - 2), 0);
|
|
217
|
+
return start === undefined ? undefined : diffRange(start + hunkStart - 1, lines);
|
|
218
|
+
}
|
|
219
|
+
/** One hunk's `@@ -a,b +c,d @@` header, or undefined when the texts' file
|
|
220
|
+
* positions are unknown. `oldStart`/`newStart` are the 1-based file lines of
|
|
221
|
+
* the diff's first text lines; only a producer that knows the texts are a
|
|
222
|
+
* whole-file image (or a known slice) may set them, so a missing offset stays
|
|
223
|
+
* unnumbered instead of guessed (#250 P2-3). */
|
|
224
|
+
function hunkHeader(hunk, oldStart, newStart) {
|
|
225
|
+
const oldRange = hunkRange(oldStart, hunk.oldStart, hunk.oldLines);
|
|
226
|
+
const newRange = hunkRange(newStart, hunk.newStart, hunk.newLines);
|
|
227
|
+
return oldRange === undefined || newRange === undefined ? undefined : `@@ -${oldRange} +${newRange} @@`;
|
|
228
|
+
}
|
|
229
|
+
/** One hunk body in git's unified layout: context lines keep their leading
|
|
230
|
+
* space, removals get `-`, additions `+`. A `\ No newline` marker carries no
|
|
231
|
+
* readable content and is dropped (the patch parser does the same). */
|
|
232
|
+
function hunkBodyLines(hunk) {
|
|
233
|
+
const out = [];
|
|
234
|
+
for (const raw of hunk.lines) {
|
|
235
|
+
if (raw.startsWith('\\'))
|
|
236
|
+
continue;
|
|
237
|
+
const marker = raw[0] ?? ' ';
|
|
238
|
+
const text = raw.slice(1);
|
|
239
|
+
out.push(marker === '-' ? del(`-${text}`) : marker === '+' ? add(`+${text}`) : plain(` ${text}`));
|
|
240
|
+
}
|
|
241
|
+
return out;
|
|
199
242
|
}
|
|
200
243
|
/** A patch file → its header and numbered hunk rows: each line carries
|
|
201
244
|
* its real line number (old for a removed line, new otherwise) in a gutter
|
|
@@ -228,10 +271,63 @@ function patchLines(diff, multiFile) {
|
|
|
228
271
|
});
|
|
229
272
|
return out;
|
|
230
273
|
}
|
|
231
|
-
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
274
|
+
/** One side's text → display lines (upstream contentLines rule: empty text
|
|
275
|
+
* is zero lines; a single trailing newline is a terminator, not a line;
|
|
276
|
+
* interior blanks survive). The hunk path gets the same rule from jsdiff;
|
|
277
|
+
* this listing is only the over-budget fallback. */
|
|
278
|
+
function sideLines(text) {
|
|
279
|
+
if (text === '')
|
|
280
|
+
return [];
|
|
281
|
+
const lines = text.split('\n');
|
|
282
|
+
if (lines[lines.length - 1] === '')
|
|
283
|
+
lines.pop();
|
|
284
|
+
return lines;
|
|
285
|
+
}
|
|
286
|
+
/** Whole-text fallback for a diff too large to hunk within the render budget:
|
|
287
|
+
* removed lines then added lines, with no hunk header (the position is not
|
|
288
|
+
* known here). The ordinary line caps bound the rows like any other body. */
|
|
289
|
+
function wholeTextDiffLines(diff) {
|
|
290
|
+
const out = [];
|
|
291
|
+
if (diff.oldText !== null)
|
|
292
|
+
for (const line of sideLines(diff.oldText))
|
|
293
|
+
out.push(del(`-${line}`));
|
|
294
|
+
for (const line of sideLines(diff.newText))
|
|
295
|
+
out.push(add(`+${line}`));
|
|
296
|
+
return out;
|
|
297
|
+
}
|
|
298
|
+
/** One old/new file diff → git-style hunks: each hunk shows its change plus
|
|
299
|
+
* {@link DIFF_CONTEXT_LINES} context lines, removed and added lines adjacent,
|
|
300
|
+
* and — when the backend told us where the texts start — the hunk header
|
|
301
|
+
* with real file line numbers. Without offsets a hunk prints no numbers and
|
|
302
|
+
* `⋯` separates the hunks instead (#250 P2-3, #1777). */
|
|
303
|
+
function oldNewDiffLines(diff) {
|
|
304
|
+
const patch = JsDiff.structuredPatch('', '', diff.oldText ?? '', diff.newText, undefined, undefined, {
|
|
305
|
+
context: DIFF_CONTEXT_LINES,
|
|
306
|
+
maxEditLength: DIFF_MAX_EDIT_LENGTH,
|
|
307
|
+
timeout: DIFF_TIMEOUT_MS,
|
|
308
|
+
});
|
|
309
|
+
// Over budget: keep the frame responsive with the bounded listing instead.
|
|
310
|
+
if (patch === undefined)
|
|
311
|
+
return wholeTextDiffLines(diff);
|
|
312
|
+
const out = [];
|
|
313
|
+
patch.hunks.forEach((hunk, index) => {
|
|
314
|
+
const header = hunkHeader(hunk, diff.oldStart, diff.newStart);
|
|
315
|
+
if (header !== undefined)
|
|
316
|
+
out.push(dim(header));
|
|
317
|
+
else if (index > 0)
|
|
318
|
+
out.push(dim('⋯'));
|
|
319
|
+
// Append row by row: a hunk can carry one row per file line, and spreading
|
|
320
|
+
// a large array into one `push` call hits the engine's argument limit.
|
|
321
|
+
for (const line of hunkBodyLines(hunk))
|
|
322
|
+
out.push(line);
|
|
323
|
+
});
|
|
324
|
+
return out;
|
|
325
|
+
}
|
|
326
|
+
/** Diff hunks → unified card rows. The header already carries the path for
|
|
327
|
+
* the common single-hunk case; with several hunks a path row separates files
|
|
328
|
+
* and `⋯` separates scattered hunks of one file (upstream DiffBlock). An
|
|
329
|
+
* old/new file diff is re-diffed into git-style hunks (#1777); a patch file
|
|
330
|
+
* (`ToolFileDiff.patch`) renders through {@link patchLines}. */
|
|
235
331
|
function diffLines(diffs) {
|
|
236
332
|
const out = [];
|
|
237
333
|
let prevPath;
|
|
@@ -248,12 +344,9 @@ function diffLines(diffs) {
|
|
|
248
344
|
out.push(dim('⋯'));
|
|
249
345
|
}
|
|
250
346
|
prevPath = diff.path;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
for (const line of sideLines(diff.newText))
|
|
256
|
-
out.push(add(`+ ${line}`));
|
|
347
|
+
// Same append-by-row rule: the over-budget fallback lists every source line.
|
|
348
|
+
for (const line of oldNewDiffLines(diff))
|
|
349
|
+
out.push(line);
|
|
257
350
|
}
|
|
258
351
|
return out;
|
|
259
352
|
}
|
|
@@ -412,7 +505,7 @@ function foldTerminalTitle(title, foldLines) {
|
|
|
412
505
|
let separators = 1;
|
|
413
506
|
for (let at = title.indexOf('\n', firstEnd + 1); at !== -1; at = title.indexOf('\n', at + 1))
|
|
414
507
|
separators++;
|
|
415
|
-
//
|
|
508
|
+
// A trailing newline is a terminator, not a line.
|
|
416
509
|
hiddenLines = separators - (title.endsWith('\n') ? 1 : 0);
|
|
417
510
|
body = title.slice(0, title.charCodeAt(firstEnd - 1) === 13 ? firstEnd - 1 : firstEnd);
|
|
418
511
|
}
|
|
@@ -527,6 +620,8 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
|
|
|
527
620
|
// forces a SyncLane render per tick, and repeated sync commits ending with
|
|
528
621
|
// streaming work pending feed React's nested-update counter (error #185).
|
|
529
622
|
useRevealVersion(revealVersion === undefined);
|
|
623
|
+
// Per-root keyspace: a recompose can render this card under a new root.
|
|
624
|
+
const revealScope = useRevealScope();
|
|
530
625
|
const isRunning = tool.status === 'running';
|
|
531
626
|
const isError = tool.status === 'error';
|
|
532
627
|
const sendMessage = sendMessageCardOf(tool);
|
|
@@ -608,6 +703,12 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
|
|
|
608
703
|
const liveMaxLines = liveOutputMaxLines(verbose, fullscreen);
|
|
609
704
|
const liveWidth = Math.max(1, columns - 4);
|
|
610
705
|
const liveView = React.useMemo(() => liveText === '' ? undefined : liveOutputView(liveText, liveDropped, liveMaxLines, liveWidth), [liveText, liveDropped, liveMaxLines, liveWidth]);
|
|
706
|
+
// Structured body (diff hunks / tool output / read content) memoized on the
|
|
707
|
+
// view identity: a running card re-renders on the 1 s elapsed tick and on
|
|
708
|
+
// every reveal step, and the unified diff layout re-diffs its old/new texts
|
|
709
|
+
// into git hunks — a Claude card carries the whole file. `lang` joins the
|
|
710
|
+
// deps for the localized rows (patch stats, search totals).
|
|
711
|
+
const viewBody = React.useMemo(() => (useSplitDiff || view === undefined ? undefined : viewLines(view)), [useSplitDiff, view, lang]);
|
|
611
712
|
let body = [];
|
|
612
713
|
if (sendMessage !== undefined) {
|
|
613
714
|
// 正文 = message 文本预览(长文走既有的三行折叠),summary 作副行;
|
|
@@ -640,8 +741,8 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
|
|
|
640
741
|
body = tool.errorText.split('\n').map((text) => ({ text, tone: 'error' }));
|
|
641
742
|
}
|
|
642
743
|
else if (!useSplitDiff) {
|
|
643
|
-
if (
|
|
644
|
-
body =
|
|
744
|
+
if (viewBody !== undefined)
|
|
745
|
+
body = viewBody;
|
|
645
746
|
if (body.length === 0 && result) {
|
|
646
747
|
body = result.trimEnd().split('\n').map(plain);
|
|
647
748
|
}
|
|
@@ -707,7 +808,7 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
|
|
|
707
808
|
// paint complete. `snapReveal` on every non-revealable render retires a
|
|
708
809
|
// cursor the moment its card stops qualifying (result arrived, user
|
|
709
810
|
// expanded) — idempotent, safe during render.
|
|
710
|
-
const revealKey = `tool:${tool.callId}
|
|
811
|
+
const revealKey = scopeRevealKey(revealScope, `tool:${tool.callId}`);
|
|
711
812
|
const revealable = smoothReveal && !isError && isRunning && view !== undefined &&
|
|
712
813
|
tool.resultView === undefined && !verbose && !isExpanded && fresh;
|
|
713
814
|
if (!revealable)
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* never be split into a lone surrogate by ←/→/⌫/Del or a paste boundary.
|
|
28
28
|
*/
|
|
29
29
|
import React from 'react';
|
|
30
|
-
import type { QuestionDraft, QuestionSelection } from '../../channel/questions.js';
|
|
30
|
+
import type { QuestionDraft, QuestionIntentView, QuestionSelection } from '../../channel/questions.js';
|
|
31
31
|
import type { ProviderModelEditor as ModelEditor } from '../../adapter/ports/channel-settings.js';
|
|
32
32
|
import { type ClipboardRead } from '../../utils/clipboard.js';
|
|
33
33
|
export type AskUserQuestionPanelProps = {
|
|
@@ -60,13 +60,10 @@ export type AskUserQuestionPanelProps = {
|
|
|
60
60
|
/** Local /provider draft editor. Ordinary model-facing asks carry none. */
|
|
61
61
|
readonly modelEditor?: ModelEditor;
|
|
62
62
|
/** Presentation intent tag (rc.6): 'plan-review' switches to the
|
|
63
|
-
* decision-card layout
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
readonly approveAlso?: readonly string[];
|
|
68
|
-
readonly decline?: string;
|
|
69
|
-
};
|
|
63
|
+
* decision-card layout, 'approval' stays on the generic questionnaire
|
|
64
|
+
* (its option labels carry the decision); an intent never changes the
|
|
65
|
+
* protocol. */
|
|
66
|
+
readonly intent?: QuestionIntentView;
|
|
70
67
|
};
|
|
71
68
|
/** 1-based position within the batch (progress header). */
|
|
72
69
|
readonly position: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskUserQuestionPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/questions/AskUserQuestionPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"AskUserQuestionPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/questions/AskUserQuestionPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACtG,OAAO,KAAK,EAAE,mBAAmB,IAAI,WAAW,EAAE,MAAM,yCAAyC,CAAA;AAOjG,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAoC5E,MAAM,MAAM,yBAAyB,GAAG;IACtC,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;YAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;QAC3F,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;QAC9B;;oEAE4D;QAC5D,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAA;QAClC;;qEAE6D;QAC7D,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;QAC5C;;;wDAGgD;QAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;QACtB;2EACmE;QACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;QACzB,2EAA2E;QAC3E,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAA;QAClC;;;wBAGgB;QAChB,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAA;KACrC,CAAA;IACD,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACzD,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAClD,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAChD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IACnD;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;IAC7D;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IAClC;;gEAE4D;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAS,EACT,qBAAqB,EACrB,SAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,UAAkB,GACnB,EAAE,yBAAyB,GAAG,KAAK,CAAC,SAAS,CAgzB7C"}
|
|
@@ -75,12 +75,15 @@ export function AskUserQuestionPanel({ question, position, total, answered, init
|
|
|
75
75
|
// Plan-mode's exit_plan_mode ask carries a presentation intent: render
|
|
76
76
|
// the plan decision card instead of the generic questionnaire. The
|
|
77
77
|
// branch precedes every hook so hook order stays stable per remount key.
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
const intent = question.intent;
|
|
79
|
+
if (intent?.kind === 'plan-review') {
|
|
80
|
+
// Spread with the narrowed intent: the decision card's contract is the
|
|
81
|
+
// plan-review variant, not the union the questionnaire accepts.
|
|
82
|
+
return _jsx(PlanReviewPanel, { question: { ...question, intent }, onAnswer: onAnswer, onCancel: onCancel, readClipboardOverride: readClipboardOverride });
|
|
80
83
|
}
|
|
81
84
|
const options = question.options ?? [];
|
|
82
85
|
const multiSelect = question.multiSelect === true;
|
|
83
|
-
const hideCustomInput = question.hideCustomInput === true && options.length > 0;
|
|
86
|
+
const hideCustomInput = intent?.kind === 'approval' || (question.hideCustomInput === true && options.length > 0);
|
|
84
87
|
const modelEditor = typeof question.modelEditor?.read === 'function'
|
|
85
88
|
&& typeof question.modelEditor.save === 'function' && typeof question.modelEditor.edited === 'function'
|
|
86
89
|
? question.modelEditor : undefined;
|
|
@@ -97,7 +100,7 @@ export function AskUserQuestionPanel({ question, position, total, answered, init
|
|
|
97
100
|
const initialSelected = initialDraft !== undefined
|
|
98
101
|
? initialDraft.selected
|
|
99
102
|
: question.defaultSelected ?? [];
|
|
100
|
-
const initialCustom = initialDraft?.custom ?? '';
|
|
103
|
+
const initialCustom = hideCustomInput ? '' : initialDraft?.custom ?? '';
|
|
101
104
|
const selectedIndices = options
|
|
102
105
|
.map((option, index) => initialSelected.includes(option.label) ? index : -1)
|
|
103
106
|
.filter(index => index >= 0);
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* never be split by ←/→/⌫/Del (same contract as the plugin InputDialog).
|
|
29
29
|
*/
|
|
30
30
|
import React from 'react';
|
|
31
|
-
import type { QuestionSelection } from '../../channel/questions.js';
|
|
31
|
+
import type { QuestionIntentView, QuestionSelection } from '../../channel/questions.js';
|
|
32
32
|
import { type ClipboardRead } from '../../utils/clipboard.js';
|
|
33
33
|
export type PlanReviewPanelProps = {
|
|
34
34
|
/** The plan-review question (intent.kind === 'plan-review'). */
|
|
@@ -40,12 +40,9 @@ export type PlanReviewPanelProps = {
|
|
|
40
40
|
readonly label: string;
|
|
41
41
|
readonly description?: string;
|
|
42
42
|
}>;
|
|
43
|
-
readonly intent?: {
|
|
43
|
+
readonly intent?: Extract<QuestionIntentView, {
|
|
44
44
|
readonly kind: 'plan-review';
|
|
45
|
-
|
|
46
|
-
readonly approveAlso?: readonly string[];
|
|
47
|
-
readonly decline?: string;
|
|
48
|
-
};
|
|
45
|
+
}>;
|
|
49
46
|
};
|
|
50
47
|
readonly onAnswer: (selection: QuestionSelection) => void;
|
|
51
48
|
/** Esc / Ctrl+C — dismissed to speak instead (ASK_CANCELLED). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanReviewPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/questions/PlanReviewPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"PlanReviewPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/questions/PlanReviewPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAIvF,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAa5E,MAAM,MAAM,oBAAoB,GAAG;IACjC,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;YAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;QAC3F,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE;YAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,CAAA;KAChF,CAAA;IACD,QAAQ,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACzD,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;IAC7B;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;CAC9D,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,qBAAqB,GACtB,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS,CA+ZxC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which Chat root owns a reveal key. The reveal tables in `smoothReveal.ts`
|
|
3
|
+
* are module-level (the transcript's memo/height pipeline reads them during
|
|
4
|
+
* render), so a second Chat root in the same process — a plugin recompose or
|
|
5
|
+
* a remount builds a fresh tree with its own row ids — would otherwise share
|
|
6
|
+
* them: a rebind in one root wiped the other's completed keys and
|
|
7
|
+
* re-typewrote its history.
|
|
8
|
+
*
|
|
9
|
+
* `undefined` is the shared scope: scripts and tests that mount a transcript
|
|
10
|
+
* without a Chat provider keep the single-root behaviour and bare keys.
|
|
11
|
+
*/
|
|
12
|
+
export declare const RevealScopeContext: import("react").Context<string | undefined>;
|
|
13
|
+
/** The calling component's Chat root scope (`undefined` outside a provider). */
|
|
14
|
+
export declare function useRevealScope(): string | undefined;
|
|
15
|
+
//# sourceMappingURL=revealScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revealScope.d.ts","sourceRoot":"","sources":["../../../src/components/revealScope.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,6CAA+C,CAAA;AAE9E,gFAAgF;AAChF,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Which Chat root owns a reveal key. The reveal tables in `smoothReveal.ts`
|
|
4
|
+
* are module-level (the transcript's memo/height pipeline reads them during
|
|
5
|
+
* render), so a second Chat root in the same process — a plugin recompose or
|
|
6
|
+
* a remount builds a fresh tree with its own row ids — would otherwise share
|
|
7
|
+
* them: a rebind in one root wiped the other's completed keys and
|
|
8
|
+
* re-typewrote its history.
|
|
9
|
+
*
|
|
10
|
+
* `undefined` is the shared scope: scripts and tests that mount a transcript
|
|
11
|
+
* without a Chat provider keep the single-root behaviour and bare keys.
|
|
12
|
+
*/
|
|
13
|
+
export const RevealScopeContext = createContext(undefined);
|
|
14
|
+
/** The calling component's Chat root scope (`undefined` outside a provider). */
|
|
15
|
+
export function useRevealScope() {
|
|
16
|
+
return useContext(RevealScopeContext);
|
|
17
|
+
}
|
|
@@ -44,7 +44,34 @@ type BtwKeyFlags = SidePanelKeyFlags & {
|
|
|
44
44
|
* 语义,吃掉即可,免得漏给主聊天去滚 transcript。
|
|
45
45
|
*/
|
|
46
46
|
export declare function btwComposerKey(state: BtwComposerState, input: string, key: BtwKeyFlags): BtwComposerKeyResult | null;
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* 单行 composer 的可见窗口:草稿永远只有一行,围绕 caret 开窗。
|
|
49
|
+
* `head + at + tail` 的显示宽度 ≤ budget(`at` 自身比预算还宽时以它为准),
|
|
50
|
+
* 被裁的一侧各用一个 `…` 标出来,每个 `…` 另占 1 列。
|
|
51
|
+
*/
|
|
52
|
+
export interface BtwComposerWindow {
|
|
53
|
+
/** caret 之前可见的文字。 */
|
|
54
|
+
readonly head: string;
|
|
55
|
+
/** caret 处的可见单元;caret 在末尾时是虚拟空格(IME 锚点恒为真实 cell)。 */
|
|
56
|
+
readonly at: string;
|
|
57
|
+
/** caret 之后可见的文字。 */
|
|
58
|
+
readonly tail: string;
|
|
59
|
+
/** 左侧还藏着文字,且框里腾得出 1 列画 `…`(该列已从预算里扣掉)。 */
|
|
60
|
+
readonly clippedLeft: boolean;
|
|
61
|
+
/** 右侧还藏着文字,且框里腾得出 1 列画 `…`。 */
|
|
62
|
+
readonly clippedRight: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 单行输入框的窗口(issue #1812):按显示列把草稿裁成 head + at + tail,
|
|
66
|
+
* caret 始终留在框内;两侧被裁时各补一个 `…`,让人知道那边还有字。
|
|
67
|
+
*
|
|
68
|
+
* 不能只靠 `wrap="truncate"`:截断把节点的宽度夹到可用宽度,排在它后面的
|
|
69
|
+
* `InputCaret` 必然落到框右缘之外。所以先算窗口再上屏。按字素累计列宽,
|
|
70
|
+
* CJK / 宽字符 / emoji 整格取舍,不在中间劈开;草稿由面板与全屏共享,另一个
|
|
71
|
+
* 编辑面可能把这个 caret 留在字素中间,此时吸附到后一个边界,绝不显示半个字。
|
|
72
|
+
*/
|
|
73
|
+
export declare function composerWindow(text: string, caret: number, budget: number): BtwComposerWindow;
|
|
74
|
+
export declare function BtwComposer({ state, focused, busy, notice, width, onActivate, }: {
|
|
48
75
|
readonly state: BtwComposerState;
|
|
49
76
|
/** 编辑焦点(决定边框高亮与原生光标显示)。 */
|
|
50
77
|
readonly focused: boolean;
|
|
@@ -55,6 +82,12 @@ export declare function BtwComposer({ state, focused, busy, notice, onActivate,
|
|
|
55
82
|
readonly text: string;
|
|
56
83
|
readonly failure: boolean;
|
|
57
84
|
} | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* 输入框外宽(含边框);缺省取 useTerminalSize()。分栏传面板列宽,全屏
|
|
87
|
+
* 场景传 columns - 2(根 Box 的 paddingX)——否则声明宽比实际框宽多 2 列,
|
|
88
|
+
* caret 行正好溢出(issue #1812)。
|
|
89
|
+
*/
|
|
90
|
+
readonly width?: number | undefined;
|
|
58
91
|
/** 点击输入框进入编辑(默认箭头归导航,点进来才编辑)。 */
|
|
59
92
|
readonly onActivate?: () => void;
|
|
60
93
|
}): React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BtwComposer.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwComposer.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"BtwComposer.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwComposer.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAGpD,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,8DAA8D;AAC9D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,wCAAwC;IACxC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAA;CACtB;AAED,qDAAqD;AACrD,KAAK,WAAW,GAAG,iBAAiB,GAAG;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,oBAAoB,GAAG,IAAI,CAsDpH;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,qBAAqB;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CA8E7F;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,IAAI,EACJ,MAAM,EACN,KAAK,EACL,UAAU,GACX,EAAE;IACD,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;IAChC,2BAA2B;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,6BAA6B;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;IAClF;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,iCAAiC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACjC,GAAG,KAAK,CAAC,SAAS,CAyDlB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text, InputCaret } from '../../../ui.js';
|
|
2
|
+
import { Box, Text, InputCaret, useTerminalSize } from '../../../ui.js';
|
|
3
3
|
import { t } from '../../../i18n.js';
|
|
4
4
|
import { actionMatches } from '../../../utils/keymap.js';
|
|
5
|
-
import { flattenPasteInline } from '../../../channel/sanitize.js';
|
|
5
|
+
import { flattenInline, flattenPasteInline } from '../../../channel/sanitize.js';
|
|
6
|
+
import { stringWidth } from '../../../ink/stringWidth.js';
|
|
7
|
+
import { getGraphemeSegmenter } from '../../../utils/intl.js';
|
|
6
8
|
import { nextCodePoint, previousCodePoint } from '../../AgentMessageComposer.js';
|
|
7
9
|
/**
|
|
8
10
|
* 单行 composer 的键语义。返回 null = 未消费(面板形态交宿主回退键,
|
|
@@ -69,13 +71,112 @@ export function btwComposerKey(state, input, key) {
|
|
|
69
71
|
if (key.end === true)
|
|
70
72
|
return { state: { ...state, caret: state.text.length } };
|
|
71
73
|
if (input !== '' && key.ctrl !== true && key.meta !== true) {
|
|
72
|
-
|
|
74
|
+
// 整块文本不一定带 isPasted:忽略 bracketed paste 的终端会把换行原样
|
|
75
|
+
// 送进这里,而单行窗口的 Text 会按 LF 折出第二行(被 overflow 裁掉、
|
|
76
|
+
// caret 与可见文本脱节)。等长压平后再插,caret 偏移保持不变。
|
|
77
|
+
const typed = flattenInline(input);
|
|
78
|
+
return { state: { text: state.text.slice(0, caret) + typed + state.text.slice(caret), caret: caret + typed.length } };
|
|
73
79
|
}
|
|
74
80
|
return null;
|
|
75
81
|
}
|
|
76
|
-
|
|
82
|
+
/**
|
|
83
|
+
* 单行输入框的窗口(issue #1812):按显示列把草稿裁成 head + at + tail,
|
|
84
|
+
* caret 始终留在框内;两侧被裁时各补一个 `…`,让人知道那边还有字。
|
|
85
|
+
*
|
|
86
|
+
* 不能只靠 `wrap="truncate"`:截断把节点的宽度夹到可用宽度,排在它后面的
|
|
87
|
+
* `InputCaret` 必然落到框右缘之外。所以先算窗口再上屏。按字素累计列宽,
|
|
88
|
+
* CJK / 宽字符 / emoji 整格取舍,不在中间劈开;草稿由面板与全屏共享,另一个
|
|
89
|
+
* 编辑面可能把这个 caret 留在字素中间,此时吸附到后一个边界,绝不显示半个字。
|
|
90
|
+
*/
|
|
91
|
+
export function composerWindow(text, caret, budget) {
|
|
92
|
+
const width = Math.max(1, budget);
|
|
93
|
+
const cells = [];
|
|
94
|
+
const starts = [];
|
|
95
|
+
for (const { segment, index } of getGraphemeSegmenter().segment(text)) {
|
|
96
|
+
cells.push(segment);
|
|
97
|
+
starts.push(index);
|
|
98
|
+
}
|
|
99
|
+
const clamped = Math.max(0, Math.min(caret, text.length));
|
|
100
|
+
// caret 之前的完整字素个数:caret 正好落在边界上取它;落在字素中间则
|
|
101
|
+
// 取后一个边界(那个字素整个留在 head 里,caret 画在它之后)。
|
|
102
|
+
let index = cells.length;
|
|
103
|
+
for (let i = 0; i < starts.length; i += 1) {
|
|
104
|
+
if (starts[i] >= clamped) {
|
|
105
|
+
index = i;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const at = cells[index] ?? ' ';
|
|
110
|
+
const atWidth = stringWidth(at);
|
|
111
|
+
// 两侧各自还需要多少列:用来决定分配,也让「某侧其实放得下」时不浪费 `…`。
|
|
112
|
+
let leftNeed = 0;
|
|
113
|
+
for (let i = 0; i < index; i += 1)
|
|
114
|
+
leftNeed += stringWidth(cells[i]);
|
|
115
|
+
let rightNeed = 0;
|
|
116
|
+
for (let i = index + 1; i < cells.length; i += 1)
|
|
117
|
+
rightNeed += stringWidth(cells[i]);
|
|
118
|
+
const fitsAll = leftNeed + rightNeed <= width - atWidth;
|
|
119
|
+
/** 按给定预留列数做一次分配:两侧都超框时 caret 居中。 */
|
|
120
|
+
const allocate = (reserveLeft, reserveRight) => {
|
|
121
|
+
const content = Math.max(0, width - atWidth - reserveLeft - reserveRight);
|
|
122
|
+
// 两侧都有字时分一半(零头给左侧),否则整行给有字的那一侧。
|
|
123
|
+
let headLimit = leftNeed > 0 && rightNeed > 0 ? Math.ceil(content / 2) : content;
|
|
124
|
+
headLimit = Math.min(headLimit, leftNeed);
|
|
125
|
+
// 右侧用不完自己的份额:余量还给左侧(最多到它需要的量)。
|
|
126
|
+
if (rightNeed < content - headLimit)
|
|
127
|
+
headLimit = Math.min(leftNeed, content - rightNeed);
|
|
128
|
+
let head = index;
|
|
129
|
+
let headWidth = 0;
|
|
130
|
+
while (head > 0) {
|
|
131
|
+
const cellWidth = stringWidth(cells[head - 1]);
|
|
132
|
+
if (headWidth + cellWidth > headLimit)
|
|
133
|
+
break;
|
|
134
|
+
headWidth += cellWidth;
|
|
135
|
+
head -= 1;
|
|
136
|
+
}
|
|
137
|
+
const tailLimit = content - headWidth;
|
|
138
|
+
let tail = index + 1;
|
|
139
|
+
let tailWidth = 0;
|
|
140
|
+
while (tail < cells.length) {
|
|
141
|
+
const cellWidth = stringWidth(cells[tail]);
|
|
142
|
+
if (tailWidth + cellWidth > tailLimit)
|
|
143
|
+
break;
|
|
144
|
+
tailWidth += cellWidth;
|
|
145
|
+
tail += 1;
|
|
146
|
+
}
|
|
147
|
+
return { head, tail, headWidth, tailWidth };
|
|
148
|
+
};
|
|
149
|
+
// 两侧各留 1 列给 `…`,再按实际裁没裁掉把多余的预留收回来。预算连两个
|
|
150
|
+
// `…` 都不够时(极窄档)干脆不画:指示符不能把 caret 挤出框。
|
|
151
|
+
const room = Math.max(0, width - atWidth);
|
|
152
|
+
let reserveLeft = !fitsAll && index > 0 ? 1 : 0;
|
|
153
|
+
let reserveRight = !fitsAll && rightNeed > 0 ? 1 : 0;
|
|
154
|
+
if (reserveLeft + reserveRight > room) {
|
|
155
|
+
reserveLeft = 0;
|
|
156
|
+
reserveRight = 0;
|
|
157
|
+
}
|
|
158
|
+
let layout = allocate(reserveLeft, reserveRight);
|
|
159
|
+
// 收预留只会多出内容,不会让另一侧变得更紧,所以各检查一次就稳定。
|
|
160
|
+
if (layout.head === 0 && reserveLeft > 0) {
|
|
161
|
+
reserveLeft = 0;
|
|
162
|
+
layout = allocate(reserveLeft, reserveRight);
|
|
163
|
+
}
|
|
164
|
+
if (layout.tail === cells.length && reserveRight > 0) {
|
|
165
|
+
reserveRight = 0;
|
|
166
|
+
layout = allocate(reserveLeft, reserveRight);
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
head: cells.slice(layout.head, index).join(''),
|
|
170
|
+
at,
|
|
171
|
+
tail: cells.slice(index + 1, layout.tail).join(''),
|
|
172
|
+
clippedLeft: reserveLeft === 1,
|
|
173
|
+
clippedRight: reserveRight === 1,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export function BtwComposer({ state, focused, busy, notice, width, onActivate, }) {
|
|
177
|
+
const { columns } = useTerminalSize();
|
|
77
178
|
const { text, caret } = state;
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
return (_jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [_jsx(Box, { width: "100%", flexShrink: 0, borderStyle: "round", borderColor: focused ? 'accent' : undefined, onClick: onActivate === undefined ? undefined : () => onActivate(), children: _jsxs(Box, { flexDirection: "row", flexShrink: 0, paddingLeft: 1, paddingRight: 1, children: [_jsx(Text, { color: focused ? 'accent' : undefined, bold: true, children: '›' }), _jsx(Text, { children: ' ' }), focused ? (_jsxs(_Fragment, { children: [
|
|
179
|
+
// 边框 2 + 左右 padding 2 + 「› 」2 = 6 列不属于草稿。
|
|
180
|
+
const view = composerWindow(text, caret, Math.max(1, (width ?? columns) - 6));
|
|
181
|
+
return (_jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [_jsx(Box, { width: "100%", flexShrink: 0, borderStyle: "round", borderColor: focused ? 'accent' : undefined, onClick: onActivate === undefined ? undefined : () => onActivate(), children: _jsxs(Box, { flexDirection: "row", height: 1, flexShrink: 1, minWidth: 0, paddingLeft: 1, paddingRight: 1, children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { color: focused ? 'accent' : undefined, bold: true, children: '›' }) }), _jsx(Box, { flexShrink: 0, children: _jsx(Text, { children: ' ' }) }), focused ? (text === '' ? (_jsxs(_Fragment, { children: [_jsx(InputCaret, { children: ' ' }), _jsx(Box, { flexGrow: 1, flexShrink: 0, children: _jsx(Text, { children: " " }) }), _jsx(Box, { flexShrink: 1, minWidth: 0, children: _jsxs(Text, { dimColor: true, wrap: "truncate", children: [" ", t('btw-input-hint-edit')] }) })] })) : (_jsxs(Box, { flexDirection: "row", flexShrink: 1, minWidth: 0, height: 1, overflow: "hidden", children: [view.clippedLeft ? _jsx(Text, { wrap: "truncate", children: '…' }) : null, _jsx(Text, { wrap: "truncate", children: view.head }), _jsx(InputCaret, { children: view.at }), _jsx(Text, { wrap: "truncate", children: view.tail }), view.clippedRight ? _jsx(Text, { wrap: "truncate", children: '…' }) : null] }))) : (_jsx(Text, { dimColor: true, wrap: "truncate", children: text === '' ? t('btw-input-placeholder') : text }))] }) }), notice !== undefined && (_jsx(Text, { color: notice.failure ? 'error' : undefined, wrap: "truncate", children: notice.text }))] }));
|
|
81
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BtwPanelAdapter.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwPanelAdapter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,aAAa,CAAA;AAY9D,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"BtwPanelAdapter.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwPanelAdapter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,aAAa,CAAA;AAY9D,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,CAqRhG"}
|
|
@@ -285,5 +285,5 @@ export function BtwPanelAdapter({ width, height, focused, visible }) {
|
|
|
285
285
|
panelStore.setHint('btw', hintText);
|
|
286
286
|
return () => { panelStore.setHint('btw', ''); };
|
|
287
287
|
}, [hintText]);
|
|
288
|
-
return (_jsxs(Box, { flexDirection: "column", width: "100%", height: height, overflow: "hidden", children: [header, _jsx(BtwThreadView, { thread: thread, width: width, height: Math.max(3, height - (header === null ? 4 : 6)), alive: visible, selectedTurnId: listActive ? selectedId ?? undefined : undefined, onSelectTurn: selectTurn, scrollHandleRef: scrollRef }), _jsx(BtwComposer, { state: { text: thread?.draft ?? '', caret }, focused: composerFocus && focused && visible, busy: busy, notice: notice === undefined || notice === null ? undefined : notice, onActivate: activateComposer })] }));
|
|
288
|
+
return (_jsxs(Box, { flexDirection: "column", width: "100%", height: height, overflow: "hidden", children: [header, _jsx(BtwThreadView, { thread: thread, width: width, height: Math.max(3, height - (header === null ? 4 : 6)), alive: visible, selectedTurnId: listActive ? selectedId ?? undefined : undefined, onSelectTurn: selectTurn, scrollHandleRef: scrollRef }), _jsx(BtwComposer, { state: { text: thread?.draft ?? '', caret }, focused: composerFocus && focused && visible, busy: busy, notice: notice === undefined || notice === null ? undefined : notice, width: width, onActivate: activateComposer })] }));
|
|
289
289
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BtwThreadScene.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwThreadScene.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AAQtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhE,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,OAAO,EACP,WAAW,EACX,qBAAqB,GACtB,EAAE;IACD,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B,iCAAiC;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IAC/C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,SAAS,CAAA;CAC5E,GAAG,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"BtwThreadScene.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwThreadScene.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AAQtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhE,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,OAAO,EACP,WAAW,EACX,qBAAqB,GACtB,EAAE;IACD,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B,iCAAiC;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IAC/C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,SAAS,CAAA;CAC5E,GAAG,KAAK,CAAC,SAAS,CA2KlB"}
|
|
@@ -182,5 +182,5 @@ export function BtwThreadScene({ channel, onClose, onFocusChat, readClipboardOve
|
|
|
182
182
|
event.stopImmediatePropagation();
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
|
-
return (_jsxs(Box, { flexDirection: "column", width: columns, height: rows, paddingX: 1, children: [_jsxs(Box, { flexDirection: "row", width: "100%", height: 1, flexShrink: 0, children: [_jsx(Text, { color: "warning", bold: true, children: t('btw-fullscreen-title') }), _jsx(Text, { dimColor: true, wrap: "truncate", children: ' ' + t('btw-scene-hints') })] }), _jsx(BtwThreadView, { thread: thread, width: columns - 2, height: Math.max(3, rows - 4), alive: true, selectedTurnId: composerFocus ? undefined : selectedId ?? undefined, onSelectTurn: selectTurn, scrollHandleRef: scrollRef }), _jsx(BtwComposer, { state: { text: thread?.draft ?? '', caret }, focused: composerFocus, busy: busy, notice: notice === null ? undefined : notice, onActivate: activateComposer })] }));
|
|
185
|
+
return (_jsxs(Box, { flexDirection: "column", width: columns, height: rows, paddingX: 1, children: [_jsxs(Box, { flexDirection: "row", width: "100%", height: 1, flexShrink: 0, children: [_jsx(Text, { color: "warning", bold: true, children: t('btw-fullscreen-title') }), _jsx(Text, { dimColor: true, wrap: "truncate", children: ' ' + t('btw-scene-hints') })] }), _jsx(BtwThreadView, { thread: thread, width: columns - 2, height: Math.max(3, rows - 4), alive: true, selectedTurnId: composerFocus ? undefined : selectedId ?? undefined, onSelectTurn: selectTurn, scrollHandleRef: scrollRef }), _jsx(BtwComposer, { state: { text: thread?.draft ?? '', caret }, focused: composerFocus, busy: busy, notice: notice === null ? undefined : notice, width: columns - 2, onActivate: activateComposer })] }));
|
|
186
186
|
}
|