@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,7 +1,7 @@
|
|
|
1
1
|
import type { ServiceLookup } from './channel-host.js';
|
|
2
2
|
import type { LocalImageStore } from './core/local-images.js';
|
|
3
3
|
import type { ChannelOwner } from './owner.js';
|
|
4
|
-
import type { ChannelImageBlock, ComposerImageRef, StagedImageHandle, StagedImageInput, TranscriptImage } from './types.js';
|
|
4
|
+
import type { ChannelImageBlock, MentionAttachments, ComposerImageRef, StagedImageAdjustment, StagedImageHandle, StagedImageInput, TranscriptImage } from './types.js';
|
|
5
5
|
/** Every visible composer placeholder token, in source order. */
|
|
6
6
|
export declare const COMPOSER_IMAGE_TOKEN: RegExp;
|
|
7
7
|
/** One whole placeholder token; the distinction matters because a mention
|
|
@@ -52,6 +52,14 @@ export interface ComposerImages {
|
|
|
52
52
|
/** Enqueue-time capture: legacy bindings merged, one object per ref. */
|
|
53
53
|
captureDraftImages(text: string, images: readonly ComposerImageRef[]): readonly ComposerImageRef[];
|
|
54
54
|
}
|
|
55
|
+
/** A controlled admission refusal, safe to expose alongside a failed mention. */
|
|
56
|
+
export declare class ImageAdmissionError extends Error {
|
|
57
|
+
}
|
|
58
|
+
/** Shared paste/mention admission; the returned attachment is the store's truth. */
|
|
59
|
+
export declare function saveAdmittedImage(attachments: MentionAttachments, input: StagedImageInput): Promise<{
|
|
60
|
+
attachment: ChannelImageBlock['attachment'];
|
|
61
|
+
adjustment?: StagedImageAdjustment;
|
|
62
|
+
}>;
|
|
55
63
|
/**
|
|
56
64
|
* Owns the editable-composer image capabilities: the session epoch, the
|
|
57
65
|
* capability map, its preview facades and the `[Image #N]` compatibility
|
|
@@ -65,5 +73,7 @@ export declare function createComposerImages(ctx: ServiceLookup, owner: ChannelO
|
|
|
65
73
|
* backend with the `images` capability); undefined = the DSH
|
|
66
74
|
* attachments service. */
|
|
67
75
|
localImages?(): LocalImageStore | undefined;
|
|
76
|
+
/** Staged images a session change keeps: those of held rows. */
|
|
77
|
+
retainedStageIds?(): ReadonlySet<string>;
|
|
68
78
|
}): ComposerImages;
|
|
69
79
|
//# sourceMappingURL=composer-images.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composer-images.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/composer-images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAOtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"composer-images.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/composer-images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAOtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,QAAqB,CAAA;AAEtD;6EAC6E;AAC7E,eAAO,MAAM,0BAA0B,QAAsB,CAAA;AAE7D,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,KAAG,MACe,CAAA;AAE1E;;;2EAG2E;AAC3E,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,GAC7B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAehB;AAED;;4EAE4E;AAC5E,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAA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,iFAAiF;AACjF,qBAAa,mBAAoB,SAAQ,KAAK;CAAG;AAEjD,oFAAoF;AACpF,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,kBAAkB,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAAE,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAAC,UAAU,CAAC,EAAE,qBAAqB,CAAA;CAAE,CAAC,CA2G9L;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;IACJ,UAAU,IAAI,MAAM,CAAA;IACpB,kFAAkF;IAClF,SAAS,CAAC,IAAI,MAAM,CAAA;IACpB;;+BAE2B;IAC3B,WAAW,CAAC,IAAI,eAAe,GAAG,SAAS,CAAA;IAC3C,gEAAgE;IAChE,gBAAgB,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAA;CACzC,GACA,cAAc,CA8KhB"}
|
|
@@ -65,6 +65,115 @@ function admissionFailure(outcome, context) {
|
|
|
65
65
|
/** A store-reported pixel dimension, or the gate's own value when the store
|
|
66
66
|
* reported none (lean attachment fakes in the verify scripts). */
|
|
67
67
|
const positiveOr = (value, fallback) => typeof value === 'number' && value > 0 ? value : fallback;
|
|
68
|
+
/** A controlled admission refusal, safe to expose alongside a failed mention. */
|
|
69
|
+
export class ImageAdmissionError extends Error {
|
|
70
|
+
}
|
|
71
|
+
/** Shared paste/mention admission; the returned attachment is the store's truth. */
|
|
72
|
+
export async function saveAdmittedImage(attachments, input) {
|
|
73
|
+
if (input.data.byteLength > attachments.imageLimits.maxImageBytes) {
|
|
74
|
+
throw new ImageAdmissionError(`image exceeds this profile's per-image size limit`);
|
|
75
|
+
}
|
|
76
|
+
// Ingress adaptation (issue #938): the store admits by media type, byte
|
|
77
|
+
// budget and the per-side / total pixel caps, and refuses on all of them
|
|
78
|
+
// when the bytes reach it. Measure and re-encode HERE instead, while the
|
|
79
|
+
// paste can still be explained to the user. Admission is judged against
|
|
80
|
+
// the pair this gate HANDS OVER (the store may normalize further on its
|
|
81
|
+
// own — that step is outside this feature), and both triggers are
|
|
82
|
+
// size-independent:
|
|
83
|
+
// * a source media type the profile does not accept is converted, so a
|
|
84
|
+
// small PNG is never refused while a large one succeeds;
|
|
85
|
+
// * a probe-recognized image inside the caps skips sharp entirely;
|
|
86
|
+
// * an unrecognized format is decoded for measurement (never trusted by
|
|
87
|
+
// byte budget alone — the #432 gap);
|
|
88
|
+
// * with sharp absent the image goes to the store unchanged ONLY while
|
|
89
|
+
// it is still admissible as-is — an accepted format whose size the
|
|
90
|
+
// probe could not prove fits (upstream stays the backstop); a measured
|
|
91
|
+
// oversize, a decode failure, an unaccepted format or a multi-frame
|
|
92
|
+
// image this gate would have to re-encode is reported now instead of
|
|
93
|
+
// becoming a token that dies at save time.
|
|
94
|
+
// The runtime guards keep older attachment fakes (whose imageLimits
|
|
95
|
+
// predate the dimension fields) on the legacy synchronous path.
|
|
96
|
+
const dimensionCap = attachments.imageLimits.maxImageDimension;
|
|
97
|
+
const pixelCap = attachments.imageLimits.maxImagePixels;
|
|
98
|
+
let mediaType = input.mediaType;
|
|
99
|
+
let data = input.data;
|
|
100
|
+
// The content wins over the declared label — the same rule the local
|
|
101
|
+
// image store applies (channel/core/local-images.ts): a paste declares
|
|
102
|
+
// its media type from the filename, and a renamed or mis-exported file
|
|
103
|
+
// (a wechat download, a re-saved screenshot) would otherwise be judged
|
|
104
|
+
// and stored under a type its bytes contradict. The sniff reads magic
|
|
105
|
+
// bytes only; content it cannot identify keeps the declared label and
|
|
106
|
+
// takes the decode-or-refuse path below.
|
|
107
|
+
const sniffed = sniffImageMediaType(data);
|
|
108
|
+
if (sniffed !== undefined && sniffed !== mediaType)
|
|
109
|
+
mediaType = sniffed;
|
|
110
|
+
let adapted;
|
|
111
|
+
if (typeof dimensionCap === 'number' && typeof pixelCap === 'number'
|
|
112
|
+
&& Number.isFinite(dimensionCap) && Number.isFinite(pixelCap)) {
|
|
113
|
+
const dimensionLimits = { maxImageDimension: dimensionCap, maxImagePixels: pixelCap };
|
|
114
|
+
const probe = probeImageSize(data);
|
|
115
|
+
const sourceAccepted = attachments.imageLimits.mediaTypes.includes(mediaType);
|
|
116
|
+
// Only a probe-measured oversize is *known* to be refused by the store;
|
|
117
|
+
// an unmeasurable image may well be admissible, which is what keeps the
|
|
118
|
+
// sharp-less degradation a degradation rather than a guess.
|
|
119
|
+
const knownOversize = probe !== null && !withinDimensionLimits(probe, dimensionLimits);
|
|
120
|
+
if (!sourceAccepted || probe === null || knownOversize) {
|
|
121
|
+
const outcome = await adaptImageForAdmission(data, mediaType, dimensionLimits, attachments.imageLimits.mediaTypes);
|
|
122
|
+
if (outcome.kind === 'adapted') {
|
|
123
|
+
// outcome.mediaType comes from the accepted list inside the gate, so
|
|
124
|
+
// it is one of the profile's media types at runtime — narrowing,
|
|
125
|
+
// not trusting.
|
|
126
|
+
mediaType = outcome.mediaType;
|
|
127
|
+
data = outcome.data;
|
|
128
|
+
adapted = outcome;
|
|
129
|
+
if (data.byteLength > attachments.imageLimits.maxImageBytes) {
|
|
130
|
+
throw new ImageAdmissionError(`image still exceeds this profile's per-image size limit after resampling`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else if (outcome.kind === 'unavailable') {
|
|
134
|
+
// Degrade ONLY when the paste is still admissible as-is: an accepted
|
|
135
|
+
// format whose size the probe could not prove fits. Everything else
|
|
136
|
+
// (measured oversize, unaccepted format, decode failure, animation
|
|
137
|
+
// that cannot survive) is a refusal we can state now.
|
|
138
|
+
const degraded = outcome.reason === 'sharp-missing' && sourceAccepted && !knownOversize;
|
|
139
|
+
if (!degraded) {
|
|
140
|
+
// The refused bytes are the only forensic handle on a "could not
|
|
141
|
+
// be decoded" paste — the temp export is unlinked right after —
|
|
142
|
+
// so an opted-in run records what the gate actually saw.
|
|
143
|
+
logForDebugging('image ingress refused', {
|
|
144
|
+
reason: outcome.reason,
|
|
145
|
+
detail: outcome.detail,
|
|
146
|
+
declared: input.mediaType,
|
|
147
|
+
sniffed,
|
|
148
|
+
bytes: data.byteLength,
|
|
149
|
+
prefix: Buffer.from(data.subarray(0, 16)).toString('hex'),
|
|
150
|
+
...(input.name === undefined ? {} : { name: input.name }),
|
|
151
|
+
});
|
|
152
|
+
throw new ImageAdmissionError(admissionFailure(outcome, { probe, mediaType, limits: dimensionLimits }));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// What the store will actually see: an accepted media type, inside the
|
|
158
|
+
// byte cap. A media type can still be unaccepted here only when the
|
|
159
|
+
// adaptation did not run (legacy limits) or could not produce one.
|
|
160
|
+
if (!attachments.imageLimits.mediaTypes.includes(mediaType)) {
|
|
161
|
+
throw new ImageAdmissionError(`${mediaType} images are not accepted by this profile`);
|
|
162
|
+
}
|
|
163
|
+
// The source path is TUI-side display metadata; the store only sees the
|
|
164
|
+
// fields its contract names. mediaType/data may be the adapted pair from
|
|
165
|
+
// the ingress gate above.
|
|
166
|
+
const { path: _path, ...stored } = input;
|
|
167
|
+
const attachment = await attachments.saveImage({ ...stored, mediaType, data });
|
|
168
|
+
const sourceSize = probeImageSize(input.data);
|
|
169
|
+
const width = positiveOr(attachment.width, adapted?.width ?? sourceSize?.width ?? 0);
|
|
170
|
+
const height = positiveOr(attachment.height, adapted?.height ?? sourceSize?.height ?? 0);
|
|
171
|
+
const resized = adapted?.resized === true || (adapted !== undefined && (width !== adapted.width || height !== adapted.height)) || (sourceSize !== null && (width !== sourceSize.width || height !== sourceSize.height));
|
|
172
|
+
const adjustment = adapted !== undefined || resized || attachment.mediaType !== mediaType
|
|
173
|
+
? { sourceMediaType: input.mediaType, mediaType: attachment.mediaType, width, height, resized, flattened: adapted?.flattened ?? false }
|
|
174
|
+
: undefined;
|
|
175
|
+
return { attachment, ...(adjustment === undefined ? {} : { adjustment }) };
|
|
176
|
+
}
|
|
68
177
|
/**
|
|
69
178
|
* Owns the editable-composer image capabilities: the session epoch, the
|
|
70
179
|
* capability map, its preview facades and the `[Image #N]` compatibility
|
|
@@ -94,8 +203,16 @@ export function createComposerImages(ctx, owner, deps) {
|
|
|
94
203
|
};
|
|
95
204
|
const clearStagedImages = () => {
|
|
96
205
|
stagedImageEpoch += 1;
|
|
97
|
-
|
|
98
|
-
|
|
206
|
+
// Held rows are the user's messages waiting for the next session (#1651):
|
|
207
|
+
// their images go with them. References are content-addressed and
|
|
208
|
+
// durable, so only the drafts' capabilities are revoked.
|
|
209
|
+
const retained = deps.retainedStageIds?.() ?? new Set();
|
|
210
|
+
for (const stageId of [...stagedImages.keys()]) {
|
|
211
|
+
if (retained.has(stageId))
|
|
212
|
+
continue;
|
|
213
|
+
stagedImages.delete(stageId);
|
|
214
|
+
stagedImageViews.delete(stageId);
|
|
215
|
+
}
|
|
99
216
|
legacyStagedImageRefs.clear();
|
|
100
217
|
legacyStagedImageSequence = 0;
|
|
101
218
|
};
|
|
@@ -149,101 +266,8 @@ export function createComposerImages(ctx, owner, deps) {
|
|
|
149
266
|
if (generation !== stagedImageEpoch) {
|
|
150
267
|
throw new Error('the session changed while the image was being staged');
|
|
151
268
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
// Ingress adaptation (issue #938): the store admits by media type, byte
|
|
156
|
-
// budget and the per-side / total pixel caps, and refuses on all of them
|
|
157
|
-
// when the bytes reach it. Measure and re-encode HERE instead, while the
|
|
158
|
-
// paste can still be explained to the user. Admission is judged against
|
|
159
|
-
// the pair this gate HANDS OVER (the store may normalize further on its
|
|
160
|
-
// own — that step is outside this feature), and both triggers are
|
|
161
|
-
// size-independent:
|
|
162
|
-
// * a source media type the profile does not accept is converted, so a
|
|
163
|
-
// small PNG is never refused while a large one succeeds;
|
|
164
|
-
// * a probe-recognized image inside the caps skips sharp entirely;
|
|
165
|
-
// * an unrecognized format is decoded for measurement (never trusted by
|
|
166
|
-
// byte budget alone — the #432 gap);
|
|
167
|
-
// * with sharp absent the image goes to the store unchanged ONLY while
|
|
168
|
-
// it is still admissible as-is — an accepted format whose size the
|
|
169
|
-
// probe could not prove fits (upstream stays the backstop); a measured
|
|
170
|
-
// oversize, a decode failure, an unaccepted format or a multi-frame
|
|
171
|
-
// image this gate would have to re-encode is reported now instead of
|
|
172
|
-
// becoming a token that dies at save time.
|
|
173
|
-
// The runtime guards keep older attachment fakes (whose imageLimits
|
|
174
|
-
// predate the dimension fields) on the legacy synchronous path.
|
|
175
|
-
const dimensionCap = attachments.imageLimits.maxImageDimension;
|
|
176
|
-
const pixelCap = attachments.imageLimits.maxImagePixels;
|
|
177
|
-
let mediaType = input.mediaType;
|
|
178
|
-
let data = input.data;
|
|
179
|
-
// The content wins over the declared label — the same rule the local
|
|
180
|
-
// image store applies (channel/core/local-images.ts): a paste declares
|
|
181
|
-
// its media type from the filename, and a renamed or mis-exported file
|
|
182
|
-
// (a wechat download, a re-saved screenshot) would otherwise be judged
|
|
183
|
-
// and stored under a type its bytes contradict. The sniff reads magic
|
|
184
|
-
// bytes only; content it cannot identify keeps the declared label and
|
|
185
|
-
// takes the decode-or-refuse path below.
|
|
186
|
-
const sniffed = sniffImageMediaType(data);
|
|
187
|
-
if (sniffed !== undefined && sniffed !== mediaType)
|
|
188
|
-
mediaType = sniffed;
|
|
189
|
-
let adapted;
|
|
190
|
-
if (typeof dimensionCap === 'number' && typeof pixelCap === 'number'
|
|
191
|
-
&& Number.isFinite(dimensionCap) && Number.isFinite(pixelCap)) {
|
|
192
|
-
const dimensionLimits = { maxImageDimension: dimensionCap, maxImagePixels: pixelCap };
|
|
193
|
-
const probe = probeImageSize(data);
|
|
194
|
-
const sourceAccepted = attachments.imageLimits.mediaTypes.includes(mediaType);
|
|
195
|
-
// Only a probe-measured oversize is *known* to be refused by the store;
|
|
196
|
-
// an unmeasurable image may well be admissible, which is what keeps the
|
|
197
|
-
// sharp-less degradation a degradation rather than a guess.
|
|
198
|
-
const knownOversize = probe !== null && !withinDimensionLimits(probe, dimensionLimits);
|
|
199
|
-
if (!sourceAccepted || probe === null || knownOversize) {
|
|
200
|
-
const outcome = await adaptImageForAdmission(data, mediaType, dimensionLimits, attachments.imageLimits.mediaTypes);
|
|
201
|
-
if (outcome.kind === 'adapted') {
|
|
202
|
-
// outcome.mediaType comes from the accepted list inside the gate, so
|
|
203
|
-
// it is one of the profile's media types at runtime — narrowing,
|
|
204
|
-
// not trusting.
|
|
205
|
-
mediaType = outcome.mediaType;
|
|
206
|
-
data = outcome.data;
|
|
207
|
-
adapted = outcome;
|
|
208
|
-
if (data.byteLength > attachments.imageLimits.maxImageBytes) {
|
|
209
|
-
throw new Error(`image still exceeds this profile's per-image size limit after resampling`);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
else if (outcome.kind === 'unavailable') {
|
|
213
|
-
// Degrade ONLY when the paste is still admissible as-is: an accepted
|
|
214
|
-
// format whose size the probe could not prove fits. Everything else
|
|
215
|
-
// (measured oversize, unaccepted format, decode failure, animation
|
|
216
|
-
// that cannot survive) is a refusal we can state now.
|
|
217
|
-
const degraded = outcome.reason === 'sharp-missing' && sourceAccepted && !knownOversize;
|
|
218
|
-
if (!degraded) {
|
|
219
|
-
// The refused bytes are the only forensic handle on a "could not
|
|
220
|
-
// be decoded" paste — the temp export is unlinked right after —
|
|
221
|
-
// so an opted-in run records what the gate actually saw.
|
|
222
|
-
logForDebugging('image ingress refused', {
|
|
223
|
-
reason: outcome.reason,
|
|
224
|
-
detail: outcome.detail,
|
|
225
|
-
declared: input.mediaType,
|
|
226
|
-
sniffed,
|
|
227
|
-
bytes: data.byteLength,
|
|
228
|
-
prefix: Buffer.from(data.subarray(0, 16)).toString('hex'),
|
|
229
|
-
...(input.name === undefined ? {} : { name: input.name }),
|
|
230
|
-
});
|
|
231
|
-
throw new Error(admissionFailure(outcome, { probe, mediaType, limits: dimensionLimits }));
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
// What the store will actually see: an accepted media type, inside the
|
|
237
|
-
// byte cap. A media type can still be unaccepted here only when the
|
|
238
|
-
// adaptation did not run (legacy limits) or could not produce one.
|
|
239
|
-
if (!attachments.imageLimits.mediaTypes.includes(mediaType)) {
|
|
240
|
-
throw new Error(`${mediaType} images are not accepted by this profile`);
|
|
241
|
-
}
|
|
242
|
-
// The source path is TUI-side display metadata; the store only sees the
|
|
243
|
-
// fields its contract names. mediaType/data may be the adapted pair from
|
|
244
|
-
// the ingress gate above.
|
|
245
|
-
const { path, ...stored } = input;
|
|
246
|
-
const attachment = await attachments.saveImage({ ...stored, mediaType, data });
|
|
269
|
+
const { attachment, adjustment } = await saveAdmittedImage(attachments, input);
|
|
270
|
+
const { path } = input;
|
|
247
271
|
// A session change (/new, resume, rewind, model switch, background)
|
|
248
272
|
// cleared the maps while the save was in flight: the durable object is
|
|
249
273
|
// harmless, but the OLD session's capability must not reach the new one.
|
|
@@ -264,22 +288,6 @@ export function createComposerImages(ctx, owner, deps) {
|
|
|
264
288
|
break;
|
|
265
289
|
deleteStagedImage(oldest);
|
|
266
290
|
}
|
|
267
|
-
// The adjustment travels with the capability so the composer can say what
|
|
268
|
-
// happened instead of letting a rewritten image reach the store silently.
|
|
269
|
-
// Its numbers come from the STORE's own report, not from what this gate
|
|
270
|
-
// handed over: the store normalizes further (dimensions, and the media type
|
|
271
|
-
// too), and a notice quoting the gate's numbers would contradict the
|
|
272
|
-
// preview card the user is looking at.
|
|
273
|
-
const adjustment = adapted === undefined ? undefined : {
|
|
274
|
-
sourceMediaType: input.mediaType,
|
|
275
|
-
mediaType: attachment.mediaType,
|
|
276
|
-
width: positiveOr(attachment.width, adapted.width),
|
|
277
|
-
height: positiveOr(attachment.height, adapted.height),
|
|
278
|
-
resized: adapted.resized
|
|
279
|
-
|| positiveOr(attachment.width, adapted.width) !== adapted.width
|
|
280
|
-
|| positiveOr(attachment.height, adapted.height) !== adapted.height,
|
|
281
|
-
flattened: adapted.flattened,
|
|
282
|
-
};
|
|
283
291
|
return adjustment === undefined ? { stageId } : { stageId, adjustment };
|
|
284
292
|
};
|
|
285
293
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composer-mentions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/composer-mentions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"composer-mentions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/composer-mentions.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEpG;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC1C,EAAE,EAAE,SAAS,GAAG,SAAS,EACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,kBAAkB,EAChC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC,GAClE,OAAO,CAAC,gBAAgB,CAAC,CAuM3B"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { isAbsolute, join } from 'node:path';
|
|
2
2
|
import { extractMentions } from '../../utils/mentions.js';
|
|
3
|
-
import { COMPOSER_IMAGE_TOKEN } from './composer-images.js';
|
|
3
|
+
import { COMPOSER_IMAGE_TOKEN, ImageAdmissionError, saveAdmittedImage } from './composer-images.js';
|
|
4
4
|
import { MENTION_MAX_DIR_ENTRIES, MENTION_MAX_FILE_CHARS, MENTION_MAX_TOTAL_CHARS, mentionImageMediaType, tryResolveMention, } from './mentions.js';
|
|
5
5
|
import { basename } from './paths.js';
|
|
6
|
+
import { expandHomePrefix } from '../../utils/paths.js';
|
|
6
7
|
/**
|
|
7
8
|
* Expand a submitted text's `@` mentions (issue #15) into model-facing
|
|
8
9
|
* attachment blocks: supported image files become durable image blocks,
|
|
@@ -19,6 +20,8 @@ export async function expandComposerMentions(fs, cwd, text, attachments, stagedI
|
|
|
19
20
|
const blocks = [{ type: 'text', text }];
|
|
20
21
|
const attached = [];
|
|
21
22
|
const missing = [];
|
|
23
|
+
const imageAdjustments = [];
|
|
24
|
+
const imageFailures = [];
|
|
22
25
|
const mentions = extractMentions(text);
|
|
23
26
|
let budget = MENTION_MAX_TOTAL_CHARS;
|
|
24
27
|
let imageCount = 0;
|
|
@@ -80,15 +83,22 @@ export async function expandComposerMentions(fs, cwd, text, attachments, stagedI
|
|
|
80
83
|
if (budget <= 0 && imageMediaType === undefined)
|
|
81
84
|
continue;
|
|
82
85
|
// Mentions resolve against the session cwd, same as the model-facing fs
|
|
83
|
-
// tools; absolute paths pass through untouched
|
|
84
|
-
// (
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
|
|
86
|
+
// tools; absolute paths pass through untouched, and a leading literal `~/`
|
|
87
|
+
// (or `~\`) expands to the host home exactly like completion does (issue
|
|
88
|
+
// #1706 — this is the submit path, so without it a path the `@` menu
|
|
89
|
+
// listed was joined onto the workspace and silently went missing). A
|
|
90
|
+
// `#L12-14` line suffix (issue #359) is stripped before resolution; when
|
|
91
|
+
// the stripped path misses, the typed literal (suffix intact) gets ONE
|
|
92
|
+
// fallback try so filenames genuinely containing `#L…` still resolve as
|
|
93
|
+
// whole files.
|
|
94
|
+
const mentionPath = expandHomePrefix(mention.path);
|
|
95
|
+
const absolute = isAbsolute(mentionPath) ? mentionPath : join(cwd, mentionPath);
|
|
88
96
|
let resolved = await tryResolveMention(fs, absolute);
|
|
89
97
|
let literalFallback = false;
|
|
98
|
+
let literalExpanded;
|
|
90
99
|
if (resolved === undefined && mention.literal !== undefined) {
|
|
91
|
-
|
|
100
|
+
literalExpanded = expandHomePrefix(mention.literal);
|
|
101
|
+
const literalPath = isAbsolute(literalExpanded) ? literalExpanded : join(cwd, literalExpanded);
|
|
92
102
|
resolved = await tryResolveMention(fs, literalPath);
|
|
93
103
|
literalFallback = resolved !== undefined;
|
|
94
104
|
}
|
|
@@ -99,7 +109,14 @@ export async function expandComposerMentions(fs, cwd, text, attachments, stagedI
|
|
|
99
109
|
const { target, info } = resolved;
|
|
100
110
|
// On a literal-fallback hit the attached file IS the typed name — the
|
|
101
111
|
// model must see that path, not the suffix-stripped one.
|
|
102
|
-
|
|
112
|
+
//
|
|
113
|
+
// The model-facing path must also be resolvable by the fs tools, which
|
|
114
|
+
// resolve against the session cwd and do NOT expand `~` (issue #1706):
|
|
115
|
+
// when the typed path carried a home prefix, hand the model the expanded
|
|
116
|
+
// path. The user-visible `attached`/`missing` lists keep the typed string.
|
|
117
|
+
const shownPath = literalFallback
|
|
118
|
+
? (literalExpanded !== undefined && isAbsolute(literalExpanded) ? literalExpanded : display)
|
|
119
|
+
: (isAbsolute(mentionPath) ? mentionPath : mention.path);
|
|
103
120
|
// …and judge image-ness by the typed extension in that case too.
|
|
104
121
|
const imageType = literalFallback && mention.literal !== undefined
|
|
105
122
|
? mentionImageMediaType(mention.literal)
|
|
@@ -107,28 +124,32 @@ export async function expandComposerMentions(fs, cwd, text, attachments, stagedI
|
|
|
107
124
|
if (info?.type === 'file') {
|
|
108
125
|
if (imageType !== undefined && attachments !== undefined && fs.readBytes !== undefined) {
|
|
109
126
|
const limits = attachments.imageLimits;
|
|
110
|
-
if (
|
|
127
|
+
if (imageCount >= limits.maxImagesPerMessage) {
|
|
111
128
|
missing.push(display);
|
|
112
129
|
continue;
|
|
113
130
|
}
|
|
114
131
|
try {
|
|
115
132
|
const data = await fs.readBytes(target, undefined, limits.maxImageBytes);
|
|
116
|
-
|
|
117
|
-
missing.push(display);
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
const attachment = await attachments.saveImage({
|
|
133
|
+
const { attachment, adjustment } = await saveAdmittedImage(attachments, {
|
|
121
134
|
data,
|
|
122
135
|
mediaType: imageType,
|
|
123
136
|
name: basename(target.displayPath),
|
|
124
137
|
});
|
|
138
|
+
if (imageBytes + attachment.bytes > limits.maxMessageImageBytes) {
|
|
139
|
+
missing.push(display);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
125
142
|
blocks.push({ type: 'image', attachment });
|
|
143
|
+
if (adjustment !== undefined)
|
|
144
|
+
imageAdjustments.push({ path: display, adjustment });
|
|
126
145
|
imageCount += 1;
|
|
127
|
-
imageBytes +=
|
|
146
|
+
imageBytes += attachment.bytes;
|
|
128
147
|
attached.push(display);
|
|
129
148
|
}
|
|
130
|
-
catch {
|
|
149
|
+
catch (error) {
|
|
131
150
|
missing.push(display);
|
|
151
|
+
if (error instanceof ImageAdmissionError)
|
|
152
|
+
imageFailures.push({ path: display, reason: error.message });
|
|
132
153
|
}
|
|
133
154
|
continue;
|
|
134
155
|
}
|
|
@@ -196,5 +217,5 @@ export async function expandComposerMentions(fs, cwd, text, attachments, stagedI
|
|
|
196
217
|
// Absent (stat → undefined) or a special file.
|
|
197
218
|
missing.push(display);
|
|
198
219
|
}
|
|
199
|
-
return { blocks, attached, missing };
|
|
220
|
+
return { blocks, attached, missing, ...(imageAdjustments.length === 0 ? {} : { imageAdjustments }), ...(imageFailures.length === 0 ? {} : { imageFailures }) };
|
|
200
221
|
}
|
|
@@ -21,6 +21,6 @@ export declare function createContextBookkeeping(state: () => {
|
|
|
21
21
|
text: string;
|
|
22
22
|
images?: readonly ComposerImageRef[];
|
|
23
23
|
}, placement: PendingMessage["placement"]) => void;
|
|
24
|
-
untrackPending: (messageId: string) => void;
|
|
24
|
+
untrackPending: (messageId: string, hold?: boolean) => void;
|
|
25
25
|
};
|
|
26
26
|
//# sourceMappingURL=context-bookkeeping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-bookkeeping.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/context-bookkeeping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,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AE,aAAa,cAAc,CAAC,WAAW,CAAC,KAAG,IAAI;gCAO7G,MAAM,qBAAiB,IAAI;EAU/D"}
|
|
@@ -24,12 +24,16 @@ export function createContextBookkeeping(state, notify, lowContextText, warningB
|
|
|
24
24
|
channel.pending = [...channel.pending, { id: message.id, text: message.text, images: message.images ?? [], placement }];
|
|
25
25
|
channel.emit();
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
/** Drop the preview of a message the backend never took; `hold` keeps it
|
|
28
|
+
* instead as a held, undelivered dock row (a refusal must not lose it). */
|
|
29
|
+
const untrackPending = (messageId, hold = false) => {
|
|
28
30
|
const channel = state();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
channel.
|
|
31
|
+
if (!channel.pending.some(item => item.id === messageId))
|
|
32
|
+
return;
|
|
33
|
+
channel.pending = hold
|
|
34
|
+
? channel.pending.map(item => item.id === messageId ? { ...item, docked: true, orphaned: true } : item)
|
|
35
|
+
: channel.pending.filter(item => item.id !== messageId);
|
|
36
|
+
channel.emit();
|
|
33
37
|
};
|
|
34
38
|
const resetContextWarning = () => { warning.value = false; };
|
|
35
39
|
return { warning, resetContextWarning, checkContextWarning, trackPending, untrackPending };
|
|
@@ -22,7 +22,7 @@ import type { ChannelState } from '../types.js';
|
|
|
22
22
|
export declare function createCapabilityDelegates(deps: {
|
|
23
23
|
owner: Pick<ChannelOwner, 'current'>;
|
|
24
24
|
session(): AgentSession;
|
|
25
|
-
state: () => Pick<ChannelState, 'provider' | 'model' | 'backendCapabilities'>;
|
|
25
|
+
state: () => Pick<ChannelState, 'provider' | 'model' | 'backendCapabilities' | 'emit'>;
|
|
26
26
|
notify: ChannelState['notify'];
|
|
27
27
|
unavailable(name: string): void;
|
|
28
28
|
unavailableLines(name: string): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/actions.ts"],"names":[],"mappings":"AAAA;;;;;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gB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACxC,UAAU,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAC3C,IAAI,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;IACrC,SAAS,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,SAAS,CAAA;CACvD,EACD,OAAO,UAAQ,GACd,IAAI,CAON"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { conversationRecapPrompt, parseRecapResponse, sideQuestionPrompt } from '../../../channel/side-prompts.js';
|
|
2
2
|
import { t } from '../../../i18n.js';
|
|
3
|
+
import { nearestLowerEffort } from '../../../effortPrefs.js';
|
|
3
4
|
import { createUnavailableActionDelegates } from '../action-readiness.js';
|
|
4
5
|
export function createCapabilityDelegates(deps) {
|
|
5
6
|
const { notify, unavailable, guarded } = deps;
|
|
@@ -31,14 +32,18 @@ export function createCapabilityDelegates(deps) {
|
|
|
31
32
|
await modes.set(list[(index + 1) % list.length].id);
|
|
32
33
|
}),
|
|
33
34
|
listModels: () => guarded('model', [], async () => {
|
|
34
|
-
const
|
|
35
|
+
const session = deps.session();
|
|
36
|
+
const models = session.capabilities.models;
|
|
35
37
|
if (models === undefined) {
|
|
36
38
|
unavailable('model');
|
|
37
39
|
return [];
|
|
38
40
|
}
|
|
39
41
|
// One provider: the backend itself; `/model <id>` needs no provider segment.
|
|
40
42
|
const provider = deps.state().provider;
|
|
41
|
-
|
|
43
|
+
const list = await models.list();
|
|
44
|
+
if (deps.owner.current() && deps.session() === session)
|
|
45
|
+
deps.state().emit();
|
|
46
|
+
return list.map(model => ({ provider: model.provider ?? provider, id: model.id, name: model.label, ...(model.description === undefined ? {} : { description: model.description }) }));
|
|
42
47
|
}),
|
|
43
48
|
switchModel: (provider, model) => guarded('model', false, async () => {
|
|
44
49
|
const models = caps().models;
|
|
@@ -82,6 +87,22 @@ export function createCapabilityDelegates(deps) {
|
|
|
82
87
|
// the slider can say so instead of presenting them as the model's tiers.
|
|
83
88
|
return Promise.resolve({ efforts: levels.map(level => ({ id: level.id, name: level.label })), defaultEffort: effort.current(), ...(effort.levelsFallback === true ? { levelsFallback: true } : {}) });
|
|
84
89
|
},
|
|
90
|
+
setDefaultEffort: id => {
|
|
91
|
+
const effort = caps().effort;
|
|
92
|
+
if (id !== undefined && effort?.levelsAvailable === false)
|
|
93
|
+
return false;
|
|
94
|
+
void guarded('effort', undefined, async () => {
|
|
95
|
+
if (effort === undefined)
|
|
96
|
+
return;
|
|
97
|
+
const applied = id === undefined ? undefined : nearestLowerEffort(id, effort.levels().map(level => level.id));
|
|
98
|
+
await effort.set(applied ?? null);
|
|
99
|
+
if (!deps.owner.current() || id === undefined || applied === id)
|
|
100
|
+
return;
|
|
101
|
+
notify(applied === undefined
|
|
102
|
+
? t('effort-preference-unsupported', { preferred: id })
|
|
103
|
+
: t('effort-preference-downgraded', { preferred: id, applied }), { color: 'warning' });
|
|
104
|
+
});
|
|
105
|
+
},
|
|
85
106
|
setEffort: id => guarded('effort', false, async () => {
|
|
86
107
|
const effort = caps().effort;
|
|
87
108
|
if (effort === undefined || !effort.levels().some(level => level.id === id)) {
|
|
@@ -70,11 +70,14 @@ export declare function createSessionBatchRouter(deps: {
|
|
|
70
70
|
onReset?(event: AgentEventOf<'session.reset'>): void;
|
|
71
71
|
ownsCompactionProgress?(): boolean;
|
|
72
72
|
warn(message: string): void;
|
|
73
|
+
/** Tell the user about inputs held for them; absent = held silently. */
|
|
74
|
+
notify?: ChannelProjectionDeps['notify'];
|
|
73
75
|
taskCompletion?: ReturnType<typeof createTaskCompletion>;
|
|
74
76
|
}): {
|
|
75
77
|
route: (batch: readonly AgentEvent[], meta: AgentEventMeta, current: () => boolean) => void;
|
|
76
78
|
reconcileRetiredProjection: (status: "idle" | "disposed") => void;
|
|
77
79
|
turnStarts: () => number;
|
|
80
|
+
turnEnds: () => number;
|
|
78
81
|
};
|
|
79
82
|
/**
|
|
80
83
|
* The bind that follows the bound session: shared by the channel feed below
|
|
@@ -90,6 +93,8 @@ export declare function createSessionBinder(deps: {
|
|
|
90
93
|
/** Forget the core's trajectory fold before the seed replay paints (a
|
|
91
94
|
* session swap starts an empty raw-event log, exactly like the rows). */
|
|
92
95
|
resetTrajectory?(): void;
|
|
96
|
+
/** The binding generation just changed (a session swap). */
|
|
97
|
+
rebound?(): void;
|
|
93
98
|
/** The stores a session's prompts park in (`ChannelLaunchOptions.interaction`). */
|
|
94
99
|
interaction?: ChannelLaunchOptions['interaction'];
|
|
95
100
|
/** The session-level facts kept unless the extension owns them. */
|
|
@@ -121,6 +126,8 @@ export declare function createBindingFeed(ctx: {
|
|
|
121
126
|
onReset?(event: AgentEventOf<'session.reset'>): void;
|
|
122
127
|
/** Passed to the binder: resets the core trajectory fold per bind. */
|
|
123
128
|
resetTrajectory?(): void;
|
|
129
|
+
/** Passed to the binder: the binding generation just changed. */
|
|
130
|
+
rebound?(): void;
|
|
124
131
|
}): {
|
|
125
132
|
projector: {
|
|
126
133
|
apply: (events: readonly AgentEvent[], meta: AgentEventMeta) => void;
|
|
@@ -142,8 +149,10 @@ export declare function createBindingFeed(ctx: {
|
|
|
142
149
|
route: (batch: readonly AgentEvent[], meta: AgentEventMeta, current: () => boolean) => void;
|
|
143
150
|
reconcileRetiredProjection: (status: "idle" | "disposed") => void;
|
|
144
151
|
turnStarts: () => number;
|
|
152
|
+
turnEnds: () => number;
|
|
145
153
|
};
|
|
146
|
-
|
|
154
|
+
liveTurnEnds: () => number;
|
|
155
|
+
bind(seed?: readonly AgentEvent[]): void;
|
|
147
156
|
resetProjection: () => void;
|
|
148
157
|
/** Install the backend's job-registry feed and pricing policy (before start). */
|
|
149
158
|
configureProjection(update: Partial<Pick<ChannelProjectionDeps, "jobs" | "pricingWindow">>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding-feed.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/binding-feed.ts"],"names":[],"mappings":"AAA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