@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"childStderr.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/childStderr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAsDH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CA8BhF;AAED,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CAChG;AAED,MAAM,WAAW,0BAA0B;IACzC,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yFAAyF;IACzF,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iDAAiD;IACjD,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,0BAA+B,GACvC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"childStderr.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/childStderr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAsDH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CA8BhF;AAED,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CAChG;AAED,MAAM,WAAW,0BAA0B;IACzC,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yFAAyF;IACzF,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iDAAiD;IACjD,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,0BAA+B,GACvC,mBAAmB,CAqDrB"}
|
|
@@ -145,6 +145,16 @@ export function createChildStderrReporter(notify, options = {}) {
|
|
|
145
145
|
// A burst inside the cooldown window is counted but stays silent.
|
|
146
146
|
if ((mutedUntil.get(line) ?? 0) > Date.now())
|
|
147
147
|
return;
|
|
148
|
+
// Prune expired cooldowns on the way in: entries are child-stderr
|
|
149
|
+
// lines and a long-lived MCP reconnect loop would otherwise grow the
|
|
150
|
+
// dedup table without bound.
|
|
151
|
+
if (mutedUntil.size > 64) {
|
|
152
|
+
const now = Date.now();
|
|
153
|
+
for (const [key, until] of mutedUntil) {
|
|
154
|
+
if (until <= now)
|
|
155
|
+
mutedUntil.delete(key);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
148
158
|
mutedUntil.set(line, Date.now() + cooldownMs);
|
|
149
159
|
const text = group.count > 1
|
|
150
160
|
? t('child-stderr-line-repeat', { line, count: group.count })
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command ownership attribution — the data source for the C-041 invoke
|
|
3
|
+
* checkpoint's per-owner grant decision.
|
|
4
|
+
*
|
|
5
|
+
* dsh-commands has NO owner concept (its `normalizeDefinition` rebuilds a
|
|
6
|
+
* frozen object and drops unknown fields, and its scoped layers key by
|
|
7
|
+
* agent, not by registrant), and neither realistic access path can carry
|
|
8
|
+
* the caller's identity to `register` for us: `ctx.get('commands')` is an
|
|
9
|
+
* accessor that bypasses cordis's `internal/get` waterfall, and an
|
|
10
|
+
* inject-declared property read resolves before it. So attribution does
|
|
11
|
+
* NOT try to spy on the registry — it is a MEDIATED REGISTRATION surface,
|
|
12
|
+
* the same honest-identity pattern as storage.local / messages.observe:
|
|
13
|
+
* the plugin-host row's `registerCommand(pluginCtx, definition)` supplies a
|
|
14
|
+
* unique wrapper handler and stamps that actual registered definition with
|
|
15
|
+
* the verified Component id and activation on success. The invoke checkpoint resolves the
|
|
16
|
+
* effective definition for its receiving agent first, then looks up that
|
|
17
|
+
* definition's handler here. This mirrors dsh-commands' scoped shadowing:
|
|
18
|
+
* same-name definitions in separate agent scopes never share attribution.
|
|
19
|
+
*
|
|
20
|
+
* A plugin that registers directly through `ctx.get('commands')` keeps its
|
|
21
|
+
* command UNATTRIBUTED: the invoke checkpoint then applies the root grant
|
|
22
|
+
* only — the documented C-070 trusted-in-process boundary, exactly like a
|
|
23
|
+
* plugin calling `ctx.commands.execute` directly. Attribution only ever
|
|
24
|
+
* TIGHTENS the check, never widens it.
|
|
25
|
+
*
|
|
26
|
+
* The map is keyed by the cordis ROOT so the row and the channel (two
|
|
27
|
+
* different contexts of one runtime) share one view.
|
|
28
|
+
*/
|
|
29
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
30
|
+
import type { VerifiedComponentIdentity } from './component-identity.js';
|
|
31
|
+
export interface CommandOwner {
|
|
32
|
+
componentId: string;
|
|
33
|
+
activationId: string;
|
|
34
|
+
commandId: string;
|
|
35
|
+
}
|
|
36
|
+
/** The registrant's display name for diagnostics only: the passed context's
|
|
37
|
+
* fiber name (nearest named ancestor), 'root' for host-side or degraded
|
|
38
|
+
* contexts. Authorization never uses this display value. */
|
|
39
|
+
export declare function fiberNameOf(ctx: Context): string;
|
|
40
|
+
/** Record one mediated command definition's owner after successful registration. */
|
|
41
|
+
export declare function stampCommandOwner(ctx: Context, definition: unknown, identity: VerifiedComponentIdentity, commandId: string): void;
|
|
42
|
+
/** Lift one definition's stamp without touching a later registration. */
|
|
43
|
+
export declare function unstampCommandOwner(ctx: Context, definition: unknown, activationId: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* The recorded owner of the EFFECTIVE command definition, or undefined when
|
|
46
|
+
* it is unattributed (root-side/direct registrations are the documented
|
|
47
|
+
* C-070 boundary). Callers must pass `commands.find(agent, name)`, not only
|
|
48
|
+
* the command name, so agent-scoped shadows select their own owner.
|
|
49
|
+
*/
|
|
50
|
+
export declare function commandOwner(ctx: Context, definition: unknown): CommandOwner | undefined;
|
|
51
|
+
//# sourceMappingURL=command-attribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-attribution.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/command-attribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAGxE,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB;AAQD;;4DAE4D;AAC5D,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQhD;AAYD,oFAAoF;AACpF,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,OAAO,EACnB,QAAQ,EAAE,yBAAyB,EACnC,SAAS,EAAE,MAAM,GAChB,IAAI,CAUN;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAMjG;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAKxF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command ownership attribution — the data source for the C-041 invoke
|
|
3
|
+
* checkpoint's per-owner grant decision.
|
|
4
|
+
*
|
|
5
|
+
* dsh-commands has NO owner concept (its `normalizeDefinition` rebuilds a
|
|
6
|
+
* frozen object and drops unknown fields, and its scoped layers key by
|
|
7
|
+
* agent, not by registrant), and neither realistic access path can carry
|
|
8
|
+
* the caller's identity to `register` for us: `ctx.get('commands')` is an
|
|
9
|
+
* accessor that bypasses cordis's `internal/get` waterfall, and an
|
|
10
|
+
* inject-declared property read resolves before it. So attribution does
|
|
11
|
+
* NOT try to spy on the registry — it is a MEDIATED REGISTRATION surface,
|
|
12
|
+
* the same honest-identity pattern as storage.local / messages.observe:
|
|
13
|
+
* the plugin-host row's `registerCommand(pluginCtx, definition)` supplies a
|
|
14
|
+
* unique wrapper handler and stamps that actual registered definition with
|
|
15
|
+
* the verified Component id and activation on success. The invoke checkpoint resolves the
|
|
16
|
+
* effective definition for its receiving agent first, then looks up that
|
|
17
|
+
* definition's handler here. This mirrors dsh-commands' scoped shadowing:
|
|
18
|
+
* same-name definitions in separate agent scopes never share attribution.
|
|
19
|
+
*
|
|
20
|
+
* A plugin that registers directly through `ctx.get('commands')` keeps its
|
|
21
|
+
* command UNATTRIBUTED: the invoke checkpoint then applies the root grant
|
|
22
|
+
* only — the documented C-070 trusted-in-process boundary, exactly like a
|
|
23
|
+
* plugin calling `ctx.commands.execute` directly. Attribution only ever
|
|
24
|
+
* TIGHTENS the check, never widens it.
|
|
25
|
+
*
|
|
26
|
+
* The map is keyed by the cordis ROOT so the row and the channel (two
|
|
27
|
+
* different contexts of one runtime) share one view.
|
|
28
|
+
*/
|
|
29
|
+
import { compositionRoot } from './host-access.js';
|
|
30
|
+
const ownerMaps = new WeakMap();
|
|
31
|
+
function rootKeyOf(ctx) {
|
|
32
|
+
return compositionRoot(ctx);
|
|
33
|
+
}
|
|
34
|
+
/** The registrant's display name for diagnostics only: the passed context's
|
|
35
|
+
* fiber name (nearest named ancestor), 'root' for host-side or degraded
|
|
36
|
+
* contexts. Authorization never uses this display value. */
|
|
37
|
+
export function fiberNameOf(ctx) {
|
|
38
|
+
try {
|
|
39
|
+
const resolved = ctx.fiber?.name;
|
|
40
|
+
if (typeof resolved === 'string' && resolved !== '')
|
|
41
|
+
return resolved;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Degraded context without fiber access: 'root'.
|
|
45
|
+
}
|
|
46
|
+
return 'root';
|
|
47
|
+
}
|
|
48
|
+
function handlerOf(definition) {
|
|
49
|
+
try {
|
|
50
|
+
const handler = definition?.handler;
|
|
51
|
+
return typeof handler === 'function' ? handler : undefined;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// An exotic definition cannot participate in attribution safely.
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Record one mediated command definition's owner after successful registration. */
|
|
59
|
+
export function stampCommandOwner(ctx, definition, identity, commandId) {
|
|
60
|
+
const key = rootKeyOf(ctx);
|
|
61
|
+
const handler = handlerOf(definition);
|
|
62
|
+
if (key === undefined || handler === undefined)
|
|
63
|
+
return;
|
|
64
|
+
let map = ownerMaps.get(key);
|
|
65
|
+
if (map === undefined) {
|
|
66
|
+
map = new WeakMap();
|
|
67
|
+
ownerMaps.set(key, map);
|
|
68
|
+
}
|
|
69
|
+
map.set(handler, Object.freeze({ componentId: identity.componentId, activationId: identity.activationId, commandId }));
|
|
70
|
+
}
|
|
71
|
+
/** Lift one definition's stamp without touching a later registration. */
|
|
72
|
+
export function unstampCommandOwner(ctx, definition, activationId) {
|
|
73
|
+
const key = rootKeyOf(ctx);
|
|
74
|
+
const handler = handlerOf(definition);
|
|
75
|
+
if (key === undefined || handler === undefined)
|
|
76
|
+
return;
|
|
77
|
+
const map = ownerMaps.get(key);
|
|
78
|
+
if (map?.get(handler)?.activationId === activationId)
|
|
79
|
+
map.delete(handler);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The recorded owner of the EFFECTIVE command definition, or undefined when
|
|
83
|
+
* it is unattributed (root-side/direct registrations are the documented
|
|
84
|
+
* C-070 boundary). Callers must pass `commands.find(agent, name)`, not only
|
|
85
|
+
* the command name, so agent-scoped shadows select their own owner.
|
|
86
|
+
*/
|
|
87
|
+
export function commandOwner(ctx, definition) {
|
|
88
|
+
const key = rootKeyOf(ctx);
|
|
89
|
+
const handler = handlerOf(definition);
|
|
90
|
+
if (key === undefined || handler === undefined)
|
|
91
|
+
return undefined;
|
|
92
|
+
return ownerMaps.get(key)?.get(handler);
|
|
93
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commands contract error-code alignment (C-041,
|
|
3
|
+
* `commands.dsh/v1alpha1#Command`): the official `dsh-commands` runtime
|
|
4
|
+
* reports a duplicate registration as a plain `Error` whose MESSAGE is the
|
|
5
|
+
* only signal:
|
|
6
|
+
*
|
|
7
|
+
* `command "<name>" is already registered (…)`
|
|
8
|
+
* `command "<name>" is already registered in this scope`
|
|
9
|
+
*
|
|
10
|
+
* The v0.15 contract names the code `DUPLICATE_CONTRIBUTION_ID`. This module
|
|
11
|
+
* maps the message-shaped error onto an `Error` carrying that `.code`, at
|
|
12
|
+
* the HOST-MEDIATED registration/invocation points (the channel's skill
|
|
13
|
+
* command registration and registry-command execution).
|
|
14
|
+
*
|
|
15
|
+
* Known boundary (C-070, trusted-in-process): a plugin calling
|
|
16
|
+
* `ctx.commands.register` / `ctx.commands.execute` DIRECTLY bypasses this
|
|
17
|
+
* mapping — code-level wrapping can only cover the points the host owns.
|
|
18
|
+
* That is declared platform behavior, not a bug.
|
|
19
|
+
*/
|
|
20
|
+
/** The contract's command error vocabulary. */
|
|
21
|
+
export declare const COMMAND_ERROR_CODES: readonly ["COMMAND_NOT_FOUND", "DUPLICATE_CONTRIBUTION_ID", "PERMISSION_NOT_GRANTED", "COMMAND_FAILED", "INVOCATION_CANCELLED", "INVOCATION_DEADLINE_EXCEEDED"];
|
|
22
|
+
export type CommandErrorCode = (typeof COMMAND_ERROR_CODES)[number];
|
|
23
|
+
/** An Error carrying a contract error code on `.code`. */
|
|
24
|
+
export interface CodedCommandError extends Error {
|
|
25
|
+
code: CommandErrorCode;
|
|
26
|
+
cause?: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Map a thrown dsh-commands error onto its contract code. A duplicate
|
|
30
|
+
* registration comes back as a CodedCommandError with
|
|
31
|
+
* `DUPLICATE_CONTRIBUTION_ID` (original on `.cause`); every other value
|
|
32
|
+
* passes through unchanged.
|
|
33
|
+
*/
|
|
34
|
+
export declare function mapCommandError(error: unknown): unknown;
|
|
35
|
+
/** True when `error` carries the given contract code. */
|
|
36
|
+
export declare function hasCommandErrorCode(error: unknown, code: CommandErrorCode): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Run `operation` and rethrow any duplicate-registration failure with its
|
|
39
|
+
* contract code attached (see {@link mapCommandError}).
|
|
40
|
+
*/
|
|
41
|
+
export declare function withCommandErrorMapping<T>(operation: () => T | Promise<T>): Promise<T>;
|
|
42
|
+
//# sourceMappingURL=command-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-errors.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/command-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,+CAA+C;AAC/C,eAAO,MAAM,mBAAmB,iKAOtB,CAAA;AACV,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnE,0DAA0D;AAC1D,MAAM,WAAW,iBAAkB,SAAQ,KAAK;IAC9C,IAAI,EAAE,gBAAgB,CAAA;IACtB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CASvD;AAED,yDAAyD;AACzD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAMnF;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM5F"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commands contract error-code alignment (C-041,
|
|
3
|
+
* `commands.dsh/v1alpha1#Command`): the official `dsh-commands` runtime
|
|
4
|
+
* reports a duplicate registration as a plain `Error` whose MESSAGE is the
|
|
5
|
+
* only signal:
|
|
6
|
+
*
|
|
7
|
+
* `command "<name>" is already registered (…)`
|
|
8
|
+
* `command "<name>" is already registered in this scope`
|
|
9
|
+
*
|
|
10
|
+
* The v0.15 contract names the code `DUPLICATE_CONTRIBUTION_ID`. This module
|
|
11
|
+
* maps the message-shaped error onto an `Error` carrying that `.code`, at
|
|
12
|
+
* the HOST-MEDIATED registration/invocation points (the channel's skill
|
|
13
|
+
* command registration and registry-command execution).
|
|
14
|
+
*
|
|
15
|
+
* Known boundary (C-070, trusted-in-process): a plugin calling
|
|
16
|
+
* `ctx.commands.register` / `ctx.commands.execute` DIRECTLY bypasses this
|
|
17
|
+
* mapping — code-level wrapping can only cover the points the host owns.
|
|
18
|
+
* That is declared platform behavior, not a bug.
|
|
19
|
+
*/
|
|
20
|
+
/** The contract's command error vocabulary. */
|
|
21
|
+
export const COMMAND_ERROR_CODES = [
|
|
22
|
+
'COMMAND_NOT_FOUND',
|
|
23
|
+
'DUPLICATE_CONTRIBUTION_ID',
|
|
24
|
+
'PERMISSION_NOT_GRANTED',
|
|
25
|
+
'COMMAND_FAILED',
|
|
26
|
+
'INVOCATION_CANCELLED',
|
|
27
|
+
'INVOCATION_DEADLINE_EXCEEDED',
|
|
28
|
+
];
|
|
29
|
+
const DUPLICATE_PATTERN = /^command "[^"]+" is already registered/;
|
|
30
|
+
/**
|
|
31
|
+
* Map a thrown dsh-commands error onto its contract code. A duplicate
|
|
32
|
+
* registration comes back as a CodedCommandError with
|
|
33
|
+
* `DUPLICATE_CONTRIBUTION_ID` (original on `.cause`); every other value
|
|
34
|
+
* passes through unchanged.
|
|
35
|
+
*/
|
|
36
|
+
export function mapCommandError(error) {
|
|
37
|
+
if (error instanceof Error && DUPLICATE_PATTERN.test(error.message)) {
|
|
38
|
+
const mapped = new Error(error.message);
|
|
39
|
+
mapped.name = error.name;
|
|
40
|
+
mapped.code = 'DUPLICATE_CONTRIBUTION_ID';
|
|
41
|
+
mapped.cause = error;
|
|
42
|
+
return mapped;
|
|
43
|
+
}
|
|
44
|
+
return error;
|
|
45
|
+
}
|
|
46
|
+
/** True when `error` carries the given contract code. */
|
|
47
|
+
export function hasCommandErrorCode(error, code) {
|
|
48
|
+
return (error !== null &&
|
|
49
|
+
typeof error === 'object' &&
|
|
50
|
+
error.code === code);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Run `operation` and rethrow any duplicate-registration failure with its
|
|
54
|
+
* contract code attached (see {@link mapCommandError}).
|
|
55
|
+
*/
|
|
56
|
+
export async function withCommandErrorMapping(operation) {
|
|
57
|
+
try {
|
|
58
|
+
return await operation();
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw mapCommandError(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -9,6 +9,12 @@ export interface TuiCommandTreeProvider {
|
|
|
9
9
|
/** Children for the full canonical path, including `root` at index zero. */
|
|
10
10
|
children(canonicalPath: readonly string[]): readonly CommandCompletionNode[];
|
|
11
11
|
}
|
|
12
|
+
/** Host-only completion access. Plugins see only their own provider through
|
|
13
|
+
* the traceable service; the channel uses this facade to merge all providers. */
|
|
14
|
+
export interface TuiCommandTreeHost {
|
|
15
|
+
children(canonicalPath: readonly string[]): readonly CommandCompletionNode[];
|
|
16
|
+
descriptions(root: string): LocalizedDescriptions | undefined;
|
|
17
|
+
}
|
|
12
18
|
declare module '@deepseek-ai/cordis' {
|
|
13
19
|
interface Context {
|
|
14
20
|
tuiCommandTrees: TuiCommandTreeRuntime;
|
|
@@ -17,11 +23,11 @@ declare module '@deepseek-ai/cordis' {
|
|
|
17
23
|
export declare const name = "dsh-tui-command-trees";
|
|
18
24
|
/** Small host-only registry; command execution remains owned by dsh-commands. */
|
|
19
25
|
export declare class TuiCommandTreeRuntime extends Service {
|
|
20
|
-
private readonly providers;
|
|
21
26
|
constructor(ctx: Context);
|
|
22
27
|
register(provider: TuiCommandTreeProvider): () => void;
|
|
23
28
|
children(canonicalPath: readonly string[]): readonly CommandCompletionNode[];
|
|
24
29
|
descriptions(root: string): LocalizedDescriptions | undefined;
|
|
25
30
|
}
|
|
31
|
+
export declare function getHostCommandTrees(runtime: TuiCommandTreeRuntime | undefined): TuiCommandTreeHost | undefined;
|
|
26
32
|
export default TuiCommandTreeRuntime;
|
|
27
33
|
//# sourceMappingURL=command-trees.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-trees.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/command-trees.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAEhF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"command-trees.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/command-trees.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAEhF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAGlF,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,qBAAqB,EAAE,CAAA;CAC7E;AAED;iFACiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,qBAAqB,EAAE,CAAA;IAC5E,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAAA;CAC9D;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,eAAe,EAAE,qBAAqB,CAAA;KACvC;CACF;AAED,eAAO,MAAM,IAAI,0BAA0B,CAAA;AAE3C,iFAAiF;AACjF,qBAAa,qBAAsB,SAAQ,OAAO;gBACpC,GAAG,EAAE,OAAO;IAYxB,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI;IAoBtD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,qBAAqB,EAAE;IAM5E,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;CAK9D;AAyCD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,SAAS,GAAG,kBAAkB,GAAG,SAAS,CAO9G;AAED,eAAe,qBAAqB,CAAA"}
|
|
@@ -1,42 +1,92 @@
|
|
|
1
1
|
/** Provider-neutral subcommand completion registry for terminal front doors. */
|
|
2
2
|
import { Service } from '@deepseek-ai/cordis';
|
|
3
|
+
import { activationFiber, bindCallerEffect, compositionRoot, concreteService, requirePluginCaller } from './host-access.js';
|
|
3
4
|
export const name = 'dsh-tui-command-trees';
|
|
4
5
|
/** Small host-only registry; command execution remains owned by dsh-commands. */
|
|
5
6
|
export class TuiCommandTreeRuntime extends Service {
|
|
6
|
-
providers = new Map();
|
|
7
7
|
constructor(ctx) {
|
|
8
8
|
super(ctx, 'tuiCommandTrees');
|
|
9
|
+
compositionRoot(ctx);
|
|
10
|
+
const runtime = this;
|
|
11
|
+
const state = { providers: new Map(), owners: new Map(), host: undefined };
|
|
12
|
+
state.host = Object.freeze({
|
|
13
|
+
children: path => childrenFor(runtime, path),
|
|
14
|
+
descriptions: root => descriptionsFor(runtime, root),
|
|
15
|
+
});
|
|
16
|
+
commandTreeStates.set(this, state);
|
|
9
17
|
}
|
|
10
18
|
register(provider) {
|
|
19
|
+
const caller = requirePluginCaller(this.ctx, 'tuiCommandTrees.register', this);
|
|
20
|
+
const state = commandTreeStateFor(this);
|
|
21
|
+
const owner = activationFiber(caller);
|
|
22
|
+
if (owner === undefined)
|
|
23
|
+
throw new Error('dsh-tui: tuiCommandTrees.register requires a live activation');
|
|
11
24
|
const root = provider.root.trim().toLowerCase();
|
|
12
25
|
if (!/^[a-z][a-z0-9_-]*$/u.test(root))
|
|
13
26
|
throw new TypeError(`invalid TUI command-tree root: ${provider.root}`);
|
|
14
|
-
if (
|
|
27
|
+
if (state.providers.has(root))
|
|
15
28
|
throw new Error(`TUI command-tree root "${root}" is already registered`);
|
|
16
29
|
const normalized = { ...provider, root };
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
state.providers.set(root, normalized);
|
|
31
|
+
state.owners.set(root, owner);
|
|
32
|
+
const dispose = () => {
|
|
33
|
+
if (state.providers.get(root) !== normalized)
|
|
34
|
+
return;
|
|
35
|
+
state.providers.delete(root);
|
|
36
|
+
state.owners.delete(root);
|
|
21
37
|
};
|
|
38
|
+
bindCallerEffect(caller, dispose);
|
|
39
|
+
return dispose;
|
|
22
40
|
}
|
|
23
41
|
children(canonicalPath) {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const provider = this.providers.get(root);
|
|
28
|
-
if (provider === undefined)
|
|
29
|
-
return [];
|
|
30
|
-
try {
|
|
31
|
-
return provider.children(canonicalPath);
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// Completion is optional UI metadata and must never block execution.
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
42
|
+
const caller = requirePluginCaller(this.ctx, 'tuiCommandTrees.children', this);
|
|
43
|
+
const owner = activationFiber(caller);
|
|
44
|
+
return childrenFor(this, canonicalPath, owner);
|
|
37
45
|
}
|
|
38
46
|
descriptions(root) {
|
|
39
|
-
|
|
47
|
+
const caller = requirePluginCaller(this.ctx, 'tuiCommandTrees.descriptions', this);
|
|
48
|
+
const owner = activationFiber(caller);
|
|
49
|
+
return descriptionsFor(this, root, owner);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const commandTreeStates = new WeakMap();
|
|
53
|
+
function commandTreeStateFor(runtime) {
|
|
54
|
+
const state = commandTreeStates.get(concreteService(runtime));
|
|
55
|
+
if (state === undefined)
|
|
56
|
+
throw new Error('tuiCommandTrees host state is unavailable');
|
|
57
|
+
return state;
|
|
58
|
+
}
|
|
59
|
+
function childrenFor(runtime, canonicalPath, owner) {
|
|
60
|
+
const state = commandTreeStateFor(runtime);
|
|
61
|
+
const root = canonicalPath[0]?.toLowerCase();
|
|
62
|
+
if (root === undefined || (owner !== undefined && state.owners.get(root) !== owner))
|
|
63
|
+
return [];
|
|
64
|
+
const provider = state.providers.get(root);
|
|
65
|
+
if (provider === undefined)
|
|
66
|
+
return [];
|
|
67
|
+
try {
|
|
68
|
+
return provider.children(canonicalPath);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Completion is optional UI metadata and must never block execution.
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function descriptionsFor(runtime, root, owner) {
|
|
76
|
+
const state = commandTreeStateFor(runtime);
|
|
77
|
+
const normalized = root.trim().toLowerCase();
|
|
78
|
+
if (owner !== undefined && state.owners.get(normalized) !== owner)
|
|
79
|
+
return undefined;
|
|
80
|
+
return state.providers.get(normalized)?.descriptions;
|
|
81
|
+
}
|
|
82
|
+
export function getHostCommandTrees(runtime) {
|
|
83
|
+
if (runtime === undefined)
|
|
84
|
+
return undefined;
|
|
85
|
+
try {
|
|
86
|
+
return commandTreeStateFor(runtime).host;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return undefined;
|
|
40
90
|
}
|
|
41
91
|
}
|
|
42
92
|
export default TuiCommandTreeRuntime;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Verified Component identity bound to one Cordis activation owner. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { ComponentManifest, PluginManifest } from '@dsh-std/manifest';
|
|
4
|
+
export type ComponentIdentityErrorCode = 'COMPONENT_NOT_ADMITTED' | 'COMPONENT_ALREADY_ADMITTED';
|
|
5
|
+
export declare class ComponentIdentityError extends Error {
|
|
6
|
+
readonly code: ComponentIdentityErrorCode;
|
|
7
|
+
constructor(code: ComponentIdentityErrorCode, message: string);
|
|
8
|
+
}
|
|
9
|
+
export interface VerifiedComponentIdentity {
|
|
10
|
+
readonly componentId: string;
|
|
11
|
+
readonly version: string;
|
|
12
|
+
readonly facet: 'host';
|
|
13
|
+
readonly activationId: string;
|
|
14
|
+
readonly manifest: PluginManifest;
|
|
15
|
+
readonly projection: ComponentManifest;
|
|
16
|
+
}
|
|
17
|
+
/** Activation ids are host-issued opaque values. Keep them bounded and free
|
|
18
|
+
* of control characters because the same value is written to the effect
|
|
19
|
+
* ledger and used as a grant principal selector. */
|
|
20
|
+
export declare const ACTIVATION_ID_MAX_LENGTH = 128;
|
|
21
|
+
export declare function bindComponentIdentity(context: Context, manifest: PluginManifest, projection: ComponentManifest, activationId?: string): VerifiedComponentIdentity;
|
|
22
|
+
export declare function componentIdentityOf(context: Context): VerifiedComponentIdentity | undefined;
|
|
23
|
+
export declare function requireComponentIdentity(context: Context): VerifiedComponentIdentity;
|
|
24
|
+
export declare function declaresPermission(identity: VerifiedComponentIdentity, permission: string, actualScope: string): boolean;
|
|
25
|
+
export declare function declaresCommand(identity: VerifiedComponentIdentity, commandId: string): boolean;
|
|
26
|
+
export declare function declaresObserverScope(identity: VerifiedComponentIdentity, actualScope: string): boolean;
|
|
27
|
+
export declare function requiresDecisionEvents(identity: VerifiedComponentIdentity): boolean;
|
|
28
|
+
/** Whether admission negotiated the protocol that backs a mediated runtime
|
|
29
|
+
* capability. Permissions alone are not a capability grant: a plugin must
|
|
30
|
+
* explicitly require the corresponding contract before the host can expose
|
|
31
|
+
* its calls. */
|
|
32
|
+
export declare function requiresContract(identity: VerifiedComponentIdentity, apiVersion: string, kind: string): boolean;
|
|
33
|
+
//# sourceMappingURL=component-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-identity.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/component-identity.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAGxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAI1E,MAAM,MAAM,0BAA0B,GAAG,wBAAwB,GAAG,4BAA4B,CAAA;AAEhG,qBAAa,sBAAuB,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,0BAA0B;gBAAhC,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM;CAIvE;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;CACvC;AAED;;oDAEoD;AACpD,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAqB3C,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,iBAAiB,EAC7B,YAAY,GAAE,MAAqB,GAClC,yBAAyB,CAyB3B;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,yBAAyB,GAAG,SAAS,CAM3F;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,yBAAyB,CASpF;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,yBAAyB,EACnC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAQT;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAE/F;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAUvG;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,OAAO,CAEnF;AAED;;;gBAGgB;AAChB,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,yBAAyB,EACnC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAGT"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/** Verified Component identity bound to one Cordis activation owner. */
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { normalizePermissionScope, scopeCovers } from '../plugin-spec/permission-scope.js';
|
|
4
|
+
import { activationFiber, bindCallerEffect } from './host-access.js';
|
|
5
|
+
export class ComponentIdentityError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
constructor(code, message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.name = 'ComponentIdentityError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Activation ids are host-issued opaque values. Keep them bounded and free
|
|
14
|
+
* of control characters because the same value is written to the effect
|
|
15
|
+
* ledger and used as a grant principal selector. */
|
|
16
|
+
export const ACTIVATION_ID_MAX_LENGTH = 128;
|
|
17
|
+
function validateActivationId(value) {
|
|
18
|
+
if (typeof value !== 'string' || value.length === 0 || value.length > ACTIVATION_ID_MAX_LENGTH
|
|
19
|
+
|| /[\x00-\x1f\x7f-\x9f]/u.test(value)) {
|
|
20
|
+
throw new ComponentIdentityError('COMPONENT_NOT_ADMITTED', `activationId must be a non-empty control-free string of at most ${ACTIVATION_ID_MAX_LENGTH} characters`);
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
const identities = new WeakMap();
|
|
25
|
+
function ownerKey(context) {
|
|
26
|
+
const fiber = activationFiber(context);
|
|
27
|
+
if (fiber !== undefined)
|
|
28
|
+
return fiber;
|
|
29
|
+
throw new ComponentIdentityError('COMPONENT_NOT_ADMITTED', 'a Component activation requires an owning Cordis fiber');
|
|
30
|
+
}
|
|
31
|
+
export function bindComponentIdentity(context, manifest, projection, activationId = randomUUID()) {
|
|
32
|
+
const key = ownerKey(context);
|
|
33
|
+
if (identities.has(key)) {
|
|
34
|
+
throw new ComponentIdentityError('COMPONENT_ALREADY_ADMITTED', 'this activation already has a verified Component identity');
|
|
35
|
+
}
|
|
36
|
+
const identity = Object.freeze({
|
|
37
|
+
componentId: projection.metadata.name,
|
|
38
|
+
version: projection.metadata.version,
|
|
39
|
+
facet: 'host',
|
|
40
|
+
activationId: validateActivationId(activationId),
|
|
41
|
+
manifest,
|
|
42
|
+
projection,
|
|
43
|
+
});
|
|
44
|
+
identities.set(key, identity);
|
|
45
|
+
const release = () => {
|
|
46
|
+
if (identities.get(key) === identity)
|
|
47
|
+
identities.delete(key);
|
|
48
|
+
};
|
|
49
|
+
if (!bindCallerEffect(context, release)) {
|
|
50
|
+
identities.delete(key);
|
|
51
|
+
throw new ComponentIdentityError('COMPONENT_NOT_ADMITTED', 'cannot bind Component identity to an inactive activation');
|
|
52
|
+
}
|
|
53
|
+
return identity;
|
|
54
|
+
}
|
|
55
|
+
export function componentIdentityOf(context) {
|
|
56
|
+
try {
|
|
57
|
+
return identities.get(ownerKey(context));
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function requireComponentIdentity(context) {
|
|
64
|
+
const identity = componentIdentityOf(context);
|
|
65
|
+
if (identity === undefined) {
|
|
66
|
+
throw new ComponentIdentityError('COMPONENT_NOT_ADMITTED', 'the calling activation has no verified dsh-plugin.json Component identity');
|
|
67
|
+
}
|
|
68
|
+
return identity;
|
|
69
|
+
}
|
|
70
|
+
export function declaresPermission(identity, permission, actualScope) {
|
|
71
|
+
const actual = normalizePermissionScope(permission, actualScope, identity.componentId);
|
|
72
|
+
if (actual === undefined)
|
|
73
|
+
return false;
|
|
74
|
+
return identity.manifest.permissions.some(request => {
|
|
75
|
+
if (request.name !== permission)
|
|
76
|
+
return false;
|
|
77
|
+
const declared = normalizePermissionScope(permission, request.scope, identity.componentId);
|
|
78
|
+
return declared !== undefined && scopeCovers(declared, actual);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export function declaresCommand(identity, commandId) {
|
|
82
|
+
return identity.manifest.contributes.commands.some(command => command.id === commandId);
|
|
83
|
+
}
|
|
84
|
+
export function declaresObserverScope(identity, actualScope) {
|
|
85
|
+
const actual = normalizePermissionScope('messages.observe.read', actualScope, identity.componentId);
|
|
86
|
+
if (actual === undefined)
|
|
87
|
+
return false;
|
|
88
|
+
return identity.manifest.subscriptions.some(subscription => {
|
|
89
|
+
if (typeof subscription === 'string')
|
|
90
|
+
return subscription === 'messages.observe';
|
|
91
|
+
if (subscription.apiVersion !== 'messages.dsh/v1alpha1' || subscription.kind !== 'MessageObserver')
|
|
92
|
+
return false;
|
|
93
|
+
if (subscription.scope === undefined)
|
|
94
|
+
return true;
|
|
95
|
+
const declared = normalizePermissionScope('messages.observe.read', subscription.scope, identity.componentId);
|
|
96
|
+
return declared !== undefined && scopeCovers(declared, actual);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export function requiresDecisionEvents(identity) {
|
|
100
|
+
return requiresContract(identity, 'tui.dsh/v1alpha1', 'DecisionEvents');
|
|
101
|
+
}
|
|
102
|
+
/** Whether admission negotiated the protocol that backs a mediated runtime
|
|
103
|
+
* capability. Permissions alone are not a capability grant: a plugin must
|
|
104
|
+
* explicitly require the corresponding contract before the host can expose
|
|
105
|
+
* its calls. */
|
|
106
|
+
export function requiresContract(identity, apiVersion, kind) {
|
|
107
|
+
return identity.manifest.requires.contracts.some(requirement => requirement.apiVersion === apiVersion && requirement.kind === kind);
|
|
108
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const UPSTREAM_VALIDATED_VERSION = "0.1.0-rc.
|
|
1
|
+
export declare const UPSTREAM_VALIDATED_VERSION = "0.1.0-rc.7";
|
|
2
2
|
/**
|
|
3
3
|
* Framework packages version on their own lines; the contract validates
|
|
4
4
|
* their MAJOR (breaking surface), not the harness rc number.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Upstream compatibility contract.
|
|
3
3
|
*
|
|
4
|
-
* The TUI is validated against one upstream release line (0.1.0-rc.
|
|
4
|
+
* The TUI is validated against one upstream release line (0.1.0-rc.7).
|
|
5
5
|
* Every official package this adapter touches is blessed here; anything
|
|
6
6
|
* else must go through upstream channels or the adapter, never the UI.
|
|
7
7
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { readFileSync } from 'node:fs';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
|
-
export const UPSTREAM_VALIDATED_VERSION = '0.1.0-rc.
|
|
14
|
+
export const UPSTREAM_VALIDATED_VERSION = '0.1.0-rc.7';
|
|
15
15
|
/**
|
|
16
16
|
* Framework packages version on their own lines; the contract validates
|
|
17
17
|
* their MAJOR (breaking surface), not the harness rc number.
|