@deepseek-harness-tui/dsh-tui 0.17.0 → 0.19.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 +43 -16
- package/bin/dsh-tui.js +46 -3
- package/cli/adapters/dsh/index.mjs +2 -2
- package/guide/dsh-tui-guide/cli.en.md +1 -1
- package/guide/dsh-tui-guide/cli.md +1 -1
- 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 +8 -2
- package/guide/dsh-tui-guide/configuration.md +8 -2
- package/guide/dsh-tui-guide/getting-started.en.md +174 -6
- package/guide/dsh-tui-guide/getting-started.md +125 -15
- package/guide/dsh-tui-guide/interaction.en.md +30 -8
- package/guide/dsh-tui-guide/interaction.md +18 -5
- package/guide/dsh-tui-guide/plugins.en.md +28 -7
- package/guide/dsh-tui-guide/plugins.md +18 -5
- package/guide/dsh-tui-guide/user-guide.en.md +32 -17
- package/guide/dsh-tui-guide/user-guide.md +23 -12
- package/lib/settings.json +3 -3
- package/lib/types/adapter/channel/ui-policy.d.ts +1 -0
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +1 -0
- package/lib/types/adapter/ports/channel-ui.d.ts +10 -2
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +31 -5
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/standard/grants.d.ts +60 -0
- package/lib/types/adapter/standard/grants.d.ts.map +1 -1
- package/lib/types/adapter/standard/grants.js +74 -0
- package/lib/types/agent/events.d.ts +16 -3
- 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/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/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +78 -10
- package/lib/types/channel/questions.d.ts +19 -3
- package/lib/types/channel/questions.d.ts.map +1 -1
- 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/GoalTodoPanel.d.ts +71 -6
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
- package/lib/types/components/GoalTodoPanel.js +165 -17
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +14 -9
- package/lib/types/components/PluginGrantList.d.ts +45 -0
- package/lib/types/components/PluginGrantList.d.ts.map +1 -0
- package/lib/types/components/PluginGrantList.js +126 -0
- package/lib/types/components/PluginInstallPane.d.ts.map +1 -1
- package/lib/types/components/PluginInstallPane.js +35 -6
- package/lib/types/components/PluginManagePane.d.ts.map +1 -1
- package/lib/types/components/PluginManagePane.js +65 -8
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +63 -8
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +17 -1
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +12 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +16 -7
- package/lib/types/components/onboardingModel.d.ts +2 -2
- package/lib/types/components/onboardingModel.js +3 -3
- package/lib/types/components/onboardingProviderPlan.d.ts +110 -0
- package/lib/types/components/onboardingProviderPlan.d.ts.map +1 -0
- package/lib/types/components/onboardingProviderPlan.js +78 -0
- 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 +41 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.js +123 -6
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +9 -2
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts +7 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.js +9 -2
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts +30 -0
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts.map +1 -0
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.js +94 -0
- package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
- package/lib/types/components/sidePanel/builtinPanels.js +14 -2
- package/lib/types/components/sidePanel/types.d.ts +2 -0
- package/lib/types/components/sidePanel/types.d.ts.map +1 -1
- package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/useSidePanel.js +15 -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/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/backend/session.d.ts +7 -1
- package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/session.js +74 -6
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +15 -6
- package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/agent-view-projection.js +3 -1
- 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/composer-images.d.ts +2 -0
- package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-images.js +10 -2
- package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-mentions.js +22 -7
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +3 -7
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.js +16 -6
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +6 -0
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.js +35 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +3 -7
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +6 -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 +8 -0
- package/lib/types/dsh-adapter/channel/input-actions.d.ts +4 -4
- package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-actions.js +59 -5
- 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 +21 -8
- package/lib/types/dsh-adapter/channel/mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/mentions.js +21 -7
- 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/paths.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/paths.js +11 -9
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.js +6 -1
- package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.js +3 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +10 -3
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.js +9 -3
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.js +11 -5
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +6 -3
- 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/contract.d.ts +27 -3
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +47 -5
- package/lib/types/dsh-adapter/entry-slot.d.ts +6 -0
- package/lib/types/dsh-adapter/entry-slot.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +3 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.js +4 -0
- 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/grant-file.d.ts +70 -0
- package/lib/types/dsh-adapter/grant-file.d.ts.map +1 -0
- package/lib/types/dsh-adapter/grant-file.js +178 -0
- package/lib/types/dsh-adapter/host-access.d.ts +4 -0
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-access.js +114 -15
- 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 +0 -8
- package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-dsh.js +27 -6
- package/lib/types/dsh-adapter/host-entry.js +4 -0
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +8 -5
- 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/panels.d.ts +7 -1
- package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-declaration.d.ts +28 -0
- package/lib/types/dsh-adapter/plugin-declaration.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-declaration.js +43 -1
- package/lib/types/dsh-adapter/plugin-install.d.ts +28 -1
- package/lib/types/dsh-adapter/plugin-install.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-install.js +160 -13
- package/lib/types/dsh-adapter/plugin-manage.d.ts +53 -10
- package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-manage.js +240 -51
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +203 -58
- package/lib/types/dsh-adapter/plugins-info.d.ts +6 -7
- package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugins-info.js +34 -21
- package/lib/types/dsh-adapter/presets.d.ts +41 -10
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +59 -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/providerWizard.d.ts +2 -0
- package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
- package/lib/types/dsh-adapter/providerWizard.js +11 -5
- 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/row-attachment.d.ts +30 -0
- package/lib/types/dsh-adapter/row-attachment.d.ts.map +1 -0
- package/lib/types/dsh-adapter/row-attachment.js +29 -0
- package/lib/types/dsh-adapter/session-list-metadata.js +2 -2
- package/lib/types/dsh-adapter/subagents.d.ts +5 -0
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +22 -1
- package/lib/types/dsh-adapter/team-mode.d.ts +17 -10
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +19 -12
- 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/dsh-adapter/worktree-tool.d.ts +27 -0
- package/lib/types/dsh-adapter/worktree-tool.d.ts.map +1 -0
- package/lib/types/dsh-adapter/worktree-tool.js +87 -0
- package/lib/types/heldInputs.d.ts +75 -0
- package/lib/types/heldInputs.d.ts.map +1 -0
- package/lib/types/heldInputs.js +409 -0
- package/lib/types/i18n.d.ts +577 -34
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +230 -22
- 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/events/input-event.d.ts.map +1 -1
- package/lib/types/ink/events/input-event.js +7 -6
- 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/ink.d.ts +1 -0
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +5 -2
- 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.d.ts +13 -2
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +29 -5
- package/lib/types/onboardingDraft.d.ts +143 -0
- package/lib/types/onboardingDraft.d.ts.map +1 -0
- package/lib/types/onboardingDraft.js +71 -0
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +133 -32
- package/lib/types/screens/Onboarding.d.ts +22 -3
- package/lib/types/screens/Onboarding.d.ts.map +1 -1
- package/lib/types/screens/Onboarding.js +606 -36
- 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.js +2 -2
- 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/paths.d.ts +15 -0
- package/lib/types/utils/paths.d.ts.map +1 -1
- package/lib/types/utils/paths.js +25 -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 -108
- package/tui-profile/feed/README.md +1 -1
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import wrapText from '../ink/wrap-text.js';
|
|
4
|
+
import { stringWidth } from '../ink/stringWidth.js';
|
|
5
|
+
import { t } from '../i18n.js';
|
|
6
|
+
import { Box, Text, useTerminalSize } from '../ui.js';
|
|
7
|
+
import { cleanRenderText } from '../channel/sanitize.js';
|
|
8
|
+
import { useOverlayListRows } from './OverlayAbove.js';
|
|
9
|
+
/** Rows a confirmation pane shows before folding the rest into one line. */
|
|
10
|
+
const GRANT_LIST_MAX_ROWS = 12;
|
|
11
|
+
/** Per-cell cap: a permission name and a scope are foreign text like any other. */
|
|
12
|
+
const GRANT_CELLS = 48;
|
|
13
|
+
/** Both panes render this list inside `Pane`, which pads two cells on each side. */
|
|
14
|
+
const PANE_PADDING_CELLS = 4;
|
|
15
|
+
/** What one row spends besides its two cells: ` `, ` @ ` and ` `. */
|
|
16
|
+
const ROW_SEPARATOR_CELLS = 7;
|
|
17
|
+
/** Narrower cells than this stop being useful; the row may then lose its tail. */
|
|
18
|
+
const MIN_CELLS = 4;
|
|
19
|
+
/** Unknown names named on the folded line before it becomes a list of its own. */
|
|
20
|
+
const UNKNOWN_NAMES_SHOWN = 3;
|
|
21
|
+
/** The list's own chrome above the heading; the heading itself is measured. */
|
|
22
|
+
const LIST_TOP_MARGIN_ROWS = 1;
|
|
23
|
+
/** Chat wraps every picker pane in one row's margin inside the overlay. */
|
|
24
|
+
const OVERLAY_PANE_MARGIN_ROWS = 1;
|
|
25
|
+
/**
|
|
26
|
+
* Rows one localized line occupies inside a `Pane` at the current width.
|
|
27
|
+
*
|
|
28
|
+
* A pane that hands the permission list its frame has to know how tall that
|
|
29
|
+
* frame really is: the trust and notice copy wraps differently at 50 and 80
|
|
30
|
+
* columns, so a fixed row count either folds rows that would have fit or lets
|
|
31
|
+
* the list push the pane title off the overlay. This measures with the
|
|
32
|
+
* renderer's own wrap function (the one `Text` uses) at the pane's content
|
|
33
|
+
* width, so the count matches what is drawn.
|
|
34
|
+
*/
|
|
35
|
+
export function usePaneTextRows() {
|
|
36
|
+
const { columns } = useTerminalSize();
|
|
37
|
+
return React.useCallback((text) => wrapText(text, Math.max(1, columns - PANE_PADDING_CELLS), 'wrap').split('\n').length, [columns]);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The permissions one lifecycle action is about, as the confirmation pane shows
|
|
41
|
+
* them (grant lifecycle plan §8).
|
|
42
|
+
*
|
|
43
|
+
* Both the install confirmation and the lifecycle confirmation read the same
|
|
44
|
+
* list, so they cannot describe the same declaration differently. Ordering is
|
|
45
|
+
* deliberate: default-deny (the interception-class) permissions lead — the risk
|
|
46
|
+
* a person is least likely to expect is what they see first — and inside that
|
|
47
|
+
* block the ones not granted yet come first. Granted entries sink within their
|
|
48
|
+
* own group, never across it, so a hand-edited grant on a default-deny row
|
|
49
|
+
* keeps its place in the leading block instead of disappearing under the
|
|
50
|
+
* default-allow rows.
|
|
51
|
+
*
|
|
52
|
+
* Height is the overlay's, not the terminal's: the pane sits in `OverlayAbove`,
|
|
53
|
+
* which reserves a strip above the prompt and clips whole rows from the top.
|
|
54
|
+
* The list therefore folds to whatever its pane's frame leaves — fewer rows plus
|
|
55
|
+
* `and N more…` — instead of pushing the package identity, the trust notice or
|
|
56
|
+
* the key hint off a short terminal.
|
|
57
|
+
*
|
|
58
|
+
* Presentational only; the state lives in the flows.
|
|
59
|
+
*/
|
|
60
|
+
export function PluginGrantList({ plan, mode, frameRows }) {
|
|
61
|
+
// Hooks run before the "nothing to show" return: the pane may re-render this
|
|
62
|
+
// list with another plan, and the hook order must not depend on it.
|
|
63
|
+
const { columns } = useTerminalSize();
|
|
64
|
+
const textRows = usePaneTextRows();
|
|
65
|
+
const overlayRows = useOverlayListRows(0);
|
|
66
|
+
// Nothing to show (a package that declares no permissions): the pane keeps its
|
|
67
|
+
// own layout rather than printing an empty heading.
|
|
68
|
+
if (plan.entries.length === 0 && plan.unknown.length === 0)
|
|
69
|
+
return null;
|
|
70
|
+
// One row per permission. Besides the two foreign cells a row spends ` `,
|
|
71
|
+
// ` @ `, the gap before the status and the localized status itself; `Pane`
|
|
72
|
+
// adds two cells of padding on each side that `useTerminalSize()` does not
|
|
73
|
+
// subtract. Measure the status instead of assuming it: the English labels are
|
|
74
|
+
// wider than the Chinese ones. `wrap="truncate"` is the backstop for terminals
|
|
75
|
+
// narrower than `MIN_CELLS`: an over-long row loses its tail instead of
|
|
76
|
+
// growing a second line and pushing the key hint off the screen.
|
|
77
|
+
// A reduce, not `Math.max(...map)`: the declaration is untrusted input and a
|
|
78
|
+
// manifest can carry more permissions than the argument limit allows.
|
|
79
|
+
const statusCells = plan.entries.reduce((widest, entry) => Math.max(widest, stringWidth(statusOf(entry))), 0);
|
|
80
|
+
const cells = Math.max(MIN_CELLS, Math.min(GRANT_CELLS, Math.floor((columns - PANE_PADDING_CELLS - ROW_SEPARATOR_CELLS - statusCells) / 2)));
|
|
81
|
+
const clean = (value) => cleanRenderText(value, cells);
|
|
82
|
+
const entries = [...plan.entries].sort(compareEntries);
|
|
83
|
+
const title = t(mode === 'grant' ? 'plugins-grant-list-title' : 'plugins-grant-list-title-revoke');
|
|
84
|
+
const unknown = plan.unknown.length === 0
|
|
85
|
+
? undefined
|
|
86
|
+
: ` ${t('plugins-grant-unknown-line', {
|
|
87
|
+
count: String(plan.unknown.length),
|
|
88
|
+
names: `${plan.unknown.slice(0, UNKNOWN_NAMES_SHOWN).map(clean).join(', ')}${plan.unknown.length > UNKNOWN_NAMES_SHOWN ? '…' : ''}`,
|
|
89
|
+
})}`;
|
|
90
|
+
// Rows left for entry rows and the folded-count line. `overlayRows` is the
|
|
91
|
+
// overlay's own budget (`rows - 8` outside one, the same reserve the pickers
|
|
92
|
+
// assume); the frame is what the pane already spends, and the chrome is this
|
|
93
|
+
// list's gap, heading and unknown line.
|
|
94
|
+
const available = overlayRows - frameRows - OVERLAY_PANE_MARGIN_ROWS - LIST_TOP_MARGIN_ROWS
|
|
95
|
+
- textRows(title) - (unknown === undefined ? 0 : textRows(unknown));
|
|
96
|
+
// A frame that already fills the overlay leaves nothing to fold into: drawing
|
|
97
|
+
// a heading and no rows would only cost the rows above it.
|
|
98
|
+
if (entries.length === 0 && available < 0)
|
|
99
|
+
return null;
|
|
100
|
+
if (entries.length > 0 && available < 1)
|
|
101
|
+
return null;
|
|
102
|
+
const cap = Math.min(GRANT_LIST_MAX_ROWS, Math.max(0, available));
|
|
103
|
+
const needsFold = entries.length > cap;
|
|
104
|
+
const shownCount = needsFold ? Math.min(cap, Math.max(0, available - 1)) : entries.length;
|
|
105
|
+
const shown = entries.slice(0, shownCount);
|
|
106
|
+
const hidden = entries.length - shown.length;
|
|
107
|
+
return (_jsxs(Box, { marginTop: LIST_TOP_MARGIN_ROWS, flexDirection: "column", children: [_jsx(Text, { children: title }), shown.length === 0
|
|
108
|
+
// Not one row fits. Keep a count under the heading (the key hint repeats
|
|
109
|
+
// it) instead of drawing a heading with nothing beneath it.
|
|
110
|
+
? hidden > 0 && _jsx(Text, { dimColor: true, wrap: "truncate", children: ` ${t('plugins-grant-hidden', { count: String(hidden) })}` })
|
|
111
|
+
: shown.map(entry => (_jsx(Text, { dimColor: entry.granted, wrap: "truncate", children: ` ${clean(entry.name)} @ ${clean(entry.scope)} ${statusOf(entry)}` }, `${entry.name}\u0000${entry.scope}`))), shown.length > 0 && hidden > 0 && _jsx(Text, { dimColor: true, children: ` ${t('plugins-grant-more', { count: String(hidden) })}` }), unknown !== undefined && _jsx(Text, { dimColor: true, children: unknown })] }));
|
|
112
|
+
}
|
|
113
|
+
/** What one row says about itself: its registry default and whether it is granted. */
|
|
114
|
+
function statusOf(entry) {
|
|
115
|
+
const granted = t(entry.granted ? 'plugins-grant-granted' : 'plugins-grant-not-granted');
|
|
116
|
+
const fallback = t(entry.default === 'allow' ? 'plugins-grant-default-allow' : 'plugins-grant-default-deny');
|
|
117
|
+
return `${fallback} ${granted}`;
|
|
118
|
+
}
|
|
119
|
+
/** Default-deny before default-allow, then not-yet-granted before granted. */
|
|
120
|
+
function compareEntries(left, right) {
|
|
121
|
+
if (left.default !== right.default)
|
|
122
|
+
return left.default === 'deny' ? -1 : 1;
|
|
123
|
+
if (left.granted !== right.granted)
|
|
124
|
+
return left.granted ? 1 : -1;
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginInstallPane.d.ts","sourceRoot":"","sources":["../../../src/components/PluginInstallPane.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,iBAAiB,EAAqB,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"PluginInstallPane.d.ts","sourceRoot":"","sources":["../../../src/components/PluginInstallPane.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,iBAAiB,EAAqB,MAAM,kCAAkC,CAAA;AAsB5F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAAC,SAAS,CAqH7G"}
|
|
@@ -5,6 +5,7 @@ import { cleanRenderText, NOTICE_CELLS } from '../channel/sanitize.js';
|
|
|
5
5
|
import { HintLine } from './design-system/HintLine.js';
|
|
6
6
|
import { LoadingState } from './design-system/LoadingState.js';
|
|
7
7
|
import { Pane } from './design-system/Pane.js';
|
|
8
|
+
import { PluginGrantList, usePaneTextRows } from './PluginGrantList.js';
|
|
8
9
|
/** Foreign text on its way to the screen: control sequences stripped, bounded. */
|
|
9
10
|
const clean = (value) => cleanRenderText(value, NOTICE_CELLS);
|
|
10
11
|
/**
|
|
@@ -30,19 +31,47 @@ const TARGET_CELLS = 80;
|
|
|
30
31
|
* (Enter confirms / retries, Esc cancels), exactly like the SDK install wizard.
|
|
31
32
|
*/
|
|
32
33
|
export function PluginInstallPane({ step, busy }) {
|
|
34
|
+
const textRows = usePaneTextRows();
|
|
33
35
|
if (busy) {
|
|
34
36
|
return (_jsxs(Pane, { color: "permission", children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "remember", bold: true, children: t('plugins-install-pane-title') }), _jsx(Box, { marginTop: 1, children: _jsx(LoadingState, { message: t('plugins-install-installing') }) })] }), _jsx(Text, { dimColor: true, italic: true, children: _jsx(HintLine, { text: t('plugins-install-key-cancel') }) })] }));
|
|
35
37
|
}
|
|
36
38
|
if (step.kind === 'confirm') {
|
|
37
|
-
const { artifact, trust, notice } = step;
|
|
39
|
+
const { artifact, trust, notice, grants } = step;
|
|
38
40
|
const spec = artifact.name === undefined
|
|
39
41
|
? t('plugins-install-unidentified')
|
|
40
42
|
: cleanRenderText(`${artifact.name}${artifact.version === undefined ? '' : `@${artifact.version}`}`, TARGET_CELLS);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const title = t('plugins-install-pane-title');
|
|
44
|
+
const configure = t('plugins-install-configure', {
|
|
45
|
+
spec,
|
|
46
|
+
kind: artifact.kind,
|
|
47
|
+
bundle: artifact.bundle === true ? 'bundle' : artifact.bundle === false ? 'not a bundle' : 'unknown',
|
|
48
|
+
});
|
|
49
|
+
const trustText = trust.kind === 'third-party' ? t('plugins-install-trust-third-party') : undefined;
|
|
50
|
+
const noticeText = notice.kind === 'declared' ? t('plugins-install-notice-declared')
|
|
51
|
+
: notice.kind === 'undeclared' ? t('plugins-install-notice-undeclared')
|
|
52
|
+
: notice.kind === 'invalid' ? t('plugins-install-notice-invalid', { err: notice.error })
|
|
53
|
+
: notice.kind === 'unjudged' ? t('plugins-install-notice-unjudged')
|
|
54
|
+
: undefined;
|
|
55
|
+
const grantCount = grants?.entries.length ?? 0;
|
|
56
|
+
const hint = grantCount > 0
|
|
57
|
+
? t('plugins-install-key-confirm-grant', { count: String(grantCount) })
|
|
58
|
+
: t('plugins-install-key-confirm');
|
|
59
|
+
// Everything the overlay draws besides the permission rows: Pane's top line
|
|
60
|
+
// and padding, the title and its gap, the configure line, the facts gap, the
|
|
61
|
+
// trust/notice copy and the hint. Measured at this width, so the list folds
|
|
62
|
+
// itself instead of pushing them off a short terminal.
|
|
63
|
+
const frameRows = 2 + textRows(title) + 1 + textRows(configure) + 1
|
|
64
|
+
+ (trustText === undefined ? 0 : textRows(trustText))
|
|
65
|
+
+ (noticeText === undefined ? 0 : textRows(noticeText)) + textRows(hint);
|
|
66
|
+
return (_jsxs(Pane, { color: "permission", children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "remember", bold: true, children: title }) }), _jsx(Text, { children: configure }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [trustText !== undefined && _jsx(Text, { children: trustText }), noticeText !== undefined && _jsx(Text, { dimColor: notice.kind === 'declared', children: noticeText })] }), grants !== undefined && _jsx(PluginGrantList, { plan: grants, mode: "grant", frameRows: frameRows })] }), _jsx(Text, { dimColor: true, italic: true, children: _jsx(HintLine, { text: hint }) })] }));
|
|
67
|
+
}
|
|
68
|
+
if (step.kind === 'grant') {
|
|
69
|
+
const title = t('plugins-install-pane-title');
|
|
70
|
+
const ask = t('plugins-install-grant-ask', { id: clean(step.plan.id) });
|
|
71
|
+
const hint = t('plugins-install-key-grant', { count: String(step.plan.entries.length) });
|
|
72
|
+
// Pane frame, title and its gap, the question, the hint.
|
|
73
|
+
const frameRows = 2 + textRows(title) + 1 + textRows(ask) + textRows(hint);
|
|
74
|
+
return (_jsxs(Pane, { color: "permission", children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "remember", bold: true, children: title }) }), _jsx(Text, { children: ask }), _jsx(PluginGrantList, { plan: step.plan, mode: "grant", frameRows: frameRows })] }), _jsx(Text, { dimColor: true, italic: true, children: _jsx(HintLine, { text: hint }) })] }));
|
|
46
75
|
}
|
|
47
76
|
if (step.kind === 'build-blocked') {
|
|
48
77
|
return (_jsxs(Pane, { color: "permission", children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "remember", bold: true, children: t('plugins-install-pane-title') }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { children: t('plugins-install-builds-title') }), step.builds.map(build => _jsx(Text, { dimColor: true, children: ` ${clean(build)}` }, build))] })] }), _jsx(Text, { dimColor: true, italic: true, children: _jsx(HintLine, { text: t('plugins-install-key-builds') }) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginManagePane.d.ts","sourceRoot":"","sources":["../../../src/components/PluginManagePane.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"PluginManagePane.d.ts","sourceRoot":"","sources":["../../../src/components/PluginManagePane.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,iCAAiC,CAAA;AAkB3F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAAC,SAAS,CAiF3G"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { t } from '../i18n.js';
|
|
3
3
|
import { Box, Text } from '../ui.js';
|
|
4
4
|
import { cleanRenderText, NOTICE_CELLS } from '../channel/sanitize.js';
|
|
5
5
|
import { HintLine } from './design-system/HintLine.js';
|
|
6
6
|
import { LoadingState } from './design-system/LoadingState.js';
|
|
7
7
|
import { Pane } from './design-system/Pane.js';
|
|
8
|
+
import { PluginGrantList, usePaneTextRows } from './PluginGrantList.js';
|
|
8
9
|
/** Foreign text on its way to the screen: control sequences stripped, bounded. */
|
|
9
10
|
const clean = (value) => cleanRenderText(value, NOTICE_CELLS);
|
|
10
11
|
/**
|
|
@@ -30,6 +31,7 @@ const TARGET_CELLS = 80;
|
|
|
30
31
|
* and the key hints. Keys are handled in Chat (Enter answers, Esc closes).
|
|
31
32
|
*/
|
|
32
33
|
export function PluginManagePane({ step, busy }) {
|
|
34
|
+
const textRows = usePaneTextRows();
|
|
33
35
|
if (busy) {
|
|
34
36
|
// A write is in flight. Esc closes the pane and the write finishes anyway —
|
|
35
37
|
// the service has no cancellation for these three, and saying "cancelling"
|
|
@@ -37,18 +39,73 @@ export function PluginManagePane({ step, busy }) {
|
|
|
37
39
|
return (_jsxs(Pane, { color: "permission", children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "remember", bold: true, children: t('plugins-manage-pane-title') }), _jsx(Box, { marginTop: 1, children: _jsx(LoadingState, { message: t('plugins-manage-working') }) })] }), _jsx(Text, { dimColor: true, italic: true, children: _jsx(HintLine, { text: t('plugins-manage-key-busy') }) })] }));
|
|
38
40
|
}
|
|
39
41
|
if (step.kind === 'confirm') {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const title = t('plugins-manage-pane-title');
|
|
43
|
+
const configure = t('plugins-manage-configure', {
|
|
44
|
+
action: t(actionKeyOf(step.target)),
|
|
45
|
+
target: describe(step.target),
|
|
46
|
+
});
|
|
47
|
+
const facts = [];
|
|
48
|
+
if (step.question.kind === 'remove') {
|
|
49
|
+
facts.push(t('plugins-manage-remove-facts', {
|
|
50
|
+
rows: String(step.target.kind === 'bundle' ? step.target.rows : 0),
|
|
51
|
+
overrides: String(step.target.kind === 'bundle' ? step.target.overrides : 0),
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
else if (step.question.kind === 'trust') {
|
|
55
|
+
facts.push(t('plugins-manage-trust-facts'));
|
|
56
|
+
}
|
|
57
|
+
else if (step.question.kind === 'host-row') {
|
|
58
|
+
facts.push(t('plugins-manage-host-row-facts'));
|
|
59
|
+
}
|
|
60
|
+
else if (step.question.kind === 'team-active') {
|
|
61
|
+
if (step.question.members > 0) {
|
|
62
|
+
facts.push(t('plugins-manage-team-active-facts', { members: String(step.question.members) }));
|
|
63
|
+
}
|
|
64
|
+
if (step.question.unseen > 0) {
|
|
65
|
+
facts.push(t('plugins-manage-team-unseen-facts', { members: String(step.question.unseen) }));
|
|
66
|
+
}
|
|
67
|
+
facts.push(t('plugins-manage-team-active-stop'));
|
|
68
|
+
}
|
|
69
|
+
const grantFacts = step.target.action === 'remove' && step.grants !== undefined
|
|
70
|
+
? t('plugins-manage-remove-grant-facts')
|
|
71
|
+
: undefined;
|
|
72
|
+
const hint = hintTextOf(step);
|
|
73
|
+
// Everything the overlay draws besides the permission rows: Pane's top line
|
|
74
|
+
// and padding, the title and its gap, the configure line, the facts gap, the
|
|
75
|
+
// facts themselves, the removal note and the hint. Measured at this width,
|
|
76
|
+
// so the list folds instead of pushing them off a short terminal.
|
|
77
|
+
const frameRows = 2 + textRows(title) + 1 + textRows(configure) + 1
|
|
78
|
+
+ facts.reduce((rows, fact) => rows + textRows(fact), 0)
|
|
79
|
+
+ (grantFacts === undefined ? 0 : 1 + textRows(grantFacts))
|
|
80
|
+
+ textRows(hint);
|
|
81
|
+
return (_jsxs(Pane, { color: "permission", children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "remember", bold: true, children: title }) }), _jsx(Text, { children: configure }), _jsx(Box, { marginTop: 1, flexDirection: "column", children: facts.map((fact, index) => _jsx(Text, { children: fact }, index)) }), step.target.kind === 'bundle' && step.target.action === 'enable'
|
|
82
|
+
&& step.grants !== undefined
|
|
83
|
+
&& _jsx(PluginGrantList, { plan: step.grants, mode: "grant", frameRows: frameRows }), step.target.kind === 'bundle' && step.target.action === 'disable'
|
|
84
|
+
&& step.grants !== undefined
|
|
85
|
+
&& _jsx(PluginGrantList, { plan: step.grants, mode: "revoke", frameRows: frameRows }), grantFacts !== undefined
|
|
86
|
+
&& _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: grantFacts }) })] }), _jsx(Text, { dimColor: true, italic: true, children: _jsx(HintLine, { text: hint }) })] }));
|
|
47
87
|
}
|
|
48
88
|
// `done` never renders: its lines are already in the transcript, so Chat
|
|
49
89
|
// closes the pane instead of leaving an empty box behind.
|
|
50
90
|
return null;
|
|
51
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* The key hint for this question. Enabling grants the declared permissions and
|
|
94
|
+
* disabling revokes them, so the hint names both halves of the action when
|
|
95
|
+
* there is something to grant or revoke; a removal keeps the plain hint (its
|
|
96
|
+
* grant fact is a line of its own).
|
|
97
|
+
*/
|
|
98
|
+
function hintTextOf(step) {
|
|
99
|
+
const grants = step.grants;
|
|
100
|
+
if (step.target.kind === 'bundle' && grants !== undefined && grants.entries.length > 0) {
|
|
101
|
+
if (step.target.action === 'enable')
|
|
102
|
+
return t('plugins-manage-key-enable-grant', { count: String(grants.entries.length) });
|
|
103
|
+
if (step.target.action === 'disable') {
|
|
104
|
+
return t('plugins-manage-key-disable-revoke', { count: String(grants.entries.length) });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return t('plugins-manage-key-confirm');
|
|
108
|
+
}
|
|
52
109
|
/** Which verb the title asks about. */
|
|
53
110
|
function actionKeyOf(target) {
|
|
54
111
|
return target.action === 'remove'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptInput.d.ts","sourceRoot":"","sources":["../../../src/components/PromptInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AA+BzB,OAAO,KAAK,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"PromptInput.d.ts","sourceRoot":"","sources":["../../../src/components/PromptInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AA+BzB,OAAO,KAAK,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAc1E,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAgLjF;gFACgF;AAChF,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,gBAAgB,EAAE,CAWpB;AAoKD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,IAAI,OAAO,CAAA;IAClB,yFAAyF;IACzF,IAAI,IAAI,MAAM,CAAA;IACd,4EAA4E;IAC5E,aAAa,CAAC,IAAI,SAAS;QAAE,KAAK,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACtE,KAAK,IAAI,IAAI,CAAA;IACb;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B;;;;;OAKG;IACH,oBAAoB,IAAI,OAAO,CAAA;IAC/B,+EAA+E;IAC/E,aAAa,IAAI,OAAO,CAAA;IACxB,2EAA2E;IAC3E,SAAS,IAAI,OAAO,CAAA;IACpB;yEACqE;IACrE,SAAS,IAAI,OAAO,CAAA;CAAC;AAEvB;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,OAAO,CAAA;IACrE;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAC7B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,0EAA0E;IAC1E,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,IAAI,IAAI,CAAA;IACpB;;;OAGG;IACH,YAAY,CACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAClC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7B,6EAA6E;IAC7E,eAAe,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,cAAc,CAAC,IAAI,IAAI,CAAA;IACvB,kEAAkE;IAClE,eAAe,CAAC,IAAI,IAAI,CAAA;IACxB;;;OAGG;IACH,mBAAmB,CAAC,IAAI,IAAI,CAAA;IAC5B;;;;;;;;OAQG;IACH,cAAc,CAAC,IAAI,IAAI,CAAA;IACvB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,MAAM,CAAA;IACrC,0EAA0E;IAC1E,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;IACxD;;;;;;;OAOG;IACH,YAAY,CAAC,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAA;IAC7G;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,qBAAqB,CAAC,IAAI,IAAI,CAAA;IAC9B;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,eAAe,EACf,SAAiB,EACjB,aAAoB,EACpB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,4BAA4B,EAC5B,aAAa,EACb,YAAY,EACZ,gBAAwB,EACxB,qBAAqB,EACrB,GAAc,GACf,EAAE,gBAAgB,4BAuhIlB"}
|
|
@@ -1465,6 +1465,25 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
1465
1465
|
clearDeliveredDraft();
|
|
1466
1466
|
channel.notify(t('input-queued-after-turn'), { timeoutMs: 2500 });
|
|
1467
1467
|
};
|
|
1468
|
+
/**
|
|
1469
|
+
* Take a retracted row's staged contexts back into the composer. The
|
|
1470
|
+
* submission spent their chips (`consumeAttachedContexts()`), so only the
|
|
1471
|
+
* row's snapshot still has them: without this a row retracted for editing
|
|
1472
|
+
* would re-send without its panel bodies. `truncated` rides along — the
|
|
1473
|
+
* snapshot's body is already capped, and re-deriving the flag from it would
|
|
1474
|
+
* hand the model a cut body with no `[… truncated]` marker.
|
|
1475
|
+
*/
|
|
1476
|
+
const restageContexts = (contexts) => {
|
|
1477
|
+
for (const context of contexts ?? []) {
|
|
1478
|
+
channel.attachContext({
|
|
1479
|
+
source: context.source,
|
|
1480
|
+
sourceId: context.sourceId,
|
|
1481
|
+
title: context.title,
|
|
1482
|
+
content: context.content,
|
|
1483
|
+
truncated: context.truncated,
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1468
1487
|
/**
|
|
1469
1488
|
* Alt+Up: pull the last pending message back into the input for editing
|
|
1470
1489
|
* (never interrupts the running turn). Refused when the running dsh-agent
|
|
@@ -1481,6 +1500,7 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
1481
1500
|
channel.notify(t('input-cannot-retract'), { color: 'warning', timeoutMs: 2500 });
|
|
1482
1501
|
return;
|
|
1483
1502
|
}
|
|
1503
|
+
restageContexts(item.contexts);
|
|
1484
1504
|
restoreDraftImages({
|
|
1485
1505
|
text: item.text,
|
|
1486
1506
|
images: item.images ?? [],
|
|
@@ -1509,6 +1529,9 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
1509
1529
|
if (target === undefined)
|
|
1510
1530
|
return;
|
|
1511
1531
|
if (channel.removePending(target.id)) {
|
|
1532
|
+
// The text is back in the composer; its "send to Chat" contexts belong
|
|
1533
|
+
// there too, or editing and resending drops the panel bodies.
|
|
1534
|
+
restageContexts(target.contexts);
|
|
1512
1535
|
channel.notify(t('input-retracted'), { timeoutMs: 2000 });
|
|
1513
1536
|
}
|
|
1514
1537
|
else {
|
|
@@ -1574,6 +1597,7 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
1574
1597
|
// already retains every capability (nothing is discarded).
|
|
1575
1598
|
const beforeBlock = foldBlockRef.current;
|
|
1576
1599
|
updateFoldBlock(null);
|
|
1600
|
+
restageContexts(item.contexts);
|
|
1577
1601
|
setInput(item.text, item.text.length, 'step', beforeBlock);
|
|
1578
1602
|
replaceDraftImages(item.images ?? []);
|
|
1579
1603
|
setSelectedCommand(0);
|
|
@@ -1585,6 +1609,7 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
1585
1609
|
channel.notify(t('input-cannot-retract'), { color: 'warning', timeoutMs: 2500 });
|
|
1586
1610
|
return;
|
|
1587
1611
|
}
|
|
1612
|
+
restageContexts(item.contexts);
|
|
1588
1613
|
restoreDraftImages({
|
|
1589
1614
|
text: item.text,
|
|
1590
1615
|
images: item.images ?? [],
|
|
@@ -1772,6 +1797,28 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
1772
1797
|
}
|
|
1773
1798
|
return handled !== false;
|
|
1774
1799
|
};
|
|
1800
|
+
/**
|
|
1801
|
+
* Run one completion row. The screen's own (and registry) commands consume
|
|
1802
|
+
* it; a backend command (`/usage`, `/diff`) or backend skill answers through
|
|
1803
|
+
* the session, so its line goes out through the ordinary submit path.
|
|
1804
|
+
* Enter, the mouse pick and the batched-stdin line all share this: returning
|
|
1805
|
+
* on `tryRunCommand`'s false is what used to leave them dead.
|
|
1806
|
+
*/
|
|
1807
|
+
const dispatchCompletion = (line, placement = 'steer') => {
|
|
1808
|
+
if (tryRunCommand(line))
|
|
1809
|
+
return;
|
|
1810
|
+
// A backend command (Codex `/usage`, `/diff`, a backend skill) answers
|
|
1811
|
+
// through the session. Interactive entry points take the typed placement
|
|
1812
|
+
// while a turn runs; a piped whole line keeps the legacy direct submit
|
|
1813
|
+
// (nobody is watching a steer notice there).
|
|
1814
|
+
if (placement === 'steer' && channel.working) {
|
|
1815
|
+
// Same placement as a typed line; the notice is kept because the UI
|
|
1816
|
+
// cannot tell a self-answering command from a real skill here.
|
|
1817
|
+
steerSend(line);
|
|
1818
|
+
return;
|
|
1819
|
+
}
|
|
1820
|
+
submitText(line);
|
|
1821
|
+
};
|
|
1775
1822
|
/**
|
|
1776
1823
|
* The Enter main path, shared by the inline prompt, the expanded
|
|
1777
1824
|
* editor's Ctrl+Enter, and its Send button:
|
|
@@ -1803,8 +1850,8 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
1803
1850
|
// draft through the ordinary path instead of accepting a stale row.
|
|
1804
1851
|
if (overlayOpen && value === completionInput) {
|
|
1805
1852
|
const command = suggestions[selectedCommand];
|
|
1806
|
-
if (command) {
|
|
1807
|
-
|
|
1853
|
+
if (command !== undefined) {
|
|
1854
|
+
dispatchCompletion(command.commandLine);
|
|
1808
1855
|
return;
|
|
1809
1856
|
}
|
|
1810
1857
|
}
|
|
@@ -2443,7 +2490,7 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
2443
2490
|
if (line.startsWith('/')) {
|
|
2444
2491
|
const matches = channel.commandCompletions(line);
|
|
2445
2492
|
if (matches.length === 1) {
|
|
2446
|
-
|
|
2493
|
+
dispatchCompletion(matches[0].commandLine, 'submit');
|
|
2447
2494
|
return;
|
|
2448
2495
|
}
|
|
2449
2496
|
}
|
|
@@ -3869,7 +3916,7 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
3869
3916
|
.filter(item => item.placement === 'steer' && item.docked !== true)
|
|
3870
3917
|
.map(item => (_jsxs(Text, { dimColor: true, wrap: "truncate", children: [' ', "\u21B3 ", item.text] }, item.id)))] })), channel.pending.some(item => item.placement === 'followup' && item.docked !== true) && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: ["\u23F3 ", t('input-pending-queue-label')] }), channel.pending
|
|
3871
3918
|
.filter(item => item.placement === 'followup' && item.docked !== true)
|
|
3872
|
-
.map(item => (_jsxs(Text, { dimColor: true, wrap: "truncate", children: [' ', "\u21B3 ", item.text] }, item.id)))] })), dockCount > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: ["\u23F8 ", t('input-pending-dock-label')] }), dockedPending.slice(dockStart, dockEnd).map((item, index) => {
|
|
3919
|
+
.map(item => (_jsxs(Text, { dimColor: true, wrap: "truncate", children: [' ', "\u21B3 ", item.text] }, item.id)))] })), dockCount > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: ["\u23F8 ", t(dockedPending.every(item => item.orphaned === true) ? 'input-pending-orphan-label' : 'input-pending-dock-label')] }), dockedPending.slice(dockStart, dockEnd).map((item, index) => {
|
|
3873
3920
|
// The window maps to absolute dock indices: the click and
|
|
3874
3921
|
// the highlight name the same row the user sees.
|
|
3875
3922
|
const absoluteIndex = dockStart + index;
|
|
@@ -3880,7 +3927,7 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
3880
3927
|
// 点击提示行 = 全部发送(与空输入 ⏎ 同路径)
|
|
3881
3928
|
, {
|
|
3882
3929
|
// 点击提示行 = 全部发送(与空输入 ⏎ 同路径)
|
|
3883
|
-
onClick: () => { sendDocked(); }, children: _jsxs(Text, { dimColor: true, children: [' ', t(channel.working ? 'input-pending-dock-hint-working' : 'input-pending-dock-hint')] }) })] })), _jsxs(Text, { dimColor: true, children: ["Alt+\u2191 ", t('input-pending-actions-hint')] })] })), fileOverlayOpen && (_jsx(FileSuggestions, { files: fileMatches, selectedIndex: fileSelected, columns: columns, query: mention?.query ?? '', accent: promptAccent,
|
|
3930
|
+
onClick: () => { sendDocked(); }, children: _jsxs(Text, { dimColor: true, children: [' ', t(channel.status === 'disposed' ? 'input-pending-dock-hint-disposed' : channel.working ? 'input-pending-dock-hint-working' : 'input-pending-dock-hint')] }) })] })), _jsxs(Text, { dimColor: true, children: ["Alt+\u2191 ", t(channel.status === 'disposed' ? 'input-pending-actions-hint-disposed' : 'input-pending-actions-hint')] })] })), fileOverlayOpen && (_jsx(FileSuggestions, { files: fileMatches, selectedIndex: fileSelected, columns: columns, query: mention?.query ?? '', accent: promptAccent,
|
|
3884
3931
|
// 点击行 = 接受该项(与 Enter 同路径)
|
|
3885
3932
|
onPick: (index) => {
|
|
3886
3933
|
const file = fileMatches[index];
|
|
@@ -3891,11 +3938,19 @@ export function PromptInput({ channel, toastSuppressed, suspended = false, curso
|
|
|
3891
3938
|
onWheelStep: (step) => {
|
|
3892
3939
|
setFileSelected(i => Math.max(0, Math.min(fileMatches.length - 1, i + step)));
|
|
3893
3940
|
} })), overlayOpen && (_jsx(CommandSuggestions, { commands: suggestions, selectedIndex: selectedCommand, columns: columns, query: value, accent: promptAccent, holdFrom: suggestionsHoldFrom,
|
|
3894
|
-
// 点击行 =
|
|
3941
|
+
// 点击行 = 运行该命令(选中行与 Enter 共用派遣)
|
|
3895
3942
|
onPick: (index) => {
|
|
3896
3943
|
const command = suggestions[index];
|
|
3897
|
-
if (command)
|
|
3898
|
-
|
|
3944
|
+
if (command === undefined)
|
|
3945
|
+
return;
|
|
3946
|
+
// A stale row (the draft moved on while it was showing) does not
|
|
3947
|
+
// own the click: only run what the screen can dispatch, never
|
|
3948
|
+
// send the half-typed draft to the model.
|
|
3949
|
+
if (valueRef.current !== completionInput) {
|
|
3950
|
+
tryRunCommand(valueRef.current);
|
|
3951
|
+
return;
|
|
3952
|
+
}
|
|
3953
|
+
dispatchCompletion(command.commandLine);
|
|
3899
3954
|
},
|
|
3900
3955
|
// 滚轮 = 移动选中行(与 ↑/↓ 同路径,窗口跟随)
|
|
3901
3956
|
onWheelStep: (step) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubagentDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/SubagentDashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"SubagentDashboard.d.ts","sourceRoot":"","sources":["../../../src/components/SubagentDashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAOhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC9E,OAAO,KAAK,EAAY,QAAQ,EAAE,MAAM,kCAAkC,CAAA;AAK1E,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAA;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IACzC;mDAC+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC;0BACsB;IACtB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACtC;6DACyD;IACzD,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;2DACuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;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,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAOjF;AAED,yCAAyC;AACzC,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,KAAK,CAAC,SAAS,CAWhF;AAgED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,IAAI,EACJ,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,OAAmB,EACnB,OAAc,EACd,OAAc,GACf,EAAE,sBAAsB,GAAG,KAAK,CAAC,SAAS,CAoT1C"}
|
|
@@ -5,9 +5,11 @@ import { SubagentCard, teamStatusGlyph } from './SubagentCard.js';
|
|
|
5
5
|
import { t } from '../i18n.js';
|
|
6
6
|
import { Divider } from './design-system/Divider.js';
|
|
7
7
|
import { isPlainReturnInput } from '../utils/modifiers.js';
|
|
8
|
+
import { actionMatches } from '../utils/keymap.js';
|
|
8
9
|
import { usePanelInput } from './sidePanel/usePanelInput.js';
|
|
9
10
|
import { AgentMessagesSummary } from './messages/AgentMessageFlow.js';
|
|
10
11
|
import { isTeamTaskBlocked, teamDashboardModel, teamTaskProgress } from './teamRoster.js';
|
|
12
|
+
import { isDegradedChannel, summarizeChannelFailures } from '../channel/subagent-failure.js';
|
|
11
13
|
import { isMinimalUiMode } from '../minimalUiMode.js';
|
|
12
14
|
/** Accept Ink's Enter flag and the panel dispatcher's normalized alias. */
|
|
13
15
|
export function isPanelPlainReturn(input, key) {
|
|
@@ -118,6 +120,15 @@ export function SubagentDashboard({ subagents, team, sessionId, peers, onClose,
|
|
|
118
120
|
const panelKeyHandler = (input, key) => {
|
|
119
121
|
if (key.escape === true || (key.ctrl === true && input === 'c'))
|
|
120
122
|
return false;
|
|
123
|
+
// 分栏在渲染时 keymap 的 `paste` 组合(可重映射,macOS 上是 Cmd+V)先
|
|
124
|
+
// 投递给活动面板:粘贴组合本身(含重映射到方向键等命名键)不触发表面动作。
|
|
125
|
+
if (actionMatches('paste', input, key, true))
|
|
126
|
+
return false;
|
|
127
|
+
// 带修饰的字母同样不触发字母快捷键(Cmd+V 不能命中下面的 v)。方向键/Enter
|
|
128
|
+
// 保持面板自己的语义(Cmd+↑/↓ 移焦点、Cmd+Enter 选中;isPanelPlainReturn
|
|
129
|
+
// 不转发 super),不能被粘贴守卫一并吃掉。
|
|
130
|
+
if ((key.ctrl === true || key.meta === true || key.super === true) && /^[a-z]$/u.test(input.toLowerCase()))
|
|
131
|
+
return false;
|
|
121
132
|
if (key.upArrow === true) {
|
|
122
133
|
moveFocus(-1);
|
|
123
134
|
scrollRef.current?.scrollBy(-3);
|
|
@@ -146,13 +157,18 @@ export function SubagentDashboard({ subagents, team, sessionId, peers, onClose,
|
|
|
146
157
|
const running = subagents.filter(s => s.status === 'running').length;
|
|
147
158
|
const completed = subagents.filter(s => s.status === 'completed').length;
|
|
148
159
|
const failed = subagents.filter(s => s.status === 'failed').length;
|
|
160
|
+
const channelFailures = summarizeChannelFailures(subagents).filter(isDegradedChannel);
|
|
149
161
|
const memberCount = (status) => model?.teammates.filter(row => row.status === status).length ?? 0;
|
|
150
162
|
const teamSep = panelMode ? ' · ' : ' ';
|
|
151
163
|
// Full-screen keeps its inset; the panel uses one cell on each side.
|
|
152
164
|
const outer = panelMode
|
|
153
165
|
? { paddingLeft: 1, paddingRight: 1, paddingTop: 0 }
|
|
154
166
|
: { paddingX: 2, paddingY: 1 };
|
|
155
|
-
return (_jsxs(Box, { flexDirection: "column", ...outer, children: [!panelMode && _jsx(Divider, { color: "accent", title: t(team === undefined ? 'subagent-dashboard-title' : 'team-dashboard-title') }), _jsxs(Box, { flexDirection: "row", gap: 3, marginTop: panelMode ? 0 : 1, marginBottom: panelMode ? 0 : 1, children: [team !== undefined ? (_jsx(Box, { flexShrink: 1, overflow: "hidden", children: _jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: "accent", children: memberCount('running') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-running') + teamSep }), _jsx(Text, { color: "accent", children: memberCount('idle') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-idle') + teamSep }), memberCount('provisioning') > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: memberCount('provisioning') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-provisioning') + teamSep })] })), memberCount('active') > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: "accent", children: memberCount('active') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-active') + teamSep })] })), memberCount('failed') > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: "error", children: memberCount('failed') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-failed') + teamSep })] })), _jsx(Text, { dimColor: true, children: t('team-tasks-count', teamTaskProgress(team.tasks)) })] }) })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { children: [_jsx(Text, { color: "accent", children: running }), _jsxs(Text, { dimColor: true, children: [" ", t('subagent-count-running')] })] }), _jsxs(Text, { children: [_jsx(Text, { color: "success", children: completed }), _jsxs(Text, { dimColor: true, children: [" ", t('subagent-count-completed')] })] }), failed > 0 && (_jsxs(Text, { children: [_jsx(Text, { color: "error", children: failed }), _jsxs(Text, { dimColor: true, children: [" ", t('subagent-count-failed')] })] })), nested > 0 && (_jsxs(Text, { children: [_jsx(Text, { color: "accent", children: nested }), _jsxs(Text, { dimColor: true, children: [" ", t('subagent-count-nested')] })] }))] })), _jsx(Box, { flexGrow: 1 }), !panelMode && onClose !== undefined && _jsx(ExitButton, { onClick: onClose })] }), team?.failure !== undefined && (_jsx(Text, { color: "error", wrap: "wrap", children: '⚠ ' + t('team-failure', { failure: team.failure }) })),
|
|
167
|
+
return (_jsxs(Box, { flexDirection: "column", ...outer, children: [!panelMode && _jsx(Divider, { color: "accent", title: t(team === undefined ? 'subagent-dashboard-title' : 'team-dashboard-title') }), _jsxs(Box, { flexDirection: "row", gap: 3, marginTop: panelMode ? 0 : 1, marginBottom: panelMode ? 0 : 1, children: [team !== undefined ? (_jsx(Box, { flexShrink: 1, overflow: "hidden", children: _jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { color: "accent", children: memberCount('running') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-running') + teamSep }), _jsx(Text, { color: "accent", children: memberCount('idle') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-idle') + teamSep }), memberCount('provisioning') > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: memberCount('provisioning') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-provisioning') + teamSep })] })), memberCount('active') > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: "accent", children: memberCount('active') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-active') + teamSep })] })), memberCount('failed') > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { color: "error", children: memberCount('failed') }), _jsx(Text, { dimColor: true, children: ' ' + t('team-status-failed') + teamSep })] })), _jsx(Text, { dimColor: true, children: t('team-tasks-count', teamTaskProgress(team.tasks)) })] }) })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { children: [_jsx(Text, { color: "accent", children: running }), _jsxs(Text, { dimColor: true, children: [" ", t('subagent-count-running')] })] }), _jsxs(Text, { children: [_jsx(Text, { color: "success", children: completed }), _jsxs(Text, { dimColor: true, children: [" ", t('subagent-count-completed')] })] }), failed > 0 && (_jsxs(Text, { children: [_jsx(Text, { color: "error", children: failed }), _jsxs(Text, { dimColor: true, children: [" ", t('subagent-count-failed')] })] })), nested > 0 && (_jsxs(Text, { children: [_jsx(Text, { color: "accent", children: nested }), _jsxs(Text, { dimColor: true, children: [" ", t('subagent-count-nested')] })] }))] })), _jsx(Box, { flexGrow: 1 }), !panelMode && onClose !== undefined && _jsx(ExitButton, { onClick: onClose })] }), team?.failure !== undefined && (_jsx(Text, { color: "error", wrap: "wrap", children: '⚠ ' + t('team-failure', { failure: team.failure }) })), channelFailures.map(summary => (_jsx(Text, { color: "error", wrap: "wrap", children: '⚠ ' + t('subagent-channel-degraded', {
|
|
168
|
+
provider: summary.provider,
|
|
169
|
+
failed: summary.failed,
|
|
170
|
+
settled: summary.settled,
|
|
171
|
+
}) }, summary.provider))), _jsx(Box, { flexDirection: "column", maxHeight: panelMode ? Math.max(6, rows - 4) : Math.max(10, rows - 10), marginTop: panelMode ? 0 : 1, children: _jsxs(ScrollBox, { ref: scrollRef, flexDirection: "column", flexGrow: 1, children: [model !== undefined && (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: t('team-members-title') }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: ' ◆ ' + t(model.viewedFromLead ? 'team-lead-row' : 'team-lead-row-peer') })] })), model === undefined && subagents.length === 0 ? (_jsxs(Box, { flexDirection: "column", alignItems: "center", marginTop: Math.max(2, Math.floor((rows - 16) / 3)), children: [_jsx(Text, { dimColor: true, children: '○' }), _jsx(Text, { dimColor: true, children: t('subagent-none') }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: t('subagent-empty-hint') }) })] })) : (entries.map(({ key, subagent, teamRow, nested: nestedMark }, index) => (_jsxs(Box, { flexDirection: "column", children: [index === othersStart && _jsx(Text, { dimColor: true, children: t('team-others-title') }), nestedMark && (_jsx(Text, { dimColor: true, children: ' ↳ ' + t('subagent-nested-mark') })), subagent === undefined ? (teamRow !== undefined && _jsx(TeamRosterOnlyRow, { row: teamRow, focused: index === focusIndex, panelMode: panelMode, self: teamRow.member.id === sessionId })) : (_jsx(SubagentCard, { subagent: subagent, variant: panelMode ? 'panel' : 'default', focused: index === focusIndex, onClick: onSelect !== undefined
|
|
156
172
|
// Click = view detail, same as Enter on the focused card.
|
|
157
173
|
? () => onSelect(subagent.agentId)
|
|
158
174
|
: undefined, ...teamRow === undefined ? {} : { teamMember: { name: teamRow.member.name, status: teamRow.status } } })), teamRow?.status === 'failed' && teamRow.member.error !== undefined && (_jsx(Text, { color: "error", wrap: "truncate-end", children: ' │ ' + teamRow.member.error })), teamRow?.status === 'idle' && subagent?.status === 'failed' && (_jsx(Text, { color: "error", wrap: "truncate-end", children: ' │ ' + t('team-last-run-failed', { error: subagent.error ?? '' }).trimEnd() })), subagent !== undefined && messages !== undefined && messages.length > 0 && (_jsx(AgentMessagesSummary, { messages: messages.filter(message => message.from === subagent.agentId || message.to === subagent.agentId), selfAgentId: subagent.agentId })), subagent !== undefined && onOpenView !== undefined && (!panelMode || index === focusIndex) && (_jsx(Box, { paddingLeft: 1, onClick: () => onOpenView(subagent.agentId), children: _jsx(Text, { color: "subtle", children: `⤢ ${t('agent-view-open-action')}` }) })), !panelMode && index < entries.length - 1 && index + 1 !== othersStart && (_jsx(Text, { dimColor: true, children: '─'.repeat(Math.max(20, Math.min(72, columns - 6))) }))] }, key)))), team !== undefined && _jsx(TeamTaskBoard, { tasks: team.tasks })] }) }), peers !== undefined && (!panelMode || peers.length > 0) && (_jsx(Box, { flexDirection: "column", children: panelMode ? (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: t('agents-peers-title') + ' · ' + peers.length })) : (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: t('agents-peers-title') }), peers.length === 0 ? (_jsx(Text, { dimColor: true, children: ' ' + t('agents-peers-empty') })) : (_jsxs(Box, { flexDirection: "column", children: [peers.map(peer => (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: ' · ' + (peer.name ?? peer.label ?? peer.agentId.slice(0, 8)) + ' · ' + peer.agentId.slice(0, 8) }, peer.agentId))), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: ' ' + t('agents-peers-note') })] }))] })) })), !panelMode && (_jsxs(_Fragment, { children: [_jsx(Divider, { color: "subtle", title: "" }), _jsx(Box, { children: _jsx(Text, { dimColor: true, children: onSelect ? t('subagent-dashboard-hint-detail') : t('subagent-dashboard-hint-basic') }) })] }))] }));
|
|
@@ -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;
|
|
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;AA+JzC,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,CAomB5C"}
|
|
@@ -10,6 +10,7 @@ import { t } from '../i18n.js';
|
|
|
10
10
|
import { Divider } from './design-system/Divider.js';
|
|
11
11
|
import { ExitButton, isPanelPlainReturn } from './SubagentDashboard.js';
|
|
12
12
|
import { isPlainReturnInput } from '../utils/modifiers.js';
|
|
13
|
+
import { actionMatches } from '../utils/keymap.js';
|
|
13
14
|
import { toolNameColor } from './messages/AssistantToolUseMessage.js';
|
|
14
15
|
import { Markdown } from './Markdown.js';
|
|
15
16
|
import { getCliHighlightPromise } from '../terminal-utils/cliHighlight.js';
|
|
@@ -322,6 +323,12 @@ export function SubagentDetailScene({ subagent, onFailureRead, onBack, onInterru
|
|
|
322
323
|
// 的 Esc 回退是「焦点回聊天」)。其余未认的键返回 false,让 [/]、数字、
|
|
323
324
|
// z、+/- 继续可用。
|
|
324
325
|
const panelKeyHandler = (input, key) => {
|
|
326
|
+
// 分栏在渲染时 keymap 的 `paste` 组合(可重映射,macOS 上是 Cmd+V)先
|
|
327
|
+
// 投递给活动面板:粘贴组合本身(含重映射到方向键等命名键)不触发表面动作。
|
|
328
|
+
// 必须排在 composer 转发之前:否则重映射到 ctrl+backspace / ctrl+← 的
|
|
329
|
+
// 粘贴键会在子代理 composer 里删字/移光标(Cmd+V 还会插入字面 v)。
|
|
330
|
+
if (actionMatches('paste', input, key, true))
|
|
331
|
+
return false;
|
|
325
332
|
// composer 聚焦时键先给编辑器(含 Esc);↑/↓ 仍滚动正文。
|
|
326
333
|
if (compose !== undefined && composerFocused) {
|
|
327
334
|
if (key.upArrow === true || key.downArrow === true) {
|
|
@@ -334,6 +341,11 @@ export function SubagentDetailScene({ subagent, onFailureRead, onBack, onInterru
|
|
|
334
341
|
onBack();
|
|
335
342
|
return true;
|
|
336
343
|
}
|
|
344
|
+
// 带修饰的字母同样不触发字母快捷键(Cmd+V 不能命中下面的 v)。方向键/Enter
|
|
345
|
+
// 保持面板自己的语义(Cmd+←/→ 翻页、Cmd+Enter 折叠/返回;isPanelPlainReturn
|
|
346
|
+
// 不转发 super),不能被粘贴守卫一并吃掉。
|
|
347
|
+
if ((key.ctrl === true || key.meta === true || key.super === true) && /^[a-z]$/u.test(input.toLowerCase()))
|
|
348
|
+
return false;
|
|
337
349
|
if (key.leftArrow === true) {
|
|
338
350
|
turnPage(-1);
|
|
339
351
|
return true;
|
|
@@ -11,7 +11,8 @@ type Props = {
|
|
|
11
11
|
verbose: boolean;
|
|
12
12
|
/** Message-selection mode highlight. */
|
|
13
13
|
isSelected?: boolean;
|
|
14
|
-
/** Row expanded on its own (
|
|
14
|
+
/** Row expanded on its own (click / Enter); the card keeps the background
|
|
15
|
+
* configured for tool cards. */
|
|
15
16
|
isExpanded?: boolean;
|
|
16
17
|
/**
|
|
17
18
|
* Mouse click (fullscreen): toggles the row's expansion — same action as
|