@deepseek-harness-tui/dsh-tui 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -59
- package/bin/dsh-tui.js +46 -3
- package/cordis.patch.yml +5 -3
- package/cordis.yml +3 -2
- package/guide/dsh-tui-guide/codex-backend.en.md +2 -2
- package/guide/dsh-tui-guide/codex-backend.md +2 -2
- package/guide/dsh-tui-guide/configuration.en.md +7 -2
- package/guide/dsh-tui-guide/configuration.md +7 -2
- package/guide/dsh-tui-guide/getting-started.en.md +168 -4
- package/guide/dsh-tui-guide/getting-started.md +121 -14
- package/guide/dsh-tui-guide/interaction.en.md +11 -10
- package/guide/dsh-tui-guide/interaction.md +5 -4
- package/guide/dsh-tui-guide/user-guide.en.md +12 -6
- package/guide/dsh-tui-guide/user-guide.md +12 -6
- package/lib/settings.json +24 -8
- package/lib/types/adapter/ports/channel-ui.d.ts +10 -7
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +67 -8
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/agent/events.d.ts +14 -5
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/agent/session.d.ts +5 -0
- package/lib/types/agent/session.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.js +8 -3
- package/lib/types/backends/claude/translate/core.d.ts +2 -2
- package/lib/types/backends/claude/translate/core.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/core.js +10 -6
- package/lib/types/backends/codex/session/commands.d.ts +2 -0
- package/lib/types/backends/codex/session/commands.d.ts.map +1 -1
- package/lib/types/backends/codex/session/commands.js +8 -4
- package/lib/types/backends/codex/session/input.d.ts +11 -7
- package/lib/types/backends/codex/session/input.d.ts.map +1 -1
- package/lib/types/backends/codex/session/input.js +68 -15
- package/lib/types/backends/codex/session/session.d.ts.map +1 -1
- package/lib/types/backends/codex/session/session.js +2 -3
- package/lib/types/backends/codex/translate/presentation.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/presentation.js +5 -2
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/permissions.d.ts +15 -0
- package/lib/types/channel/permissions.d.ts.map +1 -1
- package/lib/types/channel/permissions.js +28 -0
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +89 -11
- package/lib/types/channel/questions.d.ts +45 -3
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/questions.js +43 -0
- package/lib/types/channel/sanitize.d.ts.map +1 -1
- package/lib/types/channel/sanitize.js +8 -4
- package/lib/types/channel/subagent-failure.d.ts +49 -0
- package/lib/types/channel/subagent-failure.d.ts.map +1 -0
- package/lib/types/channel/subagent-failure.js +59 -0
- package/lib/types/channel/transcript.d.ts +17 -0
- package/lib/types/channel/transcript.d.ts.map +1 -1
- package/lib/types/channel/transcript.js +35 -0
- package/lib/types/commands.js +2 -2
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +14 -10
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +61 -6
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +3 -2
- package/lib/types/components/StarPrompt.d.ts +5 -3
- package/lib/types/components/StarPrompt.d.ts.map +1 -1
- package/lib/types/components/StarPrompt.js +56 -6
- package/lib/types/components/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +1 -1
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +9 -2
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +126 -25
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -8
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +7 -4
- package/lib/types/components/questions/PlanReviewPanel.d.ts +3 -6
- package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
- package/lib/types/components/revealScope.d.ts +15 -0
- package/lib/types/components/revealScope.d.ts.map +1 -0
- package/lib/types/components/revealScope.js +17 -0
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +34 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.js +108 -7
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.js +1 -1
- package/lib/types/components/smoothReveal.d.ts +36 -6
- package/lib/types/components/smoothReveal.d.ts.map +1 -1
- package/lib/types/components/smoothReveal.js +92 -21
- package/lib/types/components/teamRoster.d.ts +6 -3
- package/lib/types/components/teamRoster.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +4 -14
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.js +26 -17
- package/lib/types/dsh-adapter/approvals.d.ts +19 -0
- package/lib/types/dsh-adapter/approvals.d.ts.map +1 -1
- package/lib/types/dsh-adapter/approvals.js +17 -1
- package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/session.js +12 -0
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +21 -4
- package/lib/types/dsh-adapter/channel/attached-context.d.ts +15 -2
- package/lib/types/dsh-adapter/channel/attached-context.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/attached-context.js +26 -3
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +3 -0
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +43 -2
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +2 -6
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.js +7 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +2 -6
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.js +3 -26
- package/lib/types/dsh-adapter/channel/emitter.js +1 -1
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +15 -4
- package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
- package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-actions.js +34 -10
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +3 -7
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +14 -5
- package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +7 -3
- package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.js +26 -9
- package/lib/types/dsh-adapter/channel/model-selection.d.ts +27 -2
- package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-selection.js +81 -37
- package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection-helpers.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection-helpers.js +4 -2
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.js +6 -2
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.js +8 -4
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +185 -36
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +55 -4
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.js +80 -16
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.js +6 -5
- package/lib/types/dsh-adapter/channel/task-completion.js +2 -10
- package/lib/types/dsh-adapter/channel/transcript.d.ts +3 -2
- package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/transcript.js +13 -4
- package/lib/types/dsh-adapter/channel/types.d.ts +11 -2
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts +11 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.js +38 -0
- package/lib/types/dsh-adapter/compat/messages.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/messages.js +2 -2
- package/lib/types/dsh-adapter/contract.d.ts +29 -3
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +48 -5
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +5 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.js +0 -2
- package/lib/types/dsh-adapter/fresh-agent.d.ts +1 -1
- package/lib/types/dsh-adapter/fresh-agent.d.ts.map +1 -1
- package/lib/types/dsh-adapter/fresh-agent.js +60 -11
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-access.js +60 -11
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-contract.js +5 -3
- package/lib/types/dsh-adapter/host-dsh.d.ts +2 -8
- package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-dsh.js +30 -6
- package/lib/types/dsh-adapter/host-entry.js +4 -0
- package/lib/types/dsh-adapter/index.d.ts +9 -1
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +5 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts +73 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts.map +1 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.js +250 -0
- package/lib/types/dsh-adapter/oauth/bonus.d.ts +34 -9
- package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/bonus.js +47 -5
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts +7 -2
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/deepseek.js +6 -1
- package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/index.js +44 -0
- package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/profiles.js +14 -1
- package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/service.js +5 -6
- package/lib/types/dsh-adapter/plugin-manage.d.ts +6 -4
- package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-manage.js +3 -2
- package/lib/types/dsh-adapter/plugin.d.ts +237 -6
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +751 -67
- package/lib/types/dsh-adapter/presets.d.ts +38 -11
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +46 -17
- package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
- package/lib/types/dsh-adapter/process-exit.js +1 -1
- package/lib/types/dsh-adapter/questions.d.ts +3 -4
- package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/questions.js +1 -1
- package/lib/types/dsh-adapter/session-list-metadata.js +2 -2
- package/lib/types/dsh-adapter/session-projection-store.d.ts +1 -1
- package/lib/types/dsh-adapter/session-projection-store.d.ts.map +1 -1
- package/lib/types/dsh-adapter/session-projection-store.js +30 -23
- package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessionTree.js +4 -1
- package/lib/types/dsh-adapter/subagents.d.ts +6 -0
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +32 -3
- package/lib/types/dsh-adapter/team-mode.d.ts +46 -27
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +157 -29
- package/lib/types/dsh-adapter/team-roster.d.ts +53 -18
- package/lib/types/dsh-adapter/team-roster.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-roster.js +206 -39
- package/lib/types/dsh-adapter/team-tools.d.ts +25 -12
- package/lib/types/dsh-adapter/team-tools.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-tools.js +81 -26
- package/lib/types/dsh-adapter/tool-scope.d.ts +24 -0
- package/lib/types/dsh-adapter/tool-scope.d.ts.map +1 -0
- package/lib/types/dsh-adapter/tool-scope.js +127 -0
- package/lib/types/dsh-adapter/types.d.ts +2 -1
- package/lib/types/dsh-adapter/types.d.ts.map +1 -1
- package/lib/types/heldInputs.d.ts +55 -16
- package/lib/types/heldInputs.d.ts.map +1 -1
- package/lib/types/heldInputs.js +277 -41
- package/lib/types/i18n.d.ts +292 -20
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +89 -13
- package/lib/types/ink/components/App.d.ts +2 -0
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +8 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/dom.js +13 -3
- package/lib/types/ink/events/input-event.d.ts.map +1 -1
- package/lib/types/ink/events/input-event.js +7 -6
- package/lib/types/ink/flush-tick.d.ts +6 -0
- package/lib/types/ink/flush-tick.d.ts.map +1 -1
- package/lib/types/ink/flush-tick.js +31 -0
- package/lib/types/ink/hit-test.d.ts +2 -0
- package/lib/types/ink/hit-test.d.ts.map +1 -1
- package/lib/types/ink/hit-test.js +10 -0
- package/lib/types/ink/hooks/use-program-status.d.ts +1 -1
- package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-program-status.js +3 -2
- package/lib/types/ink/hooks/use-terminal-title.d.ts +15 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-terminal-title.js +23 -3
- package/lib/types/ink/ink.d.ts +1 -0
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +7 -4
- package/lib/types/ink/jumpback-state.d.ts +33 -0
- package/lib/types/ink/jumpback-state.d.ts.map +1 -0
- package/lib/types/ink/jumpback-state.js +51 -0
- package/lib/types/ink/jumpback.d.ts +78 -0
- package/lib/types/ink/jumpback.d.ts.map +1 -0
- package/lib/types/ink/jumpback.js +515 -0
- package/lib/types/ink/log-update.js +37 -14
- package/lib/types/ink/notify-helper/activate.cs +836 -0
- package/lib/types/ink/notify-helper/compile.d.ts +30 -0
- package/lib/types/ink/notify-helper/compile.d.ts.map +1 -0
- package/lib/types/ink/notify-helper/compile.js +235 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +25 -0
- package/lib/types/ink/terminal-notification-windows.d.ts +8 -4
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.js +14 -21
- package/lib/types/ink/terminal-notification.d.ts +31 -2
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +51 -0
- package/lib/types/ink/terminal.d.ts +15 -3
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +38 -9
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +1 -1
- package/lib/types/screens/Chat.d.ts +4 -3
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +81 -11
- package/lib/types/screens/SessionSupervisor.d.ts +3 -6
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +5 -8
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +1 -2
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +2 -2
- package/lib/types/screens/sessionSupervisor/model.d.ts +1 -1
- package/lib/types/screens/sessionSupervisor/model.js +1 -1
- package/lib/types/sessionMounts.d.ts +12 -5
- package/lib/types/sessionMounts.d.ts.map +1 -1
- package/lib/types/sessionMounts.js +33 -6
- package/lib/types/settings/definitions.d.ts +12 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +15 -7
- package/lib/types/update.d.ts +412 -20
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +2094 -193
- package/lib/types/updateHost.d.ts +198 -0
- package/lib/types/updateHost.d.ts.map +1 -0
- package/lib/types/updateHost.js +608 -0
- package/lib/types/utils/processName.d.ts +16 -0
- package/lib/types/utils/processName.d.ts.map +1 -0
- package/lib/types/utils/processName.js +27 -0
- package/package.json +114 -111
- package/presets/liangshen/agent.cordis.yml +4 -0
- package/tui-profile/feed/README.md +1 -1
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -14,6 +14,7 @@ import { EDITABLE_CONFIG_KEYS } from '../settings/definitions.js';
|
|
|
14
14
|
import { kernelEntriesOf } from '../components/kernelCatalog.js';
|
|
15
15
|
import { openBackendStartup, prepareBackendStartup, probeKernels, installSurfaceFor } from './backends.js';
|
|
16
16
|
import { backendLabel, isBackendIdSyntax, isRegisteredBackend, listBackends, listOfferedBackends, loadBackend, parseBackendChoice, unloadBackends } from './backend-registry.js';
|
|
17
|
+
import { installedKernelVersion } from './contract.js';
|
|
17
18
|
import { createPluginInstallEntry } from './plugin-install.js';
|
|
18
19
|
import { createPluginManageEntry } from './plugin-manage.js';
|
|
19
20
|
import { formatSessionRef } from '../agent/refs.js';
|
|
@@ -27,14 +28,16 @@ import { removeClipboardImageDir } from '../utils/clipboard.js';
|
|
|
27
28
|
import { appendCrashLog, serializeCrashDetail, unserializableCrashDetail } from '../utils/crashDetail.js';
|
|
28
29
|
import { pluginManagerOf } from './plugin-manager.js';
|
|
29
30
|
import { logForDebugging } from '../utils/debug.js';
|
|
30
|
-
import { createTerminalNotifier } from '../ink/terminal-notification.js';
|
|
31
|
+
import { clipToWidthGraphemes, createTerminalNotifier, notificationText } from '../ink/terminal-notification.js';
|
|
31
32
|
import { getTerminalFocused } from '../ink/terminal-focus-state.js';
|
|
33
|
+
import { createJumpBack, isMarkerFileSession } from '../ink/jumpback.js';
|
|
34
|
+
import { getJumpBackState, setJumpBackEnabled } from '../ink/jumpback-state.js';
|
|
32
35
|
import { resolveNotificationMethod } from '../ink/terminal.js';
|
|
33
36
|
import { isEnvTruthy } from '../utils/envUtils.js';
|
|
34
37
|
import { QuestionStore, bindQuestionStore } from './questions.js';
|
|
35
38
|
import { prepareQuestionAnswerer } from './questions-answerer.js';
|
|
36
39
|
import { adapterRuntimeFor } from '../adapter/kernel/runtime-context.js';
|
|
37
|
-
import { ApprovalStore, bindApprovalStore } from './approvals.js';
|
|
40
|
+
import { ApprovalStore, bindApprovalStore, reasonOf } from './approvals.js';
|
|
38
41
|
import { PermissionStore } from '../channel/permissions.js';
|
|
39
42
|
import { registerPromptDebug } from './promptDebug.js';
|
|
40
43
|
import { readActivityFrames } from '../activityPrefs.js';
|
|
@@ -52,12 +55,12 @@ import { clearResumeTarget, resumeTargetFromArgv, stripResumeArgs, writeResumeTa
|
|
|
52
55
|
import { cmdlineArgsOf, initialPromptFromCmdlineArgs } from './startup-args.js';
|
|
53
56
|
import { readHomePrefs } from '../homePrefs.js';
|
|
54
57
|
import { handoffEventTag, formatHandoffNotice } from '../handoffEvents.js';
|
|
55
|
-
import { adoptHeldInputs, heldInputsResumeCommand, takeHeldInputs, writeHeldInputs } from '../heldInputs.js';
|
|
58
|
+
import { adoptHeldInputs, collectHeldInputs, heldInputsResumeCommand, takeHeldInputs, writeHeldInputs } from '../heldInputs.js';
|
|
56
59
|
import { armFirstFrameAck, beginHandoffAck, handoffAttemptId, ownsAltScreenExit } from '../handoffAck.js';
|
|
57
60
|
import { DSH_BACKEND_ID, HOST_NOTICE_ENV, KERNEL_SWITCH_HANDOFF_ENV, RESUME_BACKEND_ENV, RESUME_RETRY_ENV, parseBackendId, readKernelPrefs, resolveRememberedBackend, resolveResumeTarget, writeKernelPrefs } from '../kernelPrefs.js';
|
|
58
61
|
import { shouldOfferOnboarding } from '../onboardingPrefs.js';
|
|
59
62
|
import { resolveSessionCwd } from '../utils/workspaceRoot.js';
|
|
60
|
-
import { LAUNCH_PROMPT_SENT_ENV, beginRestartAttempt, checkForTuiUpdate, installedTuiVersion, isBootDeadlockTarget, isStandaloneRuntime, isVersionNewer, logRestartEvent, resolveDshProfileName,
|
|
63
|
+
import { LAUNCH_PROMPT_SENT_ENV, beginRestartAttempt, blockedUpdateMessages, checkForTuiUpdate, describeHostStepReason, describeLauncherStepReason, deliverEngineSkipReport, idleReportMessages, installedTuiVersion, isBootDeadlockTarget, isStandaloneRuntime, isVersionNewer, logRestartEvent, resolveDshProfileName, resolveUpdatePlan, restartTui, updatePlanLayers, updatePlanState, updatePlanSuite, updateTuiAndRestart, writeHandoffNotice, writeLastRunRecord } from '../update.js';
|
|
61
64
|
import { getLang, isLang, resolveStartupLang, setLang, t, writeLangPref } from '../i18n.js';
|
|
62
65
|
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';
|
|
63
66
|
import { draftComboConflicts, effectiveComboString, parseComboDraft, setKeymapOverrides, SHORTCUT_ACTIONS, } from '../utils/keymap.js';
|
|
@@ -182,7 +185,22 @@ export function createTaskNotificationSettings(notifier, initial) {
|
|
|
182
185
|
};
|
|
183
186
|
}
|
|
184
187
|
/**
|
|
185
|
-
*
|
|
188
|
+
* Whether a notification is announced at all: the one gate shared by task
|
|
189
|
+
* completions and waiting interruptions, asked before the Windows transport so
|
|
190
|
+
* a suppressed notification never costs a PowerShell process, and so a
|
|
191
|
+
* delivered toast never also rings the bell. The Windows fallback re-enters
|
|
192
|
+
* through `ringTaskCompletion`, which carries this answer instead of asking the
|
|
193
|
+
* focus question again after the awaits.
|
|
194
|
+
* @param settings - The live notification settings.
|
|
195
|
+
* @param stdoutTty - Whether stdout is a TTY right now.
|
|
196
|
+
* @param focused - Whether the terminal reports focus right now.
|
|
197
|
+
* @returns True when the switch and the focus policy say this notification is due.
|
|
198
|
+
*/
|
|
199
|
+
export function notificationAlertsEnabled(settings, stdoutTty, focused) {
|
|
200
|
+
return stdoutTty && settings.condition !== 'off' && !(settings.condition === 'unfocused' && focused);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Ring the terminal for a notification the host's gate already approved.
|
|
186
204
|
*
|
|
187
205
|
* The gate asks whether the terminal is focused; this port runs after the toast's
|
|
188
206
|
* await, which is up to 30 s of PowerShell. Asking the focus question a second
|
|
@@ -206,7 +224,7 @@ export function ringTaskCompletion(notifier, settings, title, message) {
|
|
|
206
224
|
}
|
|
207
225
|
}
|
|
208
226
|
/**
|
|
209
|
-
* Show one
|
|
227
|
+
* Show one notification toast and answer for what it did.
|
|
210
228
|
*
|
|
211
229
|
* Exactly one answer reaches the terminal path: `unavailable` rings the bell
|
|
212
230
|
* (AC-5), because the alternative is a notification the user never learns
|
|
@@ -217,12 +235,15 @@ export function ringTaskCompletion(notifier, settings, title, message) {
|
|
|
217
235
|
* without a toast, a registry write or a child process.
|
|
218
236
|
* @param title - The localized title.
|
|
219
237
|
* @param message - The single-line summary; empty shows the title alone.
|
|
220
|
-
* @param backendId - The session
|
|
238
|
+
* @param backendId - The session the notification speaks for; a DSH plugin only covers DSH events.
|
|
221
239
|
* @param delivery - The toast port, and the terminal path to fall back to.
|
|
222
240
|
*/
|
|
223
241
|
export async function deliverTaskCompletionOnWindows(title, message, backendId, delivery) {
|
|
242
|
+
let target = refreshJumpBackMarker(delivery);
|
|
224
243
|
let externalNotifierActive = false;
|
|
225
|
-
|
|
244
|
+
// A delivery that opts out keeps `false` without paying for the inventory read:
|
|
245
|
+
// the caller already knows the external plugin does not cover this notice.
|
|
246
|
+
if (backendId === 'dsh' && delivery.pluginManager !== undefined && delivery.yieldToExternal !== false) {
|
|
226
247
|
try {
|
|
227
248
|
const plugins = await delivery.pluginManager.listPlugins();
|
|
228
249
|
externalNotifierActive = plugins.some(plugin => plugin.enabled && plugin.fiberPhase === 'active'
|
|
@@ -232,23 +253,261 @@ export async function deliverTaskCompletionOnWindows(title, message, backendId,
|
|
|
232
253
|
logForDebugging('external notifier inventory unavailable; using the built-in Windows notification');
|
|
233
254
|
}
|
|
234
255
|
}
|
|
256
|
+
// The inventory await is a toggle boundary too: a switch turned off while it
|
|
257
|
+
// ran already cleaned up, so the target taken before it must not register or
|
|
258
|
+
// promise anything now.
|
|
259
|
+
if (target !== undefined) {
|
|
260
|
+
const state = getJumpBackState();
|
|
261
|
+
if (!state.enabled || state.generation !== target.generation || !ownerAllows(delivery)) {
|
|
262
|
+
target = undefined;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// An external notifier ships this notification: only a toast this process sends
|
|
266
|
+
// can come back here, so no probe and no registration - the URI would never
|
|
267
|
+
// be clicked.
|
|
268
|
+
const launch = target === undefined || externalNotifierActive ? undefined : await jumpBackLaunch(target, delivery);
|
|
235
269
|
const result = await delivery.toast({
|
|
236
270
|
title,
|
|
237
271
|
message,
|
|
238
272
|
externalNotifierActive,
|
|
239
273
|
canDispatch: delivery.canDispatch,
|
|
274
|
+
launch,
|
|
240
275
|
});
|
|
241
276
|
if (result.status !== 'unavailable' || delivery.canDispatch?.() === false)
|
|
242
277
|
return;
|
|
243
278
|
// AC-5 wants the bell, not a silent loss - and the reason is what makes the
|
|
244
279
|
// pair "toast missing + bell rang" explainable afterwards. Ring first, then
|
|
245
|
-
// report: the port rings for a
|
|
280
|
+
// report: the port rings for a notification the gate already approved, and a line
|
|
246
281
|
// written ahead of the action is how the fallback came to log a bell that a
|
|
247
282
|
// second look at the focus had eaten.
|
|
248
283
|
const cause = result.detail === undefined ? result.reason : `${result.reason}: ${result.detail}`;
|
|
249
284
|
delivery.terminal(title, message);
|
|
250
285
|
logForDebugging(`windows toast unavailable (${cause}); using the terminal fallback`);
|
|
251
286
|
}
|
|
287
|
+
/** Where the documented activation URI starts; the helper parses it (D6). */
|
|
288
|
+
const JUMP_BACK_LAUNCH_PREFIX = 'dsh-tui:activate?m=';
|
|
289
|
+
let sharedJumpBack;
|
|
290
|
+
/**
|
|
291
|
+
* The jump-back orchestration for this process: one instance, so the protocol
|
|
292
|
+
* key it registered and the marker files it wrote are exactly what `cleanup()`
|
|
293
|
+
* removes. A per-notification instance would lose that bookkeeping and
|
|
294
|
+
* leak both.
|
|
295
|
+
*/
|
|
296
|
+
function jumpBackForProcess() {
|
|
297
|
+
sharedJumpBack ??= createJumpBack();
|
|
298
|
+
return sharedJumpBack;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* The marker file's name for one notification (D8): the backend's session id when
|
|
302
|
+
* it is a safe file name, else a name for this process. A missing id is no
|
|
303
|
+
* reason to skip the documented file - the toast still names this pane.
|
|
304
|
+
* @returns A file name that cannot leave the marker directory.
|
|
305
|
+
*/
|
|
306
|
+
function markerFileName(sessionId) {
|
|
307
|
+
return sessionId !== undefined && isMarkerFileSession(sessionId)
|
|
308
|
+
? sessionId
|
|
309
|
+
: `process-${process.pid}`;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Refresh the documented marker file for this notification (D8).
|
|
313
|
+
*
|
|
314
|
+
* The file is written before the toast's ownership is known: an external
|
|
315
|
+
* notifier may deliver this notification, but an external plugin reading the
|
|
316
|
+
* documented seam still has to find this session's marker (AC-9). Only the
|
|
317
|
+
* probe that decides whether a click can be promised comes later.
|
|
318
|
+
* @param delivery - The ports for this notification; `jumpback` defaults to this
|
|
319
|
+
* process's orchestration.
|
|
320
|
+
* @returns The marker and its orchestration, or undefined when jump-back is
|
|
321
|
+
* off, off Windows, has no marker yet, or the port refuses to write.
|
|
322
|
+
*/
|
|
323
|
+
function refreshJumpBackMarker(delivery) {
|
|
324
|
+
// The title writer tags a pane only on Windows; promising a jump anywhere
|
|
325
|
+
// else is a dead click. A disabled switch costs nothing and comes first.
|
|
326
|
+
const { enabled, marker, generation } = getJumpBackState();
|
|
327
|
+
if (!enabled || marker === null || (delivery.platform ?? process.platform) !== 'win32')
|
|
328
|
+
return undefined;
|
|
329
|
+
const jumpback = delivery.jumpback ?? jumpBackForProcess();
|
|
330
|
+
try {
|
|
331
|
+
// `writeMarker` answers undefined, not a throw, when the directory is not
|
|
332
|
+
// writable. A target without its documented file would still allow a probe
|
|
333
|
+
// and a registration, so a click would promise a jump other instances
|
|
334
|
+
// cannot see (and cannot use to judge this one alive).
|
|
335
|
+
if (jumpback.writeMarker(markerFileName(delivery.sessionId), marker) === undefined) {
|
|
336
|
+
logForDebugging('jumpback: the launch could not be prepared; sending the plain toast', {
|
|
337
|
+
step: 'marker',
|
|
338
|
+
detail: 'the marker file was not written',
|
|
339
|
+
});
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
return { marker, jumpback, generation };
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
// The delivery path is fire-and-forget: a port that throws must cost the
|
|
346
|
+
// jump-back promise, never the notification itself (AC-3/AC-10). One
|
|
347
|
+
// message covers both preparation steps; `step` says which one failed.
|
|
348
|
+
logForDebugging('jumpback: the launch could not be prepared; sending the plain toast', {
|
|
349
|
+
step: 'marker',
|
|
350
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
351
|
+
});
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Whether the host still owns this notification. A throwing callback is a released
|
|
357
|
+
* owner, not a reason to break the delivery path: the promise is the only thing
|
|
358
|
+
* it may cost.
|
|
359
|
+
*/
|
|
360
|
+
function ownerAllows(delivery) {
|
|
361
|
+
try {
|
|
362
|
+
return delivery.canDispatch?.() !== false;
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
logForDebugging('jumpback: the owner check threw; treating the owner as released', {
|
|
366
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
367
|
+
});
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Ask whether this notification may carry a jump-back URI (D4/D7).
|
|
373
|
+
*
|
|
374
|
+
* The marker file was already refreshed by {@link refreshJumpBackMarker}; this
|
|
375
|
+
* step only spends the half second a probe costs. It must prove exactly one
|
|
376
|
+
* target (AC-3), and a refused protocol registration also answers no URI - a
|
|
377
|
+
* click whose handler is missing is a dead click (D7). Every skip leaves its
|
|
378
|
+
* stage and reason in the debug log.
|
|
379
|
+
* @param target - The marker and the orchestration that must prove it reachable.
|
|
380
|
+
* @returns The activation URI, or undefined for the plain toast.
|
|
381
|
+
*/
|
|
382
|
+
async function jumpBackLaunch(target, delivery) {
|
|
383
|
+
// The setting can be turned off while this notification waits for its probe or
|
|
384
|
+
// for the registry. A stale preparation must not write the key back: the
|
|
385
|
+
// disable already ran its cleanup, and the click would outlive the switch.
|
|
386
|
+
const stillWanted = () => {
|
|
387
|
+
const state = getJumpBackState();
|
|
388
|
+
return state.enabled && state.generation === target.generation && ownerAllows(delivery);
|
|
389
|
+
};
|
|
390
|
+
if (!stillWanted())
|
|
391
|
+
return undefined;
|
|
392
|
+
try {
|
|
393
|
+
const probe = await target.jumpback.probe(target.marker);
|
|
394
|
+
if (!probe.capable || !stillWanted())
|
|
395
|
+
return undefined;
|
|
396
|
+
if (!await target.jumpback.ensureProtocol(probe.helperPath))
|
|
397
|
+
return undefined;
|
|
398
|
+
if (!stillWanted())
|
|
399
|
+
return undefined;
|
|
400
|
+
return `${JUMP_BACK_LAUNCH_PREFIX}${target.marker}`;
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
// Same rule as the marker refresh: the jump-back promise is all a throwing
|
|
404
|
+
// port may cost (AC-3/AC-10).
|
|
405
|
+
logForDebugging('jumpback: the launch could not be prepared; sending the plain toast', {
|
|
406
|
+
step: 'probe',
|
|
407
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
408
|
+
});
|
|
409
|
+
return undefined;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Publish the documented marker file as soon as the setting is turned on (D8).
|
|
414
|
+
*
|
|
415
|
+
* The notification path refreshes it per notification, but between the flip and
|
|
416
|
+
* the first notification an external reader already sees the switch on and would
|
|
417
|
+
* find no file for the current session (AC-9). Only a session whose id can name
|
|
418
|
+
* the documented `<session>.json` is published: the per-notification fallback
|
|
419
|
+
* (`process-<pid>.json`) exists for a toast that still needs a name, while here
|
|
420
|
+
* a reader looking the session up would find nothing either way.
|
|
421
|
+
*
|
|
422
|
+
* Best-effort by the same rule as the delivery path: the switch was already
|
|
423
|
+
* published, and a throwing port may cost the seam, never the settings edit.
|
|
424
|
+
* @param sessionId - The current session's id, when the host has one yet.
|
|
425
|
+
* @param platform - The host platform; only Windows tags panes (D2).
|
|
426
|
+
*/
|
|
427
|
+
function refreshEnabledMarker(jumpback, sessionId, platform) {
|
|
428
|
+
const { enabled, marker } = getJumpBackState();
|
|
429
|
+
if (!enabled || platform !== 'win32' || marker === null)
|
|
430
|
+
return;
|
|
431
|
+
if (sessionId === undefined || !isMarkerFileSession(sessionId))
|
|
432
|
+
return;
|
|
433
|
+
try {
|
|
434
|
+
if (jumpback.writeMarker(sessionId, marker) === undefined) {
|
|
435
|
+
logForDebugging('jumpback: the enabled marker file was not written', { sessionId });
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
catch (error) {
|
|
439
|
+
logForDebugging('jumpback: the enabled marker file could not be refreshed', {
|
|
440
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Every cleanup a disable started, chained so a later enable orders its marker
|
|
446
|
+
* write after the delete that owns the same documented path. The chain is
|
|
447
|
+
* append-only on purpose: a stale enable that awaited an older link must never
|
|
448
|
+
* replace the tail and drop a newer cleanup (review 2026-11-01).
|
|
449
|
+
*/
|
|
450
|
+
let cleanupChain = Promise.resolve();
|
|
451
|
+
/**
|
|
452
|
+
* Publish one jump-back settings resolution and act on the transition
|
|
453
|
+
* (D1/D4/D8). Enabling sweeps stale marker files once and refreshes the
|
|
454
|
+
* documented seam for the current session; disabling is a cleanup point of its
|
|
455
|
+
* own (AC-1/AC-9), not merely a title rewrite.
|
|
456
|
+
*
|
|
457
|
+
* `cleanup()` removes only what THIS process registered or wrote - another
|
|
458
|
+
* instance's protocol key survives - and is a no-op for a process that
|
|
459
|
+
* never did either, so a disabled boot path is unchanged. The sweep is
|
|
460
|
+
* win32-gated inside the orchestration, so no second platform judgment is made
|
|
461
|
+
* for it; the marker refresh needs the platform here because it happens before
|
|
462
|
+
* any port proves the host. Exported for the regression, which drives the same
|
|
463
|
+
* transition the settings watch calls.
|
|
464
|
+
* @param platform - The host platform; defaults to this process's, injectable
|
|
465
|
+
* for the regression, which runs on POSIX CI.
|
|
466
|
+
*/
|
|
467
|
+
/**
|
|
468
|
+
* Compile the helper once the user enables jump-back, off the notification path:
|
|
469
|
+
* the first notification then pays the probe's half second, not the csc run.
|
|
470
|
+
*/
|
|
471
|
+
function warmJumpBackHelper() {
|
|
472
|
+
void import('../ink/notify-helper/compile.js')
|
|
473
|
+
.then(module => module.ensureHelper())
|
|
474
|
+
.catch((error) => {
|
|
475
|
+
logForDebugging('jumpback: helper warm-up failed', {
|
|
476
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
export async function applyJumpBackSetting(jumpback, enabled, sessionId, platform = process.platform) {
|
|
481
|
+
const wasEnabled = getJumpBackState().enabled;
|
|
482
|
+
setJumpBackEnabled(enabled);
|
|
483
|
+
if (enabled && !wasEnabled) {
|
|
484
|
+
// The generation this enable published: a later toggle changes it, and a
|
|
485
|
+
// stale enable must never publish a marker under the replacement's nose.
|
|
486
|
+
const generation = getJumpBackState().generation;
|
|
487
|
+
// Every cleanup that started before this enable owns the documented path
|
|
488
|
+
// for a while. The chain is append-only, so the tail captured here covers
|
|
489
|
+
// all of them; a stale enable must not reset it, or a newer cleanup goes
|
|
490
|
+
// untracked and deletes the marker this generation is about to write.
|
|
491
|
+
await cleanupChain;
|
|
492
|
+
if (getJumpBackState().generation !== generation || !getJumpBackState().enabled)
|
|
493
|
+
return;
|
|
494
|
+
jumpback.sweepStale();
|
|
495
|
+
refreshEnabledMarker(jumpback, sessionId, platform);
|
|
496
|
+
}
|
|
497
|
+
else if (!enabled && wasEnabled) {
|
|
498
|
+
// Append instead of starting a parallel delete: a quick re-enable then
|
|
499
|
+
// orders its marker write after every cleanup that started before it, and
|
|
500
|
+
// a stale enable that awaited an older link cannot drop this one. The
|
|
501
|
+
// settings watch does not wait for the transition itself.
|
|
502
|
+
cleanupChain = cleanupChain
|
|
503
|
+
.then(() => jumpback.cleanup())
|
|
504
|
+
.catch((error) => {
|
|
505
|
+
logForDebugging('jumpback: the cleanup after disabling failed', {
|
|
506
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
507
|
+
});
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
}
|
|
252
511
|
/**
|
|
253
512
|
* The production toast port. The Windows module is imported on first use and
|
|
254
513
|
* never at load time, so this path does not pull it in on a host that never
|
|
@@ -267,6 +526,223 @@ async function showWindowsToast(input) {
|
|
|
267
526
|
return { status: 'unavailable', reason: 'unexpected', detail };
|
|
268
527
|
}
|
|
269
528
|
}
|
|
529
|
+
/** Cells a notification body may spend on the session name. */
|
|
530
|
+
const NOTIFICATION_SESSION_NAME_MAX_WIDTH = 20;
|
|
531
|
+
/**
|
|
532
|
+
* The session name as a notification shows it: a localized placeholder while
|
|
533
|
+
* the session is unnamed, and a grapheme-safe clip when a long name would crowd
|
|
534
|
+
* out the tool and reason after it. A Windows toast keeps 80 cells of the body,
|
|
535
|
+
* and the tool and reason are what tell the reader which prompt is waiting, so
|
|
536
|
+
* the name is the only part that gives way.
|
|
537
|
+
* @param sessionTitle - The attached session's title.
|
|
538
|
+
* @returns One plain line fitting the name's share of the body budget.
|
|
539
|
+
*/
|
|
540
|
+
function notificationSessionName(sessionTitle) {
|
|
541
|
+
const name = notificationText(sessionTitle);
|
|
542
|
+
if (name === '')
|
|
543
|
+
return t('untitled-session');
|
|
544
|
+
return clipToWidthGraphemes(name, NOTIFICATION_SESSION_NAME_MAX_WIDTH);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* The approval notification body: the session, the tool and the asker's
|
|
548
|
+
* reason, in that order, with empty parts dropped. A session that is not named
|
|
549
|
+
* yet contributes a localized placeholder name rather than vanishing from the
|
|
550
|
+
* body altogether.
|
|
551
|
+
*
|
|
552
|
+
* The reason is host-provided text: DSH's sandbox escalation passes the model's
|
|
553
|
+
* own `justification` through verbatim, so it can carry arbitrary prose. It is
|
|
554
|
+
* normalized to one plain line and capped like the completion preview, but the
|
|
555
|
+
* body makes no redaction promise - the panel keeps the full reason and the
|
|
556
|
+
* gated command, and the tool call's arguments are never read for the body.
|
|
557
|
+
*
|
|
558
|
+
* The session name is the only part that may be shortened: a Windows toast
|
|
559
|
+
* keeps 80 cells of the body, and the tool and reason are what tells the
|
|
560
|
+
* reader which prompt is waiting, so the name is clipped first.
|
|
561
|
+
*
|
|
562
|
+
* Exported like the completion seams above so the regression can assert the
|
|
563
|
+
* exact body without a toast or a live approval request.
|
|
564
|
+
* @param sessionTitle - The attached session's title; empty before it is
|
|
565
|
+
* named, which falls back to a localized placeholder.
|
|
566
|
+
* @param toolName - The tool the prompt gates.
|
|
567
|
+
* @param reason - The asker's reason as the host provides it, when it gave one.
|
|
568
|
+
*/
|
|
569
|
+
export function approvalNotificationMessage(sessionTitle, toolName, reason) {
|
|
570
|
+
const reasonText = reason === undefined ? '' : notificationText(reason);
|
|
571
|
+
return [notificationSessionName(sessionTitle), notificationText(toolName), reasonText]
|
|
572
|
+
.filter(part => part !== '')
|
|
573
|
+
.join(':');
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Build the notice for a parked non-DSH prompt, or undefined when the prompt
|
|
577
|
+
* belongs to a subagent: that prompt still parks for the panel and its
|
|
578
|
+
* session-list badge, but it is not this window's waiting prompt and must not
|
|
579
|
+
* raise a notification here.
|
|
580
|
+
* @param request - The parked backend prompt.
|
|
581
|
+
* @param session - The attached session's title and backend.
|
|
582
|
+
* @returns The notice to announce, or undefined when the prompt is not this window's.
|
|
583
|
+
*/
|
|
584
|
+
export function backendApprovalNotice(request, session) {
|
|
585
|
+
if (request.agentId !== undefined)
|
|
586
|
+
return undefined;
|
|
587
|
+
return {
|
|
588
|
+
sessionTitle: session.title,
|
|
589
|
+
toolName: request.toolName,
|
|
590
|
+
...(request.reason === undefined ? {} : { reason: request.reason }),
|
|
591
|
+
backendId: session.backendId,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Build the notice for a DSH approval request, or undefined when the request
|
|
596
|
+
* belongs to another agent - a background session or a subagent. Those still
|
|
597
|
+
* park for the panel and its needs-input badge, but only the attached session's
|
|
598
|
+
* ask belongs in this window's notification.
|
|
599
|
+
* @param request - The agent id, tool and resolved reason of the approval request.
|
|
600
|
+
* @param session - The attached agent id, session title and backend.
|
|
601
|
+
* @returns The notice to announce, or undefined for another agent's request.
|
|
602
|
+
*/
|
|
603
|
+
export function dshApprovalNotice(request, session) {
|
|
604
|
+
if (request.agentId !== session.attachedAgentId)
|
|
605
|
+
return undefined;
|
|
606
|
+
return {
|
|
607
|
+
sessionTitle: session.title,
|
|
608
|
+
toolName: request.toolName,
|
|
609
|
+
...(request.reason === undefined ? {} : { reason: request.reason }),
|
|
610
|
+
backendId: session.backendId,
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Whether a notification queued before the Windows transport may still be
|
|
615
|
+
* dispatched: the window must still own the channel, the switch must not have
|
|
616
|
+
* been turned off, the notice must speak for the session that is attached now,
|
|
617
|
+
* and the interruption it announces must still be waiting. A check that throws
|
|
618
|
+
* counts as released: a state the seam cannot read must not produce a toast
|
|
619
|
+
* about a prompt that may already be gone.
|
|
620
|
+
* @param input - The live facts read at dispatch time.
|
|
621
|
+
* @returns True when the notification is still true enough to show.
|
|
622
|
+
*/
|
|
623
|
+
export function notificationDispatchAllowed(input) {
|
|
624
|
+
if (!input.ownerCurrent || input.condition === 'off')
|
|
625
|
+
return false;
|
|
626
|
+
if (input.announcedSessionId !== undefined && input.announcedSessionId !== input.currentSessionId)
|
|
627
|
+
return false;
|
|
628
|
+
if (input.stillWaiting === undefined)
|
|
629
|
+
return true;
|
|
630
|
+
try {
|
|
631
|
+
return input.stillWaiting();
|
|
632
|
+
}
|
|
633
|
+
catch {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Build the entry point that announces one waiting interruption - an approval,
|
|
639
|
+
* a waiting question or a plan review. The body is already
|
|
640
|
+
* decided by the caller; this seam owns the shared focus/off gate, the platform
|
|
641
|
+
* split, the jump-back ports and the dispatch rechecks. The gate runs before
|
|
642
|
+
* the Windows transport so a suppressed notification never costs a PowerShell
|
|
643
|
+
* process, and a delivered toast never also rings the bell.
|
|
644
|
+
* @param facts - The live ports and settings the announcement reads.
|
|
645
|
+
* @returns The function that announces one interruption; `options.yieldToExternal`
|
|
646
|
+
* is handed to the delivery, `options.stillWaiting` to its dispatch recheck.
|
|
647
|
+
*/
|
|
648
|
+
export function createInterruptionAnnouncer(facts) {
|
|
649
|
+
return (title, message, backendId, options) => {
|
|
650
|
+
if (!facts.alertsEnabled())
|
|
651
|
+
return;
|
|
652
|
+
const settings = facts.settings();
|
|
653
|
+
if (resolveNotificationMethod(settings.method, facts.platform) !== 'windows') {
|
|
654
|
+
facts.notifier.notify(title, message);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const announcedSessionId = facts.sessionId();
|
|
658
|
+
void deliverTaskCompletionOnWindows(title, message, backendId, {
|
|
659
|
+
pluginManager: facts.pluginManager(),
|
|
660
|
+
yieldToExternal: options?.yieldToExternal,
|
|
661
|
+
canDispatch: () => notificationDispatchAllowed({
|
|
662
|
+
ownerCurrent: facts.ownerCurrent(),
|
|
663
|
+
condition: facts.settings().condition,
|
|
664
|
+
announcedSessionId,
|
|
665
|
+
currentSessionId: facts.sessionId(),
|
|
666
|
+
stillWaiting: options?.stillWaiting,
|
|
667
|
+
}),
|
|
668
|
+
toast: facts.toast,
|
|
669
|
+
terminal: (fallbackTitle, fallbackMessage) => ringTaskCompletion(facts.notifier, facts.settings(), fallbackTitle, fallbackMessage),
|
|
670
|
+
jumpback: facts.jumpback,
|
|
671
|
+
sessionId: announcedSessionId,
|
|
672
|
+
// One platform judgment for the method and the toast gate, so an injected
|
|
673
|
+
// regression sees the same host the delivery pretends to run on.
|
|
674
|
+
platform: facts.platform,
|
|
675
|
+
});
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* The waiting-question notification body: the first question's header and
|
|
680
|
+
* question, trimmed and joined, with empty parts dropped. The body only has to
|
|
681
|
+
* say that the session is waiting for an answer - options, detail and link
|
|
682
|
+
* stay in the panel, because a lock screen is the wrong place to choose one.
|
|
683
|
+
* Both parts are host- or model-authored, so they get the same normalization as
|
|
684
|
+
* every other notification body (ANSI/C0 stripped, whitespace collapsed,
|
|
685
|
+
* 200-grapheme cap); a long question therefore cannot push the panel-only
|
|
686
|
+
* context into the notification, and a control sequence cannot reach either
|
|
687
|
+
* transport. Formatting only: {@link questionNotice} decides whether the ask is
|
|
688
|
+
* announced, and under which title.
|
|
689
|
+
* @param questions - The ask's questions, in display order.
|
|
690
|
+
*/
|
|
691
|
+
export function questionNotificationMessage(questions) {
|
|
692
|
+
const first = questions[0];
|
|
693
|
+
if (first === undefined)
|
|
694
|
+
return '';
|
|
695
|
+
return [notificationText(first.header ?? ''), notificationText(first.question)]
|
|
696
|
+
.filter(part => part !== '')
|
|
697
|
+
.join(':');
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* The waiting-question notice: whether the ask is announced at all, under which
|
|
701
|
+
* title, and whether an external notifier owns it - decided once here so no
|
|
702
|
+
* caller has to infer it back from the title. A plan review is announced under
|
|
703
|
+
* its own title because what is waiting is a decision on a plan, not an answer
|
|
704
|
+
* to a generic prompt; naming it up front says so before the body is read.
|
|
705
|
+
*
|
|
706
|
+
* The plan review also stays in-house: cc-dsh-notifier announces approvals and
|
|
707
|
+
* `ask_user_question` calls (it listens to `approval/asked` and `tool/call`),
|
|
708
|
+
* and a plan review is neither. Yielding would leave only its generic idle
|
|
709
|
+
* notice, which does not say that a plan review is waiting. An ordinary ask
|
|
710
|
+
* keeps the default and yields to an active external notifier.
|
|
711
|
+
*
|
|
712
|
+
* A batch with nothing to say yields no notice: a title with an empty body is
|
|
713
|
+
* pure noise away from the terminal.
|
|
714
|
+
* @param questions - The ask's questions, in display order.
|
|
715
|
+
*/
|
|
716
|
+
export function questionNotice(questions) {
|
|
717
|
+
const message = questionNotificationMessage(questions);
|
|
718
|
+
if (message === '')
|
|
719
|
+
return undefined;
|
|
720
|
+
const planReview = questions.some(question => question.intent?.kind === 'plan-review');
|
|
721
|
+
return { titleKey: planReview ? 'plan-review-notification' : 'question-notification', message, yieldToExternal: !planReview };
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* The waiting-question notice for one ask, or undefined when the ask is not this
|
|
725
|
+
* window's. Two shapes name the asker: a backend bridge stamps the asking
|
|
726
|
+
* subagent in `agentId` (that ask still parks in the panel), while a DSH ask
|
|
727
|
+
* carries the protocol's `agent` object and, on the legacy `registerProvider`
|
|
728
|
+
* hosts, reaches this store for every in-process session. Only the attached
|
|
729
|
+
* session's asks become a system notification; an ask with no owner (a local
|
|
730
|
+
* wizard or `/auth`) has nothing to compare and is announced as before.
|
|
731
|
+
* Exported so the regression drives the production guard and title mapping
|
|
732
|
+
* instead of installing its own copy of them.
|
|
733
|
+
* @param request - The ask the store hands the observer, including the DSH
|
|
734
|
+
* protocol's structural `agent` when present.
|
|
735
|
+
* @param attachedAgentId - The session/agent this window is attached to now.
|
|
736
|
+
* @returns The notice to announce, or undefined when the ask stays in the panel.
|
|
737
|
+
*/
|
|
738
|
+
export function waitingQuestionNotice(request, attachedAgentId) {
|
|
739
|
+
if (request.agentId !== undefined)
|
|
740
|
+
return undefined;
|
|
741
|
+
const asking = request.agent;
|
|
742
|
+
if (asking !== undefined && (attachedAgentId === undefined || String(asking.id) !== attachedAgentId))
|
|
743
|
+
return undefined;
|
|
744
|
+
return questionNotice(request.questions);
|
|
745
|
+
}
|
|
270
746
|
export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOptions = {}) {
|
|
271
747
|
const config = configValues(runtimeConfig);
|
|
272
748
|
const taskNotifier = createTerminalNotifier(process.stdout);
|
|
@@ -275,23 +751,19 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
275
751
|
method: config.notificationMethod ?? 'auto',
|
|
276
752
|
});
|
|
277
753
|
configureTaskNotifications(config.taskNotifications, config.notificationMethod);
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
*/
|
|
286
|
-
const taskCompletionAlertsEnabled = () => process.stdout.isTTY === true
|
|
287
|
-
&& notificationSettings.condition !== 'off'
|
|
288
|
-
&& !(notificationSettings.condition === 'unfocused' && getTerminalFocused());
|
|
754
|
+
// Jump-back (D4/D7/D8): one orchestration per process, cleaned up on
|
|
755
|
+
// this fiber's teardown. Creating it touches nothing - the registry and the
|
|
756
|
+
// marker directory are only reached after the user turns the setting on and a
|
|
757
|
+
// notification is delivered (AC-1). `cleanup()` is a no-op for a process that
|
|
758
|
+
// never registered or wrote, so an off launch exits exactly as before.
|
|
759
|
+
const jumpBack = jumpBackForProcess();
|
|
760
|
+
ctx.effect(() => () => jumpBack.cleanup());
|
|
289
761
|
/**
|
|
290
762
|
* Announce a finished task: the channel's `onTaskComplete` payload and gate,
|
|
291
763
|
* with the Windows method resolved first (`auto` picks the toast there, D2).
|
|
292
764
|
*/
|
|
293
765
|
const announceTaskCompletion = (preview, backendId) => {
|
|
294
|
-
if (!
|
|
766
|
+
if (!notificationAlertsEnabled(notificationSettings, process.stdout.isTTY === true, getTerminalFocused()))
|
|
295
767
|
return;
|
|
296
768
|
const title = t('task-complete-notification');
|
|
297
769
|
const message = preview ?? '';
|
|
@@ -304,8 +776,43 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
304
776
|
canDispatch: () => channelOwnerCurrent(rawChannel) && notificationSettings.condition !== 'off',
|
|
305
777
|
toast: showWindowsToast,
|
|
306
778
|
terminal: (fallbackTitle, fallbackMessage) => ringTaskCompletion(taskNotifier, notificationSettings, fallbackTitle, fallbackMessage),
|
|
779
|
+
jumpback: jumpBack,
|
|
780
|
+
// Read at announce time: the marker file names the session that just
|
|
781
|
+
// completed, not whichever session this process mounted at boot (D8).
|
|
782
|
+
sessionId: rawChannel.sessionRef.sessionId,
|
|
307
783
|
});
|
|
308
784
|
};
|
|
785
|
+
/**
|
|
786
|
+
* The shared interruption seam: focus/off gate, platform split, jump-back
|
|
787
|
+
* ports and dispatch rechecks for a waiting approval, question or plan
|
|
788
|
+
* review. A queued notice is dropped at
|
|
789
|
+
* dispatch time when the switch turned off, the session is no longer the
|
|
790
|
+
* attached one, or the interruption was answered in the meantime.
|
|
791
|
+
*/
|
|
792
|
+
const announceInterruption = createInterruptionAnnouncer({
|
|
793
|
+
notifier: taskNotifier,
|
|
794
|
+
settings: () => notificationSettings,
|
|
795
|
+
alertsEnabled: () => notificationAlertsEnabled(notificationSettings, process.stdout.isTTY === true, getTerminalFocused()),
|
|
796
|
+
platform: process.platform,
|
|
797
|
+
sessionId: () => rawChannel.sessionRef.sessionId,
|
|
798
|
+
ownerCurrent: () => channelOwnerCurrent(rawChannel),
|
|
799
|
+
pluginManager: () => pluginManagerOf(ctx),
|
|
800
|
+
toast: showWindowsToast,
|
|
801
|
+
jumpback: jumpBack,
|
|
802
|
+
});
|
|
803
|
+
/**
|
|
804
|
+
* Announce a pending approval: the shared interruption seam with the
|
|
805
|
+
* session/tool/reason body (`approvalNotificationMessage`). Called once per
|
|
806
|
+
* parked request - a queued prompt still needs its decision, so nothing is
|
|
807
|
+
* deduplicated.
|
|
808
|
+
* @param notice - The attached session's title, the gated tool, the asker's
|
|
809
|
+
* reason and the backend that owns the session.
|
|
810
|
+
* @param stillWaiting - Whether that approval is still parked, read again
|
|
811
|
+
* before the native transport dispatches.
|
|
812
|
+
*/
|
|
813
|
+
const announceApproval = (notice, stillWaiting) => {
|
|
814
|
+
announceInterruption(t('approval-notification'), approvalNotificationMessage(notice.sessionTitle, notice.toolName, notice.reason), notice.backendId, { stillWaiting });
|
|
815
|
+
};
|
|
309
816
|
// /restart handoff diagnosis: the replacement process is marked by env and
|
|
310
817
|
// logs its boot progress to ~/.dsh-tui/restart.log (ordinary launches stay
|
|
311
818
|
// silent). First line lands before anything in this function can throw.
|
|
@@ -427,10 +934,17 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
427
934
|
// pretending the update landed.
|
|
428
935
|
{
|
|
429
936
|
const updatedFrom = process.env.DSH_TUI_UPDATED_FROM;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
937
|
+
const updatedDshFrom = process.env.DSH_TUI_UPDATED_DSH_FROM;
|
|
938
|
+
const launcherAbsent = process.env.DSH_TUI_LAUNCHER_ABSENT !== undefined;
|
|
939
|
+
// Assigning undefined would stringify to "undefined" and leak the marker
|
|
940
|
+
// into every child process; remove them for real.
|
|
941
|
+
if (updatedFrom !== undefined)
|
|
433
942
|
delete process.env.DSH_TUI_UPDATED_FROM;
|
|
943
|
+
if (updatedDshFrom !== undefined)
|
|
944
|
+
delete process.env.DSH_TUI_UPDATED_DSH_FROM;
|
|
945
|
+
if (launcherAbsent)
|
|
946
|
+
delete process.env.DSH_TUI_LAUNCHER_ABSENT;
|
|
947
|
+
if (updatedFrom !== undefined) {
|
|
434
948
|
const now = installedTuiVersion();
|
|
435
949
|
if (now === undefined || !isVersionNewer(now, updatedFrom)) {
|
|
436
950
|
ctx.logger.warn(`dsh-tui: /update restarted but the version did not advance (still ${now ?? 'unknown'}, was ${updatedFrom})`);
|
|
@@ -439,21 +953,45 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
439
953
|
`可能是镜像 registry 未同步,请稍后重试或检查 registry 配置。\n`);
|
|
440
954
|
}
|
|
441
955
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
956
|
+
}
|
|
957
|
+
// Engine counterpart (#1844 §3.6): the engine step reports its own stamp,
|
|
958
|
+
// so a "TUI already latest, engine-only" update is checked against the
|
|
959
|
+
// engine instead of tripping the TUI version-advance warning above.
|
|
960
|
+
if (updatedDshFrom !== undefined) {
|
|
961
|
+
const engine = installedKernelVersion();
|
|
962
|
+
if (engine === undefined || !isVersionNewer(engine, updatedDshFrom)) {
|
|
963
|
+
ctx.logger.warn(`dsh-tui: /update restarted but the dsh engine did not advance (still ${engine ?? 'unknown'}, was ${updatedDshFrom})`);
|
|
964
|
+
if (process.stderr.isTTY) {
|
|
965
|
+
process.stderr.write(`\n${t('update-engine-not-advanced', {
|
|
966
|
+
now: engine ?? 'unknown',
|
|
967
|
+
from: updatedDshFrom,
|
|
968
|
+
command: 'dsh-tui update',
|
|
969
|
+
})}\n`);
|
|
454
970
|
}
|
|
455
|
-
|
|
456
|
-
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
if ((updatedFrom !== undefined || updatedDshFrom !== undefined) && process.stderr.isTTY) {
|
|
974
|
+
// Launcher alignment bridge (0.8.3): the profile copy was just
|
|
975
|
+
// replaced; a globally installed `dsh-tui` launcher is a separate copy
|
|
976
|
+
// that keeps its old version. Launchers >=0.8.3 export
|
|
977
|
+
// DSH_TUI_LAUNCHER_VERSION so we can tell whether the outer launcher
|
|
978
|
+
// lags the freshly installed profile. Both stamps exist only on the
|
|
979
|
+
// replacement process immediately after /update.
|
|
980
|
+
const launcherVersion = process.env.DSH_TUI_LAUNCHER_VERSION;
|
|
981
|
+
if (launcherVersion === undefined) {
|
|
982
|
+
// A `dsh --profile` boot has no launcher to align at all, and plan
|
|
983
|
+
// §3.5 asks for no warning there: the update that just ran resolved no
|
|
984
|
+
// launcher and left a one-shot marker. An engine-only update stays
|
|
985
|
+
// silent unless a launcher actually reported itself; a TUI-only update
|
|
986
|
+
// through an older shim (version marker, no path) still warns.
|
|
987
|
+
if (updatedFrom !== undefined && !launcherAbsent) {
|
|
988
|
+
process.stderr.write(`\n[dsh-tui] ${t('update-launcher-align-unknown', { version: installedTuiVersion() ?? 'unknown' })}\n`);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
else {
|
|
992
|
+
const profileVersion = installedTuiVersion();
|
|
993
|
+
if (profileVersion !== undefined && isVersionNewer(profileVersion, launcherVersion)) {
|
|
994
|
+
process.stderr.write(`\n[dsh-tui] ${t('update-launcher-outdated', { profile: profileVersion, launcher: launcherVersion })}\n`);
|
|
457
995
|
}
|
|
458
996
|
}
|
|
459
997
|
}
|
|
@@ -466,6 +1004,32 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
466
1004
|
// adapter binds either registration to this Cordis fiber; this separate
|
|
467
1005
|
// effect rejects asks still parked in the UI during teardown.
|
|
468
1006
|
ctx.effect(() => () => questionStore.rejectAll());
|
|
1007
|
+
// A waiting question is an interruption like a parked approval: announce it
|
|
1008
|
+
// through the same notifier so a user who stepped away sees that the
|
|
1009
|
+
// session needs an answer. The store calls this once per ask batch (a queued
|
|
1010
|
+
// one included) and already swallows callback throws; the catch here only
|
|
1011
|
+
// keeps a composition mistake visible in the debug log.
|
|
1012
|
+
questionStore.setOnAsk(request => {
|
|
1013
|
+
// The guard and the title mapping are one production decision: the notice
|
|
1014
|
+
// drops a subagent's ask and another in-process session's ask (the legacy
|
|
1015
|
+
// provider path receives every agent's question), while plan reviews stay
|
|
1016
|
+
// for the later change.
|
|
1017
|
+
const notice = waitingQuestionNotice(request, channel.agentId);
|
|
1018
|
+
if (notice === undefined)
|
|
1019
|
+
return;
|
|
1020
|
+
try {
|
|
1021
|
+
// Pure passthrough: the notice decides the plan-review opt-out, so this
|
|
1022
|
+
// callback must not infer it back from the title.
|
|
1023
|
+
announceInterruption(t(notice.titleKey), notice.message, rawChannel.sessionRef.backendId, {
|
|
1024
|
+
yieldToExternal: notice.yieldToExternal,
|
|
1025
|
+
stillWaiting: () => questionStore.hasPendingRequest(request),
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
catch (error) {
|
|
1029
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
1030
|
+
logForDebugging(`question notification failed (${detail})`);
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
469
1033
|
// DSH user-interaction seam: the model's ask_user_question tool parks on
|
|
470
1034
|
// the userQuestions service until a UI answerer responds. Mount the
|
|
471
1035
|
// service when the composition doesn't (the official dsh-base
|
|
@@ -491,10 +1055,13 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
491
1055
|
// delegation rows, and a request that carries `spawn_teammate` drops
|
|
492
1056
|
// `subagent` / `subagent_fork` (team-mode.ts), so a team bundle switched
|
|
493
1057
|
// at run time reaches the sessions already running.
|
|
1058
|
+
// 0.2.2 presentations have no tool declarations: tool-scope.ts owns those
|
|
1059
|
+
// restrictions and these shape-based filters keep only the section half.
|
|
1060
|
+
// Old hosts still carry tools here and must retain the same safety filters.
|
|
494
1061
|
dshCtx.on('system-prompt/assemble', async (_assembly, context, next) => {
|
|
495
|
-
const assembled =
|
|
1062
|
+
const assembled = await next();
|
|
496
1063
|
const presetId = context.agent === undefined ? undefined : runningPresetOf(context.agent.session);
|
|
497
|
-
return filterMinimalPresetTools(assembled, presetId);
|
|
1064
|
+
return filterMinimalPresetTools(filterTeamReplacedTools(assembled), presetId);
|
|
498
1065
|
});
|
|
499
1066
|
// `/debug-prompt` snapshots the final provider-neutral request at the
|
|
500
1067
|
// llm/stream boundary, after every prompt and tool contributor has run.
|
|
@@ -867,8 +1434,23 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
867
1434
|
// approval panel renders; its questions share the DSH questionnaire store.
|
|
868
1435
|
// Teardown withdraws whatever is still parked.
|
|
869
1436
|
const backendPermissions = backendStart === undefined ? undefined : new PermissionStore();
|
|
870
|
-
if (backendPermissions !== undefined)
|
|
1437
|
+
if (backendPermissions !== undefined) {
|
|
1438
|
+
// A non-DSH session's prompts park in this channel-owned store: there is no
|
|
1439
|
+
// background session to filter out, and the session name is read from the
|
|
1440
|
+
// channel, not the view (`PermissionRequestView` carries no session id).
|
|
1441
|
+
// A subagent's prompt parks for the panel and its session-list badge, but
|
|
1442
|
+
// only the attached session's asks belong in a system notification.
|
|
1443
|
+
backendPermissions.setOnPark(request => {
|
|
1444
|
+
const notice = backendApprovalNotice(request, {
|
|
1445
|
+
title: rawChannel.sessionTitle,
|
|
1446
|
+
backendId: rawChannel.sessionRef.backendId,
|
|
1447
|
+
});
|
|
1448
|
+
if (notice === undefined)
|
|
1449
|
+
return;
|
|
1450
|
+
announceApproval(notice, () => backendPermissions.pending().some(view => view.requestId === request.requestId));
|
|
1451
|
+
});
|
|
871
1452
|
ctx.effect(() => () => backendPermissions.settleAll());
|
|
1453
|
+
}
|
|
872
1454
|
const resolved = backendStart !== undefined || dshInEntry
|
|
873
1455
|
? { agent: undefined, handle: undefined, agentPreset: undefined, route: undefined }
|
|
874
1456
|
: await resolveAgent(ctx, bootSessionId, configuredRoute, startupRoute, deploymentRoute, meta, config.preset);
|
|
@@ -1244,6 +1826,10 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1244
1826
|
// Must mirror Config's union (`src/dsh-adapter/index.ts`): a method
|
|
1245
1827
|
// missing here is rejected by /settings and never reaches the runtime.
|
|
1246
1828
|
notificationMethod: Schema.union(['auto', 'osc9', 'bel', 'windows']),
|
|
1829
|
+
// Must mirror Config's `jumpBack` (D1). No default on purpose
|
|
1830
|
+
// (D1a): applyDisplay resolves `?? config.jumpBack ?? false`, so an
|
|
1831
|
+
// explicit cordis.yml value stays decisive while the user layer is unset.
|
|
1832
|
+
jumpBack: Schema.boolean(),
|
|
1247
1833
|
// Same no-default rule: applyDisplay resolves `?? config.mermaidDiagrams ?? true`.
|
|
1248
1834
|
mermaidDiagrams: Schema.boolean(),
|
|
1249
1835
|
// Code-frame shape; unset keeps the light rail frame.
|
|
@@ -1434,6 +2020,11 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1434
2020
|
channel.setExpandEditor(value.expandEditor ?? config.expandEditor ?? true);
|
|
1435
2021
|
channel.setSmoothStreaming(value.smoothStreaming ?? config.smoothStreaming ?? true);
|
|
1436
2022
|
configureTaskNotifications(value.taskNotifications ?? config.taskNotifications, value.notificationMethod ?? config.notificationMethod);
|
|
2023
|
+
void applyJumpBackSetting(jumpBack, value.jumpBack ?? config.jumpBack ?? false, rawChannel.sessionRef.sessionId)
|
|
2024
|
+
.then(() => {
|
|
2025
|
+
if (process.platform === 'win32' && getJumpBackState().enabled)
|
|
2026
|
+
warmJumpBackHelper();
|
|
2027
|
+
});
|
|
1437
2028
|
applyMermaidDiagrams(value.mermaidDiagrams ?? config.mermaidDiagrams);
|
|
1438
2029
|
applyCodeFrameStyle(value.codeFrameStyle ?? config.codeFrameStyle);
|
|
1439
2030
|
applyMathRendering(resolveMathRendering(value, config));
|
|
@@ -1745,6 +2336,13 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
1745
2336
|
...settingField('notificationMethod'),
|
|
1746
2337
|
format: value => String(value ?? config.notificationMethod ?? 'auto'),
|
|
1747
2338
|
},
|
|
2339
|
+
{
|
|
2340
|
+
...settingField('jumpBack'),
|
|
2341
|
+
format(value) {
|
|
2342
|
+
// Unset in settings.yaml: the effective default is off (D1a).
|
|
2343
|
+
return String(typeof value === 'boolean' ? value : config.jumpBack === true);
|
|
2344
|
+
},
|
|
2345
|
+
},
|
|
1748
2346
|
{
|
|
1749
2347
|
...settingField('codeFrameStyle'),
|
|
1750
2348
|
},
|
|
@@ -2012,7 +2610,25 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2012
2610
|
// The in-process DSH kernel installs it in `attachDsh`.
|
|
2013
2611
|
const mountDshApprovals = (dshCtx) => {
|
|
2014
2612
|
if (dshCtx.get('approval') !== undefined && backendStart === undefined) {
|
|
2015
|
-
dshCtx.on('approval/request', (req, next) =>
|
|
2613
|
+
dshCtx.on('approval/request', (req, next) => {
|
|
2614
|
+
// Park first: the ask must reach the panel even if announcing it fails.
|
|
2615
|
+
const parked = approvalStore.park(req).catch(() => next());
|
|
2616
|
+
// Only the attached session's ask belongs to this window: a background
|
|
2617
|
+
// session or a subagent carries its own agent id, so it still parks for
|
|
2618
|
+
// the panel and its needs-input badge but must not raise a toast here.
|
|
2619
|
+
const agentId = String(req.agent.id);
|
|
2620
|
+
const notice = dshApprovalNotice({ agentId, toolName: req.toolName, reason: reasonOf(req) }, { attachedAgentId: channel.agentId, title: rawChannel.sessionTitle, backendId: rawChannel.sessionRef.backendId });
|
|
2621
|
+
if (notice !== undefined) {
|
|
2622
|
+
try {
|
|
2623
|
+
announceApproval(notice, () => approvalStore.hasParkedRequest(req));
|
|
2624
|
+
}
|
|
2625
|
+
catch (error) {
|
|
2626
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
2627
|
+
logForDebugging(`approval notification failed (${detail})`);
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
return parked;
|
|
2631
|
+
});
|
|
2016
2632
|
// Badge-flip push (P-4): React does not know the session log appended —
|
|
2017
2633
|
// a source-badge verdict that only flips inside getSnapshot() surfaces
|
|
2018
2634
|
// solely when something else re-renders. Feed the session firehose to
|
|
@@ -2069,6 +2685,15 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2069
2685
|
ctx.effect(() => unsubscribe, 'dsh-tui initial prompt after startup');
|
|
2070
2686
|
}
|
|
2071
2687
|
}
|
|
2688
|
+
// The /update that restarted into this process skipped the engine. Its own
|
|
2689
|
+
// screen was torn down in the same tick, so the guidance lands here, on the
|
|
2690
|
+
// mount that survives the boot recompose.
|
|
2691
|
+
if (!shadow) {
|
|
2692
|
+
ctx.effect(() => deliverEngineSkipReport(channel, skip => {
|
|
2693
|
+
channel.pushLocal(skip.title, skip.report.split('\n').map(line => line.trimEnd()), { lineLimit: 2000 });
|
|
2694
|
+
notifyChannel(skip.toast, { color: 'warning' });
|
|
2695
|
+
}), 'dsh-tui engine skip report after startup');
|
|
2696
|
+
}
|
|
2072
2697
|
// Attach the stderr reporter to the live channel and flush anything a
|
|
2073
2698
|
// startup-spawned server produced while the channel didn't exist yet.
|
|
2074
2699
|
notifyStderr = (text, options) => notifyChannel(text, options);
|
|
@@ -2093,7 +2718,8 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2093
2718
|
let instance;
|
|
2094
2719
|
let exited = false;
|
|
2095
2720
|
let updateRequested = false;
|
|
2096
|
-
|
|
2721
|
+
/** The preflight plan for /update (TUI + engine + launcher, #1844). */
|
|
2722
|
+
let updatePlan;
|
|
2097
2723
|
// `/restart` flag: same exit funnel as `/update` minus the pnpm step —
|
|
2098
2724
|
// write the resume target, restore the terminal, respawn the process with
|
|
2099
2725
|
// the original argv, and let the fresh boot attach the same session.
|
|
@@ -2160,6 +2786,14 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2160
2786
|
return;
|
|
2161
2787
|
}
|
|
2162
2788
|
if (updateRequested) {
|
|
2789
|
+
// The plan is assigned in the same onUpdate block that raises
|
|
2790
|
+
// `updateRequested`; capturing it keeps the narrowed type inside the
|
|
2791
|
+
// exit closure. Unreachable, but exiting non-zero beats hanging.
|
|
2792
|
+
const plan = updatePlan;
|
|
2793
|
+
if (plan === undefined) {
|
|
2794
|
+
void disposeRootAndExit(ctx, 1);
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2163
2797
|
try {
|
|
2164
2798
|
// Non-DSH sessions keep their marker in backend prefs, not DSH's `resume.txt`.
|
|
2165
2799
|
if (backendStart === undefined) {
|
|
@@ -2179,7 +2813,7 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2179
2813
|
const hintText = isStandaloneRuntime()
|
|
2180
2814
|
? t('update-standalone-starting')
|
|
2181
2815
|
: t('update-starting');
|
|
2182
|
-
void finishExit(ctx, instance, bootedFullscreen, hintText, undefined, () => runUpdate(ctx, profile, handoffSessionId(),
|
|
2816
|
+
void finishExit(ctx, instance, bootedFullscreen, hintText, undefined, () => runUpdate(ctx, profile, handoffSessionId(), plan, backendChoice, handoffHint, exitSeam));
|
|
2183
2817
|
return;
|
|
2184
2818
|
}
|
|
2185
2819
|
// The kernel selector's switch: the same respawn machinery, no resume.
|
|
@@ -2233,14 +2867,26 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2233
2867
|
}
|
|
2234
2868
|
refreshLastRunRecord();
|
|
2235
2869
|
// The queue dies with this process (the kernel records it canceled);
|
|
2236
|
-
// the replacement parks the same
|
|
2237
|
-
|
|
2870
|
+
// the replacement parks the same inputs, images included, as held
|
|
2871
|
+
// dock rows (#1651). Their bytes are read now, while the session's
|
|
2872
|
+
// attachment store is still up; the spawn waits for them.
|
|
2873
|
+
const held = collectHeldInputs(channel.pending, stageId => channel.stagedImage(stageId));
|
|
2238
2874
|
void finishExit(ctx, instance, bootedFullscreen,
|
|
2239
2875
|
// This line is the one the user actually sees before the terminal is
|
|
2240
2876
|
// handed over (the composer's toast dies with the unmount): a
|
|
2241
2877
|
// mid-turn restart must say that the running turn is interrupted,
|
|
2242
2878
|
// not promise a clean resume.
|
|
2243
|
-
t(channel.working ? 'restart-during-turn' : 'restart-starting'), undefined, () =>
|
|
2879
|
+
t(channel.working ? 'restart-during-turn' : 'restart-starting'), undefined, () => {
|
|
2880
|
+
// A failed collection must still restart, without the carried
|
|
2881
|
+
// input: the alternative is a half-disposed process that never
|
|
2882
|
+
// spawns a replacement. The texts stay in the composer's own
|
|
2883
|
+
// history either way.
|
|
2884
|
+
// `then(onOk, onErr)`, not `.then(...).catch(...)`: the catch form
|
|
2885
|
+
// also swallows a synchronous throw from `runRestart`, which would
|
|
2886
|
+
// dispose the root a second time and race two replacements for the
|
|
2887
|
+
// same session mount.
|
|
2888
|
+
void held.then(inputs => { runRestart(ctx, profile, handoffSessionId(), handoffHint, { kernel: backendChoice, env: writeHeldInputs(inputs) }, exitSeam); }, () => { runRestart(ctx, profile, handoffSessionId(), handoffHint, { kernel: backendChoice }, exitSeam); });
|
|
2889
|
+
});
|
|
2244
2890
|
return;
|
|
2245
2891
|
}
|
|
2246
2892
|
// Judge against the live session behind the channel (channel.agentId),
|
|
@@ -2514,10 +3160,14 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2514
3160
|
onPluginManage: createPluginManageEntry(ctx, {
|
|
2515
3161
|
profileName: profile ?? resolveDshProfileName(),
|
|
2516
3162
|
}),
|
|
2517
|
-
// `/team [status]`: the live team report
|
|
2518
|
-
//
|
|
3163
|
+
// `/team [status|on|off]`: the live team report and, on hosts with a
|
|
3164
|
+
// per-session selection, its switch (team-mode.ts). A bundle host keeps
|
|
3165
|
+
// `/plugin enable|disable`, which shares the lifecycle flow.
|
|
2519
3166
|
onTeamCommand: createTeamCommandEntry(ctx, {
|
|
2520
3167
|
profileName: profile ?? resolveDshProfileName(),
|
|
3168
|
+
// The bound session's live Agent; team-mode walks to the tree root whose
|
|
3169
|
+
// saved selection owns the switch (a descendant is rejected upstream).
|
|
3170
|
+
rootAgent: () => liveDshAgent(),
|
|
2521
3171
|
}),
|
|
2522
3172
|
kernelPinned: backendPinned,
|
|
2523
3173
|
// Only a `dsh --profile <name>` launch has a profile installation for
|
|
@@ -2526,42 +3176,71 @@ export async function apply(ctx, runtimeConfig, configOwner = ctx, runtimeOption
|
|
|
2526
3176
|
onUpdate: profile === undefined ? undefined : () => {
|
|
2527
3177
|
if (exited || updateRequested)
|
|
2528
3178
|
return;
|
|
2529
|
-
//
|
|
2530
|
-
//
|
|
2531
|
-
//
|
|
2532
|
-
|
|
3179
|
+
// Resolve the WHOLE set before tearing the TUI down (#1844): the TUI
|
|
3180
|
+
// target, the engine version its peer range validates, and whether the
|
|
3181
|
+
// global launcher lags. An already-current TUI does NOT end the check —
|
|
3182
|
+
// the engine and launcher layers may still have work to do.
|
|
3183
|
+
void resolveUpdatePlan().then((plan) => {
|
|
2533
3184
|
if (exited || updateRequested)
|
|
2534
3185
|
return;
|
|
2535
|
-
|
|
2536
|
-
|
|
3186
|
+
const state = updatePlanState(plan);
|
|
3187
|
+
if (state === 'blocked') {
|
|
3188
|
+
// The composer toast is a single truncated row; the refusal promises
|
|
3189
|
+
// a manual repair command, so the complete text goes into a durable
|
|
3190
|
+
// transcript report and the toast stays a short pointer.
|
|
3191
|
+
const blocked = blockedUpdateMessages(plan);
|
|
3192
|
+
channel.pushLocal(blocked.title, blocked.report.split('\n').map(line => line.trimEnd()), { lineLimit: 2000 });
|
|
3193
|
+
notifyChannel(blocked.toast, { color: 'warning' });
|
|
2537
3194
|
return;
|
|
2538
3195
|
}
|
|
2539
|
-
if (
|
|
3196
|
+
if (state === 'empty') {
|
|
3197
|
+
notifyChannel(t('update-plan-empty', { layers: updatePlanSuite(plan) }));
|
|
3198
|
+
return;
|
|
3199
|
+
}
|
|
3200
|
+
if (state === 'idle') {
|
|
3201
|
+
const report = idleReportMessages(plan);
|
|
3202
|
+
if (report !== undefined) {
|
|
3203
|
+
// The composer toast is one truncated row; either the engine cannot
|
|
3204
|
+
// be aligned automatically (with a computed repair command) or a
|
|
3205
|
+
// newer release is waiting for a TUI that declares it, so the whole
|
|
3206
|
+
// explanation goes into the durable transcript.
|
|
3207
|
+
channel.pushLocal(report.title, report.report.split('\n').map(line => line.trimEnd()), { lineLimit: 2000 });
|
|
3208
|
+
notifyChannel(report.toast, { color: 'warning' });
|
|
3209
|
+
return;
|
|
3210
|
+
}
|
|
3211
|
+
notifyChannel(t('update-plan-idle', {
|
|
3212
|
+
current: plan.tui.kind === 'latest' ? plan.tui.current : installedTuiVersion() ?? 'unknown',
|
|
3213
|
+
reason: describeLauncherStepReason(plan.launcher) ?? describeHostStepReason(plan.host),
|
|
3214
|
+
}), { color: 'warning' });
|
|
3215
|
+
return;
|
|
3216
|
+
}
|
|
3217
|
+
if (plan.tui.kind === 'unknown') {
|
|
2540
3218
|
notifyChannel(t('update-check-failed'));
|
|
2541
3219
|
}
|
|
2542
|
-
else {
|
|
3220
|
+
else if (plan.tui.kind === 'update') {
|
|
2543
3221
|
// 0.7.0/0.7.1 hard-inject tuiWorkspaces at the code level; under
|
|
2544
3222
|
// an older global launcher patch (no service row) that is a
|
|
2545
3223
|
// permanent boot deadlock (issues #183/#307, the exact report
|
|
2546
3224
|
// "pending (waiting for service: tuiWorkspaces)"). A stale mirror
|
|
2547
3225
|
// pinning /update onto that range must be refused, not installed.
|
|
2548
|
-
if (isBootDeadlockTarget(
|
|
3226
|
+
if (isBootDeadlockTarget(plan.tui.latest)) {
|
|
2549
3227
|
notifyChannel(t('update-refused-deadlock', {
|
|
2550
|
-
latest:
|
|
2551
|
-
authoritative:
|
|
3228
|
+
latest: plan.tui.latest,
|
|
3229
|
+
authoritative: plan.tui.authoritative ?? plan.tui.latest,
|
|
2552
3230
|
}), { color: 'warning' });
|
|
2553
3231
|
return;
|
|
2554
3232
|
}
|
|
2555
|
-
if (
|
|
2556
|
-
notifyChannel(t('update-mirror-lag', { latest:
|
|
3233
|
+
if (plan.tui.authoritative !== undefined) {
|
|
3234
|
+
notifyChannel(t('update-mirror-lag', { latest: plan.tui.latest, authoritative: plan.tui.authoritative }));
|
|
2557
3235
|
}
|
|
2558
|
-
updateTargetVersion = target.latest;
|
|
2559
3236
|
}
|
|
3237
|
+
updatePlan = plan;
|
|
2560
3238
|
if (isStandaloneRuntime()) {
|
|
2561
3239
|
notifyChannel(t('update-standalone-starting'));
|
|
2562
3240
|
}
|
|
2563
3241
|
else {
|
|
2564
|
-
|
|
3242
|
+
const layers = updatePlanLayers(plan);
|
|
3243
|
+
notifyChannel(layers.length === 0 ? t('update-starting') : t('update-plan-starting', { layers: layers.join(' · ') }));
|
|
2565
3244
|
}
|
|
2566
3245
|
updateRequested = true;
|
|
2567
3246
|
handleExit();
|
|
@@ -3432,10 +4111,15 @@ function runRestart(ctx, profile, sessionId, hint = id => resumeCommand(profile,
|
|
|
3432
4111
|
});
|
|
3433
4112
|
}, stalled);
|
|
3434
4113
|
}
|
|
3435
|
-
function runUpdate(ctx, profile, sessionId,
|
|
4114
|
+
function runUpdate(ctx, profile, sessionId, plan, kernel, hint = id => resumeCommand(profile, id), exitSeam) {
|
|
3436
4115
|
const recovery = preservedSessionTail(sessionId, hint);
|
|
3437
4116
|
disposeRootAndThen(ctx, () => {
|
|
3438
|
-
logRestartEvent('update: starting', {
|
|
4117
|
+
logRestartEvent('update: starting', {
|
|
4118
|
+
profile,
|
|
4119
|
+
tui: plan.tui.kind === 'update' ? `${plan.tui.current}->${plan.tui.latest}` : plan.tui.kind,
|
|
4120
|
+
host: plan.host.kind === 'install' ? `${plan.host.from ?? '?'}->${plan.host.to}` : plan.host.kind,
|
|
4121
|
+
launcher: plan.launcher.kind,
|
|
4122
|
+
});
|
|
3439
4123
|
writeHandoffNotice(`\ndsh-tui: installation starts. Check/repair an interrupted installation before resuming.${recovery}`);
|
|
3440
4124
|
if (profile === undefined) {
|
|
3441
4125
|
writeHandoffNotice(`\n${t('update-aborted-no-profile')}${recovery}`);
|
|
@@ -3457,7 +4141,7 @@ function runUpdate(ctx, profile, sessionId, targetVersion, kernel, hint = id =>
|
|
|
3457
4141
|
exitSeam.request = replacementRequest;
|
|
3458
4142
|
onSpawn?.(child);
|
|
3459
4143
|
};
|
|
3460
|
-
void updateTuiAndRestart(sessionId, profile,
|
|
4144
|
+
void updateTuiAndRestart(sessionId, profile, plan, kernel, supervision, cancellation.signal).then(({ updateCode, restartCode }) => {
|
|
3461
4145
|
logRestartEvent('update: finished', { updateCode, restartCode });
|
|
3462
4146
|
if (updateCode !== 0) {
|
|
3463
4147
|
writeHandoffNotice(`\ndsh-tui update failed (exit ${updateCode}). Check/repair the installation before resuming.${preservedSessionTail(sessionId, hint)}`);
|