dsh-zen-remote 1.1.16 → 2.0.0

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.
Files changed (255) hide show
  1. package/AGENTS.md +54 -9
  2. package/README.md +249 -190
  3. package/README.zh-CN.md +247 -201
  4. package/assets/home.png +0 -0
  5. package/assets/info.png +0 -0
  6. package/assets/pairing.png +0 -0
  7. package/assets/session.png +0 -0
  8. package/assets/sheet.png +0 -0
  9. package/cordis.patch.yml +12 -11
  10. package/cordis.patch.yml.example +24 -9
  11. package/docs/interface.md +57 -2
  12. package/docs/remote-access.en.md +99 -58
  13. package/docs/remote-access.md +99 -42
  14. package/dsh-push.mjs +67 -54
  15. package/lan-gate.mjs +88 -20
  16. package/lib/activity.js +168 -0
  17. package/lib/activity.js.map +1 -0
  18. package/lib/admin-routes.js +526 -0
  19. package/lib/admin-routes.js.map +1 -0
  20. package/lib/client-pairing.js +224 -0
  21. package/lib/client-pairing.js.map +1 -0
  22. package/lib/client-routes.js +674 -0
  23. package/lib/client-routes.js.map +1 -0
  24. package/lib/client.js +10051 -4777
  25. package/lib/config.js +346 -0
  26. package/lib/config.js.map +1 -0
  27. package/lib/fetch-route-intercept.js +418 -0
  28. package/lib/fetch-route-intercept.js.map +1 -0
  29. package/lib/fingerprint.js +363 -0
  30. package/lib/fingerprint.js.map +1 -0
  31. package/lib/http.js +69 -0
  32. package/lib/http.js.map +1 -0
  33. package/lib/index.js +675 -54
  34. package/lib/index.js.map +1 -1
  35. package/lib/intercept-shape.js +81 -0
  36. package/lib/intercept-shape.js.map +1 -0
  37. package/lib/intercept.js +3040 -0
  38. package/lib/intercept.js.map +1 -0
  39. package/lib/lan-gate-server.cjs +532 -121
  40. package/lib/merge-streams.js +1165 -0
  41. package/lib/merge-streams.js.map +1 -0
  42. package/lib/relay-access.js +496 -0
  43. package/lib/relay-access.js.map +1 -0
  44. package/lib/relay-client.js +1303 -0
  45. package/lib/relay-client.js.map +1 -0
  46. package/lib/relay-filter.js +282 -0
  47. package/lib/relay-filter.js.map +1 -0
  48. package/lib/relay-server.js +1792 -0
  49. package/lib/relay-server.js.map +1 -0
  50. package/lib/restart-fields.js +34 -0
  51. package/lib/restart-fields.js.map +1 -0
  52. package/lib/restart-watcher.js +106 -0
  53. package/lib/restart-watcher.js.map +1 -0
  54. package/lib/session-reference.js +157 -0
  55. package/lib/session-reference.js.map +1 -0
  56. package/lib/share-export.js +16 -1
  57. package/lib/share-export.js.map +1 -1
  58. package/lib/share-ops.js +86 -0
  59. package/lib/share-ops.js.map +1 -0
  60. package/lib/share-store.js +294 -0
  61. package/lib/share-store.js.map +1 -0
  62. package/lib/types/activity.d.ts +99 -0
  63. package/lib/types/activity.d.ts.map +1 -0
  64. package/lib/types/admin-routes.d.ts +129 -0
  65. package/lib/types/admin-routes.d.ts.map +1 -0
  66. package/lib/types/client/MobileDrawerFooter.d.ts.map +1 -1
  67. package/lib/types/client/MobileHome.d.ts +1 -1
  68. package/lib/types/client/MobileHome.d.ts.map +1 -1
  69. package/lib/types/client/MobileHomeChips.d.ts +1 -1
  70. package/lib/types/client/MobileHomeChips.d.ts.map +1 -1
  71. package/lib/types/client/MobileSessionHeader.d.ts +13 -2
  72. package/lib/types/client/MobileSessionHeader.d.ts.map +1 -1
  73. package/lib/types/client/MobileSessionInfo.d.ts +20 -3
  74. package/lib/types/client/MobileSessionInfo.d.ts.map +1 -1
  75. package/lib/types/client/RemoteComposerBanner.d.ts +42 -0
  76. package/lib/types/client/RemoteComposerBanner.d.ts.map +1 -0
  77. package/lib/types/client/RemoteHeaderIcon.d.ts +37 -0
  78. package/lib/types/client/RemoteHeaderIcon.d.ts.map +1 -0
  79. package/lib/types/client/RemoteShareMenu.d.ts +28 -0
  80. package/lib/types/client/RemoteShareMenu.d.ts.map +1 -0
  81. package/lib/types/client/RemoteStatusIcon.d.ts +36 -0
  82. package/lib/types/client/RemoteStatusIcon.d.ts.map +1 -0
  83. package/lib/types/client/compat/desktop.d.ts +21 -0
  84. package/lib/types/client/compat/desktop.d.ts.map +1 -0
  85. package/lib/types/client/compat/types.d.ts +57 -0
  86. package/lib/types/client/compat/types.d.ts.map +1 -1
  87. package/lib/types/client/current-session-report.d.ts +37 -0
  88. package/lib/types/client/current-session-report.d.ts.map +1 -0
  89. package/lib/types/client/effects/header-status.d.ts.map +1 -1
  90. package/lib/types/client/effects/keyboard-guard.d.ts.map +1 -1
  91. package/lib/types/client/effects/permission-sheet.d.ts +39 -0
  92. package/lib/types/client/effects/permission-sheet.d.ts.map +1 -0
  93. package/lib/types/client/effects/remote-session.d.ts +25 -0
  94. package/lib/types/client/effects/remote-session.d.ts.map +1 -0
  95. package/lib/types/client/effects/turn-fold.d.ts +9 -0
  96. package/lib/types/client/effects/turn-fold.d.ts.map +1 -1
  97. package/lib/types/client/index.d.ts.map +1 -1
  98. package/lib/types/client/locales.d.ts +187 -2
  99. package/lib/types/client/locales.d.ts.map +1 -1
  100. package/lib/types/client/remote-fetch.d.ts +51 -0
  101. package/lib/types/client/remote-fetch.d.ts.map +1 -0
  102. package/lib/types/client/remote-group-expansion.d.ts +41 -0
  103. package/lib/types/client/remote-group-expansion.d.ts.map +1 -0
  104. package/lib/types/client/remote-share-css.d.ts +19 -0
  105. package/lib/types/client/remote-share-css.d.ts.map +1 -0
  106. package/lib/types/client/remote-share-register.d.ts +113 -0
  107. package/lib/types/client/remote-share-register.d.ts.map +1 -0
  108. package/lib/types/client/remote-status-css.d.ts +15 -0
  109. package/lib/types/client/remote-status-css.d.ts.map +1 -0
  110. package/lib/types/client/remote-status-register.d.ts +46 -0
  111. package/lib/types/client/remote-status-register.d.ts.map +1 -0
  112. package/lib/types/client/settings/SettingsSection.d.ts +46 -0
  113. package/lib/types/client/settings/SettingsSection.d.ts.map +1 -0
  114. package/lib/types/client/settings/register-settings.d.ts +58 -0
  115. package/lib/types/client/settings/register-settings.d.ts.map +1 -0
  116. package/lib/types/client/settings/settings-css.d.ts +10 -0
  117. package/lib/types/client/settings/settings-css.d.ts.map +1 -0
  118. package/lib/types/client/share/share-preview.d.ts.map +1 -1
  119. package/lib/types/client/styles/composer.css.d.ts +1 -1
  120. package/lib/types/client/styles/composer.css.d.ts.map +1 -1
  121. package/lib/types/client/styles/header.css.d.ts +1 -1
  122. package/lib/types/client/styles/header.css.d.ts.map +1 -1
  123. package/lib/types/client/styles/info.css.d.ts +1 -1
  124. package/lib/types/client/styles/info.css.d.ts.map +1 -1
  125. package/lib/types/client/styles/remote-session.css.d.ts +2 -0
  126. package/lib/types/client/styles/remote-session.css.d.ts.map +1 -0
  127. package/lib/types/client-data/current-session.d.ts +41 -0
  128. package/lib/types/client-data/current-session.d.ts.map +1 -0
  129. package/lib/types/client-data/remote-group-expansion.d.ts +76 -0
  130. package/lib/types/client-data/remote-group-expansion.d.ts.map +1 -0
  131. package/lib/types/client-data/remote-status.d.ts +148 -0
  132. package/lib/types/client-data/remote-status.d.ts.map +1 -0
  133. package/lib/types/client-data/settings-form.d.ts +774 -0
  134. package/lib/types/client-data/settings-form.d.ts.map +1 -0
  135. package/lib/types/client-data/shares.d.ts +211 -0
  136. package/lib/types/client-data/shares.d.ts.map +1 -0
  137. package/lib/types/client-pairing.d.ts +114 -0
  138. package/lib/types/client-pairing.d.ts.map +1 -0
  139. package/lib/types/client-routes.d.ts +112 -0
  140. package/lib/types/client-routes.d.ts.map +1 -0
  141. package/lib/types/config.d.ts +200 -0
  142. package/lib/types/config.d.ts.map +1 -0
  143. package/lib/types/fetch-route-intercept.d.ts +156 -0
  144. package/lib/types/fetch-route-intercept.d.ts.map +1 -0
  145. package/lib/types/fingerprint.d.ts +164 -0
  146. package/lib/types/fingerprint.d.ts.map +1 -0
  147. package/lib/types/http.d.ts +41 -0
  148. package/lib/types/http.d.ts.map +1 -0
  149. package/lib/types/index.d.ts +56 -24
  150. package/lib/types/index.d.ts.map +1 -1
  151. package/lib/types/intercept-shape.d.ts +32 -0
  152. package/lib/types/intercept-shape.d.ts.map +1 -0
  153. package/lib/types/intercept.d.ts +432 -0
  154. package/lib/types/intercept.d.ts.map +1 -0
  155. package/lib/types/merge-streams.d.ts +393 -0
  156. package/lib/types/merge-streams.d.ts.map +1 -0
  157. package/lib/types/relay-access.d.ts +310 -0
  158. package/lib/types/relay-access.d.ts.map +1 -0
  159. package/lib/types/relay-client.d.ts +274 -0
  160. package/lib/types/relay-client.d.ts.map +1 -0
  161. package/lib/types/relay-filter.d.ts +103 -0
  162. package/lib/types/relay-filter.d.ts.map +1 -0
  163. package/lib/types/relay-server.d.ts +208 -0
  164. package/lib/types/relay-server.d.ts.map +1 -0
  165. package/lib/types/restart-fields.d.ts +22 -0
  166. package/lib/types/restart-fields.d.ts.map +1 -0
  167. package/lib/types/restart-watcher.d.ts +83 -0
  168. package/lib/types/restart-watcher.d.ts.map +1 -0
  169. package/lib/types/session-reference.d.ts +66 -0
  170. package/lib/types/session-reference.d.ts.map +1 -0
  171. package/lib/types/share-export.d.ts +14 -1
  172. package/lib/types/share-export.d.ts.map +1 -1
  173. package/lib/types/share-ops.d.ts +79 -0
  174. package/lib/types/share-ops.d.ts.map +1 -0
  175. package/lib/types/share-store.d.ts +87 -0
  176. package/lib/types/share-store.d.ts.map +1 -0
  177. package/lib/types/virtual-id.d.ts +38 -0
  178. package/lib/types/virtual-id.d.ts.map +1 -0
  179. package/lib/virtual-id.js +52 -0
  180. package/lib/virtual-id.js.map +1 -0
  181. package/llms.txt +17 -14
  182. package/package.json +60 -50
  183. package/scripts/build-client.mjs +5 -3
  184. package/scripts/check-host-shadow.mjs +19 -2
  185. package/scripts/check-settings-form.mjs +933 -0
  186. package/scripts/check-shares.mjs +397 -0
  187. package/scripts/check-upload-endpoint.mjs +59 -3
  188. package/scripts/sync-doc-version.mjs +8 -15
  189. package/scripts/verify-fingerprint-live.mjs +111 -0
  190. package/src/activity.ts +218 -0
  191. package/src/admin-routes.ts +627 -0
  192. package/src/client/MobileAttachButton.tsx +2 -2
  193. package/src/client/MobileAttachChips.tsx +3 -3
  194. package/src/client/MobileDrawerFooter.tsx +7 -4
  195. package/src/client/MobileHome.tsx +20 -16
  196. package/src/client/MobileHomeChips.tsx +16 -16
  197. package/src/client/MobileNavOverlay.tsx +2 -2
  198. package/src/client/MobileNavToggle.tsx +3 -3
  199. package/src/client/MobileSessionHeader.tsx +63 -42
  200. package/src/client/MobileSessionInfo.tsx +118 -17
  201. package/src/client/RemoteComposerBanner.tsx +76 -0
  202. package/src/client/RemoteHeaderIcon.tsx +103 -0
  203. package/src/client/RemoteShareMenu.tsx +57 -0
  204. package/src/client/RemoteStatusIcon.tsx +91 -0
  205. package/src/client/compat/desktop.ts +22 -0
  206. package/src/client/compat/types.ts +62 -0
  207. package/src/client/current-session-report.ts +164 -0
  208. package/src/client/effects/header-status.ts +21 -17
  209. package/src/client/effects/keyboard-guard.ts +65 -1
  210. package/src/client/effects/permission-sheet.ts +149 -0
  211. package/src/client/effects/remote-session.ts +68 -0
  212. package/src/client/effects/turn-fold.ts +52 -0
  213. package/src/client/index.tsx +151 -36
  214. package/src/client/locales.ts +396 -2
  215. package/src/client/remote-fetch.ts +125 -0
  216. package/src/client/remote-group-expansion.ts +190 -0
  217. package/src/client/remote-share-css.ts +54 -0
  218. package/src/client/remote-share-register.ts +244 -0
  219. package/src/client/remote-status-css.ts +64 -0
  220. package/src/client/remote-status-register.ts +107 -0
  221. package/src/client/settings/SettingsSection.tsx +1229 -0
  222. package/src/client/settings/register-settings.ts +116 -0
  223. package/src/client/settings/settings-css.ts +236 -0
  224. package/src/client/share/share-preview.tsx +6 -3
  225. package/src/client/share/share-sheet.tsx +3 -3
  226. package/src/client/styles/composer.css.ts +119 -26
  227. package/src/client/styles/header.css.ts +7 -7
  228. package/src/client/styles/info.css.ts +74 -0
  229. package/src/client/styles/remote-session.css.ts +251 -0
  230. package/src/client-data/current-session.ts +57 -0
  231. package/src/client-data/remote-group-expansion.ts +145 -0
  232. package/src/client-data/remote-status.ts +374 -0
  233. package/src/client-data/settings-form.ts +1371 -0
  234. package/src/client-data/shares.ts +467 -0
  235. package/src/client-pairing.ts +244 -0
  236. package/src/client-routes.ts +732 -0
  237. package/src/config.ts +447 -0
  238. package/src/fetch-route-intercept.ts +510 -0
  239. package/src/fingerprint.ts +408 -0
  240. package/src/http.ts +68 -0
  241. package/src/index.ts +719 -62
  242. package/src/intercept-shape.ts +87 -0
  243. package/src/intercept.ts +3362 -0
  244. package/src/merge-streams.ts +1272 -0
  245. package/src/relay-access.ts +669 -0
  246. package/src/relay-client.ts +1514 -0
  247. package/src/relay-filter.ts +291 -0
  248. package/src/relay-server.ts +2025 -0
  249. package/src/restart-fields.ts +36 -0
  250. package/src/restart-watcher.ts +140 -0
  251. package/src/session-reference.ts +156 -0
  252. package/src/share-export.ts +26 -1
  253. package/src/share-ops.ts +114 -0
  254. package/src/share-store.ts +373 -0
  255. package/src/virtual-id.ts +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-form.d.ts","sourceRoot":"","sources":["../../../src/client-data/settings-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,+HAA+H;AAC/H,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAA;AAE7D,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,KAAK,GAAG,gBAAgB,CAAA;IAC9B,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,KAAK,GAAG,gBAAgB,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 * Session-sharing data for the browser half (T33b + T33b-fix): the
3
+ * shared-session table behind the three entry points (session "…" menu
4
+ * item, title-row remote icon, settings-page shared list).
5
+ * Browser-import-free so scripts/check-shares.mjs drives it directly with a
6
+ * fake fetch:
7
+ *
8
+ * - `parseSharesBody(body, now)` maps the `GET /_dsh/zen-remote/admin/shares`
9
+ * body (T33a: `{ ok, shares:[{ sessionId, sharedAt, lastActivityAt, busy,
10
+ * remainingMs(null=忙碌), viewers, title }] }`) into tolerant view entries,
11
+ * each stamped with the parse time so `describeShare` can let the idle
12
+ * countdown tick between polls;
13
+ * - `describeShare(entry, now, t?)` maps one entry (or the absence of one)
14
+ * to the icon's three states — off / on / watched (a desktop client is
15
+ * viewing) — plus the hover line (idle time left, or the busy copy);
16
+ * - `shareFailText(outcome, action, t)` maps a refused share/unshare to the
17
+ * one-line `window.alert` copy, keyed by the server's error code;
18
+ * - `createSharesStore(fetchImpl, visibility?, pollMs?)` is the subscription
19
+ * store every part shares. The ROLE gates everything (T33b-fix): until
20
+ * the registration wires a role nothing polls and nothing renders; only
21
+ * a host polls. A failed GET — 404 during a plugin reload, a dropped
22
+ * connection, anything — fails exactly its own round: the last table
23
+ * stays on screen and the next tick asks again; no latch, no permanent
24
+ * shutdown. The poll cadence is visibility-shaped: the timer only runs
25
+ * while the page is visible, becoming visible pulls once immediately;
26
+ * - `getSharesStore()` is the page-wide singleton the registered components
27
+ * read, so exactly one poll loop exists no matter how many parts mount.
28
+ */
29
+ /** Same-origin admin shares route (host half: T33a, src/admin-routes.ts). */
30
+ export declare const ADMIN_SHARES_ROUTE = "/_dsh/zen-remote/admin/shares";
31
+ /** One shared session as the parts render it. `asOf` is the parse time that
32
+ * anchors the local countdown decay (the wire has no such field). */
33
+ export interface ShareEntryView {
34
+ sessionId: string;
35
+ sharedAt: number;
36
+ lastActivityAt: number;
37
+ busy: boolean;
38
+ /** Idle time left at `asOf`; null = busy (not counting down). */
39
+ remainingMs: number | null;
40
+ viewers: number;
41
+ title: string | null;
42
+ /** When this row was parsed off a GET body (Date.now() of the refresh). */
43
+ asOf: number;
44
+ }
45
+ /** Everything the parts read off the store, one frozen object per change. */
46
+ export interface SharesSnapshot {
47
+ /**
48
+ * The deployment role, wired by the registration from the SAME decision
49
+ * the settings page makes (row document first, client-config probe as the
50
+ * fallback — settings-form.ts's settingsRoleOf). `'unknown'` until that
51
+ * wiring answers: nothing polls, the parts render nothing. `'client'`
52
+ * hides the parts and stops the polling; switching back to host resumes.
53
+ */
54
+ role: 'unknown' | 'host' | 'client';
55
+ /** One GET has answered ok — parts render nothing before this. */
56
+ ready: boolean;
57
+ entries: readonly ShareEntryView[];
58
+ }
59
+ /** The locale keys `describeShare` needs, as its formatter accepts them. */
60
+ export type ShareTextKey = 'shareRemoteStateOff' | 'shareRemoteBusy' | 'shareRemoteRemainingHours' | 'shareRemoteRemainingMinutes';
61
+ /** Minimal shape of the framework `t` seat over the plugin's namespace. */
62
+ export type ShareTextFormatter = (key: ShareTextKey, params?: Record<string, number>) => string;
63
+ /** Default formatter: the plugin's Chinese dictionary (the key-set source of
64
+ * truth). Components pass their real framework `t`, so the default only
65
+ * serves the pure-function callers (check script, non-React reads). */
66
+ export declare function createZhShareFormatter(): ShareTextFormatter;
67
+ /** The icon's three states and the hover line (T33b spec). */
68
+ export interface ShareDescription {
69
+ state: 'off' | 'on' | 'watched';
70
+ remainingText: string;
71
+ }
72
+ /**
73
+ * Map one entry — or the absence of one — to the remote icon's state and its
74
+ * hover text. The idle countdown decays locally from the entry's `asOf` stamp
75
+ * (a ≤30 s-poll skew beats a frozen number), floors at zero, reads as hours
76
+ * once above the hour and minutes below it, and swaps to the busy copy when
77
+ * the session is not counting down at all. A session with a desktop client
78
+ * watching reads `watched` regardless of the countdown — the countdown stays
79
+ * in the hover text.
80
+ */
81
+ export declare function describeShare(entry: ShareEntryView | undefined | null, now: number, t?: ShareTextFormatter): ShareDescription;
82
+ /** Parse one GET body tolerantly: a garbage shape is an empty table, a
83
+ * garbage row is dropped — never a throw into the polling loop. */
84
+ export declare function parseSharesBody(body: unknown, now: number): ShareEntryView[];
85
+ /** How one share/unshare/unshare-all POST ended. A refused action carries
86
+ * the server's error `code` when it sent one (`subagent-session`,
87
+ * `no-session`, …) for the alert copy to key on. */
88
+ export type ShareActionOutcome = {
89
+ ok: true;
90
+ } | {
91
+ ok: false;
92
+ code?: string;
93
+ message?: string;
94
+ };
95
+ /** The action verbs the POST route takes (mirror of the server's set). */
96
+ export type ShareAction = 'share' | 'unshare' | 'unshare-all';
97
+ /** The locale keys `shareFailText` needs. */
98
+ export type ShareFailTextKey = 'shareRemoteFailSubagent' | 'shareRemoteFailEmpty' | 'shareRemoteFailGeneric';
99
+ export type ShareFailTextFormatter = (key: ShareFailTextKey) => string;
100
+ /**
101
+ * The one-line `window.alert` copy for a refused action (T33b-fix): the
102
+ * share-specific server codes map to their reasons, everything else —
103
+ * including every unshare failure — reads as the generic retry line.
104
+ */
105
+ export declare function shareFailText(outcome: {
106
+ ok: boolean;
107
+ code?: string;
108
+ }, action: ShareAction, t: ShareFailTextFormatter): string;
109
+ /** The keys the info-card row reads: the icon's words, the one new state
110
+ * word (the icon only ever colored the on state, it never had copy for it),
111
+ * and the settings list's viewers line (reused verbatim). The component's
112
+ * real `t` seat carries the whole dictionary, so it assigns cleanly; the
113
+ * check/test doubles just answer these keys. */
114
+ export type ShareCardFormatterKey = ShareTextKey | 'shareRemoteStateOn' | 'settings.shareViewers';
115
+ export type ShareCardFormatter = (key: ShareCardFormatterKey, params?: Record<string, unknown>) => string;
116
+ /** What the info-card「远程访问」row renders (T67). */
117
+ export interface ShareCardRemoteView {
118
+ /** Host role + an answered table + not a subagent session — the exact
119
+ * gate the title-row icon and the menu item use. */
120
+ visible: boolean;
121
+ /** Whether the switch reads on (the session is in the table). */
122
+ shared: boolean;
123
+ /** The description line under the label: state word, then (when on) the
124
+ * watchers count if any, then the idle countdown / busy copy verbatim
125
+ * from {@link describeShare}. */
126
+ line: string;
127
+ }
128
+ /**
129
+ * Derive the info-card「远程访问」row from the shares snapshot (T67). The
130
+ * visibility gate is the shared one; the description reuses the icon's
131
+ * words (`shareRemoteStateOn` is the one new state word — the icon only
132
+ * ever colored that state, it never had copy for it).
133
+ */
134
+ export declare function shareCardRemoteView(args: {
135
+ ready: boolean;
136
+ role: SharesSnapshot['role'];
137
+ subagent: boolean;
138
+ entry: ShareEntryView | undefined;
139
+ now: number;
140
+ t: ShareCardFormatter;
141
+ }): ShareCardRemoteView;
142
+ /** Whether the page is currently visible, plus change notifications — the
143
+ * seam that keeps the poll cadence visibility-shaped while staying
144
+ * testable (the check script injects a controllable source). */
145
+ export interface VisibilitySource {
146
+ visible(): boolean;
147
+ subscribe(listener: () => void): () => void;
148
+ }
149
+ /** The real source: `visibilitychange` off `document` (Node: always visible,
150
+ * never notifying). */
151
+ export declare const documentVisibility: VisibilitySource;
152
+ /** The store face the three T33b parts share. */
153
+ export interface SharesStore {
154
+ /** The current snapshot — a stable frozen reference until the next change. */
155
+ getSnapshot(): SharesSnapshot;
156
+ /** Observe snapshot replacements; polling runs while at least one
157
+ * listener is attached AND the wired role is host AND the page is
158
+ * visible. */
159
+ subscribe(listener: () => void): () => void;
160
+ /** Wire the deployment role (settings-form.ts's settingsRoleOf verdict,
161
+ * re-applied on every configForms snapshot update). Flipping back to host
162
+ * resumes polling with an immediate pull; flipping to client stops it. */
163
+ setRole(role: 'host' | 'client'): void;
164
+ /** GET now (latest-wins). @returns whether an ok body landed. */
165
+ refresh(): Promise<boolean>;
166
+ /** POST share, then refresh immediately. @returns the action's outcome. */
167
+ share(sessionId: string): Promise<ShareActionOutcome>;
168
+ /** POST unshare for one session, then refresh. @returns the outcome. */
169
+ unshare(sessionId: string): Promise<ShareActionOutcome>;
170
+ /** POST unshare-all, then refresh. @returns the outcome. */
171
+ unshareAll(): Promise<ShareActionOutcome>;
172
+ }
173
+ /** Poll cadence while the page is visible, the role is host, and at least
174
+ * one part is mounted. */
175
+ export declare const SHARES_POLL_MS = 30000;
176
+ /**
177
+ * Build one store over an injectable fetch and visibility source. The GET is
178
+ * latest-wins (T16's gate): an earlier request answering late never
179
+ * overwrites a newer table. Every GET failure fails its own round only —
180
+ * the last ready table stays up and the next tick retries (a plugin reload
181
+ * serving a few 404s must not blind the page until reload). The timer is
182
+ * real while visible and gone while hidden; becoming visible pulls once
183
+ * immediately. `pollMs` exists for the check script: the shipped cadence is
184
+ * far too slow for a test to observe, so tests run a few cycles at 5 ms.
185
+ */
186
+ export declare function createSharesStore(fetchImpl: typeof fetch, visibility?: VisibilitySource, pollMs?: number): SharesStore;
187
+ /** The page-wide store every registered part reads — one poll loop no
188
+ * matter how many of the menu items, the header icon and the settings
189
+ * list are mounted at once. Created lazily over the real fetch, so the
190
+ * check script never constructs it. */
191
+ export declare function getSharesStore(): SharesStore;
192
+ /**
193
+ * The subscribe face the title-row icon hands `useSyncExternalStore`: on
194
+ * the phone shell (a non-desktop-shell viewport at or under 767px) the
195
+ * mobile stylesheet blanket-hides every `conversation.session.header.actions`
196
+ * entry (styles/header.css.ts), so the icon would never be seen — it does
197
+ * not subscribe either, and a subscription that never opens never polls.
198
+ * Pure over (store, phoneShell) so the desktop-gate test drives it with a
199
+ * counting fake fetch.
200
+ */
201
+ export declare function subscribeIfNotPhoneShell(store: SharesStore, phoneShell: boolean, listener: () => void): () => void;
202
+ /**
203
+ * The subscribe face the info-card row (T67) hands `useSyncExternalStore`:
204
+ * the shares table is subscribed ONLY while the sheet is open — a
205
+ * subscription is what keeps the 30 s admin/shares poll alive, and the
206
+ * phone shell must not keep that polling through the gateway. Pure over
207
+ * (store, open) so behavior tests drive it with a counting fake fetch;
208
+ * closing the sheet returns the no-op unsubscribes and the poll stops.
209
+ */
210
+ export declare function subscribeWhileOpen(store: SharesStore, open: boolean, listener: () => void): () => void;
211
+ //# sourceMappingURL=shares.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shares.d.ts","sourceRoot":"","sources":["../../../src/client-data/shares.ts"],"names":[],"mappings":"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;uCAGuC;AACvC,wBAAgB,cAAc,IAAI,WAAW,CAG5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAElH;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAEtG"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Pure pairing/probe logic for the sub-client half (T16): the address
3
+ * normalizer the claim route validates user input with, and the two
4
+ * classifiers that turn one HTTP round-trip each into a shape the settings
5
+ * block can render. No I/O, no clocks, no process reads — the route module
6
+ * owns the sockets and the timeouts, this module owns the decisions.
7
+ *
8
+ * IPv4/IPv6 range checks are hand-rolled because the address arrives as a
9
+ * STRING inside an already-parsed URL and the point is to keep the private-
10
+ * network allowance of `normalizeServerUrl` exactly as narrow as specified
11
+ * (172.16/12, 100.64/10 etc. — off-by-one range bugs here would either lock
12
+ * LAN users out or open plain-http pairing to the public internet).
13
+ */
14
+ /** The gateway claim endpoint, resolved against the normalized server URL. */
15
+ export declare const CLAIM_PATH = "/lan-gate/pair/claim-desktop";
16
+ /** The relay ping path the client backend probes (the gateway admits this
17
+ * prefix for desktop-client devices and forwards to the host relay route). */
18
+ export declare const RELAY_PING_PATH = "/_dsh/zen-remote/relay/ping";
19
+ /** Why an address did not normalize: unparseable / wrong shape, or a plain
20
+ * `http:` URL whose host is not one of the private-network allowances. */
21
+ export type NormalizeFailure = 'invalid' | 'insecure-http';
22
+ export type NormalizeResult = {
23
+ ok: true;
24
+ url: string;
25
+ } | {
26
+ ok: false;
27
+ reason: NormalizeFailure;
28
+ };
29
+ /**
30
+ * Normalize one user-typed server address to the exact string the client
31
+ * stores and probes: surrounding whitespace and trailing slashes gone, no
32
+ * path (beyond `/`), no query, no fragment, no embedded credentials, and a
33
+ * scheme of `http:` (private hosts only) or `https:` (always).
34
+ */
35
+ export declare function normalizeServerUrl(input: string): NormalizeResult;
36
+ /**
37
+ * The volatile row field's current server address, read through the loader's
38
+ * `{ get() }` wrapper and normalized exactly like the claim route validates
39
+ * user input. undefined when the field is unset or no longer legal: a
40
+ * hand-edited row must never have the pairing token sent to an address the
41
+ * claim route would have refused. Used by the relay client's address getter
42
+ * in src/index.ts; the status route reads the row itself because it needs
43
+ * the unset / invalid distinction its own two states answer with.
44
+ */
45
+ export declare function normalizedRowServerUrl(row: unknown): string | undefined;
46
+ /** The gateway claim reply, exactly as lib/lan-gate-server.cjs answers
47
+ * `/lan-gate/pair/claim-desktop` for a desktop client. */
48
+ export interface ClaimSuccessBody {
49
+ ok: true;
50
+ id?: unknown;
51
+ name?: unknown;
52
+ token?: unknown;
53
+ }
54
+ /** What the claim route forwards to the browser (and what it maps every
55
+ * gateway refusal to). `message` rides through for role-mismatch — the
56
+ * gateway's copy is localized server-side and meant to be shown as-is. */
57
+ export type ClaimOutcome = {
58
+ ok: true;
59
+ token: string;
60
+ deviceId: string;
61
+ deviceName: string;
62
+ } | {
63
+ ok: false;
64
+ code: 'role-mismatch';
65
+ message?: string;
66
+ } | {
67
+ ok: false;
68
+ code: 'bad-code';
69
+ } | {
70
+ ok: false;
71
+ code: 'locked';
72
+ retryAfterMs: number;
73
+ } | {
74
+ ok: false;
75
+ code: 'unexpected';
76
+ };
77
+ /**
78
+ * Classify one claim round-trip. `body` may be anything the server returned
79
+ * (including unparsable garbage — the route passes `undefined` then): only
80
+ * the exact happy shape counts as success, everything else lands in the four
81
+ * refusal buckets the settings block has copy for.
82
+ */
83
+ export declare function classifyClaimResponse(status: number, body: unknown): ClaimOutcome;
84
+ /** One probe round-trip handed to {@link classifyProbe}: either the transport
85
+ * failed before any HTTP answer existed (refused, reset, timeout) or a
86
+ * response arrived with its status and best-effort parsed body. */
87
+ export type ProbeResult = {
88
+ kind: 'error';
89
+ } | {
90
+ kind: 'response';
91
+ status: number;
92
+ body: unknown;
93
+ };
94
+ /** The connection states the settings block renders. */
95
+ export type ProbeState = 'unreachable' | 'revoked' | 'unexpected' | 'connected';
96
+ /**
97
+ * Classify one probe of `<serverUrl>${RELAY_PING_PATH}`:
98
+ *
99
+ * - no HTTP answer at all → `unreachable` (down, wrong address, timeout);
100
+ * - 401 with the relay route's own `relay-unauthorized` error → `unexpected`
101
+ * (T23a-fix): the gateway ACCEPTED the token but the server's internal
102
+ * secret disagrees — a server-side fault that must not unpair a valid
103
+ * device; only the gateway's own pairing wall (`reason: 'unpaired'`) is
104
+ * a dead token;
105
+ * - any other 401 → `revoked` — the gateway treats an invalid or revoked
106
+ * desktop-client token as unpaired and answers its 401 wall;
107
+ * - 403 with `reason: 'relay-only'` → `unexpected`: the token was ACCEPTED
108
+ * but the server refuses the relay prefix — only possible when the server
109
+ * is not running the 2.0.0 gateway;
110
+ * - any other status (200 ping ok, 404 from a pre-relay server, even 3xx)
111
+ * means the gateway accepted the token → `connected`.
112
+ */
113
+ export declare function classifyProbe(result: ProbeResult): ProbeState;
114
+ //# sourceMappingURL=client-pairing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-pairing.d.ts","sourceRoot":"","sources":["../../src/client-pairing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,8EAA8E;AAC9E,eAAO,MAAM,UAAU,iCAAiC,CAAA;AAExD;8EAC8E;AAC9E,eAAO,MAAM,eAAe,gCAAgC,CAAA;AAE5D;0EAC0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,CAAA;AAE1D,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAA;AAqE3C;;;;;GAKG;AACH,wBAAgB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AG,YAAY,GAAG,WAAW,CAAA;AAE/E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAmB7D"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Sub-client backend routes (T16): pairing claim and connection status for a
3
+ * DSH process running `role: 'client'` — this machine's settings page is the
4
+ * ONLY browser surface that talks to them, same-origin like the host's admin
5
+ * routes (T14). The claim route forwards the pairing code to the SERVER's
6
+ * gateway (`<serverUrl>/lan-gate/pair/claim-desktop`) and hands the returned
7
+ * token straight back to the browser, which writes it into the row's
8
+ * `deviceToken` secret field; this process itself never persists or logs the
9
+ * token — it only ever puts it into an Authorization header for the status
10
+ * probe. The status route reads `serverUrl` / `deviceToken` from the plugin
11
+ * ROW PER REQUEST (both are volatile `{ get() }`-wrapped fields, so the row
12
+ * object `apply()` received is the only live source) and probes the server's
13
+ * relay ping, reporting one of the five connection states.
14
+ *
15
+ * Same walls as the admin routes, in the same order: `admit` first (webServer
16
+ * routes skip DSH's /api authentication), then for the POST also the
17
+ * same-origin gate and a 16 KiB JSON-object body cap. Built by a factory so
18
+ * the tests drive it over a real socket with a mock server gateway.
19
+ *
20
+ * T41b adds the plain-HTTP relay under `client/http/<route>`: the GETs the
21
+ * browser fetch wrapper intercepted (`/api/changes.summary` / `changes.diff`
22
+ * naming a virtual session id) are re-issued here through the relay client's
23
+ * `http()` with the original id restored, and the upstream status,
24
+ * content type and body travel back verbatim.
25
+ */
26
+ import type { IncomingMessage, ServerResponse } from 'node:http';
27
+ import type { AdminAdmission } from './admin-routes.js';
28
+ import type { FetchRouteInterceptDiagnostics } from './fetch-route-intercept.js';
29
+ import type { CurrentSessionRead, InterceptDiagnostics } from './intercept.js';
30
+ import type { RelayClient } from './relay-client.js';
31
+ /** Prefix all client routes live under (one webServer prefix registration). */
32
+ export declare const CLIENT_ROUTE_PREFIX = "/_dsh/zen-remote/client";
33
+ /** POST `{serverUrl, code, name}`: redeem a desktop pairing code. */
34
+ export declare const CLIENT_CLAIM_ROUTE = "/_dsh/zen-remote/client/claim";
35
+ /** GET: the current connection state (never carries the token). */
36
+ export declare const CLIENT_STATUS_ROUTE = "/_dsh/zen-remote/client/status";
37
+ /** POST: one immediate reconnect attempt (T43, the settings page's 立即重连);
38
+ * answered 409 unless the relay client is currently `offline`. */
39
+ export declare const CLIENT_RECONNECT_ROUTE = "/_dsh/zen-remote/client/reconnect";
40
+ /** GET: the remote-session status the T34 client parts render from (T34) —
41
+ * the relay's serving state, the interface-compatibility verdict, the
42
+ * handshake's server name, and the closed-session map. The prefix is
43
+ * registered on BOTH roles (T34-fix): a host — no relay client wired —
44
+ * answers the empty `{state:'unpaired', versionMismatch:false, serverName:'',
45
+ * closed:{}}` conclusion. It carries no token and no server address. */
46
+ export declare const CLIENT_REMOTE_STATUS_ROUTE = "/_dsh/zen-remote/client/remote-status";
47
+ /** POST `{sessionId: <虚拟 id>}`: close one remote session from THIS machine
48
+ * (T34) — the backend forwards the ORIGINAL id through the relay's
49
+ * `POST relay/v1/unshare`, so the server closes it with reason `'client'`. */
50
+ export declare const CLIENT_UNSHARE_ROUTE = "/_dsh/zen-remote/client/unshare";
51
+ /** POST `{sessionId: string | null}`: the browser's report of which session
52
+ * the host UI currently has open (T62) — the intercept layer runs in this
53
+ * backend process and cannot read the browser's localStorage itself. `null`
54
+ * means a readable signal says nothing is open; the sink stores the value
55
+ * and re-judges the mergers immediately. */
56
+ export declare const CLIENT_CURRENT_SESSION_ROUTE = "/_dsh/zen-remote/client/current-session";
57
+ /** Prefix of the plain-HTTP relay routes (T41b):
58
+ * `GET ${CLIENT_HTTP_ROUTE_PREFIX}<route>?<query>` relays one intercepted
59
+ * `/api/<route>` call (the fetch wrapper's rewrites land here) to the
60
+ * server, with the virtual session id swapped back to the original. */
61
+ export declare const CLIENT_HTTP_ROUTE_PREFIX = "/_dsh/zen-remote/client/http/";
62
+ /** The fetch face this module needs; injectable for tests. */
63
+ export type FetchLike = (url: string | URL, init?: RequestInit) => Promise<Response>;
64
+ export interface ClientHandlerOptions {
65
+ /** The connection service's admit, injected by apply(); tests fake it. */
66
+ admit: (req: IncomingMessage) => AdminAdmission;
67
+ /** The plugin ROW as apply() received it — `serverUrl` / `deviceToken` are
68
+ * volatile, so they must be read through this at request time, never
69
+ * snapshotted at registration. */
70
+ getRowConfig: () => unknown;
71
+ /** Outbound fetch, defaulting to the global one. */
72
+ fetchImpl?: FetchLike;
73
+ /** The live relay client (T23a), once apply() built one. When it has LEFT
74
+ * its initial `unpaired` state — a connection attempt ran — the status
75
+ * route reports ITS verdict (state + handshake server name) and skips the
76
+ * ping probe; the probe below stays as the fallback for a client that
77
+ * never connected, so the settings page still gets a fresh answer while
78
+ * the startup `connect()` is still unpaired. */
79
+ getRelayClient?: () => RelayClient | undefined;
80
+ /** The typert interception's diagnostics (T23b-1), read live per request.
81
+ * Shapes, counters and failure codes only — never a token. Undefined when
82
+ * this composition never even attempted an install (no typertGateway). */
83
+ getIntercept?: () => InterceptDiagnostics | undefined;
84
+ /** The exact-fetch-route interception's diagnostics (T51), read live per
85
+ * request: the local upload route's remote-forwarding install state and
86
+ * its refusal counters. Undefined when this composition never attempted
87
+ * one (no connection service, or no fileUploads service to inject). */
88
+ getFetchRouteIntercept?: () => FetchRouteInterceptDiagnostics | undefined;
89
+ /** Serve ONLY the remote-status route (T41a-fix2, the host role's mount):
90
+ * every other route under the prefix answers the same 404 an unknown path
91
+ * would. The claim / status / reconnect / unshare routes exist for a
92
+ * CLIENT — a host carries no relay client and no pairing surface, so
93
+ * answering them (even with their empty conclusions) is exposure without
94
+ * a user. The remote-status route stays: the T34 client parts poll it on
95
+ * whatever role this process runs. */
96
+ remoteStatusOnly?: boolean;
97
+ /** T62: the sink for the browser's current-session reports — stores the
98
+ * latest value (memory, last write wins across windows) and makes the
99
+ * intercept re-judge at once. Wired only on the CLIENT mount; the HOST
100
+ * mount's remoteStatusOnly wall 404s the route before this matters, and
101
+ * a client handler WITHOUT the sink answers the same 404 (no sink, no
102
+ * route). */
103
+ onCurrentSession?: (read: CurrentSessionRead) => void;
104
+ }
105
+ export type ClientHandler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
106
+ /**
107
+ * Build the client route handler for one plugin row. The returned handler
108
+ * owns the full response lifecycle of every request under
109
+ * {@link CLIENT_ROUTE_PREFIX} and never throws.
110
+ */
111
+ export declare function createClientHandler(options: ClientHandlerOptions): ClientHandler;
112
+ //# sourceMappingURL=client-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-routes.d.ts","sourceRoot":"","sources":["../../src/client-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAIvD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI9E,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAA;AAGrE,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,4BAA4B,CAAA;AAE5D,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,kCAAiC,CAAA;AAEhE,mEAAmE;AACnE,eAAO,MAAM,mBAAmB,mCAAkC,CAAA;AAElE;kEACkE;AAClE,eAAO,MAAM,sBAAsB,sCAAqC,CAAA;AAExE;;;;;wEAKwE;AACxE,eAAO,MAAM,0BAA0B,0CAAyC,CAAA;AAEhF;;8EAE8E;AAC9E,eAAO,MAAM,oBAAoB,oCAAmC,CAAA;AAEpE;;;;4CAI4C;AAC5C,eAAO,MAAM,4BAA4B,4CAA2C,CAAA;AAOpF;;;uEAGuE;AACvE,eAAO,MAAM,wBAAwB,kCAAiC,CAAA;AAWtE,8DAA8D;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