@deepseek-harness-tui/dsh-tui 0.16.1 → 0.18.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 +213 -34
- package/assets/plugin-icon.svg +13 -0
- package/assets/windows-installer.cs +308 -0
- package/assets/windows-installer.ps1 +17 -0
- package/bin/dsh-tui.js +64 -5
- package/cli/adapters/dsh/index.mjs +111 -0
- package/cli/adapters/dsh/locate.mjs +73 -0
- package/cli/adapters/dsh/management-plugin.mjs +111 -0
- package/cli/args.mjs +154 -0
- package/cli/contracts.d.ts +48 -0
- package/cli/engine.mjs +92 -0
- package/cli/entry.mjs +48 -0
- package/cli/process.mjs +118 -0
- package/cli/protocol.mjs +23 -0
- package/cli/schema-v1.json +33 -0
- package/cordis.patch.yml +3 -1
- package/cordis.yml +3 -1
- package/guide/dsh-tui-guide/SKILL.md +1 -0
- package/guide/dsh-tui-guide/cli.en.md +114 -0
- package/guide/dsh-tui-guide/cli.md +114 -0
- package/guide/dsh-tui-guide/configuration.en.md +7 -5
- package/guide/dsh-tui-guide/configuration.md +7 -5
- package/guide/dsh-tui-guide/getting-started.en.md +33 -3
- package/guide/dsh-tui-guide/getting-started.md +23 -2
- package/guide/dsh-tui-guide/interaction.en.md +50 -17
- package/guide/dsh-tui-guide/interaction.md +35 -13
- package/guide/dsh-tui-guide/plugins.en.md +63 -11
- package/guide/dsh-tui-guide/plugins.md +41 -7
- package/guide/dsh-tui-guide/user-guide.en.md +55 -34
- package/guide/dsh-tui-guide/user-guide.md +45 -28
- package/lib/settings.json +85 -42
- package/lib/types/adapter/channel/plugins.d.ts.map +1 -1
- package/lib/types/adapter/channel/plugins.js +8 -0
- package/lib/types/adapter/channel/ui-policy.d.ts +2 -1
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +4 -0
- package/lib/types/adapter/ports/channel-display.d.ts +10 -0
- package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-session.d.ts +2 -0
- package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-settings.d.ts +20 -0
- package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-ui.d.ts +22 -2
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +11 -1
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel.d.ts +7 -0
- package/lib/types/adapter/ports/channel.d.ts.map +1 -1
- package/lib/types/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/capabilities.d.ts +2 -0
- package/lib/types/agent/capabilities.d.ts.map +1 -1
- package/lib/types/agent/events.d.ts +15 -1
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/api.d.ts +2 -2
- package/lib/types/api.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/events.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/events.js +2 -1
- package/lib/types/backends/codex/auth/status.js +1 -1
- package/lib/types/backends/codex/session/controls.d.ts.map +1 -1
- package/lib/types/backends/codex/session/controls.js +6 -5
- package/lib/types/backends/codex/session/goals.d.ts.map +1 -1
- package/lib/types/backends/codex/session/side-query.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/events.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/events.js +3 -1
- package/lib/types/backends/shared/channel-tokens.d.ts.map +1 -1
- package/lib/types/backends/shared/channel-tokens.js +9 -8
- package/lib/types/channel/history-restore.d.ts.map +1 -1
- package/lib/types/channel/history-restore.js +2 -0
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/projection.d.ts +1 -1
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +19 -4
- package/lib/types/channel/questions.d.ts +2 -0
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/sanitize.d.ts +14 -0
- package/lib/types/channel/sanitize.d.ts.map +1 -1
- package/lib/types/channel/sanitize.js +55 -0
- package/lib/types/channel/working-directory.d.ts +9 -0
- package/lib/types/channel/working-directory.d.ts.map +1 -0
- package/lib/types/channel/working-directory.js +7 -0
- package/lib/types/commands.d.ts +8 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +14 -5
- package/lib/types/components/ChatTitle.d.ts +7 -0
- package/lib/types/components/ChatTitle.d.ts.map +1 -0
- package/lib/types/components/ChatTitle.js +15 -0
- package/lib/types/components/CodeBlockFrame.d.ts.map +1 -1
- package/lib/types/components/CodeBlockFrame.js +10 -5
- package/lib/types/components/CompactionStatusRow.d.ts.map +1 -1
- package/lib/types/components/CompactionStatusRow.js +24 -3
- package/lib/types/components/GoalTodoPanel.d.ts +73 -6
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
- package/lib/types/components/GoalTodoPanel.js +165 -17
- package/lib/types/components/Markdown.d.ts +9 -1
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +5 -4
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +20 -14
- 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 +13 -5
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +190 -108
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +232 -22
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +10 -0
- package/lib/types/components/SubagentDetailScene.d.ts +3 -1
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +17 -1
- package/lib/types/components/Whale.d.ts.map +1 -1
- package/lib/types/components/Whale.js +8 -5
- package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
- package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
- package/lib/types/components/approvals/ApprovalPanel.js +93 -11
- package/lib/types/components/bigfont.d.ts.map +1 -1
- package/lib/types/components/bigfont.js +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +24 -11
- 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/previewRows.d.ts +19 -0
- package/lib/types/components/previewRows.d.ts.map +1 -0
- package/lib/types/components/previewRows.js +46 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +75 -10
- package/lib/types/components/sessions/ForeignSessionRow.d.ts +3 -9
- package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -1
- package/lib/types/components/sessions/ForeignSessionRow.js +6 -10
- package/lib/types/components/sessions/SessionListRow.d.ts +4 -9
- package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
- package/lib/types/components/sessions/SessionListRow.js +18 -10
- package/lib/types/components/sidePanel/InfoPanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/InfoPanel.js +4 -3
- package/lib/types/components/sidePanel/SidePanelLayout.d.ts.map +1 -1
- package/lib/types/components/sidePanel/SidePanelLayout.js +5 -5
- package/lib/types/components/sidePanel/WorkspacePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/WorkspacePanel.js +19 -7
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +7 -0
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.js +16 -0
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +8 -1
- 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 +8 -1
- 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 +36 -18
- package/lib/types/components/sidePanel/companion/CompanionPanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/companion/CompanionPanel.js +2 -1
- package/lib/types/components/sidePanel/panelMarkdown.d.ts +32 -0
- package/lib/types/components/sidePanel/panelMarkdown.d.ts.map +1 -0
- package/lib/types/components/sidePanel/panelMarkdown.js +45 -0
- package/lib/types/components/sidePanel/pluginPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/pluginPanelAdapter.js +6 -1
- package/lib/types/components/sidePanel/subagentFailureRead.d.ts +21 -0
- package/lib/types/components/sidePanel/subagentFailureRead.d.ts.map +1 -0
- package/lib/types/components/sidePanel/subagentFailureRead.js +66 -0
- package/lib/types/components/sidePanel/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 +39 -7
- package/lib/types/components/trajectory/MiniWake.d.ts +2 -2
- package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
- package/lib/types/components/trajectory/MiniWake.js +7 -3
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.js +4 -7
- package/lib/types/dsh-adapter/backend/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 +62 -6
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +18 -4
- package/lib/types/dsh-adapter/backend-admission.d.ts +3 -3
- 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/binding-events.d.ts +5 -1
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +18 -1
- package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/command-completions.js +6 -8
- package/lib/types/dsh-adapter/channel/composer-images.d.ts +11 -1
- package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-images.js +121 -113
- package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-mentions.js +38 -17
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.js +9 -5
- package/lib/types/dsh-adapter/channel/core/actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/core/actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/actions.js +23 -2
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +10 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.js +48 -3
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +5 -2
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +7 -0
- package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/files.js +2 -1
- package/lib/types/dsh-adapter/channel/core/host.d.ts +14 -10
- package/lib/types/dsh-adapter/channel/core/host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/host.js +192 -13
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts +1 -0
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.js +32 -3
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +31 -5
- package/lib/types/dsh-adapter/channel/input-actions.d.ts +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 -0
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +5 -2
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +31 -4
- 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 +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.js +7 -1
- package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-selection.js +6 -4
- package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/paths.js +11 -9
- package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-fork.js +1 -0
- package/lib/types/dsh-adapter/channel/session-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-metadata.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-metadata.js +15 -2
- package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.js +7 -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 +56 -36
- 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 +3 -1
- 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 +3 -1
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +10 -3
- package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +2 -2
- package/lib/types/dsh-adapter/channel/types.d.ts +13 -1
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/liveSession.d.ts +3 -3
- package/lib/types/dsh-adapter/compat/liveSession.js +3 -3
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.js +17 -1
- package/lib/types/dsh-adapter/contract.d.ts +7 -5
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +10 -5
- package/lib/types/dsh-adapter/effect-ledger.d.ts +1 -1
- package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -1
- package/lib/types/dsh-adapter/effect-ledger.js +1 -0
- package/lib/types/dsh-adapter/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 +29 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -0
- package/lib/types/dsh-adapter/experimental-bundles.js +15 -0
- 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 +54 -4
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.js +2 -2
- package/lib/types/dsh-adapter/host-dsh.js +3 -3
- package/lib/types/dsh-adapter/index.d.ts +8 -4
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +17 -12
- package/lib/types/dsh-adapter/panels.d.ts +28 -8
- package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
- package/lib/types/dsh-adapter/panels.js +11 -56
- package/lib/types/dsh-adapter/plugin-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 +81 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +378 -84
- 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 +99 -31
- package/lib/types/dsh-adapter/presets.d.ts +19 -6
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +69 -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/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-tools.d.ts +34 -0
- package/lib/types/dsh-adapter/session-tools.d.ts.map +1 -0
- package/lib/types/dsh-adapter/session-tools.js +39 -0
- package/lib/types/dsh-adapter/settings-sections.d.ts +18 -1
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +73 -0
- package/lib/types/dsh-adapter/status.d.ts +88 -1
- package/lib/types/dsh-adapter/status.d.ts.map +1 -1
- package/lib/types/dsh-adapter/status.js +318 -3
- package/lib/types/dsh-adapter/team-mode.d.ts +42 -33
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +76 -112
- package/lib/types/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/extensions.d.ts +1 -1
- package/lib/types/extensions.d.ts.map +1 -1
- package/lib/types/force-production-react.js +3 -3
- package/lib/types/heldInputs.d.ts +36 -0
- package/lib/types/heldInputs.d.ts.map +1 -0
- package/lib/types/heldInputs.js +173 -0
- package/lib/types/i18n.d.ts +543 -73
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +265 -46
- package/lib/types/ink/colorize.d.ts +7 -1
- package/lib/types/ink/colorize.d.ts.map +1 -1
- package/lib/types/ink/colorize.js +29 -8
- package/lib/types/ink/components/App.d.ts +2 -1
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +10 -3
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
- package/lib/types/ink/components/ScrollBox.js +1 -0
- package/lib/types/ink/dom.d.ts +1 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-program-status.d.ts +78 -0
- package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-program-status.js +96 -0
- package/lib/types/ink/ink.d.ts +13 -4
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +119 -25
- package/lib/types/ink/output.d.ts +17 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +85 -2
- package/lib/types/ink/parse-keypress.d.ts +1 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +5 -4
- package/lib/types/ink/render-node-to-output.d.ts +2 -0
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +79 -10
- package/lib/types/ink/root.d.ts +8 -0
- package/lib/types/ink/root.d.ts.map +1 -1
- package/lib/types/ink/root.js +12 -3
- package/lib/types/ink/screen.d.ts +11 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +44 -0
- package/lib/types/ink/selection.d.ts +7 -2
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +187 -44
- package/lib/types/ink/shutdown-input.d.ts +15 -0
- package/lib/types/ink/shutdown-input.d.ts.map +1 -0
- package/lib/types/ink/shutdown-input.js +28 -0
- package/lib/types/ink/sixel-cursor-heal.d.ts +21 -0
- package/lib/types/ink/sixel-cursor-heal.d.ts.map +1 -0
- package/lib/types/ink/sixel-cursor-heal.js +62 -0
- package/lib/types/ink/sixel-graphics.d.ts +6 -0
- package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
- package/lib/types/ink/sixel-graphics.js +18 -0
- package/lib/types/ink/styles.d.ts +8 -1
- package/lib/types/ink/styles.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.d.ts +195 -0
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -0
- package/lib/types/ink/terminal-notification-windows.js +433 -0
- package/lib/types/ink/terminal-notification.d.ts +3 -1
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +4 -1
- package/lib/types/ink/terminal-querier.d.ts +9 -1
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +32 -1
- package/lib/types/ink/terminal.d.ts +23 -2
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +32 -2
- package/lib/types/ink/termio/osc.d.ts +2 -1
- package/lib/types/ink/termio/osc.d.ts.map +1 -1
- package/lib/types/ink/termio/osc.js +37 -8
- package/lib/types/ink/termio/osc7501.d.ts +102 -0
- package/lib/types/ink/termio/osc7501.d.ts.map +1 -0
- package/lib/types/ink/termio/osc7501.js +229 -0
- package/lib/types/ink/termio/tokenize.js +5 -7
- package/lib/types/onboardingDraft.d.ts +143 -0
- package/lib/types/onboardingDraft.d.ts.map +1 -0
- package/lib/types/onboardingDraft.js +71 -0
- package/lib/types/panels.d.ts +1 -1
- package/lib/types/panels.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.d.ts +3 -1
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +5 -1
- package/lib/types/screens/Chat.d.ts +6 -6
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +394 -141
- package/lib/types/screens/Launchpad.d.ts +8 -2
- package/lib/types/screens/Launchpad.d.ts.map +1 -1
- package/lib/types/screens/Launchpad.js +32 -12
- package/lib/types/screens/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.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +31 -21
- package/lib/types/screens/Settings.d.ts +5 -1
- package/lib/types/screens/Settings.d.ts.map +1 -1
- package/lib/types/screens/Settings.js +528 -51
- package/lib/types/screens/StatusLine.d.ts +9 -3
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +91 -15
- package/lib/types/screens/StatusMetrics.d.ts +2 -11
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
- package/lib/types/screens/StatusMetrics.js +20 -14
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +13 -21
- package/lib/types/sessionMounts.d.ts +14 -0
- package/lib/types/sessionMounts.d.ts.map +1 -1
- package/lib/types/sessionMounts.js +20 -9
- package/lib/types/sessions/format.d.ts +39 -0
- package/lib/types/sessions/format.d.ts.map +1 -1
- package/lib/types/sessions/format.js +83 -0
- package/lib/types/sessions/resumeFailure.d.ts +4 -0
- package/lib/types/sessions/resumeFailure.d.ts.map +1 -1
- package/lib/types/sessions/resumeFailure.js +12 -4
- package/lib/types/sessions/workspaceCounts.d.ts +6 -0
- package/lib/types/sessions/workspaceCounts.d.ts.map +1 -0
- package/lib/types/sessions/workspaceCounts.js +24 -0
- package/lib/types/settings/definitions.d.ts +24 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +40 -15
- package/lib/types/tips.js +2 -2
- package/lib/types/tuiDisplayPrefs.d.ts +113 -5
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +276 -14
- package/lib/types/update.d.ts +15 -14
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +163 -115
- package/lib/types/updateProcess.d.ts +28 -0
- package/lib/types/updateProcess.d.ts.map +1 -0
- package/lib/types/updateProcess.js +135 -0
- package/lib/types/utils/inputWordBoundary.d.ts +5 -0
- package/lib/types/utils/inputWordBoundary.d.ts.map +1 -0
- package/lib/types/utils/inputWordBoundary.js +18 -0
- package/lib/types/utils/keymap.d.ts +1 -1
- package/lib/types/utils/keymap.d.ts.map +1 -1
- package/lib/types/utils/keymap.js +6 -1
- package/lib/types/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/windowsInstaller.d.ts +4 -0
- package/lib/types/windowsInstaller.d.ts.map +1 -0
- package/lib/types/windowsInstaller.js +237 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +130 -111
- package/presets/liangshen/custom-bash.mjs +13 -1
- package/presets/liangshen/instruction-hint.mjs +4 -1
- package/presets/liangshen/skill-search.mjs +14 -2
- package/presets/winbash.mjs +16 -4
- package/tui-profile/feed/README.md +17 -8
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -11,7 +11,7 @@ import { getLang, t } from '../i18n.js';
|
|
|
11
11
|
import { SettingsForm } from '../dsh-adapter/settingsEditor.js';
|
|
12
12
|
import { panelStore } from '../components/sidePanel/PanelStore.js';
|
|
13
13
|
import { registerBuiltinPanels } from '../components/sidePanel/builtinPanels.js';
|
|
14
|
-
import {
|
|
14
|
+
import { ALL_PLUGIN_FIELDS, ALL_SIDE_PANELS, formatPluginFieldsOrder, getHiddenTemporarySidePanels, isLegacyAnonymousSidePanelId, isTemporarySidePanelId, parsePluginFieldsOrder, parseSidePanelPanels, persistentSidePanelId, resolveSidePanelIds, setTemporarySidePanelHidden, STATUS_FIELD_SLOTS, subscribeHiddenTemporarySidePanels } from '../tuiDisplayPrefs.js';
|
|
15
15
|
// The panel picker enumerates the live registry: builtin panels register on
|
|
16
16
|
// import (same idempotent call SidePanelColumn makes), plugins come and go
|
|
17
17
|
// through ctx.tuiPanels while the screen is open.
|
|
@@ -27,18 +27,182 @@ function isPanelListField(ns, field) {
|
|
|
27
27
|
return ns === 'dsh-tui' && field.path.join('.') === 'sidePanel.panels';
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* The plugin footer field list renders as a per-slot checkbox picker over the
|
|
31
|
+
* live `tuiStatus` registry: three slot subheads, one row per field, and the
|
|
32
|
+
* advanced `a,b;c;d` row. Its stored value stays the exact list string —
|
|
33
|
+
* schema and persistence contract unchanged. Scoped to the TUI's own
|
|
34
|
+
* namespace so a plugin section carrying the same path keeps the generic row.
|
|
33
35
|
*/
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
function isFieldListField(ns, field) {
|
|
37
|
+
return ns === 'dsh-tui' && field.path.join('.') === 'statusBar.pluginFieldsOrder';
|
|
38
|
+
}
|
|
39
|
+
function fieldSlotLabel(slot) {
|
|
40
|
+
return t(slot === 'left-tail' ? 'settings-fields-slot-left-tail'
|
|
41
|
+
: slot === 'right-head' ? 'settings-fields-slot-right-head'
|
|
42
|
+
: 'settings-fields-slot-right-tail');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The picker's rows for one stored value. `*` (and an invalid value, which the
|
|
46
|
+
* footer also reads as `*`) lists every field checked in its declared slot;
|
|
47
|
+
* `''` lists every field unchecked; an explicit list lists its keys in list
|
|
48
|
+
* order (checked) followed by the fields it does not name (unchecked), each in
|
|
49
|
+
* the slot it declares. A listed key whose group is not its declared slot is
|
|
50
|
+
* marked as moved — that annotation is how the screen tells the user what the
|
|
51
|
+
* plugin asked for after the list took over.
|
|
52
|
+
*/
|
|
53
|
+
function pluginFieldGroups(text, fields) {
|
|
54
|
+
const parsed = parsePluginFieldsOrder(text);
|
|
55
|
+
const listed = parsed.mode === 'groups' ? parsed.groups : undefined;
|
|
56
|
+
const allShown = parsed.mode === 'all' || parsed.mode === 'invalid';
|
|
57
|
+
const byKey = new Map(fields.map(field => [field.key, field]));
|
|
58
|
+
const named = new Set(listed === undefined ? [] : listed.flat());
|
|
59
|
+
return STATUS_FIELD_SLOTS.map((slot, index) => {
|
|
60
|
+
const rows = [];
|
|
61
|
+
if (listed === undefined) {
|
|
62
|
+
for (const field of fields) {
|
|
63
|
+
if (field.slot !== slot)
|
|
64
|
+
continue;
|
|
65
|
+
rows.push({ key: field.key, checked: allShown, title: field.text, description: field.key });
|
|
66
|
+
}
|
|
67
|
+
return { slot, rows };
|
|
68
|
+
}
|
|
69
|
+
for (const key of listed[index] ?? []) {
|
|
70
|
+
const field = byKey.get(key);
|
|
71
|
+
rows.push({
|
|
72
|
+
key,
|
|
73
|
+
checked: true,
|
|
74
|
+
title: field?.text ?? key,
|
|
75
|
+
description: field === undefined
|
|
76
|
+
? t('settings-fields-unclaimed')
|
|
77
|
+
: field.slot === slot ? field.key : `${field.key} · ${t('settings-fields-moved', { slot: fieldSlotLabel(field.slot) })}`,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
for (const field of fields) {
|
|
81
|
+
if (named.has(field.key) || field.slot !== slot)
|
|
82
|
+
continue;
|
|
83
|
+
rows.push({ key: field.key, checked: false, title: field.text, description: field.key });
|
|
84
|
+
}
|
|
85
|
+
return { slot, rows };
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/** Materialize a value into three mutable groups: `''` starts empty, while `*`
|
|
89
|
+
* (and an invalid value) starts from the registry so a toggle never silently
|
|
90
|
+
* discards the current arrangement. */
|
|
91
|
+
function pluginFieldListFrom(text, fields) {
|
|
92
|
+
const parsed = parsePluginFieldsOrder(text);
|
|
93
|
+
if (parsed.mode === 'groups')
|
|
94
|
+
return parsed.groups.map(group => [...group]);
|
|
95
|
+
return STATUS_FIELD_SLOTS.map(slot => (parsed.mode === 'none'
|
|
96
|
+
? []
|
|
97
|
+
: fields.filter(field => field.slot === slot).map(field => field.key)));
|
|
98
|
+
}
|
|
99
|
+
/** Tick/untick one key: an untick removes it wherever it sits, a tick appends
|
|
100
|
+
* to the end of the group its row lives in (its declared slot). All groups
|
|
101
|
+
* empty collapses to `''` — "none" is a legal state, not a refusal. */
|
|
102
|
+
function togglePluginFieldText(text, fields, key) {
|
|
103
|
+
const groups = pluginFieldListFrom(text, fields);
|
|
104
|
+
const at = groups.findIndex(group => group.includes(key));
|
|
105
|
+
if (at >= 0) {
|
|
106
|
+
groups[at].splice(groups[at].indexOf(key), 1);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const field = fields.find(candidate => candidate.key === key);
|
|
110
|
+
if (field === undefined)
|
|
111
|
+
return text;
|
|
112
|
+
groups[STATUS_FIELD_SLOTS.indexOf(field.slot)].push(key);
|
|
40
113
|
}
|
|
41
|
-
return
|
|
114
|
+
return groups.every(group => group.length === 0) ? '' : formatPluginFieldsOrder(groups);
|
|
115
|
+
}
|
|
116
|
+
/** The draft the advanced row opens with: `*` expands to the three-group
|
|
117
|
+
* skeleton (the declared slots become the structure the user edits), while an
|
|
118
|
+
* explicit list or the user's typo opens verbatim. */
|
|
119
|
+
function pluginFieldDraft(text, fields) {
|
|
120
|
+
if (parsePluginFieldsOrder(text).mode !== 'all')
|
|
121
|
+
return text;
|
|
122
|
+
return formatPluginFieldsOrder(pluginFieldListFrom(text, fields));
|
|
123
|
+
}
|
|
124
|
+
/** Saving the untouched skeleton must not pin the automatic mode: only a real
|
|
125
|
+
* change makes the list explicit. The stored value is the other half of that
|
|
126
|
+
* rule — an explicit list (even one identical to the current skeleton) is
|
|
127
|
+
* never rewritten to `*`, or an unedited save would silently re-enable
|
|
128
|
+
* "fields registered later". */
|
|
129
|
+
function pluginFieldCommit(stored, text, fields) {
|
|
130
|
+
// Only a draft that STARTED from `*` can collapse back to it.
|
|
131
|
+
if (parsePluginFieldsOrder(stored).mode !== 'all')
|
|
132
|
+
return text;
|
|
133
|
+
return text.trim() === pluginFieldDraft(stored, fields) ? ALL_PLUGIN_FIELDS : text;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The picker's draft helpers. `*` (the default) is not a list: the stored
|
|
137
|
+
* value only says "every registered panel", so both the checkbox rows and the
|
|
138
|
+
* toggle derive the effective ids through the same resolver the PanelBar
|
|
139
|
+
* uses. An explicit list is user data and stays literally editable.
|
|
140
|
+
*/
|
|
141
|
+
/** The ids a toggle writes back for one stored draft, in **persisted form**:
|
|
142
|
+
* `*` (or a value the store folds to it) materializes every registered
|
|
143
|
+
* panel, an explicit list opens verbatim — its own tokens stay exactly as
|
|
144
|
+
* stored, so a bare actN placeholder is never rewritten into the verified
|
|
145
|
+
* `component:` encoding by an unrelated tick. Temporary panels are left out
|
|
146
|
+
* of every write: their on/off is session state, not a preference (#1695). */
|
|
147
|
+
function panelMaterializedIds(text, registered) {
|
|
148
|
+
const parsed = parseSidePanelPanels(text);
|
|
149
|
+
if (parsed.mode === 'list')
|
|
150
|
+
return [...parsed.ids];
|
|
151
|
+
return resolveSidePanelIds(ALL_SIDE_PANELS, registered)
|
|
152
|
+
.filter(id => !isTemporarySidePanelId(id))
|
|
153
|
+
.map(id => persistentSidePanelId(id));
|
|
154
|
+
}
|
|
155
|
+
/** Every registered panel in the documented default order, as picker rows see
|
|
156
|
+
* it: the persistent id each row addresses, plus the runtime id the row's
|
|
157
|
+
* own checkbox is about. A temporary row keeps its slot even while this run
|
|
158
|
+
* hides it, or the tick that hides it could never be undone. */
|
|
159
|
+
function panelRowIds(registered) {
|
|
160
|
+
return resolveSidePanelIds(ALL_SIDE_PANELS, registered)
|
|
161
|
+
.map(runtimeId => ({ id: persistentSidePanelId(runtimeId), runtimeId }));
|
|
162
|
+
}
|
|
163
|
+
/** The draft the advanced row opens with: `*` expands to the effective list
|
|
164
|
+
* (the registry order becomes the structure the user edits), while an
|
|
165
|
+
* explicit list opens verbatim. Temporary ids never appear — the field edits
|
|
166
|
+
* persisted ids only. */
|
|
167
|
+
function panelDraft(text, registered) {
|
|
168
|
+
return parseSidePanelPanels(text).mode === 'all'
|
|
169
|
+
? panelMaterializedIds(text, registered).join(',')
|
|
170
|
+
: text;
|
|
171
|
+
}
|
|
172
|
+
/** Saving the untouched expansion must not pin the automatic mode: only a
|
|
173
|
+
* draft that STARTED from `*` and was not changed collapses back to it. The
|
|
174
|
+
* comparison is against the snapshot captured when the editor opened, not a
|
|
175
|
+
* fresh expansion — a panel registering mid-edit must not turn an untouched
|
|
176
|
+
* save into an explicit list, which would hide the panel that just arrived.
|
|
177
|
+
* An explicit list (even one identical to the current expansion) is never
|
|
178
|
+
* rewritten to `*`, or an unedited save would silently re-enable "panels
|
|
179
|
+
* registered later". */
|
|
180
|
+
function panelCommit(stored, text, initialDraft) {
|
|
181
|
+
if (parseSidePanelPanels(stored).mode !== 'all')
|
|
182
|
+
return text;
|
|
183
|
+
return text.trim() === initialDraft.trim() ? ALL_SIDE_PANELS : text;
|
|
184
|
+
}
|
|
185
|
+
/** Insert a newly ticked id where its row sits — after the last enabled id
|
|
186
|
+
* that precedes it in the documented default order (the order the picker and
|
|
187
|
+
* `*` use) — instead of appending it to the tail. Existing ids keep their
|
|
188
|
+
* relative order, so a custom list from the advanced row is preserved; only
|
|
189
|
+
* the insertion point follows the displayed order. Ids with no registry row
|
|
190
|
+
* (unclaimed placeholders) keep their slots; a plain append stays the
|
|
191
|
+
* fallback for a panel the registry does not know. */
|
|
192
|
+
function insertAtDefaultPosition(current, panelId, registered) {
|
|
193
|
+
const rank = new Map(panelRowIds(registered).map((row, index) => [row.id, index]));
|
|
194
|
+
const target = rank.get(panelId);
|
|
195
|
+
if (target === undefined)
|
|
196
|
+
return [...current, panelId];
|
|
197
|
+
let at = 0;
|
|
198
|
+
for (let index = 0; index < current.length; index += 1) {
|
|
199
|
+
const rankOf = rank.get(current[index]);
|
|
200
|
+
if (rankOf !== undefined && rankOf < target)
|
|
201
|
+
at = index + 1;
|
|
202
|
+
}
|
|
203
|
+
const next = [...current];
|
|
204
|
+
next.splice(at, 0, panelId);
|
|
205
|
+
return next;
|
|
42
206
|
}
|
|
43
207
|
/** One-line descriptions for the builtin picker rows (plugin rows show their
|
|
44
208
|
* plugin id; unclaimed rows show the waiting hint). */
|
|
@@ -75,6 +239,67 @@ function rootRowsFor(section) {
|
|
|
75
239
|
function pick(text, descriptions) {
|
|
76
240
|
return descriptions?.[getLang()] ?? text;
|
|
77
241
|
}
|
|
242
|
+
/** Page id of the sections that declare none: the default "general" page.
|
|
243
|
+
* Declared ids are validated against the plugin namespace grammar, so the
|
|
244
|
+
* empty string can never collide with one. */
|
|
245
|
+
const DEFAULT_PAGE_ID = '';
|
|
246
|
+
/**
|
|
247
|
+
* Group the declared sections into the screen's top-level pages. A section
|
|
248
|
+
* that declares `page` joins every other section declaring the same id (the
|
|
249
|
+
* first declaration names the page); sections without one share the default
|
|
250
|
+
* "general" page, which stays first. Pages follow registration order, so the
|
|
251
|
+
* strip is stable across renders for a given section list.
|
|
252
|
+
*/
|
|
253
|
+
function settingsPages(sections) {
|
|
254
|
+
const pages = [];
|
|
255
|
+
const byId = new Map();
|
|
256
|
+
const general = sections.filter(section => section.page === undefined);
|
|
257
|
+
if (general.length > 0) {
|
|
258
|
+
const page = { id: DEFAULT_PAGE_ID, sections: general };
|
|
259
|
+
byId.set(DEFAULT_PAGE_ID, page);
|
|
260
|
+
pages.push(page);
|
|
261
|
+
}
|
|
262
|
+
for (const section of sections) {
|
|
263
|
+
const declared = section.page;
|
|
264
|
+
if (declared === undefined)
|
|
265
|
+
continue;
|
|
266
|
+
const existing = byId.get(declared.id);
|
|
267
|
+
if (existing !== undefined) {
|
|
268
|
+
existing.sections.push(section);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const page = { id: declared.id, page: declared, sections: [section] };
|
|
272
|
+
byId.set(declared.id, page);
|
|
273
|
+
pages.push(page);
|
|
274
|
+
}
|
|
275
|
+
return pages;
|
|
276
|
+
}
|
|
277
|
+
/** The strip label of one page, localized at render time. */
|
|
278
|
+
function settingsPageTitle(page) {
|
|
279
|
+
return page.page === undefined ? t('settings-page-general') : pick(page.page.title, page.page.descriptions);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Lay the page tabs out in `columns`. Labels shrink evenly while every page
|
|
283
|
+
* keeps at least one label cell; when even that cannot fit (a terminal
|
|
284
|
+
* narrower than three cells per page), only the active tab is drawn followed
|
|
285
|
+
* by its `i/N` position — the page you are on never disappears from the
|
|
286
|
+
* strip, and Tab / Shift+Tab still reach every page.
|
|
287
|
+
*/
|
|
288
|
+
function settingsTabsView(pages, columns, activeIndex) {
|
|
289
|
+
const titles = pages.map(settingsPageTitle);
|
|
290
|
+
const budget = Math.floor((columns - titles.length * 2) / Math.max(1, titles.length));
|
|
291
|
+
if (budget >= 1) {
|
|
292
|
+
return { indexes: pages.map((_, index) => index), labels: titles.map(title => truncateWidth(title, budget)), compact: false };
|
|
293
|
+
}
|
|
294
|
+
return { indexes: [activeIndex], labels: [truncateWidth(titles[activeIndex] ?? '', Math.max(1, columns - 6))], compact: true };
|
|
295
|
+
}
|
|
296
|
+
/** One page tab: a reverse block when active, dim (or hovered) otherwise. */
|
|
297
|
+
function PageTab({ label, active, onSelect }) {
|
|
298
|
+
const [hovered, setHovered] = React.useState(false);
|
|
299
|
+
return (_jsx(Box, { flexShrink: 0, onClick: onSelect, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: active
|
|
300
|
+
? _jsx(Text, { color: "remember", bold: true, inverse: true, children: ` ${label} ` })
|
|
301
|
+
: _jsx(Text, { dimColor: !hovered, children: ` ${label} ` }) }));
|
|
302
|
+
}
|
|
78
303
|
/**
|
|
79
304
|
* Pad a glyph to a fixed display width.
|
|
80
305
|
*
|
|
@@ -173,6 +398,9 @@ function CardBottom({ columns, color = CARD_BORDER }) {
|
|
|
173
398
|
function CardRow({ children, highlight, color = CARD_BORDER, }) {
|
|
174
399
|
return (_jsxs(Box, { flexDirection: "row", height: 1, flexShrink: 0, overflow: "hidden", children: [_jsx(Text, { color: color, children: "\u2502" }), _jsx(Box, { flexDirection: "column", flexGrow: 1, minWidth: 0, paddingX: 1, backgroundColor: highlight === true ? 'selectionBg' : undefined, children: children }), _jsx(Text, { color: color, children: "\u2502" })] }));
|
|
175
400
|
}
|
|
401
|
+
/** Stable empty default: a settings screen opened without the live registry
|
|
402
|
+
* (tests, non-Chat hosts) still renders the field list, just empty. */
|
|
403
|
+
const NO_STATUS_FIELDS = Object.freeze([]);
|
|
176
404
|
/**
|
|
177
405
|
* The settings screen — `/settings` as a screen of its own (issue #165).
|
|
178
406
|
*
|
|
@@ -188,7 +416,7 @@ function CardRow({ children, highlight, color = CARD_BORDER, }) {
|
|
|
188
416
|
* settingsEditor.ts), so the brief in-flight window and a failed save keep
|
|
189
417
|
* their `*` / badge feedback.
|
|
190
418
|
*/
|
|
191
|
-
export function Settings({ channel, onClose, }) {
|
|
419
|
+
export function Settings({ channel, onClose, statusFields = NO_STATUS_FIELDS, }) {
|
|
192
420
|
// Explicit terminal size (not flexGrow) — the same rule the full-screen
|
|
193
421
|
// session views follow inside the alternate screen's fixed-height box.
|
|
194
422
|
const { columns, rows } = useTerminalSize();
|
|
@@ -196,11 +424,49 @@ export function Settings({ channel, onClose, }) {
|
|
|
196
424
|
// host-keyed effects below on every render (an endless render loop).
|
|
197
425
|
const host = channel.settingsHost();
|
|
198
426
|
const [namespaces, setNamespaces] = React.useState(() => host?.listNamespaces() ?? []);
|
|
199
|
-
const [
|
|
427
|
+
const [registeredSections, setSections] = React.useState(() => channel.settingsSections());
|
|
428
|
+
const routeKey = React.useMemo(() => Symbol('effort catalog'), [
|
|
429
|
+
channel.sessionRef?.backendId, channel.sessionRef?.sessionId, channel.agentBindingGeneration,
|
|
430
|
+
channel.agentId, channel.provider, channel.model, JSON.stringify(channel.effortLevels),
|
|
431
|
+
channel.backendCapabilities?.backendId, channel.backendCapabilities?.effort, getLang(),
|
|
432
|
+
]);
|
|
433
|
+
const [effortCatalog, setEffortCatalog] = React.useState();
|
|
434
|
+
// A stable getter lets already-staged forms validate against the latest
|
|
435
|
+
// route without dropping their unrelated drafts or retaining old tiers.
|
|
436
|
+
const effortOptions = React.useRef([]);
|
|
437
|
+
effortOptions.current = effortCatalog?.key === routeKey ? effortCatalog.options : [];
|
|
438
|
+
const sections = React.useMemo(() => registeredSections.map(section => ({
|
|
439
|
+
...section,
|
|
440
|
+
fields: section.fields.map(field => field.optionsSource !== 'effort' ? field : {
|
|
441
|
+
...field,
|
|
442
|
+
get options() { return [...(field.options ?? []).filter(option => option.value === 'auto'), ...effortOptions.current]; },
|
|
443
|
+
}),
|
|
444
|
+
})), [registeredSections]);
|
|
445
|
+
const needsEfforts = registeredSections.some(section => section.fields.some(field => field.optionsSource === 'effort'));
|
|
446
|
+
React.useEffect(() => {
|
|
447
|
+
if (!needsEfforts || typeof channel.listEfforts !== 'function')
|
|
448
|
+
return;
|
|
449
|
+
let current = true;
|
|
450
|
+
const provider = channel.provider;
|
|
451
|
+
const model = channel.model;
|
|
452
|
+
void channel.listEfforts({ provider, model }).then(result => {
|
|
453
|
+
if (!current)
|
|
454
|
+
return;
|
|
455
|
+
setEffortCatalog({ key: routeKey, options: result.efforts.filter(effort => effort.id !== 'auto').map(effort => ({ value: effort.id, label: effort.name })) });
|
|
456
|
+
}).catch(() => {
|
|
457
|
+
if (current)
|
|
458
|
+
setEffortCatalog({ key: routeKey, options: [] });
|
|
459
|
+
});
|
|
460
|
+
return () => { current = false; };
|
|
461
|
+
}, [channel, routeKey, needsEfforts]);
|
|
200
462
|
const [mode, setMode] = React.useState('list');
|
|
201
463
|
const [editing, setEditing] = React.useState(null);
|
|
202
464
|
const [activeGroup, setActiveGroup] = React.useState(null);
|
|
203
465
|
const [focusIndex, setFocusIndex] = React.useState(0);
|
|
466
|
+
/** Selected page id; undefined = the first page (settings page ids are
|
|
467
|
+
* stable across renders, so focus can be remembered per page). */
|
|
468
|
+
const [activePageId, setActivePageId] = React.useState(undefined);
|
|
469
|
+
const pageFocusRef = React.useRef(new Map());
|
|
204
470
|
const [notice, setNotice] = React.useState(undefined);
|
|
205
471
|
/** Configured status of every secret field's credential ref. */
|
|
206
472
|
const [secrets, setSecrets] = React.useState(new Map());
|
|
@@ -209,6 +475,7 @@ export function Settings({ channel, onClose, }) {
|
|
|
209
475
|
/** Repaint after a form mutation — staged drafts live in the (React-free)
|
|
210
476
|
* SettingsForm, so editing one changes no React state by itself. */
|
|
211
477
|
const [, bump] = React.useReducer((count) => count + 1, 0);
|
|
478
|
+
React.useEffect(() => typeof channel.subscribe === 'function' ? channel.subscribe(bump) : undefined, [channel]);
|
|
212
479
|
/** Async save completions must not touch state after the screen closes. */
|
|
213
480
|
const mountedRef = React.useRef(true);
|
|
214
481
|
React.useEffect(() => () => {
|
|
@@ -255,8 +522,19 @@ export function Settings({ channel, onClose, }) {
|
|
|
255
522
|
};
|
|
256
523
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
257
524
|
}, [host, sections, secretProbe]);
|
|
525
|
+
// Top-level pages (tabs): sections without a declared page share the
|
|
526
|
+
// default "general" page; the strip only appears once something declares
|
|
527
|
+
// a page of its own.
|
|
528
|
+
const pages = React.useMemo(() => settingsPages(sections), [sections]);
|
|
529
|
+
const activePageIndex = Math.max(0, pages.findIndex(page => page.id === activePageId));
|
|
530
|
+
const activePage = pages[activePageIndex];
|
|
531
|
+
React.useEffect(() => {
|
|
532
|
+
if (activePageId !== undefined && !pages.some(page => page.id === activePageId))
|
|
533
|
+
setActivePageId(undefined);
|
|
534
|
+
}, [activePageId, pages]);
|
|
258
535
|
const activeSection = activeGroup === null ? undefined : sections.find(section => section.ns === activeGroup.ns);
|
|
259
536
|
const activeGroupSpec = activeSection?.groups?.find(group => group.id === activeGroup?.id);
|
|
537
|
+
const inGroup = activeSection !== undefined && activeGroupSpec !== undefined;
|
|
260
538
|
React.useEffect(() => {
|
|
261
539
|
if (activeGroup !== null && activeGroupSpec === undefined) {
|
|
262
540
|
setActiveGroup(null);
|
|
@@ -268,20 +546,43 @@ export function Settings({ channel, onClose, }) {
|
|
|
268
546
|
* register/unregister (a plugin landing mid-session adds its row on the
|
|
269
547
|
* open screen — the list is never a frozen snapshot). */
|
|
270
548
|
const panelEntries = React.useSyncExternalStore(panelStore.subscribe, () => panelStore.list());
|
|
549
|
+
/** Registered ids in registry order — the `*` resolver's input (also what
|
|
550
|
+
* the toggle materializes an explicit list from). */
|
|
551
|
+
const registeredPanelIds = React.useMemo(() => panelEntries.map(entry => entry.definition.id), [panelEntries]);
|
|
552
|
+
/** Temporary panels this run is hiding (#1695): session state the stored
|
|
553
|
+
* value cannot name, so the picker reads it from its own store. */
|
|
554
|
+
const hiddenTemporaryPanelIds = React.useSyncExternalStore(subscribeHiddenTemporarySidePanels, getHiddenTemporarySidePanels);
|
|
271
555
|
/**
|
|
272
|
-
* Checkbox rows of one picker field, in
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* the
|
|
556
|
+
* Checkbox rows of one picker field, always in the **documented default
|
|
557
|
+
* order** — the order `sidePanel.panels` ships with — so the list never
|
|
558
|
+
* reshuffles when the stored value changes or a plugin registers: built-ins
|
|
559
|
+
* by `DEFAULT_SIDE_PANEL_IDS`, then plugin panels in registry order. Checked
|
|
560
|
+
* derives from the same resolver the PanelBar uses, so `*` (the default)
|
|
561
|
+
* shows every registered panel — plugin panels included — as checked. An
|
|
562
|
+
* explicit list's own order stays user data for the PanelBar and the
|
|
563
|
+
* advanced row; a well-formed id nothing claims yet stays as a checked
|
|
564
|
+
* placeholder at the tail (the extension story: tick a future id now, the
|
|
565
|
+
* plugin claims it later).
|
|
277
566
|
*/
|
|
278
567
|
const panelPickerRows = (ns, field) => {
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
568
|
+
const parsed = parseSidePanelPanels(forms.get(ns)?.field(field).text ?? '');
|
|
569
|
+
// `*` (and a hand-edited value the store folds to it) checks every
|
|
570
|
+
// registered panel; an explicit list checks exactly its own ids. The
|
|
571
|
+
// comparison is in persisted form, so a verified `component:` selection
|
|
572
|
+
// and a stale bare actN stay two separate rows.
|
|
573
|
+
const storedIds = parsed.mode === 'list' ? parsed.ids : undefined;
|
|
574
|
+
const rows = panelRowIds(registeredPanelIds).map(({ id, runtimeId }) => ({
|
|
575
|
+
id,
|
|
576
|
+
checked: isTemporarySidePanelId(runtimeId)
|
|
577
|
+
? !hiddenTemporaryPanelIds.includes(runtimeId)
|
|
578
|
+
: storedIds === undefined || storedIds.includes(id),
|
|
579
|
+
}));
|
|
580
|
+
if (storedIds !== undefined) {
|
|
581
|
+
const claimed = new Set(rows.map(row => row.id));
|
|
582
|
+
for (const id of storedIds) {
|
|
583
|
+
if (!claimed.has(id))
|
|
584
|
+
rows.push({ id, checked: true });
|
|
585
|
+
}
|
|
285
586
|
}
|
|
286
587
|
return rows;
|
|
287
588
|
};
|
|
@@ -289,6 +590,13 @@ export function Settings({ channel, onClose, }) {
|
|
|
289
590
|
* its checkbox rows plus the advanced row, in the exact order the renderer
|
|
290
591
|
* below lays them out (the focus list and the layout share this order). */
|
|
291
592
|
const fieldEntries = (ns, field) => {
|
|
593
|
+
if (isFieldListField(ns, field)) {
|
|
594
|
+
const text = forms.get(ns)?.field(field).text ?? '';
|
|
595
|
+
return [
|
|
596
|
+
...pluginFieldGroups(text, statusFields).flatMap(group => group.rows.map(row => ({ kind: 'fieldToggle', ns, field, fieldKey: row.key }))),
|
|
597
|
+
{ kind: 'fieldAdvanced', ns, field },
|
|
598
|
+
];
|
|
599
|
+
}
|
|
292
600
|
if (!isPanelListField(ns, field))
|
|
293
601
|
return [{ kind: 'field', ns, field }];
|
|
294
602
|
return [
|
|
@@ -301,7 +609,7 @@ export function Settings({ channel, onClose, }) {
|
|
|
301
609
|
? activeSection.fields
|
|
302
610
|
.filter(field => field.group === activeGroupSpec.id)
|
|
303
611
|
.flatMap(field => fieldEntries(activeSection.ns, field))
|
|
304
|
-
: sections.flatMap(section => rootRowsFor(section).flatMap((row) => {
|
|
612
|
+
: (activePage?.sections ?? []).flatMap(section => rootRowsFor(section).flatMap((row) => {
|
|
305
613
|
if (row.kind === 'field')
|
|
306
614
|
return fieldEntries(section.ns, row.field);
|
|
307
615
|
if (row.kind === 'page')
|
|
@@ -310,6 +618,24 @@ export function Settings({ channel, onClose, }) {
|
|
|
310
618
|
}));
|
|
311
619
|
const effFocus = Math.min(focusIndex, Math.max(0, focusable.length - 1));
|
|
312
620
|
const focused = focusable.length === 0 ? undefined : focusable[effFocus];
|
|
621
|
+
/** Switch the visible page: remember this page's focus, drop a group
|
|
622
|
+
* subpage (its section lives on the page we are leaving), and restore the
|
|
623
|
+
* target page's last focus. */
|
|
624
|
+
const switchPage = (id) => {
|
|
625
|
+
if (id === activePage?.id)
|
|
626
|
+
return;
|
|
627
|
+
// A group subpage's focus index is local to that subpage; recording it as
|
|
628
|
+
// the page's root focus would land on an unrelated row when the page comes
|
|
629
|
+
// back. The root focus was captured when the group row was activated.
|
|
630
|
+
if (activePage !== undefined && !inGroup)
|
|
631
|
+
pageFocusRef.current.set(activePage.id, effFocus);
|
|
632
|
+
setActivePageId(id);
|
|
633
|
+
setActiveGroup(null);
|
|
634
|
+
setMode('list');
|
|
635
|
+
setEditing(null);
|
|
636
|
+
setFocusIndex(pageFocusRef.current.get(id) ?? 0);
|
|
637
|
+
setWindowStart(0);
|
|
638
|
+
};
|
|
313
639
|
/**
|
|
314
640
|
* Save a section's staged edits right now (auto-save: every confirmed edit
|
|
315
641
|
* writes immediately — no manual save key, Esc just leaves). A save already
|
|
@@ -378,21 +704,38 @@ export function Settings({ channel, onClose, }) {
|
|
|
378
704
|
saveSoon(ns);
|
|
379
705
|
};
|
|
380
706
|
/**
|
|
381
|
-
* Tick/untick one panel id.
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* the
|
|
707
|
+
* Tick/untick one panel id. Under `*` (the default) the effective list is
|
|
708
|
+
* materialized first — default order plus every registered panel, plugin
|
|
709
|
+
* panels included — so one toggle writes the whole explicit list instead of
|
|
710
|
+
* silently dropping the ids the stored text never mentioned. On an explicit
|
|
711
|
+
* list, ids keep their relative order (PanelBar order is user data), and a
|
|
712
|
+
* new tick goes back to the position its row occupies in the fixed default
|
|
713
|
+
* order instead of being appended to the tail; unticking removes. An empty
|
|
714
|
+
* selection is refused: `''` means "use the default `*`", so writing it
|
|
715
|
+
* would silently re-enable every panel. A temporary row never reaches the
|
|
716
|
+
* stored value at all — it toggles this run's visibility (see above).
|
|
387
717
|
*/
|
|
388
718
|
const togglePanel = (ns, field, panelId) => {
|
|
389
719
|
const form = forms.get(ns);
|
|
390
720
|
if (form === undefined || !form.available)
|
|
391
721
|
return;
|
|
392
|
-
|
|
722
|
+
// A temporary panel has no durable identity: its row moves this run's
|
|
723
|
+
// visibility only, never the stored value (#1695).
|
|
724
|
+
if (isTemporarySidePanelId(panelId) && panelStore.get(panelId) !== undefined) {
|
|
725
|
+
const hide = !hiddenTemporaryPanelIds.includes(panelId);
|
|
726
|
+
const text = form.field(field).text;
|
|
727
|
+
if (hide && resolveSidePanelIds(text, registeredPanelIds, [...hiddenTemporaryPanelIds, panelId]).length === 0) {
|
|
728
|
+
setNotice({ text: t('settings-panels-min-one'), tone: 'error' });
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
setTemporarySidePanelHidden(panelId, hide);
|
|
732
|
+
bump();
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
const current = panelMaterializedIds(form.field(field).text, registeredPanelIds);
|
|
393
736
|
const next = current.includes(panelId)
|
|
394
737
|
? current.filter(id => id !== panelId)
|
|
395
|
-
:
|
|
738
|
+
: insertAtDefaultPosition(current, panelId, registeredPanelIds);
|
|
396
739
|
if (next.length === 0) {
|
|
397
740
|
setNotice({ text: t('settings-panels-min-one'), tone: 'error' });
|
|
398
741
|
return;
|
|
@@ -401,6 +744,20 @@ export function Settings({ channel, onClose, }) {
|
|
|
401
744
|
bump();
|
|
402
745
|
saveSoon(ns);
|
|
403
746
|
};
|
|
747
|
+
/**
|
|
748
|
+
* Tick/untick one plugin footer field. The stored string keeps its exact
|
|
749
|
+
* semantics: keys already listed keep their relative order, a new tick
|
|
750
|
+
* appends to its slot group's end, unticking removes. `''` (none) is a
|
|
751
|
+
* legal outcome here — the picker has no "at least one" rule.
|
|
752
|
+
*/
|
|
753
|
+
const togglePluginField = (ns, field, key) => {
|
|
754
|
+
const form = forms.get(ns);
|
|
755
|
+
if (form === undefined || !form.available)
|
|
756
|
+
return;
|
|
757
|
+
form.edit(field, togglePluginFieldText(form.field(field).text, statusFields, key));
|
|
758
|
+
bump();
|
|
759
|
+
saveSoon(ns);
|
|
760
|
+
};
|
|
404
761
|
/**
|
|
405
762
|
* Activate one focusable entry — the keyboard Enter path, shared with the
|
|
406
763
|
* mouse click. Groups open their subpage; picker checkbox rows toggle their
|
|
@@ -409,6 +766,10 @@ export function Settings({ channel, onClose, }) {
|
|
|
409
766
|
*/
|
|
410
767
|
const activateEntry = (entry) => {
|
|
411
768
|
if (entry.kind === 'group') {
|
|
769
|
+
// Remember the page root focus before the subpage resets it, so a page
|
|
770
|
+
// switch from inside the group returns to this row.
|
|
771
|
+
if (activePage !== undefined)
|
|
772
|
+
pageFocusRef.current.set(activePage.id, effFocus);
|
|
412
773
|
setActiveGroup({ ns: entry.ns, id: entry.group.id });
|
|
413
774
|
setFocusIndex(0);
|
|
414
775
|
setWindowStart(0);
|
|
@@ -418,6 +779,10 @@ export function Settings({ channel, onClose, }) {
|
|
|
418
779
|
togglePanel(entry.ns, entry.field, entry.panelId);
|
|
419
780
|
return;
|
|
420
781
|
}
|
|
782
|
+
if (entry.kind === 'fieldToggle') {
|
|
783
|
+
togglePluginField(entry.ns, entry.field, entry.fieldKey);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
421
786
|
const form = forms.get(entry.ns);
|
|
422
787
|
if (form === undefined || !form.available)
|
|
423
788
|
return;
|
|
@@ -425,7 +790,11 @@ export function Settings({ channel, onClose, }) {
|
|
|
425
790
|
cycleField(entry.ns, entry.field);
|
|
426
791
|
}
|
|
427
792
|
else {
|
|
428
|
-
|
|
793
|
+
const text = form.field(entry.field).text;
|
|
794
|
+
const draft = isPanelListField(entry.ns, entry.field)
|
|
795
|
+
? panelDraft(text, registeredPanelIds)
|
|
796
|
+
: isFieldListField(entry.ns, entry.field) ? pluginFieldDraft(text, statusFields) : text;
|
|
797
|
+
setEditing({ ns: entry.ns, field: entry.field, draft, initialDraft: draft });
|
|
429
798
|
setMode('edit');
|
|
430
799
|
}
|
|
431
800
|
};
|
|
@@ -444,7 +813,19 @@ export function Settings({ channel, onClose, }) {
|
|
|
444
813
|
// error badge and a toast; a valid one saves immediately (auto-save).
|
|
445
814
|
const form = forms.get(editing.ns);
|
|
446
815
|
if (form !== undefined) {
|
|
447
|
-
form
|
|
816
|
+
// Keep rejected panel drafts out of the form: its checkbox helpers
|
|
817
|
+
// interpret an invalid value as `*`, so Esc must leave the last
|
|
818
|
+
// valid selection intact for the next toggle.
|
|
819
|
+
if (isPanelListField(editing.ns, editing.field) && parseSidePanelPanels(editing.draft).mode === 'invalid') {
|
|
820
|
+
setEditing({ ...editing, invalid: true });
|
|
821
|
+
setNotice({ text: t('settings-field-invalid'), tone: 'error' });
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
form.edit(editing.field, isPanelListField(editing.ns, editing.field)
|
|
825
|
+
? panelCommit(form.field(editing.field).text, editing.draft, editing.initialDraft)
|
|
826
|
+
: isFieldListField(editing.ns, editing.field)
|
|
827
|
+
? pluginFieldCommit(form.field(editing.field).text, editing.draft, statusFields)
|
|
828
|
+
: editing.draft);
|
|
448
829
|
if (form.field(editing.field).invalid) {
|
|
449
830
|
setNotice({ text: t('settings-field-invalid'), tone: 'error' });
|
|
450
831
|
bump();
|
|
@@ -478,6 +859,16 @@ export function Settings({ channel, onClose, }) {
|
|
|
478
859
|
else if (key.downArrow) {
|
|
479
860
|
setFocusIndex(Math.min(Math.max(0, focusable.length - 1), effFocus + 1));
|
|
480
861
|
}
|
|
862
|
+
else if (key.tab) {
|
|
863
|
+
// Tab / Shift+Tab walk the page tabs; the arrows keep the field focus.
|
|
864
|
+
// Editing owns the keyboard, so this only runs in list mode.
|
|
865
|
+
if (pages.length > 1) {
|
|
866
|
+
const step = key.shift ? -1 : 1;
|
|
867
|
+
const next = pages[(activePageIndex + step + pages.length) % pages.length];
|
|
868
|
+
if (next !== undefined)
|
|
869
|
+
switchPage(next.id);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
481
872
|
else if (key.leftArrow || key.rightArrow) {
|
|
482
873
|
// ←/→ cycle an options-bearing field (select rows and hybrid
|
|
483
874
|
// text-with-options rows such as the page margin presets). Rows
|
|
@@ -592,16 +983,17 @@ export function Settings({ channel, onClose, }) {
|
|
|
592
983
|
return badges;
|
|
593
984
|
};
|
|
594
985
|
/**
|
|
595
|
-
* The picker field's block: a dim title row, one checkbox row per
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
*
|
|
986
|
+
* The picker field's block: a dim title row, one checkbox row per registered
|
|
987
|
+
* panel in the documented default order (built-ins by the order the value
|
|
988
|
+
* ships with, then plugin panels in registry order), the unclaimed
|
|
989
|
+
* placeholders, and the advanced raw-text row. Rows stay one line each, so
|
|
990
|
+
* the focus-follow windowing below needs no special casing.
|
|
599
991
|
*/
|
|
600
992
|
const addPanelPicker = (section, field) => {
|
|
601
993
|
const ns = section.ns;
|
|
602
994
|
const form = forms.get(ns);
|
|
603
995
|
const state = form?.field(field) ?? { text: '', overridden: false, invalid: false };
|
|
604
|
-
const registered = new Map(panelEntries.map(entry => [entry.definition.id, entry]));
|
|
996
|
+
const registered = new Map(panelEntries.map(entry => [persistentSidePanelId(entry.definition.id), entry]));
|
|
605
997
|
entries.push({
|
|
606
998
|
key: `panel-header:${ns}:${field.path.join('.')}`,
|
|
607
999
|
lines: 1,
|
|
@@ -630,10 +1022,12 @@ export function Settings({ channel, onClose, }) {
|
|
|
630
1022
|
: definition.title ?? row.id;
|
|
631
1023
|
const descriptionKey = PANEL_DESCRIPTION_KEYS[row.id];
|
|
632
1024
|
const description = definition === undefined
|
|
633
|
-
? t('settings-panels-unclaimed')
|
|
634
|
-
:
|
|
635
|
-
? t('settings-panels-
|
|
636
|
-
:
|
|
1025
|
+
? t(isLegacyAnonymousSidePanelId(row.id) ? 'settings-panels-legacy-anonymous' : 'settings-panels-unclaimed')
|
|
1026
|
+
: isTemporarySidePanelId(row.id)
|
|
1027
|
+
? t('settings-panels-temporary', { n: String(registered.get(row.id)?.registrationId ?? '') })
|
|
1028
|
+
: definition.source === 'plugin'
|
|
1029
|
+
? t('settings-panels-plugin', { plugin: definition.pluginId ?? definition.id })
|
|
1030
|
+
: descriptionKey !== undefined ? t(descriptionKey) : '';
|
|
637
1031
|
entries.push({
|
|
638
1032
|
key: `panel-toggle:${ns}:${row.id}`,
|
|
639
1033
|
lines: 1,
|
|
@@ -662,10 +1056,84 @@ export function Settings({ channel, onClose, }) {
|
|
|
662
1056
|
key: `panel-advanced:${ns}:${field.path.join('.')}`,
|
|
663
1057
|
lines: 1,
|
|
664
1058
|
focus: advIndex,
|
|
665
|
-
node: (_jsx(CardRow, { highlight: advFocused, children: _jsx(FieldRow, { label: t('settings-panels-advanced'), kind: "text", value: advEditing ? `${editing?.draft ?? ''}▌` : state.text === '' ? t('settings-field-empty') : state.text, selectLabel: undefined, focused: advFocused, editing: advEditing, invalid: state.invalid, staged: form?.isStaged(field) === true, onClick: advEvents?.onClick, onMouseEnter: advEvents?.onMouseEnter }) })),
|
|
1059
|
+
node: (_jsx(CardRow, { highlight: advFocused, children: _jsx(FieldRow, { label: t('settings-panels-advanced'), kind: "text", value: advEditing ? `${editing?.draft ?? ''}▌` : state.text === '' ? t('settings-field-empty') : state.text, selectLabel: undefined, focused: advFocused, editing: advEditing, invalid: state.invalid || (advEditing && editing?.invalid === true), staged: form?.isStaged(field) === true, onClick: advEvents?.onClick, onMouseEnter: advEvents?.onMouseEnter }) })),
|
|
1060
|
+
});
|
|
1061
|
+
};
|
|
1062
|
+
/**
|
|
1063
|
+
* The plugin footer field list's block: a dim title row, one subhead per
|
|
1064
|
+
* slot with its checkbox rows, then the advanced `a,b;c;d` row. The rows come
|
|
1065
|
+
* from `pluginFieldGroups`, the same function `fieldEntries` fans out from,
|
|
1066
|
+
* so the focus list and the layout cannot drift.
|
|
1067
|
+
*/
|
|
1068
|
+
const addFieldPicker = (section, field) => {
|
|
1069
|
+
const ns = section.ns;
|
|
1070
|
+
const form = forms.get(ns);
|
|
1071
|
+
const state = form?.field(field) ?? { text: '', overridden: false, invalid: false };
|
|
1072
|
+
entries.push({
|
|
1073
|
+
key: `field-picker-header:${ns}:${field.path.join('.')}`,
|
|
1074
|
+
lines: 1,
|
|
1075
|
+
node: _jsx(CardRow, { children: _jsx(PanelListHeaderRow, { title: pick(field.label, field.descriptions) }) }),
|
|
1076
|
+
});
|
|
1077
|
+
for (const group of pluginFieldGroups(state.text, statusFields)) {
|
|
1078
|
+
// A slot with nothing to show stays as a one-line subhead: the three
|
|
1079
|
+
// groups are the grammar, so they must not disappear with their rows.
|
|
1080
|
+
entries.push({
|
|
1081
|
+
key: `field-picker-slot:${ns}:${group.slot}`,
|
|
1082
|
+
lines: 1,
|
|
1083
|
+
node: _jsx(CardRow, { children: _jsx(PanelListHeaderRow, { title: fieldSlotLabel(group.slot) }) }),
|
|
1084
|
+
});
|
|
1085
|
+
for (const row of group.rows) {
|
|
1086
|
+
const index = focusCursor;
|
|
1087
|
+
focusCursor += 1;
|
|
1088
|
+
const isFocused = focused?.kind === 'fieldToggle' && focused.ns === ns && focused.field === field && focused.fieldKey === row.key;
|
|
1089
|
+
const rowEvents = mode === 'edit'
|
|
1090
|
+
? undefined
|
|
1091
|
+
: {
|
|
1092
|
+
onClick: () => {
|
|
1093
|
+
setFocusIndex(index);
|
|
1094
|
+
togglePluginField(ns, field, row.key);
|
|
1095
|
+
},
|
|
1096
|
+
onMouseEnter: () => {
|
|
1097
|
+
setFocusIndex(index);
|
|
1098
|
+
},
|
|
1099
|
+
};
|
|
1100
|
+
entries.push({
|
|
1101
|
+
key: `field-toggle:${ns}:${group.slot}:${row.key}`,
|
|
1102
|
+
lines: 1,
|
|
1103
|
+
focus: index,
|
|
1104
|
+
node: (_jsx(CardRow, { highlight: isFocused, children: _jsx(PanelToggleRow, { checked: row.checked, icon: "\u00B7", title: row.title, description: row.description, focused: isFocused, columns: columns, onClick: rowEvents?.onClick, onMouseEnter: rowEvents?.onMouseEnter }) })),
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
// The advanced escape hatch: same row/edit/invalid conventions as a text
|
|
1109
|
+
// field, seeded with the three-group skeleton on the first Enter.
|
|
1110
|
+
const advIndex = focusCursor;
|
|
1111
|
+
focusCursor += 1;
|
|
1112
|
+
const advFocused = focused?.kind === 'fieldAdvanced' && focused.ns === ns && focused.field === field;
|
|
1113
|
+
const advEditing = advFocused && mode === 'edit' && editing !== null;
|
|
1114
|
+
const advEvents = mode === 'edit'
|
|
1115
|
+
? undefined
|
|
1116
|
+
: {
|
|
1117
|
+
onClick: () => {
|
|
1118
|
+
setFocusIndex(advIndex);
|
|
1119
|
+
activateEntry({ kind: 'fieldAdvanced', ns, field });
|
|
1120
|
+
},
|
|
1121
|
+
onMouseEnter: () => {
|
|
1122
|
+
setFocusIndex(advIndex);
|
|
1123
|
+
},
|
|
1124
|
+
};
|
|
1125
|
+
entries.push({
|
|
1126
|
+
key: `field-advanced:${ns}:${field.path.join('.')}`,
|
|
1127
|
+
lines: 1,
|
|
1128
|
+
focus: advIndex,
|
|
1129
|
+
node: (_jsx(CardRow, { highlight: advFocused, children: _jsx(FieldRow, { label: t('settings-fields-advanced'), kind: "text", value: advEditing ? `${editing?.draft ?? ''}▌` : state.text === '' ? t('settings-field-empty') : state.text, selectLabel: undefined, focused: advFocused, editing: advEditing, invalid: state.invalid, staged: form?.isStaged(field) === true, onClick: advEvents?.onClick, onMouseEnter: advEvents?.onMouseEnter }) })),
|
|
666
1130
|
});
|
|
667
1131
|
};
|
|
668
1132
|
const addField = (section, field) => {
|
|
1133
|
+
if (isFieldListField(section.ns, field)) {
|
|
1134
|
+
addFieldPicker(section, field);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
669
1137
|
if (isPanelListField(section.ns, field)) {
|
|
670
1138
|
addPanelPicker(section, field);
|
|
671
1139
|
return;
|
|
@@ -697,7 +1165,8 @@ export function Settings({ channel, onClose, }) {
|
|
|
697
1165
|
entries.push({ key: 'card:group:bottom', lines: 1, node: _jsx(CardBottom, { columns: columns }) });
|
|
698
1166
|
}
|
|
699
1167
|
else {
|
|
700
|
-
sections
|
|
1168
|
+
const rootSections = activePage?.sections ?? [];
|
|
1169
|
+
rootSections.forEach((section, sectionIndex) => {
|
|
701
1170
|
if (sectionIndex > 0)
|
|
702
1171
|
entries.push({ key: `gap:${section.ns}`, lines: 1, node: _jsx(Text, { children: " " }) });
|
|
703
1172
|
entries.push({
|
|
@@ -744,7 +1213,7 @@ export function Settings({ channel, onClose, }) {
|
|
|
744
1213
|
});
|
|
745
1214
|
// Namespaces without a plugin-declared section are deliberately NOT
|
|
746
1215
|
// listed (they used to get a read-only YAML hint; user feedback: noise).
|
|
747
|
-
if (
|
|
1216
|
+
if (pages.length === 0) {
|
|
748
1217
|
entries.push({
|
|
749
1218
|
key: 'empty',
|
|
750
1219
|
lines: 1,
|
|
@@ -778,7 +1247,8 @@ export function Settings({ channel, onClose, }) {
|
|
|
778
1247
|
// Chrome: title row, footer rule, notice slot, help row. The notice slot is
|
|
779
1248
|
// permanent (blank while quiet) so a save/discard toast never shifts the
|
|
780
1249
|
// list above it.
|
|
781
|
-
const
|
|
1250
|
+
const showTabs = pages.length > 1;
|
|
1251
|
+
const viewport = Math.max(1, rows - 4 - (showTabs ? 1 : 0));
|
|
782
1252
|
const maxStart = Math.max(0, totalLines - viewport);
|
|
783
1253
|
React.useEffect(() => {
|
|
784
1254
|
setWindowStart(start => {
|
|
@@ -805,11 +1275,13 @@ export function Settings({ channel, onClose, }) {
|
|
|
805
1275
|
entryOffset += entry.lines;
|
|
806
1276
|
return start >= windowStart && start + entry.lines <= windowStart + viewport;
|
|
807
1277
|
});
|
|
808
|
-
const
|
|
809
|
-
|
|
1278
|
+
const navigationHint = inGroup
|
|
1279
|
+
? t('settings-hint-group')
|
|
1280
|
+
: pages.length > 1 ? t('settings-hint-list-pages') : t('settings-hint-list');
|
|
810
1281
|
// The bottom help bar: the focused field's hint on the left (truncated
|
|
811
1282
|
// first), the navigation keys pinned to the right — a truncated hint still
|
|
812
1283
|
// reads, a truncated shortcut hint hides the keys nobody can guess.
|
|
1284
|
+
const tabs = showTabs ? settingsTabsView(pages, columns, activePageIndex) : undefined;
|
|
813
1285
|
const focusedHint = focused !== undefined && focused.kind !== 'group' && focused.field.hint !== undefined
|
|
814
1286
|
? pick(focused.field.hint, focused.field.hintDescriptions)
|
|
815
1287
|
: undefined;
|
|
@@ -837,5 +1309,10 @@ export function Settings({ channel, onClose, }) {
|
|
|
837
1309
|
}
|
|
838
1310
|
// Header stats: where the focus sits in the current page's focusable list.
|
|
839
1311
|
// (Auto-save means there is no unsaved-draft count to surface here.)
|
|
840
|
-
return (_jsxs(Box, { flexDirection: "column", width: columns, height: rows, children: [_jsxs(Box, { children: [_jsx(Text, { bold: true, children: t('settings-title') }), inGroup && (_jsxs(_Fragment, { children: [_jsxs(Text, { dimColor: true, children: [' › ', pick(activeSection.title, activeSection.descriptions)] }), _jsx(Text, { dimColor: true, children: ' › ' }), _jsx(Text, { bold: true, children: pick(activeGroupSpec.title, activeGroupSpec.descriptions) })] })), _jsx(Box, { flexGrow: 1 }), host === undefined && _jsx(Text, { color: "warning", children: `${t('settings-unavailable')} ` }), focusable.length > 0 && _jsx(Text, { dimColor: true, children: `${effFocus + 1}/${focusable.length}` })] }),
|
|
1312
|
+
return (_jsxs(Box, { flexDirection: "column", width: columns, height: rows, children: [_jsxs(Box, { children: [_jsx(Text, { bold: true, children: t('settings-title') }), inGroup && (_jsxs(_Fragment, { children: [_jsxs(Text, { dimColor: true, children: [' › ', pick(activeSection.title, activeSection.descriptions)] }), _jsx(Text, { dimColor: true, children: ' › ' }), _jsx(Text, { bold: true, children: pick(activeGroupSpec.title, activeGroupSpec.descriptions) })] })), _jsx(Box, { flexGrow: 1 }), host === undefined && _jsx(Text, { color: "warning", children: `${t('settings-unavailable')} ` }), focusable.length > 0 && _jsx(Text, { dimColor: true, children: `${effFocus + 1}/${focusable.length}` })] }), tabs !== undefined && (_jsxs(Box, { height: 1, flexShrink: 0, overflow: "hidden", children: [tabs.indexes.map((index, cell) => {
|
|
1313
|
+
const page = pages[index];
|
|
1314
|
+
if (page === undefined)
|
|
1315
|
+
return null;
|
|
1316
|
+
return (_jsx(PageTab, { label: tabs.labels[cell] ?? settingsPageTitle(page), active: index === activePageIndex, ...(mode === 'edit' ? {} : { onSelect: () => switchPage(page.id) }) }, page.id === DEFAULT_PAGE_ID ? '__general' : page.id));
|
|
1317
|
+
}), tabs.compact && _jsx(Text, { dimColor: true, children: ` ${activePageIndex + 1}/${pages.length}` })] })), _jsx("ink-box", { style: { flexDirection: 'column', flexGrow: 1, flexShrink: 1, overflow: 'hidden' }, onWheel: handleWheel, children: visible.map(entry => (_jsx(React.Fragment, { children: entry.node }, entry.key))) }), _jsx(Box, { flexGrow: 1 }), _jsx(Divider, { bleed: true }), _jsx(Text, { color: notice?.tone === 'error' ? 'error' : 'success', children: notice === undefined ? ' ' : `${notice.tone === 'error' ? MULTIPLICATION_X : TICK} ${notice.text}` }), _jsxs(Box, { children: [_jsx(Text, { dimColor: true, italic: true, children: hintText }), _jsx(Box, { flexGrow: 1 }), _jsx(Text, { dimColor: true, italic: true, children: _jsx(HintLine, { text: keysLine }) })] })] }));
|
|
841
1318
|
}
|