dsh-zen-remote 2.2.5 → 2.2.7
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/AGENTS.md +15 -3
- package/README.md +10 -2
- package/README.zh-CN.md +10 -2
- package/docs/interface.md +17 -0
- package/docs/remote-access.en.md +9 -2
- package/docs/remote-access.md +9 -2
- package/lib/adapters/dsh-better-sidebar/index.js +1 -1
- package/lib/client-routes.js +3 -0
- package/lib/client-routes.js.map +1 -1
- package/lib/client.js +1189 -203
- package/lib/fetch-route-intercept.js +1 -1
- package/lib/index.js +73 -16
- package/lib/index.js.map +1 -1
- package/lib/intercept.js +13 -0
- package/lib/intercept.js.map +1 -1
- package/lib/invoke-binary.js +8 -2
- package/lib/invoke-binary.js.map +1 -1
- package/lib/lan-gate-server.cjs +109 -2
- package/lib/owner-peer.js +23 -0
- package/lib/owner-peer.js.map +1 -1
- package/lib/plugin-adapter-core.js +2 -2
- package/lib/relay-access.js +24 -2
- package/lib/relay-access.js.map +1 -1
- package/lib/relay-client.js +2 -2
- package/lib/relay-server.js +103 -100
- package/lib/relay-server.js.map +1 -1
- package/lib/types/client/MobileAttachButton.d.ts +5 -2
- package/lib/types/client/MobileAttachButton.d.ts.map +1 -1
- package/lib/types/client/MobileAttachChips.d.ts.map +1 -1
- package/lib/types/client/MobileHome.d.ts.map +1 -1
- package/lib/types/client/RemoteFileDownload.d.ts +57 -0
- package/lib/types/client/RemoteFileDownload.d.ts.map +1 -0
- package/lib/types/client/attach-upload.d.ts +32 -0
- package/lib/types/client/attach-upload.d.ts.map +1 -1
- package/lib/types/client/effects/remote-drop.d.ts +27 -0
- package/lib/types/client/effects/remote-drop.d.ts.map +1 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +11 -0
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/remote-file-save.d.ts +112 -0
- package/lib/types/client/remote-file-save.d.ts.map +1 -0
- package/lib/types/client/settings/SettingsSection.d.ts.map +1 -1
- package/lib/types/client/styles/compat.css.d.ts +1 -1
- package/lib/types/client/styles/compat.css.d.ts.map +1 -1
- package/lib/types/client/styles/header.css.d.ts +1 -1
- package/lib/types/client/styles/header.css.d.ts.map +1 -1
- package/lib/types/client/styles/home.css.d.ts +1 -1
- package/lib/types/client/styles/home.css.d.ts.map +1 -1
- package/lib/types/client/styles/layout.css.d.ts +1 -1
- package/lib/types/client/styles/layout.css.d.ts.map +1 -1
- package/lib/types/client/styles/remote-session.css.d.ts +1 -1
- package/lib/types/client/styles/remote-session.css.d.ts.map +1 -1
- package/lib/types/client-data/remote-drop.d.ts +99 -0
- package/lib/types/client-data/remote-drop.d.ts.map +1 -0
- package/lib/types/client-data/settings-form.d.ts +7 -0
- package/lib/types/client-data/settings-form.d.ts.map +1 -1
- package/lib/types/client-routes.d.ts +6 -0
- package/lib/types/client-routes.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/intercept.d.ts.map +1 -1
- package/lib/types/invoke-binary.d.ts +4 -1
- package/lib/types/invoke-binary.d.ts.map +1 -1
- package/lib/types/owner-peer.d.ts +9 -0
- package/lib/types/owner-peer.d.ts.map +1 -1
- package/lib/types/plugin-adapter-core.d.ts +1 -1
- package/lib/types/relay-access.d.ts.map +1 -1
- package/lib/types/relay-server.d.ts +10 -7
- package/lib/types/relay-server.d.ts.map +1 -1
- package/package.json +36 -36
- package/pwa/inject.js +20 -9
- package/pwa/sw.js +97 -21
- package/scripts/check-attach-upload.mjs +37 -0
- package/scripts/check-remote-drop.mjs +114 -0
- package/scripts/check-settings-form.mjs +3 -2
- package/scripts/check-upload-endpoint.mjs +14 -3
- package/src/adapters/dsh-better-sidebar/index.ts +1 -1
- package/src/client/MobileAttachButton.tsx +14 -9
- package/src/client/MobileAttachChips.tsx +4 -0
- package/src/client/MobileHome.tsx +79 -12
- package/src/client/RemoteFileDownload.tsx +173 -0
- package/src/client/attach-upload.ts +47 -0
- package/src/client/effects/remote-drop.ts +269 -0
- package/src/client/index.tsx +47 -0
- package/src/client/locales.ts +32 -0
- package/src/client/remote-file-save.ts +232 -0
- package/src/client/settings/SettingsSection.tsx +61 -1
- package/src/client/styles/compat.css.ts +43 -12
- package/src/client/styles/header.css.ts +63 -15
- package/src/client/styles/home.css.ts +64 -11
- package/src/client/styles/layout.css.ts +24 -7
- package/src/client/styles/remote-session.css.ts +38 -0
- package/src/client-data/remote-drop.ts +127 -0
- package/src/client-data/settings-form.ts +10 -0
- package/src/client-routes.ts +8 -0
- package/src/fetch-route-intercept.ts +1 -1
- package/src/index.ts +71 -18
- package/src/intercept.ts +13 -0
- package/src/invoke-binary.ts +8 -2
- package/src/owner-peer.ts +32 -0
- package/src/plugin-adapter-core.ts +2 -2
- package/src/relay-access.ts +24 -2
- package/src/relay-client.ts +2 -2
- package/src/relay-server.ts +114 -90
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAIhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAWlD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,MAAM;QACd,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAAA;KAClD;CACF;AAUD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAKvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAgBpD,OAAO,KAAK,EAAqB,cAAc,EAAqD,MAAM,oBAAoB,CAAA;AAO9H,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAO7E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAA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AA;IAC5E,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gEAAgE;IAChE,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IAClD,wDAAwD;IACxD,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IACnD,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,OAAO,CAAA;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAuBtG"}
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
/** 标记键。线上只会出现服务端写入的标记;客户端只认这个键。 */
|
|
16
16
|
export declare const BINARY_MARKER = "$zr-u8";
|
|
17
17
|
/** 结果里带二进制的方法(`namespace/method`)。请求侧参数不带二进制
|
|
18
|
-
* (readBytes 的参数是 scope/paths),故只有结果方向需要标记。
|
|
18
|
+
* (readBytes 的参数是 scope/paths),故只有结果方向需要标记。
|
|
19
|
+
* `officeToPdf/render`(2.2.6)返回的 `data` 是整份 PDF 字节:同一个
|
|
20
|
+
* JSON 通道会把 typed array 压扁,客户端严格编解码当场拒绝——登记进来
|
|
21
|
+
* 后服务端按同一标记写出、客户端按同一标记还原。 */
|
|
19
22
|
export declare const INVOKE_BINARY_RESULT_METHODS: ReadonlySet<string>;
|
|
20
23
|
/** 深度遍历,把 typed array(含 Buffer)换成 `{ $zr-u8: base64 }` 标记。 */
|
|
21
24
|
export declare function markInvokeBinary(value: unknown, depth?: number): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-binary.d.ts","sourceRoot":"","sources":["../../src/invoke-binary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,mCAAmC;AACnC,eAAO,MAAM,aAAa,WAAW,CAAA;AAErC
|
|
1
|
+
{"version":3,"file":"invoke-binary.d.ts","sourceRoot":"","sources":["../../src/invoke-binary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,mCAAmC;AACnC,eAAO,MAAM,aAAa,WAAW,CAAA;AAErC;;;;6BAI6B;AAC7B,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,MAAM,CAG3D,CAAA;AAWF,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAwBnE;AAED;;;uCAGuC;AACvC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CA4BtE;AAED;;;wDAGwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACzB,KAAK,EAAE,UAAU,CAAA;CAClB;AAED;qDACqD;AACrD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAAE,CA8B5G"}
|
|
@@ -54,4 +54,13 @@ export declare function createOwnerPeerSource(getConnection: () => unknown): ()
|
|
|
54
54
|
export declare function withPeer<T extends object>(request: T, getPeer: (() => unknown) | undefined): T & {
|
|
55
55
|
peer?: unknown;
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Build the `/api` shared-fetch dispatcher reader for the relay server.
|
|
59
|
+
* DSH 0.2.1-rc.3's `HostConnectionService.createSharedFetchHandler('/api').fetch(request, peer)`
|
|
60
|
+
* checks `peer.principal.kind !== 'owner'` directly (returning 403 or throwing
|
|
61
|
+
* TypeError when `peer` is undefined), so the dispatcher forwards the owner
|
|
62
|
+
* Peer from `getPeer()` as the second argument. Pre-rc.3 hosts ignore the
|
|
63
|
+
* extra argument.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createSharedApiFetchGetter(getConnection: () => unknown, getPeer?: () => unknown): () => ((request: Request) => Promise<Response>) | undefined;
|
|
57
66
|
//# sourceMappingURL=owner-peer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner-peer.d.ts","sourceRoot":"","sources":["../../src/owner-peer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,uDAAuD;AACvD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AAED,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE;YAAE,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC;QAAC,YAAY,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;KAAE,KAAK,OAAO,CAAA;IACrG,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,OAAO,GAAG,MAAM,OAAO,CAmBjF;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAGnH"}
|
|
1
|
+
{"version":3,"file":"owner-peer.d.ts","sourceRoot":"","sources":["../../src/owner-peer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,uDAAuD;AACvD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AAED,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE;YAAE,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC;QAAC,YAAY,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;KAAE,KAAK,OAAO,CAAA;IACrG,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,OAAO,GAAG,MAAM,OAAO,CAmBjF;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAGnH;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,OAAO,EAC5B,OAAO,GAAE,MAAM,OAA8C,GAC5D,MAAM,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAmB7D"}
|
|
@@ -160,7 +160,7 @@ export interface NormalizedAdapter {
|
|
|
160
160
|
declaration: NormalizedDeclaration;
|
|
161
161
|
hooks: AdapterHooks;
|
|
162
162
|
}
|
|
163
|
-
/** The body cap an ADAPTER route may declare:
|
|
163
|
+
/** The body cap an ADAPTER route may declare: 500 MiB — the relay's own
|
|
164
164
|
* upload budget (lib/relay-server.js `MAX_UPLOAD_BYTES`), which the
|
|
165
165
|
* better-sidebar upload route rides. Wider than the cooperative
|
|
166
166
|
* declaration's 64 MiB because raw media uploads are exactly what an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-access.d.ts","sourceRoot":"","sources":["../../src/relay-access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,YAAY,CAgBd;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAC9G,KAAK,EAAE,KAAK,CAAA;IACZ,MAAM,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,CAAA;CAClD,CAAA;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,GAC3C,mBAAmB,CAcrB"}
|
|
@@ -44,7 +44,7 @@ export declare const RELAY_PREFIX = "/_dsh/zen-remote/relay";
|
|
|
44
44
|
* host stores the stream verbatim (`saveFileStreamVerbatim` →
|
|
45
45
|
* `publishImmutableObjectStream`, RT dsh-attachment-local lib/index.js
|
|
46
46
|
* ~699-716; the 20 MiB `maxImageBytes` there covers INLINE images only), so
|
|
47
|
-
* there is no host number to mirror and this relay picks its own:
|
|
47
|
+
* there is no host number to mirror and this relay picks its own: 500 MiB
|
|
48
48
|
* per upload, checked first against `Content-Length` (refused before a byte
|
|
49
49
|
* moves) and then counted while the stream is pumped (a chunked body has no
|
|
50
50
|
* length header — the sub-client's undici forbids hand-set length headers,
|
|
@@ -53,11 +53,14 @@ export declare const RELAY_PREFIX = "/_dsh/zen-remote/relay";
|
|
|
53
53
|
* answer is 413 `payload-too-large`.
|
|
54
54
|
*
|
|
55
55
|
* SLOW-LINK BOUND (T51-fix, for the docs): a single legitimate upload is
|
|
56
|
-
* also bounded in TIME
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* roughly
|
|
60
|
-
* client-side refusal keeps the connection state)
|
|
56
|
+
* also bounded in TIME. The sub-client's own round-trip budget now caps at
|
|
57
|
+
* 15 minutes (relay-client.ts, the T31-fix rule), but the HOST's HTTP server
|
|
58
|
+
* keeps Node's default 300 s request deadline — that is the binding limit:
|
|
59
|
+
* a 500 MiB body needs roughly 14 Mbps sustained end to end, and a slower
|
|
60
|
+
* link fails the call (the client-side refusal keeps the connection state)
|
|
61
|
+
* rather than hanging. Raising the cap past what that deadline can carry
|
|
62
|
+
* would only move the failure, so 500 MiB is the honest ceiling for the
|
|
63
|
+
* current transport.
|
|
61
64
|
*/
|
|
62
65
|
export declare const MAX_UPLOAD_BYTES: number;
|
|
63
66
|
/** The `/api` route the upload channel dispatches into, verbatim from the
|
|
@@ -161,7 +164,7 @@ export interface RelayHandlerOptions {
|
|
|
161
164
|
* defaults to 5000. Tests inject a small value. */
|
|
162
165
|
endDrainTimeoutMs?: number;
|
|
163
166
|
/** The binary upload channel's byte cap (T51); defaults to
|
|
164
|
-
* {@link MAX_UPLOAD_BYTES} (
|
|
167
|
+
* {@link MAX_UPLOAD_BYTES} (500 MiB). Tests inject a small value so the
|
|
165
168
|
* Content-Length and streaming-count refusals stay cheap to drive. */
|
|
166
169
|
uploadCapBytes?: number;
|
|
167
170
|
/** How long an upload refusal's tail drain may run before the socket is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-server.d.ts","sourceRoot":"","sources":["../../src/relay-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAWlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE3E,OAAO,EAA0C,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAG1D,OAAO,KAAK,EAAE,iBAAiB,EAAkB,MAAM,0BAA0B,CAAA;AAGjF;;;;;G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EACzB,iBAAiB,GAClB,MAAM,wBAAwB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-zen-remote",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"description": "一个插件、两种角色:主服务端把 DeepSeek Harness 变成手机能安全访问的 PWA(移动端界面、配对码网关、Web Push),并把选定会话共享给已配对的桌面端;子客户端在另一台 DSH 桌面端的侧边栏里远程使用这些会话。One DSH plugin, two roles: the host turns DeepSeek Harness into a phone-reachable PWA (mobile UI, pairing-code gateway behind your own reverse proxy, Web Push) and shares chosen sessions to paired desktops; the client uses those sessions remotely from another DSH desktop app's sidebar.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -117,40 +117,40 @@
|
|
|
117
117
|
"devDependencies": {
|
|
118
118
|
"@deepseek-ai/cordis": "4.0.5",
|
|
119
119
|
"@deepseek-ai/cosmokit": "1.8.5",
|
|
120
|
-
"@deepseek-ai/dsh-agent": "0.2.1-rc.
|
|
121
|
-
"@deepseek-ai/dsh-api-remotes": "0.2.1-rc.
|
|
122
|
-
"@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.
|
|
123
|
-
"@deepseek-ai/dsh-api-workspace-controller": "0.2.1-rc.
|
|
124
|
-
"@deepseek-ai/dsh-brand": "0.2.1-rc.
|
|
125
|
-
"@deepseek-ai/dsh-client-connection": "0.2.1-rc.
|
|
126
|
-
"@deepseek-ai/dsh-client-locale": "0.2.1-rc.
|
|
127
|
-
"@deepseek-ai/dsh-client-store": "0.2.1-rc.
|
|
128
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.
|
|
129
|
-
"@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.
|
|
130
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.
|
|
131
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.
|
|
132
|
-
"@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.
|
|
133
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.
|
|
134
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.
|
|
135
|
-
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.
|
|
136
|
-
"@deepseek-ai/dsh-llm": "0.2.1-rc.
|
|
137
|
-
"@deepseek-ai/dsh-ptc-runtime": "0.2.1-rc.
|
|
138
|
-
"@deepseek-ai/dsh-sandbox": "0.2.1-rc.
|
|
139
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.
|
|
140
|
-
"@deepseek-ai/dsh-scope": "0.2.1-rc.
|
|
141
|
-
"@deepseek-ai/dsh-session": "0.2.1-rc.
|
|
142
|
-
"@deepseek-ai/dsh-session-log-export": "0.2.1-rc.
|
|
143
|
-
"@deepseek-ai/dsh-session-projection": "0.2.1-rc.
|
|
144
|
-
"@deepseek-ai/dsh-session-query": "0.2.1-rc.
|
|
145
|
-
"@deepseek-ai/dsh-session-stats": "0.2.1-rc.
|
|
146
|
-
"@deepseek-ai/dsh-subagent": "0.2.1-rc.
|
|
147
|
-
"@deepseek-ai/dsh-timeout": "0.2.1-rc.
|
|
148
|
-
"@deepseek-ai/dsh-token-meter": "0.2.1-rc.
|
|
149
|
-
"@deepseek-ai/dsh-tools": "0.2.1-rc.
|
|
150
|
-
"@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.
|
|
151
|
-
"@deepseek-ai/dsh-util-crypto": "0.2.1-rc.
|
|
152
|
-
"@deepseek-ai/dsh-util-values": "0.2.1-rc.
|
|
153
|
-
"@deepseek-ai/dsh-workspace": "0.2.1-rc.
|
|
120
|
+
"@deepseek-ai/dsh-agent": "0.2.1-rc.3",
|
|
121
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.1-rc.3",
|
|
122
|
+
"@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.3",
|
|
123
|
+
"@deepseek-ai/dsh-api-workspace-controller": "0.2.1-rc.3",
|
|
124
|
+
"@deepseek-ai/dsh-brand": "0.2.1-rc.3",
|
|
125
|
+
"@deepseek-ai/dsh-client-connection": "0.2.1-rc.3",
|
|
126
|
+
"@deepseek-ai/dsh-client-locale": "0.2.1-rc.3",
|
|
127
|
+
"@deepseek-ai/dsh-client-store": "0.2.1-rc.3",
|
|
128
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.3",
|
|
129
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.3",
|
|
130
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.3",
|
|
131
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.3",
|
|
132
|
+
"@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.3",
|
|
133
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.3",
|
|
134
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.3",
|
|
135
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.3",
|
|
136
|
+
"@deepseek-ai/dsh-llm": "0.2.1-rc.3",
|
|
137
|
+
"@deepseek-ai/dsh-ptc-runtime": "0.2.1-rc.3",
|
|
138
|
+
"@deepseek-ai/dsh-sandbox": "0.2.1-rc.3",
|
|
139
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.3",
|
|
140
|
+
"@deepseek-ai/dsh-scope": "0.2.1-rc.3",
|
|
141
|
+
"@deepseek-ai/dsh-session": "0.2.1-rc.3",
|
|
142
|
+
"@deepseek-ai/dsh-session-log-export": "0.2.1-rc.3",
|
|
143
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-rc.3",
|
|
144
|
+
"@deepseek-ai/dsh-session-query": "0.2.1-rc.3",
|
|
145
|
+
"@deepseek-ai/dsh-session-stats": "0.2.1-rc.3",
|
|
146
|
+
"@deepseek-ai/dsh-subagent": "0.2.1-rc.3",
|
|
147
|
+
"@deepseek-ai/dsh-timeout": "0.2.1-rc.3",
|
|
148
|
+
"@deepseek-ai/dsh-token-meter": "0.2.1-rc.3",
|
|
149
|
+
"@deepseek-ai/dsh-tools": "0.2.1-rc.3",
|
|
150
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.3",
|
|
151
|
+
"@deepseek-ai/dsh-util-crypto": "0.2.1-rc.3",
|
|
152
|
+
"@deepseek-ai/dsh-util-values": "0.2.1-rc.3",
|
|
153
|
+
"@deepseek-ai/dsh-workspace": "0.2.1-rc.3",
|
|
154
154
|
"@deepseek-ai/schemastery": "3.18.4",
|
|
155
155
|
"@types/node": "^26.2.0",
|
|
156
156
|
"@types/react": "~18.3.1",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"scripts": {
|
|
161
161
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig.client.json && node scripts/build-client.mjs",
|
|
162
162
|
"verify": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.client.json --noEmit",
|
|
163
|
-
"test": "node --test \"test/*.test.cjs\" && node scripts/check-sunk-viewport.mjs && node scripts/check-keyboard-avoid.mjs && node scripts/check-attach-upload.mjs && node scripts/check-share-image.mjs && node scripts/check-upload-endpoint.mjs && node scripts/check-host-shadow.mjs && node scripts/check-compat-store.mjs && node scripts/check-settings-form.mjs && node scripts/check-shares.mjs && node scripts/check-plugin-bridge-ui.mjs && node scripts/check-client-externals.mjs && node scripts/check-info-sheet-stacking.mjs && node scripts/sync-doc-version.mjs --check",
|
|
163
|
+
"test": "node --test \"test/*.test.cjs\" && node scripts/check-sunk-viewport.mjs && node scripts/check-keyboard-avoid.mjs && node scripts/check-attach-upload.mjs && node scripts/check-share-image.mjs && node scripts/check-upload-endpoint.mjs && node scripts/check-host-shadow.mjs && node scripts/check-compat-store.mjs && node scripts/check-settings-form.mjs && node scripts/check-shares.mjs && node scripts/check-plugin-bridge-ui.mjs && node scripts/check-remote-drop.mjs && node scripts/check-client-externals.mjs && node scripts/check-info-sheet-stacking.mjs && node scripts/sync-doc-version.mjs --check",
|
|
164
164
|
"version": "node scripts/sync-doc-version.mjs && git add README.md README.zh-CN.md"
|
|
165
165
|
}
|
|
166
166
|
}
|
package/pwa/inject.js
CHANGED
|
@@ -81,15 +81,26 @@
|
|
|
81
81
|
alert(T.unsupported)
|
|
82
82
|
return Promise.reject(new Error('push unsupported'))
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
// Ask for permission inside the click gesture: Safari only honours
|
|
85
|
+
// requestPermission() while user activation is still live, and this
|
|
86
|
+
// function is called straight from the button's click handler.
|
|
87
|
+
var perm = window.Notification.permission === 'granted'
|
|
88
|
+
? Promise.resolve('granted')
|
|
89
|
+
: (typeof window.Notification.requestPermission === 'function'
|
|
90
|
+
? window.Notification.requestPermission()
|
|
91
|
+
: Promise.resolve('denied'))
|
|
92
|
+
// Then wait for an ACTIVE worker. register() resolves before install
|
|
93
|
+
// finishes, so `__DSH_PWA__.reg` set from its .then() may still have a
|
|
94
|
+
// null `active` — WebKit rejects pushManager.subscribe() on it with
|
|
95
|
+
// "Subscribing for push requires an active service worker" (seen on a
|
|
96
|
+
// real iPhone PWA 2026-10-21; it worked after a restart, i.e. a race).
|
|
97
|
+
// navigator.serviceWorker.ready is the only reliable gate.
|
|
98
|
+
return perm.then(function (state) {
|
|
99
|
+
if (state !== 'granted') throw new Error(T.denied)
|
|
100
|
+
return navigator.serviceWorker.ready
|
|
101
|
+
}).then(function (reg) {
|
|
102
|
+
window.__DSH_PWA__.reg = reg
|
|
103
|
+
return doSubscribe(reg)
|
|
93
104
|
})
|
|
94
105
|
}
|
|
95
106
|
|
package/pwa/sw.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
/* dsh-mobile-pwa · service worker
|
|
2
2
|
* Offline-capable caching + agent-done push notifications for the DSH Web UI.
|
|
3
3
|
*
|
|
4
|
-
* Strategy (
|
|
4
|
+
* Strategy (v4 — see the "new DOM + old CSS" postmortem below):
|
|
5
5
|
* - True static shell (manifest, icons, offline fallback) -> cache-first.
|
|
6
6
|
* These are the only assets whose bytes cannot change without an entry in
|
|
7
7
|
* SHELL_PATHS changing too, so caching them aggressively is safe.
|
|
8
|
-
* -
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* - Content-addressed build output (a Vite hash in the filename, or DSH's
|
|
9
|
+
* plugin graph served with ?rev=<build revision>) -> cache-first. The URL is
|
|
10
|
+
* a function of the bytes, so a hit can never be stale: a new deploy is a
|
|
11
|
+
* NEW URL. This is what makes the second and later cold starts cheap — the
|
|
12
|
+
* app shell JS/CSS and the ~12 MB plugin graph come from CacheStorage
|
|
13
|
+
* instead of crossing the reverse proxy again. Stored payloads must match
|
|
14
|
+
* the type their URL claims, and endless streams are never cached.
|
|
15
|
+
* - Everything else same-origin (unhashed JS/CSS incl. this plugin's own
|
|
16
|
+
* app.css/inject.js/touch-gestures.js, API calls, fonts, images) ->
|
|
17
|
+
* network-first, falling back to cache only when the network fetch
|
|
18
|
+
* actually fails (offline).
|
|
12
19
|
* - SPA navigations (HTML doc) -> network-first, falling back to the last
|
|
13
20
|
* successfully loaded page when offline.
|
|
14
21
|
*
|
|
@@ -20,14 +27,15 @@
|
|
|
20
27
|
* navigation (already network-first) served today's markup — a "new DOM +
|
|
21
28
|
* old CSS" mismatch (e.g. cards rendered full-bleed) that a fresh local
|
|
22
29
|
* profile never reproduces because it has nothing stale to serve. Only the
|
|
23
|
-
* handful of files in SHELL_PATHS are safe to keep cache-first
|
|
30
|
+
* handful of files in SHELL_PATHS are safe to keep cache-first — plus, from
|
|
31
|
+
* v4 on, content-addressed URLs, whose freshness proof is the URL itself.
|
|
24
32
|
*
|
|
25
33
|
* Served by the gateway at /pwa/sw.js. Registered from the injected PWA script.
|
|
26
34
|
*/
|
|
27
35
|
'use strict'
|
|
28
36
|
|
|
29
|
-
const SHELL_CACHE = 'dsh-mobile-pwa-shell-
|
|
30
|
-
const RUNTIME_CACHE = 'dsh-mobile-pwa-runtime-
|
|
37
|
+
const SHELL_CACHE = 'dsh-mobile-pwa-shell-v4'
|
|
38
|
+
const RUNTIME_CACHE = 'dsh-mobile-pwa-runtime-v4'
|
|
31
39
|
|
|
32
40
|
const SHELL_PATHS = new Set([
|
|
33
41
|
'/pwa/manifest.json',
|
|
@@ -37,6 +45,48 @@ const SHELL_PATHS = new Set([
|
|
|
37
45
|
'/pwa/offline.html'
|
|
38
46
|
])
|
|
39
47
|
|
|
48
|
+
// A Vite content hash in the filename (/assets/index-CN7NIWNw.js, hashed
|
|
49
|
+
// fonts, lazy language chunks): 8+ base64url characters after the last dash.
|
|
50
|
+
// A plain-word filename that happens to match the shape (vendor-bootstrap.css,
|
|
51
|
+
// app-BOOTSTRAP.js) has no digit and only one letter case and is rejected; a
|
|
52
|
+
// genuine all-lowercase hash would merely fall back to network-first.
|
|
53
|
+
const IMMUTABLE_ASSET_RE = /^\/assets\/(?:[^/]+\/)*[^/]+-([A-Za-z0-9_-]{8,})\.(?:js|mjs|css|woff2?|ttf|otf|eot|svg|png|jpe?g|gif|webp|avif|ico)$/
|
|
54
|
+
// DSH serves a whole plugin batch through /plugins/??<id>/client.js&rev=<hash>.
|
|
55
|
+
// DSH derives that revision as a 12-char sha1 hex slice over the plugin
|
|
56
|
+
// artifact's mtime/ctime/size (a build revision, not a content hash) and
|
|
57
|
+
// serves those URLs immutable itself; requiring hex rejects words like
|
|
58
|
+
// rev=default/latest.
|
|
59
|
+
const IMMUTABLE_PLUGIN_RE = /^\/plugins\//
|
|
60
|
+
const IMMUTABLE_REV_RE = /[?&]rev=([0-9a-f]{8,})(?:&|$)/i
|
|
61
|
+
function isContentAddressedAsset(pathname) {
|
|
62
|
+
const m = IMMUTABLE_ASSET_RE.exec(pathname)
|
|
63
|
+
if (m === null) return false
|
|
64
|
+
const hash = m[1]
|
|
65
|
+
return /[0-9]/.test(hash) || (/[a-z]/.test(hash) && /[A-Z]/.test(hash))
|
|
66
|
+
}
|
|
67
|
+
function isImmutableUrl(url) {
|
|
68
|
+
return isContentAddressedAsset(url.pathname) ||
|
|
69
|
+
(IMMUTABLE_PLUGIN_RE.test(url.pathname) && IMMUTABLE_REV_RE.test(url.search))
|
|
70
|
+
}
|
|
71
|
+
// cacheFirst only stores what the URL claims to be. A 200 HTML/SPA-fallback or
|
|
72
|
+
// error page served at an asset URL (deploy race, login wall, revoked device)
|
|
73
|
+
// must never become a permanent "asset" in CacheStorage.
|
|
74
|
+
function responseContentType(res) {
|
|
75
|
+
try { return res && res.headers && typeof res.headers.get === 'function' ? String(res.headers.get('content-type') || '') : '' } catch (e) { return '' }
|
|
76
|
+
}
|
|
77
|
+
function immutablePayloadOk(url, res) {
|
|
78
|
+
const ct = responseContentType(res).toLowerCase()
|
|
79
|
+
if (ct === '') return false
|
|
80
|
+
if (url.pathname.indexOf('/plugins/') === 0) return ct.indexOf('javascript') !== -1 || ct.indexOf('ecmascript') !== -1
|
|
81
|
+
if (/\.css$/.test(url.pathname)) return ct.indexOf('text/css') === 0
|
|
82
|
+
if (/\.(?:m?js)$/.test(url.pathname)) return ct.indexOf('javascript') !== -1 || ct.indexOf('ecmascript') !== -1
|
|
83
|
+
// DSH's static server treats fonts (and some images) as octet-stream — the
|
|
84
|
+
// extension is still the payload's identity, and an HTML page never carries
|
|
85
|
+
// that type.
|
|
86
|
+
if (/\.(?:woff2?|ttf|otf|eot)$/.test(url.pathname)) return ct.indexOf('font/') === 0 || ct.indexOf('application/octet-stream') === 0
|
|
87
|
+
return ct.indexOf('image/') === 0 || ct.indexOf('application/octet-stream') === 0
|
|
88
|
+
}
|
|
89
|
+
|
|
40
90
|
// ---- Copy -------------------------------------------------------------
|
|
41
91
|
// A worker has no window and no gateway injection, so the language comes from
|
|
42
92
|
// the worker's own navigator (guarded: the test sandbox has none). Only two
|
|
@@ -64,11 +114,12 @@ self.addEventListener('install', (event) => {
|
|
|
64
114
|
]))
|
|
65
115
|
)
|
|
66
116
|
// Safe to activate immediately: this worker only decides how *future*
|
|
67
|
-
// fetches are served (cache-first for the shell
|
|
68
|
-
// everything else). A tab that's already
|
|
69
|
-
// already has in memory regardless of which
|
|
70
|
-
// only starts talking to the new worker on its
|
|
71
|
-
// skipping the wait doesn't yank code out from
|
|
117
|
+
// fetches are served (cache-first for the static shell and content-addressed
|
|
118
|
+
// build output, network-first for everything else). A tab that's already
|
|
119
|
+
// loaded keeps running the JS it already has in memory regardless of which
|
|
120
|
+
// SW version is "active" — it only starts talking to the new worker on its
|
|
121
|
+
// next fetch/navigation — so skipping the wait doesn't yank code out from
|
|
122
|
+
// under a running page. What
|
|
72
123
|
// it *does* fix: without it, an old SW can sit "waiting" indefinitely on a
|
|
73
124
|
// phone that never fully closes the PWA, which is the same staleness bug
|
|
74
125
|
// this rewrite targets, just at the SW-registration layer instead of the
|
|
@@ -107,29 +158,52 @@ self.addEventListener('fetch', (event) => {
|
|
|
107
158
|
return
|
|
108
159
|
}
|
|
109
160
|
|
|
110
|
-
// 2.
|
|
161
|
+
// 2. Content-addressed build output -> cache-first. The URL names its own
|
|
162
|
+
// bytes (Vite filename hash, or DSH's ?rev=<content hash> plugin graph),
|
|
163
|
+
// so a deploy reaches the phone as a new URL rather than new bytes under
|
|
164
|
+
// a cached one — no "new DOM + old CSS" risk.
|
|
165
|
+
if (req.method === 'GET' && isImmutableUrl(url)) {
|
|
166
|
+
event.respondWith(cacheFirst(req, RUNTIME_CACHE, (res) => immutablePayloadOk(url, res)))
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// 3. HTML navigations -> network-first with offline fallback to the last
|
|
111
171
|
// successfully loaded page.
|
|
112
172
|
if (req.mode === 'navigate') {
|
|
113
173
|
event.respondWith(networkFirstNavigation(req))
|
|
114
174
|
return
|
|
115
175
|
}
|
|
116
176
|
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
177
|
+
// 4. Everything else same-origin GET -> network-first. Unhashed JS/CSS,
|
|
178
|
+
// API calls, fonts and images can change on any deploy without their
|
|
179
|
+
// URL changing, so the server's current copy always wins; the cache
|
|
180
|
+
// only serves them when offline.
|
|
121
181
|
if (req.method === 'GET') {
|
|
122
182
|
event.respondWith(networkFirst(req, RUNTIME_CACHE))
|
|
123
183
|
return
|
|
124
184
|
}
|
|
125
185
|
})
|
|
126
186
|
|
|
127
|
-
|
|
187
|
+
// A response cannot be cloned/consumed to completion without blocking the
|
|
188
|
+
// caller, so NEVER await cache.put() on the response path: /plugins/events is
|
|
189
|
+
// an endless text/event-stream, and awaiting its clone would keep
|
|
190
|
+
// respondWith() pending forever (the stream would never open). Fire and
|
|
191
|
+
// forget; a rejected write (quota, Vary:*) must not break the fetch either.
|
|
192
|
+
function isEndlessResponse(res) {
|
|
193
|
+
const ct = responseContentType(res).toLowerCase()
|
|
194
|
+
return ct.indexOf('text/event-stream') !== -1 ||
|
|
195
|
+
ct.indexOf('application/x-ndjson') !== -1 ||
|
|
196
|
+
ct.indexOf('multipart/') === 0
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async function cacheFirst(req, cacheName, accept) {
|
|
128
200
|
const cache = await caches.open(cacheName)
|
|
129
201
|
const cached = await cache.match(req)
|
|
130
202
|
if (cached) return cached
|
|
131
203
|
const res = await fetch(req)
|
|
132
|
-
if (res && res.ok)
|
|
204
|
+
if (res && res.ok && !isEndlessResponse(res) && (!accept || accept(res))) {
|
|
205
|
+
cache.put(req, res.clone()).catch(() => {})
|
|
206
|
+
}
|
|
133
207
|
return res
|
|
134
208
|
}
|
|
135
209
|
|
|
@@ -137,7 +211,9 @@ async function networkFirst(req, cacheName) {
|
|
|
137
211
|
const cache = await caches.open(cacheName)
|
|
138
212
|
try {
|
|
139
213
|
const res = await fetch(req)
|
|
140
|
-
if (res && res.ok && req.method === 'GET'
|
|
214
|
+
if (res && res.ok && req.method === 'GET' && !isEndlessResponse(res)) {
|
|
215
|
+
cache.put(req, res.clone()).catch(() => {})
|
|
216
|
+
}
|
|
141
217
|
return res
|
|
142
218
|
} catch (err) {
|
|
143
219
|
const cached = await cache.match(req)
|
|
@@ -14,12 +14,14 @@ import assert from 'node:assert/strict'
|
|
|
14
14
|
import {
|
|
15
15
|
UPLOAD_DIR,
|
|
16
16
|
UPLOAD_ROUTE,
|
|
17
|
+
appendDraftOf,
|
|
17
18
|
draftWithMention,
|
|
18
19
|
draftWithoutMention,
|
|
19
20
|
leafOf,
|
|
20
21
|
mentionsIn,
|
|
21
22
|
middleEllipsis,
|
|
22
23
|
uploadUrl,
|
|
24
|
+
writeMention,
|
|
23
25
|
} from '../src/client/attach-upload.ts'
|
|
24
26
|
|
|
25
27
|
// ---- the upload URL --------------------------------------------------------
|
|
@@ -84,6 +86,41 @@ assert.deepEqual(mentionsIn(draft), [])
|
|
|
84
86
|
// one trailing space.
|
|
85
87
|
assert.equal(draft, 'photos: ')
|
|
86
88
|
|
|
89
|
+
// ---- writing mentions: appendDraft when the host has it, else setDraft ------
|
|
90
|
+
// DSH <= 0.2.1-rc.2 (and the rc.3 public inputActions face): setDraft only.
|
|
91
|
+
{
|
|
92
|
+
const calls = []
|
|
93
|
+
const legacy = { setDraft: (text) => calls.push(['set', text]) }
|
|
94
|
+
assert.equal(appendDraftOf(legacy), undefined)
|
|
95
|
+
const first = writeMention(legacy, 'read', a)
|
|
96
|
+
assert.equal(first, 'read @.dsh-uploads/a.pdf ')
|
|
97
|
+
const second = writeMention(legacy, first, b)
|
|
98
|
+
assert.equal(second, 'read @.dsh-uploads/a.pdf @.dsh-uploads/b.zip ')
|
|
99
|
+
assert.deepEqual(calls, [['set', first], ['set', second]])
|
|
100
|
+
}
|
|
101
|
+
// A host whose action face carries appendDraft: only the token is appended,
|
|
102
|
+
// setDraft is never touched, and `this` stays bound to the action face.
|
|
103
|
+
{
|
|
104
|
+
const calls = []
|
|
105
|
+
const modern = {
|
|
106
|
+
draft: 'keep my @src/index.ts reference',
|
|
107
|
+
setDraft(text) { calls.push(['set', text]) },
|
|
108
|
+
appendDraft(text) { calls.push(['append', text, this === modern]) },
|
|
109
|
+
}
|
|
110
|
+
assert.equal(typeof appendDraftOf(modern), 'function')
|
|
111
|
+
assert.equal(writeMention(modern, modern.draft, a), modern.draft)
|
|
112
|
+
writeMention(modern, modern.draft, b)
|
|
113
|
+
assert.deepEqual(calls, [['append', '@.dsh-uploads/a.pdf ', true], ['append', '@.dsh-uploads/b.zip ', true]])
|
|
114
|
+
}
|
|
115
|
+
// A non-function appendDraft is not an interface: fall back.
|
|
116
|
+
{
|
|
117
|
+
const calls = []
|
|
118
|
+
const odd = { appendDraft: true, setDraft: (text) => calls.push(text) }
|
|
119
|
+
assert.equal(appendDraftOf(odd), undefined)
|
|
120
|
+
writeMention(odd, '', a)
|
|
121
|
+
assert.deepEqual(calls, ['@.dsh-uploads/a.pdf '])
|
|
122
|
+
}
|
|
123
|
+
|
|
87
124
|
// ---- chip labels -----------------------------------------------------------
|
|
88
125
|
assert.equal(leafOf(`${UPLOAD_DIR}/report.pdf`), 'report.pdf')
|
|
89
126
|
assert.equal(leafOf('report.pdf'), 'report.pdf')
|