@duke-dsh-plugins/dsh-remote-control 0.0.0-stage → 1.1.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/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Remote Control (Phone)",
4
+ "description": "Control DeepSeek Harness from your HarmonyOS phone over an end-to-end-encrypted public relay: browse and switch sessions, send prompts, watch streamed replies, cancel turns, and answer approval or question requests remotely. Push notifications via Huawei Push Kit are optional and gracefully disabled when unconfigured."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "手机远程控制",
4
+ "description": "通过端到端加密的公网中继,用 HarmonyOS 手机远程控制 DeepSeek Harness:浏览与切换会话、发送提示词、查看流式回复、取消任务,并远程应答审批与提问。华为 Push Kit 推送通知为可选能力,未配置时优雅禁用。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
- {
2
- "name": "@duke-dsh-plugins/dsh-remote-control",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@duke-dsh-plugins/dsh-remote-control",
3
+ "version": "1.1.3",
4
+ "description": "Remote-control bridge for DeepSeek Harness: pairs a HarmonyOS phone app with the desktop Host over an end-to-end-encrypted public relay (WebSocket). Lets the phone list/create/switch sessions, send prompts, watch streamed replies, cancel turns, and answer approval and ask-user-question requests from anywhere; pushes Huawei Push Kit notifications (gracefully disabled when AGC is unconfigured) for approvals, questions, and turn completion. The pairing QR lives in the DSH settings panel (\"DSH Pocket\"). Fail-open by design: any relay timeout or fault hands the request back to the desktop answerer.",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./client": "./client.js",
10
+ "./typert": "./typert.host.js",
11
+ "./cordis.patch.yml": "./cordis.patch.yml",
12
+ "./icon": "./icon.svg",
13
+ "./locale/*.json": "./locale/*.json",
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "index.js",
18
+ "client.js",
19
+ "typert.host.js",
20
+ "lib",
21
+ "vendor",
22
+ "cordis.patch.yml",
23
+ "icon.svg",
24
+ "locale"
25
+ ],
26
+ "license": "MIT",
27
+ "dsh": {
28
+ "bundle": {
29
+ "patch": "./cordis.patch.yml"
30
+ },
31
+ "client": {
32
+ "platform": "web"
33
+ },
34
+ "engines": {
35
+ "dsh": "^0.1.5-rc.3 || ^0.2.0-rc.1 || ^0.2.1-rc.0"
36
+ }
37
+ },
38
+ "peerDependencies": {
39
+ "@deepseek-ai/cordis": "^4.0.1",
40
+ "@deepseek-ai/dsh": "^0.1.5-rc.3 || ^0.2.0-rc.1 || ^0.2.1-rc.0",
41
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.7 || ^0.2.0-rc.1 || ^0.2.1-rc.0"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "@deepseek-ai/dsh": {
45
+ "optional": true
46
+ },
47
+ "@deepseek-ai/cordis": {
48
+ "optional": true
49
+ },
50
+ "@deepseek-ai/dsh-typert-protocol": {
51
+ "optional": true
52
+ }
53
+ },
54
+ "dependencies": {
55
+ "ws": "^8.18.1",
56
+ "zod": "^4.4.3"
57
+ },
58
+ "devDependencies": {
59
+ "jsqr": "^1.4.0"
60
+ },
61
+ "scripts": {
62
+ "vendor:relay": "node scripts/vendor-relay.mjs",
63
+ "vendor:relay:check": "node scripts/vendor-relay.mjs --check"
64
+ },
65
+ "repository": {
66
+ "type": "git",
67
+ "url": "git+https://github.com/MoonlitDropOfBlood/dsh-remote-control.git",
68
+ "directory": "plugin"
69
+ },
70
+ "homepage": "https://github.com/MoonlitDropOfBlood/dsh-remote-control/tree/main/plugin#readme",
71
+ "bugs": {
72
+ "url": "https://github.com/MoonlitDropOfBlood/dsh-remote-control/issues"
73
+ },
74
+ "keywords": []
75
+ }
package/typert.host.js ADDED
@@ -0,0 +1,243 @@
1
+ /**
2
+ * dsh-remote-control — Typert Host manifest.
3
+ *
4
+ * Hand-written TYPERT manifest (the format the DSH typert-loader consumes from
5
+ * the package's `./typert` export). It describes the `remoteControl` Remote
6
+ * service the Host half publishes so the browser Client half can call it
7
+ * through `ctx.remote.remoteControl.*` (设置面板「DSH Pocket」分区).
8
+ *
9
+ * Keep the invocation ids, service/namespace names and method names in sync
10
+ * with `index.js` (RemoteControlService) and `client.js`.
11
+ */
12
+
13
+ import { z } from "zod";
14
+
15
+ // typert-loader's strict codec path rejects codecs without a create() factory
16
+ // (a v1.5.0 manifest shipped without them and the loader never registered it,
17
+ // so every Remote call failed). Every codec below is paired with its factory;
18
+ // run `node scripts/verify-settings.mjs` after changes.
19
+ const createStringSchema = () => z.string();
20
+ const createBooleanSchema = () => z.boolean();
21
+
22
+ // ---- shared shapes ---------------------------------------------------------
23
+
24
+ /** 设置面板需要的配对信息(**不含 secret 明文**:secret 只存在于二维码图像里)。 */
25
+ const pairingValueSchema = z
26
+ .object({
27
+ relayUrl: z.string(),
28
+ channel: z.string(),
29
+ hidden: z.boolean(),
30
+ qrSvg: z.string(),
31
+ note: z.string(),
32
+ })
33
+ .readonly();
34
+
35
+ /** 统一的 Remote 结果信封:{ok:true,value} | {ok:false,error}。 */
36
+ const pairingResultSchema = z.union([
37
+ z
38
+ .object({
39
+ ok: z.literal(true).readonly(),
40
+ value: pairingValueSchema,
41
+ })
42
+ .readonly(),
43
+ z
44
+ .object({
45
+ ok: z.literal(false).readonly(),
46
+ error: z
47
+ .object({
48
+ code: z.string().readonly(),
49
+ message: z.string().readonly().optional(),
50
+ })
51
+ .readonly(),
52
+ })
53
+ .readonly(),
54
+ ]);
55
+
56
+ const createPairingResult = () => pairingResultSchema;
57
+
58
+ export const TYPERT = {
59
+ package: "@duke-dsh-plugins/dsh-remote-control",
60
+ face: "host",
61
+ schemas: [],
62
+ invocations: [
63
+ {
64
+ id: "dsh-remote-control#remoteControl/getPairing",
65
+ service: "remoteControl",
66
+ namespace: "remoteControl",
67
+ method: "getPairing",
68
+ invocation: { kind: "direct" },
69
+ parameters: [],
70
+ result: {
71
+ mode: "strict",
72
+ typeSymbol: "dsh-remote-control#PairingResult",
73
+ schema: pairingResultSchema,
74
+ create: createPairingResult,
75
+ },
76
+ sourceLocation: { file: "index.js", line: 1, column: 1 },
77
+ },
78
+ {
79
+ id: "dsh-remote-control#remoteControl/rotateSecret",
80
+ service: "remoteControl",
81
+ namespace: "remoteControl",
82
+ method: "rotateSecret",
83
+ invocation: { kind: "direct" },
84
+ parameters: [],
85
+ result: {
86
+ mode: "strict",
87
+ typeSymbol: "dsh-remote-control#PairingResult",
88
+ schema: pairingResultSchema,
89
+ create: createPairingResult,
90
+ },
91
+ sourceLocation: { file: "index.js", line: 1, column: 1 },
92
+ },
93
+ {
94
+ id: "dsh-remote-control#remoteControl/setHidden",
95
+ service: "remoteControl",
96
+ namespace: "remoteControl",
97
+ method: "setHidden",
98
+ invocation: { kind: "direct" },
99
+ parameters: [
100
+ {
101
+ name: "hidden",
102
+ wire: "hidden",
103
+ source: "json",
104
+ codec: {
105
+ mode: "strict",
106
+ typeSymbol: "dsh-remote-control#remoteControl/setHidden:hidden",
107
+ schema: z.boolean(),
108
+ create: createBooleanSchema,
109
+ },
110
+ },
111
+ ],
112
+ result: {
113
+ mode: "strict",
114
+ typeSymbol: "dsh-remote-control#PairingResult",
115
+ schema: pairingResultSchema,
116
+ create: createPairingResult,
117
+ },
118
+ sourceLocation: { file: "index.js", line: 1, column: 1 },
119
+ },
120
+ {
121
+ id: "dsh-remote-control#remoteControl/setRelayUrl",
122
+ service: "remoteControl",
123
+ namespace: "remoteControl",
124
+ method: "setRelayUrl",
125
+ invocation: { kind: "direct" },
126
+ parameters: [
127
+ {
128
+ name: "url",
129
+ wire: "url",
130
+ source: "json",
131
+ codec: {
132
+ mode: "strict",
133
+ typeSymbol: "dsh-remote-control#remoteControl/setRelayUrl:url",
134
+ schema: z.string(),
135
+ create: createStringSchema,
136
+ },
137
+ },
138
+ ],
139
+ result: {
140
+ mode: "strict",
141
+ typeSymbol: "dsh-remote-control#PairingResult",
142
+ schema: pairingResultSchema,
143
+ create: createPairingResult,
144
+ },
145
+ sourceLocation: { file: "index.js", line: 1, column: 1 },
146
+ },
147
+ {
148
+ // v1.1.3:中继门口的鉴权令牌(对应中继的 RELAY_TOKEN)。
149
+ // 令牌会出现在 transport hello 里(明文可读),所以设置页不回显明文,
150
+ // 只回 relayTokenSet;配对二维码会带上它(契约 §3.5 的 t= 参数)。
151
+ id: "dsh-remote-control#remoteControl/setRelayToken",
152
+ service: "remoteControl",
153
+ namespace: "remoteControl",
154
+ method: "setRelayToken",
155
+ invocation: { kind: "direct" },
156
+ parameters: [
157
+ {
158
+ name: "token",
159
+ wire: "token",
160
+ source: "json",
161
+ codec: {
162
+ mode: "strict",
163
+ typeSymbol: "dsh-remote-control#remoteControl/setRelayToken:token",
164
+ schema: z.string(),
165
+ create: createStringSchema,
166
+ },
167
+ },
168
+ ],
169
+ result: {
170
+ mode: "strict",
171
+ typeSymbol: "dsh-remote-control#PairingResult",
172
+ schema: pairingResultSchema,
173
+ create: createPairingResult,
174
+ },
175
+ sourceLocation: { file: "index.js", line: 1, column: 1 },
176
+ },
177
+ ],
178
+ model: {
179
+ services: [
180
+ {
181
+ description:
182
+ "Remote-control pairing service: exposes the relay address, the pairing channel and the pairing QR code to the desktop settings panel, plus relay-address editing, key rotation and pairing hide/show.",
183
+ summary: "Remote-control pairing service for the settings panel.",
184
+ tags: [],
185
+ jsDoc:
186
+ "/**\n * Remote-control pairing service: publishes the pairing QR code, the relay\n * address editor and the rotate / hide operations to the desktop settings panel.\n */",
187
+ key: "remoteControl",
188
+ exportName: "RemoteControlService",
189
+ members: [
190
+ {
191
+ kind: "method",
192
+ name: "getPairing",
193
+ signature: "@Remote('getPairing') async getPairing(): Promise<PairingResult>",
194
+ summary:
195
+ "Return the current pairing information: relay URL, channel, hidden flag and the pairing QR code (SVG).",
196
+ jsDoc:
197
+ "/**\n * Return the current pairing information for the settings panel.\n * The secret is only carried inside the QR image — never as plain text.\n * @returns success with the pairing payload or a business failure.\n */",
198
+ },
199
+ {
200
+ kind: "method",
201
+ name: "rotateSecret",
202
+ signature: "@Remote('rotateSecret') async rotateSecret(): Promise<PairingResult>",
203
+ summary:
204
+ "Rotate the pairing identity (channel + secret); the previous QR code stops working immediately.",
205
+ jsDoc:
206
+ "/**\n * Rotate the pairing identity: a new channel/secret is generated, persisted\n * and pushed to the relay link, so the old QR code stops working at once.\n * @returns success with the fresh pairing payload or a business failure.\n */",
207
+ },
208
+ {
209
+ kind: "method",
210
+ name: "setHidden",
211
+ signature: "@Remote('setHidden') async setHidden(hidden: boolean): Promise<PairingResult>",
212
+ summary: "Hide or re-show the pairing QR code in the settings panel.",
213
+ jsDoc:
214
+ "/**\n * Hide (or re-show) the pairing QR code in the settings panel and drop the\n * on-disk pairing.svg accordingly.\n * @param hidden - true hides the pairing, false shows it again.\n * @returns success with the resulting pairing payload or a business failure.\n */",
215
+ },
216
+ {
217
+ kind: "method",
218
+ name: "setRelayUrl",
219
+ signature: "@Remote('setRelayUrl') async setRelayUrl(url: string): Promise<PairingResult>",
220
+ summary:
221
+ "Set the relay address from the settings panel: validate, persist and hot-switch the relay link; an empty string clears it.",
222
+ jsDoc:
223
+ "/**\n * Set the relay address: the value is validated (ws:// or wss:// with a host,\n * at most 512 characters), persisted to config.json and pushed into the relay\n * link, which reconnects to the new address at once. An empty string clears\n * the address and idles the plugin.\n * @param url - the relay address, or an empty string to clear it.\n * @returns success with the fresh pairing payload or a business failure.\n */",
224
+ },
225
+ ],
226
+ types: [
227
+ {
228
+ name: "PairingValue",
229
+ declaration:
230
+ "export interface PairingValue {\n readonly relayUrl: string;\n readonly channel: string;\n readonly hidden: boolean;\n readonly qrSvg: string;\n readonly note: string;\n}",
231
+ },
232
+ {
233
+ name: "PairingResult",
234
+ declaration:
235
+ "export type PairingResult = { ok: true; value: PairingValue } | { ok: false; error: { code: string; message?: string } };",
236
+ },
237
+ ],
238
+ },
239
+ ],
240
+ events: [],
241
+ objects: [],
242
+ },
243
+ };