@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,7 +1,21 @@
|
|
|
1
|
-
import { useContext, useEffect } from 'react';
|
|
1
|
+
import { useContext, useEffect, useSyncExternalStore } from 'react';
|
|
2
2
|
import stripAnsi from 'strip-ansi';
|
|
3
|
+
import { getJumpBackState, subscribeJumpBack } from '../jumpback-state.js';
|
|
3
4
|
import { OSC, osc } from '../termio/osc.js';
|
|
4
5
|
import { TerminalWriteContext } from '../useTerminalNotification.js';
|
|
6
|
+
/**
|
|
7
|
+
* The pane-title suffix that names this pane to the jump-back helper, or ''
|
|
8
|
+
* when the marker must not appear — disabled, not minted yet, or not Windows
|
|
9
|
+
* (no other host can resolve it).
|
|
10
|
+
* @param state - the published jump-back state.
|
|
11
|
+
* @param platform - the host platform; injectable for verification.
|
|
12
|
+
* @returns `' [dsh-tui:<16 hex>]'` when the marker belongs in the title.
|
|
13
|
+
*/
|
|
14
|
+
export function jumpBackTitleSuffix(state, platform = process.platform) {
|
|
15
|
+
if (platform !== 'win32' || !state.enabled || state.marker === null)
|
|
16
|
+
return '';
|
|
17
|
+
return ` [dsh-tui:${state.marker}]`;
|
|
18
|
+
}
|
|
5
19
|
/**
|
|
6
20
|
* Declaratively set the terminal tab/window title.
|
|
7
21
|
*
|
|
@@ -12,19 +26,25 @@ import { TerminalWriteContext } from '../useTerminalNotification.js';
|
|
|
12
26
|
*
|
|
13
27
|
* On Windows, uses `process.title` (classic conhost doesn't support OSC).
|
|
14
28
|
* Elsewhere, writes OSC 0 (set title+icon) via Ink's stdout.
|
|
29
|
+
*
|
|
30
|
+
* When jump-back is enabled on Windows, the pane marker is appended after
|
|
31
|
+
* ANSI stripping. The hook subscribes to the jump-back state so flipping the
|
|
32
|
+
* setting rewrites the title immediately, and the marker it appends is the
|
|
33
|
+
* same published value the activation URI carries.
|
|
15
34
|
* @param title - the title to set, or null to opt out.
|
|
16
35
|
*/
|
|
17
36
|
export function useTerminalTitle(title) {
|
|
18
37
|
const writeRaw = useContext(TerminalWriteContext);
|
|
38
|
+
const jumpBack = useSyncExternalStore(subscribeJumpBack, getJumpBackState);
|
|
19
39
|
useEffect(() => {
|
|
20
40
|
if (title === null || !writeRaw)
|
|
21
41
|
return;
|
|
22
|
-
const clean = stripAnsi(title);
|
|
42
|
+
const clean = stripAnsi(title) + jumpBackTitleSuffix(jumpBack);
|
|
23
43
|
if (process.platform === 'win32') {
|
|
24
44
|
process.title = clean;
|
|
25
45
|
}
|
|
26
46
|
else {
|
|
27
47
|
writeRaw(osc(OSC.SET_TITLE_AND_ICON, clean));
|
|
28
48
|
}
|
|
29
|
-
}, [title, writeRaw]);
|
|
49
|
+
}, [title, writeRaw, jumpBack]);
|
|
30
50
|
}
|
package/lib/types/ink/ink.d.ts
CHANGED
|
@@ -463,6 +463,7 @@ export default class Ink {
|
|
|
463
463
|
/** Batch-tail probe for release-path clicks that deferred via deferProbe. */
|
|
464
464
|
clickProbeAtBatchTail: () => void;
|
|
465
465
|
dispatchClick(col: number, row: number, button?: number, deferProbe?: boolean): boolean;
|
|
466
|
+
findClickTargetAt(col: number, row: number): dom.DOMElement | null;
|
|
466
467
|
/**
|
|
467
468
|
* Hit-test the rendered DOM tree at (col, row) and bubble a
|
|
468
469
|
* ContextMenuEvent from the deepest hit node up through ancestors with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink.d.ts","sourceRoot":"","sources":["../../../src/ink/ink.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAA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AWhB,OAAO,CAAC,oBAAoB,CAK1B;IACF,OAAO,CAAC,SAAS;IAIjB;;;;OAIG;IACH,OAAO,CAAC,yBAAyB,CAK/B;IACF,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAe7B,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI;IAuItC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAOpC,cAAc,IAAI,IAAI;IAYtB;;;;;;;OAOG;IACH,UAAU,IAAI,IAAI;IAalB,YAAY,IAAI,MAAM,IAAI;IAqB1B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,WAAW;CAmDpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAAgB,UAAU,CAAC,KAAK,GAAE,MAAM,CAAC,UAA0B,GAAG,IAAI,CAyDzE"}
|
package/lib/types/ink/ink.js
CHANGED
|
@@ -20,9 +20,9 @@ import { callWithUpdateOverflowGuard, installNestedUpdateOverflowProcessGuard }
|
|
|
20
20
|
import { KeyboardEvent } from './events/keyboard-event.js';
|
|
21
21
|
import { FocusManager } from './focus.js';
|
|
22
22
|
import { emptyFrame } from './frame.js';
|
|
23
|
-
import { dispatchClick, dispatchContextMenu, dispatchDragEvent as bubbleDragEvent, dispatchHover, dispatchWheel, findDragTarget, clearHovered, invalidateNoInterestRect } from './hit-test.js';
|
|
23
|
+
import { dispatchClick, dispatchContextMenu, dispatchDragEvent as bubbleDragEvent, dispatchHover, dispatchWheel, findClickTarget, findDragTarget, clearHovered, invalidateNoInterestRect } from './hit-test.js';
|
|
24
24
|
import { logMouseDebug } from '../utils/debug.js';
|
|
25
|
-
import { noteTerminalFlush } from './flush-tick.js';
|
|
25
|
+
import { noteTerminalFlush, takeTerminalFlushWaiters } from './flush-tick.js';
|
|
26
26
|
import instances from './instances.js';
|
|
27
27
|
import { suppressInputFor } from './input-suppression.js';
|
|
28
28
|
import { LogUpdate } from './log-update.js';
|
|
@@ -1204,7 +1204,7 @@ export default class Ink {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
1206
|
const tWrite = performance.now();
|
|
1207
|
-
writeDiffToTerminal(this.terminal, optimized, this.altScreenActive && !SYNC_OUTPUT_SUPPORTED);
|
|
1207
|
+
writeDiffToTerminal(this.terminal, optimized, this.altScreenActive && !SYNC_OUTPUT_SUPPORTED, takeTerminalFlushWaiters(this.options.stdout));
|
|
1208
1208
|
const writeMs = performance.now() - tWrite;
|
|
1209
1209
|
// One frame reached the terminal. Components holding a widened mount
|
|
1210
1210
|
// window until its content is actually flushed (MessageList's paint
|
|
@@ -2419,6 +2419,9 @@ export default class Ink {
|
|
|
2419
2419
|
logMouseDebug('dispatchClick', { col, row, handled });
|
|
2420
2420
|
return handled;
|
|
2421
2421
|
}
|
|
2422
|
+
findClickTargetAt(col, row) {
|
|
2423
|
+
return this.altScreenActive ? findClickTarget(this.rootNode, col, row) : null;
|
|
2424
|
+
}
|
|
2422
2425
|
/**
|
|
2423
2426
|
* Hit-test the rendered DOM tree at (col, row) and bubble a
|
|
2424
2427
|
* ContextMenuEvent from the deepest hit node up through ancestors with
|
|
@@ -2725,7 +2728,7 @@ export default class Ink {
|
|
|
2725
2728
|
};
|
|
2726
2729
|
render(node) {
|
|
2727
2730
|
this.currentNode = node;
|
|
2728
|
-
const tree = _jsx(App, { ref: this.setAppRef, stdin: this.options.stdin, ownsStdin: this.shutdownInput.ownsInput, stdout: this.options.stdout, stderr: this.options.stderr, exitOnCtrlC: this.options.exitOnCtrlC, onExit: this.unmount, terminalColumns: this.terminalColumns, terminalRows: this.terminalRows, selection: this.selection, onSelectionChange: this.notifySelectionChange, onClickAt: this.dispatchClick, onContextMenuAt: this.dispatchContextMenu, onHoverAt: this.dispatchHover, onWheelAt: this.dispatchWheelAt, getHyperlinkAt: this.getHyperlinkAt, onOpenHyperlink: this.openHyperlink, onMultiClick: this.handleMultiClick, onSelectionStart: this.handleSelectionStart, onSelectionDrag: this.handleSelectionDrag, onDragTargetAt: this.findDragTargetAt, onDragDispatch: this.dispatchDrag, onPointerGestureChange: this.setPointerGestureActive, onProtocolCandidateChange: this.setProtocolCandidateActive, onReleaseTail: this.drainReleaseTail, onClickProbe: this.clickProbeAtBatchTail, onStdinResume: this.reassertTerminalModes, onTerminalFocus: this.handleTerminalFocusProbe, onCursorDeclaration: this.setCursorDeclaration, dispatchKeyboardEvent: this.dispatchKeyboardEvent, children: _jsx(TerminalWriteProvider, { value: this.writeRaw, children: _jsx(TerminalImagesContext.Provider, { value: this.terminalImages, children: node }) }) });
|
|
2731
|
+
const tree = _jsx(App, { ref: this.setAppRef, stdin: this.options.stdin, ownsStdin: this.shutdownInput.ownsInput, stdout: this.options.stdout, stderr: this.options.stderr, exitOnCtrlC: this.options.exitOnCtrlC, onExit: this.unmount, terminalColumns: this.terminalColumns, terminalRows: this.terminalRows, selection: this.selection, onSelectionChange: this.notifySelectionChange, onClickAt: this.dispatchClick, onClickTargetAt: this.findClickTargetAt, onContextMenuAt: this.dispatchContextMenu, onHoverAt: this.dispatchHover, onWheelAt: this.dispatchWheelAt, getHyperlinkAt: this.getHyperlinkAt, onOpenHyperlink: this.openHyperlink, onMultiClick: this.handleMultiClick, onSelectionStart: this.handleSelectionStart, onSelectionDrag: this.handleSelectionDrag, onDragTargetAt: this.findDragTargetAt, onDragDispatch: this.dispatchDrag, onPointerGestureChange: this.setPointerGestureActive, onProtocolCandidateChange: this.setProtocolCandidateActive, onReleaseTail: this.drainReleaseTail, onClickProbe: this.clickProbeAtBatchTail, onStdinResume: this.reassertTerminalModes, onTerminalFocus: this.handleTerminalFocusProbe, onCursorDeclaration: this.setCursorDeclaration, dispatchKeyboardEvent: this.dispatchKeyboardEvent, children: _jsx(TerminalWriteProvider, { value: this.writeRaw, children: _jsx(TerminalImagesContext.Provider, { value: this.terminalImages, children: node }) }) });
|
|
2729
2732
|
// @ts-ignore -- runtime/type-definition mismatch: updateContainerSync exists in react-reconciler but not in @types/react-reconciler
|
|
2730
2733
|
reconciler.updateContainerSync(tree, this.container, null, noop);
|
|
2731
2734
|
// @ts-ignore -- runtime/type-definition mismatch: flushSyncWork exists in react-reconciler but not in @types/react-reconciler
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Published jump-back state; the object identity changes only when the state does. */
|
|
2
|
+
export interface JumpBackState {
|
|
3
|
+
/** True when the user opted into jump-back. Consumers gate every effect on it. */
|
|
4
|
+
readonly enabled: boolean;
|
|
5
|
+
/** 16 lowercase hex characters naming this pane; null until the first enable. */
|
|
6
|
+
readonly marker: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* The enable generation. Every enable or disable publishes a new value, so an
|
|
9
|
+
* asynchronous preparation that started under an older generation can tell it
|
|
10
|
+
* has been superseded before it reaches the registry.
|
|
11
|
+
*/
|
|
12
|
+
readonly generation: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The current jump-back state, for `useSyncExternalStore` and for consumers
|
|
16
|
+
* that need the marker.
|
|
17
|
+
* @returns the published state; the same object until the state changes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getJumpBackState(): JumpBackState;
|
|
20
|
+
/**
|
|
21
|
+
* Subscribe to jump-back state changes, for `useSyncExternalStore`.
|
|
22
|
+
* @param cb - invoked synchronously after every published change.
|
|
23
|
+
* @returns a function that unsubscribes the callback.
|
|
24
|
+
*/
|
|
25
|
+
export declare function subscribeJumpBack(cb: () => void): () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Publish the user's jump-back choice. Enabling mints the marker once and
|
|
28
|
+
* keeps it afterwards, so toggling the setting cannot change an identity that
|
|
29
|
+
* a documented JSON file or an already-delivered toast refers to.
|
|
30
|
+
* @param enabled - the resolved `jumpBack` setting.
|
|
31
|
+
*/
|
|
32
|
+
export declare function setJumpBackEnabled(enabled: boolean): void;
|
|
33
|
+
//# sourceMappingURL=jumpback-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jumpback-state.d.ts","sourceRoot":"","sources":["../../../src/ink/jumpback-state.ts"],"names":[],"mappings":"AAaA,uFAAuF;AACvF,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAKD;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAK5D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAUzD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jump-back identity for this process: whether the user opted into pane
|
|
3
|
+
* jump-back, and the marker that names this pane.
|
|
4
|
+
*
|
|
5
|
+
* The marker is published here instead of being derived by each consumer.
|
|
6
|
+
* The pane-title writer, the pre-toast probe and the documented JSON contract
|
|
7
|
+
* all read this one value, so the title and the activation URI can never
|
|
8
|
+
* disagree about who this pane is. It is minted on the first enable
|
|
9
|
+
* and kept for the rest of the process, which is the stability the title
|
|
10
|
+
* contract asks for.
|
|
11
|
+
*/
|
|
12
|
+
import { randomBytes } from 'node:crypto';
|
|
13
|
+
let state = { enabled: false, marker: null, generation: 0 };
|
|
14
|
+
const subscribers = new Set();
|
|
15
|
+
/**
|
|
16
|
+
* The current jump-back state, for `useSyncExternalStore` and for consumers
|
|
17
|
+
* that need the marker.
|
|
18
|
+
* @returns the published state; the same object until the state changes.
|
|
19
|
+
*/
|
|
20
|
+
export function getJumpBackState() {
|
|
21
|
+
return state;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Subscribe to jump-back state changes, for `useSyncExternalStore`.
|
|
25
|
+
* @param cb - invoked synchronously after every published change.
|
|
26
|
+
* @returns a function that unsubscribes the callback.
|
|
27
|
+
*/
|
|
28
|
+
export function subscribeJumpBack(cb) {
|
|
29
|
+
subscribers.add(cb);
|
|
30
|
+
return () => {
|
|
31
|
+
subscribers.delete(cb);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Publish the user's jump-back choice. Enabling mints the marker once and
|
|
36
|
+
* keeps it afterwards, so toggling the setting cannot change an identity that
|
|
37
|
+
* a documented JSON file or an already-delivered toast refers to.
|
|
38
|
+
* @param enabled - the resolved `jumpBack` setting.
|
|
39
|
+
*/
|
|
40
|
+
export function setJumpBackEnabled(enabled) {
|
|
41
|
+
if (enabled === state.enabled)
|
|
42
|
+
return;
|
|
43
|
+
state = {
|
|
44
|
+
enabled,
|
|
45
|
+
marker: enabled && state.marker === null ? randomBytes(8).toString('hex') : state.marker,
|
|
46
|
+
generation: state.generation + 1,
|
|
47
|
+
};
|
|
48
|
+
for (const cb of subscribers) {
|
|
49
|
+
cb();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jump-back orchestration (D4/D7/D8): the single place that asks whether this
|
|
3
|
+
* pane can be promised a jump, registers the `dsh-tui:` protocol a toast click
|
|
4
|
+
* comes back through, and keeps the documented marker files truthful. The UIA
|
|
5
|
+
* work itself belongs to the helper under `notify-helper/`.
|
|
6
|
+
*
|
|
7
|
+
* Every system side effect sits behind the win32 guard and behind the injected
|
|
8
|
+
* ports, so a POSIX process neither writes the registry nor leaves marker files.
|
|
9
|
+
* Nothing here throws: a failure answers "not capable", the caller degrades to a
|
|
10
|
+
* plain toast, and the stage and reason stay in the debug log (AC-3/AC-9).
|
|
11
|
+
*/
|
|
12
|
+
import { execFileNoThrow } from '../utils/execFileNoThrow.js';
|
|
13
|
+
/**
|
|
14
|
+
* The URI scheme root (D7): Windows hands `dsh-tui:` to a handler only when this
|
|
15
|
+
* key carries the named value `URL Protocol`; the click command sits below it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const JUMP_BACK_PROTOCOL_KEY = "HKCU\\Software\\Classes\\dsh-tui";
|
|
18
|
+
/**
|
|
19
|
+
* The command a toast click runs (D7). It quotes both the helper and the data
|
|
20
|
+
* directory: the shell starts the handler with none of our environment, so the
|
|
21
|
+
* helper must be told where the profile lives explicitly.
|
|
22
|
+
*/
|
|
23
|
+
export declare const JUMP_BACK_PROTOCOL_COMMAND_KEY = "HKCU\\Software\\Classes\\dsh-tui\\shell\\open\\command";
|
|
24
|
+
/** True when the id can name a marker file; `writeMarker` enforces the same rule. */
|
|
25
|
+
export declare function isMarkerFileSession(sessionId: string): boolean;
|
|
26
|
+
/** Why a probe did not promise a jump; each one is a degradation, never a throw. */
|
|
27
|
+
export type JumpBackProbeStage = 'not-win32' | 'marker' | 'helper' | 'probe' | 'unexpected';
|
|
28
|
+
/** The pre-toast answer (D4): capable only when the helper exited 0. */
|
|
29
|
+
export type JumpBackProbe = {
|
|
30
|
+
readonly capable: true;
|
|
31
|
+
readonly helperPath: string;
|
|
32
|
+
} | {
|
|
33
|
+
readonly capable: false;
|
|
34
|
+
readonly stage: JumpBackProbeStage;
|
|
35
|
+
readonly reason: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The ports a regression injects: each production default is named in its
|
|
39
|
+
* comment, so the suite drives the whole orchestration without the registry,
|
|
40
|
+
* csc or the real profile directory.
|
|
41
|
+
*/
|
|
42
|
+
export interface JumpBackPorts {
|
|
43
|
+
/** Platform override for the regression; production is `process.platform`. */
|
|
44
|
+
platform?: NodeJS.Platform;
|
|
45
|
+
/** Environment for the `%WINDIR%` lookup; defaults to `process.env`. */
|
|
46
|
+
env?: Record<string, string | undefined>;
|
|
47
|
+
/** Process runner for `reg.exe` and the helper; defaults to `execFileNoThrow`. */
|
|
48
|
+
run?: typeof execFileNoThrow;
|
|
49
|
+
/** Clock for `startedAt` and the stale sweep; defaults to `Date.now`. */
|
|
50
|
+
now?: () => number;
|
|
51
|
+
/** Data directory (`~/.dsh-tui` normally); defaults to {@link DATA_DIR}. */
|
|
52
|
+
dataDir?: string;
|
|
53
|
+
/** Liveness for marker owners; defaults to {@link pidAlive} (D8 sweep and cleanup). */
|
|
54
|
+
pidAlive?: (pid: number) => boolean;
|
|
55
|
+
/** Resolves the compiled helper; defaults to {@link ensureHelper}, the only compiler. */
|
|
56
|
+
helperPath?: () => Promise<string | undefined>;
|
|
57
|
+
}
|
|
58
|
+
/** The jump-back orchestration one process owns. */
|
|
59
|
+
export interface JumpBack {
|
|
60
|
+
/** Decide before a toast whether a click can be promised to land on this pane (D4). */
|
|
61
|
+
probe(marker: string): Promise<JumpBackProbe>;
|
|
62
|
+
/** Register the protocol key, or prove the cached registration is still ours (D7). */
|
|
63
|
+
ensureProtocol(helperPath: string): Promise<boolean>;
|
|
64
|
+
/** Remove the protocol key; a missing key is not an error (D7). */
|
|
65
|
+
unregisterProtocol(): Promise<void>;
|
|
66
|
+
/** Write the documented read-only marker file for one session (D8). */
|
|
67
|
+
writeMarker(sessionId: string, marker: string): string | undefined;
|
|
68
|
+
/** Remove its marker files, and the key unless another live instance still needs it (D7). */
|
|
69
|
+
cleanup(): Promise<void>;
|
|
70
|
+
/** Remove marker files whose owner is gone or older than a week (D8 startup cleanup). */
|
|
71
|
+
sweepStale(): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create the orchestration for one process.
|
|
75
|
+
* @returns The jump-back orchestration.
|
|
76
|
+
*/
|
|
77
|
+
export declare function createJumpBack(ports?: JumpBackPorts): JumpBack;
|
|
78
|
+
//# sourceMappingURL=jumpback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jumpback.d.ts","sourceRoot":"","sources":["../../../src/ink/jumpback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM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