@deepseek-harness-tui/dsh-tui 0.8.0 → 0.8.1
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 +13 -5
- package/cordis.patch.yml +21 -2
- package/cordis.yml +12 -1
- package/ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
- package/ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
- package/ecosystem-spec/registry/permissions-0.1.json +13 -0
- package/ecosystem-spec/registry/registry-0.15.json +57 -0
- package/ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
- package/ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
- package/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/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 -10
- package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
- package/lib/types/components/LoadedContextPanel.js +7 -18
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +1 -2
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +25 -1
- 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/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/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +1 -1
- package/lib/types/dsh-adapter/channel.d.ts +30 -7
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +503 -21
- 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/component-identity.d.ts +28 -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 +354 -0
- package/lib/types/dsh-adapter/dialogs.d.ts +146 -0
- package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
- package/lib/types/dsh-adapter/dialogs.js +262 -0
- package/lib/types/dsh-adapter/effect-ledger.d.ts +99 -0
- package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
- package/lib/types/dsh-adapter/effect-ledger.js +231 -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 +169 -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 +184 -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 +146 -0
- package/lib/types/dsh-adapter/message-observer.d.ts +178 -0
- package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
- package/lib/types/dsh-adapter/message-observer.js +509 -0
- package/lib/types/dsh-adapter/plugin-host.d.ts +103 -0
- package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugin-host.js +270 -0
- package/lib/types/dsh-adapter/plugin-storage.d.ts +113 -0
- package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugin-storage.js +385 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +47 -1
- 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/renderers.d.ts +65 -0
- package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
- package/lib/types/dsh-adapter/renderers.js +138 -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 +7 -1
- package/lib/types/dsh-adapter/scenes.d.ts.map +1 -1
- package/lib/types/dsh-adapter/scenes.js +17 -2
- package/lib/types/dsh-adapter/shortcuts.d.ts +109 -0
- package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
- package/lib/types/dsh-adapter/shortcuts.js +268 -0
- package/lib/types/dsh-adapter/status.d.ts +75 -0
- package/lib/types/dsh-adapter/status.d.ts.map +1 -0
- package/lib/types/dsh-adapter/status.js +168 -0
- package/lib/types/extensions.d.ts +8 -0
- package/lib/types/extensions.d.ts.map +1 -0
- package/lib/types/extensions.js +15 -0
- package/lib/types/i18n.d.ts +162 -16
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +53 -5
- package/lib/types/ink/ink.d.ts +11 -0
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +33 -0
- package/lib/types/ink/log-update.d.ts.map +1 -1
- package/lib/types/ink/log-update.js +101 -51
- package/lib/types/ink/output.d.ts +7 -0
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +125 -4
- 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/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +18 -6
- package/lib/types/plugin-host.d.ts +13 -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 +157 -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 +77 -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 +119 -0
- 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 +142 -39
- 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/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/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/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 +257 -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/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/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/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/LICENSE +21 -0
- package/node_modules/@dsh-std/presentation/README.md +26 -0
- package/node_modules/@dsh-std/presentation/README.zh.md +28 -0
- package/node_modules/@dsh-std/presentation/lib/index.d.ts +219 -0
- package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/index.js +547 -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 +21 -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 +105 -70
- 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 +257 -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/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/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/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +26 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +28 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +219 -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 +547 -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 +21 -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/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/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/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 +257 -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/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/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,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* /plugins diagnostics surface (C-070 trust disclosure + C-030 negotiation
|
|
3
|
+
* diagnostics): assembles the lines behind the `/plugins` command.
|
|
4
|
+
*
|
|
5
|
+
* Sections (overview):
|
|
6
|
+
*
|
|
7
|
+
* 1. TRUST BANNER — always the first line (C-070): plugins run in-process;
|
|
8
|
+
* grants are behavioral constraints, not a security boundary; passing
|
|
9
|
+
* validation is not proof of safety.
|
|
10
|
+
* 2. HOST DESCRIPTOR summary — what the running host actually advertises
|
|
11
|
+
* (coordinates + generation), including drift-dropped contracts.
|
|
12
|
+
* 3. GRANT MATRIX — plugins × the registered permissions. The plugin set is
|
|
13
|
+
* the union of FOOTPRINTS ONLY: keys of the grants file, pluginIds seen
|
|
14
|
+
* in the effect ledger, and storage namespaces on disk (the host cannot
|
|
15
|
+
* enumerate installed plugins — that knowledge lives in the dsh CLI
|
|
16
|
+
* Loader). The header says so honestly.
|
|
17
|
+
* 4. LEDGER TAIL — the last 5 effect-ledger records.
|
|
18
|
+
*
|
|
19
|
+
* `/plugins check <path>` uses the parser and projection from the pinned
|
|
20
|
+
* @dsh-std/manifest revision, then evaluates every public/private protocol
|
|
21
|
+
* through one ProtocolCatalog. Manifests and on-disk files are UNTRUSTED input:
|
|
22
|
+
* every derived line passes cleanScalarText before it reaches the
|
|
23
|
+
* transcript.
|
|
24
|
+
*/
|
|
25
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
26
|
+
import { join, resolve } from 'node:path';
|
|
27
|
+
import { parseManifest, projectManifest } from '@dsh-std/manifest';
|
|
28
|
+
import { DATA_DIR } from '../utils/paths.js';
|
|
29
|
+
import { t } from '../i18n.js';
|
|
30
|
+
import { loadSpecData } from '../plugin-spec/registry.js';
|
|
31
|
+
import { createContractIndex, validatePlugin } from '../plugin-spec/validate.js';
|
|
32
|
+
import { negotiate } from '../plugin-spec/negotiate.js';
|
|
33
|
+
import { cleanScalarText } from './sanitize.js';
|
|
34
|
+
import { buildHostDescriptor } from './host-descriptor.js';
|
|
35
|
+
import { PLUGIN_STORAGE_DIR } from './plugin-storage.js';
|
|
36
|
+
import { EFFECT_LEDGER_FILE } from './effect-ledger.js';
|
|
37
|
+
/** How many plugins the matrix shows before an overflow note. */
|
|
38
|
+
export const PLUGINS_MATRIX_MAX_ROWS = 20;
|
|
39
|
+
/** How many ledger records the tail section shows. */
|
|
40
|
+
export const PLUGINS_LEDGER_TAIL = 5;
|
|
41
|
+
/** Per-line cell cap for file-derived content. */
|
|
42
|
+
const LINE_CELLS = 200;
|
|
43
|
+
const cell = (value) => cleanScalarText(String(value ?? ''), LINE_CELLS);
|
|
44
|
+
/** Parse the ledger file tolerantly (skip corrupt lines, never throw). */
|
|
45
|
+
function readLedgerRecords(file) {
|
|
46
|
+
let text;
|
|
47
|
+
try {
|
|
48
|
+
text = readFileSync(file, 'utf8');
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const records = [];
|
|
54
|
+
for (const line of text.split('\n')) {
|
|
55
|
+
if (line.trim() === '')
|
|
56
|
+
continue;
|
|
57
|
+
try {
|
|
58
|
+
const parsed = JSON.parse(line);
|
|
59
|
+
if (parsed !== null && typeof parsed === 'object')
|
|
60
|
+
records.push(parsed);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Corrupt line: the diagnostics surface skips it (never rewrites).
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return records;
|
|
67
|
+
}
|
|
68
|
+
/** The plugin set for the matrix: grants-file keys ∪ ledger pluginIds ∪
|
|
69
|
+
* storage namespaces ('host'/'undeclared' ledger identities are not
|
|
70
|
+
* plugins and are excluded). */
|
|
71
|
+
function footprintPlugins(deps, dataDir, ledgerFile, storageDir) {
|
|
72
|
+
const found = new Set();
|
|
73
|
+
try {
|
|
74
|
+
const raw = JSON.parse(readFileSync(join(dataDir, 'extension-grants.json'), 'utf8'));
|
|
75
|
+
if (raw !== null && typeof raw === 'object') {
|
|
76
|
+
const table = raw;
|
|
77
|
+
for (const section of [table.grants, table.denies]) {
|
|
78
|
+
if (section !== null && typeof section === 'object') {
|
|
79
|
+
for (const plugin of Object.keys(section))
|
|
80
|
+
found.add(plugin);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// Missing/corrupt grants file: the GrantStore already answers deny;
|
|
87
|
+
// the matrix simply has no rows from this source.
|
|
88
|
+
}
|
|
89
|
+
for (const record of readLedgerRecords(ledgerFile)) {
|
|
90
|
+
if (typeof record.pluginId === 'string' && record.pluginId !== '' && record.pluginId !== 'host' && record.pluginId !== 'undeclared') {
|
|
91
|
+
found.add(record.pluginId);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
for (const entry of readdirSync(storageDir)) {
|
|
96
|
+
if (!entry.endsWith('.json'))
|
|
97
|
+
continue;
|
|
98
|
+
const namespace = decodeURIComponent(entry.slice(0, -'.json'.length));
|
|
99
|
+
if (namespace !== '')
|
|
100
|
+
found.add(namespace);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// No storage directory yet: no rows from this source.
|
|
105
|
+
}
|
|
106
|
+
void deps;
|
|
107
|
+
return [...found].sort();
|
|
108
|
+
}
|
|
109
|
+
/** `/plugins check <path>`: official parse/projection + profile validation + negotiation. */
|
|
110
|
+
function checkManifestLines(pathArg, deps) {
|
|
111
|
+
const lines = [];
|
|
112
|
+
const target = resolve(pathArg);
|
|
113
|
+
if (!existsSync(target)) {
|
|
114
|
+
lines.push(t('plugins-check-not-found', { path: cell(pathArg) }));
|
|
115
|
+
return lines;
|
|
116
|
+
}
|
|
117
|
+
let source;
|
|
118
|
+
try {
|
|
119
|
+
source = readFileSync(target, 'utf8');
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
lines.push(t('plugins-check-invalid-json', { err: cell(error instanceof Error ? error.message : String(error)) }));
|
|
123
|
+
return lines;
|
|
124
|
+
}
|
|
125
|
+
const data = loadSpecData();
|
|
126
|
+
if (data === undefined) {
|
|
127
|
+
lines.push(t('plugins-check-spec-unavailable'));
|
|
128
|
+
return lines;
|
|
129
|
+
}
|
|
130
|
+
let manifest;
|
|
131
|
+
try {
|
|
132
|
+
manifest = parseManifest(source, { source: target });
|
|
133
|
+
// Projection is an explicit admission stage. validatePlugin performs its
|
|
134
|
+
// own defensive projection too, but keeping this call here makes parser
|
|
135
|
+
// and projection failures distinguishable at the user-facing boundary.
|
|
136
|
+
projectManifest(manifest);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
const message = cell(error instanceof Error ? error.message : String(error));
|
|
140
|
+
lines.push(error instanceof SyntaxError
|
|
141
|
+
? t('plugins-check-invalid-json', { err: message })
|
|
142
|
+
: t('plugins-check-schema-failed', { err: message }));
|
|
143
|
+
return lines;
|
|
144
|
+
}
|
|
145
|
+
const index = createContractIndex(data.registry, data.permissions);
|
|
146
|
+
try {
|
|
147
|
+
validatePlugin(index, manifest);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
lines.push(t('plugins-check-invalid', { err: cell(error instanceof Error ? error.message : String(error)) }));
|
|
151
|
+
return lines;
|
|
152
|
+
}
|
|
153
|
+
const host = deps.host ?? buildHostDescriptor({ generationId: 'plugins-check' });
|
|
154
|
+
const granted = manifest.permissions
|
|
155
|
+
.map(request => ({
|
|
156
|
+
name: request.name,
|
|
157
|
+
scope: request.scope,
|
|
158
|
+
// `/plugins check` has no live activation instance. Passing an
|
|
159
|
+
// activation-less principal makes GrantStore fail closed when policy
|
|
160
|
+
// contains activation-scoped rules instead of treating them as global.
|
|
161
|
+
granted: deps.grants.allows({ componentId: manifest.id }, request.name, request.scope),
|
|
162
|
+
}));
|
|
163
|
+
const decision = negotiate(index, manifest, host.descriptor, granted);
|
|
164
|
+
lines.push(...decisionLines(decision));
|
|
165
|
+
if (host.dropped.length > 0) {
|
|
166
|
+
lines.push(t('plugins-check-dropped', { dropped: cell(host.dropped.join(', ')) }));
|
|
167
|
+
}
|
|
168
|
+
return lines;
|
|
169
|
+
}
|
|
170
|
+
function decisionLines(decision) {
|
|
171
|
+
switch (decision.decision) {
|
|
172
|
+
case 'compatible':
|
|
173
|
+
return [t('plugins-check-state', { state: 'compatible' })];
|
|
174
|
+
case 'compatible_degraded':
|
|
175
|
+
return [t('plugins-check-state', {
|
|
176
|
+
state: `compatible_degraded (missingOptional: ${cell(decision.missingOptional.join(', '))})`,
|
|
177
|
+
})];
|
|
178
|
+
case 'waiting_authorization':
|
|
179
|
+
return [t('plugins-check-state', {
|
|
180
|
+
state: `waiting_authorization (${cell(decision.reasonCode)}: ${cell(decision.deniedPermissions.join(', '))})`,
|
|
181
|
+
})];
|
|
182
|
+
case 'rejected': {
|
|
183
|
+
const detail = decision.missingRequired !== undefined
|
|
184
|
+
? `${cell(decision.reasonCode)}: ${cell(decision.missingRequired.join(', '))}`
|
|
185
|
+
: `${cell(decision.reasonCode)}: facet ${cell(decision.facetApiVersion)} vs host [${cell((decision.hostFacetApiVersions ?? []).join(', '))}]`;
|
|
186
|
+
return [t('plugins-check-state', { state: `rejected (${detail})` })];
|
|
187
|
+
}
|
|
188
|
+
case 'unknown':
|
|
189
|
+
return [t('plugins-check-state', {
|
|
190
|
+
state: `unknown (${cell(decision.reasonCode)}: ${cell(decision.unknownContracts.join(', '))})`,
|
|
191
|
+
})];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/** The `/plugins` overview lines (banner always first). */
|
|
195
|
+
export function pluginsInfoLines(args, deps) {
|
|
196
|
+
const lines = [t('plugins-trust-banner')];
|
|
197
|
+
const trimmed = args.trim();
|
|
198
|
+
if (trimmed !== '') {
|
|
199
|
+
const [sub, ...rest] = trimmed.split(/\s+/);
|
|
200
|
+
if (sub === 'check') {
|
|
201
|
+
const pathArg = rest.join(' ');
|
|
202
|
+
if (pathArg === '') {
|
|
203
|
+
lines.push(t('plugins-check-usage'));
|
|
204
|
+
return lines;
|
|
205
|
+
}
|
|
206
|
+
lines.push(...checkManifestLines(pathArg, deps));
|
|
207
|
+
return lines;
|
|
208
|
+
}
|
|
209
|
+
lines.push(t('plugins-unknown-subcommand', { sub: cell(sub) }));
|
|
210
|
+
return lines;
|
|
211
|
+
}
|
|
212
|
+
const dataDir = deps.dataDir ?? DATA_DIR;
|
|
213
|
+
const ledgerFile = deps.ledgerFile ?? EFFECT_LEDGER_FILE;
|
|
214
|
+
const storageDir = deps.storageDir ?? join(dataDir, PLUGIN_STORAGE_DIR);
|
|
215
|
+
// ── Host Descriptor ──
|
|
216
|
+
if (deps.host === undefined) {
|
|
217
|
+
lines.push(t('plugins-host-unavailable'));
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
const { descriptor, dropped } = deps.host;
|
|
221
|
+
lines.push(`Host Descriptor: ${cell(descriptor.hostId)} v${cell(descriptor.hostVersion)} · generation ${cell(descriptor.runtime.generationId)}`);
|
|
222
|
+
lines.push(` facets: ${cell(descriptor.facetApiVersions.join(', ') || '—')}`);
|
|
223
|
+
for (const contract of descriptor.contracts) {
|
|
224
|
+
const definition = contract.definition.source === 'dsh-std'
|
|
225
|
+
? contract.definition.package
|
|
226
|
+
: contract.definition.profileHash.slice(0, 19) + '…';
|
|
227
|
+
lines.push(` ${cell(contract.apiVersion)}#${cell(contract.kind)} · definition ${cell(definition)} · perms ${cell(contract.permissions.join(', ') || '—')}`);
|
|
228
|
+
}
|
|
229
|
+
for (const coordinate of dropped) {
|
|
230
|
+
lines.push(` ${cell(coordinate)} · ${t('plugins-contract-dropped')}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// ── 授权矩阵 ──
|
|
234
|
+
const plugins = footprintPlugins(deps, dataDir, ledgerFile, storageDir);
|
|
235
|
+
lines.push(t('plugins-matrix-note'));
|
|
236
|
+
const permissions = deps.grants.knownPermissions();
|
|
237
|
+
if (permissions.length === 0) {
|
|
238
|
+
lines.push(` ${t('plugins-matrix-no-registry')}`);
|
|
239
|
+
}
|
|
240
|
+
else if (plugins.length === 0) {
|
|
241
|
+
lines.push(` ${t('plugins-matrix-empty')}`);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
lines.push(` ${permissions.map((permission, index) => `[${index + 1}] ${cell(permission)}`).join(' ')}`);
|
|
245
|
+
const shown = plugins.slice(0, PLUGINS_MATRIX_MAX_ROWS);
|
|
246
|
+
const width = Math.max(...shown.map(plugin => plugin.length), 8);
|
|
247
|
+
for (const plugin of shown) {
|
|
248
|
+
const diagnosticScope = (permission) => {
|
|
249
|
+
if (permission === 'storage.local.read' || permission === 'storage.local.write')
|
|
250
|
+
return plugin;
|
|
251
|
+
if (permission === 'commands.invoke')
|
|
252
|
+
return 'diagnostic.command';
|
|
253
|
+
return 'session:*';
|
|
254
|
+
};
|
|
255
|
+
const marks = permissions.map(permission => (deps.grants.allows({ componentId: plugin }, permission, diagnosticScope(permission)) ? '✓' : '·')).join(' ');
|
|
256
|
+
lines.push(` ${cell(plugin).padEnd(width)} ${marks}`);
|
|
257
|
+
}
|
|
258
|
+
if (plugins.length > shown.length) {
|
|
259
|
+
lines.push(` ${t('plugins-footprint-overflow', { count: plugins.length - shown.length })}`);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// ── 台账尾 ──
|
|
263
|
+
const records = readLedgerRecords(ledgerFile);
|
|
264
|
+
if (records.length === 0) {
|
|
265
|
+
lines.push(t('plugins-ledger-empty'));
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
lines.push(t('plugins-ledger-header', { file: cell(ledgerFile) }));
|
|
269
|
+
for (const record of records.slice(-PLUGINS_LEDGER_TAIL)) {
|
|
270
|
+
const resource = record.resource ?? {};
|
|
271
|
+
lines.push(` #${cell(record.sequence)} ${cell(record.operation)} ${cell(resource.kind)}/${cell(resource.id)} ` +
|
|
272
|
+
`${cell(record.pluginId)} ${cell(record.result)}${typeof record.errorCode === 'string' ? ` (${cell(record.errorCode)})` : ''}`);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return lines;
|
|
276
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom session-entry renderers — pi's `pi.registerMessageRenderer`. A
|
|
3
|
+
* plugin that appends its own log-only session events (`session.append(
|
|
4
|
+
* 'my-plugin/event', payload)`) registers a renderer mapping the payload to
|
|
5
|
+
* plain TEXT rows; the channel then projects those events into the
|
|
6
|
+
* transcript on the live stream and on replay (resume/rewind), exactly like
|
|
7
|
+
* its built-in projection of `activity/status` or `agent-preset/selected`.
|
|
8
|
+
*
|
|
9
|
+
* Renderers are text-only by design: the full-React surface is the scenes
|
|
10
|
+
* seam (`ctx.tuiScenes`, with the host-React contract); transcript rows are
|
|
11
|
+
* shared with replay paths where a crash mid-replay would corrupt the whole
|
|
12
|
+
* screen, so a renderer never receives React and its output is sanitized
|
|
13
|
+
* (control chars stripped, lines preview-clipped like `pushLocal` output).
|
|
14
|
+
*
|
|
15
|
+
* Registration rules (untrusted-input discipline):
|
|
16
|
+
*
|
|
17
|
+
* - The type must look like `plugin/event` (kebab, one slash) — this is the
|
|
18
|
+
* same shape the session-log strict registry expects plugins to register.
|
|
19
|
+
* - Core vocabulary is off-limits: a renderer can never shadow a built-in
|
|
20
|
+
* event type's projection (locals win, same as commands).
|
|
21
|
+
* - A renderer that throws is skipped for THAT event and logged once per
|
|
22
|
+
* type — replay must survive a buggy plugin.
|
|
23
|
+
*/
|
|
24
|
+
import { Context, Service } from '@deepseek-ai/cordis';
|
|
25
|
+
/** What a renderer returns: an optional title row plus body lines. */
|
|
26
|
+
export interface TuiEntryRenderResult {
|
|
27
|
+
/** Short heading (rendered as a notice row); omit for a body-only entry. */
|
|
28
|
+
title?: string;
|
|
29
|
+
/** Body rows, oldest-to-newest reading order. */
|
|
30
|
+
lines: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
export type TuiEntryRenderer = (payload: unknown) => TuiEntryRenderResult | undefined;
|
|
33
|
+
declare module '@deepseek-ai/cordis' {
|
|
34
|
+
interface Context {
|
|
35
|
+
tuiRenderers: TuiRendererRuntime;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** `ctx.tuiRenderers` — custom session-entry text renderers. */
|
|
39
|
+
export declare class TuiRendererRuntime extends Service {
|
|
40
|
+
private readonly renderers;
|
|
41
|
+
private readonly failedTypes;
|
|
42
|
+
constructor(ctx: Context);
|
|
43
|
+
/**
|
|
44
|
+
* Map a log-only session event type to transcript rows. Returns the
|
|
45
|
+
* dispose function (caller scopes it with `ctx.effect`, same contract as
|
|
46
|
+
* `tuiScenes`). Refusals warn instead of throwing. The optional trailing
|
|
47
|
+
* `identity` (the plugin's own ctx) only feeds the effect ledger's
|
|
48
|
+
* pluginId — omitting it records `undeclared` (C-060).
|
|
49
|
+
*/
|
|
50
|
+
register(type: string, renderer: TuiEntryRenderer, identity?: Context): () => void;
|
|
51
|
+
/**
|
|
52
|
+
* Project one event; undefined when no renderer applies, the renderer has
|
|
53
|
+
* no opinion, or it failed (failure is sticky-logged once per type so a
|
|
54
|
+
* replayed log does not spam the warn stream per event).
|
|
55
|
+
*
|
|
56
|
+
* The result is validated and sanitized INSIDE the try boundary: the title
|
|
57
|
+
* must be a string (anything else is dropped — a non-string would crash
|
|
58
|
+
* the React render path), lines are kept to scalars, control chars are
|
|
59
|
+
* stripped, and the count/width caps bound what a replay can synchronously
|
|
60
|
+
* lay out.
|
|
61
|
+
*/
|
|
62
|
+
render(type: string, payload: unknown): TuiEntryRenderResult | undefined;
|
|
63
|
+
}
|
|
64
|
+
export default TuiRendererRuntime;
|
|
65
|
+
//# sourceMappingURL=renderers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/renderers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAItD,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CACzB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,oBAAoB,GAAG,SAAS,CAAA;AAsBrF,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,YAAY,EAAE,kBAAkB,CAAA;KACjC;CACF;AAED,gEAAgE;AAChE,qBAAa,kBAAmB,SAAQ,OAAO;IAC7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAChE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;gBAEpC,GAAG,EAAE,OAAO;IAIxB;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,IAAI;IA+ClF;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS;CAwBzE;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom session-entry renderers — pi's `pi.registerMessageRenderer`. A
|
|
3
|
+
* plugin that appends its own log-only session events (`session.append(
|
|
4
|
+
* 'my-plugin/event', payload)`) registers a renderer mapping the payload to
|
|
5
|
+
* plain TEXT rows; the channel then projects those events into the
|
|
6
|
+
* transcript on the live stream and on replay (resume/rewind), exactly like
|
|
7
|
+
* its built-in projection of `activity/status` or `agent-preset/selected`.
|
|
8
|
+
*
|
|
9
|
+
* Renderers are text-only by design: the full-React surface is the scenes
|
|
10
|
+
* seam (`ctx.tuiScenes`, with the host-React contract); transcript rows are
|
|
11
|
+
* shared with replay paths where a crash mid-replay would corrupt the whole
|
|
12
|
+
* screen, so a renderer never receives React and its output is sanitized
|
|
13
|
+
* (control chars stripped, lines preview-clipped like `pushLocal` output).
|
|
14
|
+
*
|
|
15
|
+
* Registration rules (untrusted-input discipline):
|
|
16
|
+
*
|
|
17
|
+
* - The type must look like `plugin/event` (kebab, one slash) — this is the
|
|
18
|
+
* same shape the session-log strict registry expects plugins to register.
|
|
19
|
+
* - Core vocabulary is off-limits: a renderer can never shadow a built-in
|
|
20
|
+
* event type's projection (locals win, same as commands).
|
|
21
|
+
* - A renderer that throws is skipped for THAT event and logged once per
|
|
22
|
+
* type — replay must survive a buggy plugin.
|
|
23
|
+
*/
|
|
24
|
+
import { Service } from '@deepseek-ai/cordis';
|
|
25
|
+
import { KNOWN_SESSION_EVENT_TYPES } from '@deepseek-ai/dsh-session';
|
|
26
|
+
import { cleanRenderText } from './sanitize.js';
|
|
27
|
+
const TYPE_PATTERN = /^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/u;
|
|
28
|
+
/**
|
|
29
|
+
* The built-in session-event vocabulary, FROZEN at module load. The live
|
|
30
|
+
* KNOWN_SESSION_EVENT_TYPES set cannot serve as this denylist: a plugin
|
|
31
|
+
* persisting custom events MUST add its types to that set (seam 1's hard
|
|
32
|
+
* rule), so by the time it registers a renderer for `my-plugin/note`, the
|
|
33
|
+
* mutable set already contains `my-plugin/note` — checking against it would
|
|
34
|
+
* reject exactly the types this seam exists for. The module-load snapshot
|
|
35
|
+
* (this service's row mounts before any plugin row) is the built-in truth.
|
|
36
|
+
*/
|
|
37
|
+
const BUILTIN_SESSION_EVENT_TYPES = new Set(KNOWN_SESSION_EVENT_TYPES);
|
|
38
|
+
/** Output bounds (render-path hygiene): a renderer runs on the REPLAY path
|
|
39
|
+
* too, where an unbounded result would synchronously create thousands of
|
|
40
|
+
* transcript rows. Sanitization itself lives in ./sanitize.js. */
|
|
41
|
+
const MAX_RENDER_LINES = 100;
|
|
42
|
+
const TITLE_CELLS = 120;
|
|
43
|
+
const LINE_CELLS = 400;
|
|
44
|
+
/** `ctx.tuiRenderers` — custom session-entry text renderers. */
|
|
45
|
+
export class TuiRendererRuntime extends Service {
|
|
46
|
+
renderers = new Map();
|
|
47
|
+
failedTypes = new Set();
|
|
48
|
+
constructor(ctx) {
|
|
49
|
+
super(ctx, 'tuiRenderers');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Map a log-only session event type to transcript rows. Returns the
|
|
53
|
+
* dispose function (caller scopes it with `ctx.effect`, same contract as
|
|
54
|
+
* `tuiScenes`). Refusals warn instead of throwing. The optional trailing
|
|
55
|
+
* `identity` (the plugin's own ctx) only feeds the effect ledger's
|
|
56
|
+
* pluginId — omitting it records `undeclared` (C-060).
|
|
57
|
+
*/
|
|
58
|
+
register(type, renderer, identity) {
|
|
59
|
+
const normalized = String(type ?? '').trim().toLowerCase();
|
|
60
|
+
if (!TYPE_PATTERN.test(normalized)) {
|
|
61
|
+
this.ctx.logger.warn(`dsh-tui: tuiRenderers.register rejected invalid event type ${JSON.stringify(type)}`);
|
|
62
|
+
return () => { };
|
|
63
|
+
}
|
|
64
|
+
// The channel's own projection (its renderEvent switch plus special-
|
|
65
|
+
// cased plugin events like agent-preset/selected) always wins. The check
|
|
66
|
+
// uses the module-load snapshot of the built-in vocabulary — NOT the live
|
|
67
|
+
// KNOWN_SESSION_EVENT_TYPES, which plugins must extend with their own
|
|
68
|
+
// types (see BUILTIN_SESSION_EVENT_TYPES above).
|
|
69
|
+
if (BUILTIN_SESSION_EVENT_TYPES.has(normalized) || normalized === 'agent-preset/selected') {
|
|
70
|
+
this.ctx.logger.warn(`dsh-tui: tuiRenderers.register rejected "${normalized}" — built-in event types keep their own projection`);
|
|
71
|
+
return () => { };
|
|
72
|
+
}
|
|
73
|
+
if (this.renderers.has(normalized)) {
|
|
74
|
+
this.ctx.logger.warn(`dsh-tui: tuiRenderers.register rejected "${normalized}" — already registered`);
|
|
75
|
+
this.ctx.get('tuiEffectLedger')?.record({
|
|
76
|
+
operation: 'create',
|
|
77
|
+
resource: { kind: 'renderer', id: normalized },
|
|
78
|
+
result: 'failed',
|
|
79
|
+
errorCode: 'DUPLICATE_CONTRIBUTION_ID',
|
|
80
|
+
}, identity);
|
|
81
|
+
return () => { };
|
|
82
|
+
}
|
|
83
|
+
if (typeof renderer !== 'function') {
|
|
84
|
+
this.ctx.logger.warn(`dsh-tui: tuiRenderers.register rejected "${normalized}" — renderer must be a function`);
|
|
85
|
+
return () => { };
|
|
86
|
+
}
|
|
87
|
+
this.renderers.set(normalized, renderer);
|
|
88
|
+
this.ctx.get('tuiEffectLedger')?.record({ operation: 'create', resource: { kind: 'renderer', id: normalized }, result: 'applied' }, identity);
|
|
89
|
+
return () => {
|
|
90
|
+
if (this.renderers.get(normalized) !== renderer)
|
|
91
|
+
return;
|
|
92
|
+
this.renderers.delete(normalized);
|
|
93
|
+
this.ctx.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'renderer', id: normalized }, result: 'applied' }, identity);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Project one event; undefined when no renderer applies, the renderer has
|
|
98
|
+
* no opinion, or it failed (failure is sticky-logged once per type so a
|
|
99
|
+
* replayed log does not spam the warn stream per event).
|
|
100
|
+
*
|
|
101
|
+
* The result is validated and sanitized INSIDE the try boundary: the title
|
|
102
|
+
* must be a string (anything else is dropped — a non-string would crash
|
|
103
|
+
* the React render path), lines are kept to scalars, control chars are
|
|
104
|
+
* stripped, and the count/width caps bound what a replay can synchronously
|
|
105
|
+
* lay out.
|
|
106
|
+
*/
|
|
107
|
+
render(type, payload) {
|
|
108
|
+
const renderer = this.renderers.get(type);
|
|
109
|
+
if (renderer === undefined)
|
|
110
|
+
return undefined;
|
|
111
|
+
try {
|
|
112
|
+
const result = renderer(payload);
|
|
113
|
+
if (result === undefined)
|
|
114
|
+
return undefined;
|
|
115
|
+
const raw = result;
|
|
116
|
+
if (!Array.isArray(raw.lines))
|
|
117
|
+
return undefined;
|
|
118
|
+
const lines = [];
|
|
119
|
+
for (const line of raw.lines) {
|
|
120
|
+
if (lines.length >= MAX_RENDER_LINES)
|
|
121
|
+
break;
|
|
122
|
+
if (typeof line !== 'string' && typeof line !== 'number' && typeof line !== 'boolean')
|
|
123
|
+
continue;
|
|
124
|
+
lines.push(cleanRenderText(String(line), LINE_CELLS));
|
|
125
|
+
}
|
|
126
|
+
const title = typeof raw.title === 'string' ? cleanRenderText(raw.title, TITLE_CELLS) : undefined;
|
|
127
|
+
return { ...(title === undefined || title === '' ? {} : { title }), lines };
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
if (!this.failedTypes.has(type)) {
|
|
131
|
+
this.failedTypes.add(type);
|
|
132
|
+
this.ctx.logger.warn(`dsh-tui: renderer for "${type}" threw; its entries are skipped: %o`, error);
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export default TuiRendererRuntime;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The render-path sanitization contract for plugin-supplied text — the
|
|
3
|
+
* single implementation behind every managed-UI seam (dialogs, status line,
|
|
4
|
+
* entry renderers, rewind modes, decision notices). TUI-PROP-009 Track A
|
|
5
|
+
* makes these rules normative, so they live in exactly one place:
|
|
6
|
+
*
|
|
7
|
+
* - C0/C1 control chars are stripped (replaced by a space) — plugin text
|
|
8
|
+
* must never smuggle escape sequences onto the screen;
|
|
9
|
+
* - whitespace collapses to single spaces (render paths are single-line);
|
|
10
|
+
* - width is capped in terminal CELLS (never string.length) with an
|
|
11
|
+
* ellipsis.
|
|
12
|
+
*
|
|
13
|
+
* Non-scalar input is DROPPED, never `String()`-coerced — `String({})`
|
|
14
|
+
* would put "[object Object]" on the render path. Scalars
|
|
15
|
+
* (string/number/boolean) coerce through String() first.
|
|
16
|
+
*/
|
|
17
|
+
/** Sanitize an already-string value for the render path. */
|
|
18
|
+
export declare function cleanRenderText(value: string, maxCells: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Sanitize an untrusted (possibly non-string) value. Non-scalars — objects,
|
|
21
|
+
* arrays, functions, symbols, null/undefined — yield '' so the caller takes
|
|
22
|
+
* its drop/refuse path; scalars coerce then sanitize.
|
|
23
|
+
*/
|
|
24
|
+
export declare function cleanScalarText(value: unknown, maxCells: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Truncate to a cell budget WITHOUT ellipsis, whitespace folding, or any
|
|
27
|
+
* other mutation — the editing-path counterpart of {@link cleanRenderText}.
|
|
28
|
+
* An input panel caps what the user types/pastes; inserting '…' or
|
|
29
|
+
* collapsing their spaces would corrupt text they can still edit.
|
|
30
|
+
*/
|
|
31
|
+
export declare function capCells(value: string, maxCells: number): string;
|
|
32
|
+
/** C0/C1 control chars → space, nothing else touched. The single-line
|
|
33
|
+
* input panel flattens pasted chunks with this (newlines become spaces —
|
|
34
|
+
* the panel has no second row for them). */
|
|
35
|
+
export declare function flattenInline(value: string): string;
|
|
36
|
+
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,4DAA4D;AAC5D,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUvE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGxE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQhE;AAED;;6CAE6C;AAC7C,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGnD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The render-path sanitization contract for plugin-supplied text — the
|
|
3
|
+
* single implementation behind every managed-UI seam (dialogs, status line,
|
|
4
|
+
* entry renderers, rewind modes, decision notices). TUI-PROP-009 Track A
|
|
5
|
+
* makes these rules normative, so they live in exactly one place:
|
|
6
|
+
*
|
|
7
|
+
* - C0/C1 control chars are stripped (replaced by a space) — plugin text
|
|
8
|
+
* must never smuggle escape sequences onto the screen;
|
|
9
|
+
* - whitespace collapses to single spaces (render paths are single-line);
|
|
10
|
+
* - width is capped in terminal CELLS (never string.length) with an
|
|
11
|
+
* ellipsis.
|
|
12
|
+
*
|
|
13
|
+
* Non-scalar input is DROPPED, never `String()`-coerced — `String({})`
|
|
14
|
+
* would put "[object Object]" on the render path. Scalars
|
|
15
|
+
* (string/number/boolean) coerce through String() first.
|
|
16
|
+
*/
|
|
17
|
+
import { stringWidth } from '../ink/stringWidth.js';
|
|
18
|
+
/** Sanitize an already-string value for the render path. */
|
|
19
|
+
export function cleanRenderText(value, maxCells) {
|
|
20
|
+
// eslint-disable-next-line no-control-regex -- deliberate: sanitize untrusted render-path text
|
|
21
|
+
const flat = value.replace(/[\x00-\x1f\x7f-\x9f]/g, ' ').replace(/\s+/g, ' ').trim();
|
|
22
|
+
if (stringWidth(flat) <= maxCells)
|
|
23
|
+
return flat;
|
|
24
|
+
let out = '';
|
|
25
|
+
for (const ch of flat) {
|
|
26
|
+
if (stringWidth(out + ch) > maxCells - 1)
|
|
27
|
+
break;
|
|
28
|
+
out += ch;
|
|
29
|
+
}
|
|
30
|
+
return `${out}…`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sanitize an untrusted (possibly non-string) value. Non-scalars — objects,
|
|
34
|
+
* arrays, functions, symbols, null/undefined — yield '' so the caller takes
|
|
35
|
+
* its drop/refuse path; scalars coerce then sanitize.
|
|
36
|
+
*/
|
|
37
|
+
export function cleanScalarText(value, maxCells) {
|
|
38
|
+
if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean')
|
|
39
|
+
return '';
|
|
40
|
+
return cleanRenderText(String(value), maxCells);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Truncate to a cell budget WITHOUT ellipsis, whitespace folding, or any
|
|
44
|
+
* other mutation — the editing-path counterpart of {@link cleanRenderText}.
|
|
45
|
+
* An input panel caps what the user types/pastes; inserting '…' or
|
|
46
|
+
* collapsing their spaces would corrupt text they can still edit.
|
|
47
|
+
*/
|
|
48
|
+
export function capCells(value, maxCells) {
|
|
49
|
+
if (stringWidth(value) <= maxCells)
|
|
50
|
+
return value;
|
|
51
|
+
let out = '';
|
|
52
|
+
for (const ch of value) {
|
|
53
|
+
if (stringWidth(out + ch) > maxCells)
|
|
54
|
+
break;
|
|
55
|
+
out += ch;
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/** C0/C1 control chars → space, nothing else touched. The single-line
|
|
60
|
+
* input panel flattens pasted chunks with this (newlines become spaces —
|
|
61
|
+
* the panel has no second row for them). */
|
|
62
|
+
export function flattenInline(value) {
|
|
63
|
+
// eslint-disable-next-line no-control-regex -- deliberate: sanitize untrusted render-path text
|
|
64
|
+
return value.replace(/[\x00-\x1f\x7f-\x9f]/g, ' ');
|
|
65
|
+
}
|
|
@@ -57,7 +57,13 @@ export declare class TuiSceneRuntime extends Service {
|
|
|
57
57
|
private readonly listeners;
|
|
58
58
|
private current;
|
|
59
59
|
constructor(ctx: Context);
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Register a full-screen scene; returns the dispose function (caller
|
|
62
|
+
* scopes it with `ctx.effect`). The optional trailing `identity` (the
|
|
63
|
+
* plugin's own ctx) only feeds the effect ledger's pluginId — omitting it
|
|
64
|
+
* records `undeclared` (C-060).
|
|
65
|
+
*/
|
|
66
|
+
register(descriptor: TuiSceneDescriptor, identity?: Context): () => void;
|
|
61
67
|
/**
|
|
62
68
|
* Swap the conversation for the named scene. Returns false (and warns)
|
|
63
69
|
* when no plugin registered that id — a mistyped id must fail visibly in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenes.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/scenes.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,KAAK,EAAE,OAAO,KAAK,CAAA;IACnB,8DAA8D;IAC9D,EAAE,EAAE,cAAc,UAAU,CAAC,CAAA;IAC7B,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAA;IAChB,mEAAmE;IACnE,KAAK,IAAI,IAAI,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAA;IACV,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;CAC9C;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,SAAS,EAAE,eAAe,CAAA;KAC3B;CACF;AAED,eAAO,MAAM,IAAI,mBAAmB,CAAA;AAEpC;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,OAAO,CAAgC;gBAEnC,GAAG,EAAE,OAAO;IAIxB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,IAAI;
|
|
1
|
+
{"version":3,"file":"scenes.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/scenes.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,KAAK,EAAE,OAAO,KAAK,CAAA;IACnB,8DAA8D;IAC9D,EAAE,EAAE,cAAc,UAAU,CAAC,CAAA;IAC7B,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAA;IAChB,mEAAmE;IACnE,KAAK,IAAI,IAAI,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAA;IACV,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;CAC9C;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,SAAS,EAAE,eAAe,CAAA;KAC3B;CACF;AAED,eAAO,MAAM,IAAI,mBAAmB,CAAA;AAEpC;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,OAAO,CAAgC;gBAEnC,GAAG,EAAE,OAAO;IAIxB;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,IAAI;IAoCxE;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAYzB,KAAK,IAAI,IAAI;IAMb,8DAA8D;IAC9D,IAAI,MAAM,IAAI,kBAAkB,GAAG,SAAS,CAE3C;IAED,4EAA4E;IAC5E,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAO3C,OAAO,CAAC,MAAM;CAGf;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -17,18 +17,33 @@ export class TuiSceneRuntime extends Service {
|
|
|
17
17
|
constructor(ctx) {
|
|
18
18
|
super(ctx, 'tuiScenes');
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Register a full-screen scene; returns the dispose function (caller
|
|
22
|
+
* scopes it with `ctx.effect`). The optional trailing `identity` (the
|
|
23
|
+
* plugin's own ctx) only feeds the effect ledger's pluginId — omitting it
|
|
24
|
+
* records `undeclared` (C-060).
|
|
25
|
+
*/
|
|
26
|
+
register(descriptor, identity) {
|
|
21
27
|
const id = descriptor.id.trim().toLowerCase();
|
|
22
28
|
if (!/^[a-z][a-z0-9_-]*$/u.test(id))
|
|
23
29
|
throw new TypeError(`invalid TUI scene id: ${descriptor.id}`);
|
|
24
|
-
if (this.scenes.has(id))
|
|
30
|
+
if (this.scenes.has(id)) {
|
|
31
|
+
this.ctx.get('tuiEffectLedger')?.record({
|
|
32
|
+
operation: 'create',
|
|
33
|
+
resource: { kind: 'scene', id },
|
|
34
|
+
result: 'failed',
|
|
35
|
+
errorCode: 'DUPLICATE_CONTRIBUTION_ID',
|
|
36
|
+
}, identity);
|
|
25
37
|
throw new Error(`TUI scene "${id}" is already registered`);
|
|
38
|
+
}
|
|
26
39
|
const normalized = { ...descriptor, id };
|
|
27
40
|
this.scenes.set(id, normalized);
|
|
41
|
+
this.ctx.get('tuiEffectLedger')?.record({ operation: 'create', resource: { kind: 'scene', id }, result: 'applied' }, identity);
|
|
28
42
|
return () => {
|
|
29
43
|
if (this.scenes.get(id) !== normalized)
|
|
30
44
|
return;
|
|
31
45
|
this.scenes.delete(id);
|
|
46
|
+
this.ctx.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'scene', id }, result: 'applied' }, identity);
|
|
32
47
|
// Disposing the open scene must not strand the user on a dead screen.
|
|
33
48
|
if (this.current === normalized) {
|
|
34
49
|
this.current = undefined;
|