@deepseek-harness-tui/dsh-tui 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -15
- package/cordis.patch.yml +21 -2
- package/cordis.yml +12 -1
- package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -0
- package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -0
- package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -0
- package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -0
- package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -0
- package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -0
- package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -0
- package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -0
- package/dsh-ecosystem-spec/registry/README.md +14 -0
- package/dsh-ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/scene-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/settings-section-v1alpha1.json +13 -0
- package/dsh-ecosystem-spec/registry/contracts/tui-channel-v1alpha1.json +30 -0
- package/dsh-ecosystem-spec/registry/contracts/workspace-provider-v1alpha1.json +6 -0
- package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
- package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -0
- package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -0
- package/dsh-ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
- package/dsh-ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
- package/dsh-ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
- package/lib/types/cc/figures.d.ts +4 -0
- package/lib/types/cc/figures.d.ts.map +1 -1
- package/lib/types/cc/figures.js +4 -0
- package/lib/types/command-trees.d.ts +2 -1
- package/lib/types/command-trees.d.ts.map +1 -1
- package/lib/types/command-trees.js +1 -1
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +2 -0
- package/lib/types/components/ExtensionDialog.d.ts +40 -0
- package/lib/types/components/ExtensionDialog.d.ts.map +1 -0
- package/lib/types/components/ExtensionDialog.js +210 -0
- package/lib/types/components/HelpMenu.js +1 -1
- package/lib/types/components/LoadedContextPanel.d.ts +5 -5
- package/lib/types/components/LoadedContextPanel.js +6 -6
- package/lib/types/components/LogoV2.d.ts.map +1 -1
- package/lib/types/components/LogoV2.js +16 -8
- package/lib/types/components/Markdown.d.ts +13 -1
- package/lib/types/components/Markdown.d.ts.map +1 -1
- package/lib/types/components/Markdown.js +15 -1
- package/lib/types/components/MessageList.d.ts +3 -1
- package/lib/types/components/MessageList.d.ts.map +1 -1
- package/lib/types/components/MessageList.js +111 -6
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +26 -12
- package/lib/types/components/RewindPicker.d.ts +13 -1
- package/lib/types/components/RewindPicker.d.ts.map +1 -1
- package/lib/types/components/RewindPicker.js +26 -2
- package/lib/types/components/StreamingMarkdown.d.ts +2 -8
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
- package/lib/types/components/StreamingMarkdown.js +51 -9
- package/lib/types/components/ToolUseLoader.d.ts +8 -3
- package/lib/types/components/ToolUseLoader.d.ts.map +1 -1
- package/lib/types/components/ToolUseLoader.js +43 -9
- package/lib/types/components/activityFrames.d.ts +1 -1
- package/lib/types/components/activityFrames.d.ts.map +1 -1
- package/lib/types/components/activityFrames.js +4 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +5 -1
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantThinkingMessage.js +26 -3
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +13 -2
- package/lib/types/dsh-adapter/channel.d.ts +61 -11
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +767 -120
- package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -1
- package/lib/types/dsh-adapter/childStderr.js +10 -0
- package/lib/types/dsh-adapter/command-attribution.d.ts +51 -0
- package/lib/types/dsh-adapter/command-attribution.d.ts.map +1 -0
- package/lib/types/dsh-adapter/command-attribution.js +93 -0
- package/lib/types/dsh-adapter/command-errors.d.ts +42 -0
- package/lib/types/dsh-adapter/command-errors.d.ts.map +1 -0
- package/lib/types/dsh-adapter/command-errors.js +63 -0
- package/lib/types/dsh-adapter/command-trees.d.ts +7 -1
- package/lib/types/dsh-adapter/command-trees.d.ts.map +1 -1
- package/lib/types/dsh-adapter/command-trees.js +70 -20
- package/lib/types/dsh-adapter/component-identity.d.ts +33 -0
- package/lib/types/dsh-adapter/component-identity.d.ts.map +1 -0
- package/lib/types/dsh-adapter/component-identity.js +108 -0
- package/lib/types/dsh-adapter/contract.d.ts +1 -1
- package/lib/types/dsh-adapter/contract.js +2 -2
- package/lib/types/dsh-adapter/decision-guard.d.ts +84 -0
- package/lib/types/dsh-adapter/decision-guard.d.ts.map +1 -0
- package/lib/types/dsh-adapter/decision-guard.js +348 -0
- package/lib/types/dsh-adapter/dialogs.d.ts +145 -0
- package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
- package/lib/types/dsh-adapter/dialogs.js +316 -0
- package/lib/types/dsh-adapter/effect-ledger.d.ts +91 -0
- package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
- package/lib/types/dsh-adapter/effect-ledger.js +251 -0
- package/lib/types/dsh-adapter/extension-events.d.ts +193 -0
- package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -0
- package/lib/types/dsh-adapter/extension-events.js +207 -0
- package/lib/types/dsh-adapter/extensions.d.ts +32 -0
- package/lib/types/dsh-adapter/extensions.d.ts.map +1 -0
- package/lib/types/dsh-adapter/extensions.js +42 -0
- package/lib/types/dsh-adapter/grants.d.ts +25 -0
- package/lib/types/dsh-adapter/grants.d.ts.map +1 -0
- package/lib/types/dsh-adapter/grants.js +213 -0
- package/lib/types/dsh-adapter/host-access.d.ts +37 -0
- package/lib/types/dsh-adapter/host-access.d.ts.map +1 -0
- package/lib/types/dsh-adapter/host-access.js +652 -0
- package/lib/types/dsh-adapter/host-descriptor.d.ts +24 -0
- package/lib/types/dsh-adapter/host-descriptor.d.ts.map +1 -0
- package/lib/types/dsh-adapter/host-descriptor.js +169 -0
- package/lib/types/dsh-adapter/index.d.ts +4 -0
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +1 -0
- package/lib/types/dsh-adapter/message-observer.d.ts +173 -0
- package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
- package/lib/types/dsh-adapter/message-observer.js +553 -0
- package/lib/types/dsh-adapter/plugin-host.d.ts +136 -0
- package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugin-host.js +365 -0
- package/lib/types/dsh-adapter/plugin-storage.d.ts +108 -0
- package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugin-storage.js +397 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +124 -14
- package/lib/types/dsh-adapter/plugins-info.d.ts +43 -0
- package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -0
- package/lib/types/dsh-adapter/plugins-info.js +276 -0
- package/lib/types/dsh-adapter/promptDebug.d.ts +0 -6
- package/lib/types/dsh-adapter/promptDebug.d.ts.map +1 -1
- package/lib/types/dsh-adapter/promptDebug.js +13 -4
- package/lib/types/dsh-adapter/renderers.d.ts +57 -0
- package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
- package/lib/types/dsh-adapter/renderers.js +173 -0
- package/lib/types/dsh-adapter/sanitize.d.ts +36 -0
- package/lib/types/dsh-adapter/sanitize.d.ts.map +1 -0
- package/lib/types/dsh-adapter/sanitize.js +65 -0
- package/lib/types/dsh-adapter/scenes.d.ts +15 -5
- package/lib/types/dsh-adapter/scenes.d.ts.map +1 -1
- package/lib/types/dsh-adapter/scenes.js +149 -35
- package/lib/types/dsh-adapter/settings-sections.d.ts +7 -3
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +106 -26
- package/lib/types/dsh-adapter/shortcuts.d.ts +107 -0
- package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
- package/lib/types/dsh-adapter/shortcuts.js +340 -0
- package/lib/types/dsh-adapter/status.d.ts +74 -0
- package/lib/types/dsh-adapter/status.d.ts.map +1 -0
- package/lib/types/dsh-adapter/status.js +234 -0
- package/lib/types/dsh-adapter/workspaces.d.ts +16 -5
- package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -1
- package/lib/types/dsh-adapter/workspaces.js +287 -170
- package/lib/types/extensions.d.ts +13 -0
- package/lib/types/extensions.d.ts.map +1 -0
- package/lib/types/extensions.js +21 -0
- package/lib/types/force-production-react.d.ts +1 -0
- package/lib/types/force-production-react.d.ts.map +1 -0
- package/lib/types/force-production-react.js +12 -0
- package/lib/types/i18n.d.ts +174 -20
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +56 -6
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/ink/components/App.d.ts +2 -0
- package/lib/types/ink/components/App.d.ts.map +1 -1
- package/lib/types/ink/components/App.js +4 -0
- package/lib/types/ink/ink.d.ts +31 -3
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +90 -5
- package/lib/types/ink/log-update.d.ts.map +1 -1
- package/lib/types/ink/log-update.js +225 -56
- package/lib/types/ink/output.d.ts +35 -2
- package/lib/types/ink/output.d.ts.map +1 -1
- package/lib/types/ink/output.js +281 -14
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +14 -6
- package/lib/types/ink/screen.d.ts +39 -0
- package/lib/types/ink/screen.d.ts.map +1 -1
- package/lib/types/ink/screen.js +117 -0
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +26 -6
- package/lib/types/ink/wrapAnsi.d.ts +1 -1
- package/lib/types/ink/wrapAnsi.d.ts.map +1 -1
- package/lib/types/ink/wrapAnsi.js +29 -2
- package/lib/types/plugin-host.d.ts +15 -0
- package/lib/types/plugin-host.d.ts.map +1 -0
- package/lib/types/plugin-host.js +17 -0
- package/lib/types/plugin-spec/negotiate.d.ts +11 -0
- package/lib/types/plugin-spec/negotiate.d.ts.map +1 -0
- package/lib/types/plugin-spec/negotiate.js +97 -0
- package/lib/types/plugin-spec/permission-scope.d.ts +32 -0
- package/lib/types/plugin-spec/permission-scope.d.ts.map +1 -0
- package/lib/types/plugin-spec/permission-scope.js +90 -0
- package/lib/types/plugin-spec/registry.d.ts +23 -0
- package/lib/types/plugin-spec/registry.d.ts.map +1 -0
- package/lib/types/plugin-spec/registry.js +252 -0
- package/lib/types/plugin-spec/schema-check.d.ts +17 -0
- package/lib/types/plugin-spec/schema-check.d.ts.map +1 -0
- package/lib/types/plugin-spec/schema-check.js +165 -0
- package/lib/types/plugin-spec/tui-extension.d.ts +16 -0
- package/lib/types/plugin-spec/tui-extension.d.ts.map +1 -0
- package/lib/types/plugin-spec/tui-extension.js +79 -0
- package/lib/types/plugin-spec/types.d.ts +114 -0
- package/lib/types/plugin-spec/types.d.ts.map +1 -0
- package/lib/types/plugin-spec/types.js +10 -0
- package/lib/types/plugin-spec/validate.d.ts +21 -0
- package/lib/types/plugin-spec/validate.d.ts.map +1 -0
- package/lib/types/plugin-spec/validate.js +138 -0
- package/lib/types/scenes.d.ts +2 -1
- package/lib/types/scenes.d.ts.map +1 -1
- package/lib/types/scenes.js +1 -1
- package/lib/types/screens/Chat.d.ts +14 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +173 -49
- package/lib/types/screens/SessionBrowser.d.ts.map +1 -1
- package/lib/types/screens/SessionBrowser.js +10 -3
- package/lib/types/sessions/view.d.ts +3 -2
- package/lib/types/sessions/view.d.ts.map +1 -1
- package/lib/types/sessions/view.js +18 -0
- package/lib/types/settings-sections.d.ts +2 -1
- package/lib/types/settings-sections.d.ts.map +1 -1
- package/lib/types/settings-sections.js +1 -1
- package/lib/types/theme.d.ts +5 -0
- package/lib/types/theme.d.ts.map +1 -1
- package/lib/types/theme.js +15 -0
- package/lib/types/update.d.ts +20 -0
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +54 -7
- package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
- package/lib/types/utils/execFileNoThrow.js +3 -0
- package/lib/types/utils/loaded-context.d.ts +8 -3
- package/lib/types/utils/loaded-context.d.ts.map +1 -1
- package/lib/types/utils/loaded-context.js +39 -3
- package/lib/types/utils/modifiers.d.ts.map +1 -1
- package/lib/types/utils/modifiers.js +3 -2
- package/lib/types/working-activity.d.ts +12 -0
- package/lib/types/working-activity.d.ts.map +1 -1
- package/lib/types/working-activity.js +13 -0
- package/lib/types/workspaces.d.ts +2 -1
- package/lib/types/workspaces.d.ts.map +1 -1
- package/lib/types/workspaces.js +1 -1
- package/node_modules/@dsh-std/command/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/command/LICENSE +21 -0
- package/node_modules/@dsh-std/command/README.md +26 -0
- package/node_modules/@dsh-std/command/README.zh.md +28 -0
- package/node_modules/@dsh-std/command/lib/index.d.ts +144 -0
- package/node_modules/@dsh-std/command/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/command/lib/index.js +252 -0
- package/node_modules/@dsh-std/command/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/command/package.json +22 -0
- package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/node_modules/@dsh-std/connection/README.md +42 -0
- package/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/node_modules/@dsh-std/connection/package.json +20 -0
- package/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/core/LICENSE +21 -0
- package/node_modules/@dsh-std/core/README.md +13 -0
- package/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/core/package.json +21 -0
- package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
- package/node_modules/@dsh-std/manifest/LICENSE +21 -0
- package/node_modules/@dsh-std/manifest/README.md +5 -0
- package/node_modules/@dsh-std/manifest/README.zh.md +5 -0
- package/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
- package/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/manifest/lib/index.js +625 -0
- package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/manifest/package.json +20 -0
- package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
- package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/messages/LICENSE +21 -0
- package/node_modules/@dsh-std/messages/README.md +5 -0
- package/node_modules/@dsh-std/messages/README.zh.md +7 -0
- package/node_modules/@dsh-std/messages/lib/index.d.ts +50 -0
- package/node_modules/@dsh-std/messages/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/messages/lib/index.js +151 -0
- package/node_modules/@dsh-std/messages/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/messages/package.json +20 -0
- package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -0
- package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
- package/node_modules/@dsh-std/presentation/LICENSE +21 -0
- package/node_modules/@dsh-std/presentation/README.md +27 -0
- package/node_modules/@dsh-std/presentation/README.zh.md +29 -0
- package/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
- package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
- package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/index.js +550 -0
- package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
- package/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
- package/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
- package/node_modules/@dsh-std/presentation/package.json +25 -0
- package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -0
- package/node_modules/@dsh-std/storage/LICENSE +21 -0
- package/node_modules/@dsh-std/storage/README.md +5 -0
- package/node_modules/@dsh-std/storage/README.zh.md +7 -0
- package/node_modules/@dsh-std/storage/lib/index.d.ts +48 -0
- package/node_modules/@dsh-std/storage/lib/index.d.ts.map +1 -0
- package/node_modules/@dsh-std/storage/lib/index.js +104 -0
- package/node_modules/@dsh-std/storage/lib/index.js.map +1 -0
- package/node_modules/@dsh-std/storage/package.json +20 -0
- package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -0
- package/package.json +110 -70
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js +625 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js +550 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js +158 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js +258 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js +424 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -0
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { a as CONNECTION_API_VERSION, c as validateEndpointOffer, i as ConnectionInvocationError, l as validatePlanCoordinates, n as defineCapabilityProtocol, o as createEndpointOffer, r as isCapabilityAgreement, s as freezeEndpoint, t as resolveConnection } from "./resolve-3X6ausgz.js";
|
|
2
|
+
import { defineProtocolDeclaration, sameProtocol } from "@dsh-std/core";
|
|
3
|
+
//#region src/broker.ts
|
|
4
|
+
var ConnectionSelectionError = class extends Error {
|
|
5
|
+
code;
|
|
6
|
+
implementations;
|
|
7
|
+
constructor(code, message, implementations) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.implementations = implementations;
|
|
11
|
+
this.name = "ConnectionSelectionError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Implementation registry used by an adapter or application composition root.
|
|
16
|
+
* Domain consumers request a connection; they never import the selected implementation.
|
|
17
|
+
*/
|
|
18
|
+
var ConnectionBroker = class {
|
|
19
|
+
connectors = /* @__PURE__ */ new Map();
|
|
20
|
+
register(connector) {
|
|
21
|
+
namespaced(connector.id, "connection connector id");
|
|
22
|
+
if (this.connectors.has(connector.id)) throw new Error(`connection connector ${JSON.stringify(connector.id)} is already registered`);
|
|
23
|
+
this.connectors.set(connector.id, connector);
|
|
24
|
+
return () => {
|
|
25
|
+
if (this.connectors.get(connector.id) === connector) this.connectors.delete(connector.id);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
implementations(target) {
|
|
29
|
+
if (target !== void 0) validateTarget(target);
|
|
30
|
+
return Object.freeze([...this.connectors.values()].filter((connector) => target === void 0 || safelySupports(connector, target)).map((connector) => connector.id).sort());
|
|
31
|
+
}
|
|
32
|
+
async connect(request) {
|
|
33
|
+
validateTarget(request.target);
|
|
34
|
+
validateEndpointOffer(request.local.offer);
|
|
35
|
+
request.signal?.throwIfAborted();
|
|
36
|
+
const matches = [...this.connectors.values()].filter((connector) => safelySupports(connector, request.target)).sort((left, right) => left.id.localeCompare(right.id));
|
|
37
|
+
if (matches.length === 0) throw new ConnectionSelectionError("implementation-unavailable", `no connection implementation supports ${JSON.stringify(request.target.uri)}`, []);
|
|
38
|
+
if (matches.length > 1) {
|
|
39
|
+
const ids = Object.freeze(matches.map((connector) => connector.id));
|
|
40
|
+
throw new ConnectionSelectionError("implementation-ambiguous", `multiple connection implementations support ${JSON.stringify(request.target.uri)}: ${ids.join(", ")}`, ids);
|
|
41
|
+
}
|
|
42
|
+
return matches[0].connect(request);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
function safelySupports(connector, target) {
|
|
46
|
+
try {
|
|
47
|
+
return connector.supports(target);
|
|
48
|
+
} catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function validateTarget(target) {
|
|
53
|
+
if (typeof target.uri !== "string" || target.uri.trim() === "") throw new TypeError("connection target uri must be non-empty");
|
|
54
|
+
if (target.metadata !== void 0) {
|
|
55
|
+
for (const [key, value] of Object.entries(target.metadata)) if (key.trim() === "" || typeof value !== "string") throw new TypeError("connection target metadata must contain string pairs");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function namespaced(value, label) {
|
|
59
|
+
if (!/^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$/u.test(value)) throw new TypeError(`${label} must be namespaced`);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/endpoint.ts
|
|
63
|
+
var StandardEndpointRuntime = class {
|
|
64
|
+
declarations = /* @__PURE__ */ new Map();
|
|
65
|
+
implementations = [];
|
|
66
|
+
listeners = /* @__PURE__ */ new Set();
|
|
67
|
+
identity;
|
|
68
|
+
revision;
|
|
69
|
+
currentOffer;
|
|
70
|
+
constructor(options) {
|
|
71
|
+
this.identity = Object.freeze({
|
|
72
|
+
id: options.id,
|
|
73
|
+
instanceId: options.instanceId
|
|
74
|
+
});
|
|
75
|
+
this.revision = options.revision ?? 0;
|
|
76
|
+
this.currentOffer = this.createOffer();
|
|
77
|
+
}
|
|
78
|
+
get offer() {
|
|
79
|
+
return this.currentOffer;
|
|
80
|
+
}
|
|
81
|
+
register(publication) {
|
|
82
|
+
const declaration = defineProtocolDeclaration(publication.declaration);
|
|
83
|
+
const participantId = declaration.participant.id;
|
|
84
|
+
if (this.declarations.has(participantId)) throw new Error(`participant ${JSON.stringify(participantId)} is already registered`);
|
|
85
|
+
const implementations = [...publication.implementations ?? []];
|
|
86
|
+
const implemented = /* @__PURE__ */ new Set();
|
|
87
|
+
for (const implementation of implementations) {
|
|
88
|
+
if (implementation.participantId !== participantId) throw new TypeError(`implementation participantId must be ${JSON.stringify(participantId)}`);
|
|
89
|
+
if (!(declaration.supports ?? []).some((support) => sameProtocol(support, implementation.protocol))) throw new TypeError(`participant implementation ${implementation.protocol.apiVersion} ${implementation.protocol.kind} is not declared live`);
|
|
90
|
+
const key = `${implementation.protocol.apiVersion}\0${implementation.protocol.kind}`;
|
|
91
|
+
if (implemented.has(key)) throw new TypeError(`participant has multiple implementations for ${implementation.protocol.apiVersion} ${implementation.protocol.kind}`);
|
|
92
|
+
implemented.add(key);
|
|
93
|
+
}
|
|
94
|
+
const stored = implementations.map((implementation) => Object.freeze({
|
|
95
|
+
...implementation,
|
|
96
|
+
protocol: Object.freeze({ ...implementation.protocol }),
|
|
97
|
+
handle: implementation.handle
|
|
98
|
+
}));
|
|
99
|
+
this.declarations.set(participantId, declaration);
|
|
100
|
+
this.implementations.push(...stored);
|
|
101
|
+
this.publishOffer();
|
|
102
|
+
let active = true;
|
|
103
|
+
return () => {
|
|
104
|
+
if (!active) return;
|
|
105
|
+
active = false;
|
|
106
|
+
if (this.declarations.get(participantId) === declaration) this.declarations.delete(participantId);
|
|
107
|
+
for (const implementation of stored) {
|
|
108
|
+
const index = this.implementations.indexOf(implementation);
|
|
109
|
+
if (index >= 0) this.implementations.splice(index, 1);
|
|
110
|
+
}
|
|
111
|
+
this.publishOffer();
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async dispatch(invocation) {
|
|
115
|
+
validateDispatch(invocation, this.currentOffer);
|
|
116
|
+
const implementation = this.implementations.find((candidate) => candidate.participantId === invocation.binding.provider.participantId && sameProtocol(candidate.protocol, invocation.binding.support));
|
|
117
|
+
if (implementation === void 0) throw new ConnectionInvocationError("handler-missing", `binding ${JSON.stringify(invocation.binding.bindingId)} has no live implementation`);
|
|
118
|
+
try {
|
|
119
|
+
return await implementation.handle(invocation.operation, invocation.input, Object.freeze({
|
|
120
|
+
connectionId: invocation.connectionId,
|
|
121
|
+
planRevision: invocation.planRevision,
|
|
122
|
+
invocationId: invocation.invocationId,
|
|
123
|
+
binding: invocation.binding,
|
|
124
|
+
signal: invocation.signal,
|
|
125
|
+
progress: invocation.progress
|
|
126
|
+
}));
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (error instanceof ConnectionInvocationError) throw error;
|
|
129
|
+
throw new ConnectionInvocationError("handler-failed", error instanceof Error ? error.message : String(error), { cause: error });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
onOfferChange(listener) {
|
|
133
|
+
this.listeners.add(listener);
|
|
134
|
+
return () => {
|
|
135
|
+
this.listeners.delete(listener);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
createOffer() {
|
|
139
|
+
return createEndpointOffer(this.identity, this.revision, [...this.declarations.values()]);
|
|
140
|
+
}
|
|
141
|
+
publishOffer() {
|
|
142
|
+
this.revision += 1;
|
|
143
|
+
this.currentOffer = this.createOffer();
|
|
144
|
+
for (const listener of this.listeners) listener(this.currentOffer);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
function validateDispatch(invocation, offer) {
|
|
148
|
+
if (invocation.connectionId.trim() === "") throw new TypeError("connectionId must be non-empty");
|
|
149
|
+
if (!Number.isSafeInteger(invocation.planRevision) || invocation.planRevision < 1) throw new TypeError("planRevision must be positive");
|
|
150
|
+
if (invocation.binding.planRevision !== invocation.planRevision) throw new ConnectionInvocationError("capability-unbound", "binding belongs to another plan revision");
|
|
151
|
+
if (invocation.binding.provider.endpoint.instanceId !== offer.endpoint.instanceId) throw new ConnectionInvocationError("capability-unbound", "binding provider belongs to another endpoint");
|
|
152
|
+
if (invocation.invocationId.trim() === "" || invocation.operation.trim() === "") throw new TypeError("invocationId and operation must be non-empty");
|
|
153
|
+
invocation.signal.throwIfAborted();
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { CONNECTION_API_VERSION, ConnectionBroker, ConnectionInvocationError, ConnectionSelectionError, StandardEndpointRuntime, createEndpointOffer, defineCapabilityProtocol, freezeEndpoint, isCapabilityAgreement, resolveConnection, validateEndpointOffer, validatePlanCoordinates };
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/broker.ts","../src/endpoint.ts"],"sourcesContent":["import { validateEndpointOffer } from './model.js'\nimport type { ConnectionEndpoint, StandardConnection } from './connection.js'\n\nexport interface ConnectionTarget {\n /** Implementation-neutral target. Its URI scheme is interpreted by registered connectors. */\n readonly uri: string\n readonly metadata?: Readonly<Record<string, string>>\n}\n\nexport interface ConnectRequest {\n readonly target: ConnectionTarget\n /** Live endpoint, including the dispatcher used for peer-to-local calls. */\n readonly local: ConnectionEndpoint\n readonly signal?: AbortSignal\n}\n\n/** Client half of one concrete connection implementation. */\nexport interface ConnectionConnector {\n /** Namespaced implementation identity, not a transport or product name exposed to domain consumers. */\n readonly id: string\n supports(target: ConnectionTarget): boolean\n connect(request: ConnectRequest): Promise<StandardConnection>\n}\n\nexport class ConnectionSelectionError extends Error {\n constructor(\n readonly code: 'implementation-unavailable' | 'implementation-ambiguous',\n message: string,\n readonly implementations: readonly string[],\n ) {\n super(message)\n this.name = 'ConnectionSelectionError'\n }\n}\n\n/**\n * Implementation registry used by an adapter or application composition root.\n * Domain consumers request a connection; they never import the selected implementation.\n */\nexport class ConnectionBroker {\n private readonly connectors = new Map<string, ConnectionConnector>()\n\n register(connector: ConnectionConnector): () => void {\n namespaced(connector.id, 'connection connector id')\n if (this.connectors.has(connector.id)) throw new Error(`connection connector ${JSON.stringify(connector.id)} is already registered`)\n this.connectors.set(connector.id, connector)\n return () => { if (this.connectors.get(connector.id) === connector) this.connectors.delete(connector.id) }\n }\n\n implementations(target?: ConnectionTarget): readonly string[] {\n if (target !== undefined) validateTarget(target)\n return Object.freeze([...this.connectors.values()]\n .filter(connector => target === undefined || safelySupports(connector, target))\n .map(connector => connector.id)\n .sort())\n }\n\n async connect(request: ConnectRequest): Promise<StandardConnection> {\n validateTarget(request.target)\n validateEndpointOffer(request.local.offer)\n request.signal?.throwIfAborted()\n const matches = [...this.connectors.values()]\n .filter(connector => safelySupports(connector, request.target))\n .sort((left, right) => left.id.localeCompare(right.id))\n if (matches.length === 0) {\n throw new ConnectionSelectionError(\n 'implementation-unavailable',\n `no connection implementation supports ${JSON.stringify(request.target.uri)}`,\n [],\n )\n }\n if (matches.length > 1) {\n const ids = Object.freeze(matches.map(connector => connector.id))\n throw new ConnectionSelectionError(\n 'implementation-ambiguous',\n `multiple connection implementations support ${JSON.stringify(request.target.uri)}: ${ids.join(', ')}`,\n ids,\n )\n }\n return matches[0]!.connect(request)\n }\n}\n\nfunction safelySupports(connector: ConnectionConnector, target: ConnectionTarget): boolean {\n try { return connector.supports(target) } catch { return false }\n}\n\nfunction validateTarget(target: ConnectionTarget): void {\n if (typeof target.uri !== 'string' || target.uri.trim() === '') throw new TypeError('connection target uri must be non-empty')\n if (target.metadata !== undefined) {\n for (const [key, value] of Object.entries(target.metadata)) {\n if (key.trim() === '' || typeof value !== 'string') throw new TypeError('connection target metadata must contain string pairs')\n }\n }\n}\n\nfunction namespaced(value: string, label: string): void {\n if (!/^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$/u.test(value)) throw new TypeError(`${label} must be namespaced`)\n}\n","import {\n defineProtocolDeclaration,\n sameProtocol,\n type ProtocolDeclaration,\n type ProtocolSupport,\n} from '@dsh-std/core'\nimport {\n ConnectionInvocationError,\n type CapabilityDispatch,\n type CapabilityImplementation,\n type ConnectionEndpoint,\n} from './connection.js'\nimport { createEndpointOffer, type EndpointIdentity, type EndpointOffer } from './model.js'\n\nexport interface EndpointPublication {\n readonly declaration: ProtocolDeclaration\n readonly implementations?: readonly CapabilityImplementation[]\n}\n\nexport interface EndpointRuntimeOptions extends EndpointIdentity {\n readonly revision?: number\n}\n\nexport class StandardEndpointRuntime implements ConnectionEndpoint {\n private readonly declarations = new Map<string, ProtocolDeclaration>()\n private readonly implementations: CapabilityImplementation[] = []\n private readonly listeners = new Set<(offer: EndpointOffer) => void>()\n private readonly identity: EndpointIdentity\n private revision: number\n private currentOffer: EndpointOffer\n\n constructor(options: EndpointRuntimeOptions) {\n this.identity = Object.freeze({ id: options.id, instanceId: options.instanceId })\n this.revision = options.revision ?? 0\n this.currentOffer = this.createOffer()\n }\n\n get offer(): EndpointOffer { return this.currentOffer }\n\n register(publication: EndpointPublication): () => void {\n const declaration = defineProtocolDeclaration(publication.declaration)\n const participantId = declaration.participant.id\n if (this.declarations.has(participantId)) throw new Error(`participant ${JSON.stringify(participantId)} is already registered`)\n const implementations = [...(publication.implementations ?? [])]\n const implemented = new Set<string>()\n for (const implementation of implementations) {\n if (implementation.participantId !== participantId) throw new TypeError(`implementation participantId must be ${JSON.stringify(participantId)}`)\n if (!(declaration.supports ?? []).some(support => sameProtocol(support, implementation.protocol))) {\n throw new TypeError(`participant implementation ${implementation.protocol.apiVersion} ${implementation.protocol.kind} is not declared live`)\n }\n const key = `${implementation.protocol.apiVersion}\\0${implementation.protocol.kind}`\n if (implemented.has(key)) throw new TypeError(`participant has multiple implementations for ${implementation.protocol.apiVersion} ${implementation.protocol.kind}`)\n implemented.add(key)\n }\n const stored = implementations.map(implementation => Object.freeze({\n ...implementation, protocol: Object.freeze({ ...implementation.protocol }),\n handle: implementation.handle as CapabilityImplementation['handle'],\n }))\n this.declarations.set(participantId, declaration)\n this.implementations.push(...stored)\n this.publishOffer()\n let active = true\n return () => {\n if (!active) return\n active = false\n if (this.declarations.get(participantId) === declaration) this.declarations.delete(participantId)\n for (const implementation of stored) {\n const index = this.implementations.indexOf(implementation)\n if (index >= 0) this.implementations.splice(index, 1)\n }\n this.publishOffer()\n }\n }\n\n async dispatch<TInput = unknown, TOutput = unknown, TProgress = unknown>(invocation: CapabilityDispatch<TInput, TProgress>): Promise<TOutput> {\n validateDispatch(invocation, this.currentOffer)\n const implementation = this.implementations.find(candidate =>\n candidate.participantId === invocation.binding.provider.participantId\n && sameProtocol(candidate.protocol, invocation.binding.support))\n if (implementation === undefined) throw new ConnectionInvocationError('handler-missing', `binding ${JSON.stringify(invocation.binding.bindingId)} has no live implementation`)\n try {\n return await implementation.handle(invocation.operation, invocation.input, Object.freeze({\n connectionId: invocation.connectionId,\n planRevision: invocation.planRevision,\n invocationId: invocation.invocationId,\n binding: invocation.binding,\n signal: invocation.signal,\n progress: invocation.progress,\n })) as TOutput\n } catch (error) {\n if (error instanceof ConnectionInvocationError) throw error\n throw new ConnectionInvocationError('handler-failed', error instanceof Error ? error.message : String(error), { cause: error })\n }\n }\n\n onOfferChange(listener: (offer: EndpointOffer) => void): () => void {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n private createOffer(): EndpointOffer {\n return createEndpointOffer(this.identity, this.revision, [...this.declarations.values()])\n }\n\n private publishOffer(): void {\n this.revision += 1\n this.currentOffer = this.createOffer()\n for (const listener of this.listeners) listener(this.currentOffer)\n }\n}\n\nfunction validateDispatch(invocation: CapabilityDispatch, offer: EndpointOffer): void {\n if (invocation.connectionId.trim() === '') throw new TypeError('connectionId must be non-empty')\n if (!Number.isSafeInteger(invocation.planRevision) || invocation.planRevision < 1) throw new TypeError('planRevision must be positive')\n if (invocation.binding.planRevision !== invocation.planRevision) throw new ConnectionInvocationError('capability-unbound', 'binding belongs to another plan revision')\n if (invocation.binding.provider.endpoint.instanceId !== offer.endpoint.instanceId) throw new ConnectionInvocationError('capability-unbound', 'binding provider belongs to another endpoint')\n if (invocation.invocationId.trim() === '' || invocation.operation.trim() === '') throw new TypeError('invocationId and operation must be non-empty')\n invocation.signal.throwIfAborted()\n}\n"],"mappings":";;;AAwBA,IAAa,2BAAb,cAA8C,MAAM;CAEvC;CAEA;CAHX,YACE,MACA,SACA,iBACA;EACA,MAAM,OAAO;EAJJ,KAAA,OAAA;EAEA,KAAA,kBAAA;EAGT,KAAK,OAAO;CACd;AACF;;;;;AAMA,IAAa,mBAAb,MAA8B;CAC5B,6BAA8B,IAAI,IAAiC;CAEnE,SAAS,WAA4C;EACnD,WAAW,UAAU,IAAI,yBAAyB;EAClD,IAAI,KAAK,WAAW,IAAI,UAAU,EAAE,GAAG,MAAM,IAAI,MAAM,wBAAwB,KAAK,UAAU,UAAU,EAAE,EAAE,uBAAuB;EACnI,KAAK,WAAW,IAAI,UAAU,IAAI,SAAS;EAC3C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AW;IACpB,QAAQ,WAAW;IACnB,UAAU,WAAW;GACvB,CAAC,CAAC;EACJ,SAAS,OAAO;GACd,IAAI,iBAAiB,2BAA2B,MAAM;GACtD,MAAM,IAAI,0BAA0B,kBAAkB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,EAAE,OAAO,MAAM,CAAC;EAChI;CACF;CAEA,cAAc,UAAsD;EAClE,KAAK,UAAU,IAAI,QAAQ;EAC3B,aAAa;GAAE,KAAK,UAAU,OAAO,QAAQ;EAAE;CACjD;CAEA,cAAqC;EACnC,OAAO,oBAAoB,KAAK,UAAU,KAAK,UAAU,CAAC,GAAG,KAAK,aAAa,OAAO,CAAC,CAAC;CAC1F;CAEA,eAA6B;EAC3B,KAAK,YAAY;EACjB,KAAK,eAAe,KAAK,YAAY;EACrC,KAAK,MAAM,YAAY,KAAK,WAAW,SAAS,KAAK,YAAY;CACnE;AACF;AAEA,SAAS,iBAAiB,YAAgC,OAA4B;CACpF,IAAI,WAAW,aAAa,KAAK,MAAM,IAAI,MAAM,IAAI,UAAU,gCAAgC;CAC/F,IAAI,CAAC,OAAO,cAAc,WAAW,YAAY,KAAK,WAAW,eAAe,GAAG,MAAM,IAAI,UAAU,+BAA+B;CACtI,IAAI,WAAW,QAAQ,iBAAiB,WAAW,cAAc,MAAM,IAAI,0BAA0B,sBAAsB,0CAA0C;CACrK,IAAI,WAAW,QAAQ,SAAS,SAAS,eAAe,MAAM,SAAS,YAAY,MAAM,IAAI,0BAA0B,sBAAsB,8CAA8C;CAC3L,IAAI,WAAW,aAAa,KAAK,MAAM,MAAM,WAAW,UAAU,KAAK,MAAM,IAAI,MAAM,IAAI,UAAU,8CAA8C;CACnJ,WAAW,OAAO,eAAe;AACnC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { g as ConnectionPlan, l as StandardConnection, o as CapabilityImplementation, r as CapabilityDispatch, s as ConnectionEndpoint, v as EndpointOffer, y as ResolveConnectionOptions } from "./connection-CdGcSQnu.js";
|
|
2
|
+
//#region src/memory.d.ts
|
|
3
|
+
declare class MemoryConnectionEndpoint implements ConnectionEndpoint {
|
|
4
|
+
private currentOffer;
|
|
5
|
+
private readonly implementations;
|
|
6
|
+
private readonly offerListeners;
|
|
7
|
+
constructor(offer: EndpointOffer);
|
|
8
|
+
get offer(): EndpointOffer;
|
|
9
|
+
replaceOffer(offer: EndpointOffer): void;
|
|
10
|
+
register(implementation: CapabilityImplementation): () => void;
|
|
11
|
+
dispatch<TInput = unknown, TOutput = unknown, TProgress = unknown>(invocation: CapabilityDispatch<TInput, TProgress>): Promise<TOutput>;
|
|
12
|
+
onOfferChange(listener: (offer: EndpointOffer) => void): () => void;
|
|
13
|
+
}
|
|
14
|
+
interface MemoryConnectionPair {
|
|
15
|
+
readonly left: StandardConnection;
|
|
16
|
+
readonly right: StandardConnection;
|
|
17
|
+
readonly plan: ConnectionPlan;
|
|
18
|
+
renegotiate(options: ResolveConnectionOptions): ConnectionPlan;
|
|
19
|
+
close(reason?: string): void;
|
|
20
|
+
}
|
|
21
|
+
declare function createMemoryConnectionPair(left: ConnectionEndpoint, right: ConnectionEndpoint, options: ResolveConnectionOptions): MemoryConnectionPair;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { MemoryConnectionEndpoint, MemoryConnectionPair, createMemoryConnectionPair };
|
|
24
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","names":[],"sources":["../src/memory.ts"],"mappings":";;cAmBa,oCAAoC;UACvC;mBACS;mBACA;EAEL,YAAA,OAAO;MAKf,SAAS;EAEb,aAAa,OAAO;EAQpB,SAAS,gBAAgB;EAgBnB,SAAS,kBAAkB,mBAAmB,qBAAqB,YAAY,mBAAmB,QAAQ,aAAa,QAAQ;EAerI,cAAc,WAAW,OAAO;;UAMjB;WACN,MAAM;WACN,OAAO;WACP,MAAM;EACf,YAAY,SAAS,2BAA2B;EAChD,MAAM;;iBAGQ,2BACd,MAAM,oBAAoB,OAAO,oBAAoB,SAAS,2BAC7D"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { c as validateEndpointOffer, i as ConnectionInvocationError, t as resolveConnection } from "./resolve-3X6ausgz.js";
|
|
2
|
+
import { sameProtocol } from "@dsh-std/core";
|
|
3
|
+
//#region src/memory.ts
|
|
4
|
+
var MemoryConnectionEndpoint = class {
|
|
5
|
+
currentOffer;
|
|
6
|
+
implementations = [];
|
|
7
|
+
offerListeners = /* @__PURE__ */ new Set();
|
|
8
|
+
constructor(offer) {
|
|
9
|
+
validateEndpointOffer(offer);
|
|
10
|
+
this.currentOffer = offer;
|
|
11
|
+
}
|
|
12
|
+
get offer() {
|
|
13
|
+
return this.currentOffer;
|
|
14
|
+
}
|
|
15
|
+
replaceOffer(offer) {
|
|
16
|
+
validateEndpointOffer(offer);
|
|
17
|
+
if (offer.endpoint.instanceId !== this.currentOffer.endpoint.instanceId) throw new TypeError("replacement offer belongs to another endpoint");
|
|
18
|
+
if (offer.revision <= this.currentOffer.revision) throw new TypeError("replacement offer must increase revision");
|
|
19
|
+
this.currentOffer = offer;
|
|
20
|
+
for (const listener of this.offerListeners) listener(offer);
|
|
21
|
+
}
|
|
22
|
+
register(implementation) {
|
|
23
|
+
const declaration = this.currentOffer.declarations.find((row) => row.participant.id === implementation.participantId);
|
|
24
|
+
if (declaration === void 0 || !(declaration.supports ?? []).some((row) => sameProtocol(row, implementation.protocol))) throw new TypeError("implementation is not backed by a live endpoint declaration");
|
|
25
|
+
if (this.implementations.some((row) => row.participantId === implementation.participantId && sameProtocol(row.protocol, implementation.protocol))) throw new TypeError("capability implementation is already registered");
|
|
26
|
+
const stored = Object.freeze({
|
|
27
|
+
...implementation,
|
|
28
|
+
protocol: Object.freeze({ ...implementation.protocol })
|
|
29
|
+
});
|
|
30
|
+
this.implementations.push(stored);
|
|
31
|
+
return () => {
|
|
32
|
+
const index = this.implementations.indexOf(stored);
|
|
33
|
+
if (index >= 0) this.implementations.splice(index, 1);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async dispatch(invocation) {
|
|
37
|
+
const implementation = this.implementations.find((row) => row.participantId === invocation.binding.provider.participantId && sameProtocol(row.protocol, invocation.binding.support));
|
|
38
|
+
if (implementation === void 0) throw new ConnectionInvocationError("handler-missing", "binding has no live implementation");
|
|
39
|
+
return await implementation.handle(invocation.operation, invocation.input, Object.freeze({
|
|
40
|
+
connectionId: invocation.connectionId,
|
|
41
|
+
planRevision: invocation.planRevision,
|
|
42
|
+
invocationId: invocation.invocationId,
|
|
43
|
+
binding: invocation.binding,
|
|
44
|
+
signal: invocation.signal,
|
|
45
|
+
progress: invocation.progress
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
onOfferChange(listener) {
|
|
49
|
+
this.offerListeners.add(listener);
|
|
50
|
+
return () => {
|
|
51
|
+
this.offerListeners.delete(listener);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
function createMemoryConnectionPair(left, right, options) {
|
|
56
|
+
return new MemoryPair(left, right, options);
|
|
57
|
+
}
|
|
58
|
+
var MemoryPair = class {
|
|
59
|
+
leftEndpoint;
|
|
60
|
+
rightEndpoint;
|
|
61
|
+
currentPlan;
|
|
62
|
+
closed = false;
|
|
63
|
+
invocationSequence = 0;
|
|
64
|
+
listeners = /* @__PURE__ */ new Set();
|
|
65
|
+
active = /* @__PURE__ */ new Map();
|
|
66
|
+
left;
|
|
67
|
+
right;
|
|
68
|
+
constructor(leftEndpoint, rightEndpoint, options) {
|
|
69
|
+
this.leftEndpoint = leftEndpoint;
|
|
70
|
+
this.rightEndpoint = rightEndpoint;
|
|
71
|
+
this.currentPlan = resolveConnection(leftEndpoint.offer, rightEndpoint.offer, options);
|
|
72
|
+
this.left = new MemoryConnectionView(this, leftEndpoint, rightEndpoint);
|
|
73
|
+
this.right = new MemoryConnectionView(this, rightEndpoint, leftEndpoint);
|
|
74
|
+
}
|
|
75
|
+
get plan() {
|
|
76
|
+
return this.currentPlan;
|
|
77
|
+
}
|
|
78
|
+
renegotiate(options) {
|
|
79
|
+
this.assertOpen();
|
|
80
|
+
if (options.connectionId !== this.currentPlan.connectionId || options.revision <= this.currentPlan.revision) throw new TypeError("renegotiation must retain connectionId and increase revision");
|
|
81
|
+
this.currentPlan = resolveConnection(this.leftEndpoint.offer, this.rightEndpoint.offer, options);
|
|
82
|
+
for (const listener of this.listeners) listener(this.currentPlan);
|
|
83
|
+
return this.currentPlan;
|
|
84
|
+
}
|
|
85
|
+
subscribe(listener) {
|
|
86
|
+
this.listeners.add(listener);
|
|
87
|
+
return () => {
|
|
88
|
+
this.listeners.delete(listener);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
binding(local, participantId, reference) {
|
|
92
|
+
if (this.closed) return void 0;
|
|
93
|
+
return this.currentPlan.bindings.find((binding) => binding.consumer.endpoint.instanceId === local.offer.endpoint.instanceId && binding.consumer.participantId === participantId && sameProtocol(binding.requirement, reference));
|
|
94
|
+
}
|
|
95
|
+
invoke(local, participantId, reference, operation, input, signal) {
|
|
96
|
+
this.assertOpen();
|
|
97
|
+
signal?.throwIfAborted();
|
|
98
|
+
const binding = this.binding(local, participantId, reference);
|
|
99
|
+
if (binding === void 0) throw new ConnectionInvocationError("capability-unbound", `participant ${JSON.stringify(participantId)} has no binding`);
|
|
100
|
+
const target = binding.provider.endpoint.instanceId === this.leftEndpoint.offer.endpoint.instanceId ? this.leftEndpoint : binding.provider.endpoint.instanceId === this.rightEndpoint.offer.endpoint.instanceId ? this.rightEndpoint : void 0;
|
|
101
|
+
if (target === void 0) throw new ConnectionInvocationError("handler-missing", "binding provider endpoint is unavailable");
|
|
102
|
+
const invocationId = `${local.offer.endpoint.instanceId}:${String(++this.invocationSequence)}`;
|
|
103
|
+
const controller = new AbortController();
|
|
104
|
+
const progress = new AsyncProgress();
|
|
105
|
+
let settled = false;
|
|
106
|
+
let resolveResult;
|
|
107
|
+
let rejectResult;
|
|
108
|
+
const result = new Promise((resolve, reject) => {
|
|
109
|
+
resolveResult = resolve;
|
|
110
|
+
rejectResult = reject;
|
|
111
|
+
});
|
|
112
|
+
const finish = () => {
|
|
113
|
+
settled = true;
|
|
114
|
+
this.active.delete(invocationId);
|
|
115
|
+
progress.close();
|
|
116
|
+
};
|
|
117
|
+
const cancel = (reason = "capability invocation cancelled", code = "cancelled") => {
|
|
118
|
+
if (settled) return;
|
|
119
|
+
controller.abort(reason);
|
|
120
|
+
finish();
|
|
121
|
+
rejectResult(new ConnectionInvocationError(code, reason));
|
|
122
|
+
};
|
|
123
|
+
this.active.set(invocationId, cancel);
|
|
124
|
+
if (signal !== void 0) signal.addEventListener("abort", () => cancel(abortMessage(signal)), { once: true });
|
|
125
|
+
queueMicrotask(() => {
|
|
126
|
+
if (settled) return;
|
|
127
|
+
Promise.resolve(target.dispatch({
|
|
128
|
+
connectionId: this.currentPlan.connectionId,
|
|
129
|
+
planRevision: binding.planRevision,
|
|
130
|
+
invocationId,
|
|
131
|
+
binding,
|
|
132
|
+
operation,
|
|
133
|
+
input,
|
|
134
|
+
signal: controller.signal,
|
|
135
|
+
progress: (value) => {
|
|
136
|
+
if (!settled) progress.push(value);
|
|
137
|
+
}
|
|
138
|
+
})).then((value) => {
|
|
139
|
+
if (!settled) {
|
|
140
|
+
finish();
|
|
141
|
+
resolveResult(value);
|
|
142
|
+
}
|
|
143
|
+
}, (error) => {
|
|
144
|
+
if (!settled) {
|
|
145
|
+
finish();
|
|
146
|
+
rejectResult(error);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
return Object.freeze({
|
|
151
|
+
invocationId,
|
|
152
|
+
result,
|
|
153
|
+
progress,
|
|
154
|
+
cancel
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
close(reason = "connection closed") {
|
|
158
|
+
if (this.closed) return;
|
|
159
|
+
this.closed = true;
|
|
160
|
+
for (const cancel of this.active.values()) cancel(reason, "connection-closed");
|
|
161
|
+
this.active.clear();
|
|
162
|
+
this.listeners.clear();
|
|
163
|
+
}
|
|
164
|
+
assertOpen() {
|
|
165
|
+
if (this.closed) throw new ConnectionInvocationError("connection-closed", "connection is closed");
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
var MemoryConnectionView = class {
|
|
169
|
+
pair;
|
|
170
|
+
localEndpoint;
|
|
171
|
+
remoteEndpoint;
|
|
172
|
+
constructor(pair, localEndpoint, remoteEndpoint) {
|
|
173
|
+
this.pair = pair;
|
|
174
|
+
this.localEndpoint = localEndpoint;
|
|
175
|
+
this.remoteEndpoint = remoteEndpoint;
|
|
176
|
+
}
|
|
177
|
+
get id() {
|
|
178
|
+
return this.pair.plan.connectionId;
|
|
179
|
+
}
|
|
180
|
+
get local() {
|
|
181
|
+
return this.localEndpoint.offer.endpoint;
|
|
182
|
+
}
|
|
183
|
+
get remote() {
|
|
184
|
+
return this.remoteEndpoint.offer.endpoint;
|
|
185
|
+
}
|
|
186
|
+
get plan() {
|
|
187
|
+
return this.pair.plan;
|
|
188
|
+
}
|
|
189
|
+
client(participantId) {
|
|
190
|
+
nonEmpty(participantId, "participantId");
|
|
191
|
+
return Object.freeze({
|
|
192
|
+
participantId,
|
|
193
|
+
binding: (reference) => this.pair.binding(this.localEndpoint, participantId, reference),
|
|
194
|
+
invoke: (reference, operation, input, options) => this.pair.invoke(this.localEndpoint, participantId, reference, operation, input, options?.signal)
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
onPlanChange(listener) {
|
|
198
|
+
return this.pair.subscribe(listener);
|
|
199
|
+
}
|
|
200
|
+
close(reason) {
|
|
201
|
+
this.pair.close(reason);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var AsyncProgress = class {
|
|
205
|
+
values = [];
|
|
206
|
+
waiters = [];
|
|
207
|
+
done = false;
|
|
208
|
+
push(value) {
|
|
209
|
+
if (this.done) return;
|
|
210
|
+
const waiter = this.waiters.shift();
|
|
211
|
+
if (waiter === void 0) this.values.push(value);
|
|
212
|
+
else waiter({
|
|
213
|
+
done: false,
|
|
214
|
+
value
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
close() {
|
|
218
|
+
if (this.done) return;
|
|
219
|
+
this.done = true;
|
|
220
|
+
for (const waiter of this.waiters.splice(0)) waiter({
|
|
221
|
+
done: true,
|
|
222
|
+
value: void 0
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
next() {
|
|
226
|
+
if (this.values.length > 0) return Promise.resolve({
|
|
227
|
+
done: false,
|
|
228
|
+
value: this.values.shift()
|
|
229
|
+
});
|
|
230
|
+
if (this.done) return Promise.resolve({
|
|
231
|
+
done: true,
|
|
232
|
+
value: void 0
|
|
233
|
+
});
|
|
234
|
+
return new Promise((resolve) => {
|
|
235
|
+
this.waiters.push(resolve);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return() {
|
|
239
|
+
this.close();
|
|
240
|
+
return Promise.resolve({
|
|
241
|
+
done: true,
|
|
242
|
+
value: void 0
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
[Symbol.asyncIterator]() {
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
function abortMessage(signal) {
|
|
250
|
+
return signal.reason instanceof Error ? signal.reason.message : typeof signal.reason === "string" ? signal.reason : "capability invocation cancelled";
|
|
251
|
+
}
|
|
252
|
+
function nonEmpty(value, label) {
|
|
253
|
+
if (typeof value !== "string" || value.trim() === "") throw new TypeError(`${label} must be non-empty`);
|
|
254
|
+
}
|
|
255
|
+
//#endregion
|
|
256
|
+
export { MemoryConnectionEndpoint, createMemoryConnectionPair };
|
|
257
|
+
|
|
258
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","names":[],"sources":["../src/memory.ts"],"sourcesContent":["import { sameProtocol, type ApiReference } from '@dsh-std/core'\nimport {\n ConnectionInvocationError,\n type CapabilityCall,\n type CapabilityClient,\n type CapabilityDispatch,\n type CapabilityImplementation,\n type ConnectionEndpoint,\n type StandardConnection,\n} from './connection.js'\nimport {\n validateEndpointOffer,\n type CapabilityBinding,\n type ConnectionPlan,\n type EndpointOffer,\n type ResolveConnectionOptions,\n} from './model.js'\nimport { resolveConnection } from './resolve.js'\n\nexport class MemoryConnectionEndpoint implements ConnectionEndpoint {\n private currentOffer: EndpointOffer\n private readonly implementations: CapabilityImplementation[] = []\n private readonly offerListeners = new Set<(offer: EndpointOffer) => void>()\n\n constructor(offer: EndpointOffer) {\n validateEndpointOffer(offer)\n this.currentOffer = offer\n }\n\n get offer(): EndpointOffer { return this.currentOffer }\n\n replaceOffer(offer: EndpointOffer): void {\n validateEndpointOffer(offer)\n if (offer.endpoint.instanceId !== this.currentOffer.endpoint.instanceId) throw new TypeError('replacement offer belongs to another endpoint')\n if (offer.revision <= this.currentOffer.revision) throw new TypeError('replacement offer must increase revision')\n this.currentOffer = offer\n for (const listener of this.offerListeners) listener(offer)\n }\n\n register(implementation: CapabilityImplementation): () => void {\n const declaration = this.currentOffer.declarations.find(row => row.participant.id === implementation.participantId)\n if (declaration === undefined || !(declaration.supports ?? []).some(row => sameProtocol(row, implementation.protocol))) {\n throw new TypeError('implementation is not backed by a live endpoint declaration')\n }\n if (this.implementations.some(row => row.participantId === implementation.participantId && sameProtocol(row.protocol, implementation.protocol))) {\n throw new TypeError('capability implementation is already registered')\n }\n const stored = Object.freeze({ ...implementation, protocol: Object.freeze({ ...implementation.protocol }) })\n this.implementations.push(stored)\n return () => {\n const index = this.implementations.indexOf(stored)\n if (index >= 0) this.implementations.splice(index, 1)\n }\n }\n\n async dispatch<TInput = unknown, TOutput = unknown, TProgress = unknown>(invocation: CapabilityDispatch<TInput, TProgress>): Promise<TOutput> {\n const implementation = this.implementations.find(row =>\n row.participantId === invocation.binding.provider.participantId\n && sameProtocol(row.protocol, invocation.binding.support))\n if (implementation === undefined) throw new ConnectionInvocationError('handler-missing', 'binding has no live implementation')\n return await implementation.handle(invocation.operation, invocation.input, Object.freeze({\n connectionId: invocation.connectionId,\n planRevision: invocation.planRevision,\n invocationId: invocation.invocationId,\n binding: invocation.binding,\n signal: invocation.signal,\n progress: invocation.progress,\n })) as TOutput\n }\n\n onOfferChange(listener: (offer: EndpointOffer) => void): () => void {\n this.offerListeners.add(listener)\n return () => { this.offerListeners.delete(listener) }\n }\n}\n\nexport interface MemoryConnectionPair {\n readonly left: StandardConnection\n readonly right: StandardConnection\n readonly plan: ConnectionPlan\n renegotiate(options: ResolveConnectionOptions): ConnectionPlan\n close(reason?: string): void\n}\n\nexport function createMemoryConnectionPair(\n left: ConnectionEndpoint, right: ConnectionEndpoint, options: ResolveConnectionOptions,\n): MemoryConnectionPair {\n return new MemoryPair(left, right, options)\n}\n\nclass MemoryPair implements MemoryConnectionPair {\n private currentPlan: ConnectionPlan\n private closed = false\n private invocationSequence = 0\n private readonly listeners = new Set<(plan: ConnectionPlan) => void>()\n private readonly active = new Map<string, (reason?: string, code?: 'cancelled' | 'connection-closed') => void>()\n readonly left: StandardConnection\n readonly right: StandardConnection\n\n constructor(\n private readonly leftEndpoint: ConnectionEndpoint,\n private readonly rightEndpoint: ConnectionEndpoint,\n options: ResolveConnectionOptions,\n ) {\n this.currentPlan = resolveConnection(leftEndpoint.offer, rightEndpoint.offer, options)\n this.left = new MemoryConnectionView(this, leftEndpoint, rightEndpoint)\n this.right = new MemoryConnectionView(this, rightEndpoint, leftEndpoint)\n }\n\n get plan(): ConnectionPlan { return this.currentPlan }\n\n renegotiate(options: ResolveConnectionOptions): ConnectionPlan {\n this.assertOpen()\n if (options.connectionId !== this.currentPlan.connectionId || options.revision <= this.currentPlan.revision) {\n throw new TypeError('renegotiation must retain connectionId and increase revision')\n }\n this.currentPlan = resolveConnection(this.leftEndpoint.offer, this.rightEndpoint.offer, options)\n for (const listener of this.listeners) listener(this.currentPlan)\n return this.currentPlan\n }\n\n subscribe(listener: (plan: ConnectionPlan) => void): () => void {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n binding(local: ConnectionEndpoint, participantId: string, reference: ApiReference): CapabilityBinding | undefined {\n if (this.closed) return undefined\n return this.currentPlan.bindings.find(binding =>\n binding.consumer.endpoint.instanceId === local.offer.endpoint.instanceId\n && binding.consumer.participantId === participantId\n && sameProtocol(binding.requirement, reference))\n }\n\n invoke<TInput, TOutput, TProgress>(\n local: ConnectionEndpoint,\n participantId: string,\n reference: ApiReference,\n operation: string,\n input: TInput,\n signal?: AbortSignal,\n ): CapabilityCall<TOutput, TProgress> {\n this.assertOpen()\n signal?.throwIfAborted()\n const binding = this.binding(local, participantId, reference)\n if (binding === undefined) throw new ConnectionInvocationError('capability-unbound', `participant ${JSON.stringify(participantId)} has no binding`)\n const target = binding.provider.endpoint.instanceId === this.leftEndpoint.offer.endpoint.instanceId\n ? this.leftEndpoint\n : binding.provider.endpoint.instanceId === this.rightEndpoint.offer.endpoint.instanceId ? this.rightEndpoint : undefined\n if (target === undefined) throw new ConnectionInvocationError('handler-missing', 'binding provider endpoint is unavailable')\n const invocationId = `${local.offer.endpoint.instanceId}:${String(++this.invocationSequence)}`\n const controller = new AbortController()\n const progress = new AsyncProgress<TProgress>()\n let settled = false\n let resolveResult!: (value: TOutput | PromiseLike<TOutput>) => void\n let rejectResult!: (reason?: unknown) => void\n const result = new Promise<TOutput>((resolve, reject) => { resolveResult = resolve; rejectResult = reject })\n const finish = () => { settled = true; this.active.delete(invocationId); progress.close() }\n const cancel = (reason = 'capability invocation cancelled', code: 'cancelled' | 'connection-closed' = 'cancelled') => {\n if (settled) return\n controller.abort(reason)\n finish()\n rejectResult(new ConnectionInvocationError(code, reason))\n }\n this.active.set(invocationId, cancel)\n if (signal !== undefined) signal.addEventListener('abort', () => cancel(abortMessage(signal)), { once: true })\n queueMicrotask(() => {\n if (settled) return\n Promise.resolve(target.dispatch<TInput, TOutput, TProgress>({\n connectionId: this.currentPlan.connectionId,\n planRevision: binding.planRevision,\n invocationId,\n binding,\n operation,\n input,\n signal: controller.signal,\n progress: value => { if (!settled) progress.push(value) },\n })).then(value => { if (!settled) { finish(); resolveResult(value) } }, error => {\n if (!settled) { finish(); rejectResult(error) }\n })\n })\n return Object.freeze({ invocationId, result, progress, cancel })\n }\n\n close(reason = 'connection closed'): void {\n if (this.closed) return\n this.closed = true\n for (const cancel of this.active.values()) cancel(reason, 'connection-closed')\n this.active.clear()\n this.listeners.clear()\n }\n\n private assertOpen(): void {\n if (this.closed) throw new ConnectionInvocationError('connection-closed', 'connection is closed')\n }\n\n}\n\nclass MemoryConnectionView implements StandardConnection {\n constructor(\n private readonly pair: MemoryPair,\n private readonly localEndpoint: ConnectionEndpoint,\n private readonly remoteEndpoint: ConnectionEndpoint,\n ) {}\n\n get id(): string { return this.pair.plan.connectionId }\n get local() { return this.localEndpoint.offer.endpoint }\n get remote() { return this.remoteEndpoint.offer.endpoint }\n get plan() { return this.pair.plan }\n\n client(participantId: string): CapabilityClient {\n nonEmpty(participantId, 'participantId')\n return Object.freeze({\n participantId,\n binding: (reference: ApiReference) => this.pair.binding(this.localEndpoint, participantId, reference),\n invoke: <TInput, TOutput, TProgress>(\n reference: ApiReference, operation: string, input: TInput, options?: { readonly signal?: AbortSignal },\n ) => this.pair.invoke<TInput, TOutput, TProgress>(this.localEndpoint, participantId, reference, operation, input, options?.signal),\n })\n }\n\n onPlanChange(listener: (plan: ConnectionPlan) => void): () => void { return this.pair.subscribe(listener) }\n close(reason?: string): void { this.pair.close(reason) }\n}\n\nclass AsyncProgress<T> implements AsyncIterableIterator<T> {\n private readonly values: T[] = []\n private readonly waiters: Array<(result: IteratorResult<T>) => void> = []\n private done = false\n push(value: T): void {\n if (this.done) return\n const waiter = this.waiters.shift()\n if (waiter === undefined) this.values.push(value)\n else waiter({ done: false, value })\n }\n close(): void {\n if (this.done) return\n this.done = true\n for (const waiter of this.waiters.splice(0)) waiter({ done: true, value: undefined })\n }\n next(): Promise<IteratorResult<T>> {\n if (this.values.length > 0) return Promise.resolve({ done: false, value: this.values.shift() as T })\n if (this.done) return Promise.resolve({ done: true, value: undefined })\n return new Promise(resolve => { this.waiters.push(resolve) })\n }\n return(): Promise<IteratorResult<T>> { this.close(); return Promise.resolve({ done: true, value: undefined }) }\n [Symbol.asyncIterator](): AsyncIterableIterator<T> { return this }\n}\n\nfunction abortMessage(signal: AbortSignal): string {\n return signal.reason instanceof Error ? signal.reason.message : typeof signal.reason === 'string' ? signal.reason : 'capability invocation cancelled'\n}\n\nfunction nonEmpty(value: string, label: string): void {\n if (typeof value !== 'string' || value.trim() === '') throw new TypeError(`${label} must be non-empty`)\n}\n"],"mappings":";;;AAmBA,IAAa,2BAAb,MAAoE;CAClE;CACA,kBAA+D,CAAC;CAChE,iCAAkC,IAAI,IAAoC;CAE1E,YAAY,OAAsB;EAChC,sBAAsB,KAAK;EAC3B,KAAK,eAAe;CACtB;CAEA,IAAI,QAAuB;EAAE,OAAO,KAAK;CAAa;CAEtD,aAAa,OAA4B;EACvC,sBAAsB,KAAK;EAC3B,IAAI,MAAM,SAAS,eAAe,KAAK,aAAa,SAAS,YAAY,MAAM,IAAI,UAAU,+CAA+C;EAC5I,IAAI,MAAM,YAAY,KAAK,aAAa,UAAU,MAAM,IAAI,UAAU,0CAA0C;EAChH,KAAK,eAAe;EACpB,KAAK,MAAM,YAAY,KAAK,gBAAgB,SAAS,KAAK;CAC5D;CAEA,SAAS,gBAAsD;EAC7D,MAAM,cAAc,KAAK,aAAa,aAAa,MAAK,QAAO,IAAI,YAAY,OAAO,eAAe,aAAa;EAClH,IAAI,gBAAgB,KAAA,KAAa,EAAE,YAAY,YAAY,CAAC,EAAA,CAAG,MAAK,QAAO,aAAa,KAAK,eAAe,QAAQ,CAAC,GACnH,MAAM,IAAI,UAAU,6DAA6D;EAEnF,IAAI,KAAK,gBAAgB,MAAK,QAAO,IAAI,kBAAkB,eAAe,iBAAiB,aAAa,IAAI,UAAU,eAAe,QAAQ,CAAC,GAC5I,MAAM,IAAI,UAAU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