@deepseek-harness-tui/dsh-tui 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +214 -34
- package/assets/plugin-icon.svg +13 -0
- package/assets/windows-installer.cs +308 -0
- package/assets/windows-installer.ps1 +17 -0
- package/bin/dsh-tui.js +64 -5
- package/cli/adapters/dsh/index.mjs +111 -0
- package/cli/adapters/dsh/locate.mjs +73 -0
- package/cli/adapters/dsh/management-plugin.mjs +111 -0
- package/cli/args.mjs +154 -0
- package/cli/contracts.d.ts +48 -0
- package/cli/engine.mjs +92 -0
- package/cli/entry.mjs +48 -0
- package/cli/process.mjs +118 -0
- package/cli/protocol.mjs +23 -0
- package/cli/schema-v1.json +33 -0
- package/cordis.patch.yml +3 -1
- package/cordis.yml +3 -1
- package/guide/dsh-tui-guide/SKILL.md +1 -0
- package/guide/dsh-tui-guide/claude-backend.en.md +8 -0
- package/guide/dsh-tui-guide/claude-backend.md +5 -0
- package/guide/dsh-tui-guide/cli.en.md +114 -0
- package/guide/dsh-tui-guide/cli.md +114 -0
- package/guide/dsh-tui-guide/configuration.en.md +6 -5
- package/guide/dsh-tui-guide/configuration.md +6 -5
- package/guide/dsh-tui-guide/getting-started.en.md +44 -10
- package/guide/dsh-tui-guide/getting-started.md +31 -9
- package/guide/dsh-tui-guide/interaction.en.md +22 -10
- package/guide/dsh-tui-guide/interaction.md +18 -8
- package/guide/dsh-tui-guide/plugins.en.md +35 -4
- package/guide/dsh-tui-guide/plugins.md +23 -2
- package/guide/dsh-tui-guide/user-guide.en.md +30 -23
- package/guide/dsh-tui-guide/user-guide.md +29 -22
- package/lib/settings.json +83 -40
- package/lib/types/adapter/channel/plugins.d.ts.map +1 -1
- package/lib/types/adapter/channel/plugins.js +8 -0
- package/lib/types/adapter/channel/ui-policy.d.ts +1 -1
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +3 -0
- package/lib/types/adapter/ports/channel-display.d.ts +10 -0
- package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-session.d.ts +2 -0
- package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-settings.d.ts +20 -0
- package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-ui.d.ts +17 -2
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +8 -1
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel.d.ts +7 -0
- package/lib/types/adapter/ports/channel.d.ts.map +1 -1
- package/lib/types/agent/capabilities.d.ts +2 -0
- package/lib/types/agent/capabilities.d.ts.map +1 -1
- package/lib/types/agent/events.d.ts +8 -0
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/api.d.ts +2 -2
- package/lib/types/api.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/events.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/events.js +2 -1
- package/lib/types/backends/codex/auth/status.js +1 -1
- package/lib/types/backends/codex/session/controls.d.ts.map +1 -1
- package/lib/types/backends/codex/session/controls.js +6 -5
- package/lib/types/backends/codex/session/goals.d.ts.map +1 -1
- package/lib/types/backends/codex/session/side-query.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/events.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/events.js +3 -1
- package/lib/types/backends/shared/channel-tokens.d.ts.map +1 -1
- package/lib/types/backends/shared/channel-tokens.js +9 -8
- package/lib/types/channel/history-restore.d.ts.map +1 -1
- package/lib/types/channel/history-restore.js +2 -0
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/projection.d.ts +1 -1
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +19 -4
- package/lib/types/channel/questions.d.ts +2 -0
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/sanitize.d.ts +14 -0
- package/lib/types/channel/sanitize.d.ts.map +1 -1
- package/lib/types/channel/sanitize.js +55 -0
- package/lib/types/channel/working-directory.d.ts +9 -0
- package/lib/types/channel/working-directory.d.ts.map +1 -0
- package/lib/types/channel/working-directory.js +7 -0
- package/lib/types/commands.d.ts +8 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +13 -4
- package/lib/types/components/ChatTitle.d.ts +7 -0
- package/lib/types/components/ChatTitle.d.ts.map +1 -0
- package/lib/types/components/ChatTitle.js +15 -0
- package/lib/types/components/CodeBlockFrame.d.ts.map +1 -1
- package/lib/types/components/CodeBlockFrame.js +10 -5
- package/lib/types/components/CompactionStatusRow.d.ts.map +1 -1
- package/lib/types/components/CompactionStatusRow.js +24 -3
- package/lib/types/components/GoalTodoPanel.d.ts +3 -1
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
- package/lib/types/components/GoalTodoPanel.js +2 -2
- package/lib/types/components/Markdown.d.ts +9 -1
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +5 -4
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +17 -12
- package/lib/types/components/PromptInput.d.ts +13 -5
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +189 -107
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +232 -22
- package/lib/types/components/SubagentDetailScene.d.ts +3 -1
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +5 -1
- package/lib/types/components/Whale.d.ts.map +1 -1
- package/lib/types/components/Whale.js +8 -5
- package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
- package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
- package/lib/types/components/approvals/ApprovalPanel.js +93 -11
- package/lib/types/components/bigfont.d.ts.map +1 -1
- package/lib/types/components/bigfont.js +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +13 -6
- package/lib/types/components/previewRows.d.ts +19 -0
- package/lib/types/components/previewRows.d.ts.map +1 -0
- package/lib/types/components/previewRows.js +46 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +75 -10
- package/lib/types/components/sessions/ForeignSessionRow.d.ts +3 -9
- package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -1
- package/lib/types/components/sessions/ForeignSessionRow.js +6 -10
- package/lib/types/components/sessions/SessionListRow.d.ts +4 -9
- package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
- package/lib/types/components/sessions/SessionListRow.js +18 -10
- package/lib/types/components/sidePanel/InfoPanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/InfoPanel.js +4 -3
- package/lib/types/components/sidePanel/SidePanelLayout.d.ts.map +1 -1
- package/lib/types/components/sidePanel/SidePanelLayout.js +5 -5
- package/lib/types/components/sidePanel/WorkspacePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/WorkspacePanel.js +19 -7
- package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
- package/lib/types/components/sidePanel/builtinPanels.js +22 -16
- package/lib/types/components/sidePanel/companion/CompanionPanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/companion/CompanionPanel.js +2 -1
- package/lib/types/components/sidePanel/panelMarkdown.d.ts +32 -0
- package/lib/types/components/sidePanel/panelMarkdown.d.ts.map +1 -0
- package/lib/types/components/sidePanel/panelMarkdown.js +45 -0
- package/lib/types/components/sidePanel/pluginPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/pluginPanelAdapter.js +6 -1
- package/lib/types/components/sidePanel/subagentFailureRead.d.ts +21 -0
- package/lib/types/components/sidePanel/subagentFailureRead.d.ts.map +1 -0
- package/lib/types/components/sidePanel/subagentFailureRead.js +66 -0
- package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/useSidePanel.js +24 -6
- package/lib/types/components/trajectory/MiniWake.d.ts +2 -2
- package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
- package/lib/types/components/trajectory/MiniWake.js +7 -3
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.js +4 -7
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +11 -1
- package/lib/types/dsh-adapter/backend-admission.d.ts +3 -3
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +5 -1
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +18 -1
- package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/command-completions.js +6 -8
- package/lib/types/dsh-adapter/channel/composer-images.d.ts +9 -1
- package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-images.js +111 -111
- package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-mentions.js +16 -10
- package/lib/types/dsh-adapter/channel/core/actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/core/actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/actions.js +23 -2
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.js +13 -2
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +2 -0
- package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/files.js +2 -1
- package/lib/types/dsh-adapter/channel/core/host.d.ts +14 -10
- package/lib/types/dsh-adapter/channel/core/host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/host.js +192 -13
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts +1 -0
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.js +32 -3
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +31 -5
- package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-actions.js +4 -0
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +24 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.js +7 -1
- package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-selection.js +6 -4
- package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-fork.js +1 -0
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-metadata.js +15 -2
- package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.js +4 -0
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +46 -33
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +10 -3
- package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +2 -2
- package/lib/types/dsh-adapter/channel/types.d.ts +13 -1
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/liveSession.d.ts +3 -3
- package/lib/types/dsh-adapter/compat/liveSession.js +3 -3
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.js +17 -1
- package/lib/types/dsh-adapter/contract.d.ts +6 -5
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +7 -5
- package/lib/types/dsh-adapter/effect-ledger.d.ts +1 -1
- package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -1
- package/lib/types/dsh-adapter/effect-ledger.js +1 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +26 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -0
- package/lib/types/dsh-adapter/experimental-bundles.js +11 -0
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-access.js +4 -0
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.js +2 -2
- package/lib/types/dsh-adapter/host-dsh.js +3 -3
- package/lib/types/dsh-adapter/host-entry.js +5 -3
- package/lib/types/dsh-adapter/index.d.ts +8 -4
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +9 -7
- package/lib/types/dsh-adapter/install/pnpm-profile-add.d.ts.map +1 -1
- package/lib/types/dsh-adapter/install/pnpm-profile-add.js +9 -3
- package/lib/types/dsh-adapter/panels.d.ts +21 -7
- package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
- package/lib/types/dsh-adapter/panels.js +11 -56
- package/lib/types/dsh-adapter/plugin.d.ts +81 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +318 -70
- package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugins-info.js +65 -10
- package/lib/types/dsh-adapter/presets.d.ts +15 -6
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +51 -12
- package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
- package/lib/types/dsh-adapter/process-exit.js +1 -1
- package/lib/types/dsh-adapter/session-tools.d.ts +34 -0
- package/lib/types/dsh-adapter/session-tools.d.ts.map +1 -0
- package/lib/types/dsh-adapter/session-tools.js +39 -0
- package/lib/types/dsh-adapter/settings-sections.d.ts +18 -1
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +73 -0
- package/lib/types/dsh-adapter/status.d.ts +88 -1
- package/lib/types/dsh-adapter/status.d.ts.map +1 -1
- package/lib/types/dsh-adapter/status.js +318 -3
- package/lib/types/dsh-adapter/team-mode.d.ts +42 -33
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +76 -112
- package/lib/types/extensions.d.ts +1 -1
- package/lib/types/extensions.d.ts.map +1 -1
- package/lib/types/force-production-react.js +3 -3
- package/lib/types/i18n.d.ts +195 -52
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +96 -30
- package/lib/types/ink/colorize.d.ts +7 -1
- package/lib/types/ink/colorize.d.ts.map +1 -1
- package/lib/types/ink/colorize.js +29 -8
- package/lib/types/ink/components/App.d.ts +2 -1
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +10 -3
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
- package/lib/types/ink/components/ScrollBox.js +1 -0
- package/lib/types/ink/dom.d.ts +1 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-program-status.d.ts +78 -0
- package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-program-status.js +96 -0
- package/lib/types/ink/ink.d.ts +13 -4
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +119 -25
- package/lib/types/ink/output.d.ts +17 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +85 -2
- package/lib/types/ink/parse-keypress.d.ts +1 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +5 -4
- package/lib/types/ink/render-node-to-output.d.ts +2 -0
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +79 -10
- package/lib/types/ink/root.d.ts +8 -0
- package/lib/types/ink/root.d.ts.map +1 -1
- package/lib/types/ink/root.js +12 -3
- package/lib/types/ink/screen.d.ts +11 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +44 -0
- package/lib/types/ink/selection.d.ts +7 -2
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +187 -44
- package/lib/types/ink/shutdown-input.d.ts +15 -0
- package/lib/types/ink/shutdown-input.d.ts.map +1 -0
- package/lib/types/ink/shutdown-input.js +28 -0
- package/lib/types/ink/sixel-cursor-heal.d.ts +21 -0
- package/lib/types/ink/sixel-cursor-heal.d.ts.map +1 -0
- package/lib/types/ink/sixel-cursor-heal.js +62 -0
- package/lib/types/ink/sixel-graphics.d.ts +6 -0
- package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
- package/lib/types/ink/sixel-graphics.js +18 -0
- package/lib/types/ink/styles.d.ts +8 -1
- package/lib/types/ink/styles.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.d.ts +195 -0
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -0
- package/lib/types/ink/terminal-notification-windows.js +433 -0
- package/lib/types/ink/terminal-notification.d.ts +3 -1
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +4 -1
- package/lib/types/ink/terminal-querier.d.ts +9 -1
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +32 -1
- package/lib/types/ink/terminal.d.ts +23 -2
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +32 -2
- package/lib/types/ink/termio/osc.d.ts +2 -1
- package/lib/types/ink/termio/osc.d.ts.map +1 -1
- package/lib/types/ink/termio/osc.js +37 -8
- package/lib/types/ink/termio/osc7501.d.ts +102 -0
- package/lib/types/ink/termio/osc7501.d.ts.map +1 -0
- package/lib/types/ink/termio/osc7501.js +229 -0
- package/lib/types/ink/termio/tokenize.js +5 -7
- package/lib/types/panels.d.ts +1 -1
- package/lib/types/panels.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.d.ts +3 -1
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +5 -1
- package/lib/types/screens/Chat.d.ts +6 -6
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +304 -111
- package/lib/types/screens/Launchpad.d.ts +8 -2
- package/lib/types/screens/Launchpad.d.ts.map +1 -1
- package/lib/types/screens/Launchpad.js +32 -12
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +31 -21
- package/lib/types/screens/Settings.d.ts +5 -1
- package/lib/types/screens/Settings.d.ts.map +1 -1
- package/lib/types/screens/Settings.js +528 -51
- package/lib/types/screens/StatusLine.d.ts +9 -3
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +91 -15
- package/lib/types/screens/StatusMetrics.d.ts +2 -11
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
- package/lib/types/screens/StatusMetrics.js +20 -14
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +13 -21
- package/lib/types/sessionMounts.d.ts +14 -0
- package/lib/types/sessionMounts.d.ts.map +1 -1
- package/lib/types/sessionMounts.js +20 -9
- package/lib/types/sessions/format.d.ts +39 -0
- package/lib/types/sessions/format.d.ts.map +1 -1
- package/lib/types/sessions/format.js +83 -0
- package/lib/types/sessions/resumeFailure.d.ts +4 -0
- package/lib/types/sessions/resumeFailure.d.ts.map +1 -1
- package/lib/types/sessions/resumeFailure.js +12 -4
- package/lib/types/sessions/workspaceCounts.d.ts +6 -0
- package/lib/types/sessions/workspaceCounts.d.ts.map +1 -0
- package/lib/types/sessions/workspaceCounts.js +24 -0
- package/lib/types/settings/definitions.d.ts +24 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +38 -13
- package/lib/types/tips.js +2 -2
- package/lib/types/tuiDisplayPrefs.d.ts +113 -5
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +276 -14
- package/lib/types/update.d.ts +46 -36
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +248 -157
- package/lib/types/updateProcess.d.ts +28 -0
- package/lib/types/updateProcess.d.ts.map +1 -0
- package/lib/types/updateProcess.js +135 -0
- package/lib/types/utils/inputWordBoundary.d.ts +5 -0
- package/lib/types/utils/inputWordBoundary.d.ts.map +1 -0
- package/lib/types/utils/inputWordBoundary.js +18 -0
- package/lib/types/utils/keymap.d.ts +1 -1
- package/lib/types/utils/keymap.d.ts.map +1 -1
- package/lib/types/utils/keymap.js +6 -1
- package/lib/types/windowsInstaller.d.ts +4 -0
- package/lib/types/windowsInstaller.d.ts.map +1 -0
- package/lib/types/windowsInstaller.js +237 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +127 -111
- package/presets/liangshen/custom-bash.mjs +13 -1
- package/presets/liangshen/instruction-hint.mjs +4 -1
- package/presets/liangshen/skill-search.mjs +14 -2
- package/presets/winbash.mjs +16 -4
- package/tui-profile/feed/README.md +17 -8
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -7,6 +7,7 @@ import Schema from '@deepseek-ai/schemastery';
|
|
|
7
7
|
import { Config } from './index.js';
|
|
8
8
|
import { configValues, createSettingsScope, resolveSettingsNamespace } from './compat/settings.js';
|
|
9
9
|
import { createChannel } from './channel.js';
|
|
10
|
+
import { channelOwnerCurrent } from './channel/owner.js';
|
|
10
11
|
import { createDshSession } from './backend/session.js';
|
|
11
12
|
import { createTuiSettingsService } from './tui-settings.js';
|
|
12
13
|
import { EDITABLE_CONFIG_KEYS } from '../settings/definitions.js';
|
|
@@ -24,8 +25,11 @@ import { registerTuiChannel } from '../adapter/channel/host-registry.js';
|
|
|
24
25
|
import { createChildStderrReporter, installChildStderrGuard } from './childStderr.js';
|
|
25
26
|
import { removeClipboardImageDir } from '../utils/clipboard.js';
|
|
26
27
|
import { appendCrashLog, serializeCrashDetail, unserializableCrashDetail } from '../utils/crashDetail.js';
|
|
28
|
+
import { pluginManagerOf } from './plugin-manager.js';
|
|
27
29
|
import { logForDebugging } from '../utils/debug.js';
|
|
28
30
|
import { createTerminalNotifier } from '../ink/terminal-notification.js';
|
|
31
|
+
import { getTerminalFocused } from '../ink/terminal-focus-state.js';
|
|
32
|
+
import { resolveNotificationMethod } from '../ink/terminal.js';
|
|
29
33
|
import { isEnvTruthy } from '../utils/envUtils.js';
|
|
30
34
|
import { QuestionStore, bindQuestionStore } from './questions.js';
|
|
31
35
|
import { prepareQuestionAnswerer } from './questions-answerer.js';
|
|
@@ -54,7 +58,7 @@ import { shouldOfferOnboarding } from '../onboardingPrefs.js';
|
|
|
54
58
|
import { resolveSessionCwd } from '../utils/workspaceRoot.js';
|
|
55
59
|
import { LAUNCH_PROMPT_SENT_ENV, beginRestartAttempt, checkForTuiUpdate, installedTuiVersion, isBootDeadlockTarget, isStandaloneRuntime, isVersionNewer, logRestartEvent, resolveDshProfileName, resolveTuiUpdateTarget, restartTui, updateTuiAndRestart, writeHandoffNotice, writeLastRunRecord } from '../update.js';
|
|
56
60
|
import { getLang, isLang, resolveStartupLang, setLang, t, writeLangPref } from '../i18n.js';
|
|
57
|
-
import { applyBtwContextBudget, applyBtwContextTurns, applyCodeFrameStyle, applyCompanionSkin, applyImageBacking, applyMathImageBacking, applyMathImageScale, applyMathRendering, applyMermaidDiagrams, applyPageMargin, applySidePanelOpen, applySidePanelRatio, applySidePanelSplitEnabled, BTW_CONTEXT_BUDGET_MAX, BTW_CONTEXT_BUDGET_MIN, BTW_CONTEXT_TURNS_MAX, BTW_CONTEXT_TURNS_MIN, DEFAULT_PAGE_MARGIN,
|
|
61
|
+
import { applyBtwContextBudget, applyBtwContextTurns, applyCodeFrameStyle, applyCompanionSkin, applyImageBacking, applyMathImageBacking, applyMathImageScale, applyMathRendering, applyMermaidDiagrams, applyPageMargin, applySidePanelOpen, applySidePanelPanels, applySidePanelRatio, applySidePanelSplitEnabled, ALL_SIDE_PANELS, BTW_CONTEXT_BUDGET_MAX, BTW_CONTEXT_BUDGET_MIN, BTW_CONTEXT_TURNS_MAX, BTW_CONTEXT_TURNS_MIN, DEFAULT_PAGE_MARGIN, DEFAULT_STATUS_BAR, isPageMarginMode, normalizeJobGroupFold, normalizePageMargin, normalizeScrollGutter, normalizeSidePanelPanels, normalizePluginFieldsOrder, normalizeStatusBar, normalizeToolBackground, parsePageMarginSpec, parsePluginFieldsOrder, parseSidePanelPanels, resolveMathRendering } from '../tuiDisplayPrefs.js';
|
|
58
62
|
import { draftComboConflicts, effectiveComboString, parseComboDraft, setKeymapOverrides, SHORTCUT_ACTIONS, } from '../utils/keymap.js';
|
|
59
63
|
import { attachHerdrIntegration } from '../herdr.js';
|
|
60
64
|
import { logMouseDebug } from '../utils/debug.js';
|
|
@@ -74,11 +78,10 @@ import { getHostShortcuts } from './shortcuts.js';
|
|
|
74
78
|
import { getHostThemes } from './themes.js';
|
|
75
79
|
import { attachSessionToWorkspace } from './workspace.js';
|
|
76
80
|
import { createLocalWorkspaceRuntime, getHostWorkspaceRuntime } from './workspaces.js';
|
|
77
|
-
import {
|
|
81
|
+
import { trackHostSettingsSection } from './settings-sections.js';
|
|
78
82
|
import { compositionRoot, withHostRootCapability } from './host-access.js';
|
|
79
83
|
import { armAdmissionLoader } from './admission-loader.js';
|
|
80
84
|
import { assembleBackendsFromProfile } from './backend-assembly.js';
|
|
81
|
-
import { applyConfiguredSidePanelPanels, applySidePanelPanelsFromSettings } from './panels.js';
|
|
82
85
|
import { disposeRootSettled } from './root-dispose.js';
|
|
83
86
|
import { render, ThemeProvider, AlternateScreen } from '../ui.js';
|
|
84
87
|
import { PageMargin } from '../components/PageMargin.js';
|
|
@@ -86,8 +89,9 @@ import { normalizeSplashFont } from '../components/splashFonts.js';
|
|
|
86
89
|
import { normalizeBrandSetting, resolveBrand, setActiveBrand } from '../branding.js';
|
|
87
90
|
import { SETTING_GROUPS, SHORTCUT_FIELD_META, settingField } from '../settings/definitions.js';
|
|
88
91
|
import instances from '../ink/instances.js';
|
|
92
|
+
import { getShutdownInput } from '../ink/shutdown-input.js';
|
|
89
93
|
import { cursorMove, DISABLE_KITTY_KEYBOARD, DISABLE_MODIFY_OTHER_KEYS, DISABLE_WIN32_INPUT_MODE } from '../ink/termio/csi.js';
|
|
90
|
-
import { DBP, DFE, DISABLE_MOUSE_TRACKING, EXIT_ALT_SCREEN, SHOW_CURSOR } from '../ink/termio/dec.js';
|
|
94
|
+
import { DBP, DFE, DISABLE_MOUSE_TRACKING, ESU, EXIT_ALT_SCREEN, SHOW_CURSOR } from '../ink/termio/dec.js';
|
|
91
95
|
import { CLEAR_ITERM2_PROGRESS, CLEAR_TAB_STATUS, supportsTabStatus, wrapForMultiplexer } from '../ink/termio/osc.js';
|
|
92
96
|
import { addProcessErrorAbsorber, fatalReasonForExit, registerProcessGuardFatalSink } from '../ink/update-overflow-guard.js';
|
|
93
97
|
import { CHANNEL_UI_LIFETIME_ENDED } from '../adapter/channel/ui.js';
|
|
@@ -153,10 +157,153 @@ export function resolveTuiHostMode(stdoutIsTTY = process.stdout.isTTY === true,
|
|
|
153
157
|
const explicitTuiLaunch = env.DSH_TUI_LAUNCHER_VERSION !== undefined || isStandaloneRuntime();
|
|
154
158
|
return explicitTuiLaunch ? 'invalid-explicit-launch' : 'headless-host';
|
|
155
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Create the live task-notification settings around a notifier.
|
|
162
|
+
*
|
|
163
|
+
* The notifier holds the values for the terminal path, and the Windows branch
|
|
164
|
+
* needs the same two before it can decide whether to spawn anything. One writer
|
|
165
|
+
* keeps them in step - `applyDisplay` is the second caller, for a live /settings
|
|
166
|
+
* edit.
|
|
167
|
+
* @param notifier - The terminal notifier to configure.
|
|
168
|
+
* @param initial - The values this launch starts with.
|
|
169
|
+
* @returns The settings and the single function that changes them.
|
|
170
|
+
*/
|
|
171
|
+
export function createTaskNotificationSettings(notifier, initial) {
|
|
172
|
+
const settings = { ...initial };
|
|
173
|
+
return {
|
|
174
|
+
settings,
|
|
175
|
+
configure(condition, method) {
|
|
176
|
+
settings.condition = condition ?? 'unfocused';
|
|
177
|
+
settings.method = method ?? 'auto';
|
|
178
|
+
notifier.configure(condition, method);
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Ring the terminal for a completion the host's gate already approved.
|
|
184
|
+
*
|
|
185
|
+
* The gate asks whether the terminal is focused; this port runs after the toast's
|
|
186
|
+
* await, which is up to 30 s of PowerShell. Asking the focus question a second
|
|
187
|
+
* time here would drop the bell for a user who came back to the terminal in that
|
|
188
|
+
* window - while the log had already reported it rung (AC-5). The decision
|
|
189
|
+
* travels in instead. `notify()` is synchronous, so the override covers exactly
|
|
190
|
+
* this call.
|
|
191
|
+
* @param notifier - The terminal notifier the host configured.
|
|
192
|
+
* @param settings - The live settings the decision was taken from.
|
|
193
|
+
* @param title - The localized title.
|
|
194
|
+
* @param message - The single-line summary; empty rings for the title alone.
|
|
195
|
+
*/
|
|
196
|
+
export function ringTaskCompletion(notifier, settings, title, message) {
|
|
197
|
+
// A later explicit off still cancels sound; merely regaining focus does not.
|
|
198
|
+
notifier.configure(settings.condition === 'unfocused' ? 'always' : settings.condition, 'bel');
|
|
199
|
+
try {
|
|
200
|
+
notifier.notify(title, message);
|
|
201
|
+
}
|
|
202
|
+
finally {
|
|
203
|
+
notifier.configure(settings.condition, settings.method);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Show one task-completion toast and answer for what it did.
|
|
208
|
+
*
|
|
209
|
+
* Exactly one answer reaches the terminal path: `unavailable` rings the bell
|
|
210
|
+
* (AC-5), because the alternative is a notification the user never learns
|
|
211
|
+
* about. `shown` is already delivered and `yielded` belongs to the external
|
|
212
|
+
* notifier (D8/AC-6) — ringing after either would remind the user twice.
|
|
213
|
+
*
|
|
214
|
+
* The transport is a parameter so the regression can drive all three answers
|
|
215
|
+
* without a toast, a registry write or a child process.
|
|
216
|
+
* @param title - The localized title.
|
|
217
|
+
* @param message - The single-line summary; empty shows the title alone.
|
|
218
|
+
* @param backendId - The session that completed; a DSH plugin only covers DSH events.
|
|
219
|
+
* @param delivery - The toast port, and the terminal path to fall back to.
|
|
220
|
+
*/
|
|
221
|
+
export async function deliverTaskCompletionOnWindows(title, message, backendId, delivery) {
|
|
222
|
+
let externalNotifierActive = false;
|
|
223
|
+
if (backendId === 'dsh' && delivery.pluginManager !== undefined) {
|
|
224
|
+
try {
|
|
225
|
+
const plugins = await delivery.pluginManager.listPlugins();
|
|
226
|
+
externalNotifierActive = plugins.some(plugin => plugin.enabled && plugin.fiberPhase === 'active'
|
|
227
|
+
&& ['@baobaolaodie/cc-dsh-notifier', 'cc-dsh-notifier'].includes(plugin.moduleName));
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
logForDebugging('external notifier inventory unavailable; using the built-in Windows notification');
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const result = await delivery.toast({
|
|
234
|
+
title,
|
|
235
|
+
message,
|
|
236
|
+
externalNotifierActive,
|
|
237
|
+
canDispatch: delivery.canDispatch,
|
|
238
|
+
});
|
|
239
|
+
if (result.status !== 'unavailable' || delivery.canDispatch?.() === false)
|
|
240
|
+
return;
|
|
241
|
+
// AC-5 wants the bell, not a silent loss - and the reason is what makes the
|
|
242
|
+
// pair "toast missing + bell rang" explainable afterwards. Ring first, then
|
|
243
|
+
// report: the port rings for a completion the gate already approved, and a line
|
|
244
|
+
// written ahead of the action is how the fallback came to log a bell that a
|
|
245
|
+
// second look at the focus had eaten.
|
|
246
|
+
const cause = result.detail === undefined ? result.reason : `${result.reason}: ${result.detail}`;
|
|
247
|
+
delivery.terminal(title, message);
|
|
248
|
+
logForDebugging(`windows toast unavailable (${cause}); using the terminal fallback`);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The production toast port. The Windows module is imported on first use and
|
|
252
|
+
* never at load time, so this path does not pull it in on a host that never
|
|
253
|
+
* delivers a toast. A load that fails answers like any other unavailable
|
|
254
|
+
* transport instead of throwing: this path is fire-and-forget, and the caller
|
|
255
|
+
* still has the bell.
|
|
256
|
+
*/
|
|
257
|
+
async function showWindowsToast(input) {
|
|
258
|
+
try {
|
|
259
|
+
const { notifyWindowsToast } = await import('../ink/terminal-notification-windows.js');
|
|
260
|
+
return await notifyWindowsToast(input);
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
264
|
+
logForDebugging(`windows toast transport failed to load (${detail})`);
|
|
265
|
+
return { status: 'unavailable', reason: 'unexpected', detail };
|
|
266
|
+
}
|
|
267
|
+
}
|
|
156
268
|
export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOptions = {}) {
|
|
157
269
|
const config = configValues(runtimeConfig);
|
|
158
270
|
const taskNotifier = createTerminalNotifier(process.stdout);
|
|
159
|
-
|
|
271
|
+
const { settings: notificationSettings, configure: configureTaskNotifications } = createTaskNotificationSettings(taskNotifier, {
|
|
272
|
+
condition: config.taskNotifications ?? 'unfocused',
|
|
273
|
+
method: config.notificationMethod ?? 'auto',
|
|
274
|
+
});
|
|
275
|
+
configureTaskNotifications(config.taskNotifications, config.notificationMethod);
|
|
276
|
+
/**
|
|
277
|
+
* Whether a task completion is announced at all: the one gate, asked before
|
|
278
|
+
* the Windows transport so a suppressed notification never costs a PowerShell
|
|
279
|
+
* process, and so a delivered toast never also rings the bell. The Windows
|
|
280
|
+
* fallback re-enters through `ringTaskCompletion`, which carries this answer
|
|
281
|
+
* instead of asking the focus question again after the awaits. Explicit off or
|
|
282
|
+
* owner release revokes pending dispatch; an already started host is not recalled.
|
|
283
|
+
*/
|
|
284
|
+
const taskCompletionAlertsEnabled = () => process.stdout.isTTY === true
|
|
285
|
+
&& notificationSettings.condition !== 'off'
|
|
286
|
+
&& !(notificationSettings.condition === 'unfocused' && getTerminalFocused());
|
|
287
|
+
/**
|
|
288
|
+
* Announce a finished task: the channel's `onTaskComplete` payload and gate,
|
|
289
|
+
* with the Windows method resolved first (`auto` picks the toast there, D2).
|
|
290
|
+
*/
|
|
291
|
+
const announceTaskCompletion = (preview, backendId) => {
|
|
292
|
+
if (!taskCompletionAlertsEnabled())
|
|
293
|
+
return;
|
|
294
|
+
const title = t('task-complete-notification');
|
|
295
|
+
const message = preview ?? '';
|
|
296
|
+
if (resolveNotificationMethod(notificationSettings.method, process.platform) !== 'windows') {
|
|
297
|
+
taskNotifier.notify(title, message);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
void deliverTaskCompletionOnWindows(title, message, backendId, {
|
|
301
|
+
pluginManager: pluginManagerOf(ctx),
|
|
302
|
+
canDispatch: () => channelOwnerCurrent(rawChannel) && notificationSettings.condition !== 'off',
|
|
303
|
+
toast: showWindowsToast,
|
|
304
|
+
terminal: (fallbackTitle, fallbackMessage) => ringTaskCompletion(taskNotifier, notificationSettings, fallbackTitle, fallbackMessage),
|
|
305
|
+
});
|
|
306
|
+
};
|
|
160
307
|
// /restart handoff diagnosis: the replacement process is marked by env and
|
|
161
308
|
// logs its boot progress to ~/.dsh-tui/restart.log (ordinary launches stay
|
|
162
309
|
// silent). First line lands before anything in this function can throw.
|
|
@@ -824,7 +971,7 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
824
971
|
settingsNs: tuiSettingsNs,
|
|
825
972
|
onTaskComplete: preview => {
|
|
826
973
|
if (!shadow)
|
|
827
|
-
|
|
974
|
+
announceTaskCompletion(preview, rawChannel.sessionRef.backendId);
|
|
828
975
|
},
|
|
829
976
|
settingsService: tuiSettings,
|
|
830
977
|
// The backend reports its model with its first turn (`system/init`);
|
|
@@ -1006,9 +1153,9 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1006
1153
|
applySidePanelSplitEnabled(config.sidePanel?.splitEnabled);
|
|
1007
1154
|
applySidePanelOpen(config.sidePanel?.open);
|
|
1008
1155
|
applySidePanelRatio(config.sidePanel?.ratio);
|
|
1009
|
-
//
|
|
1010
|
-
//
|
|
1011
|
-
|
|
1156
|
+
// The stored value only: `*` (the default) lets the registry supply the
|
|
1157
|
+
// plugin panels, so no registration-time merge is needed (issue #1662).
|
|
1158
|
+
applySidePanelPanels(config.sidePanel?.panels);
|
|
1012
1159
|
applyCompanionSkin(config.companion?.skin);
|
|
1013
1160
|
applyBtwContextTurns(config.btw?.contextTurns);
|
|
1014
1161
|
applyBtwContextBudget(config.btw?.contextBudget);
|
|
@@ -1091,7 +1238,9 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1091
1238
|
// Same no-default rule: applyDisplay resolves `?? config.smoothStreaming ?? true`.
|
|
1092
1239
|
smoothStreaming: Schema.boolean(),
|
|
1093
1240
|
taskNotifications: Schema.union(['off', 'unfocused', 'always']),
|
|
1094
|
-
|
|
1241
|
+
// Must mirror Config's union (`src/dsh-adapter/index.ts`): a method
|
|
1242
|
+
// missing here is rejected by /settings and never reaches the runtime.
|
|
1243
|
+
notificationMethod: Schema.union(['auto', 'osc9', 'bel', 'windows']),
|
|
1095
1244
|
// Same no-default rule: applyDisplay resolves `?? config.mermaidDiagrams ?? true`.
|
|
1096
1245
|
mermaidDiagrams: Schema.boolean(),
|
|
1097
1246
|
// Code-frame shape; unset keeps the light rail frame.
|
|
@@ -1129,6 +1278,8 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1129
1278
|
activity: Schema.boolean().default(DEFAULT_STATUS_BAR.activity),
|
|
1130
1279
|
trajectory: Schema.boolean().default(DEFAULT_STATUS_BAR.trajectory),
|
|
1131
1280
|
shortcutHint: Schema.boolean().default(DEFAULT_STATUS_BAR.shortcutHint),
|
|
1281
|
+
pluginFields: Schema.boolean().default(DEFAULT_STATUS_BAR.pluginFields),
|
|
1282
|
+
pluginFieldsOrder: Schema.string().default(DEFAULT_STATUS_BAR.pluginFieldsOrder),
|
|
1132
1283
|
}).default({ ...DEFAULT_STATUS_BAR }),
|
|
1133
1284
|
// Side-panel preferences. No schema defaults on purpose (same rule as
|
|
1134
1285
|
// foldTerminalCommand/expandEditor above): a default here would come
|
|
@@ -1248,9 +1399,6 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1248
1399
|
}
|
|
1249
1400
|
bootedTerminalImages = lastBootedTerminalImages ?? value.terminalImages ?? config.terminalImages ?? true;
|
|
1250
1401
|
};
|
|
1251
|
-
/** False only during the boot application below: a registered panel absent
|
|
1252
|
-
* from its CSV is not a user removal (./panels.ts). */
|
|
1253
|
-
let settingsEditsLive = true;
|
|
1254
1402
|
// The /settings language field writes `lang` through the settings
|
|
1255
1403
|
// service (user layer): apply it live and mirror it to lang.json so
|
|
1256
1404
|
// the /lang command and next-boot resolution agree. DSH_TUI_LANG
|
|
@@ -1282,7 +1430,7 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1282
1430
|
channel.setPromptSessionLabel(value.promptSessionLabel ?? config.promptSessionLabel ?? false);
|
|
1283
1431
|
channel.setExpandEditor(value.expandEditor ?? config.expandEditor ?? true);
|
|
1284
1432
|
channel.setSmoothStreaming(value.smoothStreaming ?? config.smoothStreaming ?? true);
|
|
1285
|
-
|
|
1433
|
+
configureTaskNotifications(value.taskNotifications ?? config.taskNotifications, value.notificationMethod ?? config.notificationMethod);
|
|
1286
1434
|
applyMermaidDiagrams(value.mermaidDiagrams ?? config.mermaidDiagrams);
|
|
1287
1435
|
applyCodeFrameStyle(value.codeFrameStyle ?? config.codeFrameStyle);
|
|
1288
1436
|
applyMathRendering(resolveMathRendering(value, config));
|
|
@@ -1297,12 +1445,9 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1297
1445
|
applySidePanelSplitEnabled(value.sidePanel?.splitEnabled ?? config.sidePanel?.splitEnabled);
|
|
1298
1446
|
applySidePanelOpen(value.sidePanel?.open ?? config.sidePanel?.open);
|
|
1299
1447
|
applySidePanelRatio(value.sidePanel?.ratio ?? config.sidePanel?.ratio);
|
|
1300
|
-
//
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
applySidePanelPanelsFromSettings(panelsCsv);
|
|
1304
|
-
else
|
|
1305
|
-
applyConfiguredSidePanelPanels(panelsCsv);
|
|
1448
|
+
// The stored value only: registration never rewrites it, so every apply
|
|
1449
|
+
// (boot or live, same CSV or a new one) is idempotent (issue #1662).
|
|
1450
|
+
applySidePanelPanels(value.sidePanel?.panels ?? config.sidePanel?.panels);
|
|
1306
1451
|
applyCompanionSkin(value.companion?.skin ?? config.companion?.skin);
|
|
1307
1452
|
applyBtwContextTurns(value.btw?.contextTurns ?? config.btw?.contextTurns);
|
|
1308
1453
|
applyBtwContextBudget(value.btw?.contextBudget ?? config.btw?.contextBudget);
|
|
@@ -1331,13 +1476,27 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1331
1476
|
// re-apply — unrelated settings edits must not disturb a live /effort
|
|
1332
1477
|
// choice mid-session.
|
|
1333
1478
|
let lastEffortDefault = undefined;
|
|
1479
|
+
/** True only while boot's first settings snapshot is applied: a capability
|
|
1480
|
+
* backend restores its own effort at boot, and that first apply must not
|
|
1481
|
+
* overwrite it (#1688). */
|
|
1482
|
+
let bootApplication = false;
|
|
1334
1483
|
const applyEffortDefault = (value) => {
|
|
1335
1484
|
const next = value.effortDefault ?? null;
|
|
1336
1485
|
if (next === lastEffortDefault)
|
|
1337
1486
|
return;
|
|
1338
|
-
lastEffortDefault = next;
|
|
1339
1487
|
const level = next === null || next === 'auto' ? undefined : next;
|
|
1340
|
-
|
|
1488
|
+
// Capability backends restore their own effort. Boot is not a live edit:
|
|
1489
|
+
// Auto and resumed sessions keep that selection until the user changes it.
|
|
1490
|
+
const preserve = bootApplication && backendStart !== undefined && (level === undefined || backendStart.resumedSessionId !== undefined);
|
|
1491
|
+
if (!preserve && backendStart !== undefined && !channel.ready) {
|
|
1492
|
+
lastEffortDefault = undefined;
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
if (!preserve && channel.setDefaultEffort(level) === false) {
|
|
1496
|
+
lastEffortDefault = undefined;
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
lastEffortDefault = next;
|
|
1341
1500
|
};
|
|
1342
1501
|
const apply = (next) => {
|
|
1343
1502
|
applyLayout(next);
|
|
@@ -1376,9 +1535,30 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1376
1535
|
notifyChannel(t('settings-fullscreen-migrated'), { color: 'warning' });
|
|
1377
1536
|
}
|
|
1378
1537
|
const { fullscreen: staleFullscreen, ...migratedSettings } = bootSettings;
|
|
1379
|
-
|
|
1538
|
+
bootApplication = true;
|
|
1380
1539
|
apply(fullscreenMigration === 'unset' ? migratedSettings : bootSettings);
|
|
1381
|
-
|
|
1540
|
+
bootApplication = false;
|
|
1541
|
+
if (backendStart !== undefined)
|
|
1542
|
+
settingsCtx.effect(() => {
|
|
1543
|
+
let active = true;
|
|
1544
|
+
let generation = channel.ready ? channel.agentBindingGeneration : undefined;
|
|
1545
|
+
const stop = channel.subscribe(() => {
|
|
1546
|
+
if (!channel.ready || (lastEffortDefault !== undefined && generation === channel.agentBindingGeneration))
|
|
1547
|
+
return;
|
|
1548
|
+
// Adoption publishes several synchronous updates before its binding generation.
|
|
1549
|
+
queueMicrotask(() => {
|
|
1550
|
+
if (!active || !channel.ready)
|
|
1551
|
+
return;
|
|
1552
|
+
if (generation !== undefined && generation !== channel.agentBindingGeneration) {
|
|
1553
|
+
lastEffortDefault = scope.get().effortDefault ?? null;
|
|
1554
|
+
}
|
|
1555
|
+
generation = channel.agentBindingGeneration;
|
|
1556
|
+
if (lastEffortDefault === undefined)
|
|
1557
|
+
applyEffortDefault(scope.get());
|
|
1558
|
+
});
|
|
1559
|
+
});
|
|
1560
|
+
return () => { active = false; stop(); };
|
|
1561
|
+
});
|
|
1382
1562
|
let lastTerminalImages = bootSettings.terminalImages ?? config.terminalImages ?? true;
|
|
1383
1563
|
let lastLaunchpad = bootSettings.launchpad ?? config.launchpad ?? true;
|
|
1384
1564
|
settingsCtx.effect(() => scope.watch(next => {
|
|
@@ -1440,12 +1620,11 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1440
1620
|
// dsh-tui-* host-seam insert list right after load (issue #557), which
|
|
1441
1621
|
// left this registration silently skipped and /settings read-only.
|
|
1442
1622
|
// channel.ts reads through the same fallback, so both sides meet in the
|
|
1443
|
-
// same registry either way
|
|
1444
|
-
//
|
|
1445
|
-
//
|
|
1446
|
-
|
|
1623
|
+
// same registry either way — but which registry that is can still change
|
|
1624
|
+
// after this registration: the service row may activate later, or reload
|
|
1625
|
+
// into an empty state. trackHostSettingsSection follows it, so the section
|
|
1626
|
+
// never strands in the registry /settings stopped reading.
|
|
1447
1627
|
{
|
|
1448
|
-
let settingsSections = getHostSettingsSections(ctx.get('tuiSettingsSections')) ?? getLocalSettingsSectionsHost(ctx);
|
|
1449
1628
|
const tuiSection = {
|
|
1450
1629
|
ns: tuiSettingsNs,
|
|
1451
1630
|
title: 'dsh-tui',
|
|
@@ -1587,11 +1766,12 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1587
1766
|
},
|
|
1588
1767
|
{
|
|
1589
1768
|
...settingField('effortDefault'),
|
|
1769
|
+
optionsSource: 'effort',
|
|
1590
1770
|
format(value) {
|
|
1591
1771
|
// Unset in settings.yaml: show what a boot would actually start
|
|
1592
1772
|
// on (the persisted /effort choice → the cordis effort default)
|
|
1593
1773
|
// instead of a misleading blank.
|
|
1594
|
-
if (value === undefined || value === null
|
|
1774
|
+
if (value === undefined || value === null) {
|
|
1595
1775
|
return readEffortPref() ?? config.effort ?? 'auto';
|
|
1596
1776
|
}
|
|
1597
1777
|
return String(value);
|
|
@@ -1652,6 +1832,28 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1652
1832
|
{
|
|
1653
1833
|
...settingField('statusBar.shortcutHint'),
|
|
1654
1834
|
},
|
|
1835
|
+
{
|
|
1836
|
+
...settingField('statusBar.pluginFields'),
|
|
1837
|
+
},
|
|
1838
|
+
{
|
|
1839
|
+
...settingField('statusBar.pluginFieldsOrder'),
|
|
1840
|
+
// An empty draft means "show none" here, not the editor's default
|
|
1841
|
+
// "clear" (which would fall back to `*` and silently re-show every
|
|
1842
|
+
// field). `*` stays reachable by typing it, and an illegal shape
|
|
1843
|
+
// (`a`, `a;b`, a duplicate key) blocks the save instead of being
|
|
1844
|
+
// normalized into something the user did not ask for.
|
|
1845
|
+
parse(text) {
|
|
1846
|
+
return parsePluginFieldsOrder(text).mode === 'invalid'
|
|
1847
|
+
? undefined
|
|
1848
|
+
: { kind: 'set', value: normalizePluginFieldsOrder(text) };
|
|
1849
|
+
},
|
|
1850
|
+
// Unset in the user layer: show the value the footer actually uses
|
|
1851
|
+
// (the schema default, `*`) instead of a blank row that would read
|
|
1852
|
+
// as "none" next to the all-unchecked boxes.
|
|
1853
|
+
format(value) {
|
|
1854
|
+
return normalizePluginFieldsOrder(value);
|
|
1855
|
+
},
|
|
1856
|
+
},
|
|
1655
1857
|
{
|
|
1656
1858
|
...settingField('sidePanel.splitEnabled'),
|
|
1657
1859
|
format(value) {
|
|
@@ -1689,24 +1891,28 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1689
1891
|
},
|
|
1690
1892
|
{
|
|
1691
1893
|
...settingField('sidePanel.panels'),
|
|
1692
|
-
placeholder:
|
|
1894
|
+
placeholder: ALL_SIDE_PANELS,
|
|
1693
1895
|
format(value) {
|
|
1694
|
-
//
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1896
|
+
// Project what the store actually uses: a hand-edited value with
|
|
1897
|
+
// an unusable token must not read differently here than it does
|
|
1898
|
+
// in the PanelBar, so it is normalized exactly like the store
|
|
1899
|
+
// normalizes it. Unset in the user layer: the effective config
|
|
1900
|
+
// value (`*` by default), which the picker reads as "everything
|
|
1901
|
+
// checked".
|
|
1902
|
+
return normalizeSidePanelPanels(typeof value === 'string' && value.trim() !== '' ? value : config.sidePanel?.panels);
|
|
1698
1903
|
},
|
|
1699
1904
|
parse(text) {
|
|
1700
|
-
const
|
|
1701
|
-
if (
|
|
1905
|
+
const parsed = parseSidePanelPanels(text);
|
|
1906
|
+
if (parsed.mode === 'empty')
|
|
1702
1907
|
return { kind: 'clear' };
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
//
|
|
1706
|
-
|
|
1707
|
-
|
|
1908
|
+
if (parsed.mode === 'all')
|
|
1909
|
+
return { kind: 'set', value: ALL_SIDE_PANELS };
|
|
1910
|
+
// Strict gate: a malformed token (or a list embedding `*`, or a
|
|
1911
|
+
// temporary address no later run could honour) is refused instead
|
|
1912
|
+
// of saved as something else.
|
|
1913
|
+
if (parsed.mode === 'invalid')
|
|
1708
1914
|
return undefined;
|
|
1709
|
-
return { kind: 'set', value:
|
|
1915
|
+
return { kind: 'set', value: parsed.ids.join(',') };
|
|
1710
1916
|
},
|
|
1711
1917
|
},
|
|
1712
1918
|
{
|
|
@@ -1785,16 +1991,8 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1785
1991
|
},
|
|
1786
1992
|
],
|
|
1787
1993
|
};
|
|
1788
|
-
|
|
1789
|
-
ctx.effect(() => () => {
|
|
1790
|
-
rehomeSettingsSection = () => {
|
|
1791
|
-
const service = getHostSettingsSections(ctx.get('tuiSettingsSections'));
|
|
1792
|
-
if (service === undefined || service === settingsSections)
|
|
1793
|
-
return;
|
|
1794
|
-
unregister();
|
|
1795
|
-
settingsSections = service;
|
|
1796
|
-
unregister = service.register(tuiSection);
|
|
1797
|
-
};
|
|
1994
|
+
const disposeSection = trackHostSettingsSection(ctx, tuiSection);
|
|
1995
|
+
ctx.effect(() => () => { disposeSection(); });
|
|
1798
1996
|
}
|
|
1799
1997
|
// DSH approval seam: the permission layer asks ApprovalService.request(),
|
|
1800
1998
|
// which dispatches an `approval/request` waterfall. With no answerer the
|
|
@@ -2027,7 +2225,12 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2027
2225
|
});
|
|
2028
2226
|
}
|
|
2029
2227
|
refreshLastRunRecord();
|
|
2030
|
-
void finishExit(ctx, instance, bootedFullscreen,
|
|
2228
|
+
void finishExit(ctx, instance, bootedFullscreen,
|
|
2229
|
+
// This line is the one the user actually sees before the terminal is
|
|
2230
|
+
// handed over (the composer's toast dies with the unmount): a
|
|
2231
|
+
// mid-turn restart must say that the running turn and its queued
|
|
2232
|
+
// input are dropped, not promise a clean resume.
|
|
2233
|
+
t(channel.working ? 'restart-during-turn' : 'restart-starting'), undefined, () => runRestart(ctx, profile, handoffSessionId(), handoffHint, { kernel: backendChoice }, exitSeam));
|
|
2031
2234
|
return;
|
|
2032
2235
|
}
|
|
2033
2236
|
// Judge against the live session behind the channel (channel.agentId),
|
|
@@ -2301,12 +2504,10 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2301
2504
|
onPluginManage: createPluginManageEntry(ctx, {
|
|
2302
2505
|
profileName: profile ?? resolveDshProfileName(),
|
|
2303
2506
|
}),
|
|
2304
|
-
// `/team [status]
|
|
2305
|
-
// lifecycle flow
|
|
2507
|
+
// `/team [status]`: the live team report (team-mode.ts). The bundle switch
|
|
2508
|
+
// is `/plugin enable|disable`, which shares the lifecycle flow.
|
|
2306
2509
|
onTeamCommand: createTeamCommandEntry(ctx, {
|
|
2307
2510
|
profileName: profile ?? resolveDshProfileName(),
|
|
2308
|
-
// The host reports `unknown` when it has no version: read the installed one.
|
|
2309
|
-
kernelVersion: entrySlot?.kernelVersion === 'unknown' ? undefined : entrySlot?.kernelVersion,
|
|
2310
2511
|
}),
|
|
2311
2512
|
kernelPinned: backendPinned,
|
|
2312
2513
|
// Only a `dsh --profile <name>` launch has a profile installation for
|
|
@@ -2502,10 +2703,10 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2502
2703
|
};
|
|
2503
2704
|
/**
|
|
2504
2705
|
* Services composed after the mount: re-read what the screen took as values
|
|
2505
|
-
* at mount (Chat's stores, theme host, toast sink
|
|
2706
|
+
* at mount (Chat's stores, theme host, toast sink). The /settings section
|
|
2707
|
+
* follows its registry on its own (trackHostSettingsSection).
|
|
2506
2708
|
*/
|
|
2507
2709
|
const refreshHostServices = () => {
|
|
2508
|
-
rehomeSettingsSection();
|
|
2509
2710
|
bindToastSink();
|
|
2510
2711
|
if (!exited)
|
|
2511
2712
|
instance?.rerender(buildTree());
|
|
@@ -2938,6 +3139,7 @@ export function isExitResumable(deps) {
|
|
|
2938
3139
|
* Exported for scripts/verify-shutdown-fallback.
|
|
2939
3140
|
*/
|
|
2940
3141
|
export async function finishExit(ctx, instance, fullscreen, notice, stderrNotice, done, options = {}) {
|
|
3142
|
+
const input = options.shutdownInput ?? getShutdownInput(instance);
|
|
2941
3143
|
try {
|
|
2942
3144
|
// Resolve the Ink runtime twice: the instances map is keyed by stdout
|
|
2943
3145
|
// identity, so a replaced/overridden stdout misses it; the render()
|
|
@@ -2945,7 +3147,10 @@ export async function finishExit(ctx, instance, fullscreen, notice, stderrNotice
|
|
|
2945
3147
|
// a missed lookup skipped detachForShutdown, leaving the stdin pump,
|
|
2946
3148
|
// TTY handlers and querier alive so the self-heal probe re-wrote
|
|
2947
3149
|
// ENABLE_MOUSE_TRACKING after DISABLE_MOUSE_TRACKING had been sent).
|
|
2948
|
-
const
|
|
3150
|
+
const mapped = instances.get(input?.stdout ?? process.stdout);
|
|
3151
|
+
const fromMap = input === undefined || mapped?.shutdownInput === input
|
|
3152
|
+
? readInkShutdownState(mapped)
|
|
3153
|
+
: undefined;
|
|
2949
3154
|
const fromHandle = instance === undefined ? undefined : readInkShutdownState(instance);
|
|
2950
3155
|
// A handle that exposes neither detach hook is not an Ink runtime we can
|
|
2951
3156
|
// latch (e.g. the fake render handles in shutdown regressions) — treat it
|
|
@@ -2992,6 +3197,7 @@ export async function finishExit(ctx, instance, fullscreen, notice, stderrNotice
|
|
|
2992
3197
|
// first frame, and the old process will close the alternate screen.
|
|
2993
3198
|
const exitAlt = fullscreen && !(options.keepAltScreen === true) && ownsAltScreenExit() ? EXIT_ALT_SCREEN : '';
|
|
2994
3199
|
const cleanup = [
|
|
3200
|
+
ESU,
|
|
2995
3201
|
exitAlt,
|
|
2996
3202
|
cursor,
|
|
2997
3203
|
DISABLE_MOUSE_TRACKING,
|
|
@@ -3006,7 +3212,11 @@ export async function finishExit(ctx, instance, fullscreen, notice, stderrNotice
|
|
|
3006
3212
|
].join('');
|
|
3007
3213
|
const suffix = notice === undefined ? '' : `${notice}\n`;
|
|
3008
3214
|
const restoreFrame = options.keepAltScreen === true ? '\x1b[2J\x1b[H' : '';
|
|
3009
|
-
|
|
3215
|
+
// A replacement may already own the terminal. Its modes and frame must
|
|
3216
|
+
// survive old-root disposal; a stale exit notice also belongs to that root.
|
|
3217
|
+
if (input?.ownsInput() !== false) {
|
|
3218
|
+
await writeStream(input?.stdout ?? process.stdout, `${restoreFrame}${cleanup}\r\n${suffix}`);
|
|
3219
|
+
}
|
|
3010
3220
|
// Re-drain AFTER the cleanup sequences have landed (#507): terminal
|
|
3011
3221
|
// replies and mouse packets already in flight when the exit started
|
|
3012
3222
|
// keep arriving while cleanup is being written — the detach-time drain
|
|
@@ -3016,14 +3226,21 @@ export async function finishExit(ctx, instance, fullscreen, notice, stderrNotice
|
|
|
3016
3226
|
// environment; 50ms proved too tight there) while staying well inside
|
|
3017
3227
|
// the exit window the user already waits through.
|
|
3018
3228
|
await new Promise(resolve => setTimeout(resolve, 150));
|
|
3019
|
-
|
|
3020
|
-
|
|
3229
|
+
if (input !== undefined)
|
|
3230
|
+
input.drain();
|
|
3231
|
+
else
|
|
3232
|
+
runtime?.drainStdin?.();
|
|
3233
|
+
if (stderrNotice !== undefined && input?.ownsInput() !== false) {
|
|
3021
3234
|
await writeStream(process.stderr, `\n${stderrNotice}\n`);
|
|
3022
3235
|
}
|
|
3023
3236
|
}
|
|
3024
3237
|
catch {
|
|
3025
|
-
|
|
3238
|
+
try {
|
|
3239
|
+
ctx.logger.debug('dsh-tui: terminal cleanup failed; continuing with process shutdown');
|
|
3240
|
+
}
|
|
3241
|
+
catch { /* a failed diagnostic must not swallow the exit action */ }
|
|
3026
3242
|
}
|
|
3243
|
+
input?.release();
|
|
3027
3244
|
// Filesystem-only: the exported clipboard images live in a per-process
|
|
3028
3245
|
// temp directory that nothing else removes.
|
|
3029
3246
|
removeClipboardImageDir();
|
|
@@ -3134,6 +3351,16 @@ function superviseReplacement(exitSeam, options) {
|
|
|
3134
3351
|
}
|
|
3135
3352
|
function runRestart(ctx, profile, sessionId, hint = id => resumeCommand(profile, id), options = {}, exitSeam) {
|
|
3136
3353
|
logRestartEvent('runRestart: entered, disposing cordis root');
|
|
3354
|
+
// A wedged turn makes the root dispose wait forever: the agent teardown
|
|
3355
|
+
// waits for the loop to reach quiescence, and a tool that ignores its
|
|
3356
|
+
// AbortSignal never settles (dsh-agent-loop drains every dispatched tool on
|
|
3357
|
+
// abort). Spawning the replacement then would race this process for the
|
|
3358
|
+
// session mount, so the only honest answer is the resume hint the user can
|
|
3359
|
+
// run after this process is gone.
|
|
3360
|
+
const stalled = () => {
|
|
3361
|
+
writeHandoffNotice(`\ndsh-tui restart timed out while stopping the current turn.${preservedSessionTail(sessionId, hint)}`);
|
|
3362
|
+
process.exit(1);
|
|
3363
|
+
};
|
|
3137
3364
|
disposeRootAndThen(ctx, () => {
|
|
3138
3365
|
logRestartEvent('runRestart: root disposed, starting restartTui');
|
|
3139
3366
|
const supervision = superviseReplacement(exitSeam, options);
|
|
@@ -3157,22 +3384,43 @@ function runRestart(ctx, profile, sessionId, hint = id => resumeCommand(profile,
|
|
|
3157
3384
|
writeHandoffNotice(`\ndsh-tui restart failed: ${message}.${preservedSessionTail(sessionId, hint)}`);
|
|
3158
3385
|
process.exit(1);
|
|
3159
3386
|
});
|
|
3160
|
-
});
|
|
3387
|
+
}, stalled);
|
|
3161
3388
|
}
|
|
3162
3389
|
function runUpdate(ctx, profile, sessionId, targetVersion, kernel, hint = id => resumeCommand(profile, id), exitSeam) {
|
|
3390
|
+
const recovery = preservedSessionTail(sessionId, hint);
|
|
3163
3391
|
disposeRootAndThen(ctx, () => {
|
|
3392
|
+
logRestartEvent('update: starting', { profile, targetVersion });
|
|
3393
|
+
writeHandoffNotice(`\ndsh-tui: installation starts. Check/repair an interrupted installation before resuming.${recovery}`);
|
|
3164
3394
|
if (profile === undefined) {
|
|
3165
|
-
|
|
3395
|
+
writeHandoffNotice(`\n${t('update-aborted-no-profile')}${recovery}`);
|
|
3166
3396
|
process.exit(1);
|
|
3167
3397
|
}
|
|
3168
|
-
|
|
3398
|
+
const cancellation = new AbortController();
|
|
3399
|
+
const supervision = superviseReplacement(exitSeam, {});
|
|
3400
|
+
const replacementRequest = exitSeam?.request;
|
|
3401
|
+
if (exitSeam !== undefined)
|
|
3402
|
+
exitSeam.request = () => {
|
|
3403
|
+
cancellation.abort();
|
|
3404
|
+
// Installer owns its cancellation deadline. Entry fallback disposal
|
|
3405
|
+
// must not kill this process before the owned installer tree settles.
|
|
3406
|
+
return 'supervising';
|
|
3407
|
+
};
|
|
3408
|
+
const onSpawn = supervision.onSpawn;
|
|
3409
|
+
supervision.onSpawn = child => {
|
|
3410
|
+
if (exitSeam !== undefined)
|
|
3411
|
+
exitSeam.request = replacementRequest;
|
|
3412
|
+
onSpawn?.(child);
|
|
3413
|
+
};
|
|
3414
|
+
void updateTuiAndRestart(sessionId, profile, targetVersion, kernel, supervision, cancellation.signal).then(({ updateCode, restartCode }) => {
|
|
3415
|
+
logRestartEvent('update: finished', { updateCode, restartCode });
|
|
3169
3416
|
if (updateCode !== 0) {
|
|
3170
|
-
|
|
3417
|
+
writeHandoffNotice(`\ndsh-tui update failed (exit ${updateCode}). Check/repair the installation before resuming.${preservedSessionTail(sessionId, hint)}`);
|
|
3171
3418
|
}
|
|
3172
3419
|
process.exit(restartCode);
|
|
3173
3420
|
}, updateError => {
|
|
3421
|
+
logRestartEvent('update: rejected');
|
|
3174
3422
|
const message = updateError instanceof Error ? updateError.message : String(updateError);
|
|
3175
|
-
|
|
3423
|
+
writeHandoffNotice(`\ndsh-tui update failed: ${message}. Check/repair the installation before resuming.${preservedSessionTail(sessionId, hint)}`);
|
|
3176
3424
|
process.exit(1);
|
|
3177
3425
|
});
|
|
3178
3426
|
});
|