@deepseek-harness-tui/dsh-tui 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -59
- package/bin/dsh-tui.js +46 -3
- package/cordis.patch.yml +5 -3
- package/cordis.yml +3 -2
- package/guide/dsh-tui-guide/codex-backend.en.md +2 -2
- package/guide/dsh-tui-guide/codex-backend.md +2 -2
- package/guide/dsh-tui-guide/configuration.en.md +7 -2
- package/guide/dsh-tui-guide/configuration.md +7 -2
- package/guide/dsh-tui-guide/getting-started.en.md +168 -4
- package/guide/dsh-tui-guide/getting-started.md +121 -14
- package/guide/dsh-tui-guide/interaction.en.md +11 -10
- package/guide/dsh-tui-guide/interaction.md +5 -4
- package/guide/dsh-tui-guide/user-guide.en.md +12 -6
- package/guide/dsh-tui-guide/user-guide.md +12 -6
- package/lib/settings.json +24 -8
- package/lib/types/adapter/ports/channel-ui.d.ts +10 -7
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +67 -8
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/agent/events.d.ts +14 -5
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/agent/session.d.ts +5 -0
- package/lib/types/agent/session.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.d.ts.map +1 -1
- package/lib/types/backends/claude/tools.js +8 -3
- package/lib/types/backends/claude/translate/core.d.ts +2 -2
- package/lib/types/backends/claude/translate/core.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/core.js +10 -6
- package/lib/types/backends/codex/session/commands.d.ts +2 -0
- package/lib/types/backends/codex/session/commands.d.ts.map +1 -1
- package/lib/types/backends/codex/session/commands.js +8 -4
- package/lib/types/backends/codex/session/input.d.ts +11 -7
- package/lib/types/backends/codex/session/input.d.ts.map +1 -1
- package/lib/types/backends/codex/session/input.js +68 -15
- package/lib/types/backends/codex/session/session.d.ts.map +1 -1
- package/lib/types/backends/codex/session/session.js +2 -3
- package/lib/types/backends/codex/translate/presentation.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/presentation.js +5 -2
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/permissions.d.ts +15 -0
- package/lib/types/channel/permissions.d.ts.map +1 -1
- package/lib/types/channel/permissions.js +28 -0
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +89 -11
- package/lib/types/channel/questions.d.ts +45 -3
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/questions.js +43 -0
- package/lib/types/channel/sanitize.d.ts.map +1 -1
- package/lib/types/channel/sanitize.js +8 -4
- package/lib/types/channel/subagent-failure.d.ts +49 -0
- package/lib/types/channel/subagent-failure.d.ts.map +1 -0
- package/lib/types/channel/subagent-failure.js +59 -0
- package/lib/types/channel/transcript.d.ts +17 -0
- package/lib/types/channel/transcript.d.ts.map +1 -1
- package/lib/types/channel/transcript.js +35 -0
- package/lib/types/commands.js +2 -2
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +14 -10
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +61 -6
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +3 -2
- package/lib/types/components/StarPrompt.d.ts +5 -3
- package/lib/types/components/StarPrompt.d.ts.map +1 -1
- package/lib/types/components/StarPrompt.js +56 -6
- package/lib/types/components/SubagentCard.d.ts.map +1 -1
- package/lib/types/components/SubagentCard.js +1 -1
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +9 -2
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +126 -25
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -8
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +7 -4
- package/lib/types/components/questions/PlanReviewPanel.d.ts +3 -6
- package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
- package/lib/types/components/revealScope.d.ts +15 -0
- package/lib/types/components/revealScope.d.ts.map +1 -0
- package/lib/types/components/revealScope.js +17 -0
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +34 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.js +108 -7
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.js +1 -1
- package/lib/types/components/smoothReveal.d.ts +36 -6
- package/lib/types/components/smoothReveal.d.ts.map +1 -1
- package/lib/types/components/smoothReveal.js +92 -21
- package/lib/types/components/teamRoster.d.ts +6 -3
- package/lib/types/components/teamRoster.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +4 -14
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.js +26 -17
- package/lib/types/dsh-adapter/approvals.d.ts +19 -0
- package/lib/types/dsh-adapter/approvals.d.ts.map +1 -1
- package/lib/types/dsh-adapter/approvals.js +17 -1
- package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/session.js +12 -0
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +21 -4
- package/lib/types/dsh-adapter/channel/attached-context.d.ts +15 -2
- package/lib/types/dsh-adapter/channel/attached-context.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/attached-context.js +26 -3
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +3 -0
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +43 -2
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +2 -6
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.js +7 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +2 -6
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.js +3 -26
- package/lib/types/dsh-adapter/channel/emitter.js +1 -1
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +15 -4
- package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
- package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-actions.js +34 -10
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +3 -7
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +14 -5
- package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/local-actions.js +7 -3
- package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.js +26 -9
- package/lib/types/dsh-adapter/channel/model-selection.d.ts +27 -2
- package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-selection.js +81 -37
- package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection-helpers.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/projection-helpers.js +4 -2
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.js +6 -2
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.js +8 -4
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +185 -36
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +55 -4
- package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-projection.js +80 -16
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/subagent-transcript.js +6 -5
- package/lib/types/dsh-adapter/channel/task-completion.js +2 -10
- package/lib/types/dsh-adapter/channel/transcript.d.ts +3 -2
- package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/transcript.js +13 -4
- package/lib/types/dsh-adapter/channel/types.d.ts +11 -2
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts +11 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.d.ts.map +1 -0
- package/lib/types/dsh-adapter/compat/compaction-previews.js +38 -0
- package/lib/types/dsh-adapter/compat/messages.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/messages.js +2 -2
- package/lib/types/dsh-adapter/contract.d.ts +29 -3
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +48 -5
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +5 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.js +0 -2
- package/lib/types/dsh-adapter/fresh-agent.d.ts +1 -1
- package/lib/types/dsh-adapter/fresh-agent.d.ts.map +1 -1
- package/lib/types/dsh-adapter/fresh-agent.js +60 -11
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-access.js +60 -11
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-contract.js +5 -3
- package/lib/types/dsh-adapter/host-dsh.d.ts +2 -8
- package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-dsh.js +30 -6
- package/lib/types/dsh-adapter/host-entry.js +4 -0
- package/lib/types/dsh-adapter/index.d.ts +9 -1
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +5 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts +73 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.d.ts.map +1 -0
- package/lib/types/dsh-adapter/oauth/account-notifications.js +250 -0
- package/lib/types/dsh-adapter/oauth/bonus.d.ts +34 -9
- package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/bonus.js +47 -5
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts +7 -2
- package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/deepseek.js +6 -1
- package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/index.js +44 -0
- package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/profiles.js +14 -1
- package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -1
- package/lib/types/dsh-adapter/oauth/service.js +5 -6
- package/lib/types/dsh-adapter/plugin-manage.d.ts +6 -4
- package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-manage.js +3 -2
- package/lib/types/dsh-adapter/plugin.d.ts +237 -6
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +751 -67
- package/lib/types/dsh-adapter/presets.d.ts +38 -11
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +46 -17
- package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
- package/lib/types/dsh-adapter/process-exit.js +1 -1
- package/lib/types/dsh-adapter/questions.d.ts +3 -4
- package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/questions.js +1 -1
- package/lib/types/dsh-adapter/session-list-metadata.js +2 -2
- package/lib/types/dsh-adapter/session-projection-store.d.ts +1 -1
- package/lib/types/dsh-adapter/session-projection-store.d.ts.map +1 -1
- package/lib/types/dsh-adapter/session-projection-store.js +30 -23
- package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
- package/lib/types/dsh-adapter/sessionTree.js +4 -1
- package/lib/types/dsh-adapter/subagents.d.ts +6 -0
- package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
- package/lib/types/dsh-adapter/subagents.js +32 -3
- package/lib/types/dsh-adapter/team-mode.d.ts +46 -27
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +157 -29
- package/lib/types/dsh-adapter/team-roster.d.ts +53 -18
- package/lib/types/dsh-adapter/team-roster.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-roster.js +206 -39
- package/lib/types/dsh-adapter/team-tools.d.ts +25 -12
- package/lib/types/dsh-adapter/team-tools.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-tools.js +81 -26
- package/lib/types/dsh-adapter/tool-scope.d.ts +24 -0
- package/lib/types/dsh-adapter/tool-scope.d.ts.map +1 -0
- package/lib/types/dsh-adapter/tool-scope.js +127 -0
- package/lib/types/dsh-adapter/types.d.ts +2 -1
- package/lib/types/dsh-adapter/types.d.ts.map +1 -1
- package/lib/types/heldInputs.d.ts +55 -16
- package/lib/types/heldInputs.d.ts.map +1 -1
- package/lib/types/heldInputs.js +277 -41
- package/lib/types/i18n.d.ts +292 -20
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +89 -13
- package/lib/types/ink/components/App.d.ts +2 -0
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +8 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/dom.js +13 -3
- package/lib/types/ink/events/input-event.d.ts.map +1 -1
- package/lib/types/ink/events/input-event.js +7 -6
- package/lib/types/ink/flush-tick.d.ts +6 -0
- package/lib/types/ink/flush-tick.d.ts.map +1 -1
- package/lib/types/ink/flush-tick.js +31 -0
- package/lib/types/ink/hit-test.d.ts +2 -0
- package/lib/types/ink/hit-test.d.ts.map +1 -1
- package/lib/types/ink/hit-test.js +10 -0
- package/lib/types/ink/hooks/use-program-status.d.ts +1 -1
- package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-program-status.js +3 -2
- package/lib/types/ink/hooks/use-terminal-title.d.ts +15 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-terminal-title.js +23 -3
- package/lib/types/ink/ink.d.ts +1 -0
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +7 -4
- package/lib/types/ink/jumpback-state.d.ts +33 -0
- package/lib/types/ink/jumpback-state.d.ts.map +1 -0
- package/lib/types/ink/jumpback-state.js +51 -0
- package/lib/types/ink/jumpback.d.ts +78 -0
- package/lib/types/ink/jumpback.d.ts.map +1 -0
- package/lib/types/ink/jumpback.js +515 -0
- package/lib/types/ink/log-update.js +37 -14
- package/lib/types/ink/notify-helper/activate.cs +836 -0
- package/lib/types/ink/notify-helper/compile.d.ts +30 -0
- package/lib/types/ink/notify-helper/compile.d.ts.map +1 -0
- package/lib/types/ink/notify-helper/compile.js +235 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +25 -0
- package/lib/types/ink/terminal-notification-windows.d.ts +8 -4
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.js +14 -21
- package/lib/types/ink/terminal-notification.d.ts +31 -2
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +51 -0
- package/lib/types/ink/terminal.d.ts +15 -3
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +38 -9
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +1 -1
- package/lib/types/screens/Chat.d.ts +4 -3
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +81 -11
- package/lib/types/screens/SessionSupervisor.d.ts +3 -6
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +5 -8
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +1 -2
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +2 -2
- package/lib/types/screens/sessionSupervisor/model.d.ts +1 -1
- package/lib/types/screens/sessionSupervisor/model.js +1 -1
- package/lib/types/sessionMounts.d.ts +12 -5
- package/lib/types/sessionMounts.d.ts.map +1 -1
- package/lib/types/sessionMounts.js +33 -6
- package/lib/types/settings/definitions.d.ts +12 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +15 -7
- package/lib/types/update.d.ts +412 -20
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +2094 -193
- package/lib/types/updateHost.d.ts +198 -0
- package/lib/types/updateHost.d.ts.map +1 -0
- package/lib/types/updateHost.js +608 -0
- package/lib/types/utils/processName.d.ts +16 -0
- package/lib/types/utils/processName.d.ts.map +1 -0
- package/lib/types/utils/processName.js +27 -0
- package/package.json +114 -111
- package/presets/liangshen/agent.cordis.yml +4 -0
- package/tui-profile/feed/README.md +1 -1
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import coerce from 'semver/functions/coerce.js';
|
|
2
2
|
import { appendFileSync } from 'node:fs';
|
|
3
3
|
import { env } from '../utils/env.js';
|
|
4
|
+
import { isEnvTruthy } from '../utils/envUtils.js';
|
|
4
5
|
import { gte } from '../utils/semver.js';
|
|
5
6
|
import { CURSOR_HOME, cursorMove, cursorTo, ERASE_SCREEN, eraseLines, SGR_RESET, } from './termio/csi.js';
|
|
6
7
|
import { BSU, ESU, HIDE_CURSOR, SHOW_CURSOR } from './termio/dec.js';
|
|
@@ -257,13 +258,21 @@ export function supportsDecrqmProbe() {
|
|
|
257
258
|
// env.terminal is lowercased (utils/env.ts) and falls back to TERM when
|
|
258
259
|
// TERM_PROGRAM is unset — kitty doesn't set TERM_PROGRAM, so its TERM
|
|
259
260
|
// (xterm-kitty) is listed too. Warp sets TERM_PROGRAM=WarpTerminal and
|
|
260
|
-
// implements the kitty keyboard protocol (issue #110).
|
|
261
|
+
// implements the kitty keyboard protocol (issue #110). Rio implements it too,
|
|
262
|
+
// and 0.5.x honors the push with no extra configuration; an older rio that
|
|
263
|
+
// turned `use-kitty-keyboard-protocol` off stays inert, and a terminal that
|
|
264
|
+
// does not implement the sequence ignores it either way (issue #1820).
|
|
265
|
+
// Orca's panes are xterm.js with the kitty keyboard extension enabled but no
|
|
266
|
+
// modifyOtherKeys; match TERM_PROGRAM=Orca specifically — its XTVERSION is
|
|
267
|
+
// `xterm.js(...)`, identical to VS Code, which must stay off (issue #1522).
|
|
261
268
|
const EXTENDED_KEYS_TERMINALS = [
|
|
262
269
|
'iterm.app',
|
|
263
270
|
'kitty',
|
|
264
271
|
'xterm-kitty',
|
|
265
272
|
'wezterm',
|
|
266
273
|
'ghostty',
|
|
274
|
+
'rio',
|
|
275
|
+
'orca',
|
|
267
276
|
'tmux',
|
|
268
277
|
'warpterminal',
|
|
269
278
|
'windows-terminal',
|
|
@@ -276,12 +285,27 @@ const EXTENDED_KEYS_TERMINALS = [
|
|
|
276
285
|
* covers navigation keys. It does NOT cover Enter (microsoft/terminal#530);
|
|
277
286
|
* Shift+Enter on native Windows needs win32-input-mode instead — see
|
|
278
287
|
* supportsWin32InputMode (issue #147).
|
|
279
|
-
*
|
|
288
|
+
*
|
|
289
|
+
* Two env hatches keep the allowlist from being a hard ceiling, because there
|
|
290
|
+
* is no reliable runtime probe for this: a terminal that implements the
|
|
291
|
+
* protocol but is missing from the list can opt in with
|
|
292
|
+
* `DSH_TUI_FORCE_EXTENDED_KEYS=1`, and an allowlisted terminal reached
|
|
293
|
+
* through a layer that rewrites input (SSH, a nested xterm.js host) can opt
|
|
294
|
+
* out with `DSH_TUI_DISABLE_EXTENDED_KEYS=1`. The opt-out wins when both are
|
|
295
|
+
* set: a broken encoding is worse than a missing modifier. Both go through
|
|
296
|
+
* `isEnvTruthy` so `true`/`yes`/`on` work like every other DSH_TUI switch.
|
|
297
|
+
* @param terminal - lowercased terminal identity, defaults to `env.terminal`.
|
|
298
|
+
* @param environment - optional capability environment, defaults to the process.
|
|
299
|
+
* @returns true when the terminal should receive the extended-key push.
|
|
280
300
|
*/
|
|
281
|
-
export function supportsExtendedKeys() {
|
|
282
|
-
if (
|
|
301
|
+
export function supportsExtendedKeys(terminal = env.terminal, environment = process.env) {
|
|
302
|
+
if (isEnvTruthy(environment.DSH_TUI_DISABLE_EXTENDED_KEYS))
|
|
303
|
+
return false;
|
|
304
|
+
if (isEnvTruthy(environment.DSH_TUI_FORCE_EXTENDED_KEYS))
|
|
305
|
+
return true;
|
|
306
|
+
if (environment.WT_SESSION)
|
|
283
307
|
return true;
|
|
284
|
-
return EXTENDED_KEYS_TERMINALS.includes(
|
|
308
|
+
return EXTENDED_KEYS_TERMINALS.includes(terminal);
|
|
285
309
|
}
|
|
286
310
|
/**
|
|
287
311
|
* True when win32-input-mode (DECSET 9001, `CSI ? 9001 h`) should drive
|
|
@@ -489,11 +513,16 @@ export function serializeDiff(terminal, diff, skipSyncMarkers = false) {
|
|
|
489
513
|
* @param terminal - the terminal to write to.
|
|
490
514
|
* @param diff - the frame diff patches to render.
|
|
491
515
|
* @param skipSyncMarkers - when true, omit the BSU/ESU wrapping.
|
|
516
|
+
* @param onWritten - optional completion receipt for this frame, including prior queued output.
|
|
492
517
|
*/
|
|
493
|
-
export function writeDiffToTerminal(terminal, diff, skipSyncMarkers = false) {
|
|
518
|
+
export function writeDiffToTerminal(terminal, diff, skipSyncMarkers = false, onWritten) {
|
|
494
519
|
const buffer = serializeDiff(terminal, diff, skipSyncMarkers);
|
|
495
|
-
if (buffer === '')
|
|
520
|
+
if (buffer === '' && onWritten === undefined)
|
|
496
521
|
return;
|
|
497
|
-
|
|
498
|
-
|
|
522
|
+
// A presentation waiter needs the stream's completion, not just enqueueing.
|
|
523
|
+
// An empty diff uses an empty write as a barrier for earlier queued bytes.
|
|
524
|
+
if (onWritten === undefined)
|
|
525
|
+
terminal.stdout.write(buffer);
|
|
526
|
+
else
|
|
527
|
+
terminal.stdout.write(buffer, onWritten);
|
|
499
528
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentTranscriptScene.d.ts","sourceRoot":"","sources":["../../../src/screens/AgentTranscriptScene.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhE,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,8CAA8C,CA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AKL,KAAK,gBAAgB,EACtB,MAAM,8CAA8C,CAAA;AAIrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAwDrI,MAAM,WAAW,yBAAyB;IACxC;kEAC8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAChC,sEAAsE;IACtE,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAA;IACjD,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,MAAM,IAAI,IAAI,CAAA;IACd;;gCAE4B;IAC5B,cAAc,CAAC,EAAE,gBAAgB,CAAA;IACjC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;IAC/C;6DACyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;KAAE,CAAA;IACjG;;6BAEyB;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IAC1C;;8EAE0E;IAC1E,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC1C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAa,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,yBAAyB,GAAG,KAAK,CAAC,SAAS,CA+T3L"}
|
|
@@ -209,7 +209,7 @@ export function AgentTranscriptScene({ subagent, onFailureRead, source, onExit,
|
|
|
209
209
|
: `${liveBadge === '' ? '' : ` · ${liveBadge}`} · ${t('agent-view-readonly')} · id ${agentId.slice(0, 8)}`;
|
|
210
210
|
const fallbackTail = subagent.outputEvents;
|
|
211
211
|
const retained = fallbackTail.length >= OUTPUT_WINDOW_CAP;
|
|
212
|
-
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { color: "accent", bold: true, children: "\u2922" }) }), _jsx(Box, { flexShrink: 1, minWidth: 0, children: _jsx(Text, { bold: true, wrap: "truncate-end", children: headerLabel }) }), _jsx(Box, { flexShrink: 0, children: _jsx(Text, { dimColor: true, children: headerBadges }) }), _jsx(Box, { flexGrow: 1 }), _jsx(Box, { flexShrink: 0, children: _jsx(ExitButton, { onClick: onExit }) })] }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: `${t('agent-view-title')} · ${sourceLabel(source)} · ${t('agent-view-back')}: Esc${headerWidth < 44 ? '' : ` · ↑/↓ ${t('subagent-hint-scroll')} · o ${t('subagent-transcript-load-older', { count: TRANSCRIPT_OLDER_CHUNK })}`}` }), _jsxs(Box, { flexDirection: "row", paddingX: 1, maxHeight: Math.max(10, rows - (compose !== undefined ? 12 : 6)), children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, minWidth: panelEnabled ? 44 : 0, children: _jsx(ScrollBox, { ref: scrollRef, flexDirection: "column", flexGrow: 1, children: loadTranscript === undefined ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: t('agent-view-no-transcript') }), retained && (_jsx(Text, { dimColor: true, children: t('agent-view-retained-tail', { count: fallbackTail.length }) })), fallbackTail.length === 0 && messages.length === 0 && (_jsx(Text, { dimColor: true, children: t('subagent-no-output') })), fallbackTail.map((line, index) => (_jsxs(Text, { wrap: "wrap", dimColor: line.kind === 'thinking' || line.kind === 'system', italic: line.kind === 'thinking', color: line.kind === 'error' ? 'error' : undefined, children: [line.text, !line.settled && isRunning ? ' ▍' : ''] }, `tail-${index}`))), messages.map(message => (_jsx(AgentMessageLeafRow, { message: message, selfAgentId: agentId, marginTopOnTurn: true }, `am-${message.messageId}`)))] })) : (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: `${hasHistory ? t('agent-view-history') : t('agent-view-live')} · ${t('agent-view-readonly')}` }), transcript.status === 'ready' && transcript.parentAgentId !== null && (_jsx(Text, { dimColor: true, children: t('subagent-transcript-parent', { id: transcript.parentAgentId.slice(0, 8) }) })), transcript.status === 'ready' && transcript.parentAgentId === null && (subagent.depth ?? 1) >= 2 && (_jsx(Text, { dimColor: true, children: t('subagent-transcript-old-format', { depth: subagent.depth ?? 2 }) })), transcript.status === 'loading' && _jsx(Text, { dimColor: true, children: `⏳ ${t('subagent-transcript-loading')}` }), transcript.status === 'unavailable' && _jsx(Text, { color: "error", children: t('subagent-transcript-unavailable') }), transcript.status === 'ready' && (() => {
|
|
212
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { color: "accent", bold: true, children: "\u2922" }) }), _jsx(Box, { flexShrink: 1, minWidth: 0, children: _jsx(Text, { bold: true, wrap: "truncate-end", children: headerLabel }) }), subagent.name !== undefined && subagent.name !== '' && (_jsx(Box, { flexShrink: 1, minWidth: 0, overflow: "hidden", children: _jsx(Text, { color: "accent", wrap: "truncate-end", children: subagent.name }) })), _jsx(Box, { flexShrink: 0, children: _jsx(Text, { dimColor: true, children: headerBadges }) }), _jsx(Box, { flexGrow: 1 }), _jsx(Box, { flexShrink: 0, children: _jsx(ExitButton, { onClick: onExit }) })] }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: `${t('agent-view-title')} · ${sourceLabel(source)} · ${t('agent-view-back')}: Esc${headerWidth < 44 ? '' : ` · ↑/↓ ${t('subagent-hint-scroll')} · o ${t('subagent-transcript-load-older', { count: TRANSCRIPT_OLDER_CHUNK })}`}` }), _jsxs(Box, { flexDirection: "row", paddingX: 1, maxHeight: Math.max(10, rows - (compose !== undefined ? 12 : 6)), children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, minWidth: panelEnabled ? 44 : 0, children: _jsx(ScrollBox, { ref: scrollRef, flexDirection: "column", flexGrow: 1, children: loadTranscript === undefined ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: t('agent-view-no-transcript') }), retained && (_jsx(Text, { dimColor: true, children: t('agent-view-retained-tail', { count: fallbackTail.length }) })), fallbackTail.length === 0 && messages.length === 0 && (_jsx(Text, { dimColor: true, children: t('subagent-no-output') })), fallbackTail.map((line, index) => (_jsxs(Text, { wrap: "wrap", dimColor: line.kind === 'thinking' || line.kind === 'system', italic: line.kind === 'thinking', color: line.kind === 'error' ? 'error' : undefined, children: [line.text, !line.settled && isRunning ? ' ▍' : ''] }, `tail-${index}`))), messages.map(message => (_jsx(AgentMessageLeafRow, { message: message, selfAgentId: agentId, marginTopOnTurn: true }, `am-${message.messageId}`)))] })) : (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: `${hasHistory ? t('agent-view-history') : t('agent-view-live')} · ${t('agent-view-readonly')}` }), transcript.status === 'ready' && transcript.parentAgentId !== null && (_jsx(Text, { dimColor: true, children: t('subagent-transcript-parent', { id: transcript.parentAgentId.slice(0, 8) }) })), transcript.status === 'ready' && transcript.parentAgentId === null && (subagent.depth ?? 1) >= 2 && (_jsx(Text, { dimColor: true, children: t('subagent-transcript-old-format', { depth: subagent.depth ?? 2 }) })), transcript.status === 'loading' && _jsx(Text, { dimColor: true, children: `⏳ ${t('subagent-transcript-loading')}` }), transcript.status === 'unavailable' && _jsx(Text, { color: "error", children: t('subagent-transcript-unavailable') }), transcript.status === 'ready' && (() => {
|
|
213
213
|
const merged = mergeLiveWindow(transcript.leaves, subagent, true);
|
|
214
214
|
const liveStart = merged.findIndex(row => row.kind === 'live');
|
|
215
215
|
if (merged.length === 0)
|
|
@@ -112,9 +112,10 @@ export declare function Chat({ channel, questionStore, approvalStore, extensionD
|
|
|
112
112
|
*/
|
|
113
113
|
onPluginManage?: (args: string, sink: PluginManageSink) => PluginManageFlow | undefined;
|
|
114
114
|
/**
|
|
115
|
-
* `/team [status]`, wired to `createTeamCommandEntry`: a
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* `/team [status|on|off]`, wired to `createTeamCommandEntry`: on a selection
|
|
116
|
+
* host it writes the saved per-root switch; on a bundle host it reports and
|
|
117
|
+
* points at `/plugin enable|disable`, or at the enable route when the team
|
|
118
|
+
* service is not mounted. `undefined` on a backend without it.
|
|
118
119
|
*/
|
|
119
120
|
onTeamCommand?: (args: string, sink: TeamCommandSink) => Promise<readonly string[]>;
|
|
120
121
|
/** 启动参数(Config 行 / DSH_TUI_BACKEND)压过了记忆:选择器明说。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/screens/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/screens/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AA+BzB,OAAO,KAAK,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAwB,MAAM,0BAA0B,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAe,MAAM,kCAAkC,CAAA;AAW7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAO5D,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAkBvF,OAAO,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,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAA;IACnF,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;IAC9D;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,IAAI,CAAA;IAC5G;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;CAC/D,mBAw1NA"}
|
|
@@ -15,6 +15,8 @@ import { AlternateScreen, Box, Image, Text, InputCaret, useInput, useApp, useStd
|
|
|
15
15
|
import { usePageInset } from '../components/PageMargin.js';
|
|
16
16
|
import { POINTER } from '../terminal-utils/figures.js';
|
|
17
17
|
import { previousCodePoint } from '../components/AgentMessageComposer.js';
|
|
18
|
+
import { resetRevealSession } from '../components/smoothReveal.js';
|
|
19
|
+
import { RevealScopeContext } from '../components/revealScope.js';
|
|
18
20
|
import { isPlainReturnInput } from '../utils/modifiers.js';
|
|
19
21
|
import { actionMatches, effectiveComboDisplay, primaryComboString } from '../utils/keymap.js';
|
|
20
22
|
import { formatTokens } from '../terminal-utils/format.js';
|
|
@@ -344,6 +346,8 @@ const EMPTY_KERNEL_ENTRIES = [];
|
|
|
344
346
|
function peekKey(image, title) {
|
|
345
347
|
return `${title ?? ''} ${image.id}`;
|
|
346
348
|
}
|
|
349
|
+
/** Distinguishes reveal keyspaces of concurrently mounted Chat roots. */
|
|
350
|
+
let revealRootSequence = 0;
|
|
347
351
|
export function Chat({ channel, questionStore, approvalStore, extensionDialogs, bonusNotices, extensionStatus, activityStore, extensionShortcuts, themeHost, onExit, onUpdate, onRestart, onSwitchBackend, onRestartFreshSession, onProbeKernels, kernelEntries = EMPTY_KERNEL_ENTRIES, onResolveSdkInstall, onPluginInstall, onPluginManage, onTeamCommand, kernelPinned, fullscreen = false, trajectorySeen: trajectorySeenProp, injectControllerRef, promptControllerRef: promptControllerRefProp, renderScene, openHomeOnBoot, launchpadOnBoot, onboardingOnBoot, starPrompt, }) {
|
|
348
352
|
const { internal_eventEmitter: inputEmitter } = useStdin();
|
|
349
353
|
const writeRaw = React.useContext(TerminalWriteContext);
|
|
@@ -1441,7 +1445,27 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
1441
1445
|
ink?.clearScrollbackAndRedraw();
|
|
1442
1446
|
}, 0);
|
|
1443
1447
|
};
|
|
1448
|
+
// This root's reveal keyspace. A process can hold more than one Chat root
|
|
1449
|
+
// (a plugin recompose or a remount builds a fresh tree), and each owns its
|
|
1450
|
+
// row ids: sharing one table let a rebind in one root clear another's
|
|
1451
|
+
// completed keys, so its history re-typewrote from the start.
|
|
1452
|
+
const revealScopeRef = React.useRef(undefined);
|
|
1453
|
+
if (revealScopeRef.current === undefined)
|
|
1454
|
+
revealScopeRef.current = `chat-root-${++revealRootSequence}`;
|
|
1455
|
+
const bindingGeneration = channel.agentBindingGeneration;
|
|
1456
|
+
// The binding generation is part of the keyspace, not a reset trigger: a
|
|
1457
|
+
// re-resume replays its rows in the same commit that bumps the generation,
|
|
1458
|
+
// so a layout-phase reset would run *after* that frame had already built its
|
|
1459
|
+
// caught-up cursors — the next live delta would repaint the row from zero.
|
|
1460
|
+
// A new scope leaves the old keys unreachable instead, and the effect below
|
|
1461
|
+
// releases them as soon as the scope is replaced.
|
|
1462
|
+
const revealScope = `${revealScopeRef.current}:b${bindingGeneration}`;
|
|
1463
|
+
// The tables are module-level, so a scope that stops being used (a rebind
|
|
1464
|
+
// or the root unmounting) must say so: its keys would otherwise outlive it
|
|
1465
|
+
// for the life of the process.
|
|
1466
|
+
React.useEffect(() => () => resetRevealSession(revealScope), [revealScope]);
|
|
1444
1467
|
const lastAgentIdRef = React.useRef(undefined);
|
|
1468
|
+
const lastResetScopeRef = React.useRef(revealScope);
|
|
1445
1469
|
React.useEffect(() => {
|
|
1446
1470
|
const id = channel.agentId;
|
|
1447
1471
|
if (lastAgentIdRef.current === undefined) {
|
|
@@ -1451,6 +1475,17 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
1451
1475
|
if (lastAgentIdRef.current === id)
|
|
1452
1476
|
return;
|
|
1453
1477
|
lastAgentIdRef.current = id;
|
|
1478
|
+
// Reveal state is keyed by row id, and ids restart at 0 after an adopt:
|
|
1479
|
+
// without this, a completed `a12` from the old session would suppress (or
|
|
1480
|
+
// an in-flight cursor would resume over) the new session's row 12. A
|
|
1481
|
+
// switch that also bumped the binding generation already moved to a fresh
|
|
1482
|
+
// keyspace, and this frame's replay wrote caught-up cursors into it:
|
|
1483
|
+
// clearing that scope here would repaint the resumed row from zero, so
|
|
1484
|
+
// only a switch that kept the keyspace needs the reset.
|
|
1485
|
+
const sameKeyspace = lastResetScopeRef.current === revealScope;
|
|
1486
|
+
lastResetScopeRef.current = revealScope;
|
|
1487
|
+
if (sameKeyspace)
|
|
1488
|
+
resetRevealSession(revealScope);
|
|
1454
1489
|
setExpanded(false);
|
|
1455
1490
|
setExpandedRows(new Set());
|
|
1456
1491
|
setSelectedId(null);
|
|
@@ -2189,8 +2224,8 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
2189
2224
|
const thinkingStatus = useThinkingStatus(channel.spinnerMode === 'thinking');
|
|
2190
2225
|
const terminalFocused = useTerminalFocus();
|
|
2191
2226
|
// Gate the stream this app renders to; embedders may replace process.stdout.
|
|
2192
|
-
const { stdout
|
|
2193
|
-
const programStatusEnabled = React.useMemo(() => supportsProgramStatus(
|
|
2227
|
+
const { stdout } = useApp();
|
|
2228
|
+
const programStatusEnabled = React.useMemo(() => supportsProgramStatus(stdout.isTTY === true), [stdout]);
|
|
2194
2229
|
// Mouse text selection auto-copy: active only in
|
|
2195
2230
|
// fullscreen (<AlternateScreen> supplies mouse tracking); a no-op
|
|
2196
2231
|
// subscription in inline mode, where selection belongs to the terminal.
|
|
@@ -2414,6 +2449,8 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
2414
2449
|
lines.push(t('command-output-truncated'));
|
|
2415
2450
|
// The report already has a cell cap. Avoid a second UTF-16 preview cut
|
|
2416
2451
|
// splitting an emoji or a combining sequence in the local row sink.
|
|
2452
|
+
// A side-effect-only command can return no text: with no report there
|
|
2453
|
+
// is nothing to title, so keep the same guard as the block branch.
|
|
2417
2454
|
if (lines.length > 0)
|
|
2418
2455
|
channel.pushLocal(`/${name}`, lines, { lineLimit: 65_536, preserveWhitespace: true });
|
|
2419
2456
|
if (outcome.kind === 'error') {
|
|
@@ -3005,7 +3042,11 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
3005
3042
|
case 'clear':
|
|
3006
3043
|
channel.clear();
|
|
3007
3044
|
// channel.clear() resets row ids to 0; stale expanded/selection
|
|
3008
|
-
// state would mis-highlight fresh rows (known-limitation fix).
|
|
3045
|
+
// state would mis-highlight fresh rows (known-limitation fix). The
|
|
3046
|
+
// reveal memory is keyed by the same ids: left alone, the new
|
|
3047
|
+
// session's first rows would hit the old `a0…aN` entries and paint
|
|
3048
|
+
// without their reveal.
|
|
3049
|
+
resetRevealSession(revealScope);
|
|
3009
3050
|
setExpandedRows(new Set());
|
|
3010
3051
|
setStreamViewToggledRows(new Set());
|
|
3011
3052
|
setSelectedId(null);
|
|
@@ -3579,7 +3620,8 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
3579
3620
|
return true;
|
|
3580
3621
|
}
|
|
3581
3622
|
case 'team': {
|
|
3582
|
-
// `/team
|
|
3623
|
+
// `/team`(team-mode.ts):0.2.2-rc.2 选择宿主执行 on|off 写会话级开关;
|
|
3624
|
+
// 旧 bundle 宿主只报告并指向 /plugin enable|disable。
|
|
3583
3625
|
// 服务未挂载时这一行不在命令表里,但手敲仍会走到这里,拿回开启提示。
|
|
3584
3626
|
setHelpOpen(false);
|
|
3585
3627
|
if (onTeamCommand === undefined) {
|
|
@@ -4516,12 +4558,40 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
4516
4558
|
&& !supervisorOpen && !treeOpen && !settingsOpen && !jobsPanelOpen
|
|
4517
4559
|
&& !sceneOpen && !subagentDashboardOpen && subagentDetailId === null
|
|
4518
4560
|
&& !btwSceneOpen;
|
|
4561
|
+
const couponRootRef = React.useRef(null);
|
|
4562
|
+
const couponGeometryRef = React.useRef(null);
|
|
4563
|
+
React.useLayoutEffect(() => {
|
|
4564
|
+
const columns = stdout.columns;
|
|
4565
|
+
const rows = stdout.rows;
|
|
4566
|
+
const previous = couponGeometryRef.current;
|
|
4567
|
+
// No card: skip the per-commit yoga measurement. Physical size is still
|
|
4568
|
+
// recorded so a card that appears together with a resize is not
|
|
4569
|
+
// reanchored on top of the resize repaint the renderer already did.
|
|
4570
|
+
if (!couponVisible) {
|
|
4571
|
+
couponGeometryRef.current = { visible: false, height: 0, columns, rows };
|
|
4572
|
+
return;
|
|
4573
|
+
}
|
|
4574
|
+
const height = couponRootRef.current?.yogaNode?.getComputedHeight();
|
|
4575
|
+
couponGeometryRef.current = height === undefined ? null : { visible: couponVisible, height, columns, rows };
|
|
4576
|
+
// Inline shrink preserves transcript scrollback, so its document bottom can
|
|
4577
|
+
// move above the viewport bottom. Reanchor the modal after its new geometry
|
|
4578
|
+
// commits, including an idle-layout shrink while the same card stays open.
|
|
4579
|
+
// Requesting this before the commit lets a pending old frame consume it.
|
|
4580
|
+
// Terminal viewport changes already get a resize repaint in the renderer.
|
|
4581
|
+
if (couponVisible && height !== undefined
|
|
4582
|
+
&& (previous === null
|
|
4583
|
+
|| (previous.columns === columns && previous.rows === rows
|
|
4584
|
+
&& (!previous.visible || height < previous.height)))) {
|
|
4585
|
+
instances.get(stdout)?.reanchorViewport();
|
|
4586
|
+
}
|
|
4587
|
+
});
|
|
4519
4588
|
const markCouponShown = React.useCallback((orderId) => {
|
|
4520
|
-
|
|
4521
|
-
|
|
4589
|
+
if (coupon !== null)
|
|
4590
|
+
bonusNotices?.shown(orderId, coupon);
|
|
4591
|
+
}, [bonusNotices, coupon]);
|
|
4522
4592
|
const closeCoupon = React.useCallback(() => {
|
|
4523
4593
|
if (coupon !== null)
|
|
4524
|
-
bonusNotices?.dismiss(coupon.orderId);
|
|
4594
|
+
bonusNotices?.dismiss(coupon.orderId, coupon);
|
|
4525
4595
|
}, [bonusNotices, coupon]);
|
|
4526
4596
|
/**
|
|
4527
4597
|
* Escalation surface for a wedged abort. `cancelPending` means a turn was
|
|
@@ -6045,7 +6115,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
6045
6115
|
runFileAction(index, path);
|
|
6046
6116
|
} }) })), overlay.kind === 'search' && _jsx(TranscriptSearch, { query: searchQuery, cursorOffset: searchCursor, count: searchCount, current: searchCurrent })] }));
|
|
6047
6117
|
// Every scene retains the title, while its frame state stays in a null leaf.
|
|
6048
|
-
const withTitle = (content) => (_jsxs(
|
|
6118
|
+
const withTitle = (content) => (_jsxs(RevealScopeContext.Provider, { value: revealScope, children: [_jsx(ChatTitle, { title: channel.sessionTitle, working: channel.working, focused: terminalFocused }), content] }));
|
|
6049
6119
|
const screenOpen = channel.pluginScene !== undefined || supervisorOpen || settingsOpen
|
|
6050
6120
|
|| subagentDetailId !== null || subagentDashboardOpen || sceneOpen
|
|
6051
6121
|
|| agentView !== null
|
|
@@ -6209,7 +6279,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
6209
6279
|
const messageControl = channel.subagentControl?.message;
|
|
6210
6280
|
const loadTranscript = channel.subagentControl?.history;
|
|
6211
6281
|
const viewMessages = messageControl === undefined ? [] : messageControl.messages().filter(m => m.from === agentView.agentId || m.to === agentView.agentId);
|
|
6212
|
-
const viewTarget = agentComposeTargetOf(agentView.agentId, new Map(channel.subagents.map(s => [s.agentId, s.description])));
|
|
6282
|
+
const viewTarget = agentComposeTargetOf(agentView.agentId, new Map(channel.subagents.map(s => [s.agentId, s.name !== undefined && s.name !== '' ? s.name : s.description])));
|
|
6213
6283
|
const viewScene = (_jsx(AgentTranscriptScene, { subagent: viewSubagent, onFailureRead: agent => subagentFailureRead.acknowledge(failureScope, agent), source: agentView.source, onExit: () => exitAgentView(agentView.source), ...(loadTranscript === undefined ? {} : { loadTranscript }), messages: viewMessages, ...(messageControl === undefined ? {} : { compose: { control: messageControl, target: viewTarget } }), roster: channel.subagents,
|
|
6214
6284
|
// Switching to a sibling or the parent swaps the viewed agent in
|
|
6215
6285
|
// place; Esc still returns to the original entry point.
|
|
@@ -6228,7 +6298,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
6228
6298
|
}
|
|
6229
6299
|
const detailControl = channel.subagentControl?.message;
|
|
6230
6300
|
const detailMessages = detailControl === undefined ? [] : detailControl.messages().filter(m => m.from === subagent.agentId || m.to === subagent.agentId);
|
|
6231
|
-
const detailTarget = agentComposeTargetOf(subagent.agentId, new Map(channel.subagents.map(s => [s.agentId, s.description])));
|
|
6301
|
+
const detailTarget = agentComposeTargetOf(subagent.agentId, new Map(channel.subagents.map(s => [s.agentId, s.name !== undefined && s.name !== '' ? s.name : s.description])));
|
|
6232
6302
|
const scene = (_jsx(SubagentDetailScene, { subagent: subagent, onFailureRead: agent => subagentFailureRead.acknowledge(failureScope, agent), onInterrupt: (id) => channel.subagentControl?.interrupt(id), ...(channel.subagentControl?.history === undefined ? {} : { loadTranscript: channel.subagentControl.history }), onOpenView: () => openAgentView(subagent.agentId, { kind: 'agent-detail', agentId: subagent.agentId }), messages: detailMessages, ...(detailControl === undefined ? {} : { compose: { control: detailControl, target: detailTarget } }), onBack: () => {
|
|
6233
6303
|
setSubagentDetailId(null);
|
|
6234
6304
|
setSubagentDashboardOpen(true);
|
|
@@ -6478,7 +6548,7 @@ export function Chat({ channel, questionStore, approvalStore, extensionDialogs,
|
|
|
6478
6548
|
? () => setPeekSuppressed(peekKey(activePreview.image, activePreview.title))
|
|
6479
6549
|
: () => dispatchOverlay({ type: 'close-if', kind: 'image-preview' }), region: imagePreviewRegion }))
|
|
6480
6550
|
: null;
|
|
6481
|
-
return withTitle(_jsxs(Box, { flexDirection: "column", flexGrow: 1, width: "100%", children: [_jsxs(SidePanelLayout, { geometry: sidePanel.geometry, focus: sidePanel.focus, onActivateChat: sidePanel.focusChat, onActivatePanel: sidePanel.focusPanel, onResize: sidePanel.resize, side: _jsx(SidePanelColumn, { width: sidePanel.panelColumns, controller: sidePanel, channel: channel, activity: workingActivity, attention: {
|
|
6551
|
+
return withTitle(_jsxs(Box, { ref: couponRootRef, flexDirection: "column", flexGrow: 1, width: "100%", children: [_jsxs(SidePanelLayout, { geometry: sidePanel.geometry, focus: sidePanel.focus, onActivateChat: sidePanel.focusChat, onActivatePanel: sidePanel.focusPanel, onResize: sidePanel.resize, side: _jsx(SidePanelColumn, { width: sidePanel.panelColumns, controller: sidePanel, channel: channel, activity: workingActivity, attention: {
|
|
6482
6552
|
approvals: approvalSnapshot !== null ? 1 : 0,
|
|
6483
6553
|
questions: questionSnapshot !== null ? 1 : 0,
|
|
6484
6554
|
}, trajectory: trajectory, onExpand: openPanelFullscreen }), children: [!isSticky && timeline.activeId !== null && (_jsx(PinnedTurnHeader, { text: anchorUserText || null, onClick: () => {
|
|
@@ -72,12 +72,9 @@ export declare function SessionSupervisor({ channel, home, onClose, onOpenSessio
|
|
|
72
72
|
* directly. It used to be offset by the `+` row that led the rail, which is
|
|
73
73
|
* gone — a workspace joins the ledger by being a terminal's launch directory.
|
|
74
74
|
*
|
|
75
|
-
* `capacity`
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* entries made the window believe it could show twice as many workspaces as it
|
|
79
|
-
* can, and the focused entry was simply clipped away by `overflow="hidden"`
|
|
80
|
-
* while the user navigated it blind.
|
|
75
|
+
* `capacity` counts entries after accounting for {@link WORKSPACE_ROW_LINES}.
|
|
76
|
+
* Previously, two-line entries were budgeted as one terminal row, clipping
|
|
77
|
+
* the focused workspace out of the viewport.
|
|
81
78
|
*/
|
|
82
79
|
export declare function railWindowTop(focus: number, entryCount: number, capacity: number): number;
|
|
83
80
|
/** Re-exported so a regression can drive the spinner without importing ink. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionSupervisor.d.ts","sourceRoot":"","sources":["../../../src/screens/SessionSupervisor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAahF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAEpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAUzH,OAAO,KAAK,EAAqB,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,KAAK,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAMpE,OAAO,EAA2L,mBAAmB,EAAsD,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AACpU,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;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|
|
501
501
|
const next = { col: event.col, row: event.row, item: 0 };
|
|
502
502
|
tabMenuRef.current = next;
|
|
503
503
|
setTabMenu(next);
|
|
504
|
-
} }) }))] }), _jsx(Divider, { bleed: true }), pathRows > 0 && (_jsx(Box, { flexDirection: "column", flexShrink: 0, paddingX: 1, ...pathTooltip, children: pathLines.map((line, index) => _jsx(Text, { dimColor: true, children: line }, index)) })), tab !== DSH_TAB && (_jsx(ForeignSessionPanes, { model: foreign, sourceLabel: activeSource?.label ?? tab,
|
|
504
|
+
} }) }))] }), _jsx(Divider, { bleed: true }), pathRows > 0 && (_jsx(Box, { flexDirection: "column", flexShrink: 0, paddingX: 1, ...pathTooltip, children: pathLines.map((line, index) => _jsx(Text, { dimColor: true, children: line }, index)) })), tab !== DSH_TAB && (_jsx(ForeignSessionPanes, { model: foreign, sourceLabel: activeSource?.label ?? tab, now: now, query: query, notice: notice, railVisible: railVisible, railWidth: railWidth, railEntryCapacity: visibleRailCapacity, sessionWidth: sessionWidth, rows: rows - pathRows, isTerminalFocused: isTerminalFocused, filterFocused: filterFocused, cursorActive: cursorActive, onFilterFocus: setFilterFocused })), tab === DSH_TAB && (_jsxs(Box, { flexDirection: "row", flexGrow: 1, flexShrink: 1, overflow: "hidden", children: [railVisible && (_jsxs("ink-box", { style: { flexDirection: 'column', width: railWidth, height: '100%', flexShrink: 0, overflow: 'hidden' }, onClick: focusRail, onMouseEnter: focusRail, onWheel: (event) => {
|
|
505
505
|
setFilterFocused(false);
|
|
506
506
|
moveRail(event.deltaY >= 0 ? 1 : -1);
|
|
507
507
|
}, children: [_jsx(Box, { height: 1, flexShrink: 0, overflow: "hidden", paddingX: 1, children: _jsx(Text, { dimColor: true, children: truncateWidth(railEntries.length === entries.length
|
|
508
508
|
? t('home-section-workspaces', { n: entries.length })
|
|
509
509
|
: t('supervisor-workspace-groups', { registered: entries.length, history: railEntries.length - entries.length }), railWidth - 2) }) }), !loading && railEntries.length === 0 && (_jsx(Box, { paddingX: 1, children: _jsx(Text, { dimColor: true, italic: true, wrap: "truncate-end", children: truncateWidth(t('home-no-workspaces'), railWidth - 2) }) })), visibleRailRows.map((entry) => {
|
|
510
510
|
const absolute = railEntries.indexOf(entry);
|
|
511
|
-
return (_jsx(HomeWorkspaceRow, { title: entry.title,
|
|
511
|
+
return (_jsx(HomeWorkspaceRow, { title: entry.title, sessionCount: countOf(entry), historyOnly: entry.from === 'unregistered', present: entry.present, selected: selected !== undefined && selected.id === entry.id, focused: activePane === 'rail' && railFocus === absolute, declareCursor: cursorActive && !searchCursor, width: railWidth, onSelect: (event) => {
|
|
512
512
|
event.stopImmediatePropagation();
|
|
513
513
|
setFilterFocused(false);
|
|
514
514
|
railRef.current = absolute;
|
|
@@ -586,12 +586,9 @@ export function SessionSupervisor({ channel, home, onClose, onOpenSession, onNew
|
|
|
586
586
|
* directly. It used to be offset by the `+` row that led the rail, which is
|
|
587
587
|
* gone — a workspace joins the ledger by being a terminal's launch directory.
|
|
588
588
|
*
|
|
589
|
-
* `capacity`
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
* entries made the window believe it could show twice as many workspaces as it
|
|
593
|
-
* can, and the focused entry was simply clipped away by `overflow="hidden"`
|
|
594
|
-
* while the user navigated it blind.
|
|
589
|
+
* `capacity` counts entries after accounting for {@link WORKSPACE_ROW_LINES}.
|
|
590
|
+
* Previously, two-line entries were budgeted as one terminal row, clipping
|
|
591
|
+
* the focused workspace out of the viewport.
|
|
595
592
|
*/
|
|
596
593
|
export function railWindowTop(focus, entryCount, capacity) {
|
|
597
594
|
const entries = Math.max(1, capacity);
|
|
@@ -25,11 +25,10 @@ export declare function windowTop(focus: number, total: number, capacity: number
|
|
|
25
25
|
* no workspace menu (the rail is derived, not a ledger), no new-session card,
|
|
26
26
|
* no live state and no pins.
|
|
27
27
|
*/
|
|
28
|
-
export declare function ForeignSessionPanes({ model, sourceLabel,
|
|
28
|
+
export declare function ForeignSessionPanes({ model, sourceLabel, now, query, notice, railVisible, railWidth, railEntryCapacity, sessionWidth, rows, isTerminalFocused, filterFocused, cursorActive, onFilterFocus, }: {
|
|
29
29
|
model: ForeignSessionsModel;
|
|
30
30
|
/** The active source's display name. */
|
|
31
31
|
sourceLabel: string;
|
|
32
|
-
home: string;
|
|
33
32
|
now: number;
|
|
34
33
|
query: string;
|
|
35
34
|
notice: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForeignSessionPanes.d.ts","sourceRoot":"","sources":["../../../../src/screens/sessionSupervisor/ForeignSessionPanes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAA;AAEzC;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIhF;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"ForeignSessionPanes.d.ts","sourceRoot":"","sources":["../../../../src/screens/sessionSupervisor/ForeignSessionPanes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAA;AAEzC;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIhF;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,WAAW,EACX,GAAG,EACH,KAAK,EACL,MAAM,EACN,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,IAAI,EACJ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,aAAa,GACd,EAAE;IACD,KAAK,EAAE,oBAAoB,CAAA;IAC3B,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;IAC5D,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,EAAE,MAAM,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,iBAAiB,EAAE,OAAO,CAAA;IAC1B,aAAa,EAAE,OAAO,CAAA;IACtB,YAAY,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;CACtC,GAAG,KAAK,CAAC,SAAS,CA+JlB"}
|
|
@@ -36,7 +36,7 @@ export function windowTop(focus, total, capacity) {
|
|
|
36
36
|
* no workspace menu (the rail is derived, not a ledger), no new-session card,
|
|
37
37
|
* no live state and no pins.
|
|
38
38
|
*/
|
|
39
|
-
export function ForeignSessionPanes({ model, sourceLabel,
|
|
39
|
+
export function ForeignSessionPanes({ model, sourceLabel, now, query, notice, railVisible, railWidth, railEntryCapacity, sessionWidth, rows, isTerminalFocused, filterFocused, cursorActive, onFilterFocus, }) {
|
|
40
40
|
const { groups, selected, railFocus, visibleRows, rowIndex, pane, loading } = model;
|
|
41
41
|
const searchCursor = filterFocused || (!railVisible && pane === 'rail') || (pane === 'list' && visibleRows.length === 0);
|
|
42
42
|
const activateRail = () => {
|
|
@@ -61,7 +61,7 @@ export function ForeignSessionPanes({ model, sourceLabel, home, now, query, noti
|
|
|
61
61
|
model.moveRail(event.deltaY >= 0 ? 1 : -1);
|
|
62
62
|
}, children: [_jsx(Box, { height: 1, flexShrink: 0, overflow: "hidden", paddingX: 1, children: _jsx(Text, { dimColor: true, children: truncateWidth(t('home-section-workspaces', { n: groups.length }), railWidth - 2) }) }), !loading && groups.length === 0 && (_jsx(Box, { paddingX: 1, children: _jsx(Text, { dimColor: true, italic: true, wrap: "truncate-end", children: truncateWidth(t('supervisor-foreign-empty', { source: sourceLabel }), railWidth - 2) }) })), railRows.map((group) => {
|
|
63
63
|
const absolute = groups.indexOf(group);
|
|
64
|
-
return (_jsx(HomeWorkspaceRow, { title: group.title,
|
|
64
|
+
return (_jsx(HomeWorkspaceRow, { title: group.title, sessionCount: group.rows.length, present: group.present, selected: selected?.key === group.key, focused: pane === 'rail' && railFocus === absolute, declareCursor: cursorActive && !searchCursor, width: railWidth, onSelect: (event) => {
|
|
65
65
|
event.stopImmediatePropagation();
|
|
66
66
|
onFilterFocus(false);
|
|
67
67
|
model.selectGroup(group);
|
|
@@ -18,7 +18,7 @@ import type { TuiWorkspaceEntry } from '../../workspaces.js';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const RAIL_CHROME_ROWS = 4;
|
|
20
20
|
/** Terminal rows one rail entry occupies; see {@link HomeWorkspaceRow}. */
|
|
21
|
-
export declare const WORKSPACE_ROW_LINES =
|
|
21
|
+
export declare const WORKSPACE_ROW_LINES = 1;
|
|
22
22
|
/** Width the rail gets when the terminal is wide enough to show both panes. */
|
|
23
23
|
export declare const RAIL_MIN_TOTAL_COLUMNS = 84;
|
|
24
24
|
export declare const RAIL_WIDTH_MIN = 24;
|
|
@@ -20,7 +20,7 @@ import { stringWidth } from '../../ink/stringWidth.js';
|
|
|
20
20
|
*/
|
|
21
21
|
export const RAIL_CHROME_ROWS = 4;
|
|
22
22
|
/** Terminal rows one rail entry occupies; see {@link HomeWorkspaceRow}. */
|
|
23
|
-
export const WORKSPACE_ROW_LINES =
|
|
23
|
+
export const WORKSPACE_ROW_LINES = 1;
|
|
24
24
|
/** Width the rail gets when the terminal is wide enough to show both panes. */
|
|
25
25
|
export const RAIL_MIN_TOTAL_COLUMNS = 84;
|
|
26
26
|
export const RAIL_WIDTH_MIN = 24;
|
|
@@ -11,12 +11,15 @@
|
|
|
11
11
|
* the set of sessions it has mounted, and a reader that sees a foreign entry
|
|
12
12
|
* treats the session as OCCUPIED and refuses to mount it.
|
|
13
13
|
*
|
|
14
|
-
* Liveness
|
|
15
|
-
* a `kill -9`.
|
|
14
|
+
* Liveness starts with `process.kill(pid, 0)`: it catches a clean exit and
|
|
15
|
+
* a `kill -9`. On Linux, a surviving id must not be a non-leader thread: a TUI
|
|
16
|
+
* publishes its process id (TGID), but kill also accepts a recycled thread id.
|
|
17
|
+
* There is no heartbeat timestamp, because a timestamp only stays
|
|
16
18
|
* truthful while a timer keeps refreshing it, and the process that cannot
|
|
17
19
|
* refresh it is exactly the one whose record should expire. The cost is pid
|
|
18
|
-
* REUSE — a recycled
|
|
19
|
-
* refusing a session that is in fact free
|
|
20
|
+
* REUSE — a recycled process id can keep a dead owner's record alive — which
|
|
21
|
+
* errs toward refusing a session that is in fact free until that process exits;
|
|
22
|
+
* the opposite
|
|
20
23
|
* error interleaves two writers into one transcript. This is a same-machine
|
|
21
24
|
* guard only: the host's own session write lock stays the authority that
|
|
22
25
|
* actually separates writers.
|
|
@@ -114,7 +117,11 @@ export type MountClaim = {
|
|
|
114
117
|
/**
|
|
115
118
|
* Whether a process id is still alive. `process.kill(pid, 0)` sends no signal
|
|
116
119
|
* and throws `ESRCH` when the process is gone; `EPERM` means it exists but is
|
|
117
|
-
* owned by another user, which still counts as alive here.
|
|
120
|
+
* owned by another user, which still counts as alive here. Linux also accepts
|
|
121
|
+
* non-leader thread ids, which cannot own a TUI record: Node's process.pid is
|
|
122
|
+
* the thread group id. Only a readable, valid, different TGID disproves that
|
|
123
|
+
* identity, after confirming proc uses our PID namespace. Missing or unreadable
|
|
124
|
+
* proc information must preserve the owner.
|
|
118
125
|
*/
|
|
119
126
|
export declare function pidAlive(pid: number): boolean;
|
|
120
127
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionMounts.d.ts","sourceRoot":"","sources":["../../src/sessionMounts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sessionMounts.d.ts","sourceRoot":"","sources":["../../src/sessionMounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAwCH,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC;AAED,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAE7D;AAED,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAIvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACxF;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,QAAQ,CAAC,EAAE,E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;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAyCxD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAMvD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAaxC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC,CAItF;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,SAAS,MAAM,EAAE,CAE7C;AAUD;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAQhF;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAC7B;AAED,8EAA8E;AAC9E,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAA;CAAE,GAC7D,YAAY,CAAA;AAEhB;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAwBrF"}
|
|
@@ -11,12 +11,15 @@
|
|
|
11
11
|
* the set of sessions it has mounted, and a reader that sees a foreign entry
|
|
12
12
|
* treats the session as OCCUPIED and refuses to mount it.
|
|
13
13
|
*
|
|
14
|
-
* Liveness
|
|
15
|
-
* a `kill -9`.
|
|
14
|
+
* Liveness starts with `process.kill(pid, 0)`: it catches a clean exit and
|
|
15
|
+
* a `kill -9`. On Linux, a surviving id must not be a non-leader thread: a TUI
|
|
16
|
+
* publishes its process id (TGID), but kill also accepts a recycled thread id.
|
|
17
|
+
* There is no heartbeat timestamp, because a timestamp only stays
|
|
16
18
|
* truthful while a timer keeps refreshing it, and the process that cannot
|
|
17
19
|
* refresh it is exactly the one whose record should expire. The cost is pid
|
|
18
|
-
* REUSE — a recycled
|
|
19
|
-
* refusing a session that is in fact free
|
|
20
|
+
* REUSE — a recycled process id can keep a dead owner's record alive — which
|
|
21
|
+
* errs toward refusing a session that is in fact free until that process exits;
|
|
22
|
+
* the opposite
|
|
20
23
|
* error interleaves two writers into one transcript. This is a same-machine
|
|
21
24
|
* guard only: the host's own session write lock stays the authority that
|
|
22
25
|
* actually separates writers.
|
|
@@ -74,7 +77,11 @@ const EMPTY = { kind: 'free' };
|
|
|
74
77
|
/**
|
|
75
78
|
* Whether a process id is still alive. `process.kill(pid, 0)` sends no signal
|
|
76
79
|
* and throws `ESRCH` when the process is gone; `EPERM` means it exists but is
|
|
77
|
-
* owned by another user, which still counts as alive here.
|
|
80
|
+
* owned by another user, which still counts as alive here. Linux also accepts
|
|
81
|
+
* non-leader thread ids, which cannot own a TUI record: Node's process.pid is
|
|
82
|
+
* the thread group id. Only a readable, valid, different TGID disproves that
|
|
83
|
+
* identity, after confirming proc uses our PID namespace. Missing or unreadable
|
|
84
|
+
* proc information must preserve the owner.
|
|
78
85
|
*/
|
|
79
86
|
export function pidAlive(pid) {
|
|
80
87
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
@@ -83,11 +90,31 @@ export function pidAlive(pid) {
|
|
|
83
90
|
return true;
|
|
84
91
|
try {
|
|
85
92
|
process.kill(pid, 0);
|
|
86
|
-
return true;
|
|
87
93
|
}
|
|
88
94
|
catch (error) {
|
|
89
95
|
return hasCode(error, 'EPERM');
|
|
90
96
|
}
|
|
97
|
+
if (process.platform === 'linux') {
|
|
98
|
+
try {
|
|
99
|
+
// A proc mount from another PID namespace may use different ids from
|
|
100
|
+
// process.kill. Do not compare its thread identities with our pids.
|
|
101
|
+
const selfStatus = readFileSync('/proc/self/status', 'utf8');
|
|
102
|
+
const selfTgid = Number(/^Tgid:[\t ]+([1-9]\d*)[\t ]*$/m.exec(selfStatus)?.[1]);
|
|
103
|
+
// NStgid lists ids from the proc mount's namespace inward. Require one
|
|
104
|
+
// id: equal numbers in two namespaces still do not prove equal views.
|
|
105
|
+
const namespaceTgid = Number(/^NStgid:[\t ]+([1-9]\d*)[\t ]*$/m.exec(selfStatus)?.[1]);
|
|
106
|
+
if (selfTgid !== process.pid || namespaceTgid !== process.pid)
|
|
107
|
+
return true;
|
|
108
|
+
const status = readFileSync(`/proc/${pid}/status`, 'utf8');
|
|
109
|
+
const tgid = Number(/^Tgid:[\t ]+([1-9]\d*)[\t ]*$/m.exec(status)?.[1]);
|
|
110
|
+
if (Number.isSafeInteger(tgid) && tgid > 0 && tgid !== pid)
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
// An unavailable identity witness is not evidence that an owner is gone.
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
91
118
|
}
|
|
92
119
|
/** Parse one record, or undefined when the shape is wrong. */
|
|
93
120
|
function parseOwner(value) {
|
|
@@ -206,6 +206,18 @@ export declare const SETTING_DEFINITIONS: {
|
|
|
206
206
|
};
|
|
207
207
|
}[];
|
|
208
208
|
};
|
|
209
|
+
jumpBack: {
|
|
210
|
+
label: string;
|
|
211
|
+
descriptions: {
|
|
212
|
+
zh: string;
|
|
213
|
+
};
|
|
214
|
+
group: string;
|
|
215
|
+
hint: string;
|
|
216
|
+
hintDescriptions: {
|
|
217
|
+
zh: string;
|
|
218
|
+
};
|
|
219
|
+
kind: "boolean";
|
|
220
|
+
};
|
|
209
221
|
lang: {
|
|
210
222
|
label: string;
|
|
211
223
|
descriptions: {
|