@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
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
import { assertVersionRange, parseSemanticVersion, protocolKey, validateApiReference } from "@dsh-std/core";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
const COMMUNITY_V015_MANIFEST_VERSION = "0.15";
|
|
4
|
+
const COMPONENT_API_VERSION = "manifest.dsh/internal/v1alpha1";
|
|
5
|
+
const COMMUNITY_PERMISSION_API_VERSION = "community.dsh/v1alpha1";
|
|
6
|
+
const COMMUNITY_PERMISSION_KIND = "Permission";
|
|
7
|
+
const COMPONENT_ID = /^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$/u;
|
|
8
|
+
const LOCAL_NAME = /^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)*$/u;
|
|
9
|
+
var ManifestDefinitionCatalog = class {
|
|
10
|
+
validator;
|
|
11
|
+
activations = /* @__PURE__ */ new Map();
|
|
12
|
+
extensions = /* @__PURE__ */ new Map();
|
|
13
|
+
constructor(validator = Object.freeze({
|
|
14
|
+
name: "@dsh-std/manifest",
|
|
15
|
+
version: "0.1.0"
|
|
16
|
+
})) {
|
|
17
|
+
this.validator = validator;
|
|
18
|
+
nonEmpty(validator.name, "validator.name");
|
|
19
|
+
nonEmpty(validator.version, "validator.version");
|
|
20
|
+
}
|
|
21
|
+
registerActivation(definition) {
|
|
22
|
+
return registerDefinition(this.activations, definition, "activation");
|
|
23
|
+
}
|
|
24
|
+
registerExtension(definition) {
|
|
25
|
+
return registerDefinition(this.extensions, definition, "extension");
|
|
26
|
+
}
|
|
27
|
+
activation(reference) {
|
|
28
|
+
return this.activations.get(protocolKey(reference));
|
|
29
|
+
}
|
|
30
|
+
extension(reference) {
|
|
31
|
+
return this.extensions.get(protocolKey(reference));
|
|
32
|
+
}
|
|
33
|
+
validate(manifestValue, protocols, options = {}) {
|
|
34
|
+
const manifest = defineComponentManifest(manifestValue);
|
|
35
|
+
const issues = [];
|
|
36
|
+
for (const [facetIndex, facet] of manifest.spec.facets.entries()) {
|
|
37
|
+
const base = `/spec/facets/${facetIndex}`;
|
|
38
|
+
if (facet.activation !== void 0) {
|
|
39
|
+
const definition = this.activation(facet.activation);
|
|
40
|
+
if (definition === void 0) issues.push(issue("unknown-activation", "warning", `${base}/activation`, "activation definition is not installed"));
|
|
41
|
+
else try {
|
|
42
|
+
definition.validateSpec(facet.activation.spec);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
issues.push(issue("invalid-activation", "error", `${base}/activation/spec`, errorMessage(error)));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
for (const direction of ["requires", "supports"]) for (const [index, row] of (facet.protocols?.[direction] ?? []).entries()) if (protocols !== void 0 && !protocols.understands(row)) issues.push(issue("unknown-protocol", "warning", `${base}/protocols/${direction}/${index}`, `protocol ${row.apiVersion} ${row.kind} is unknown`));
|
|
48
|
+
for (const [index, extension] of (facet.extensions ?? []).entries()) {
|
|
49
|
+
const definition = this.extension(extension);
|
|
50
|
+
if (definition === void 0) issues.push(issue("unknown-extension", "warning", `${base}/extensions/${index}`, "extension definition is not installed"));
|
|
51
|
+
else try {
|
|
52
|
+
definition.validateMetadata?.(extension.metadata);
|
|
53
|
+
definition.validateSpec(extension.spec);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
issues.push(issue("invalid-extension", "error", `${base}/extensions/${index}`, errorMessage(error)));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return Object.freeze({
|
|
60
|
+
apiVersion: "manifest.dsh/report/v1alpha1",
|
|
61
|
+
validator: Object.freeze({ ...this.validator }),
|
|
62
|
+
source: options.source ?? "memory:",
|
|
63
|
+
digest: options.digest ?? manifestDigest(manifest),
|
|
64
|
+
manifest: Object.freeze({
|
|
65
|
+
name: manifest.metadata.name,
|
|
66
|
+
version: manifest.metadata.version
|
|
67
|
+
}),
|
|
68
|
+
compatible: !issues.some((row) => row.severity === "error"),
|
|
69
|
+
issues: Object.freeze(issues)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/** Parse the package-root dsh-plugin.json without executing plugin code or fetching a schema. */
|
|
74
|
+
function parseManifest(source, options = {}) {
|
|
75
|
+
if (typeof source !== "string") throw new TypeError("manifest source must be a string");
|
|
76
|
+
let value;
|
|
77
|
+
try {
|
|
78
|
+
value = JSON.parse(source);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
throw new SyntaxError(`${options.source ?? "dsh-plugin.json"}: ${errorMessage(error)}`, { cause: error });
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
return defineManifest(value);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
throw new TypeError(`${options.source ?? "dsh-plugin.json"}: ${errorMessage(error)}`, { cause: error });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function defineManifest(manifest) {
|
|
89
|
+
validateManifest(manifest);
|
|
90
|
+
return deepFreeze(structuredClone(manifest));
|
|
91
|
+
}
|
|
92
|
+
function validateManifest(value) {
|
|
93
|
+
if (!record(value)) throw new TypeError("plugin manifest must be an object");
|
|
94
|
+
if (value.manifestVersion === "0.15") {
|
|
95
|
+
validateCommunityManifest(value);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
throw new TypeError(`unsupported plugin manifest $schema ${JSON.stringify(value.$schema)} and manifestVersion ${JSON.stringify(value.manifestVersion)}`);
|
|
99
|
+
}
|
|
100
|
+
function validateCommunityManifest(value) {
|
|
101
|
+
exact(value, [
|
|
102
|
+
"$schema",
|
|
103
|
+
"manifestVersion",
|
|
104
|
+
"id",
|
|
105
|
+
"name",
|
|
106
|
+
"version",
|
|
107
|
+
"facets",
|
|
108
|
+
"requires",
|
|
109
|
+
"permissions",
|
|
110
|
+
"contributes",
|
|
111
|
+
"subscriptions",
|
|
112
|
+
"license",
|
|
113
|
+
"source",
|
|
114
|
+
"artifact",
|
|
115
|
+
"compat",
|
|
116
|
+
"overrides"
|
|
117
|
+
], "community v0.15 plugin manifest");
|
|
118
|
+
validateSchemaIdentifier(value.$schema, "community v0.15 manifest.$schema");
|
|
119
|
+
if (value.manifestVersion !== "0.15") throw new TypeError(`unsupported Community v0.15 manifestVersion ${JSON.stringify(value.manifestVersion)}`);
|
|
120
|
+
namespaced(value.id, "community v0.15 manifest.id");
|
|
121
|
+
nonEmpty(value.name, "community v0.15 manifest.name");
|
|
122
|
+
nonEmpty(value.version, "community v0.15 manifest.version");
|
|
123
|
+
parseSemanticVersion(value.version);
|
|
124
|
+
validateCommunityFacets(value.facets);
|
|
125
|
+
validateCommunityRequirements(value.requires);
|
|
126
|
+
validateCommunityPermissions(value.permissions);
|
|
127
|
+
validateCommunityContributions(value.contributes);
|
|
128
|
+
validateCommunitySubscriptions(value.subscriptions);
|
|
129
|
+
if (value.license !== void 0) nonEmpty(value.license, "community v0.15 manifest.license");
|
|
130
|
+
if (value.source !== void 0) validateCommunitySource(value.source);
|
|
131
|
+
if (value.artifact !== void 0) validateCommunityArtifact(value.artifact);
|
|
132
|
+
if (value.compat !== void 0) validateCommunityCompat(value.compat);
|
|
133
|
+
if (value.overrides !== void 0) validateCommunityOverrides(value.overrides);
|
|
134
|
+
}
|
|
135
|
+
/** Validate a host-internal Component/Facet projection. */
|
|
136
|
+
function defineComponentManifest(manifest) {
|
|
137
|
+
validateComponentManifest(manifest);
|
|
138
|
+
return deepFreeze(structuredClone(manifest));
|
|
139
|
+
}
|
|
140
|
+
function validateComponentManifest(value) {
|
|
141
|
+
if (!record(value)) throw new TypeError("component manifest must be an object");
|
|
142
|
+
exact(value, [
|
|
143
|
+
"apiVersion",
|
|
144
|
+
"kind",
|
|
145
|
+
"metadata",
|
|
146
|
+
"spec"
|
|
147
|
+
], "component manifest");
|
|
148
|
+
if (value.apiVersion !== "manifest.dsh/internal/v1alpha1") throw new TypeError(`unsupported component manifest apiVersion ${JSON.stringify(value.apiVersion)}`);
|
|
149
|
+
if (value.kind !== "Component") throw new TypeError("component manifest kind must be \"Component\"");
|
|
150
|
+
if (!record(value.metadata)) throw new TypeError("component metadata must be an object");
|
|
151
|
+
exact(value.metadata, [
|
|
152
|
+
"name",
|
|
153
|
+
"version",
|
|
154
|
+
"displayName"
|
|
155
|
+
], "component metadata");
|
|
156
|
+
namespaced(value.metadata.name, "component metadata.name");
|
|
157
|
+
nonEmpty(value.metadata.version, "component metadata.version");
|
|
158
|
+
parseSemanticVersion(value.metadata.version);
|
|
159
|
+
if (value.metadata.displayName !== void 0) nonEmpty(value.metadata.displayName, "component metadata.displayName");
|
|
160
|
+
if (!record(value.spec)) throw new TypeError("component spec must be an object");
|
|
161
|
+
exact(value.spec, ["facets", "relationships"], "component spec");
|
|
162
|
+
if (!Array.isArray(value.spec.facets) || value.spec.facets.length === 0) throw new TypeError("component spec.facets must be a non-empty array");
|
|
163
|
+
const names = /* @__PURE__ */ new Set();
|
|
164
|
+
for (const [index, facet] of value.spec.facets.entries()) {
|
|
165
|
+
validateFacet(facet, index);
|
|
166
|
+
const name = facet.name;
|
|
167
|
+
if (names.has(name)) throw new TypeError(`duplicate facet name ${JSON.stringify(name)}`);
|
|
168
|
+
names.add(name);
|
|
169
|
+
}
|
|
170
|
+
if (value.spec.relationships !== void 0) validateRelationships(value.spec.relationships, value.metadata.name);
|
|
171
|
+
}
|
|
172
|
+
/** Project a supported package manifest version into the common host composition model. */
|
|
173
|
+
function projectManifest(manifestValue) {
|
|
174
|
+
return projectCommunityManifest(defineManifest(manifestValue));
|
|
175
|
+
}
|
|
176
|
+
function projectCommunityManifest(manifest) {
|
|
177
|
+
const extensions = manifest.contributes.commands.map((row) => Object.freeze({
|
|
178
|
+
apiVersion: "commands.dsh/v1alpha1",
|
|
179
|
+
kind: "Command",
|
|
180
|
+
metadata: Object.freeze({
|
|
181
|
+
name: localContributionName(row.id),
|
|
182
|
+
labels: Object.freeze({ "dsh.std/contribution-id": row.id })
|
|
183
|
+
}),
|
|
184
|
+
spec: Object.freeze({
|
|
185
|
+
title: row.title,
|
|
186
|
+
...row.description === void 0 ? {} : { description: row.description }
|
|
187
|
+
})
|
|
188
|
+
}));
|
|
189
|
+
for (const [point, contributions] of Object.entries(manifest.contributes)) {
|
|
190
|
+
if (!point.startsWith("x-")) continue;
|
|
191
|
+
for (const contribution of contributions) {
|
|
192
|
+
if (!record(contribution) || typeof contribution.apiVersion !== "string" || typeof contribution.kind !== "string" || typeof contribution.id !== "string" || typeof contribution.name !== "string" || !Object.hasOwn(contribution, "spec")) continue;
|
|
193
|
+
extensions.push(Object.freeze({
|
|
194
|
+
apiVersion: contribution.apiVersion,
|
|
195
|
+
kind: contribution.kind,
|
|
196
|
+
metadata: Object.freeze({
|
|
197
|
+
name: contribution.name,
|
|
198
|
+
labels: Object.freeze({ "dsh.std/contribution-id": contribution.id })
|
|
199
|
+
}),
|
|
200
|
+
spec: contribution.spec
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const requirements = manifest.requires.contracts.map(communityRequirement);
|
|
205
|
+
const permissions = manifest.permissions.map((permission) => Object.freeze({
|
|
206
|
+
apiVersion: COMMUNITY_PERMISSION_API_VERSION,
|
|
207
|
+
kind: COMMUNITY_PERMISSION_KIND,
|
|
208
|
+
action: permission.name,
|
|
209
|
+
...permission.reason === void 0 ? {} : { reason: permission.reason },
|
|
210
|
+
spec: Object.freeze({ scope: permission.scope })
|
|
211
|
+
}));
|
|
212
|
+
return defineComponentManifest({
|
|
213
|
+
apiVersion: COMPONENT_API_VERSION,
|
|
214
|
+
kind: "Component",
|
|
215
|
+
metadata: {
|
|
216
|
+
name: manifest.id,
|
|
217
|
+
displayName: manifest.name,
|
|
218
|
+
version: manifest.version
|
|
219
|
+
},
|
|
220
|
+
spec: { facets: [{
|
|
221
|
+
name: "host",
|
|
222
|
+
activation: {
|
|
223
|
+
apiVersion: "lifecycle.dsh/v1alpha1",
|
|
224
|
+
kind: "FacetModule",
|
|
225
|
+
spec: { module: manifest.facets.host.entry }
|
|
226
|
+
},
|
|
227
|
+
...requirements.length === 0 ? {} : { protocols: { requires: requirements } },
|
|
228
|
+
...extensions.length === 0 ? {} : { extensions },
|
|
229
|
+
...permissions.length === 0 ? {} : { permissions }
|
|
230
|
+
}] }
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function communityRequirement(reference) {
|
|
234
|
+
return Object.freeze({
|
|
235
|
+
apiVersion: reference.apiVersion,
|
|
236
|
+
kind: reference.kind,
|
|
237
|
+
...reference.optional === void 0 ? {} : { optional: reference.optional },
|
|
238
|
+
...reference.fallback === void 0 ? {} : { "x-community-fallback": reference.fallback }
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function facetIdentity(manifest, facet) {
|
|
242
|
+
if (!manifest.spec.facets.includes(facet)) {
|
|
243
|
+
if (manifest.spec.facets.find((candidate) => candidate.name === facet.name) === void 0) throw new TypeError(`facet ${JSON.stringify(facet.name)} does not belong to component`);
|
|
244
|
+
}
|
|
245
|
+
return Object.freeze({
|
|
246
|
+
component: manifest.metadata.name,
|
|
247
|
+
version: manifest.metadata.version,
|
|
248
|
+
facet: facet.name
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function facetKey(identity) {
|
|
252
|
+
return `${identity.component}@${identity.version}#${identity.facet}`;
|
|
253
|
+
}
|
|
254
|
+
function findFacet(manifest, name) {
|
|
255
|
+
return manifest.spec.facets.find((facet) => facet.name === name);
|
|
256
|
+
}
|
|
257
|
+
function validateCommunityFacets(value) {
|
|
258
|
+
const label = "community v0.15 manifest.facets";
|
|
259
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
260
|
+
exact(value, ["host"], label, false);
|
|
261
|
+
if (!record(value.host)) throw new TypeError(`${label}.host must be an object`);
|
|
262
|
+
exact(value.host, ["entry", "apiVersion"], `${label}.host`, false);
|
|
263
|
+
validatePackageRelative(value.host.entry, `${label}.host.entry`);
|
|
264
|
+
if (typeof value.host.apiVersion !== "string" || !/^v[1-9][0-9]*(?:(?:alpha|beta)[1-9][0-9]*)?$/u.test(value.host.apiVersion)) throw new TypeError(`${label}.host.apiVersion is invalid`);
|
|
265
|
+
}
|
|
266
|
+
function validateCommunityRequirements(value) {
|
|
267
|
+
const label = "community v0.15 manifest.requires";
|
|
268
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
269
|
+
exact(value, ["contracts", "services"], label, false);
|
|
270
|
+
if (!Array.isArray(value.contracts)) throw new TypeError(`${label}.contracts must be an array`);
|
|
271
|
+
const seen = /* @__PURE__ */ new Set();
|
|
272
|
+
for (const [index, referenceValue] of value.contracts.entries()) {
|
|
273
|
+
const rowLabel = `${label}.contracts[${index}]`;
|
|
274
|
+
validateApiReference(referenceValue, rowLabel);
|
|
275
|
+
const reference = referenceValue;
|
|
276
|
+
exact(reference, [
|
|
277
|
+
"apiVersion",
|
|
278
|
+
"kind",
|
|
279
|
+
"optional",
|
|
280
|
+
"fallback"
|
|
281
|
+
], rowLabel, false);
|
|
282
|
+
if (reference.optional !== void 0 && typeof reference.optional !== "boolean") throw new TypeError(`${rowLabel}.optional must be boolean`);
|
|
283
|
+
if (reference.fallback !== void 0) nonEmpty(reference.fallback, `${rowLabel}.fallback`);
|
|
284
|
+
const key = protocolKey(reference);
|
|
285
|
+
if (seen.has(key)) throw new TypeError(`${label}.contracts contains duplicate contract ${JSON.stringify(key)}`);
|
|
286
|
+
seen.add(key);
|
|
287
|
+
}
|
|
288
|
+
if (value.services !== void 0 && (!Array.isArray(value.services) || value.services.length !== 0)) throw new TypeError(`${label}.services must be an empty array in v0.15`);
|
|
289
|
+
}
|
|
290
|
+
function validateCommunityPermissions(value) {
|
|
291
|
+
const label = "community v0.15 manifest.permissions";
|
|
292
|
+
if (!Array.isArray(value)) throw new TypeError(`${label} must be an array`);
|
|
293
|
+
const seen = /* @__PURE__ */ new Set();
|
|
294
|
+
for (const [index, permissionValue] of value.entries()) {
|
|
295
|
+
const rowLabel = `${label}[${index}]`;
|
|
296
|
+
if (!record(permissionValue)) throw new TypeError(`${rowLabel} must be an object`);
|
|
297
|
+
exact(permissionValue, [
|
|
298
|
+
"name",
|
|
299
|
+
"scope",
|
|
300
|
+
"reason"
|
|
301
|
+
], rowLabel, false);
|
|
302
|
+
capabilityId(permissionValue.name, `${rowLabel}.name`);
|
|
303
|
+
nonEmpty(permissionValue.scope, `${rowLabel}.scope`);
|
|
304
|
+
if (permissionValue.reason !== void 0) nonEmpty(permissionValue.reason, `${rowLabel}.reason`);
|
|
305
|
+
const key = `${String(permissionValue.name)}\0${String(permissionValue.scope)}`;
|
|
306
|
+
if (seen.has(key)) throw new TypeError(`${label} contains duplicate permission ${JSON.stringify(key)}`);
|
|
307
|
+
seen.add(key);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function validateCommunityContributions(value) {
|
|
311
|
+
const label = "community v0.15 manifest.contributes";
|
|
312
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
313
|
+
const unknown = Object.keys(value).filter((point) => point !== "commands" && point !== "panels" && !point.startsWith("x-"));
|
|
314
|
+
if (unknown.length > 0) throw new TypeError(`${label} contains unknown contribution point ${JSON.stringify(unknown[0])}`);
|
|
315
|
+
if (!Array.isArray(value.commands)) throw new TypeError(`${label}.commands must be an array`);
|
|
316
|
+
const ids = /* @__PURE__ */ new Set();
|
|
317
|
+
for (const [index, commandValue] of value.commands.entries()) {
|
|
318
|
+
const rowLabel = `${label}.commands[${index}]`;
|
|
319
|
+
if (!record(commandValue)) throw new TypeError(`${rowLabel} must be an object`);
|
|
320
|
+
exact(commandValue, [
|
|
321
|
+
"id",
|
|
322
|
+
"title",
|
|
323
|
+
"description"
|
|
324
|
+
], rowLabel, false);
|
|
325
|
+
namespaced(commandValue.id, `${rowLabel}.id`);
|
|
326
|
+
nonEmpty(commandValue.title, `${rowLabel}.title`);
|
|
327
|
+
if (commandValue.description !== void 0) nonEmpty(commandValue.description, `${rowLabel}.description`);
|
|
328
|
+
if (ids.has(commandValue.id)) throw new TypeError(`${label}.commands contains duplicate id ${JSON.stringify(commandValue.id)}`);
|
|
329
|
+
ids.add(commandValue.id);
|
|
330
|
+
}
|
|
331
|
+
if (value.panels !== void 0 && (!Array.isArray(value.panels) || value.panels.length !== 0)) throw new TypeError(`${label}.panels must be an empty array in v0.15`);
|
|
332
|
+
for (const [point, contributions] of Object.entries(value)) {
|
|
333
|
+
if (!point.startsWith("x-")) continue;
|
|
334
|
+
if (!Array.isArray(contributions)) throw new TypeError(`${label}.${point} must be an array`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function validateCommunitySubscriptions(value) {
|
|
338
|
+
const label = "community v0.15 manifest.subscriptions";
|
|
339
|
+
if (!Array.isArray(value)) throw new TypeError(`${label} must be an array`);
|
|
340
|
+
const seen = /* @__PURE__ */ new Set();
|
|
341
|
+
for (const [index, subscriptionValue] of value.entries()) {
|
|
342
|
+
const rowLabel = `${label}[${index}]`;
|
|
343
|
+
let key;
|
|
344
|
+
if (typeof subscriptionValue === "string") {
|
|
345
|
+
nonEmpty(subscriptionValue, rowLabel);
|
|
346
|
+
key = `legacy\0${subscriptionValue}`;
|
|
347
|
+
} else {
|
|
348
|
+
validateApiReference(subscriptionValue, rowLabel);
|
|
349
|
+
const subscription = subscriptionValue;
|
|
350
|
+
exact(subscription, [
|
|
351
|
+
"apiVersion",
|
|
352
|
+
"kind",
|
|
353
|
+
"scope"
|
|
354
|
+
], rowLabel, false);
|
|
355
|
+
if (subscription.scope !== void 0) nonEmpty(subscription.scope, `${rowLabel}.scope`);
|
|
356
|
+
key = `${protocolKey(subscription)}\0${String(subscription.scope ?? "")}`;
|
|
357
|
+
}
|
|
358
|
+
if (seen.has(key)) throw new TypeError(`${label} contains duplicate subscription ${JSON.stringify(key)}`);
|
|
359
|
+
seen.add(key);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function validateCommunitySource(value) {
|
|
363
|
+
const label = "community v0.15 manifest.source";
|
|
364
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
365
|
+
exact(value, ["repository", "revision"], label, false);
|
|
366
|
+
validateSchemaIdentifier(value.repository, `${label}.repository`);
|
|
367
|
+
if (value.revision !== void 0) nonEmpty(value.revision, `${label}.revision`);
|
|
368
|
+
}
|
|
369
|
+
function validateCommunityArtifact(value) {
|
|
370
|
+
const label = "community v0.15 manifest.artifact";
|
|
371
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
372
|
+
exact(value, [
|
|
373
|
+
"digest",
|
|
374
|
+
"algorithm",
|
|
375
|
+
"path"
|
|
376
|
+
], label, false);
|
|
377
|
+
if (value.algorithm !== "sha256") throw new TypeError(`${label}.algorithm must be "sha256"`);
|
|
378
|
+
if (typeof value.digest !== "string" || !/^sha256:[a-f0-9]{64}$/u.test(value.digest)) throw new TypeError(`${label}.digest must be a SHA-256 digest`);
|
|
379
|
+
validatePackageRelative(value.path, `${label}.path`);
|
|
380
|
+
}
|
|
381
|
+
function validateCommunityCompat(value) {
|
|
382
|
+
const label = "community v0.15 manifest.compat";
|
|
383
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
384
|
+
exact(value, ["hosts"], label, false);
|
|
385
|
+
if (value.hosts === void 0) return;
|
|
386
|
+
if (!Array.isArray(value.hosts)) throw new TypeError(`${label}.hosts must be an array`);
|
|
387
|
+
const seen = /* @__PURE__ */ new Set();
|
|
388
|
+
for (const [index, host] of value.hosts.entries()) {
|
|
389
|
+
nonEmpty(host, `${label}.hosts[${index}]`);
|
|
390
|
+
if (seen.has(host)) throw new TypeError(`${label}.hosts contains duplicate ${JSON.stringify(host)}`);
|
|
391
|
+
seen.add(host);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function validateCommunityOverrides(value) {
|
|
395
|
+
const label = "community v0.15 manifest.overrides";
|
|
396
|
+
if (!Array.isArray(value)) throw new TypeError(`${label} must be an array`);
|
|
397
|
+
for (const [index, overrideValue] of value.entries()) {
|
|
398
|
+
const rowLabel = `${label}[${index}]`;
|
|
399
|
+
if (!record(overrideValue)) throw new TypeError(`${rowLabel} must be an object`);
|
|
400
|
+
exact(overrideValue, [
|
|
401
|
+
"target",
|
|
402
|
+
"kind",
|
|
403
|
+
"description"
|
|
404
|
+
], rowLabel, false);
|
|
405
|
+
nonEmpty(overrideValue.target, `${rowLabel}.target`);
|
|
406
|
+
if (overrideValue.kind !== "patch" && overrideValue.kind !== "native" && overrideValue.kind !== "build") throw new TypeError(`${rowLabel}.kind is invalid`);
|
|
407
|
+
if (overrideValue.description !== void 0) nonEmpty(overrideValue.description, `${rowLabel}.description`);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function validatePackageRelative(value, label) {
|
|
411
|
+
nonEmpty(value, label);
|
|
412
|
+
if (value.startsWith("/") || value.startsWith("\\") || /^[a-zA-Z]:[\\/]/u.test(value)) throw new TypeError(`${label} must be package-relative`);
|
|
413
|
+
if (value.replaceAll("\\", "/").split("/").includes("..")) throw new TypeError(`${label} must remain inside the package`);
|
|
414
|
+
}
|
|
415
|
+
function capabilityId(value, label) {
|
|
416
|
+
if (value === "commands" || value === "storage.local" || value === "messages.observe") return;
|
|
417
|
+
if (typeof value !== "string" || !/^(?:x-[a-z0-9][a-z0-9.-]*\.)?[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$/u.test(value)) throw new TypeError(`${label} must be a namespaced capability identifier`);
|
|
418
|
+
}
|
|
419
|
+
function localContributionName(id) {
|
|
420
|
+
const name = id.split(".").at(-1) ?? id;
|
|
421
|
+
localName(name, "contribution local name");
|
|
422
|
+
return name;
|
|
423
|
+
}
|
|
424
|
+
function validateFacet(value, index) {
|
|
425
|
+
const label = `component spec.facets[${index}]`;
|
|
426
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
427
|
+
exact(value, [
|
|
428
|
+
"name",
|
|
429
|
+
"activation",
|
|
430
|
+
"protocols",
|
|
431
|
+
"extensions",
|
|
432
|
+
"permissions"
|
|
433
|
+
], label);
|
|
434
|
+
localName(value.name, `${label}.name`);
|
|
435
|
+
if (value.activation !== void 0) validateActivation(value.activation, `${label}.activation`);
|
|
436
|
+
if (value.protocols !== void 0) validateProtocols(value.protocols, `${label}.protocols`);
|
|
437
|
+
if (value.extensions !== void 0) validateExtensions(value.extensions, `${label}.extensions`);
|
|
438
|
+
if (value.permissions !== void 0) validatePermissions(value.permissions, `${label}.permissions`);
|
|
439
|
+
if (value.activation === void 0 && value.protocols === void 0 && value.extensions === void 0 && value.permissions === void 0) throw new TypeError(`${label} must declare activation, protocols, extensions, or permissions`);
|
|
440
|
+
}
|
|
441
|
+
function validateActivation(value, label) {
|
|
442
|
+
validateApiReference(value, label);
|
|
443
|
+
const row = value;
|
|
444
|
+
exact(row, [
|
|
445
|
+
"apiVersion",
|
|
446
|
+
"kind",
|
|
447
|
+
"spec"
|
|
448
|
+
], label);
|
|
449
|
+
if (!Object.hasOwn(row, "spec")) throw new TypeError(`${label}.spec is required`);
|
|
450
|
+
}
|
|
451
|
+
function validateProtocols(value, label) {
|
|
452
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
453
|
+
exact(value, ["requires", "supports"], label);
|
|
454
|
+
validateProtocolRows(value.requires, true, `${label}.requires`);
|
|
455
|
+
validateProtocolRows(value.supports, false, `${label}.supports`);
|
|
456
|
+
}
|
|
457
|
+
function validateProtocolRows(value, requirement, label) {
|
|
458
|
+
if (value === void 0) return;
|
|
459
|
+
if (!Array.isArray(value)) throw new TypeError(`${label} must be an array`);
|
|
460
|
+
const seen = /* @__PURE__ */ new Set();
|
|
461
|
+
for (const [index, rowValue] of value.entries()) {
|
|
462
|
+
const rowLabel = `${label}[${index}]`;
|
|
463
|
+
validateApiReference(rowValue, rowLabel);
|
|
464
|
+
const row = rowValue;
|
|
465
|
+
exact(row, requirement ? [
|
|
466
|
+
"apiVersion",
|
|
467
|
+
"kind",
|
|
468
|
+
"optional",
|
|
469
|
+
"spec"
|
|
470
|
+
] : [
|
|
471
|
+
"apiVersion",
|
|
472
|
+
"kind",
|
|
473
|
+
"spec"
|
|
474
|
+
], rowLabel);
|
|
475
|
+
if (requirement && row.optional !== void 0 && typeof row.optional !== "boolean") throw new TypeError(`${rowLabel}.optional must be boolean`);
|
|
476
|
+
const key = protocolKey(row);
|
|
477
|
+
if (seen.has(key)) throw new TypeError(`${label} contains duplicate protocol ${JSON.stringify(key)}`);
|
|
478
|
+
seen.add(key);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
function validateExtensions(value, label) {
|
|
482
|
+
if (!Array.isArray(value)) throw new TypeError(`${label} must be an array`);
|
|
483
|
+
const seen = /* @__PURE__ */ new Set();
|
|
484
|
+
for (const [index, extensionValue] of value.entries()) {
|
|
485
|
+
const rowLabel = `${label}[${index}]`;
|
|
486
|
+
validateApiReference(extensionValue, rowLabel);
|
|
487
|
+
const extension = extensionValue;
|
|
488
|
+
exact(extension, [
|
|
489
|
+
"apiVersion",
|
|
490
|
+
"kind",
|
|
491
|
+
"metadata",
|
|
492
|
+
"spec"
|
|
493
|
+
], rowLabel);
|
|
494
|
+
if (!record(extension.metadata)) throw new TypeError(`${rowLabel}.metadata must be an object`);
|
|
495
|
+
exact(extension.metadata, ["name", "labels"], `${rowLabel}.metadata`);
|
|
496
|
+
nonEmpty(extension.metadata.name, `${rowLabel}.metadata.name`);
|
|
497
|
+
if (extension.metadata.labels !== void 0) validateLabels(extension.metadata.labels, `${rowLabel}.metadata.labels`);
|
|
498
|
+
if (!Object.hasOwn(extension, "spec")) throw new TypeError(`${rowLabel}.spec is required`);
|
|
499
|
+
if (Object.hasOwn(extension, "status")) throw new TypeError(`${rowLabel}.status is runtime-owned`);
|
|
500
|
+
const key = `${protocolKey(extension)}\0${String(extension.metadata.name)}`;
|
|
501
|
+
if (seen.has(key)) throw new TypeError(`${label} contains duplicate extension ${JSON.stringify(key)}`);
|
|
502
|
+
seen.add(key);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function validatePermissions(value, label) {
|
|
506
|
+
if (!Array.isArray(value)) throw new TypeError(`${label} must be an array`);
|
|
507
|
+
const seen = /* @__PURE__ */ new Set();
|
|
508
|
+
for (const [index, permissionValue] of value.entries()) {
|
|
509
|
+
const rowLabel = `${label}[${index}]`;
|
|
510
|
+
validateApiReference(permissionValue, rowLabel);
|
|
511
|
+
const permission = permissionValue;
|
|
512
|
+
exact(permission, [
|
|
513
|
+
"apiVersion",
|
|
514
|
+
"kind",
|
|
515
|
+
"action",
|
|
516
|
+
"optional",
|
|
517
|
+
"reason",
|
|
518
|
+
"spec"
|
|
519
|
+
], rowLabel);
|
|
520
|
+
localName(permission.action, `${rowLabel}.action`);
|
|
521
|
+
if (permission.optional !== void 0 && typeof permission.optional !== "boolean") throw new TypeError(`${rowLabel}.optional must be boolean`);
|
|
522
|
+
if (permission.reason !== void 0) nonEmpty(permission.reason, `${rowLabel}.reason`);
|
|
523
|
+
const key = `${protocolKey(permission)}\0${String(permission.action)}`;
|
|
524
|
+
if (seen.has(key)) throw new TypeError(`${label} contains duplicate permission ${JSON.stringify(key)}`);
|
|
525
|
+
seen.add(key);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
function validateRelationships(value, component) {
|
|
529
|
+
if (!record(value)) throw new TypeError("component relationships must be an object");
|
|
530
|
+
exact(value, [
|
|
531
|
+
"depends",
|
|
532
|
+
"recommends",
|
|
533
|
+
"conflicts",
|
|
534
|
+
"breaks"
|
|
535
|
+
], "component relationships", false);
|
|
536
|
+
for (const kind of [
|
|
537
|
+
"depends",
|
|
538
|
+
"recommends",
|
|
539
|
+
"conflicts",
|
|
540
|
+
"breaks"
|
|
541
|
+
]) {
|
|
542
|
+
const rows = value[kind];
|
|
543
|
+
if (rows === void 0) continue;
|
|
544
|
+
if (!record(rows)) throw new TypeError(`component relationships.${kind} must be an object`);
|
|
545
|
+
for (const [target, range] of Object.entries(rows)) {
|
|
546
|
+
namespaced(target, `component relationships.${kind} target`);
|
|
547
|
+
if (target === component) throw new TypeError(`component cannot declare ${kind} on itself`);
|
|
548
|
+
assertVersionRange(range);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
function registerDefinition(target, definition, label) {
|
|
553
|
+
validateApiReference(definition, `${label} definition`);
|
|
554
|
+
if (typeof definition.validateSpec !== "function") throw new TypeError(`${label} definition.validateSpec must be a function`);
|
|
555
|
+
const key = protocolKey(definition);
|
|
556
|
+
if (target.has(key)) throw new Error(`${label} definition ${definition.apiVersion} ${definition.kind} is already registered`);
|
|
557
|
+
const stored = Object.freeze({ ...definition });
|
|
558
|
+
target.set(key, stored);
|
|
559
|
+
return () => {
|
|
560
|
+
if (target.get(key) === stored) target.delete(key);
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
function issue(code, severity, path, message) {
|
|
564
|
+
return Object.freeze({
|
|
565
|
+
code,
|
|
566
|
+
severity,
|
|
567
|
+
path,
|
|
568
|
+
message
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function validateLabels(value, label) {
|
|
572
|
+
if (!record(value)) throw new TypeError(`${label} must be an object`);
|
|
573
|
+
for (const [key, item] of Object.entries(value)) {
|
|
574
|
+
nonEmpty(key, `${label} key`);
|
|
575
|
+
if (typeof item !== "string") throw new TypeError(`${label}.${key} must be a string`);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
function namespaced(value, label) {
|
|
579
|
+
if (typeof value !== "string" || !COMPONENT_ID.test(value)) throw new TypeError(`${label} must be namespaced`);
|
|
580
|
+
}
|
|
581
|
+
function localName(value, label) {
|
|
582
|
+
if (typeof value !== "string" || !LOCAL_NAME.test(value)) throw new TypeError(`${label} is invalid`);
|
|
583
|
+
}
|
|
584
|
+
function nonEmpty(value, label) {
|
|
585
|
+
if (typeof value !== "string" || value.trim() === "") throw new TypeError(`${label} must be a non-empty string`);
|
|
586
|
+
}
|
|
587
|
+
function validateSchemaIdentifier(value, label) {
|
|
588
|
+
nonEmpty(value, label);
|
|
589
|
+
try {
|
|
590
|
+
new URL(value);
|
|
591
|
+
} catch (error) {
|
|
592
|
+
throw new TypeError(`${label} must be an absolute URI`, { cause: error });
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
function record(value) {
|
|
596
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
597
|
+
}
|
|
598
|
+
function exact(value, allowed, label, extensions = true) {
|
|
599
|
+
const unknown = Object.keys(value).filter((key) => !allowed.includes(key) && !(extensions && key.startsWith("x-")));
|
|
600
|
+
if (unknown.length > 0) throw new TypeError(`${label} contains unknown field ${JSON.stringify(unknown[0])}`);
|
|
601
|
+
}
|
|
602
|
+
function deepFreeze(value) {
|
|
603
|
+
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
604
|
+
Object.freeze(value);
|
|
605
|
+
for (const child of Object.values(value)) deepFreeze(child);
|
|
606
|
+
return value;
|
|
607
|
+
}
|
|
608
|
+
function errorMessage(error) {
|
|
609
|
+
return error instanceof Error ? error.message : String(error);
|
|
610
|
+
}
|
|
611
|
+
function manifestDigest(manifest) {
|
|
612
|
+
const input = canonical(manifest);
|
|
613
|
+
let hash = 2166136261;
|
|
614
|
+
for (let index = 0; index < input.length; index += 1) hash = Math.imul(hash ^ input.charCodeAt(index), 16777619);
|
|
615
|
+
return `fnv1a32:${(hash >>> 0).toString(16).padStart(8, "0")}`;
|
|
616
|
+
}
|
|
617
|
+
function canonical(value) {
|
|
618
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
619
|
+
if (record(value)) return `{${Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(",")}}`;
|
|
620
|
+
return JSON.stringify(value) ?? "null";
|
|
621
|
+
}
|
|
622
|
+
//#endregion
|
|
623
|
+
export { COMMUNITY_PERMISSION_API_VERSION, COMMUNITY_PERMISSION_KIND, COMMUNITY_V015_MANIFEST_VERSION, COMPONENT_API_VERSION, ManifestDefinitionCatalog, defineComponentManifest, defineManifest, facetIdentity, facetKey, findFacet, parseManifest, projectManifest, validateComponentManifest, validateManifest };
|
|
624
|
+
|
|
625
|
+
//# sourceMappingURL=index.js.map
|