@deepseek-harness-tui/dsh-tui 0.16.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +213 -34
- package/assets/plugin-icon.svg +13 -0
- package/assets/windows-installer.cs +308 -0
- package/assets/windows-installer.ps1 +17 -0
- package/bin/dsh-tui.js +64 -5
- package/cli/adapters/dsh/index.mjs +111 -0
- package/cli/adapters/dsh/locate.mjs +73 -0
- package/cli/adapters/dsh/management-plugin.mjs +111 -0
- package/cli/args.mjs +154 -0
- package/cli/contracts.d.ts +48 -0
- package/cli/engine.mjs +92 -0
- package/cli/entry.mjs +48 -0
- package/cli/process.mjs +118 -0
- package/cli/protocol.mjs +23 -0
- package/cli/schema-v1.json +33 -0
- package/cordis.patch.yml +3 -1
- package/cordis.yml +3 -1
- package/guide/dsh-tui-guide/SKILL.md +1 -0
- package/guide/dsh-tui-guide/cli.en.md +114 -0
- package/guide/dsh-tui-guide/cli.md +114 -0
- package/guide/dsh-tui-guide/configuration.en.md +7 -5
- package/guide/dsh-tui-guide/configuration.md +7 -5
- package/guide/dsh-tui-guide/getting-started.en.md +33 -3
- package/guide/dsh-tui-guide/getting-started.md +23 -2
- package/guide/dsh-tui-guide/interaction.en.md +50 -17
- package/guide/dsh-tui-guide/interaction.md +35 -13
- package/guide/dsh-tui-guide/plugins.en.md +63 -11
- package/guide/dsh-tui-guide/plugins.md +41 -7
- package/guide/dsh-tui-guide/user-guide.en.md +55 -34
- package/guide/dsh-tui-guide/user-guide.md +45 -28
- package/lib/settings.json +85 -42
- package/lib/types/adapter/channel/plugins.d.ts.map +1 -1
- package/lib/types/adapter/channel/plugins.js +8 -0
- package/lib/types/adapter/channel/ui-policy.d.ts +2 -1
- package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
- package/lib/types/adapter/channel/ui-policy.js +4 -0
- package/lib/types/adapter/ports/channel-display.d.ts +10 -0
- package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-session.d.ts +2 -0
- package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-settings.d.ts +20 -0
- package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-ui.d.ts +22 -2
- package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +11 -1
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel.d.ts +7 -0
- package/lib/types/adapter/ports/channel.d.ts.map +1 -1
- package/lib/types/adapter/standard/grants.d.ts +60 -0
- package/lib/types/adapter/standard/grants.d.ts.map +1 -1
- package/lib/types/adapter/standard/grants.js +74 -0
- package/lib/types/agent/capabilities.d.ts +2 -0
- package/lib/types/agent/capabilities.d.ts.map +1 -1
- package/lib/types/agent/events.d.ts +15 -1
- package/lib/types/agent/events.d.ts.map +1 -1
- package/lib/types/api.d.ts +2 -2
- package/lib/types/api.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/events.d.ts.map +1 -1
- package/lib/types/backends/claude/translate/events.js +2 -1
- package/lib/types/backends/codex/auth/status.js +1 -1
- package/lib/types/backends/codex/session/controls.d.ts.map +1 -1
- package/lib/types/backends/codex/session/controls.js +6 -5
- package/lib/types/backends/codex/session/goals.d.ts.map +1 -1
- package/lib/types/backends/codex/session/side-query.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/events.d.ts.map +1 -1
- package/lib/types/backends/codex/translate/events.js +3 -1
- package/lib/types/backends/shared/channel-tokens.d.ts.map +1 -1
- package/lib/types/backends/shared/channel-tokens.js +9 -8
- package/lib/types/channel/history-restore.d.ts.map +1 -1
- package/lib/types/channel/history-restore.js +2 -0
- package/lib/types/channel/interaction.d.ts.map +1 -1
- package/lib/types/channel/interaction.js +1 -0
- package/lib/types/channel/projection.d.ts +1 -1
- package/lib/types/channel/projection.d.ts.map +1 -1
- package/lib/types/channel/projection.js +19 -4
- package/lib/types/channel/questions.d.ts +2 -0
- package/lib/types/channel/questions.d.ts.map +1 -1
- package/lib/types/channel/sanitize.d.ts +14 -0
- package/lib/types/channel/sanitize.d.ts.map +1 -1
- package/lib/types/channel/sanitize.js +55 -0
- package/lib/types/channel/working-directory.d.ts +9 -0
- package/lib/types/channel/working-directory.d.ts.map +1 -0
- package/lib/types/channel/working-directory.js +7 -0
- package/lib/types/commands.d.ts +8 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +14 -5
- package/lib/types/components/ChatTitle.d.ts +7 -0
- package/lib/types/components/ChatTitle.d.ts.map +1 -0
- package/lib/types/components/ChatTitle.js +15 -0
- package/lib/types/components/CodeBlockFrame.d.ts.map +1 -1
- package/lib/types/components/CodeBlockFrame.js +10 -5
- package/lib/types/components/CompactionStatusRow.d.ts.map +1 -1
- package/lib/types/components/CompactionStatusRow.js +24 -3
- package/lib/types/components/GoalTodoPanel.d.ts +73 -6
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
- package/lib/types/components/GoalTodoPanel.js +165 -17
- package/lib/types/components/Markdown.d.ts +9 -1
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +5 -4
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +20 -14
- package/lib/types/components/PluginGrantList.d.ts +45 -0
- package/lib/types/components/PluginGrantList.d.ts.map +1 -0
- package/lib/types/components/PluginGrantList.js +126 -0
- package/lib/types/components/PluginInstallPane.d.ts.map +1 -1
- package/lib/types/components/PluginInstallPane.js +35 -6
- package/lib/types/components/PluginManagePane.d.ts.map +1 -1
- package/lib/types/components/PluginManagePane.js +65 -8
- package/lib/types/components/PromptInput.d.ts +13 -5
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +190 -108
- package/lib/types/components/SplitDiffView.d.ts.map +1 -1
- package/lib/types/components/SplitDiffView.js +232 -22
- package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
- package/lib/types/components/SubagentDashboard.js +10 -0
- package/lib/types/components/SubagentDetailScene.d.ts +3 -1
- package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
- package/lib/types/components/SubagentDetailScene.js +17 -1
- package/lib/types/components/Whale.d.ts.map +1 -1
- package/lib/types/components/Whale.js +8 -5
- package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
- package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
- package/lib/types/components/approvals/ApprovalPanel.js +93 -11
- package/lib/types/components/bigfont.d.ts.map +1 -1
- package/lib/types/components/bigfont.js +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +24 -11
- package/lib/types/components/onboardingModel.d.ts +2 -2
- package/lib/types/components/onboardingModel.js +3 -3
- package/lib/types/components/onboardingProviderPlan.d.ts +110 -0
- package/lib/types/components/onboardingProviderPlan.d.ts.map +1 -0
- package/lib/types/components/onboardingProviderPlan.js +78 -0
- package/lib/types/components/previewRows.d.ts +19 -0
- package/lib/types/components/previewRows.d.ts.map +1 -0
- package/lib/types/components/previewRows.js +46 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
- package/lib/types/components/questions/AskUserQuestionPanel.js +75 -10
- package/lib/types/components/sessions/ForeignSessionRow.d.ts +3 -9
- package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -1
- package/lib/types/components/sessions/ForeignSessionRow.js +6 -10
- package/lib/types/components/sessions/SessionListRow.d.ts +4 -9
- package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
- package/lib/types/components/sessions/SessionListRow.js +18 -10
- package/lib/types/components/sidePanel/InfoPanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/InfoPanel.js +4 -3
- package/lib/types/components/sidePanel/SidePanelLayout.d.ts.map +1 -1
- package/lib/types/components/sidePanel/SidePanelLayout.js +5 -5
- package/lib/types/components/sidePanel/WorkspacePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/WorkspacePanel.js +19 -7
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +7 -0
- package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwComposer.js +16 -0
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +8 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts +7 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
- package/lib/types/components/sidePanel/btw/BtwThreadScene.js +8 -1
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts +30 -0
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts.map +1 -0
- package/lib/types/components/sidePanel/btw/useBtwComposerPaste.js +94 -0
- package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
- package/lib/types/components/sidePanel/builtinPanels.js +36 -18
- package/lib/types/components/sidePanel/companion/CompanionPanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/companion/CompanionPanel.js +2 -1
- package/lib/types/components/sidePanel/panelMarkdown.d.ts +32 -0
- package/lib/types/components/sidePanel/panelMarkdown.d.ts.map +1 -0
- package/lib/types/components/sidePanel/panelMarkdown.js +45 -0
- package/lib/types/components/sidePanel/pluginPanelAdapter.d.ts.map +1 -1
- package/lib/types/components/sidePanel/pluginPanelAdapter.js +6 -1
- package/lib/types/components/sidePanel/subagentFailureRead.d.ts +21 -0
- package/lib/types/components/sidePanel/subagentFailureRead.d.ts.map +1 -0
- package/lib/types/components/sidePanel/subagentFailureRead.js +66 -0
- package/lib/types/components/sidePanel/types.d.ts +2 -0
- package/lib/types/components/sidePanel/types.d.ts.map +1 -1
- package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
- package/lib/types/components/sidePanel/useSidePanel.js +39 -7
- package/lib/types/components/trajectory/MiniWake.d.ts +2 -2
- package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
- package/lib/types/components/trajectory/MiniWake.js +7 -3
- package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
- package/lib/types/components/workspaces/HomeWorkspaceRow.js +4 -7
- package/lib/types/dsh-adapter/backend/session.d.ts +7 -1
- package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/session.js +62 -6
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +18 -4
- package/lib/types/dsh-adapter/backend-admission.d.ts +3 -3
- package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/agent-view-projection.js +3 -1
- package/lib/types/dsh-adapter/channel/binding-events.d.ts +5 -1
- package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/binding-events.js +18 -1
- package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/command-completions.js +6 -8
- package/lib/types/dsh-adapter/channel/composer-images.d.ts +11 -1
- package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-images.js +121 -113
- package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/composer-mentions.js +38 -17
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/context-bookkeeping.js +9 -5
- package/lib/types/dsh-adapter/channel/core/actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/core/actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/actions.js +23 -2
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +10 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/binding-feed.js +48 -3
- package/lib/types/dsh-adapter/channel/core/compose.d.ts +5 -2
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/compose.js +7 -0
- package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/files.js +2 -1
- package/lib/types/dsh-adapter/channel/core/host.d.ts +14 -10
- package/lib/types/dsh-adapter/channel/core/host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/host.js +192 -13
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts +1 -0
- package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/local-actions.js +32 -3
- package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/extensions.js +31 -5
- package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
- package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-actions.js +34 -0
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts +5 -2
- package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/input-delivery.js +31 -4
- package/lib/types/dsh-adapter/channel/mentions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/mentions.js +21 -7
- package/lib/types/dsh-adapter/channel/model-actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-actions.js +7 -1
- package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/model-selection.js +6 -4
- package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/paths.js +11 -9
- package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-fork.js +1 -0
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-live-adoption.js +6 -1
- package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-metadata.js +15 -2
- package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-reset.js +7 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-resume.js +56 -36
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-rewind.js +3 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/session-tree-actions.js +3 -1
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +10 -3
- package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +2 -2
- package/lib/types/dsh-adapter/channel/types.d.ts +13 -1
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/liveSession.d.ts +3 -3
- package/lib/types/dsh-adapter/compat/liveSession.js +3 -3
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
- package/lib/types/dsh-adapter/compat/sessionLog.js +17 -1
- package/lib/types/dsh-adapter/contract.d.ts +7 -5
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +10 -5
- package/lib/types/dsh-adapter/effect-ledger.d.ts +1 -1
- package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -1
- package/lib/types/dsh-adapter/effect-ledger.js +1 -0
- package/lib/types/dsh-adapter/entry-slot.d.ts +6 -0
- package/lib/types/dsh-adapter/entry-slot.d.ts.map +1 -1
- package/lib/types/dsh-adapter/experimental-bundles.d.ts +29 -0
- package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -0
- package/lib/types/dsh-adapter/experimental-bundles.js +15 -0
- package/lib/types/dsh-adapter/grant-file.d.ts +70 -0
- package/lib/types/dsh-adapter/grant-file.d.ts.map +1 -0
- package/lib/types/dsh-adapter/grant-file.js +178 -0
- package/lib/types/dsh-adapter/host-access.d.ts +4 -0
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-access.js +54 -4
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.js +2 -2
- package/lib/types/dsh-adapter/host-dsh.js +3 -3
- package/lib/types/dsh-adapter/index.d.ts +8 -4
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +17 -12
- package/lib/types/dsh-adapter/panels.d.ts +28 -8
- package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
- package/lib/types/dsh-adapter/panels.js +11 -56
- package/lib/types/dsh-adapter/plugin-declaration.d.ts +28 -0
- package/lib/types/dsh-adapter/plugin-declaration.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-declaration.js +43 -1
- package/lib/types/dsh-adapter/plugin-install.d.ts +28 -1
- package/lib/types/dsh-adapter/plugin-install.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-install.js +160 -13
- package/lib/types/dsh-adapter/plugin-manage.d.ts +53 -10
- package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin-manage.js +240 -51
- package/lib/types/dsh-adapter/plugin.d.ts +81 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +378 -84
- package/lib/types/dsh-adapter/plugins-info.d.ts +6 -7
- package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugins-info.js +99 -31
- package/lib/types/dsh-adapter/presets.d.ts +19 -6
- package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
- package/lib/types/dsh-adapter/presets.js +69 -12
- package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
- package/lib/types/dsh-adapter/process-exit.js +1 -1
- package/lib/types/dsh-adapter/providerWizard.d.ts +2 -0
- package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
- package/lib/types/dsh-adapter/providerWizard.js +11 -5
- package/lib/types/dsh-adapter/row-attachment.d.ts +30 -0
- package/lib/types/dsh-adapter/row-attachment.d.ts.map +1 -0
- package/lib/types/dsh-adapter/row-attachment.js +29 -0
- package/lib/types/dsh-adapter/session-tools.d.ts +34 -0
- package/lib/types/dsh-adapter/session-tools.d.ts.map +1 -0
- package/lib/types/dsh-adapter/session-tools.js +39 -0
- package/lib/types/dsh-adapter/settings-sections.d.ts +18 -1
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +73 -0
- package/lib/types/dsh-adapter/status.d.ts +88 -1
- package/lib/types/dsh-adapter/status.d.ts.map +1 -1
- package/lib/types/dsh-adapter/status.js +318 -3
- package/lib/types/dsh-adapter/team-mode.d.ts +42 -33
- package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
- package/lib/types/dsh-adapter/team-mode.js +76 -112
- package/lib/types/dsh-adapter/worktree-tool.d.ts +27 -0
- package/lib/types/dsh-adapter/worktree-tool.d.ts.map +1 -0
- package/lib/types/dsh-adapter/worktree-tool.js +87 -0
- package/lib/types/extensions.d.ts +1 -1
- package/lib/types/extensions.d.ts.map +1 -1
- package/lib/types/force-production-react.js +3 -3
- package/lib/types/heldInputs.d.ts +36 -0
- package/lib/types/heldInputs.d.ts.map +1 -0
- package/lib/types/heldInputs.js +173 -0
- package/lib/types/i18n.d.ts +543 -73
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +265 -46
- package/lib/types/ink/colorize.d.ts +7 -1
- package/lib/types/ink/colorize.d.ts.map +1 -1
- package/lib/types/ink/colorize.js +29 -8
- package/lib/types/ink/components/App.d.ts +2 -1
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +10 -3
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
- package/lib/types/ink/components/ScrollBox.js +1 -0
- package/lib/types/ink/dom.d.ts +1 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/hooks/use-program-status.d.ts +78 -0
- package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-program-status.js +96 -0
- package/lib/types/ink/ink.d.ts +13 -4
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +119 -25
- package/lib/types/ink/output.d.ts +17 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +85 -2
- package/lib/types/ink/parse-keypress.d.ts +1 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -1
- package/lib/types/ink/parse-keypress.js +5 -4
- package/lib/types/ink/render-node-to-output.d.ts +2 -0
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +79 -10
- package/lib/types/ink/root.d.ts +8 -0
- package/lib/types/ink/root.d.ts.map +1 -1
- package/lib/types/ink/root.js +12 -3
- package/lib/types/ink/screen.d.ts +11 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +44 -0
- package/lib/types/ink/selection.d.ts +7 -2
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +187 -44
- package/lib/types/ink/shutdown-input.d.ts +15 -0
- package/lib/types/ink/shutdown-input.d.ts.map +1 -0
- package/lib/types/ink/shutdown-input.js +28 -0
- package/lib/types/ink/sixel-cursor-heal.d.ts +21 -0
- package/lib/types/ink/sixel-cursor-heal.d.ts.map +1 -0
- package/lib/types/ink/sixel-cursor-heal.js +62 -0
- package/lib/types/ink/sixel-graphics.d.ts +6 -0
- package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
- package/lib/types/ink/sixel-graphics.js +18 -0
- package/lib/types/ink/styles.d.ts +8 -1
- package/lib/types/ink/styles.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification-windows.d.ts +195 -0
- package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -0
- package/lib/types/ink/terminal-notification-windows.js +433 -0
- package/lib/types/ink/terminal-notification.d.ts +3 -1
- package/lib/types/ink/terminal-notification.d.ts.map +1 -1
- package/lib/types/ink/terminal-notification.js +4 -1
- package/lib/types/ink/terminal-querier.d.ts +9 -1
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +32 -1
- package/lib/types/ink/terminal.d.ts +23 -2
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +32 -2
- package/lib/types/ink/termio/osc.d.ts +2 -1
- package/lib/types/ink/termio/osc.d.ts.map +1 -1
- package/lib/types/ink/termio/osc.js +37 -8
- package/lib/types/ink/termio/osc7501.d.ts +102 -0
- package/lib/types/ink/termio/osc7501.d.ts.map +1 -0
- package/lib/types/ink/termio/osc7501.js +229 -0
- package/lib/types/ink/termio/tokenize.js +5 -7
- package/lib/types/onboardingDraft.d.ts +143 -0
- package/lib/types/onboardingDraft.d.ts.map +1 -0
- package/lib/types/onboardingDraft.js +71 -0
- package/lib/types/panels.d.ts +1 -1
- package/lib/types/panels.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.d.ts +3 -1
- package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
- package/lib/types/screens/AgentTranscriptScene.js +5 -1
- package/lib/types/screens/Chat.d.ts +6 -6
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +394 -141
- package/lib/types/screens/Launchpad.d.ts +8 -2
- package/lib/types/screens/Launchpad.d.ts.map +1 -1
- package/lib/types/screens/Launchpad.js +32 -12
- package/lib/types/screens/Onboarding.d.ts +22 -3
- package/lib/types/screens/Onboarding.d.ts.map +1 -1
- package/lib/types/screens/Onboarding.js +606 -36
- package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/SessionSupervisor.js +31 -21
- package/lib/types/screens/Settings.d.ts +5 -1
- package/lib/types/screens/Settings.d.ts.map +1 -1
- package/lib/types/screens/Settings.js +528 -51
- package/lib/types/screens/StatusLine.d.ts +9 -3
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +91 -15
- package/lib/types/screens/StatusMetrics.d.ts +2 -11
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
- package/lib/types/screens/StatusMetrics.js +20 -14
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
- package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +13 -21
- package/lib/types/sessionMounts.d.ts +14 -0
- package/lib/types/sessionMounts.d.ts.map +1 -1
- package/lib/types/sessionMounts.js +20 -9
- package/lib/types/sessions/format.d.ts +39 -0
- package/lib/types/sessions/format.d.ts.map +1 -1
- package/lib/types/sessions/format.js +83 -0
- package/lib/types/sessions/resumeFailure.d.ts +4 -0
- package/lib/types/sessions/resumeFailure.d.ts.map +1 -1
- package/lib/types/sessions/resumeFailure.js +12 -4
- package/lib/types/sessions/workspaceCounts.d.ts +6 -0
- package/lib/types/sessions/workspaceCounts.d.ts.map +1 -0
- package/lib/types/sessions/workspaceCounts.js +24 -0
- package/lib/types/settings/definitions.d.ts +24 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +40 -15
- package/lib/types/tips.js +2 -2
- package/lib/types/tuiDisplayPrefs.d.ts +113 -5
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +276 -14
- package/lib/types/update.d.ts +15 -14
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +163 -115
- package/lib/types/updateProcess.d.ts +28 -0
- package/lib/types/updateProcess.d.ts.map +1 -0
- package/lib/types/updateProcess.js +135 -0
- package/lib/types/utils/inputWordBoundary.d.ts +5 -0
- package/lib/types/utils/inputWordBoundary.d.ts.map +1 -0
- package/lib/types/utils/inputWordBoundary.js +18 -0
- package/lib/types/utils/keymap.d.ts +1 -1
- package/lib/types/utils/keymap.d.ts.map +1 -1
- package/lib/types/utils/keymap.js +6 -1
- package/lib/types/utils/paths.d.ts +15 -0
- package/lib/types/utils/paths.d.ts.map +1 -1
- package/lib/types/utils/paths.js +25 -0
- package/lib/types/windowsInstaller.d.ts +4 -0
- package/lib/types/windowsInstaller.d.ts.map +1 -0
- package/lib/types/windowsInstaller.js +237 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +130 -111
- package/presets/liangshen/custom-bash.mjs +13 -1
- package/presets/liangshen/instruction-hint.mjs +4 -1
- package/presets/liangshen/skill-search.mjs +14 -2
- package/presets/winbash.mjs +16 -4
- package/tui-profile/feed/README.md +17 -8
- package/tui-profile/feed/first-party.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-sections.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/settings-sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAA2G,MAAM,sCAAsC,CAAA;AACvL,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;
|
|
1
|
+
{"version":3,"file":"settings-sections.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/settings-sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAA2G,MAAM,sCAAsC,CAAA;AACvL,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AACxM;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAWtD,6EAA6E;AAC7E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAAA;IACjD,IAAI,IAAI,SAAS,kBAAkB,EAAE,CAAA;IACrC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAAA;IACnD,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;CAC5C;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,mBAAmB,EAAE,0BAA0B,CAAA;KAChD;CACF;AAED,eAAO,MAAM,IAAI,8BAA8B,CAAA;AAE/C;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,OAAO;gBACzC,GAAG,EAAE,OAAO;IAsBxB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAuBjD,iDAAiD;IACjD,IAAI,IAAI,SAAS,kBAAkB,EAAE;IASrC,sDAAsD;IACtD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IASnD;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;CAU5C;AA8GD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,0BAA0B,GAAG,SAAS,GAAG,uBAAuB,GAAG,SAAS,CAO5H;AAiDD,wBAAgB,4BAA4B,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAiBnF;AASD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,GAAG,MAAM,IAAI,CA2B9F;AAED,eAAe,0BAA0B,CAAA"}
|
|
@@ -113,6 +113,24 @@ function registerSection(runtime, section, owner) {
|
|
|
113
113
|
if (state.sections.has(ns))
|
|
114
114
|
throw new Error(`TUI settings section "${ns}" is already registered`);
|
|
115
115
|
const groupIds = new Set();
|
|
116
|
+
// Pages are display-only grouping keys: validate the id so a tab can never
|
|
117
|
+
// collide with the screen's own sentinel/page keys, and keep the title the
|
|
118
|
+
// tab strip renders.
|
|
119
|
+
const page = section.page === undefined
|
|
120
|
+
? undefined
|
|
121
|
+
: (() => {
|
|
122
|
+
const id = section.page.id.trim();
|
|
123
|
+
if (!/^[a-z][a-z0-9_-]*$/u.test(id))
|
|
124
|
+
throw new TypeError(`invalid TUI settings page id: ${section.page.id}`);
|
|
125
|
+
const title = section.page.title.trim();
|
|
126
|
+
if (title === '')
|
|
127
|
+
throw new TypeError(`TUI settings page "${id}" needs a title`);
|
|
128
|
+
return Object.freeze({
|
|
129
|
+
id,
|
|
130
|
+
title,
|
|
131
|
+
descriptions: section.page.descriptions === undefined ? undefined : Object.freeze({ ...section.page.descriptions }),
|
|
132
|
+
});
|
|
133
|
+
})();
|
|
116
134
|
const groups = section.groups === undefined
|
|
117
135
|
? undefined
|
|
118
136
|
: Object.freeze(section.groups.map(group => {
|
|
@@ -149,6 +167,7 @@ function registerSection(runtime, section, owner) {
|
|
|
149
167
|
...section,
|
|
150
168
|
ns,
|
|
151
169
|
descriptions: section.descriptions === undefined ? undefined : Object.freeze({ ...section.descriptions }),
|
|
170
|
+
page,
|
|
152
171
|
groups,
|
|
153
172
|
fields,
|
|
154
173
|
});
|
|
@@ -250,4 +269,58 @@ export function getLocalSettingsSectionsHost(ctx) {
|
|
|
250
269
|
});
|
|
251
270
|
return state.host;
|
|
252
271
|
}
|
|
272
|
+
/** The registry `/settings` reads right now: the composition's service, else
|
|
273
|
+
* the in-package fallback (the channel resolves the same pair). */
|
|
274
|
+
function currentSettingsSectionsHost(ctx) {
|
|
275
|
+
return getHostSettingsSections(ctx.get('tuiSettingsSections'))
|
|
276
|
+
?? getLocalSettingsSectionsHost(ctx);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Register a host-owned section in whichever registry `/settings` reads, and
|
|
280
|
+
* keep it there while the composition's `tuiSettingsSections` service comes
|
|
281
|
+
* and goes.
|
|
282
|
+
*
|
|
283
|
+
* The channel prefers the service whenever it exists, while a registration
|
|
284
|
+
* made before the service row activated lands in the in-package fallback —
|
|
285
|
+
* profile rows activate concurrently (`EntryGroup.update` awaits all of
|
|
286
|
+
* them), so "the service exists" is not a boot-order guarantee. A reloaded
|
|
287
|
+
* service row also starts from an empty registry, stranding sections
|
|
288
|
+
* registered in the previous instance. Either transition would leave the
|
|
289
|
+
* section in the registry the screen no longer reads: it disappears from
|
|
290
|
+
* /settings while other sections keep rendering. Both announce themselves
|
|
291
|
+
* through `internal/service`; the replacement registration is taken before
|
|
292
|
+
* the old one is released, so a failed move leaves the section where it was.
|
|
293
|
+
*/
|
|
294
|
+
export function trackHostSettingsSection(ctx, section) {
|
|
295
|
+
let host = currentSettingsSectionsHost(ctx);
|
|
296
|
+
let unregister = host.register(section);
|
|
297
|
+
let disposed = false;
|
|
298
|
+
const off = ctx.on('internal/service', ((name) => {
|
|
299
|
+
if (name !== 'tuiSettingsSections' || disposed)
|
|
300
|
+
return;
|
|
301
|
+
const target = currentSettingsSectionsHost(ctx);
|
|
302
|
+
if (target === host)
|
|
303
|
+
return;
|
|
304
|
+
let dispose;
|
|
305
|
+
try {
|
|
306
|
+
dispose = target.register(section);
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
// A registry that already holds this namespace (a reload that kept the
|
|
310
|
+
// row's state) must not take the section down with the move.
|
|
311
|
+
ctx.logger.warn(`dsh-tui: keeping settings section "${section.ns}" in its current registry: ${error instanceof Error ? error.message : String(error)}`);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
unregister();
|
|
315
|
+
host = target;
|
|
316
|
+
unregister = dispose;
|
|
317
|
+
}));
|
|
318
|
+
return () => {
|
|
319
|
+
if (disposed)
|
|
320
|
+
return;
|
|
321
|
+
disposed = true;
|
|
322
|
+
off();
|
|
323
|
+
unregister();
|
|
324
|
+
};
|
|
325
|
+
}
|
|
253
326
|
export default TuiSettingsSectionsRuntime;
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* sanitizes and joins every text contribution into one line. `registerView`
|
|
6
6
|
* is the bounded rich companion for compact, pointer-only surfaces that need
|
|
7
7
|
* host React and themed cells (for example a progress card). It deliberately
|
|
8
|
-
* receives no input, channel, or raw-terminal capability.
|
|
8
|
+
* receives no input, channel, or raw-terminal capability. `setField` is the
|
|
9
|
+
* footer sibling: one keyed text cell admitted into the prompt footer's
|
|
10
|
+
* existing left/right groups, with the same lifecycle, ownership, token, and
|
|
11
|
+
* ledger rules as `set()`.
|
|
9
12
|
*
|
|
10
13
|
* Same split as the dialogs seam: a cordis-free store the chat screen
|
|
11
14
|
* subscribes to, and a thin cordis service validating untrusted input.
|
|
@@ -58,6 +61,54 @@ export interface TuiStatusViewEntry {
|
|
|
58
61
|
/** Remounts the error boundary after a dispose + same-key re-registration. */
|
|
59
62
|
readonly registrationId: number;
|
|
60
63
|
}
|
|
64
|
+
/** Where a plugin footer field joins the footer: the left group's tail, the
|
|
65
|
+
* right group's head, or the right group's tail. `right-tail` is the row's
|
|
66
|
+
* right edge in the split layout only: `statusBar.compact` (the default)
|
|
67
|
+
* merges both groups into one left-aligned chain, where the slots order that
|
|
68
|
+
* chain and the ctx chip / trailing free space stay to the field's right. */
|
|
69
|
+
export type TuiStatusFieldSlot = 'left-tail' | 'right-head' | 'right-tail';
|
|
70
|
+
/** Semantic theme tone for a footer field. Literal colours are refused so a
|
|
71
|
+
* plugin cannot paint a one-off cell that ignores the active theme. */
|
|
72
|
+
export type TuiStatusFieldTone = 'dim' | 'accent' | 'success' | 'warning' | 'error';
|
|
73
|
+
/** Options for `tuiStatus.setField`. Every key is optional; on update an
|
|
74
|
+
* omitted key keeps that field's previous value (a fresh key starts from the
|
|
75
|
+
* defaults documented below). */
|
|
76
|
+
export interface TuiStatusFieldOptions {
|
|
77
|
+
/** Default `'left-tail'`. */
|
|
78
|
+
readonly slot?: TuiStatusFieldSlot;
|
|
79
|
+
/** Default `'dim'`. */
|
|
80
|
+
readonly tone?: TuiStatusFieldTone;
|
|
81
|
+
/** Hard text cap in terminal cells: default 16, clamped to 1…32. */
|
|
82
|
+
readonly maxCells?: number;
|
|
83
|
+
/** Hide the field below this terminal width: default 0, clamped to 0…400. */
|
|
84
|
+
readonly minColumns?: number;
|
|
85
|
+
/** Supplemental-row text shown while the pointer rests on the field,
|
|
86
|
+
* capped at 160 cells. Declaring `onClick` requires it. */
|
|
87
|
+
readonly detail?: string;
|
|
88
|
+
/** Pointer click in fullscreen (mouse tracking) only. Declaring it without
|
|
89
|
+
* a non-empty `detail` is refused: a clickable cell owes an explanation. */
|
|
90
|
+
readonly onClick?: () => void;
|
|
91
|
+
}
|
|
92
|
+
/** Host-side normalized field. `onClick` is the host-WRAPPED handler (errors
|
|
93
|
+
* are logged and reported to the UI); this type stays inside the adapter. */
|
|
94
|
+
export interface TuiStatusFieldEntry {
|
|
95
|
+
readonly key: string;
|
|
96
|
+
readonly text: string;
|
|
97
|
+
readonly slot: TuiStatusFieldSlot;
|
|
98
|
+
readonly tone: TuiStatusFieldTone;
|
|
99
|
+
readonly maxCells: number;
|
|
100
|
+
readonly minColumns: number;
|
|
101
|
+
readonly detail?: string;
|
|
102
|
+
readonly onClick?: () => void;
|
|
103
|
+
}
|
|
104
|
+
/** Host-side admission record: the frozen entry, the token + owner a disposer
|
|
105
|
+
* checks, and the unwrapped click so an options-less update can reuse it. */
|
|
106
|
+
export interface TuiStatusFieldRecord {
|
|
107
|
+
readonly entry: TuiStatusFieldEntry;
|
|
108
|
+
readonly token: number;
|
|
109
|
+
readonly owner: object;
|
|
110
|
+
readonly rawOnClick?: () => void;
|
|
111
|
+
}
|
|
61
112
|
/** Cordis-free text + view store. Render order is first-set/register order
|
|
62
113
|
* (Map insertion order), so plugin contributions do not jump on updates. */
|
|
63
114
|
export declare class TuiStatusStore {
|
|
@@ -65,8 +116,11 @@ export declare class TuiStatusStore {
|
|
|
65
116
|
private readonly listeners;
|
|
66
117
|
private readonly entries;
|
|
67
118
|
private readonly views;
|
|
119
|
+
private readonly fields;
|
|
68
120
|
private snapshot;
|
|
69
121
|
private viewSnapshot;
|
|
122
|
+
private fieldSnapshot;
|
|
123
|
+
private onFieldError;
|
|
70
124
|
constructor(onViewError?: ((key: string, error: Error) => void) | undefined);
|
|
71
125
|
/** Set or clear (undefined/empty) one key. */
|
|
72
126
|
set(key: string, text: string | undefined, token?: number, owner?: object): void;
|
|
@@ -83,6 +137,23 @@ export declare class TuiStatusStore {
|
|
|
83
137
|
clearViewIf(key: string, token: number, owner?: object): boolean;
|
|
84
138
|
/** Called only by the host-side error boundary. */
|
|
85
139
|
reportViewError(key: string, error: Error): void;
|
|
140
|
+
/** Current footer fields, first-set first and referentially stable between
|
|
141
|
+
* mutations for `useSyncExternalStore`. */
|
|
142
|
+
getFieldSnapshot(): readonly TuiStatusFieldEntry[];
|
|
143
|
+
/** Store (or overwrite) one admitted field. Slot/option merging already
|
|
144
|
+
* happened in the service; the store only records normalized entries. */
|
|
145
|
+
setField(entry: TuiStatusFieldEntry, token: number, owner: object, rawOnClick?: () => void): void;
|
|
146
|
+
/** The full admission record for `key` (read by the service to merge an
|
|
147
|
+
* update onto the previous options and to check ownership). */
|
|
148
|
+
fieldEntry(key: string): TuiStatusFieldRecord | undefined;
|
|
149
|
+
fieldCount(): number;
|
|
150
|
+
/** How many footer fields one activation currently owns (cap enforcement). */
|
|
151
|
+
fieldsOwnedBy(owner: object): number;
|
|
152
|
+
/** Clear `key` only while it still holds this token AND owner. */
|
|
153
|
+
clearFieldIf(key: string, token: number, owner?: object): boolean;
|
|
154
|
+
/** UI-side handler for a plugin click that threw; the service logs first. */
|
|
155
|
+
setFieldErrorHandler(handler?: (key: string, error: Error) => void): void;
|
|
156
|
+
reportFieldError(key: string, error: Error): void;
|
|
86
157
|
/** Clear `key` only while it still holds the write tagged `token` — a
|
|
87
158
|
* stale disposer must not wipe a newer contribution (even one with
|
|
88
159
|
* identical text). Returns true when this call actually cleared. */
|
|
@@ -124,6 +195,22 @@ export declare class TuiStatusRuntime extends Service {
|
|
|
124
195
|
* guess (C-060 honest identity).
|
|
125
196
|
*/
|
|
126
197
|
set(key: string, text: string | number | boolean | undefined, identity?: Context): () => void;
|
|
198
|
+
/**
|
|
199
|
+
* Insert (or update/clear) one keyed TEXT field in the prompt footer's
|
|
200
|
+
* existing left/right groups — no new row, no plugin component. The field
|
|
201
|
+
* keeps the same admission contract as `set()`: plugin caller, activation
|
|
202
|
+
* ownership, token-based disposers, effect-ledger records, never throws.
|
|
203
|
+
*
|
|
204
|
+
* Unlike `set()`, footer fields are capped (six total, two per activation)
|
|
205
|
+
* and each cell is truncated by the host to `maxCells` (default 16, at most
|
|
206
|
+
* 32) so the row's flex shrinking always has a definite bound. `detail` and
|
|
207
|
+
* `onClick` are optional; a click without a detail line is refused (the
|
|
208
|
+
* footer must never promise an action it cannot explain on hover).
|
|
209
|
+
*
|
|
210
|
+
* Passing `undefined` (or text that sanitizes to nothing) CLEARS the field;
|
|
211
|
+
* a stale disposer cannot clear a newer write for the same key.
|
|
212
|
+
*/
|
|
213
|
+
setField(key: string, text: string | number | boolean | undefined, options?: TuiStatusFieldOptions, identity?: Context): () => void;
|
|
127
214
|
/**
|
|
128
215
|
* Register a compact React view above the prompt. The component receives
|
|
129
216
|
* the host's React plus a pointer-only UI kit; it owns its live data via an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/status.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAUtD,iCAAiC;AACjC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,6DAA6D;AAC7D,MAAM,MAAM,oBAAoB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAE5C,KAAK,8BAA8B,GAC/B,KAAK,GACL,UAAU,GACV,WAAW,GACX,eAAe,GACf,SAAS,GACT,gBAAgB,GAChB,QAAQ,GACR,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,SAAS,CAAA;AAEb,KAAK,qBAAqB,GAAG,IAAI,CAC/B,KAAK,CAAC,cAAc,CAAC,cAAc,UAAU,EAAE,GAAG,CAAC,EACnD,8BAA8B,CAC/B,CAAA;AAED,KAAK,sBAAsB,GAAG,IAAI,CAChC,KAAK,CAAC,cAAc,CAAC,cAAc,UAAU,EAAE,IAAI,CAAC,EACpD,KAAK,CACN,CAAA;AAED,KAAK,uBAA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AAQ,CACN,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,EAC3C,OAAO,CAAC,EAAE,qBAAqB,EAC/B,QAAQ,CAAC,EAAE,OAAO,GACjB,MAAM,IAAI;IAwOb;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,UAAU,EAAE,uBAAuB,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,qBAAqB,GAAG,SAAS;IAkHxG;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;CAiB5C;AAiBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAOpG;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
* sanitizes and joins every text contribution into one line. `registerView`
|
|
6
6
|
* is the bounded rich companion for compact, pointer-only surfaces that need
|
|
7
7
|
* host React and themed cells (for example a progress card). It deliberately
|
|
8
|
-
* receives no input, channel, or raw-terminal capability.
|
|
8
|
+
* receives no input, channel, or raw-terminal capability. `setField` is the
|
|
9
|
+
* footer sibling: one keyed text cell admitted into the prompt footer's
|
|
10
|
+
* existing left/right groups, with the same lifecycle, ownership, token, and
|
|
11
|
+
* ledger rules as `set()`.
|
|
9
12
|
*
|
|
10
13
|
* Same split as the dialogs seam: a cordis-free store the chat screen
|
|
11
14
|
* subscribes to, and a thin cordis service validating untrusted input.
|
|
12
15
|
*/
|
|
13
16
|
import { Service } from '@deepseek-ai/cordis';
|
|
14
|
-
import { cleanScalarText } from './sanitize.js';
|
|
17
|
+
import { cleanScalarText, cleanStatusFieldText } from './sanitize.js';
|
|
15
18
|
import { activationFiber, assertCallerContext, bindCallerEffect, compositionRoot, concreteService, requirePluginCaller } from './host-access.js';
|
|
16
19
|
import { componentIdentityOf } from './component-identity.js';
|
|
17
20
|
import { assertCapabilityShadowPolicy, } from '../adapter/kernel/runtime.js';
|
|
@@ -23,6 +26,16 @@ const TEXT_CELLS = 200;
|
|
|
23
26
|
const MAX_ENTRIES = 20;
|
|
24
27
|
const MAX_VIEW_ROWS = 3;
|
|
25
28
|
const MAX_VIEW_ROW_BUDGET = 6;
|
|
29
|
+
// Footer budget: six plugin cells total (the row is one terminal line), two
|
|
30
|
+
// per activation so one plugin cannot own the whole footer.
|
|
31
|
+
const MAX_FIELDS = 6;
|
|
32
|
+
const MAX_FIELDS_PER_OWNER = 2;
|
|
33
|
+
const FIELD_CELLS_DEFAULT = 16;
|
|
34
|
+
const FIELD_CELLS_MAX = 32;
|
|
35
|
+
const FIELD_DETAIL_CELLS = 160;
|
|
36
|
+
const FIELD_MIN_COLUMNS_MAX = 400;
|
|
37
|
+
const FIELD_SLOTS = new Set(['left-tail', 'right-head', 'right-tail']);
|
|
38
|
+
const FIELD_TONES = new Set(['dim', 'accent', 'success', 'warning', 'error']);
|
|
26
39
|
const HOST_STATUS_OWNER = Object.freeze({ kind: 'host-status-owner' });
|
|
27
40
|
/** Cordis-free text + view store. Render order is first-set/register order
|
|
28
41
|
* (Map insertion order), so plugin contributions do not jump on updates. */
|
|
@@ -35,10 +48,13 @@ export class TuiStatusStore {
|
|
|
35
48
|
// same status text).
|
|
36
49
|
entries = new Map();
|
|
37
50
|
views = new Map();
|
|
51
|
+
fields = new Map();
|
|
38
52
|
// useSyncExternalStore requires a referentially stable snapshot between
|
|
39
53
|
// emits — a fresh array per call would re-render in an infinite loop.
|
|
40
54
|
snapshot = [];
|
|
41
55
|
viewSnapshot = [];
|
|
56
|
+
fieldSnapshot = [];
|
|
57
|
+
onFieldError;
|
|
42
58
|
constructor(onViewError) {
|
|
43
59
|
this.onViewError = onViewError;
|
|
44
60
|
}
|
|
@@ -100,6 +116,54 @@ export class TuiStatusStore {
|
|
|
100
116
|
reportViewError(key, error) {
|
|
101
117
|
this.onViewError?.(key, error);
|
|
102
118
|
}
|
|
119
|
+
/** Current footer fields, first-set first and referentially stable between
|
|
120
|
+
* mutations for `useSyncExternalStore`. */
|
|
121
|
+
getFieldSnapshot() {
|
|
122
|
+
return this.fieldSnapshot;
|
|
123
|
+
}
|
|
124
|
+
/** Store (or overwrite) one admitted field. Slot/option merging already
|
|
125
|
+
* happened in the service; the store only records normalized entries. */
|
|
126
|
+
setField(entry, token, owner, rawOnClick) {
|
|
127
|
+
this.fields.set(entry.key, { entry, token, owner, ...(rawOnClick === undefined ? {} : { rawOnClick }) });
|
|
128
|
+
this.fieldSnapshot = [...this.fields.values()].map(record => record.entry);
|
|
129
|
+
this.emit();
|
|
130
|
+
}
|
|
131
|
+
/** The full admission record for `key` (read by the service to merge an
|
|
132
|
+
* update onto the previous options and to check ownership). */
|
|
133
|
+
fieldEntry(key) {
|
|
134
|
+
return this.fields.get(key);
|
|
135
|
+
}
|
|
136
|
+
fieldCount() {
|
|
137
|
+
return this.fields.size;
|
|
138
|
+
}
|
|
139
|
+
/** How many footer fields one activation currently owns (cap enforcement). */
|
|
140
|
+
fieldsOwnedBy(owner) {
|
|
141
|
+
let count = 0;
|
|
142
|
+
for (const record of this.fields.values()) {
|
|
143
|
+
if (record.owner === owner)
|
|
144
|
+
count += 1;
|
|
145
|
+
}
|
|
146
|
+
return count;
|
|
147
|
+
}
|
|
148
|
+
/** Clear `key` only while it still holds this token AND owner. */
|
|
149
|
+
clearFieldIf(key, token, owner) {
|
|
150
|
+
const current = this.fields.get(key);
|
|
151
|
+
if (owner !== undefined && current?.owner !== owner)
|
|
152
|
+
return false;
|
|
153
|
+
if (current?.token !== token)
|
|
154
|
+
return false;
|
|
155
|
+
this.fields.delete(key);
|
|
156
|
+
this.fieldSnapshot = [...this.fields.values()].map(record => record.entry);
|
|
157
|
+
this.emit();
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
/** UI-side handler for a plugin click that threw; the service logs first. */
|
|
161
|
+
setFieldErrorHandler(handler) {
|
|
162
|
+
this.onFieldError = handler;
|
|
163
|
+
}
|
|
164
|
+
reportFieldError(key, error) {
|
|
165
|
+
this.onFieldError?.(key, error);
|
|
166
|
+
}
|
|
103
167
|
/** Clear `key` only while it still holds the write tagged `token` — a
|
|
104
168
|
* stale disposer must not wipe a newer contribution (even one with
|
|
105
169
|
* identical text). Returns true when this call actually cleared. */
|
|
@@ -115,12 +179,14 @@ export class TuiStatusStore {
|
|
|
115
179
|
}
|
|
116
180
|
/** Drop everything (teardown). */
|
|
117
181
|
clear() {
|
|
118
|
-
if (this.entries.size === 0 && this.views.size === 0)
|
|
182
|
+
if (this.entries.size === 0 && this.views.size === 0 && this.fields.size === 0)
|
|
119
183
|
return;
|
|
120
184
|
this.entries.clear();
|
|
121
185
|
this.views.clear();
|
|
186
|
+
this.fields.clear();
|
|
122
187
|
this.snapshot = [];
|
|
123
188
|
this.viewSnapshot = [];
|
|
189
|
+
this.fieldSnapshot = [];
|
|
124
190
|
this.emit();
|
|
125
191
|
}
|
|
126
192
|
subscribe(listener) {
|
|
@@ -280,6 +346,255 @@ export class TuiStatusRuntime extends Service {
|
|
|
280
346
|
ledgerApplied = true;
|
|
281
347
|
return dispose;
|
|
282
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Insert (or update/clear) one keyed TEXT field in the prompt footer's
|
|
351
|
+
* existing left/right groups — no new row, no plugin component. The field
|
|
352
|
+
* keeps the same admission contract as `set()`: plugin caller, activation
|
|
353
|
+
* ownership, token-based disposers, effect-ledger records, never throws.
|
|
354
|
+
*
|
|
355
|
+
* Unlike `set()`, footer fields are capped (six total, two per activation)
|
|
356
|
+
* and each cell is truncated by the host to `maxCells` (default 16, at most
|
|
357
|
+
* 32) so the row's flex shrinking always has a definite bound. `detail` and
|
|
358
|
+
* `onClick` are optional; a click without a detail line is refused (the
|
|
359
|
+
* footer must never promise an action it cannot explain on hover).
|
|
360
|
+
*
|
|
361
|
+
* Passing `undefined` (or text that sanitizes to nothing) CLEARS the field;
|
|
362
|
+
* a stale disposer cannot clear a newer write for the same key.
|
|
363
|
+
*/
|
|
364
|
+
setField(key, text, options, identity) {
|
|
365
|
+
const state = statusStateFor(this);
|
|
366
|
+
assertCapabilityShadowPolicy('host.status.set', state.runtime.mode, state.runtime.slices);
|
|
367
|
+
const noop = () => { };
|
|
368
|
+
let caller;
|
|
369
|
+
try {
|
|
370
|
+
caller = requirePluginCaller(this.ctx, 'tuiStatus.setField', this);
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
this.ctx.logger.warn('dsh-tui: tuiStatus.setField requires a live non-root plugin activation');
|
|
374
|
+
return noop;
|
|
375
|
+
}
|
|
376
|
+
const store = state.store;
|
|
377
|
+
// Capture the logger now: a click handler can outlive the activation, and
|
|
378
|
+
// reaching back through a disposed caller proxy would only mask the error.
|
|
379
|
+
const logger = caller.logger;
|
|
380
|
+
if (identity !== undefined) {
|
|
381
|
+
try {
|
|
382
|
+
assertCallerContext(caller, identity, 'tuiStatus.setField');
|
|
383
|
+
}
|
|
384
|
+
catch {
|
|
385
|
+
logger.warn('dsh-tui: tuiStatus.setField rejected an identity belonging to another activation');
|
|
386
|
+
return noop;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const owner = activationFiber(caller);
|
|
390
|
+
if (owner === undefined) {
|
|
391
|
+
logger.warn('dsh-tui: tuiStatus.setField requires a live activation owner');
|
|
392
|
+
return noop;
|
|
393
|
+
}
|
|
394
|
+
let normalized;
|
|
395
|
+
try {
|
|
396
|
+
normalized = String(key ?? '').trim().toLowerCase();
|
|
397
|
+
}
|
|
398
|
+
catch {
|
|
399
|
+
logger.warn('dsh-tui: tuiStatus.setField rejected an uncoercible key');
|
|
400
|
+
return noop;
|
|
401
|
+
}
|
|
402
|
+
if (!KEY_PATTERN.test(normalized)) {
|
|
403
|
+
logger.warn('dsh-tui: tuiStatus.setField rejected an invalid key');
|
|
404
|
+
return noop;
|
|
405
|
+
}
|
|
406
|
+
const existing = store.fieldEntry(normalized);
|
|
407
|
+
const ledger = caller.get('tuiEffectLedger');
|
|
408
|
+
// Clear path. Ownership is checked BEFORE anything is removed: another
|
|
409
|
+
// activation's field is not this caller's to clear.
|
|
410
|
+
const clear = () => {
|
|
411
|
+
if (existing === undefined)
|
|
412
|
+
return noop;
|
|
413
|
+
if (existing.owner !== owner) {
|
|
414
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — the field belongs to another activation`);
|
|
415
|
+
return noop;
|
|
416
|
+
}
|
|
417
|
+
if (store.clearFieldIf(normalized, existing.token, owner)) {
|
|
418
|
+
ledger?.record({ operation: 'release', resource: { kind: 'status-field', id: normalized }, result: 'applied' }, identity);
|
|
419
|
+
}
|
|
420
|
+
return noop;
|
|
421
|
+
};
|
|
422
|
+
if (text === undefined || text === '')
|
|
423
|
+
return clear();
|
|
424
|
+
// Scalar-only coercion, same rule as set(): an object must not become
|
|
425
|
+
// "[object Object]" nor be silently downgraded to a clear.
|
|
426
|
+
if (typeof text !== 'string' && typeof text !== 'number' && typeof text !== 'boolean') {
|
|
427
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected non-scalar text for "${normalized}"`);
|
|
428
|
+
return noop;
|
|
429
|
+
}
|
|
430
|
+
let rawOptions;
|
|
431
|
+
if (options === undefined) {
|
|
432
|
+
rawOptions = {};
|
|
433
|
+
}
|
|
434
|
+
else if (typeof options !== 'object' || options === null || Array.isArray(options)) {
|
|
435
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected invalid options for "${normalized}"`);
|
|
436
|
+
return noop;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
rawOptions = options;
|
|
440
|
+
}
|
|
441
|
+
// The options object is plugin-supplied, so a throwing getter (or a Proxy)
|
|
442
|
+
// must take the documented reject-and-warn path instead of escaping into
|
|
443
|
+
// the caller. Read every option once, inside one guard: the checks below
|
|
444
|
+
// then cannot re-trigger a getter.
|
|
445
|
+
let optionMaxCells;
|
|
446
|
+
let optionSlot;
|
|
447
|
+
let optionTone;
|
|
448
|
+
let optionMinColumns;
|
|
449
|
+
let optionDetail;
|
|
450
|
+
let optionOnClick;
|
|
451
|
+
try {
|
|
452
|
+
optionMaxCells = rawOptions.maxCells;
|
|
453
|
+
optionSlot = rawOptions.slot;
|
|
454
|
+
optionTone = rawOptions.tone;
|
|
455
|
+
optionMinColumns = rawOptions.minColumns;
|
|
456
|
+
optionDetail = rawOptions.detail;
|
|
457
|
+
optionOnClick = rawOptions.onClick;
|
|
458
|
+
}
|
|
459
|
+
catch {
|
|
460
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — unreadable options`);
|
|
461
|
+
return noop;
|
|
462
|
+
}
|
|
463
|
+
const prev = existing?.entry;
|
|
464
|
+
let maxCells = prev?.maxCells ?? FIELD_CELLS_DEFAULT;
|
|
465
|
+
if (optionMaxCells !== undefined) {
|
|
466
|
+
if (typeof optionMaxCells !== 'number' || !Number.isInteger(optionMaxCells)) {
|
|
467
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — maxCells must be an integer`);
|
|
468
|
+
return noop;
|
|
469
|
+
}
|
|
470
|
+
maxCells = Math.min(FIELD_CELLS_MAX, Math.max(1, optionMaxCells));
|
|
471
|
+
}
|
|
472
|
+
const cleaned = cleanStatusFieldText(text, maxCells);
|
|
473
|
+
// Whitespace/control/bidi-only text is a clear (set() folds it the same
|
|
474
|
+
// way). Checked before the remaining option gates: a clear carries no
|
|
475
|
+
// rendered options to validate.
|
|
476
|
+
if (cleaned === '')
|
|
477
|
+
return clear();
|
|
478
|
+
let slot = prev?.slot ?? 'left-tail';
|
|
479
|
+
if (optionSlot !== undefined) {
|
|
480
|
+
if (!FIELD_SLOTS.has(optionSlot)) {
|
|
481
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — invalid slot`);
|
|
482
|
+
return noop;
|
|
483
|
+
}
|
|
484
|
+
slot = optionSlot;
|
|
485
|
+
}
|
|
486
|
+
let tone = prev?.tone ?? 'dim';
|
|
487
|
+
if (optionTone !== undefined) {
|
|
488
|
+
if (!FIELD_TONES.has(optionTone)) {
|
|
489
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — invalid tone`);
|
|
490
|
+
return noop;
|
|
491
|
+
}
|
|
492
|
+
tone = optionTone;
|
|
493
|
+
}
|
|
494
|
+
let minColumns = prev?.minColumns ?? 0;
|
|
495
|
+
if (optionMinColumns !== undefined) {
|
|
496
|
+
if (typeof optionMinColumns !== 'number' || !Number.isInteger(optionMinColumns)) {
|
|
497
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — minColumns must be an integer`);
|
|
498
|
+
return noop;
|
|
499
|
+
}
|
|
500
|
+
minColumns = Math.min(FIELD_MIN_COLUMNS_MAX, Math.max(0, optionMinColumns));
|
|
501
|
+
}
|
|
502
|
+
let detail = prev?.detail;
|
|
503
|
+
if (optionDetail !== undefined) {
|
|
504
|
+
if (typeof optionDetail !== 'string') {
|
|
505
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — detail must be a string`);
|
|
506
|
+
return noop;
|
|
507
|
+
}
|
|
508
|
+
// An explicitly empty/unsafe detail means "no detail", not "keep the old
|
|
509
|
+
// one" — omitted is the only spelling that carries the previous value.
|
|
510
|
+
detail = cleanStatusFieldText(optionDetail, FIELD_DETAIL_CELLS) || undefined;
|
|
511
|
+
}
|
|
512
|
+
let rawOnClick = existing?.rawOnClick;
|
|
513
|
+
if (optionOnClick !== undefined) {
|
|
514
|
+
if (typeof optionOnClick !== 'function') {
|
|
515
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — onClick must be a function`);
|
|
516
|
+
return noop;
|
|
517
|
+
}
|
|
518
|
+
rawOnClick = optionOnClick;
|
|
519
|
+
}
|
|
520
|
+
if (rawOnClick !== undefined && detail === undefined) {
|
|
521
|
+
// D3: a clickable cell owes the user an explanation on hover.
|
|
522
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — onClick requires detail`);
|
|
523
|
+
return noop;
|
|
524
|
+
}
|
|
525
|
+
if (existing === undefined) {
|
|
526
|
+
if (store.fieldCount() >= MAX_FIELDS) {
|
|
527
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}": ${MAX_FIELDS} footer fields already shown`);
|
|
528
|
+
return noop;
|
|
529
|
+
}
|
|
530
|
+
if (store.fieldsOwnedBy(owner) >= MAX_FIELDS_PER_OWNER) {
|
|
531
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}": ${MAX_FIELDS_PER_OWNER} footer fields per plugin already shown`);
|
|
532
|
+
return noop;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
else if (existing.owner !== owner) {
|
|
536
|
+
logger.warn(`dsh-tui: tuiStatus.setField rejected "${normalized}" — the field belongs to another activation`);
|
|
537
|
+
return noop;
|
|
538
|
+
}
|
|
539
|
+
// The wrapper lives HERE, not in the UI: a throwing click and a REJECTED
|
|
540
|
+
// async click share one funnel — both are logged and reported as a toast.
|
|
541
|
+
// A bare `rawOnClick()` leaves a returned promise unobserved, and an
|
|
542
|
+
// unhandled rejection is fatal to the process guard; `shortcuts.ts` uses
|
|
543
|
+
// the same deferred funnel for its handlers.
|
|
544
|
+
const onClick = rawOnClick === undefined
|
|
545
|
+
? undefined
|
|
546
|
+
: () => {
|
|
547
|
+
Promise.resolve()
|
|
548
|
+
.then(() => rawOnClick())
|
|
549
|
+
.catch((error) => {
|
|
550
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
551
|
+
logger.warn(`dsh-tui: tuiStatus.setField "${normalized}" click failed: ${failure.message}`);
|
|
552
|
+
store.reportFieldError(normalized, failure);
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
const token = state.nextToken++;
|
|
556
|
+
const entry = Object.freeze({
|
|
557
|
+
key: normalized,
|
|
558
|
+
text: cleaned,
|
|
559
|
+
slot,
|
|
560
|
+
tone,
|
|
561
|
+
maxCells,
|
|
562
|
+
minColumns,
|
|
563
|
+
...(detail === undefined ? {} : { detail }),
|
|
564
|
+
...(onClick === undefined ? {} : { onClick }),
|
|
565
|
+
});
|
|
566
|
+
store.setField(entry, token, owner, rawOnClick);
|
|
567
|
+
const had = existing !== undefined;
|
|
568
|
+
let disposed = false;
|
|
569
|
+
let ledgerApplied = false;
|
|
570
|
+
let ownerCleanup;
|
|
571
|
+
const dispose = () => {
|
|
572
|
+
if (disposed)
|
|
573
|
+
return;
|
|
574
|
+
disposed = true;
|
|
575
|
+
if (store.clearFieldIf(normalized, token, owner) && ledgerApplied) {
|
|
576
|
+
caller.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'status-field', id: normalized }, result: 'applied' }, identity);
|
|
577
|
+
}
|
|
578
|
+
const cleanup = ownerCleanup;
|
|
579
|
+
ownerCleanup = undefined;
|
|
580
|
+
cleanup?.();
|
|
581
|
+
};
|
|
582
|
+
const bound = bindCallerEffect(caller, dispose, cleanup => {
|
|
583
|
+
ownerCleanup = cleanup;
|
|
584
|
+
});
|
|
585
|
+
// bindCallerEffect runs the disposer itself when registration fails, so the
|
|
586
|
+
// store entry is already rolled back here.
|
|
587
|
+
if (!bound)
|
|
588
|
+
return noop;
|
|
589
|
+
ledger?.record({
|
|
590
|
+
operation: had ? 'replace' : 'bind',
|
|
591
|
+
resource: { kind: 'status-field', id: normalized },
|
|
592
|
+
result: 'applied',
|
|
593
|
+
...(had ? { replaces: { resourceId: normalized } } : {}),
|
|
594
|
+
}, identity);
|
|
595
|
+
ledgerApplied = true;
|
|
596
|
+
return dispose;
|
|
597
|
+
}
|
|
283
598
|
/**
|
|
284
599
|
* Register a compact React view above the prompt. The component receives
|
|
285
600
|
* the host's React plus a pointer-only UI kit; it owns its live data via an
|