@deepseek-harness-tui/dsh-tui 0.7.3 → 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 +15 -7
- package/bin/dsh-tui.js +19 -3
- package/cordis.patch.yml +43 -11
- package/cordis.yml +20 -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 +4 -1
- 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 +3 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +29 -5
- package/lib/types/components/PluginSceneBoundary.d.ts +31 -0
- package/lib/types/components/PluginSceneBoundary.d.ts.map +1 -0
- package/lib/types/components/PluginSceneBoundary.js +29 -0
- 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/SkillsPicker.d.ts +18 -0
- package/lib/types/components/SkillsPicker.d.ts.map +1 -0
- package/lib/types/components/SkillsPicker.js +50 -0
- package/lib/types/components/SplitDiffView.d.ts +28 -0
- package/lib/types/components/SplitDiffView.d.ts.map +1 -0
- package/lib/types/components/SplitDiffView.js +417 -0
- 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 +3 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +17 -7
- package/lib/types/dsh-adapter/channel.d.ts +98 -7
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +623 -26
- 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 +2 -2
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +3 -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/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 +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 +106 -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/promptDebug.d.ts +10 -0
- package/lib/types/dsh-adapter/promptDebug.d.ts.map +1 -0
- package/lib/types/dsh-adapter/promptDebug.js +148 -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 +81 -0
- package/lib/types/dsh-adapter/scenes.d.ts.map +1 -0
- package/lib/types/dsh-adapter/scenes.js +93 -0
- package/lib/types/dsh-adapter/settings-sections.d.ts +116 -0
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -0
- package/lib/types/dsh-adapter/settings-sections.js +63 -0
- package/lib/types/dsh-adapter/settingsEditor.d.ts +128 -0
- package/lib/types/dsh-adapter/settingsEditor.d.ts.map +1 -0
- package/lib/types/dsh-adapter/settingsEditor.js +244 -0
- 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 +299 -26
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +89 -8
- 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/jsx-runtime.d.ts +2 -0
- package/lib/types/jsx-runtime.d.ts.map +1 -0
- package/lib/types/jsx-runtime.js +13 -0
- package/lib/types/modelRoute.d.ts +10 -2
- package/lib/types/modelRoute.d.ts.map +1 -1
- package/lib/types/modelRoute.js +33 -4
- 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/scenes.d.ts +3 -0
- package/lib/types/scenes.d.ts.map +1 -0
- package/lib/types/scenes.js +4 -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 +247 -48
- package/lib/types/screens/Settings.d.ts +20 -0
- package/lib/types/screens/Settings.d.ts.map +1 -0
- package/lib/types/screens/Settings.js +333 -0
- package/lib/types/screens/StatusLine.js +1 -1
- package/lib/types/settings-sections.d.ts +3 -0
- package/lib/types/settings-sections.d.ts.map +1 -0
- package/lib/types/settings-sections.js +4 -0
- package/lib/types/theme.d.ts +17 -0
- package/lib/types/theme.d.ts.map +1 -1
- package/lib/types/theme.js +51 -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 +118 -67
- 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
|
@@ -61,8 +61,16 @@ export declare function recordedModelRoute(events: readonly {
|
|
|
61
61
|
* Best-effort combination check (issue #67): when the llm runtime advertises
|
|
62
62
|
* a non-empty catalog for the route's provider and the model is not in it,
|
|
63
63
|
* reject the whole route in favor of `fallback` so a stale persisted choice
|
|
64
|
-
* surfaces at startup instead of as a server-side model-name error.
|
|
65
|
-
*
|
|
64
|
+
* surfaces at startup instead of as a server-side model-name error.
|
|
65
|
+
*
|
|
66
|
+
* Uncertainty trusts the route — no llm service, an empty catalog, a catalog
|
|
67
|
+
* read that failed for transport or adapter-internal reasons. An unregistered
|
|
68
|
+
* PROVIDER is not uncertainty: no adapter owns the name, so the route is
|
|
69
|
+
* proven unusable and falls back exactly like an unknown model does. Trusting
|
|
70
|
+
* it does not keep startup alive either — agent creation dies a few frames
|
|
71
|
+
* later inside the preset setup hook, reported as `refusing to compose an
|
|
72
|
+
* unscoped context`, which names neither the provider nor the stale
|
|
73
|
+
* preference that chose it.
|
|
66
74
|
* @param llm - The llm runtime seam, when mounted.
|
|
67
75
|
* @param route - The resolved route to check.
|
|
68
76
|
* @param fallback - Route to adopt when the check rejects.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelRoute.d.ts","sourceRoot":"","sources":["../../src/modelRoute.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,gCAAgC;AAChC,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wHAAwH;AACxH,eAAO,MAAM,mBAAmB,EAAE,UAGjC,CAAA;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,GAAG,SAAS,CAI5G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACjD,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,QAAQ,GAAE,UAAgC,GACzC,UAAU,CAKZ;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,GAClD,UAAU,GAAG,SAAS,CAWxB;
|
|
1
|
+
{"version":3,"file":"modelRoute.d.ts","sourceRoot":"","sources":["../../src/modelRoute.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,gCAAgC;AAChC,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wHAAwH;AACxH,eAAO,MAAM,mBAAmB,EAAE,UAGjC,CAAA;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,GAAG,SAAS,CAI5G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACjD,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,QAAQ,GAAE,UAAgC,GACzC,UAAU,CAKZ;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,GAClD,UAAU,GAAG,SAAS,CAWxB;AAyBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE;IAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAA;CAAE,GAAG,SAAS,EACrF,KAAK,EAAE,UAAU,EACjB,QAAQ,GAAE,UAAgC,GACzC,OAAO,CAAC;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC,CAWvD"}
|
package/lib/types/modelRoute.js
CHANGED
|
@@ -69,12 +69,39 @@ export function recordedModelRoute(events) {
|
|
|
69
69
|
}
|
|
70
70
|
return undefined;
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* `LlmError` code the adapter registry raises for a provider nobody
|
|
74
|
+
* registered. Matched on the code rather than `instanceof LlmError`: a profile
|
|
75
|
+
* that resolves two copies of the llm package would fail the identity check
|
|
76
|
+
* while the code stays stable, and this module deliberately carries no llm
|
|
77
|
+
* import.
|
|
78
|
+
*/
|
|
79
|
+
const NO_ADAPTER_CODE = 'NO_ADAPTER';
|
|
80
|
+
/**
|
|
81
|
+
* Whether a catalog read failed because the provider itself is unregistered,
|
|
82
|
+
* as opposed to a transport or adapter-internal failure.
|
|
83
|
+
* @param error - The value `listModels` rejected with.
|
|
84
|
+
* @returns True when no adapter owns the queried provider.
|
|
85
|
+
*/
|
|
86
|
+
function isUnregisteredProvider(error) {
|
|
87
|
+
return (typeof error === 'object'
|
|
88
|
+
&& error !== null
|
|
89
|
+
&& error.code === NO_ADAPTER_CODE);
|
|
90
|
+
}
|
|
72
91
|
/**
|
|
73
92
|
* Best-effort combination check (issue #67): when the llm runtime advertises
|
|
74
93
|
* a non-empty catalog for the route's provider and the model is not in it,
|
|
75
94
|
* reject the whole route in favor of `fallback` so a stale persisted choice
|
|
76
|
-
* surfaces at startup instead of as a server-side model-name error.
|
|
77
|
-
*
|
|
95
|
+
* surfaces at startup instead of as a server-side model-name error.
|
|
96
|
+
*
|
|
97
|
+
* Uncertainty trusts the route — no llm service, an empty catalog, a catalog
|
|
98
|
+
* read that failed for transport or adapter-internal reasons. An unregistered
|
|
99
|
+
* PROVIDER is not uncertainty: no adapter owns the name, so the route is
|
|
100
|
+
* proven unusable and falls back exactly like an unknown model does. Trusting
|
|
101
|
+
* it does not keep startup alive either — agent creation dies a few frames
|
|
102
|
+
* later inside the preset setup hook, reported as `refusing to compose an
|
|
103
|
+
* unscoped context`, which names neither the provider nor the stale
|
|
104
|
+
* preference that chose it.
|
|
78
105
|
* @param llm - The llm runtime seam, when mounted.
|
|
79
106
|
* @param route - The resolved route to check.
|
|
80
107
|
* @param fallback - Route to adopt when the check rejects.
|
|
@@ -87,8 +114,10 @@ export async function validateModelRoute(llm, route, fallback = DEFAULT_MODEL_RO
|
|
|
87
114
|
try {
|
|
88
115
|
models = await llm.listModels(route.provider);
|
|
89
116
|
}
|
|
90
|
-
catch {
|
|
91
|
-
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (!isUnregisteredProvider(error))
|
|
119
|
+
return { route };
|
|
120
|
+
return { route: fallback, rejected: route };
|
|
92
121
|
}
|
|
93
122
|
if (models.length === 0 || models.some(model => model.id === route.model))
|
|
94
123
|
return { route };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './dsh-adapter/plugin-host.js';
|
|
2
|
+
export * from './dsh-adapter/grants.js';
|
|
3
|
+
export * from './dsh-adapter/host-descriptor.js';
|
|
4
|
+
export * from './dsh-adapter/plugin-storage.js';
|
|
5
|
+
export * from './dsh-adapter/message-observer.js';
|
|
6
|
+
export * from './dsh-adapter/effect-ledger.js';
|
|
7
|
+
export * from './dsh-adapter/command-errors.js';
|
|
8
|
+
export { commandOwner, fiberNameOf, stampCommandOwner, unstampCommandOwner } from './dsh-adapter/command-attribution.js';
|
|
9
|
+
export { DECISION_EVENT_PERMISSIONS, decisionHandlersOf, registerDecisionHandler, withDecisionRegistration, } from './dsh-adapter/decision-guard.js';
|
|
10
|
+
export { DECISION_HANDLER_TIMEOUT_MS, DECISION_TOTAL_TIMEOUT_MS, dispatchTuiNotification, } from './dsh-adapter/extension-events.js';
|
|
11
|
+
export { DECISION_EVENTS_COORDINATE, TUI_EXTENSION_API_VERSION, TUI_DECISION_EVENT_NAMES, TUI_EXTENSION_PERMISSION_NAMES, createAdmissionCatalog, } from './plugin-spec/tui-extension.js';
|
|
12
|
+
export type { ContractCoordinate, ContractRef, HostContract, HostDescriptor, NegotiationDecision, PermissionEntry, PermissionRegistry, } from './plugin-spec/types.js';
|
|
13
|
+
//# sourceMappingURL=plugin-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-host.d.ts","sourceRoot":"","sources":["../../src/plugin-host.ts"],"names":[],"mappings":"AAMA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AACxH,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,gCAAgC,CAAA;AAEvC,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,kBAAkB,GACnB,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Re-export shim: the Cordis-backed implementation lives behind the adapter
|
|
2
|
+
// boundary so UI consumers never import official @deepseek-ai/* packages.
|
|
3
|
+
// Plugin authors import the plugin-host types from here
|
|
4
|
+
// (`@deepseek-harness-tui/dsh-tui/plugin-host`); importing the module also
|
|
5
|
+
// applies the `declare module '@deepseek-ai/cordis'` augmentation for the
|
|
6
|
+
// `tuiPluginHost` property on Context.
|
|
7
|
+
export * from './dsh-adapter/plugin-host.js';
|
|
8
|
+
export * from './dsh-adapter/grants.js';
|
|
9
|
+
export * from './dsh-adapter/host-descriptor.js';
|
|
10
|
+
export * from './dsh-adapter/plugin-storage.js';
|
|
11
|
+
export * from './dsh-adapter/message-observer.js';
|
|
12
|
+
export * from './dsh-adapter/effect-ledger.js';
|
|
13
|
+
export * from './dsh-adapter/command-errors.js';
|
|
14
|
+
export { commandOwner, fiberNameOf, stampCommandOwner, unstampCommandOwner } from './dsh-adapter/command-attribution.js';
|
|
15
|
+
export { DECISION_EVENT_PERMISSIONS, decisionHandlersOf, registerDecisionHandler, withDecisionRegistration, } from './dsh-adapter/decision-guard.js';
|
|
16
|
+
export { DECISION_HANDLER_TIMEOUT_MS, DECISION_TOTAL_TIMEOUT_MS, dispatchTuiNotification, } from './dsh-adapter/extension-events.js';
|
|
17
|
+
export { DECISION_EVENTS_COORDINATE, TUI_EXTENSION_API_VERSION, TUI_DECISION_EVENT_NAMES, TUI_EXTENSION_PERMISSION_NAMES, createAdmissionCatalog, } from './plugin-spec/tui-extension.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Five-state admission decision using dsh-std projection and ProtocolCatalog. */
|
|
2
|
+
import type { ContractIndex } from './validate.js';
|
|
3
|
+
import type { HostDescriptor, NegotiationDecision, PluginManifest } from './types.js';
|
|
4
|
+
export interface GrantedPermission {
|
|
5
|
+
name: string;
|
|
6
|
+
scope: string;
|
|
7
|
+
/** Explicit effective answer. Omitted means a legacy positive grant row. */
|
|
8
|
+
granted?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function negotiate(index: ContractIndex, manifest: PluginManifest, host: HostDescriptor, grants?: readonly GrantedPermission[]): NegotiationDecision;
|
|
11
|
+
//# sourceMappingURL=negotiate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiate.d.ts","sourceRoot":"","sources":["../../../src/plugin-spec/negotiate.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAIlF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,KAAK,EAAE,cAAc,EAAsB,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAIzG,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,SAAS,CACvB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,cAAc,EACpB,MAAM,GAAE,SAAS,iBAAiB,EAAO,GACxC,mBAAmB,CA6FrB"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** Five-state admission decision using dsh-std projection and ProtocolCatalog. */
|
|
2
|
+
import { defineProtocolDeclaration } from '@dsh-std/core';
|
|
3
|
+
import { projectManifest } from '@dsh-std/manifest';
|
|
4
|
+
import { rawScopeCovers } from './permission-scope.js';
|
|
5
|
+
const coordinateKey = (ref) => `${ref.apiVersion}#${ref.kind}`;
|
|
6
|
+
export function negotiate(index, manifest, host, grants = []) {
|
|
7
|
+
const supported = new Map(host.contracts.map(contract => [coordinateKey(contract), contract]));
|
|
8
|
+
const required = manifest.requires.contracts.filter(reference => reference.optional !== true);
|
|
9
|
+
const optional = manifest.requires.contracts.filter(reference => reference.optional === true);
|
|
10
|
+
const unknown = manifest.requires.contracts.filter(reference => {
|
|
11
|
+
try {
|
|
12
|
+
return index.resolveContractRef(reference).unregisteredVersion;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
if (unknown.length > 0) {
|
|
19
|
+
return {
|
|
20
|
+
decision: 'unknown',
|
|
21
|
+
reasonCode: 'UNKNOWN_PROTOCOL_VERSION',
|
|
22
|
+
unknownContracts: unknown.map(coordinateKey),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (!host.facetApiVersions.includes(manifest.facets.host.apiVersion)) {
|
|
26
|
+
return {
|
|
27
|
+
decision: 'rejected',
|
|
28
|
+
reasonCode: 'FACET_API_VERSION_UNAVAILABLE',
|
|
29
|
+
facetApiVersion: manifest.facets.host.apiVersion,
|
|
30
|
+
hostFacetApiVersions: host.facetApiVersions,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const missingRequired = required.filter(reference => !supported.has(coordinateKey(reference)));
|
|
34
|
+
const missingOptional = optional.filter(reference => !supported.has(coordinateKey(reference)));
|
|
35
|
+
if (missingRequired.length > 0) {
|
|
36
|
+
return {
|
|
37
|
+
decision: 'rejected',
|
|
38
|
+
reasonCode: 'REQUIRED_PROTOCOL_UNAVAILABLE',
|
|
39
|
+
missingRequired: missingRequired.map(coordinateKey),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const projected = projectManifest(manifest);
|
|
43
|
+
const facet = projected.spec.facets.find(candidate => candidate.name === 'host');
|
|
44
|
+
const supportedKeys = new Set(host.contracts.map(contract => coordinateKey(contract)));
|
|
45
|
+
const declaration = defineProtocolDeclaration({
|
|
46
|
+
participant: { id: manifest.id },
|
|
47
|
+
// An optional protocol that is absent is intentionally omitted from the
|
|
48
|
+
// evaluator input; its degraded state was already recorded above. This
|
|
49
|
+
// keeps ProtocolCatalog's required-support error meaningful for every
|
|
50
|
+
// remaining requirement.
|
|
51
|
+
requires: (facet?.protocols?.requires ?? []).filter(reference => reference.optional !== true || supportedKeys.has(coordinateKey(reference))),
|
|
52
|
+
});
|
|
53
|
+
const hostDeclaration = defineProtocolDeclaration({
|
|
54
|
+
participant: { id: host.hostId },
|
|
55
|
+
supports: host.contracts.map(contract => ({
|
|
56
|
+
apiVersion: contract.apiVersion,
|
|
57
|
+
kind: contract.kind,
|
|
58
|
+
...(Object.hasOwn(contract, 'spec') ? { spec: contract.spec } : {}),
|
|
59
|
+
})),
|
|
60
|
+
});
|
|
61
|
+
const report = index.protocols.negotiate([declaration, hostDeclaration]);
|
|
62
|
+
if (!report.compatible) {
|
|
63
|
+
return {
|
|
64
|
+
decision: 'rejected',
|
|
65
|
+
reasonCode: 'PROTOCOL_NEGOTIATION_FAILED',
|
|
66
|
+
issues: report.issues,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const hostPermissions = new Set(host.contracts.flatMap(contract => contract.permissions));
|
|
70
|
+
const denied = manifest.permissions.filter((request) => {
|
|
71
|
+
if (!hostPermissions.has(request.name))
|
|
72
|
+
return true;
|
|
73
|
+
const definition = index.permissions.permissions.find(permission => permission.name === request.name);
|
|
74
|
+
if (definition === undefined)
|
|
75
|
+
return true;
|
|
76
|
+
const matching = grants.filter(grant => grant.name === request.name
|
|
77
|
+
&& rawScopeCovers(grant.name, grant.scope, request.scope, manifest.id));
|
|
78
|
+
// Explicit revocation wins over an allow-default permission. This keeps
|
|
79
|
+
// admission diagnostics aligned with the runtime checkpoint instead of
|
|
80
|
+
// reporting a plugin as compatible until its first invocation fails.
|
|
81
|
+
if (matching.some(grant => grant.granted === false))
|
|
82
|
+
return true;
|
|
83
|
+
if (definition.default === 'allow')
|
|
84
|
+
return false;
|
|
85
|
+
return !matching.some(grant => grant.granted !== false);
|
|
86
|
+
});
|
|
87
|
+
if (denied.length > 0) {
|
|
88
|
+
return {
|
|
89
|
+
decision: 'waiting_authorization',
|
|
90
|
+
reasonCode: 'PERMISSION_NOT_GRANTED',
|
|
91
|
+
deniedPermissions: denied.map(request => `${request.name}@${request.scope}`),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return missingOptional.length > 0
|
|
95
|
+
? { decision: 'compatible_degraded', missingOptional: missingOptional.map(coordinateKey) }
|
|
96
|
+
: { decision: 'compatible' };
|
|
97
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Permission scope normalization shared by admission and runtime checks. */
|
|
2
|
+
export declare const STORAGE_PERMISSIONS: Set<string>;
|
|
3
|
+
export declare const INTERCEPT_PERMISSIONS: Set<string>;
|
|
4
|
+
/** The decision point controlled by each intercept permission. Keeping this
|
|
5
|
+
* mapping in the scope adapter (rather than accepting every `tui/*` name for
|
|
6
|
+
* every permission) prevents a manifest or grant from silently crossing an
|
|
7
|
+
* event boundary. */
|
|
8
|
+
export declare const INTERCEPT_EVENT_SCOPE_BY_PERMISSION: Readonly<Record<string, string>>;
|
|
9
|
+
/** A session scope is carried through the message envelope and may also be
|
|
10
|
+
* used by an intercept grant. Keep the canonical bound here so admission,
|
|
11
|
+
* grant evaluation, and runtime delivery cannot disagree about whether a
|
|
12
|
+
* scope is executable. */
|
|
13
|
+
export declare const SESSION_SCOPE_MAX_CHARS = 256;
|
|
14
|
+
export type ScopeKind = 'component' | 'command' | 'session' | 'event';
|
|
15
|
+
export interface NormalizedPermissionScope {
|
|
16
|
+
kind: ScopeKind;
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
/** Return undefined when this adapter cannot enforce the supplied scope. */
|
|
20
|
+
export declare function normalizePermissionScope(permission: string, scope: string, componentId: string): NormalizedPermissionScope | undefined;
|
|
21
|
+
export declare function scopeCovers(declared: NormalizedPermissionScope, actual: NormalizedPermissionScope): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Permission-aware containment. An event-point grant is the parent scope of
|
|
24
|
+
* the sessions delivered through that point, while a session grant can never
|
|
25
|
+
* be promoted into an event-point grant. This relation is also used for
|
|
26
|
+
* denies, so a narrow `session:<id>` deny wins over a broad event grant.
|
|
27
|
+
*/
|
|
28
|
+
export declare function permissionScopeCovers(permission: string, declared: NormalizedPermissionScope, actual: NormalizedPermissionScope): boolean;
|
|
29
|
+
/** Decision permission scopes may be expressed as one named event point. */
|
|
30
|
+
export declare const TUI_EVENT_SCOPE_NAMES: Set<string>;
|
|
31
|
+
export declare function rawScopeCovers(permission: string, declared: string, actual: string, componentId: string): boolean;
|
|
32
|
+
//# sourceMappingURL=permission-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-scope.d.ts","sourceRoot":"","sources":["../../../src/plugin-spec/permission-scope.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,eAAO,MAAM,mBAAmB,aAAyD,CAAA;AACzF,eAAO,MAAM,qBAAqB,aAKhC,CAAA;AAEF;;;qBAGqB;AACrB,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAK/E,CAAA;AAEF;;;0BAG0B;AAC1B,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAI1C,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAErE,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,4EAA4E;AAC5E,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,yBAAyB,GAAG,SAAS,CA2BvC;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,yBAAyB,EAAE,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAI3G;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,yBAAyB,EACnC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAKT;AAED,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,aAOhC,CAAA;AAEF,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAMjH"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Permission scope normalization shared by admission and runtime checks. */
|
|
2
|
+
export const STORAGE_PERMISSIONS = new Set(['storage.local.read', 'storage.local.write']);
|
|
3
|
+
export const INTERCEPT_PERMISSIONS = new Set([
|
|
4
|
+
'session.input.intercept',
|
|
5
|
+
'session.rewind.intercept',
|
|
6
|
+
'session.switch.intercept',
|
|
7
|
+
'session.compact.intercept',
|
|
8
|
+
]);
|
|
9
|
+
/** The decision point controlled by each intercept permission. Keeping this
|
|
10
|
+
* mapping in the scope adapter (rather than accepting every `tui/*` name for
|
|
11
|
+
* every permission) prevents a manifest or grant from silently crossing an
|
|
12
|
+
* event boundary. */
|
|
13
|
+
export const INTERCEPT_EVENT_SCOPE_BY_PERMISSION = Object.freeze({
|
|
14
|
+
'session.input.intercept': 'tui/input',
|
|
15
|
+
'session.rewind.intercept': 'tui/rewind-prompt',
|
|
16
|
+
'session.switch.intercept': 'tui/session-switch',
|
|
17
|
+
'session.compact.intercept': 'tui/compact',
|
|
18
|
+
});
|
|
19
|
+
/** A session scope is carried through the message envelope and may also be
|
|
20
|
+
* used by an intercept grant. Keep the canonical bound here so admission,
|
|
21
|
+
* grant evaluation, and runtime delivery cannot disagree about whether a
|
|
22
|
+
* scope is executable. */
|
|
23
|
+
export const SESSION_SCOPE_MAX_CHARS = 256;
|
|
24
|
+
const CONTROL_CHARS = /[\x00-\x1f\x7f-\x9f]/u;
|
|
25
|
+
/** Return undefined when this adapter cannot enforce the supplied scope. */
|
|
26
|
+
export function normalizePermissionScope(permission, scope, componentId) {
|
|
27
|
+
if (typeof scope !== 'string' || scope === '')
|
|
28
|
+
return undefined;
|
|
29
|
+
if (STORAGE_PERMISSIONS.has(permission)) {
|
|
30
|
+
return scope === componentId ? { kind: 'component', value: componentId } : undefined;
|
|
31
|
+
}
|
|
32
|
+
if (permission === 'commands.invoke') {
|
|
33
|
+
return /^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$/u.test(scope)
|
|
34
|
+
? { kind: 'command', value: scope }
|
|
35
|
+
: undefined;
|
|
36
|
+
}
|
|
37
|
+
if (INTERCEPT_PERMISSIONS.has(permission) && TUI_EVENT_SCOPE_NAMES.has(scope)) {
|
|
38
|
+
return INTERCEPT_EVENT_SCOPE_BY_PERMISSION[permission] === scope
|
|
39
|
+
? { kind: 'event', value: scope }
|
|
40
|
+
: undefined;
|
|
41
|
+
}
|
|
42
|
+
if (permission === 'messages.observe.read' || INTERCEPT_PERMISSIONS.has(permission)) {
|
|
43
|
+
if (scope === 'session:*')
|
|
44
|
+
return { kind: 'session', value: scope };
|
|
45
|
+
if (scope.startsWith('session:')
|
|
46
|
+
&& scope.length <= SESSION_SCOPE_MAX_CHARS
|
|
47
|
+
&& scope.length > 'session:'.length
|
|
48
|
+
&& !scope.includes('*')
|
|
49
|
+
&& !CONTROL_CHARS.test(scope)) {
|
|
50
|
+
return { kind: 'session', value: scope };
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
export function scopeCovers(declared, actual) {
|
|
57
|
+
if (declared.kind !== actual.kind)
|
|
58
|
+
return false;
|
|
59
|
+
return declared.value === actual.value
|
|
60
|
+
|| (declared.kind === 'session' && declared.value === 'session:*' && actual.value.startsWith('session:'));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Permission-aware containment. An event-point grant is the parent scope of
|
|
64
|
+
* the sessions delivered through that point, while a session grant can never
|
|
65
|
+
* be promoted into an event-point grant. This relation is also used for
|
|
66
|
+
* denies, so a narrow `session:<id>` deny wins over a broad event grant.
|
|
67
|
+
*/
|
|
68
|
+
export function permissionScopeCovers(permission, declared, actual) {
|
|
69
|
+
if (scopeCovers(declared, actual))
|
|
70
|
+
return true;
|
|
71
|
+
return INTERCEPT_PERMISSIONS.has(permission)
|
|
72
|
+
&& declared.kind === 'event'
|
|
73
|
+
&& actual.kind === 'session';
|
|
74
|
+
}
|
|
75
|
+
/** Decision permission scopes may be expressed as one named event point. */
|
|
76
|
+
export const TUI_EVENT_SCOPE_NAMES = new Set([
|
|
77
|
+
'tui/input',
|
|
78
|
+
'tui/rewind-prompt',
|
|
79
|
+
'tui/rewind-done',
|
|
80
|
+
'tui/session-switch',
|
|
81
|
+
'tui/session-switched',
|
|
82
|
+
'tui/compact',
|
|
83
|
+
]);
|
|
84
|
+
export function rawScopeCovers(permission, declared, actual, componentId) {
|
|
85
|
+
const normalizedDeclared = normalizePermissionScope(permission, declared, componentId);
|
|
86
|
+
const normalizedActual = normalizePermissionScope(permission, actual, componentId);
|
|
87
|
+
return normalizedDeclared !== undefined
|
|
88
|
+
&& normalizedActual !== undefined
|
|
89
|
+
&& permissionScopeCovers(permission, normalizedDeclared, normalizedActual);
|
|
90
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Load and verify the pinned dsh-TUI admission profile. */
|
|
2
|
+
import type { ContractRegistry, PermissionRegistry, RegistryEntry } from './types.js';
|
|
3
|
+
export declare const DSH_STD_REVISION = "a2faa86243a5693ee4970e3d8b3aaf361edea298";
|
|
4
|
+
export declare const ECOSYSTEM_SPEC_REVISION = "be1e9a219bd01decf79d825e0c3ac1685bde2be4";
|
|
5
|
+
export interface SpecData {
|
|
6
|
+
dir: string;
|
|
7
|
+
registry: ContractRegistry;
|
|
8
|
+
permissions: PermissionRegistry;
|
|
9
|
+
schemas: {
|
|
10
|
+
host: Record<string, unknown>;
|
|
11
|
+
ledger: Record<string, unknown>;
|
|
12
|
+
claim: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare function locateSpecDir(start?: string): string | undefined;
|
|
16
|
+
export declare function loadSpecData(dir?: string | undefined): SpecData | undefined;
|
|
17
|
+
export declare function registryEntries(registry: ContractRegistry): RegistryEntry[];
|
|
18
|
+
export declare function digestFile(dir: string, relative: string): `sha256:${string}`;
|
|
19
|
+
/** Verify definition availability and private profile digest pins. */
|
|
20
|
+
export declare function verifyRegistry(data: SpecData): string[];
|
|
21
|
+
/** Verify the TUI-owned definitions; public definitions live in dsh-std. */
|
|
22
|
+
export declare function verifyContractProfiles(data: SpecData): string[];
|
|
23
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/plugin-spec/registry.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAO5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAErF,eAAO,MAAM,gBAAgB,6CAA6C,CAAA;AAC1E,eAAO,MAAM,uBAAuB,6CAA6C,CAAA;AAEjF,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC/B,CAAA;CACF;AAID,wBAAgB,aAAa,CAAC,KAAK,GAAE,MAAgD,GAAG,MAAM,GAAG,SAAS,CASzG;AA0CD,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,GAAG,SAA2B,GAAG,QAAQ,GAAG,SAAS,CAiB5F;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAI3E;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,MAAM,EAAE,CAE5E;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAsBvD;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAiC/D"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/** Load and verify the pinned dsh-TUI admission profile. */
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { createAdmissionCatalog } from './tui-extension.js';
|
|
7
|
+
export const DSH_STD_REVISION = 'a2faa86243a5693ee4970e3d8b3aaf361edea298';
|
|
8
|
+
export const ECOSYSTEM_SPEC_REVISION = 'be1e9a219bd01decf79d825e0c3ac1685bde2be4';
|
|
9
|
+
const REGISTRY_FILE = join('registry', 'registry-0.15.json');
|
|
10
|
+
export function locateSpecDir(start = dirname(fileURLToPath(import.meta.url))) {
|
|
11
|
+
let dir = start;
|
|
12
|
+
for (let index = 0; index < 8; index++) {
|
|
13
|
+
if (existsSync(join(dir, 'ecosystem-spec', REGISTRY_FILE)))
|
|
14
|
+
return join(dir, 'ecosystem-spec');
|
|
15
|
+
const parent = dirname(dir);
|
|
16
|
+
if (parent === dir)
|
|
17
|
+
return undefined;
|
|
18
|
+
dir = parent;
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
function loadJson(dir, relative) {
|
|
23
|
+
return JSON.parse(readFileSync(join(dir, relative), 'utf8'));
|
|
24
|
+
}
|
|
25
|
+
function isRecord(value) {
|
|
26
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
27
|
+
}
|
|
28
|
+
function soundEntry(value, privateDefinition) {
|
|
29
|
+
if (!isRecord(value) || typeof value.name !== 'string' || typeof value.kind !== 'string')
|
|
30
|
+
return false;
|
|
31
|
+
if (!isRecord(value.coordinates)
|
|
32
|
+
|| typeof value.coordinates.apiVersion !== 'string'
|
|
33
|
+
|| typeof value.coordinates.kind !== 'string')
|
|
34
|
+
return false;
|
|
35
|
+
if (!Array.isArray(value.permissions) || !value.permissions.every(permission => typeof permission === 'string'))
|
|
36
|
+
return false;
|
|
37
|
+
if (privateDefinition) {
|
|
38
|
+
return value.authority === 'dsh-tui'
|
|
39
|
+
&& typeof value.profile === 'string'
|
|
40
|
+
&& typeof value.profileHash === 'string';
|
|
41
|
+
}
|
|
42
|
+
return typeof value.package === 'string' && value.package.startsWith('@dsh-std/');
|
|
43
|
+
}
|
|
44
|
+
function structurallySound(data) {
|
|
45
|
+
if (!isRecord(data.registry)
|
|
46
|
+
|| typeof data.registry.profileVersion !== 'string'
|
|
47
|
+
|| !isRecord(data.registry.std)
|
|
48
|
+
|| !Array.isArray(data.registry.imports)
|
|
49
|
+
|| !Array.isArray(data.registry.definitions)
|
|
50
|
+
|| !Array.isArray(data.registry.facetApiVersions)
|
|
51
|
+
|| !data.registry.facetApiVersions.every(version => typeof version === 'string'))
|
|
52
|
+
return false;
|
|
53
|
+
if (!data.registry.imports.every(entry => soundEntry(entry, false)))
|
|
54
|
+
return false;
|
|
55
|
+
if (!data.registry.definitions.every(entry => soundEntry(entry, true)))
|
|
56
|
+
return false;
|
|
57
|
+
if (!isRecord(data.permissions) || !Array.isArray(data.permissions.permissions))
|
|
58
|
+
return false;
|
|
59
|
+
for (const permission of data.permissions.permissions) {
|
|
60
|
+
if (!isRecord(permission) || typeof permission.name !== 'string'
|
|
61
|
+
|| (permission.default !== 'allow' && permission.default !== 'deny'))
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return Object.values(data.schemas).every(isRecord);
|
|
65
|
+
}
|
|
66
|
+
export function loadSpecData(dir = locateSpecDir()) {
|
|
67
|
+
if (dir === undefined)
|
|
68
|
+
return undefined;
|
|
69
|
+
try {
|
|
70
|
+
const data = {
|
|
71
|
+
dir,
|
|
72
|
+
registry: loadJson(dir, REGISTRY_FILE),
|
|
73
|
+
permissions: loadJson(dir, join('registry', 'permissions-0.1.json')),
|
|
74
|
+
schemas: {
|
|
75
|
+
host: loadJson(dir, join('schemas', 'host-descriptor.schema.json')),
|
|
76
|
+
ledger: loadJson(dir, join('schemas', 'effect-ledger-record.schema.json')),
|
|
77
|
+
claim: loadJson(dir, join('schemas', 'conformance-claim.schema.json')),
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
return structurallySound(data) ? data : undefined;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function registryEntries(registry) {
|
|
87
|
+
return Array.isArray(registry.imports) && Array.isArray(registry.definitions)
|
|
88
|
+
? [...registry.imports, ...registry.definitions]
|
|
89
|
+
: [];
|
|
90
|
+
}
|
|
91
|
+
export function digestFile(dir, relative) {
|
|
92
|
+
return `sha256:${createHash('sha256').update(readFileSync(join(dir, relative))).digest('hex')}`;
|
|
93
|
+
}
|
|
94
|
+
/** Verify definition availability and private profile digest pins. */
|
|
95
|
+
export function verifyRegistry(data) {
|
|
96
|
+
const failures = [];
|
|
97
|
+
if (!Array.isArray(data.registry.imports)
|
|
98
|
+
|| !Array.isArray(data.registry.definitions)) {
|
|
99
|
+
return ['registry imports/definitions are malformed'];
|
|
100
|
+
}
|
|
101
|
+
const { protocols } = createAdmissionCatalog();
|
|
102
|
+
for (const entry of registryEntries(data.registry)) {
|
|
103
|
+
const key = `${entry.coordinates.apiVersion}#${entry.coordinates.kind}`;
|
|
104
|
+
if (!protocols.understands(entry.coordinates))
|
|
105
|
+
failures.push(`${key}: ProtocolCatalog definition unavailable`);
|
|
106
|
+
if ('profile' in entry) {
|
|
107
|
+
let actual;
|
|
108
|
+
try {
|
|
109
|
+
actual = digestFile(data.dir, entry.profile);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
failures.push(`${entry.name}: private profile unreadable (${entry.profile})`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (actual !== entry.profileHash)
|
|
116
|
+
failures.push(`${entry.name}: profileHash drifted (registry ${entry.profileHash}, actual ${actual})`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return failures;
|
|
120
|
+
}
|
|
121
|
+
/** Verify the TUI-owned definitions; public definitions live in dsh-std. */
|
|
122
|
+
export function verifyContractProfiles(data) {
|
|
123
|
+
const requiredKeys = [
|
|
124
|
+
'name', 'version', 'kind', 'coordinates', 'caller', 'permissions',
|
|
125
|
+
'errors', 'concurrency', 'timeout', 'cleanup', 'privacyClass', 'securityBoundary',
|
|
126
|
+
];
|
|
127
|
+
const failures = [];
|
|
128
|
+
if (!Array.isArray(data.registry.definitions)) {
|
|
129
|
+
return ['registry definitions are malformed'];
|
|
130
|
+
}
|
|
131
|
+
for (const entry of data.registry.definitions) {
|
|
132
|
+
let profile;
|
|
133
|
+
try {
|
|
134
|
+
profile = loadJson(data.dir, entry.profile);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
failures.push(`${entry.name}: private profile unreadable (${entry.profile})`);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
for (const key of requiredKeys) {
|
|
141
|
+
if (!(key in profile))
|
|
142
|
+
failures.push(`${entry.name}: contract profile missing "${key}"`);
|
|
143
|
+
}
|
|
144
|
+
const coordinates = profile.coordinates;
|
|
145
|
+
if (coordinates?.apiVersion !== entry.coordinates.apiVersion || coordinates.kind !== entry.coordinates.kind) {
|
|
146
|
+
failures.push(`${entry.name}: profile/registry coordinates mismatch`);
|
|
147
|
+
}
|
|
148
|
+
const actualPermissions = [...(profile.permissions ?? [])].sort();
|
|
149
|
+
if (JSON.stringify(actualPermissions) !== JSON.stringify([...entry.permissions].sort())) {
|
|
150
|
+
failures.push(`${entry.name}: profile/registry permissions mismatch`);
|
|
151
|
+
}
|
|
152
|
+
if (!('operations' in profile) || profile.securityBoundary !== false) {
|
|
153
|
+
failures.push(`${entry.name}: capability boundary is incomplete`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return failures;
|
|
157
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 零依赖 JSON Schema 校验器——上游 `conformance/tests/run.js` 的 check()
|
|
3
|
+
* 的保真 TS 移植。刻意只实现 vendored schemas 用到的子集:本地 $ref、
|
|
4
|
+
* oneOf(恰好一个匹配)、const/enum、object(required/additionalProperties:
|
|
5
|
+
* false/patternProperties)、array(min/maxItems/items/uniqueItems)、
|
|
6
|
+
* string(min/maxLength/pattern/format uri|date-time)、integer(minimum)、
|
|
7
|
+
* boolean。遇到子集之外的构件不静默放行——schema 更新引入新构件时这里
|
|
8
|
+
* 必须显式扩展(fixtures 矩阵会当场抓住)。
|
|
9
|
+
*/
|
|
10
|
+
type JsonSchema = Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Validate `value` against `schema`; throws an Error with the failing path
|
|
13
|
+
* (`$.a.b[0]: reason`) on the first violation.
|
|
14
|
+
*/
|
|
15
|
+
export declare function check(value: unknown, schema: JsonSchema, rootSchema?: JsonSchema, where?: string): void;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=schema-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-check.d.ts","sourceRoot":"","sources":["../../../src/plugin-spec/schema-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAqCzC;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAE,UAAmB,EAAE,KAAK,SAAM,GAAG,IAAI,CA0G5G"}
|