@deepseek-harness-tui/dsh-tui 0.9.2 → 0.9.3
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 +4 -4
- package/bin/dsh-tui.js +26 -4
- package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -13
- package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -59
- package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -15
- package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -32
- package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -59
- package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -166
- package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -42
- package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -143
- package/dsh-ecosystem-spec/registry/README.md +14 -14
- package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -56
- package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -13
- package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -149
- package/lib/types/commands.d.ts.map +1 -1
- package/lib/types/commands.js +7 -8
- package/lib/types/components/BalanceReportRow.d.ts +24 -0
- package/lib/types/components/BalanceReportRow.d.ts.map +1 -0
- package/lib/types/components/BalanceReportRow.js +87 -0
- package/lib/types/components/HistorySearchDialog.js +1 -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 +11 -7
- package/lib/types/components/PluginSceneBoundary.d.ts +1 -1
- package/lib/types/components/PluginSceneBoundary.js +1 -1
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +16 -0
- package/lib/types/components/Whale.d.ts +15 -4
- package/lib/types/components/Whale.d.ts.map +1 -1
- package/lib/types/components/Whale.js +9 -8
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +7 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +34 -4
- package/lib/types/deepseekBalance.d.ts +53 -0
- package/lib/types/deepseekBalance.d.ts.map +1 -0
- package/lib/types/deepseekBalance.js +86 -0
- package/lib/types/deepseekPricing.d.ts +82 -0
- package/lib/types/deepseekPricing.d.ts.map +1 -0
- package/lib/types/deepseekPricing.js +133 -0
- package/lib/types/dsh-adapter/channel.d.ts +46 -1
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.js +84 -10
- package/lib/types/dsh-adapter/index.d.ts +5 -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/packaged-skills.d.ts +9 -0
- package/lib/types/dsh-adapter/packaged-skills.d.ts.map +1 -1
- package/lib/types/dsh-adapter/packaged-skills.js +19 -4
- package/lib/types/dsh-adapter/plugin.d.ts +6 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +122 -18
- package/lib/types/dsh-adapter/settings-sections.d.ts +1 -0
- package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
- package/lib/types/dsh-adapter/settings-sections.js +35 -2
- package/lib/types/history.d.ts +4 -3
- package/lib/types/history.d.ts.map +1 -1
- package/lib/types/history.js +66 -18
- package/lib/types/i18n.d.ts +122 -55
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +39 -18
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +67 -17
- package/lib/types/ink/root.d.ts +16 -0
- package/lib/types/ink/root.d.ts.map +1 -1
- package/lib/types/ink/root.js +2 -0
- package/lib/types/ink/terminal-querier.d.ts +8 -0
- package/lib/types/ink/terminal-querier.d.ts.map +1 -1
- package/lib/types/ink/terminal-querier.js +13 -0
- package/lib/types/ink/terminal.d.ts +42 -0
- package/lib/types/ink/terminal.d.ts.map +1 -1
- package/lib/types/ink/terminal.js +52 -2
- package/lib/types/plugin-spec/registry.d.ts +1 -1
- package/lib/types/plugin-spec/registry.js +1 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +72 -37
- package/lib/types/screens/SessionBrowser.d.ts.map +1 -1
- package/lib/types/screens/SessionBrowser.js +28 -13
- package/lib/types/screens/SessionTree.d.ts.map +1 -1
- package/lib/types/screens/SessionTree.js +33 -9
- package/lib/types/screens/Settings.d.ts +7 -5
- package/lib/types/screens/Settings.d.ts.map +1 -1
- package/lib/types/screens/Settings.js +206 -99
- package/lib/types/screens/StatusLine.d.ts.map +1 -1
- package/lib/types/screens/StatusLine.js +32 -1
- package/lib/types/sessionHistory.d.ts +11 -0
- package/lib/types/sessionHistory.d.ts.map +1 -1
- package/lib/types/sessionHistory.js +29 -0
- package/lib/types/sessions/format.d.ts.map +1 -1
- package/lib/types/sessions/format.js +14 -4
- package/lib/types/tips.js +2 -2
- package/lib/types/tuiDisplayPrefs.d.ts +3 -0
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +1 -0
- package/lib/types/update.d.ts +46 -0
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +232 -3
- package/node_modules/@deepseek-harness-tui/dsh-auth/LICENSE +21 -21
- package/node_modules/@deepseek-harness-tui/dsh-auth/dsh-plugin.json +44 -44
- package/node_modules/@dsh-std/command/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/command/LICENSE +21 -21
- package/node_modules/@dsh-std/command/README.md +26 -26
- package/node_modules/@dsh-std/command/README.zh.md +28 -28
- package/node_modules/@dsh-std/command/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/command/package.json +22 -22
- package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/connection/LICENSE +21 -21
- package/node_modules/@dsh-std/connection/README.md +42 -42
- package/node_modules/@dsh-std/connection/README.zh.md +42 -42
- package/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
- package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
- package/node_modules/@dsh-std/connection/package.json +20 -20
- package/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/core/LICENSE +21 -21
- package/node_modules/@dsh-std/core/README.md +13 -13
- package/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/core/package.json +21 -21
- package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -9
- package/node_modules/@dsh-std/manifest/LICENSE +21 -21
- package/node_modules/@dsh-std/manifest/README.md +5 -5
- package/node_modules/@dsh-std/manifest/README.zh.md +5 -5
- package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/manifest/package.json +20 -20
- package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -144
- package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/messages/LICENSE +21 -21
- package/node_modules/@dsh-std/messages/README.md +5 -5
- package/node_modules/@dsh-std/messages/README.zh.md +7 -7
- package/node_modules/@dsh-std/messages/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/messages/package.json +20 -20
- package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -54
- package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -9
- package/node_modules/@dsh-std/presentation/LICENSE +21 -21
- package/node_modules/@dsh-std/presentation/README.md +27 -27
- package/node_modules/@dsh-std/presentation/README.zh.md +29 -29
- package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -1
- package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/presentation/package.json +25 -25
- package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -8
- package/node_modules/@dsh-std/storage/LICENSE +21 -21
- package/node_modules/@dsh-std/storage/README.md +5 -5
- package/node_modules/@dsh-std/storage/README.zh.md +7 -7
- package/node_modules/@dsh-std/storage/lib/index.js.map +1 -1
- package/node_modules/@dsh-std/storage/package.json +20 -20
- package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -56
- package/package.json +95 -5
- package/skills/pr-comments/SKILL.md +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -42
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -42
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -20
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -9
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -5
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -5
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -20
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -144
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -9
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -21
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -27
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -29
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -25
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -21
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -42
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -42
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -20
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -21
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -21
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -13
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -13
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -1
- package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -21
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "urn:dsh-std:storage:local-storage:0.15",
|
|
4
|
-
"title": "LocalStorage v0.15 operations",
|
|
5
|
-
"$defs": {
|
|
6
|
-
"jsonValue": {
|
|
7
|
-
"oneOf": [
|
|
8
|
-
{ "type": "null" },
|
|
9
|
-
{ "type": "boolean" },
|
|
10
|
-
{ "type": "number" },
|
|
11
|
-
{ "type": "string" },
|
|
12
|
-
{ "type": "array", "items": { "$ref": "#/$defs/jsonValue" } },
|
|
13
|
-
{ "type": "object", "additionalProperties": { "$ref": "#/$defs/jsonValue" } }
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"getInput": {
|
|
17
|
-
"type": "object",
|
|
18
|
-
"additionalProperties": false,
|
|
19
|
-
"required": ["key"],
|
|
20
|
-
"properties": { "key": { "type": "string", "minLength": 1 } }
|
|
21
|
-
},
|
|
22
|
-
"getOutput": {
|
|
23
|
-
"type": "object",
|
|
24
|
-
"additionalProperties": false,
|
|
25
|
-
"required": ["value"],
|
|
26
|
-
"properties": { "value": { "$ref": "#/$defs/jsonValue" } }
|
|
27
|
-
},
|
|
28
|
-
"setInput": {
|
|
29
|
-
"type": "object",
|
|
30
|
-
"additionalProperties": false,
|
|
31
|
-
"required": ["key", "value"],
|
|
32
|
-
"properties": {
|
|
33
|
-
"key": { "type": "string", "minLength": 1 },
|
|
34
|
-
"value": { "$ref": "#/$defs/jsonValue" }
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"setOutput": {
|
|
38
|
-
"type": "object",
|
|
39
|
-
"additionalProperties": false,
|
|
40
|
-
"required": ["stored"],
|
|
41
|
-
"properties": { "stored": { "const": true } }
|
|
42
|
-
},
|
|
43
|
-
"deleteInput": {
|
|
44
|
-
"type": "object",
|
|
45
|
-
"additionalProperties": false,
|
|
46
|
-
"required": ["key"],
|
|
47
|
-
"properties": { "key": { "type": "string", "minLength": 1 } }
|
|
48
|
-
},
|
|
49
|
-
"deleteOutput": {
|
|
50
|
-
"type": "object",
|
|
51
|
-
"additionalProperties": false,
|
|
52
|
-
"required": ["deleted"],
|
|
53
|
-
"properties": { "deleted": { "type": "boolean" } }
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "urn:dsh-std:storage:local-storage:0.15",
|
|
4
|
+
"title": "LocalStorage v0.15 operations",
|
|
5
|
+
"$defs": {
|
|
6
|
+
"jsonValue": {
|
|
7
|
+
"oneOf": [
|
|
8
|
+
{ "type": "null" },
|
|
9
|
+
{ "type": "boolean" },
|
|
10
|
+
{ "type": "number" },
|
|
11
|
+
{ "type": "string" },
|
|
12
|
+
{ "type": "array", "items": { "$ref": "#/$defs/jsonValue" } },
|
|
13
|
+
{ "type": "object", "additionalProperties": { "$ref": "#/$defs/jsonValue" } }
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"getInput": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"additionalProperties": false,
|
|
19
|
+
"required": ["key"],
|
|
20
|
+
"properties": { "key": { "type": "string", "minLength": 1 } }
|
|
21
|
+
},
|
|
22
|
+
"getOutput": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"required": ["value"],
|
|
26
|
+
"properties": { "value": { "$ref": "#/$defs/jsonValue" } }
|
|
27
|
+
},
|
|
28
|
+
"setInput": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": false,
|
|
31
|
+
"required": ["key", "value"],
|
|
32
|
+
"properties": {
|
|
33
|
+
"key": { "type": "string", "minLength": 1 },
|
|
34
|
+
"value": { "$ref": "#/$defs/jsonValue" }
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"setOutput": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"required": ["stored"],
|
|
41
|
+
"properties": { "stored": { "const": true } }
|
|
42
|
+
},
|
|
43
|
+
"deleteInput": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"required": ["key"],
|
|
47
|
+
"properties": { "key": { "type": "string", "minLength": 1 } }
|
|
48
|
+
},
|
|
49
|
+
"deleteOutput": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"additionalProperties": false,
|
|
52
|
+
"required": ["deleted"],
|
|
53
|
+
"properties": { "deleted": { "type": "boolean" } }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-harness-tui/dsh-tui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "Claude Code style interactive TUI front door for DeepSeek Harness agents, built on the ported Ink core.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"#dsh-ecosystem-spec/tui-channel": "./dsh-ecosystem-spec/protocols/tui-channel.js"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
|
-
"dsh-tui": "./bin/dsh-tui.js"
|
|
22
|
+
"dsh-tui": "./bin/dsh-tui.js",
|
|
23
|
+
"dst": "./bin/dsh-tui.js"
|
|
23
24
|
},
|
|
24
25
|
"main": "lib/types/index.js",
|
|
25
26
|
"types": "lib/types/index.d.ts",
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
"prompt:debug": "node scripts/read-prompt-debug.mjs",
|
|
99
100
|
"tui": "node --import tsx/esm scripts/run.ts",
|
|
100
101
|
"smoke": "node --import tsx/esm scripts/smoke.tsx",
|
|
101
|
-
"verify:build": "npm run verify:boundary && npm run verify:contract && npm run verify:herdr && npm run verify:manifest-deps && npm run verify:patch-surface && npm run verify:web-coexistence && npm run verify:plugin-spec && npm run verify:plugin-grants && npm run verify:plugin-storage && npm run verify:plugin-messages && npm run verify:plugin-ledger && npm run verify:plugin-commands && npm run verify:plugin-negotiation && npm run verify:plugin-lifecycle && npm run verify:packaged-presets && npm run verify:minimal-preset-tools && npm run verify:liangshen-bootstrap && npm run verify:wheel-selection && npm run verify:liangshen-instruction-hint && npm run verify:pointer-events && npm run verify:chat-overlay && npm run verify:i18n",
|
|
102
|
+
"verify:build": "npm run verify:boundary && npm run verify:contract && npm run verify:herdr && npm run verify:manifest-deps && npm run verify:patch-surface && npm run verify:web-coexistence && npm run verify:plugin-spec && npm run verify:plugin-grants && npm run verify:plugin-storage && npm run verify:plugin-messages && npm run verify:plugin-ledger && npm run verify:plugin-commands && npm run verify:plugin-negotiation && npm run verify:plugin-lifecycle && npm run verify:packaged-presets && npm run verify:history-search && npm run verify:skill-direct-invocation && npm run verify:minimal-preset-tools && npm run verify:liangshen-bootstrap && npm run verify:wheel-selection && npm run verify:liangshen-instruction-hint && npm run verify:pointer-events && npm run verify:chat-overlay && npm run verify:i18n && npm run verify:approval-visibility",
|
|
102
103
|
"verify:boundary": "node --import tsx/esm scripts/verify-adapter-boundary.ts",
|
|
103
104
|
"verify:i18n": "node --import tsx/esm scripts/verify-i18n.ts",
|
|
104
105
|
"verify:contract": "node --import tsx/esm scripts/verify-upstream-contract.ts",
|
|
@@ -119,6 +120,7 @@
|
|
|
119
120
|
"verify:bun-package": "node scripts/verify-bun-package.mjs",
|
|
120
121
|
"verify:prompt-debug": "npm run build && node scripts/verify-prompt-debug.mjs",
|
|
121
122
|
"verify:clipboard-image": "node --import tsx/esm scripts/verify-clipboard-image.ts",
|
|
123
|
+
"verify:history-search": "node --import tsx/esm scripts/verify-history-search.mjs",
|
|
122
124
|
"verify:plugin-ledger": "node --import tsx/esm scripts/verify-plugin-ledger.ts",
|
|
123
125
|
"verify:plugin-commands": "node --import tsx/esm scripts/verify-plugin-commands.ts",
|
|
124
126
|
"verify:plugin-negotiation": "node --import tsx/esm scripts/verify-plugin-negotiation.ts",
|
|
@@ -128,8 +130,12 @@
|
|
|
128
130
|
"verify:wheel-selection": "node --import tsx/esm scripts/verify-wheel-selection.ts",
|
|
129
131
|
"verify:pointer-events": "node --import tsx/esm scripts/verify-pointer-events.ts",
|
|
130
132
|
"verify:chat-overlay": "node --import tsx/esm scripts/verify-chat-overlay.ts",
|
|
133
|
+
"verify:approval-visibility": "node --import tsx/esm scripts/verify-approval-visibility.tsx",
|
|
134
|
+
"verify:skill-direct-invocation": "node --import tsx/esm scripts/verify-skill-direct-invocation.ts",
|
|
131
135
|
"sync:profile": "node scripts/sync-profile.mjs",
|
|
132
|
-
"sync:profile:check": "node scripts/sync-profile.mjs --check"
|
|
136
|
+
"sync:profile:check": "node scripts/sync-profile.mjs --check",
|
|
137
|
+
"bundle:installer": "node scripts/make-installer-bundle.mjs",
|
|
138
|
+
"bundle:standalone": "node scripts/make-standalone-bundle.mjs"
|
|
133
139
|
},
|
|
134
140
|
"peerDependencies": {
|
|
135
141
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
@@ -160,8 +166,92 @@
|
|
|
160
166
|
"@deepseek-ai/dsh-workspace": "^0.1.0-rc.6 || ^0.1.1-rc.1",
|
|
161
167
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
162
168
|
},
|
|
169
|
+
"peerDependenciesMeta": {
|
|
170
|
+
"@deepseek-ai/cordis": {
|
|
171
|
+
"optional": true
|
|
172
|
+
},
|
|
173
|
+
"@deepseek-ai/dsh-agent": {
|
|
174
|
+
"optional": true
|
|
175
|
+
},
|
|
176
|
+
"@deepseek-ai/dsh-agent-instructions": {
|
|
177
|
+
"optional": true
|
|
178
|
+
},
|
|
179
|
+
"@deepseek-ai/dsh-agent-presets": {
|
|
180
|
+
"optional": true
|
|
181
|
+
},
|
|
182
|
+
"@deepseek-ai/dsh-atomic-write": {
|
|
183
|
+
"optional": true
|
|
184
|
+
},
|
|
185
|
+
"@deepseek-ai/dsh-commands": {
|
|
186
|
+
"optional": true
|
|
187
|
+
},
|
|
188
|
+
"@deepseek-ai/dsh-cordis-host-runner": {
|
|
189
|
+
"optional": true
|
|
190
|
+
},
|
|
191
|
+
"@deepseek-ai/dsh-invariants": {
|
|
192
|
+
"optional": true
|
|
193
|
+
},
|
|
194
|
+
"@deepseek-ai/dsh-llm": {
|
|
195
|
+
"optional": true
|
|
196
|
+
},
|
|
197
|
+
"@deepseek-ai/dsh-llm-pi-ai": {
|
|
198
|
+
"optional": true
|
|
199
|
+
},
|
|
200
|
+
"@deepseek-ai/dsh-persona": {
|
|
201
|
+
"optional": true
|
|
202
|
+
},
|
|
203
|
+
"@deepseek-ai/dsh-session": {
|
|
204
|
+
"optional": true
|
|
205
|
+
},
|
|
206
|
+
"@deepseek-ai/dsh-settings": {
|
|
207
|
+
"optional": true
|
|
208
|
+
},
|
|
209
|
+
"@deepseek-ai/dsh-skill": {
|
|
210
|
+
"optional": true
|
|
211
|
+
},
|
|
212
|
+
"@deepseek-ai/dsh-storage": {
|
|
213
|
+
"optional": true
|
|
214
|
+
},
|
|
215
|
+
"@deepseek-ai/dsh-storage-domain": {
|
|
216
|
+
"optional": true
|
|
217
|
+
},
|
|
218
|
+
"@deepseek-ai/dsh-storage-json": {
|
|
219
|
+
"optional": true
|
|
220
|
+
},
|
|
221
|
+
"@deepseek-ai/dsh-system-prompt": {
|
|
222
|
+
"optional": true
|
|
223
|
+
},
|
|
224
|
+
"@deepseek-ai/dsh-terminal": {
|
|
225
|
+
"optional": true
|
|
226
|
+
},
|
|
227
|
+
"@deepseek-ai/dsh-terminal-bash": {
|
|
228
|
+
"optional": true
|
|
229
|
+
},
|
|
230
|
+
"@deepseek-ai/dsh-tool-ask-user": {
|
|
231
|
+
"optional": true
|
|
232
|
+
},
|
|
233
|
+
"@deepseek-ai/dsh-tool-bash-persistent": {
|
|
234
|
+
"optional": true
|
|
235
|
+
},
|
|
236
|
+
"@deepseek-ai/dsh-tool-cordis": {
|
|
237
|
+
"optional": true
|
|
238
|
+
},
|
|
239
|
+
"@deepseek-ai/dsh-user-approval": {
|
|
240
|
+
"optional": true
|
|
241
|
+
},
|
|
242
|
+
"@deepseek-ai/dsh-user-questions": {
|
|
243
|
+
"optional": true
|
|
244
|
+
},
|
|
245
|
+
"@deepseek-ai/dsh-workspace": {
|
|
246
|
+
"optional": true
|
|
247
|
+
},
|
|
248
|
+
"@deepseek-ai/schemastery": {
|
|
249
|
+
"optional": true
|
|
250
|
+
}
|
|
251
|
+
},
|
|
163
252
|
"dependencies": {
|
|
164
253
|
"@alcalzone/ansi-tokenize": "^0.3.0",
|
|
254
|
+
"@earendil-works/pi-ai": "^0.82.1",
|
|
165
255
|
"auto-bind": "^4.0.0 || ^5.0.0",
|
|
166
256
|
"bidi-js": "^1.0.0",
|
|
167
257
|
"chalk": "^5.0.0",
|
|
@@ -170,7 +260,6 @@
|
|
|
170
260
|
"code-excerpt": "^3.0.0 || ^4.0.0",
|
|
171
261
|
"diff": "^8.0.4",
|
|
172
262
|
"dsh-working-activity": "^0.3.3",
|
|
173
|
-
"@earendil-works/pi-ai": "^0.82.1",
|
|
174
263
|
"emoji-regex": "^10.0.0",
|
|
175
264
|
"figures": "^6.1.0",
|
|
176
265
|
"get-east-asian-width": "^1.0.0",
|
|
@@ -251,6 +340,7 @@
|
|
|
251
340
|
"@types/react-reconciler": "^0.33.0",
|
|
252
341
|
"@types/semver": "^7.0.0",
|
|
253
342
|
"@xterm/headless": "^6.0.0",
|
|
343
|
+
"tar": "^7.5.22",
|
|
254
344
|
"tsx": "^4.0.0",
|
|
255
345
|
"typescript": "^6.0.3",
|
|
256
346
|
"yaml": "^2.9.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pr-comments
|
|
3
|
-
description: Use when the user asks to review pull request comments, or when the /
|
|
3
|
+
description: Use when the user asks to review pull request comments, or when the /pr-comments command runs — fetch and analyze PR review comments on the current branch and summarize actionable items.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Pull Request Comments Review
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
Changes to `@dsh-std/connection` are recorded here.
|
|
4
|
-
|
|
5
|
-
## 0.1.0 (draft)
|
|
6
|
-
|
|
7
|
-
- Defined connection services, endpoint views, participant publication, capability bindings, and attachments.
|
|
8
|
-
- Added an in-memory transport for protocol conformance and host integration tests.
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Changes to `@dsh-std/connection` are recorded here.
|
|
4
|
+
|
|
5
|
+
## 0.1.0 (draft)
|
|
6
|
+
|
|
7
|
+
- Defined connection services, endpoint views, participant publication, capability bindings, and attachments.
|
|
8
|
+
- Added an in-memory transport for protocol conformance and host integration tests.
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 DSH Standard contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DSH Standard contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
# @dsh-std/connection
|
|
2
|
-
|
|
3
|
-
English | [中文](README.zh.md)
|
|
4
|
-
|
|
5
|
-
The proposed design is documented in [Endpoint Connection](../../docs/proposals/endpoint-connection.zh.md). It separates the application-facing `ConnectionService` from the Connection Host provider SPI. The remainder of this page describes the current reference implementation, which does not yet complete that split.
|
|
6
|
-
|
|
7
|
-
Host-provided communication service, two-endpoint capability negotiation, and implementation-neutral invocation for the DSH Standard.
|
|
8
|
-
|
|
9
|
-
## Endpoint offers
|
|
10
|
-
|
|
11
|
-
An endpoint offer contains an endpoint identity, a revision, and the live participant declarations admitted by endpoint policy. It carries no component manifests, installation inventory, or plugin registry.
|
|
12
|
-
|
|
13
|
-
`resolveConnection()` passes both sets of declarations to a caller-owned `ProtocolCatalog`. Each protocol definition owns its negotiation and may place invocation bindings in its agreement; connection does not impose consumer/provider semantics on every protocol. `defineCapabilityProtocol()` is an explicit helper for domain protocols that do use RPC-shaped bindings.
|
|
14
|
-
|
|
15
|
-
Each invocation binding is participant-scoped and plan-revision-scoped. A client for one participant cannot discover or invoke bindings granted to another participant.
|
|
16
|
-
|
|
17
|
-
## Current reference API
|
|
18
|
-
|
|
19
|
-
`StandardConnection` exposes endpoint identities, the active plan, consumer-scoped clients, plan-change observation, and close. `CapabilityClient.invoke()` returns an invocation id, a result promise, an asynchronous progress stream, and cancellation. Domain protocol packages own operation names and input, output, and progress values.
|
|
20
|
-
|
|
21
|
-
`ConnectionBroker` selects one registered `ConnectionConnector` for an implementation-neutral target URI. Zero matches and multiple matches are both explicit errors. The broker does not expose the selected connector type through `StandardConnection`.
|
|
22
|
-
|
|
23
|
-
These types are an early reference implementation. They do not require a TUI, Web UI, GUI, or business plugin to register and operate its own connector. The protocol direction places the broker, connector/provider registry, carrier, and wire behind a Connection Host's `ConnectionService`. A consumer submits a target and uses scoped typed clients for the negotiated protocols.
|
|
24
|
-
|
|
25
|
-
A Connection Host may install or discover a remote service, own authentication, ports, forwarding and reconnection, and produce the `StandardConnection`. An SSH target facet contributes resolution and bootstrap integration while system OpenSSH or another provider may supply the physical SSH implementation. Applications do not observe the selected provider, ports, credentials, or wire.
|
|
26
|
-
|
|
27
|
-
## Lifecycle
|
|
28
|
-
|
|
29
|
-
Renegotiation creates a complete new plan revision and publishes it atomically. An invocation admitted under the old revision retains its binding until settlement; later invocations use the new revision. Closing a connection cancels active work and rejects new work with `connection-closed`.
|
|
30
|
-
|
|
31
|
-
Transport implementations must preserve invocation isolation, progress order, cancellation, and the error classification exposed by `ConnectionInvocationError`. They are also responsible for authenticating the peer and preventing one connection from reusing another connection's grants.
|
|
32
|
-
|
|
33
|
-
## Reference implementation
|
|
34
|
-
|
|
35
|
-
The `@dsh-std/connection/memory` export provides a process-local implementation for tests, adapters, and conformance experiments. It demonstrates symmetric calls, progress, cancellation, isolation, and renegotiation. It is not a required carrier or a wire-format specification.
|
|
36
|
-
|
|
37
|
-
## Known Limitations and Deferred Work
|
|
38
|
-
|
|
39
|
-
- The consumer-facing `ConnectionService` and Host provider SPI are not implemented in the current code yet.
|
|
40
|
-
- The package does not yet standardize discovery, authentication, encryption, reconnect policy, framing, or serialization.
|
|
41
|
-
- A connection has exactly two endpoints in `v1alpha1`; multi-party routing is composed from separate connections.
|
|
42
|
-
- The capability helper requires one peer provider by default. Protocols that allow multiple providers must opt into and define that behavior explicitly.
|
|
1
|
+
# @dsh-std/connection
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
The proposed design is documented in [Endpoint Connection](../../docs/proposals/endpoint-connection.zh.md). It separates the application-facing `ConnectionService` from the Connection Host provider SPI. The remainder of this page describes the current reference implementation, which does not yet complete that split.
|
|
6
|
+
|
|
7
|
+
Host-provided communication service, two-endpoint capability negotiation, and implementation-neutral invocation for the DSH Standard.
|
|
8
|
+
|
|
9
|
+
## Endpoint offers
|
|
10
|
+
|
|
11
|
+
An endpoint offer contains an endpoint identity, a revision, and the live participant declarations admitted by endpoint policy. It carries no component manifests, installation inventory, or plugin registry.
|
|
12
|
+
|
|
13
|
+
`resolveConnection()` passes both sets of declarations to a caller-owned `ProtocolCatalog`. Each protocol definition owns its negotiation and may place invocation bindings in its agreement; connection does not impose consumer/provider semantics on every protocol. `defineCapabilityProtocol()` is an explicit helper for domain protocols that do use RPC-shaped bindings.
|
|
14
|
+
|
|
15
|
+
Each invocation binding is participant-scoped and plan-revision-scoped. A client for one participant cannot discover or invoke bindings granted to another participant.
|
|
16
|
+
|
|
17
|
+
## Current reference API
|
|
18
|
+
|
|
19
|
+
`StandardConnection` exposes endpoint identities, the active plan, consumer-scoped clients, plan-change observation, and close. `CapabilityClient.invoke()` returns an invocation id, a result promise, an asynchronous progress stream, and cancellation. Domain protocol packages own operation names and input, output, and progress values.
|
|
20
|
+
|
|
21
|
+
`ConnectionBroker` selects one registered `ConnectionConnector` for an implementation-neutral target URI. Zero matches and multiple matches are both explicit errors. The broker does not expose the selected connector type through `StandardConnection`.
|
|
22
|
+
|
|
23
|
+
These types are an early reference implementation. They do not require a TUI, Web UI, GUI, or business plugin to register and operate its own connector. The protocol direction places the broker, connector/provider registry, carrier, and wire behind a Connection Host's `ConnectionService`. A consumer submits a target and uses scoped typed clients for the negotiated protocols.
|
|
24
|
+
|
|
25
|
+
A Connection Host may install or discover a remote service, own authentication, ports, forwarding and reconnection, and produce the `StandardConnection`. An SSH target facet contributes resolution and bootstrap integration while system OpenSSH or another provider may supply the physical SSH implementation. Applications do not observe the selected provider, ports, credentials, or wire.
|
|
26
|
+
|
|
27
|
+
## Lifecycle
|
|
28
|
+
|
|
29
|
+
Renegotiation creates a complete new plan revision and publishes it atomically. An invocation admitted under the old revision retains its binding until settlement; later invocations use the new revision. Closing a connection cancels active work and rejects new work with `connection-closed`.
|
|
30
|
+
|
|
31
|
+
Transport implementations must preserve invocation isolation, progress order, cancellation, and the error classification exposed by `ConnectionInvocationError`. They are also responsible for authenticating the peer and preventing one connection from reusing another connection's grants.
|
|
32
|
+
|
|
33
|
+
## Reference implementation
|
|
34
|
+
|
|
35
|
+
The `@dsh-std/connection/memory` export provides a process-local implementation for tests, adapters, and conformance experiments. It demonstrates symmetric calls, progress, cancellation, isolation, and renegotiation. It is not a required carrier or a wire-format specification.
|
|
36
|
+
|
|
37
|
+
## Known Limitations and Deferred Work
|
|
38
|
+
|
|
39
|
+
- The consumer-facing `ConnectionService` and Host provider SPI are not implemented in the current code yet.
|
|
40
|
+
- The package does not yet standardize discovery, authentication, encryption, reconnect policy, framing, or serialization.
|
|
41
|
+
- A connection has exactly two endpoints in `v1alpha1`; multi-party routing is composed from separate connections.
|
|
42
|
+
- The capability helper requires one peer provider by default. Protocols that allow multiple providers must opt into and define that behavior explicitly.
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
# @dsh-std/connection
|
|
2
|
-
|
|
3
|
-
[English](README.md) | 中文
|
|
4
|
-
|
|
5
|
-
拟议设计见 [Endpoint Connection](../../docs/proposals/endpoint-connection.zh.md)。规范把普通应用使用的 `ConnectionService` 与 Connection Host 的 provider SPI 分开;本页其余内容描述尚未完成该分层的当前参考实现。
|
|
6
|
-
|
|
7
|
-
DSH Standard 的宿主通信 service、双端点能力协商与实现无关调用。
|
|
8
|
-
|
|
9
|
-
## 端点提议
|
|
10
|
-
|
|
11
|
-
端点提议包含端点身份、修订号,以及经端点 policy 裁剪后的 live participant declarations。它不携带 component manifests、安装记录或插件注册表。
|
|
12
|
-
|
|
13
|
-
`resolveConnection()` 把两端 declarations 交给调用方提供的 `ProtocolCatalog`。每份协议 definition 决定如何协商,并可在 agreement 中产生调用绑定;connection 不为所有协议预设 consumer/provider 语义。内置的 `defineCapabilityProtocol()` 是需要 RPC 绑定的领域协议可显式采用的辅助定义。
|
|
14
|
-
|
|
15
|
-
每项调用绑定都限定于消费 participant 和方案修订版。一个 participant 的客户端不能发现或调用授予另一 participant 的绑定。
|
|
16
|
-
|
|
17
|
-
## 当前参考 API
|
|
18
|
-
|
|
19
|
-
`StandardConnection` 暴露端点身份、当前方案、按消费方隔离的客户端、方案变更观察与关闭操作。`CapabilityClient.invoke()` 返回调用 id、结果 Promise、异步进度流与取消操作。领域协议包拥有操作名称以及输入、输出和进度值的语义。
|
|
20
|
-
|
|
21
|
-
`ConnectionBroker` 根据与实现无关的目标 URI,从已注册 `ConnectionConnector` 中选择唯一实现。零个匹配与多个匹配都是明确错误。broker 不会通过 `StandardConnection` 暴露选中的 connector 类型。
|
|
22
|
-
|
|
23
|
-
这些类型是早期参考实现,不表示 TUI、Web、GUI 或业务插件应自行注册 connector。规范方向是由 Connection Host 把 broker、connector/provider、carrier 和 wire 封装为 `ConnectionService`;consumer 只提交 target,并通过 scoped typed client 使用已协商协议。
|
|
24
|
-
|
|
25
|
-
Connection Host 负责安装或发现远端服务、认证、端口与转发、重连和 `StandardConnection`。SSH target facet 可以贡献解析与 bootstrap 集成,物理 SSH 则可由系统 OpenSSH 或独立 provider 完成。应用不会看到所选 provider、端口、凭据或 wire。
|
|
26
|
-
|
|
27
|
-
## 生命周期
|
|
28
|
-
|
|
29
|
-
重新协商会生成完整的新方案修订版,并原子发布。旧修订版已经接纳的调用保留其绑定直至结束;后续调用使用新修订版。关闭连接会取消活跃工作,并以 `connection-closed` 拒绝新工作。
|
|
30
|
-
|
|
31
|
-
传输实现必须保持调用隔离、进度顺序、取消语义和 `ConnectionInvocationError` 暴露的错误分类。实现还负责认证对端,并阻止一条连接复用另一条连接的授权。
|
|
32
|
-
|
|
33
|
-
## 参考实现
|
|
34
|
-
|
|
35
|
-
`@dsh-std/connection/memory` 导出用于测试、适配器和一致性实验的进程内实现。它演示双向调用、进度、取消、隔离和重新协商,但不是强制承载方式或线协议规范。
|
|
36
|
-
|
|
37
|
-
## 已知限制与暂缓事项
|
|
38
|
-
|
|
39
|
-
- consumer-facing `ConnectionService` 与 Host provider SPI 尚未在当前代码中实现。
|
|
40
|
-
- 本包尚未标准化发现、认证、加密、重连策略、封帧或序列化。
|
|
41
|
-
- `v1alpha1` 的一条连接恰好包含两个端点;多方路由由多条独立连接组合。
|
|
42
|
-
- Capability helper 默认要求唯一对端提供方;需要多提供方的协议必须明确选择其规则。
|
|
1
|
+
# @dsh-std/connection
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
拟议设计见 [Endpoint Connection](../../docs/proposals/endpoint-connection.zh.md)。规范把普通应用使用的 `ConnectionService` 与 Connection Host 的 provider SPI 分开;本页其余内容描述尚未完成该分层的当前参考实现。
|
|
6
|
+
|
|
7
|
+
DSH Standard 的宿主通信 service、双端点能力协商与实现无关调用。
|
|
8
|
+
|
|
9
|
+
## 端点提议
|
|
10
|
+
|
|
11
|
+
端点提议包含端点身份、修订号,以及经端点 policy 裁剪后的 live participant declarations。它不携带 component manifests、安装记录或插件注册表。
|
|
12
|
+
|
|
13
|
+
`resolveConnection()` 把两端 declarations 交给调用方提供的 `ProtocolCatalog`。每份协议 definition 决定如何协商,并可在 agreement 中产生调用绑定;connection 不为所有协议预设 consumer/provider 语义。内置的 `defineCapabilityProtocol()` 是需要 RPC 绑定的领域协议可显式采用的辅助定义。
|
|
14
|
+
|
|
15
|
+
每项调用绑定都限定于消费 participant 和方案修订版。一个 participant 的客户端不能发现或调用授予另一 participant 的绑定。
|
|
16
|
+
|
|
17
|
+
## 当前参考 API
|
|
18
|
+
|
|
19
|
+
`StandardConnection` 暴露端点身份、当前方案、按消费方隔离的客户端、方案变更观察与关闭操作。`CapabilityClient.invoke()` 返回调用 id、结果 Promise、异步进度流与取消操作。领域协议包拥有操作名称以及输入、输出和进度值的语义。
|
|
20
|
+
|
|
21
|
+
`ConnectionBroker` 根据与实现无关的目标 URI,从已注册 `ConnectionConnector` 中选择唯一实现。零个匹配与多个匹配都是明确错误。broker 不会通过 `StandardConnection` 暴露选中的 connector 类型。
|
|
22
|
+
|
|
23
|
+
这些类型是早期参考实现,不表示 TUI、Web、GUI 或业务插件应自行注册 connector。规范方向是由 Connection Host 把 broker、connector/provider、carrier 和 wire 封装为 `ConnectionService`;consumer 只提交 target,并通过 scoped typed client 使用已协商协议。
|
|
24
|
+
|
|
25
|
+
Connection Host 负责安装或发现远端服务、认证、端口与转发、重连和 `StandardConnection`。SSH target facet 可以贡献解析与 bootstrap 集成,物理 SSH 则可由系统 OpenSSH 或独立 provider 完成。应用不会看到所选 provider、端口、凭据或 wire。
|
|
26
|
+
|
|
27
|
+
## 生命周期
|
|
28
|
+
|
|
29
|
+
重新协商会生成完整的新方案修订版,并原子发布。旧修订版已经接纳的调用保留其绑定直至结束;后续调用使用新修订版。关闭连接会取消活跃工作,并以 `connection-closed` 拒绝新工作。
|
|
30
|
+
|
|
31
|
+
传输实现必须保持调用隔离、进度顺序、取消语义和 `ConnectionInvocationError` 暴露的错误分类。实现还负责认证对端,并阻止一条连接复用另一条连接的授权。
|
|
32
|
+
|
|
33
|
+
## 参考实现
|
|
34
|
+
|
|
35
|
+
`@dsh-std/connection/memory` 导出用于测试、适配器和一致性实验的进程内实现。它演示双向调用、进度、取消、隔离和重新协商,但不是强制承载方式或线协议规范。
|
|
36
|
+
|
|
37
|
+
## 已知限制与暂缓事项
|
|
38
|
+
|
|
39
|
+
- consumer-facing `ConnectionService` 与 Host provider SPI 尚未在当前代码中实现。
|
|
40
|
+
- 本包尚未标准化发现、认证、加密、重连策略、封帧或序列化。
|
|
41
|
+
- `v1alpha1` 的一条连接恰好包含两个端点;多方路由由多条独立连接组合。
|
|
42
|
+
- Capability helper 默认要求唯一对端提供方;需要多提供方的协议必须明确选择其规则。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/broker.ts","../src/endpoint.ts"],"sourcesContent":["import { validateEndpointOffer } from './model.js'\r\nimport type { ConnectionEndpoint, StandardConnection } from './connection.js'\r\n\r\nexport interface ConnectionTarget {\r\n /** Implementation-neutral target. Its URI scheme is interpreted by registered connectors. */\r\n readonly uri: string\r\n readonly metadata?: Readonly<Record<string, string>>\r\n}\r\n\r\nexport interface ConnectRequest {\r\n readonly target: ConnectionTarget\r\n /** Live endpoint, including the dispatcher used for peer-to-local calls. */\r\n readonly local: ConnectionEndpoint\r\n readonly signal?: AbortSignal\r\n}\r\n\r\n/** Client half of one concrete connection implementation. */\r\nexport interface ConnectionConnector {\r\n /** Namespaced implementation identity, not a transport or product name exposed to domain consumers. */\r\n readonly id: string\r\n supports(target: ConnectionTarget): boolean\r\n connect(request: ConnectRequest): Promise<StandardConnection>\r\n}\r\n\r\nexport class ConnectionSelectionError extends Error {\r\n constructor(\r\n readonly code: 'implementation-unavailable' | 'implementation-ambiguous',\r\n message: string,\r\n readonly implementations: readonly string[],\r\n ) {\r\n super(message)\r\n this.name = 'ConnectionSelectionError'\r\n }\r\n}\r\n\r\n/**\r\n * Implementation registry used by an adapter or application composition root.\r\n * Domain consumers request a connection; they never import the selected implementation.\r\n */\r\nexport class ConnectionBroker {\r\n private readonly connectors = new Map<string, ConnectionConnector>()\r\n\r\n register(connector: ConnectionConnector): () => void {\r\n namespaced(connector.id, 'connection connector id')\r\n if (this.connectors.has(connector.id)) throw new Error(`connection connector ${JSON.stringify(connector.id)} is already registered`)\r\n this.connectors.set(connector.id, connector)\r\n return () => { if (this.connectors.get(connector.id) === connector) this.connectors.delete(connector.id) }\r\n }\r\n\r\n implementations(target?: ConnectionTarget): readonly string[] {\r\n if (target !== undefined) validateTarget(target)\r\n return Object.freeze([...this.connectors.values()]\r\n .filter(connector => target === undefined || safelySupports(connector, target))\r\n .map(connector => connector.id)\r\n .sort())\r\n }\r\n\r\n async connect(request: ConnectRequest): Promise<StandardConnection> {\r\n validateTarget(request.target)\r\n validateEndpointOffer(request.local.offer)\r\n request.signal?.throwIfAborted()\r\n const matches = [...this.connectors.values()]\r\n .filter(connector => safelySupports(connector, request.target))\r\n .sort((left, right) => left.id.localeCompare(right.id))\r\n if (matches.length === 0) {\r\n throw new ConnectionSelectionError(\r\n 'implementation-unavailable',\r\n `no connection implementation supports ${JSON.stringify(request.target.uri)}`,\r\n [],\r\n )\r\n }\r\n if (matches.length > 1) {\r\n const ids = Object.freeze(matches.map(connector => connector.id))\r\n throw new ConnectionSelectionError(\r\n 'implementation-ambiguous',\r\n `multiple connection implementations support ${JSON.stringify(request.target.uri)}: ${ids.join(', ')}`,\r\n ids,\r\n )\r\n }\r\n return matches[0]!.connect(request)\r\n }\r\n}\r\n\r\nfunction safelySupports(connector: ConnectionConnector, target: ConnectionTarget): boolean {\r\n try { return connector.supports(target) } catch { return false }\r\n}\r\n\r\nfunction validateTarget(target: ConnectionTarget): void {\r\n if (typeof target.uri !== 'string' || target.uri.trim() === '') throw new TypeError('connection target uri must be non-empty')\r\n if (target.metadata !== undefined) {\r\n for (const [key, value] of Object.entries(target.metadata)) {\r\n if (key.trim() === '' || typeof value !== 'string') throw new TypeError('connection target metadata must contain string pairs')\r\n }\r\n }\r\n}\r\n\r\nfunction namespaced(value: string, label: string): void {\r\n if (!/^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$/u.test(value)) throw new TypeError(`${label} must be namespaced`)\r\n}\r\n","import {\r\n defineProtocolDeclaration,\r\n sameProtocol,\r\n type ProtocolDeclaration,\r\n type ProtocolSupport,\r\n} from '@dsh-std/core'\r\nimport {\r\n ConnectionInvocationError,\r\n type CapabilityDispatch,\r\n type CapabilityImplementation,\r\n type ConnectionEndpoint,\r\n} from './connection.js'\r\nimport { createEndpointOffer, type EndpointIdentity, type EndpointOffer } from './model.js'\r\n\r\nexport interface EndpointPublication {\r\n readonly declaration: ProtocolDeclaration\r\n readonly implementations?: readonly CapabilityImplementation[]\r\n}\r\n\r\nexport interface EndpointRuntimeOptions extends EndpointIdentity {\r\n readonly revision?: number\r\n}\r\n\r\nexport class StandardEndpointRuntime implements ConnectionEndpoint {\r\n private readonly declarations = new Map<string, ProtocolDeclaration>()\r\n private readonly implementations: CapabilityImplementation[] = []\r\n private readonly listeners = new Set<(offer: EndpointOffer) => void>()\r\n private readonly identity: EndpointIdentity\r\n private revision: number\r\n private currentOffer: EndpointOffer\r\n\r\n constructor(options: EndpointRuntimeOptions) {\r\n this.identity = Object.freeze({ id: options.id, instanceId: options.instanceId })\r\n this.revision = options.revision ?? 0\r\n this.currentOffer = this.createOffer()\r\n }\r\n\r\n get offer(): EndpointOffer { return this.currentOffer }\r\n\r\n register(publication: EndpointPublication): () => void {\r\n const declaration = defineProtocolDeclaration(publication.declaration)\r\n const participantId = declaration.participant.id\r\n if (this.declarations.has(participantId)) throw new Error(`participant ${JSON.stringify(participantId)} is already registered`)\r\n const implementations = [...(publication.implementations ?? [])]\r\n const implemented = new Set<string>()\r\n for (const implementation of implementations) {\r\n if (implementation.participantId !== participantId) throw new TypeError(`implementation participantId must be ${JSON.stringify(participantId)}`)\r\n if (!(declaration.supports ?? []).some(support => sameProtocol(support, implementation.protocol))) {\r\n throw new TypeError(`participant implementation ${implementation.protocol.apiVersion} ${implementation.protocol.kind} is not declared live`)\r\n }\r\n const key = `${implementation.protocol.apiVersion}\\0${implementation.protocol.kind}`\r\n if (implemented.has(key)) throw new TypeError(`participant has multiple implementations for ${implementation.protocol.apiVersion} ${implementation.protocol.kind}`)\r\n implemented.add(key)\r\n }\r\n const stored = implementations.map(implementation => Object.freeze({\r\n ...implementation, protocol: Object.freeze({ ...implementation.protocol }),\r\n handle: implementation.handle as CapabilityImplementation['handle'],\r\n }))\r\n this.declarations.set(participantId, declaration)\r\n this.implementations.push(...stored)\r\n this.publishOffer()\r\n let active = true\r\n return () => {\r\n if (!active) return\r\n active = false\r\n if (this.declarations.get(participantId) === declaration) this.declarations.delete(participantId)\r\n for (const implementation of stored) {\r\n const index = this.implementations.indexOf(implementation)\r\n if (index >= 0) this.implementations.splice(index, 1)\r\n }\r\n this.publishOffer()\r\n }\r\n }\r\n\r\n async dispatch<TInput = unknown, TOutput = unknown, TProgress = unknown>(invocation: CapabilityDispatch<TInput, TProgress>): Promise<TOutput> {\r\n validateDispatch(invocation, this.currentOffer)\r\n const implementation = this.implementations.find(candidate =>\r\n candidate.participantId === invocation.binding.provider.participantId\r\n && sameProtocol(candidate.protocol, invocation.binding.support))\r\n if (implementation === undefined) throw new ConnectionInvocationError('handler-missing', `binding ${JSON.stringify(invocation.binding.bindingId)} has no live implementation`)\r\n try {\r\n return await implementation.handle(invocation.operation, invocation.input, Object.freeze({\r\n connectionId: invocation.connectionId,\r\n planRevision: invocation.planRevision,\r\n invocationId: invocation.invocationId,\r\n binding: invocation.binding,\r\n signal: invocation.signal,\r\n progress: invocation.progress,\r\n })) as TOutput\r\n } catch (error) {\r\n if (error instanceof ConnectionInvocationError) throw error\r\n throw new ConnectionInvocationError('handler-failed', error instanceof Error ? error.message : String(error), { cause: error })\r\n }\r\n }\r\n\r\n onOfferChange(listener: (offer: EndpointOffer) => void): () => void {\r\n this.listeners.add(listener)\r\n return () => { this.listeners.delete(listener) }\r\n }\r\n\r\n private createOffer(): EndpointOffer {\r\n return createEndpointOffer(this.identity, this.revision, [...this.declarations.values()])\r\n }\r\n\r\n private publishOffer(): void {\r\n this.revision += 1\r\n this.currentOffer = this.createOffer()\r\n for (const listener of this.listeners) listener(this.currentOffer)\r\n }\r\n}\r\n\r\nfunction validateDispatch(invocation: CapabilityDispatch, offer: EndpointOffer): void {\r\n if (invocation.connectionId.trim() === '') throw new TypeError('connectionId must be non-empty')\r\n if (!Number.isSafeInteger(invocation.planRevision) || invocation.planRevision < 1) throw new TypeError('planRevision must be positive')\r\n if (invocation.binding.planRevision !== invocation.planRevision) throw new ConnectionInvocationError('capability-unbound', 'binding belongs to another plan revision')\r\n if (invocation.binding.provider.endpoint.instanceId !== offer.endpoint.instanceId) throw new ConnectionInvocationError('capability-unbound', 'binding provider belongs to another endpoint')\r\n if (invocation.invocationId.trim() === '' || invocation.operation.trim() === '') throw new TypeError('invocationId and operation must be non-empty')\r\n invocation.signal.throwIfAborted()\r\n}\r\n"],"mappings":";;;AAwBA,IAAa,2BAAb,cAA8C,MAAM;CAEvC;CAEA;CAHX,YACE,MACA,SACA,iBACA;EACA,MAAM,OAAO;EAJJ,KAA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,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"}
|
|
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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