@deepseek-harness-tui/dsh-tui 0.8.0 → 0.8.2
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 +32 -15
- package/cordis.patch.yml +21 -2
- package/cordis.yml +12 -1
- package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -0
- package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -0
- package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -0
- package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -0
- package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -0
- package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -0
- package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -0
- package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -0
- package/dsh-ecosystem-spec/registry/README.md +14 -0
- package/dsh-ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/scene-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/settings-section-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/tui-channel-v1alpha1.json +30 -0
- package/dsh-ecosystem-spec/registry/contracts/workspace-provider-v1alpha1.json +6 -0
- package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
- package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -0
- package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -0
- package/dsh-ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
- package/dsh-ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
- package/dsh-ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
- package/lib/types/cc/figures.d.ts +4 -0
- package/lib/types/cc/figures.d.ts.map +1 -1
- package/lib/types/cc/figures.js +4 -0
- package/lib/types/command-trees.d.ts +2 -1
- package/lib/types/command-trees.d.ts.map +1 -1
- package/lib/types/command-trees.js +1 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +2 -0
- package/lib/types/components/ExtensionDialog.d.ts +40 -0
- package/lib/types/components/ExtensionDialog.d.ts.map +1 -0
- package/lib/types/components/ExtensionDialog.js +210 -0
- package/lib/types/components/HelpMenu.js +1 -1
- package/lib/types/components/LoadedContextPanel.d.ts +5 -5
- package/lib/types/components/LoadedContextPanel.js +6 -6
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +16 -8
- package/lib/types/components/Markdown.d.ts +13 -1
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +15 -1
- package/lib/types/components/MessageList.d.ts +3 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +111 -6
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +26 -12
- package/lib/types/components/RewindPicker.d.ts +13 -1
- package/lib/types/components/RewindPicker.d.ts.map +1 -1
- package/lib/types/components/RewindPicker.js +26 -2
- package/lib/types/components/StreamingMarkdown.d.ts +2 -8
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
- package/lib/types/components/StreamingMarkdown.js +51 -9
- package/lib/types/components/ToolUseLoader.d.ts +8 -3
- package/lib/types/components/ToolUseLoader.d.ts.map +1 -1
- package/lib/types/components/ToolUseLoader.js +43 -9
- package/lib/types/components/activityFrames.d.ts +1 -1
- package/lib/types/components/activityFrames.d.ts.map +1 -1
- package/lib/types/components/activityFrames.js +4 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +5 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +26 -3
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +13 -2
- package/lib/types/dsh-adapter/channel.d.ts +61 -11
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +767 -120
- package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -1
- package/lib/types/dsh-adapter/childStderr.js +10 -0
- package/lib/types/dsh-adapter/command-attribution.d.ts +51 -0
- package/lib/types/dsh-adapter/command-attribution.d.ts.map +1 -0
- package/lib/types/dsh-adapter/command-attribution.js +93 -0
- package/lib/types/dsh-adapter/command-errors.d.ts +42 -0
- package/lib/types/dsh-adapter/command-errors.d.ts.map +1 -0
- package/lib/types/dsh-adapter/command-errors.js +63 -0
- package/lib/types/dsh-adapter/command-trees.d.ts +7 -1
- package/lib/types/dsh-adapter/command-trees.d.ts.map +1 -1
- package/lib/types/dsh-adapter/command-trees.js +70 -20
- package/lib/types/dsh-adapter/component-identity.d.ts +33 -0
- package/lib/types/dsh-adapter/component-identity.d.ts.map +1 -0
- package/lib/types/dsh-adapter/component-identity.js +108 -0
- package/lib/types/dsh-adapter/contract.d.ts +1 -1
- package/lib/types/dsh-adapter/contract.js +2 -2
- package/lib/types/dsh-adapter/decision-guard.d.ts +84 -0
- package/lib/types/dsh-adapter/decision-guard.d.ts.map +1 -0
- package/lib/types/dsh-adapter/decision-guard.js +348 -0
- package/lib/types/dsh-adapter/dialogs.d.ts +145 -0
- package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
- package/lib/types/dsh-adapter/dialogs.js +316 -0
- package/lib/types/dsh-adapter/effect-ledger.d.ts +91 -0
- package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
- package/lib/types/dsh-adapter/effect-ledger.js +251 -0
- package/lib/types/dsh-adapter/extension-events.d.ts +193 -0
- package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -0
- package/lib/types/dsh-adapter/extension-events.js +207 -0
- package/lib/types/dsh-adapter/extensions.d.ts +32 -0
- package/lib/types/dsh-adapter/extensions.d.ts.map +1 -0
- package/lib/types/dsh-adapter/extensions.js +42 -0
- package/lib/types/dsh-adapter/grants.d.ts +25 -0
- package/lib/types/dsh-adapter/grants.d.ts.map +1 -0
- package/lib/types/dsh-adapter/grants.js +213 -0
- package/lib/types/dsh-adapter/host-access.d.ts +37 -0
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -0
- package/lib/types/dsh-adapter/host-access.js +652 -0
- package/lib/types/dsh-adapter/host-descriptor.d.ts +24 -0
- package/lib/types/dsh-adapter/host-descriptor.d.ts.map +1 -0
- package/lib/types/dsh-adapter/host-descriptor.js +169 -0
- package/lib/types/dsh-adapter/index.d.ts +4 -0
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +1 -0
- package/lib/types/dsh-adapter/message-observer.d.ts +173 -0
- package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
- package/lib/types/dsh-adapter/message-observer.js +553 -0
- package/lib/types/dsh-adapter/plugin-host.d.ts +136 -0
- package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugin-host.js +365 -0
- package/lib/types/dsh-adapter/plugin-storage.d.ts +108 -0
- package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugin-storage.js +397 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +124 -14
- package/lib/types/dsh-adapter/plugins-info.d.ts +43 -0
- package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugins-info.js +276 -0
- package/lib/types/dsh-adapter/promptDebug.d.ts +0 -6
- package/lib/types/dsh-adapter/promptDebug.d.ts.map +1 -1
- package/lib/types/dsh-adapter/promptDebug.js +13 -4
- package/lib/types/dsh-adapter/renderers.d.ts +57 -0
- package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
- package/lib/types/dsh-adapter/renderers.js +173 -0
- package/lib/types/dsh-adapter/sanitize.d.ts +36 -0
- package/lib/types/dsh-adapter/sanitize.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sanitize.js +65 -0
- package/lib/types/dsh-adapter/scenes.d.ts +15 -5
- package/lib/types/dsh-adapter/scenes.d.ts.map +1 -1
- package/lib/types/dsh-adapter/scenes.js +149 -35
- package/lib/types/dsh-adapter/settings-sections.d.ts +7 -3
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +106 -26
- package/lib/types/dsh-adapter/shortcuts.d.ts +107 -0
- package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
- package/lib/types/dsh-adapter/shortcuts.js +340 -0
- package/lib/types/dsh-adapter/status.d.ts +74 -0
- package/lib/types/dsh-adapter/status.d.ts.map +1 -0
- package/lib/types/dsh-adapter/status.js +234 -0
- package/lib/types/dsh-adapter/workspaces.d.ts +16 -5
- package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -1
- package/lib/types/dsh-adapter/workspaces.js +287 -170
- package/lib/types/extensions.d.ts +13 -0
- package/lib/types/extensions.d.ts.map +1 -0
- package/lib/types/extensions.js +21 -0
- package/lib/types/force-production-react.d.ts +1 -0
- package/lib/types/force-production-react.d.ts.map +1 -0
- package/lib/types/force-production-react.js +12 -0
- package/lib/types/i18n.d.ts +174 -20
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +56 -6
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/ink/components/App.d.ts +2 -0
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +4 -0
- package/lib/types/ink/ink.d.ts +31 -3
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +90 -5
- package/lib/types/ink/log-update.d.ts.map +1 -1
- package/lib/types/ink/log-update.js +225 -56
- package/lib/types/ink/output.d.ts +35 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +281 -14
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +14 -6
- package/lib/types/ink/screen.d.ts +39 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +117 -0
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +26 -6
- package/lib/types/ink/wrapAnsi.d.ts +1 -1
- package/lib/types/ink/wrapAnsi.d.ts.map +1 -1
- package/lib/types/ink/wrapAnsi.js +29 -2
- package/lib/types/plugin-host.d.ts +15 -0
- package/lib/types/plugin-host.d.ts.map +1 -0
- package/lib/types/plugin-host.js +17 -0
- package/lib/types/plugin-spec/negotiate.d.ts +11 -0
- package/lib/types/plugin-spec/negotiate.d.ts.map +1 -0
- package/lib/types/plugin-spec/negotiate.js +97 -0
- package/lib/types/plugin-spec/permission-scope.d.ts +32 -0
- package/lib/types/plugin-spec/permission-scope.d.ts.map +1 -0
- package/lib/types/plugin-spec/permission-scope.js +90 -0
- package/lib/types/plugin-spec/registry.d.ts +23 -0
- package/lib/types/plugin-spec/registry.d.ts.map +1 -0
- package/lib/types/plugin-spec/registry.js +252 -0
- package/lib/types/plugin-spec/schema-check.d.ts +17 -0
- package/lib/types/plugin-spec/schema-check.d.ts.map +1 -0
- package/lib/types/plugin-spec/schema-check.js +165 -0
- package/lib/types/plugin-spec/tui-extension.d.ts +16 -0
- package/lib/types/plugin-spec/tui-extension.d.ts.map +1 -0
- package/lib/types/plugin-spec/tui-extension.js +79 -0
- package/lib/types/plugin-spec/types.d.ts +114 -0
- package/lib/types/plugin-spec/types.d.ts.map +1 -0
- package/lib/types/plugin-spec/types.js +10 -0
- package/lib/types/plugin-spec/validate.d.ts +21 -0
- package/lib/types/plugin-spec/validate.d.ts.map +1 -0
- package/lib/types/plugin-spec/validate.js +138 -0
- package/lib/types/scenes.d.ts +2 -1
- package/lib/types/scenes.d.ts.map +1 -1
- package/lib/types/scenes.js +1 -1
- package/lib/types/screens/Chat.d.ts +14 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +173 -49
- package/lib/types/screens/SessionBrowser.d.ts.map +1 -1
- package/lib/types/screens/SessionBrowser.js +10 -3
- package/lib/types/sessions/view.d.ts +3 -2
- package/lib/types/sessions/view.d.ts.map +1 -1
- package/lib/types/sessions/view.js +18 -0
- package/lib/types/settings-sections.d.ts +2 -1
- package/lib/types/settings-sections.d.ts.map +1 -1
- package/lib/types/settings-sections.js +1 -1
- package/lib/types/theme.d.ts +5 -0
- package/lib/types/theme.d.ts.map +1 -1
- package/lib/types/theme.js +15 -0
- package/lib/types/update.d.ts +20 -0
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +54 -7
- package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
- package/lib/types/utils/execFileNoThrow.js +3 -0
- package/lib/types/utils/loaded-context.d.ts +8 -3
- package/lib/types/utils/loaded-context.d.ts.map +1 -1
- package/lib/types/utils/loaded-context.js +39 -3
- package/lib/types/utils/modifiers.d.ts.map +1 -1
- package/lib/types/utils/modifiers.js +3 -2
- package/lib/types/working-activity.d.ts +12 -0
- package/lib/types/working-activity.d.ts.map +1 -1
- package/lib/types/working-activity.js +13 -0
- package/lib/types/workspaces.d.ts +2 -1
- package/lib/types/workspaces.d.ts.map +1 -1
- package/lib/types/workspaces.js +1 -1
- package/node_modules/@dsh-std/command/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/command/LICENSE +21 -0
- package/node_modules/@dsh-std/command/README.md +26 -0
- package/node_modules/@dsh-std/command/README.zh.md +28 -0
- package/node_modules/@dsh-std/command/lib/index.d.ts +144 -0
- package/node_modules/@dsh-std/command/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/command/lib/index.js +252 -0
- package/node_modules/@dsh-std/command/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/command/package.json +22 -0
- package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/node_modules/@dsh-std/connection/README.md +42 -0
- package/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/node_modules/@dsh-std/connection/package.json +20 -0
- package/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/core/LICENSE +21 -0
- package/node_modules/@dsh-std/core/README.md +13 -0
- package/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/core/package.json +21 -0
- package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
- package/node_modules/@dsh-std/manifest/LICENSE +21 -0
- package/node_modules/@dsh-std/manifest/README.md +5 -0
- package/node_modules/@dsh-std/manifest/README.zh.md +5 -0
- package/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
- package/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/manifest/lib/index.js +625 -0
- package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/manifest/package.json +20 -0
- package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
- package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/messages/LICENSE +21 -0
- package/node_modules/@dsh-std/messages/README.md +5 -0
- package/node_modules/@dsh-std/messages/README.zh.md +7 -0
- package/node_modules/@dsh-std/messages/lib/index.d.ts +50 -0
- package/node_modules/@dsh-std/messages/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/messages/lib/index.js +151 -0
- package/node_modules/@dsh-std/messages/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/messages/package.json +20 -0
- package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -0
- package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
- package/node_modules/@dsh-std/presentation/LICENSE +21 -0
- package/node_modules/@dsh-std/presentation/README.md +27 -0
- package/node_modules/@dsh-std/presentation/README.zh.md +29 -0
- package/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
- package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
- package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/index.js +550 -0
- package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
- package/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
- package/node_modules/@dsh-std/presentation/package.json +25 -0
- package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/storage/LICENSE +21 -0
- package/node_modules/@dsh-std/storage/README.md +5 -0
- package/node_modules/@dsh-std/storage/README.zh.md +7 -0
- package/node_modules/@dsh-std/storage/lib/index.d.ts +48 -0
- package/node_modules/@dsh-std/storage/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/storage/lib/index.js +104 -0
- package/node_modules/@dsh-std/storage/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/storage/package.json +20 -0
- package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -0
- package/package.json +110 -70
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js +625 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js +550 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision-point events the TUI fires on the cordis bus so plugins can
|
|
3
|
+
* intercept, cancel, or customize interactive flows — the `session_before_*`
|
|
4
|
+
* style seam (pi's `session_before_fork` / `input` events) expressed in
|
|
5
|
+
* cordis dispatch semantics.
|
|
6
|
+
*
|
|
7
|
+
* All of these are FIRED BY THE CHANNEL and answered by admitted Components
|
|
8
|
+
* through the host-mediated DecisionEvents registry. No extra service row is
|
|
9
|
+
* involved: an absent handler simply means "no opinion", and the built-in
|
|
10
|
+
* flow proceeds unchanged. Dispatch is SERIAL in the registry's stable order
|
|
11
|
+
* with the first VALID decision winning — see {@link dispatchTuiDecision} for
|
|
12
|
+
* why this is not raw `ctx.serial`: per-handler crash isolation, deadlines and
|
|
13
|
+
* return-value normalization mean a broken or malformed handler can never
|
|
14
|
+
* skip a later (possibly safety) veto.
|
|
15
|
+
*
|
|
16
|
+
* Synchronous-only rule: handlers may be async, but while a decision is
|
|
17
|
+
* awaited the originating UI flow is parked (the submit is not delivered,
|
|
18
|
+
* the rewind confirm has not happened). Handlers that need user input should
|
|
19
|
+
* use the managed dialogs (`ctx.tuiDialogs`) or open a scene, then resolve.
|
|
20
|
+
*/
|
|
21
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
22
|
+
/** Explicit budgets from the DecisionEvents profile. A timed-out handler is
|
|
23
|
+
* treated as no-opinion and the chain continues; once the total budget is
|
|
24
|
+
* exhausted the remaining handlers are skipped with the same policy. */
|
|
25
|
+
export declare const DECISION_HANDLER_TIMEOUT_MS = 1000;
|
|
26
|
+
export declare const DECISION_TOTAL_TIMEOUT_MS = 5000;
|
|
27
|
+
/**
|
|
28
|
+
* Dispatch a decision event listener-by-listener in the host's stable order.
|
|
29
|
+
*
|
|
30
|
+
* Deliberately NOT `ctx.serial`: cordis bails at ANY non-null/false/undefined
|
|
31
|
+
* return, so a malformed-but-object decision (a blank `{ text }` rewrite, a
|
|
32
|
+
* junk primitive) would cut the chain before a later veto listener runs —
|
|
33
|
+
* and one throwing listener rejects the whole dispatch, skipping every later
|
|
34
|
+
* listener. Here:
|
|
35
|
+
*
|
|
36
|
+
* - a throwing listener is logged and the chain CONTINUES;
|
|
37
|
+
* - each return value passes through `normalize` (per-event validation)
|
|
38
|
+
* INSIDE the same isolation boundary — a Proxy/throwing-getter return is
|
|
39
|
+
* logged and skipped like any other invalid shape;
|
|
40
|
+
* - "no opinion" (undefined/null/false) and invalid shapes are logged and
|
|
41
|
+
* the chain CONTINUES;
|
|
42
|
+
* - the first listener whose NORMALIZED decision is non-undefined wins.
|
|
43
|
+
*
|
|
44
|
+
* Handlers come from the host-mediated DecisionEvents registry. Raw Cordis
|
|
45
|
+
* `ctx.on` listeners are intentionally absent from this path.
|
|
46
|
+
*/
|
|
47
|
+
export declare function dispatchTuiDecision<T>(ctx: Context, name: string, payload: Record<string, unknown>, normalize: (result: unknown, warn: (what: string) => void) => T | undefined): Promise<T | undefined>;
|
|
48
|
+
/** Fire a non-veto DecisionEvents point with the same bounded, isolated
|
|
49
|
+
* semantics. Notifications deliberately ignore every return value. */
|
|
50
|
+
export declare function dispatchTuiNotification(ctx: Context, name: string, payload: Record<string, unknown>): Promise<void>;
|
|
51
|
+
/** Shared normalizer for the veto-only decisions (session-switch, compact):
|
|
52
|
+
* `{ cancel: true, reason? }` or no opinion; everything else is ignored.
|
|
53
|
+
* The reason is toast-bound plugin text — sanitized (a veto must not
|
|
54
|
+
* smuggle control sequences onto the screen). */
|
|
55
|
+
export declare function normalizeCancelDecision(result: unknown, warn: (what: string) => void): {
|
|
56
|
+
cancel: true;
|
|
57
|
+
reason?: string;
|
|
58
|
+
} | undefined;
|
|
59
|
+
/** Shared context every decision event carries. */
|
|
60
|
+
export interface TuiDecisionContext {
|
|
61
|
+
/** The live session (agent) id the flow belongs to. */
|
|
62
|
+
sessionId: string;
|
|
63
|
+
/** Working directory of the session. */
|
|
64
|
+
cwd: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Fired before user-typed text is delivered to the model (`submit` and
|
|
68
|
+
* `steer`; local `!`/`!!` shell lines never fire it — they are not model
|
|
69
|
+
* input). The message is NOT yet in the session log; nothing is observable
|
|
70
|
+
* from the transcript at this point.
|
|
71
|
+
*/
|
|
72
|
+
export interface TuiInputEvent extends TuiDecisionContext {
|
|
73
|
+
/** The trimmed text as typed. */
|
|
74
|
+
text: string;
|
|
75
|
+
/** Where the text would go: a new turn (`followup`) or the running one. */
|
|
76
|
+
delivery: 'followup' | 'steer';
|
|
77
|
+
}
|
|
78
|
+
export type TuiInputDecision =
|
|
79
|
+
/** Replace the text; the substitute is delivered instead. */
|
|
80
|
+
{
|
|
81
|
+
text: string;
|
|
82
|
+
}
|
|
83
|
+
/** The plugin consumed the input itself; nothing is delivered. An optional
|
|
84
|
+
* notice is toasted so the user is not left wondering where the line went. */
|
|
85
|
+
| {
|
|
86
|
+
handled: true;
|
|
87
|
+
notice?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Drop the input; an optional reason is toasted as a warning. */
|
|
90
|
+
| {
|
|
91
|
+
cancel: true;
|
|
92
|
+
reason?: string;
|
|
93
|
+
}
|
|
94
|
+
/** No opinion — delivery proceeds unchanged. */
|
|
95
|
+
| undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Fired when the rewind picker confirms a message, BEFORE the fork happens.
|
|
98
|
+
* `seq` is the session event seq of the picked user message (the fork itself
|
|
99
|
+
* lands just before its turn — see channel.rewindTo).
|
|
100
|
+
*/
|
|
101
|
+
export interface TuiRewindPromptEvent extends TuiDecisionContext {
|
|
102
|
+
/** Text of the picked message. */
|
|
103
|
+
text: string;
|
|
104
|
+
/** Session event seq of the picked message. */
|
|
105
|
+
seq: number;
|
|
106
|
+
}
|
|
107
|
+
/** One extra rewind mode offered by a plugin (e.g. "also restore files"). */
|
|
108
|
+
export interface TuiRewindMode {
|
|
109
|
+
/** Stable id reported back in `TuiRewindDoneEvent.mode`. */
|
|
110
|
+
id: string;
|
|
111
|
+
/** One-line label shown in the confirm pane. */
|
|
112
|
+
label: string;
|
|
113
|
+
/** Optional dimmed description under the label. */
|
|
114
|
+
description?: string;
|
|
115
|
+
}
|
|
116
|
+
export type TuiRewindPromptDecision =
|
|
117
|
+
/** Abort the rewind; the picker stays open. Optional reason is toasted. */
|
|
118
|
+
{
|
|
119
|
+
cancel: true;
|
|
120
|
+
reason?: string;
|
|
121
|
+
}
|
|
122
|
+
/** Extra choices rendered in the confirm pane on top of the built-in
|
|
123
|
+
* conversation-only rewind (which stays option zero). */
|
|
124
|
+
| {
|
|
125
|
+
modes: readonly TuiRewindMode[];
|
|
126
|
+
}
|
|
127
|
+
/** No opinion — the plain confirm pane shows, exactly as before. */
|
|
128
|
+
| undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Fired after a rewind completed: the forked session is live and the
|
|
131
|
+
* transcript replayed. The first listener returning a non-empty string has
|
|
132
|
+
* it toasted as the post-rewind summary (serial bail semantics).
|
|
133
|
+
*/
|
|
134
|
+
export interface TuiRewindDoneEvent extends TuiDecisionContext {
|
|
135
|
+
/** Text of the message that was rewound to (back in the input). */
|
|
136
|
+
text: string;
|
|
137
|
+
/** The mode id the user picked, or null for the built-in
|
|
138
|
+
* conversation-only rewind. */
|
|
139
|
+
mode: string | null;
|
|
140
|
+
/** Inclusive source seq the fork cut at (the child's seed end). */
|
|
141
|
+
boundarySeq: number;
|
|
142
|
+
/** The session that was forked away from. */
|
|
143
|
+
sourceSessionId: string;
|
|
144
|
+
/** The freshly created fork session — now the live one. */
|
|
145
|
+
childSessionId: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Fired before the live session is replaced (`/new` or `/resume`; rewind has
|
|
149
|
+
* its own prompt event above). `targetSessionId` is set for resume only.
|
|
150
|
+
*/
|
|
151
|
+
export interface TuiSessionSwitchEvent extends TuiDecisionContext {
|
|
152
|
+
kind: 'new' | 'resume';
|
|
153
|
+
targetSessionId?: string;
|
|
154
|
+
}
|
|
155
|
+
export type TuiSessionSwitchDecision =
|
|
156
|
+
/** Abort the switch; the current session stays live. Optional reason is
|
|
157
|
+
* toasted as a warning. */
|
|
158
|
+
{
|
|
159
|
+
cancel: true;
|
|
160
|
+
reason?: string;
|
|
161
|
+
} | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Notification (parallel, fire-and-forget) after the live session changed.
|
|
164
|
+
* Listener errors are logged, never propagated. Rebind per-session state
|
|
165
|
+
* here; `previousSessionId` is undefined only when there was nothing live
|
|
166
|
+
* before (not currently produced — every switch has a live source).
|
|
167
|
+
*/
|
|
168
|
+
export interface TuiSessionSwitchedEvent extends TuiDecisionContext {
|
|
169
|
+
kind: 'new' | 'resume' | 'rewind';
|
|
170
|
+
/** The session that just went live. */
|
|
171
|
+
sessionId: string;
|
|
172
|
+
previousSessionId?: string;
|
|
173
|
+
}
|
|
174
|
+
/** Fired before manual `/compact` runs. */
|
|
175
|
+
export interface TuiCompactEvent extends TuiDecisionContext {
|
|
176
|
+
}
|
|
177
|
+
export type TuiCompactDecision =
|
|
178
|
+
/** Abort the compaction; optional reason is toasted as a warning. */
|
|
179
|
+
{
|
|
180
|
+
cancel: true;
|
|
181
|
+
reason?: string;
|
|
182
|
+
} | undefined;
|
|
183
|
+
declare module '@deepseek-ai/cordis' {
|
|
184
|
+
interface Events {
|
|
185
|
+
'tui/input'(event: TuiInputEvent): TuiInputDecision | Promise<TuiInputDecision>;
|
|
186
|
+
'tui/rewind-prompt'(event: TuiRewindPromptEvent): TuiRewindPromptDecision | Promise<TuiRewindPromptDecision>;
|
|
187
|
+
'tui/rewind-done'(event: TuiRewindDoneEvent): string | undefined | Promise<string | undefined>;
|
|
188
|
+
'tui/session-switch'(event: TuiSessionSwitchEvent): TuiSessionSwitchDecision | Promise<TuiSessionSwitchDecision>;
|
|
189
|
+
'tui/session-switched'(event: TuiSessionSwitchedEvent): void | Promise<void>;
|
|
190
|
+
'tui/compact'(event: TuiCompactEvent): TuiCompactDecision | Promise<TuiCompactDecision>;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=extension-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-events.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/extension-events.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision-point events the TUI fires on the cordis bus so plugins can
|
|
3
|
+
* intercept, cancel, or customize interactive flows — the `session_before_*`
|
|
4
|
+
* style seam (pi's `session_before_fork` / `input` events) expressed in
|
|
5
|
+
* cordis dispatch semantics.
|
|
6
|
+
*
|
|
7
|
+
* All of these are FIRED BY THE CHANNEL and answered by admitted Components
|
|
8
|
+
* through the host-mediated DecisionEvents registry. No extra service row is
|
|
9
|
+
* involved: an absent handler simply means "no opinion", and the built-in
|
|
10
|
+
* flow proceeds unchanged. Dispatch is SERIAL in the registry's stable order
|
|
11
|
+
* with the first VALID decision winning — see {@link dispatchTuiDecision} for
|
|
12
|
+
* why this is not raw `ctx.serial`: per-handler crash isolation, deadlines and
|
|
13
|
+
* return-value normalization mean a broken or malformed handler can never
|
|
14
|
+
* skip a later (possibly safety) veto.
|
|
15
|
+
*
|
|
16
|
+
* Synchronous-only rule: handlers may be async, but while a decision is
|
|
17
|
+
* awaited the originating UI flow is parked (the submit is not delivered,
|
|
18
|
+
* the rewind confirm has not happened). Handlers that need user input should
|
|
19
|
+
* use the managed dialogs (`ctx.tuiDialogs`) or open a scene, then resolve.
|
|
20
|
+
*/
|
|
21
|
+
import { cleanScalarText } from './sanitize.js';
|
|
22
|
+
import { DECISION_EVENT_PERMISSIONS, decisionHandlersOf, decisionRegistryOf, } from './decision-guard.js';
|
|
23
|
+
/** Toast-bound plugin text (veto reasons) is render-path data: sanitized
|
|
24
|
+
* with the one shared implementation, capped at toast width. */
|
|
25
|
+
const NOTICE_CELLS = 200;
|
|
26
|
+
/** Explicit budgets from the DecisionEvents profile. A timed-out handler is
|
|
27
|
+
* treated as no-opinion and the chain continues; once the total budget is
|
|
28
|
+
* exhausted the remaining handlers are skipped with the same policy. */
|
|
29
|
+
export const DECISION_HANDLER_TIMEOUT_MS = 1000;
|
|
30
|
+
export const DECISION_TOTAL_TIMEOUT_MS = 5000;
|
|
31
|
+
function freezeClone(value) {
|
|
32
|
+
const seen = new WeakSet();
|
|
33
|
+
const freeze = (current) => {
|
|
34
|
+
if (current === null || typeof current !== 'object' || Object.isFrozen(current))
|
|
35
|
+
return current;
|
|
36
|
+
if (seen.has(current))
|
|
37
|
+
return current;
|
|
38
|
+
seen.add(current);
|
|
39
|
+
for (const child of Object.values(current))
|
|
40
|
+
freeze(child);
|
|
41
|
+
return Object.freeze(current);
|
|
42
|
+
};
|
|
43
|
+
let copy;
|
|
44
|
+
try {
|
|
45
|
+
copy = structuredClone(value);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// Decision payloads are host-created records. Keep a defensive fallback
|
|
49
|
+
// for degraded embedders rather than handing a shared object to a plugin.
|
|
50
|
+
copy = JSON.parse(JSON.stringify(value));
|
|
51
|
+
}
|
|
52
|
+
return freeze(copy);
|
|
53
|
+
}
|
|
54
|
+
async function runBounded(task, timeoutMs) {
|
|
55
|
+
let timer;
|
|
56
|
+
const work = Promise.resolve()
|
|
57
|
+
.then(task)
|
|
58
|
+
.then(value => ({ kind: 'value', value }), error => ({ kind: 'error', error }));
|
|
59
|
+
const timeout = new Promise(resolve => {
|
|
60
|
+
timer = setTimeout(() => resolve({ kind: 'timeout' }), timeoutMs);
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
return await Promise.race([work, timeout]);
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
if (timer !== undefined)
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
// `work` has rejection handlers attached above, so a promise that settles
|
|
69
|
+
// after a timeout cannot become an unhandled rejection.
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Dispatch a decision event listener-by-listener in the host's stable order.
|
|
74
|
+
*
|
|
75
|
+
* Deliberately NOT `ctx.serial`: cordis bails at ANY non-null/false/undefined
|
|
76
|
+
* return, so a malformed-but-object decision (a blank `{ text }` rewrite, a
|
|
77
|
+
* junk primitive) would cut the chain before a later veto listener runs —
|
|
78
|
+
* and one throwing listener rejects the whole dispatch, skipping every later
|
|
79
|
+
* listener. Here:
|
|
80
|
+
*
|
|
81
|
+
* - a throwing listener is logged and the chain CONTINUES;
|
|
82
|
+
* - each return value passes through `normalize` (per-event validation)
|
|
83
|
+
* INSIDE the same isolation boundary — a Proxy/throwing-getter return is
|
|
84
|
+
* logged and skipped like any other invalid shape;
|
|
85
|
+
* - "no opinion" (undefined/null/false) and invalid shapes are logged and
|
|
86
|
+
* the chain CONTINUES;
|
|
87
|
+
* - the first listener whose NORMALIZED decision is non-undefined wins.
|
|
88
|
+
*
|
|
89
|
+
* Handlers come from the host-mediated DecisionEvents registry. Raw Cordis
|
|
90
|
+
* `ctx.on` listeners are intentionally absent from this path.
|
|
91
|
+
*/
|
|
92
|
+
export async function dispatchTuiDecision(ctx, name, payload, normalize) {
|
|
93
|
+
const sessionId = typeof payload.sessionId === 'string' ? payload.sessionId : undefined;
|
|
94
|
+
const scope = sessionId === undefined ? undefined : `session:${sessionId}`;
|
|
95
|
+
const listeners = decisionHandlersOf(ctx, name, scope);
|
|
96
|
+
const log = (message, error) => {
|
|
97
|
+
try {
|
|
98
|
+
if (error === undefined)
|
|
99
|
+
ctx.logger.warn(message);
|
|
100
|
+
else
|
|
101
|
+
ctx.logger.warn(message, error);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// Degraded ctx without a logger: warnings are best-effort.
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const started = Date.now();
|
|
108
|
+
for (const handler of listeners) {
|
|
109
|
+
const permission = DECISION_EVENT_PERMISSIONS[name];
|
|
110
|
+
const principal = { componentId: handler.componentId, activationId: handler.activationId };
|
|
111
|
+
if (permission !== undefined
|
|
112
|
+
// Re-check the handler's declared scope at the concrete payload scope.
|
|
113
|
+
// GrantStore applies parent-scope grants and narrow deny precedence, so
|
|
114
|
+
// an event-wide grant cannot bypass a revoked session.
|
|
115
|
+
&& !decisionRegistryOf(ctx).grants.allows(principal, permission, scope ?? handler.scope)) {
|
|
116
|
+
log(`dsh-tui: ${name} handler from Component "${handler.componentId}" skipped after grant revocation`);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const remaining = DECISION_TOTAL_TIMEOUT_MS - (Date.now() - started);
|
|
120
|
+
if (remaining <= 0) {
|
|
121
|
+
log(`dsh-tui: ${name} total decision budget exceeded; remaining handlers skipped`);
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
const bounded = await runBounded(() => handler.listener(freezeClone(payload)), Math.min(DECISION_HANDLER_TIMEOUT_MS, remaining));
|
|
125
|
+
if (bounded.kind === 'timeout') {
|
|
126
|
+
log(`dsh-tui: ${name} handler from Component "${handler.componentId}" exceeded ${DECISION_HANDLER_TIMEOUT_MS}ms; continuing`);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (bounded.kind === 'error') {
|
|
130
|
+
log(`dsh-tui: ${name} listener failed; continuing with the next listener: %o`, bounded.error);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const result = bounded.value;
|
|
134
|
+
// normalize runs INSIDE the isolation boundary too: a hostile return
|
|
135
|
+
// value (a Proxy or a throwing getter) must not reject the dispatch —
|
|
136
|
+
// that would cut the chain before later veto listeners run, and leave
|
|
137
|
+
// unhandled rejections at the fire-and-forget call sites.
|
|
138
|
+
let decision;
|
|
139
|
+
try {
|
|
140
|
+
decision = normalize(result, what => log(`dsh-tui: ${name} listener returned ${what}; ignored`));
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
log(`dsh-tui: ${name} listener returned a value that threw during validation; ignored: %o`, error);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (decision !== undefined)
|
|
147
|
+
return decision;
|
|
148
|
+
}
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
/** Fire a non-veto DecisionEvents point with the same bounded, isolated
|
|
152
|
+
* semantics. Notifications deliberately ignore every return value. */
|
|
153
|
+
export async function dispatchTuiNotification(ctx, name, payload) {
|
|
154
|
+
const sessionId = typeof payload.sessionId === 'string' ? payload.sessionId : undefined;
|
|
155
|
+
const scope = sessionId === undefined ? undefined : `session:${sessionId}`;
|
|
156
|
+
const listeners = decisionHandlersOf(ctx, name, scope);
|
|
157
|
+
const log = (message, error) => {
|
|
158
|
+
try {
|
|
159
|
+
if (error === undefined)
|
|
160
|
+
ctx.logger.warn(message);
|
|
161
|
+
else
|
|
162
|
+
ctx.logger.warn(message, error);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Degraded ctx without a logger: warnings are best-effort.
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const started = Date.now();
|
|
169
|
+
// Notifications have no return-value or ordering semantics. Start every
|
|
170
|
+
// listener from the same snapshot so one slow plugin cannot delay another
|
|
171
|
+
// plugin's session rebind (or make a fire-and-forget dispatch look stuck).
|
|
172
|
+
await Promise.all(listeners.map(async (handler) => {
|
|
173
|
+
const permission = DECISION_EVENT_PERMISSIONS[name];
|
|
174
|
+
const principal = { componentId: handler.componentId, activationId: handler.activationId };
|
|
175
|
+
if (permission !== undefined
|
|
176
|
+
&& !decisionRegistryOf(ctx).grants.allows(principal, permission, scope ?? handler.scope)) {
|
|
177
|
+
log(`dsh-tui: ${name} handler from Component "${handler.componentId}" skipped after grant revocation`);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const remaining = DECISION_TOTAL_TIMEOUT_MS - (Date.now() - started);
|
|
181
|
+
if (remaining <= 0) {
|
|
182
|
+
log(`dsh-tui: ${name} total decision budget exceeded; handler skipped`);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const bounded = await runBounded(() => handler.listener(freezeClone(payload)), Math.min(DECISION_HANDLER_TIMEOUT_MS, remaining));
|
|
186
|
+
if (bounded.kind === 'timeout') {
|
|
187
|
+
log(`dsh-tui: ${name} handler from Component "${handler.componentId}" exceeded ${DECISION_HANDLER_TIMEOUT_MS}ms; continuing`);
|
|
188
|
+
}
|
|
189
|
+
else if (bounded.kind === 'error') {
|
|
190
|
+
log(`dsh-tui: ${name} listener failed; continuing with the other listeners: %o`, bounded.error);
|
|
191
|
+
}
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
/** Shared normalizer for the veto-only decisions (session-switch, compact):
|
|
195
|
+
* `{ cancel: true, reason? }` or no opinion; everything else is ignored.
|
|
196
|
+
* The reason is toast-bound plugin text — sanitized (a veto must not
|
|
197
|
+
* smuggle control sequences onto the screen). */
|
|
198
|
+
export function normalizeCancelDecision(result, warn) {
|
|
199
|
+
if (result === undefined || result === null || result === false)
|
|
200
|
+
return undefined;
|
|
201
|
+
if (typeof result === 'object' && result.cancel === true) {
|
|
202
|
+
const reason = cleanScalarText(result.reason, NOTICE_CELLS);
|
|
203
|
+
return { cancel: true, ...(reason === '' ? {} : { reason }) };
|
|
204
|
+
}
|
|
205
|
+
warn('an unrecognized decision shape');
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dsh-tui-extensions row: mounts every plugin-facing UI seam service in
|
|
3
|
+
* one cordis plugin (one profile row, one patch-surface entry — see issue
|
|
4
|
+
* #183 for the cost of row/code skew, and #242 for the entry-level-only
|
|
5
|
+
* inject rule this row follows).
|
|
6
|
+
*
|
|
7
|
+
* Services mounted here (each documented in its own module):
|
|
8
|
+
*
|
|
9
|
+
* - `ctx.tuiDialogs` — managed select/confirm/input dialogs
|
|
10
|
+
* - `ctx.tuiStatus` — keyed status-line contributions
|
|
11
|
+
* - `ctx.tuiShortcuts` — keyboard shortcut registry
|
|
12
|
+
* - `ctx.tuiRenderers` — custom session-entry text renderers
|
|
13
|
+
*
|
|
14
|
+
* The decision-point events (`tui/input`, `tui/rewind-prompt`, …) need no
|
|
15
|
+
* separate service — they are fired by the channel and answered through the
|
|
16
|
+
* host-mediated DecisionEvents registry; their types ride along in this
|
|
17
|
+
* module's public surface (`./extensions` export). The Cordis `ctx.on` hook is
|
|
18
|
+
* only a compatibility facade and cannot bypass admission, scope or grant
|
|
19
|
+
* checks. Intercept-class events require an explicit grant in
|
|
20
|
+
* `~/.dsh-tui/extension-grants.json`, default deny. The channel installs the
|
|
21
|
+
* SAME hook (idempotent per cordis root, so exactly one installation lands):
|
|
22
|
+
* this row covers profiles launching without the channel, and the channel
|
|
23
|
+
* covers the skew path where THIS row is missing.
|
|
24
|
+
*
|
|
25
|
+
* Every consumer (`channel.ts`, `Chat.tsx`) reads these with `ctx.get`
|
|
26
|
+
* softly: without this row the TUI degrades to no dialogs/status/shortcuts/
|
|
27
|
+
* renderers, and plugin.ts logs the skew warning once for profile launches.
|
|
28
|
+
*/
|
|
29
|
+
import { Context } from '@deepseek-ai/cordis';
|
|
30
|
+
export declare const name = "dsh-tui-extensions";
|
|
31
|
+
export declare function apply(ctx: Context): void;
|
|
32
|
+
//# sourceMappingURL=extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAQ7C,eAAO,MAAM,IAAI,uBAAuB,CAAA;AAExC,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAMxC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dsh-tui-extensions row: mounts every plugin-facing UI seam service in
|
|
3
|
+
* one cordis plugin (one profile row, one patch-surface entry — see issue
|
|
4
|
+
* #183 for the cost of row/code skew, and #242 for the entry-level-only
|
|
5
|
+
* inject rule this row follows).
|
|
6
|
+
*
|
|
7
|
+
* Services mounted here (each documented in its own module):
|
|
8
|
+
*
|
|
9
|
+
* - `ctx.tuiDialogs` — managed select/confirm/input dialogs
|
|
10
|
+
* - `ctx.tuiStatus` — keyed status-line contributions
|
|
11
|
+
* - `ctx.tuiShortcuts` — keyboard shortcut registry
|
|
12
|
+
* - `ctx.tuiRenderers` — custom session-entry text renderers
|
|
13
|
+
*
|
|
14
|
+
* The decision-point events (`tui/input`, `tui/rewind-prompt`, …) need no
|
|
15
|
+
* separate service — they are fired by the channel and answered through the
|
|
16
|
+
* host-mediated DecisionEvents registry; their types ride along in this
|
|
17
|
+
* module's public surface (`./extensions` export). The Cordis `ctx.on` hook is
|
|
18
|
+
* only a compatibility facade and cannot bypass admission, scope or grant
|
|
19
|
+
* checks. Intercept-class events require an explicit grant in
|
|
20
|
+
* `~/.dsh-tui/extension-grants.json`, default deny. The channel installs the
|
|
21
|
+
* SAME hook (idempotent per cordis root, so exactly one installation lands):
|
|
22
|
+
* this row covers profiles launching without the channel, and the channel
|
|
23
|
+
* covers the skew path where THIS row is missing.
|
|
24
|
+
*
|
|
25
|
+
* Every consumer (`channel.ts`, `Chat.tsx`) reads these with `ctx.get`
|
|
26
|
+
* softly: without this row the TUI degrades to no dialogs/status/shortcuts/
|
|
27
|
+
* renderers, and plugin.ts logs the skew warning once for profile launches.
|
|
28
|
+
*/
|
|
29
|
+
import TuiDialogRuntime from './dialogs.js';
|
|
30
|
+
import TuiStatusRuntime from './status.js';
|
|
31
|
+
import TuiShortcutRuntime from './shortcuts.js';
|
|
32
|
+
import TuiRendererRuntime from './renderers.js';
|
|
33
|
+
import { installDecisionGuard } from './decision-guard.js';
|
|
34
|
+
import { readGrantStore } from './grants.js';
|
|
35
|
+
export const name = 'dsh-tui-extensions';
|
|
36
|
+
export function apply(ctx) {
|
|
37
|
+
installDecisionGuard(ctx, readGrantStore());
|
|
38
|
+
ctx.plugin(TuiDialogRuntime);
|
|
39
|
+
ctx.plugin(TuiStatusRuntime);
|
|
40
|
+
ctx.plugin(TuiShortcutRuntime);
|
|
41
|
+
ctx.plugin(TuiRendererRuntime);
|
|
42
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Live, scoped plugin grant evaluation. */
|
|
2
|
+
import type { PermissionRegistry } from '../plugin-spec/types.js';
|
|
3
|
+
export declare const EXTENSION_GRANTS_FILE = "extension-grants.json";
|
|
4
|
+
export interface GrantPrincipal {
|
|
5
|
+
componentId: string;
|
|
6
|
+
activationId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface GrantStore {
|
|
9
|
+
/** Evaluate one concrete operation scope. Missing/unsupported scopes deny. */
|
|
10
|
+
allows(principal: GrantPrincipal | string, permission: string, scope: string): boolean;
|
|
11
|
+
defaultOf(permission: string): 'allow' | 'deny';
|
|
12
|
+
knownPermissions(): readonly string[];
|
|
13
|
+
/** Subscribe to file changes. Used to actively release grant-owned effects. */
|
|
14
|
+
onChange?(listener: () => void): () => void;
|
|
15
|
+
readonly corrupt: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Parse a fixed snapshot, primarily for deterministic tests. */
|
|
18
|
+
export declare function parseGrantStore(text: string, registry?: PermissionRegistry): GrantStore;
|
|
19
|
+
/**
|
|
20
|
+
* Read grants on every decision. File changes therefore affect the next
|
|
21
|
+
* operation without a restart. onChange uses a non-persistent watcher so
|
|
22
|
+
* grant-owned subscriptions can be released even when no event is flowing.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readGrantStore(dir?: string, registry?: PermissionRegistry): GrantStore;
|
|
25
|
+
//# sourceMappingURL=grants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/grants.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAI5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAKjE,eAAO,MAAM,qBAAqB,0BAA0B,CAAA;AAE5D,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,8EAA8E;IAC9E,MAAM,CAAC,SAAS,EAAE,cAAc,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;IACtF,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;IAC/C,gBAAgB,IAAI,SAAS,MAAM,EAAE,CAAA;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IAC3C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAkJD,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,UAAU,CAKvF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAiB,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,UAAU,CA0DhG"}
|