dsh-zen-remote 2.3.11 → 2.4.1
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/CHANGELOG.md +45 -78
- package/README.md +94 -84
- package/README.zh-CN.md +90 -81
- package/bin/zen-remote.mjs +5 -0
- package/docs/interface.md +6 -6
- package/docs/remote-access.en.md +6 -4
- package/docs/remote-access.md +6 -4
- package/dsh-push.mjs +96 -10
- package/lib/adapters/dsh-better-sidebar/index.js +7 -3
- package/lib/adapters/dsh-better-sidebar/index.js.map +1 -1
- package/lib/admin-routes.js +10 -2
- package/lib/admin-routes.js.map +1 -1
- package/lib/cli/args.js +251 -0
- package/lib/cli/args.js.map +1 -0
- package/lib/cli/bootstrap.js +449 -0
- package/lib/cli/bootstrap.js.map +1 -0
- package/lib/cli/command-setup.js +484 -0
- package/lib/cli/command-setup.js.map +1 -0
- package/lib/cli/commands-client.js +359 -0
- package/lib/cli/commands-client.js.map +1 -0
- package/lib/cli/commands-host.js +1108 -0
- package/lib/cli/commands-host.js.map +1 -0
- package/lib/cli/commands-status.js +279 -0
- package/lib/cli/commands-status.js.map +1 -0
- package/lib/cli/config-writer.js +334 -0
- package/lib/cli/config-writer.js.map +1 -0
- package/lib/cli/context.js +10 -0
- package/lib/cli/context.js.map +1 -0
- package/lib/cli/i18n.js +620 -0
- package/lib/cli/i18n.js.map +1 -0
- package/lib/cli/ipc-client.js +160 -0
- package/lib/cli/ipc-client.js.map +1 -0
- package/lib/cli/ipc-server.js +464 -0
- package/lib/cli/ipc-server.js.map +1 -0
- package/lib/cli/main.js +245 -0
- package/lib/cli/main.js.map +1 -0
- package/lib/cli/qr-terminal.js +48 -0
- package/lib/cli/qr-terminal.js.map +1 -0
- package/lib/client-data/qr.js +286 -0
- package/lib/client-data/qr.js.map +1 -0
- package/lib/client-routes.js +308 -25
- package/lib/client-routes.js.map +1 -1
- package/lib/client.js +1013 -229
- package/lib/config.js +50 -12
- package/lib/config.js.map +1 -1
- package/lib/debug-report.js +28 -1
- package/lib/debug-report.js.map +1 -1
- package/lib/fetch-route-intercept.js +334 -26
- package/lib/fetch-route-intercept.js.map +1 -1
- package/lib/index.js +608 -375
- package/lib/index.js.map +1 -1
- package/lib/intercept.js +1833 -280
- package/lib/intercept.js.map +1 -1
- package/lib/lan-gate-server.cjs +36 -10
- package/lib/merge-streams.js +103 -11
- package/lib/merge-streams.js.map +1 -1
- package/lib/plugin-route-intercept.js +93 -63
- package/lib/plugin-route-intercept.js.map +1 -1
- package/lib/relay-access.js +8 -1
- package/lib/relay-access.js.map +1 -1
- package/lib/relay-client.js +133 -4
- package/lib/relay-client.js.map +1 -1
- package/lib/relay-pool.js +275 -0
- package/lib/relay-pool.js.map +1 -0
- package/lib/relay-server.js +269 -17
- package/lib/relay-server.js.map +1 -1
- package/lib/restart-fields.js +6 -4
- package/lib/restart-fields.js.map +1 -1
- package/lib/share-ops.js +68 -0
- package/lib/share-ops.js.map +1 -1
- package/lib/share-store.js +65 -27
- package/lib/share-store.js.map +1 -1
- package/lib/state-store.js +400 -0
- package/lib/state-store.js.map +1 -0
- package/lib/types/adapters/dsh-better-sidebar/index.d.ts +3 -2
- package/lib/types/adapters/dsh-better-sidebar/index.d.ts.map +1 -1
- package/lib/types/admin-routes.d.ts.map +1 -1
- package/lib/types/cli/args.d.ts +78 -0
- package/lib/types/cli/args.d.ts.map +1 -0
- package/lib/types/cli/bootstrap.d.ts +170 -0
- package/lib/types/cli/bootstrap.d.ts.map +1 -0
- package/lib/types/cli/command-setup.d.ts +72 -0
- package/lib/types/cli/command-setup.d.ts.map +1 -0
- package/lib/types/cli/commands-client.d.ts +36 -0
- package/lib/types/cli/commands-client.d.ts.map +1 -0
- package/lib/types/cli/commands-host.d.ts +82 -0
- package/lib/types/cli/commands-host.d.ts.map +1 -0
- package/lib/types/cli/commands-status.d.ts +46 -0
- package/lib/types/cli/commands-status.d.ts.map +1 -0
- package/lib/types/cli/config-writer.d.ts +92 -0
- package/lib/types/cli/config-writer.d.ts.map +1 -0
- package/lib/types/cli/context.d.ts +39 -0
- package/lib/types/cli/context.d.ts.map +1 -0
- package/lib/types/cli/i18n.d.ts +32 -0
- package/lib/types/cli/i18n.d.ts.map +1 -0
- package/lib/types/cli/ipc-client.d.ts +83 -0
- package/lib/types/cli/ipc-client.d.ts.map +1 -0
- package/lib/types/cli/ipc-server.d.ts +113 -0
- package/lib/types/cli/ipc-server.d.ts.map +1 -0
- package/lib/types/cli/main.d.ts +57 -0
- package/lib/types/cli/main.d.ts.map +1 -0
- package/lib/types/cli/qr-terminal.d.ts +17 -0
- package/lib/types/cli/qr-terminal.d.ts.map +1 -0
- package/lib/types/client/RemoteStatusIcon.d.ts.map +1 -1
- package/lib/types/client/current-session-report.d.ts +4 -0
- package/lib/types/client/current-session-report.d.ts.map +1 -1
- package/lib/types/client/effects/model-group-side.d.ts.map +1 -1
- package/lib/types/client/effects/remote-session.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +47 -3
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/settings/SettingsSection.d.ts.map +1 -1
- package/lib/types/client/settings/settings-css.d.ts +1 -1
- package/lib/types/client/settings/settings-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/wizard/GatewayWizard.d.ts.map +1 -1
- package/lib/types/client/wizard/cards/ProxyCard.d.ts.map +1 -1
- package/lib/types/client/wizard/wizard-css.d.ts +1 -1
- package/lib/types/client/wizard/wizard-css.d.ts.map +1 -1
- package/lib/types/client-data/model-group-side.d.ts +23 -2
- package/lib/types/client-data/model-group-side.d.ts.map +1 -1
- package/lib/types/client-data/remote-status.d.ts +47 -1
- package/lib/types/client-data/remote-status.d.ts.map +1 -1
- package/lib/types/client-data/settings-form.d.ts +85 -1
- package/lib/types/client-data/settings-form.d.ts.map +1 -1
- package/lib/types/client-data/wizard.d.ts +56 -1
- package/lib/types/client-data/wizard.d.ts.map +1 -1
- package/lib/types/client-routes.d.ts +25 -1
- package/lib/types/client-routes.d.ts.map +1 -1
- package/lib/types/config.d.ts +40 -14
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/debug-report.d.ts.map +1 -1
- package/lib/types/fetch-route-intercept.d.ts +66 -8
- package/lib/types/fetch-route-intercept.d.ts.map +1 -1
- package/lib/types/index.d.ts +9 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/intercept.d.ts +72 -10
- package/lib/types/intercept.d.ts.map +1 -1
- package/lib/types/merge-streams.d.ts +79 -1
- package/lib/types/merge-streams.d.ts.map +1 -1
- package/lib/types/plugin-route-intercept.d.ts +25 -9
- package/lib/types/plugin-route-intercept.d.ts.map +1 -1
- package/lib/types/relay-access.d.ts +3 -1
- package/lib/types/relay-access.d.ts.map +1 -1
- package/lib/types/relay-client.d.ts +23 -2
- package/lib/types/relay-client.d.ts.map +1 -1
- package/lib/types/relay-pool.d.ts +148 -0
- package/lib/types/relay-pool.d.ts.map +1 -0
- package/lib/types/relay-server.d.ts +30 -3
- package/lib/types/relay-server.d.ts.map +1 -1
- package/lib/types/restart-fields.d.ts +5 -5
- package/lib/types/restart-fields.d.ts.map +1 -1
- package/lib/types/share-ops.d.ts +47 -1
- package/lib/types/share-ops.d.ts.map +1 -1
- package/lib/types/share-store.d.ts.map +1 -1
- package/lib/types/state-store.d.ts +179 -0
- package/lib/types/state-store.d.ts.map +1 -0
- package/lib/types/upload-limits.d.ts +15 -0
- package/lib/types/upload-limits.d.ts.map +1 -1
- package/lib/types/virtual-id.d.ts +21 -0
- package/lib/types/virtual-id.d.ts.map +1 -1
- package/lib/types/wizard/probe.d.ts.map +1 -1
- package/lib/types/wizard/proxy-snippets.d.ts +3 -0
- package/lib/types/wizard/proxy-snippets.d.ts.map +1 -1
- package/lib/types/wizard/routes.d.ts +1 -0
- package/lib/types/wizard/routes.d.ts.map +1 -1
- package/lib/types/wizard/status.d.ts +9 -0
- package/lib/types/wizard/status.d.ts.map +1 -1
- package/lib/types/wizard/verify.d.ts +3 -0
- package/lib/types/wizard/verify.d.ts.map +1 -1
- package/lib/upload-limits.js +15 -0
- package/lib/upload-limits.js.map +1 -1
- package/lib/virtual-id.js +60 -0
- package/lib/virtual-id.js.map +1 -1
- package/lib/wizard/probe.js +46 -1
- package/lib/wizard/probe.js.map +1 -1
- package/lib/wizard/proxy-snippets.js +14 -1
- package/lib/wizard/proxy-snippets.js.map +1 -1
- package/lib/wizard/routes.js +23 -4
- package/lib/wizard/routes.js.map +1 -1
- package/lib/wizard/status.js +21 -0
- package/lib/wizard/status.js.map +1 -1
- package/lib/wizard/verify.js +31 -8
- package/lib/wizard/verify.js.map +1 -1
- package/package.json +8 -4
- package/pwa/icons/badge-96.png +0 -0
- package/pwa/icons/badge.svg +1 -0
- package/pwa/manifest.json +2 -1
- package/pwa/sw.js +3 -1
- package/scripts/check-debug-report.mjs +41 -1
- package/scripts/check-settings-form.mjs +14 -3
- package/scripts/check-settings-view.mjs +247 -0
- package/scripts/check-wizard-ui.mjs +37 -0
- package/src/adapters/dsh-better-sidebar/index.ts +7 -3
- package/src/admin-routes.ts +10 -2
- package/src/cli/args.ts +289 -0
- package/src/cli/bootstrap.ts +569 -0
- package/src/cli/command-setup.ts +540 -0
- package/src/cli/commands-client.ts +369 -0
- package/src/cli/commands-host.ts +1127 -0
- package/src/cli/commands-status.ts +296 -0
- package/src/cli/config-writer.ts +354 -0
- package/src/cli/context.ts +38 -0
- package/src/cli/i18n.ts +645 -0
- package/src/cli/ipc-client.ts +216 -0
- package/src/cli/ipc-server.ts +531 -0
- package/src/cli/main.ts +285 -0
- package/src/cli/qr-terminal.ts +49 -0
- package/src/client/RemoteStatusIcon.tsx +4 -1
- package/src/client/current-session-report.ts +28 -4
- package/src/client/effects/model-group-side.ts +19 -5
- package/src/client/effects/remote-session.ts +26 -6
- package/src/client/locales.ts +96 -6
- package/src/client/settings/SettingsSection.tsx +287 -92
- package/src/client/settings/settings-css.ts +18 -0
- package/src/client/styles/remote-session.css.ts +15 -1
- package/src/client/wizard/GatewayWizard.tsx +470 -109
- package/src/client/wizard/cards/ProxyCard.tsx +2 -1
- package/src/client/wizard/wizard-css.ts +23 -0
- package/src/client-data/model-group-side.ts +37 -10
- package/src/client-data/remote-status.ts +112 -17
- package/src/client-data/settings-form.ts +164 -8
- package/src/client-data/wizard.ts +112 -2
- package/src/client-routes.ts +334 -26
- package/src/config.ts +62 -16
- package/src/debug-report.ts +27 -1
- package/src/fetch-route-intercept.ts +381 -32
- package/src/index.ts +608 -380
- package/src/intercept.ts +1866 -286
- package/src/merge-streams.ts +155 -10
- package/src/plugin-route-intercept.ts +120 -71
- package/src/relay-access.ts +14 -3
- package/src/relay-client.ts +163 -5
- package/src/relay-pool.ts +387 -0
- package/src/relay-server.ts +312 -16
- package/src/restart-fields.ts +6 -4
- package/src/share-ops.ts +82 -1
- package/src/share-store.ts +59 -26
- package/src/state-store.ts +428 -0
- package/src/upload-limits.ts +16 -0
- package/src/virtual-id.ts +57 -0
- package/src/wizard/probe.ts +54 -2
- package/src/wizard/proxy-snippets.ts +17 -2
- package/src/wizard/routes.ts +24 -5
- package/src/wizard/status.ts +28 -0
- package/src/wizard/verify.ts +33 -11
- package/AGENTS.md +0 -185
- package/docs/adr/0001-plugin-bridge-forwards-plugin-routes.md +0 -15
- package/docs/adr/0002-relay-emulates-websocket.md +0 -8
|
@@ -158,6 +158,7 @@ export interface MergerIdentity {
|
|
|
158
158
|
* English forms live in src/client/locales.ts, `remoteGroup*` keys).
|
|
159
159
|
*/
|
|
160
160
|
export type MergerAnnotation = 'none' | 'offline' | 'revoked' | 'unpaired' | 'mismatch';
|
|
161
|
+
export type MergerLang = 'zh' | 'en';
|
|
161
162
|
export interface WorkspaceMergerOptions extends MergerIdentity {
|
|
162
163
|
/** Diagnostics for frames this merger dropped (unknown type or malformed).
|
|
163
164
|
* Optional: without it the drop is silent. */
|
|
@@ -165,6 +166,9 @@ export interface WorkspaceMergerOptions extends MergerIdentity {
|
|
|
165
166
|
/** T65: the clock the tombstone hide-grace runs on. Default Date.now;
|
|
166
167
|
* tests advance an injectable fake to cross the grace. */
|
|
167
168
|
now?: () => number;
|
|
169
|
+
/** Language for status annotation suffixes on group titles (`'zh'` default,
|
|
170
|
+
* `'en'` English). Accepts a getter for live resolution. */
|
|
171
|
+
lang?: MergerLang | (() => MergerLang) | undefined;
|
|
168
172
|
/** PB-25b: the known-real-session inventory report — every time the
|
|
169
173
|
* session registry changes, the FULL current set of real ids this merger
|
|
170
174
|
* knows (the sessionHome keys: live ids and tombstones alike, each one the
|
|
@@ -178,6 +182,25 @@ export interface WorkspaceMergerOptions extends MergerIdentity {
|
|
|
178
182
|
* rewrite never mutates merge state). */
|
|
179
183
|
onKnownSessions?: (ids: ReadonlySet<string>) => void;
|
|
180
184
|
}
|
|
185
|
+
/** The lists a workspace merger contributes to the MS-3 multi-server
|
|
186
|
+
* composition: the locally observed truth (identical across every slot fed
|
|
187
|
+
* the same local stream) and this server's virtualized remote contribution
|
|
188
|
+
* (shown workspaces in remote order, archived = remote archived + the T58
|
|
189
|
+
* hidden closed sessions, pinned). Snapshots — the caller may mutate them
|
|
190
|
+
* freely; nothing here hands out a live reference. */
|
|
191
|
+
export interface WorkspaceMergerParts {
|
|
192
|
+
local: {
|
|
193
|
+
orderIds: string[];
|
|
194
|
+
archivedIds: string[];
|
|
195
|
+
pinnedIds: string[];
|
|
196
|
+
};
|
|
197
|
+
remote: {
|
|
198
|
+
orderIds: string[];
|
|
199
|
+
archivedIds: string[];
|
|
200
|
+
pinnedIds: string[];
|
|
201
|
+
workspaces: Record<string, unknown>[];
|
|
202
|
+
};
|
|
203
|
+
}
|
|
181
204
|
export interface WorkspaceMerger {
|
|
182
205
|
readonly serverId: string;
|
|
183
206
|
readonly serverName: string;
|
|
@@ -231,6 +254,13 @@ export interface WorkspaceMerger {
|
|
|
231
254
|
* for a serverId change the remote state must be gone first (onRemoteGone
|
|
232
255
|
* first); for a rename it may stay. */
|
|
233
256
|
retarget(identity: MergerIdentity): void;
|
|
257
|
+
/** MS-3: the composition inputs the multi-server orchestrator builds the
|
|
258
|
+
* canonical merged frames from — the locally observed lists and this
|
|
259
|
+
* server's virtualized remote contribution, as snapshots. Reading the
|
|
260
|
+
* workspaces runs the same {@link forwardVisible} visibility gate the
|
|
261
|
+
* frame paths use (T56/T58), so the parts can never expose a group the
|
|
262
|
+
* frames would withhold. */
|
|
263
|
+
parts(): WorkspaceMergerParts;
|
|
234
264
|
}
|
|
235
265
|
/**
|
|
236
266
|
* The workspace/follow merger. Remote state is a Map keyed by the ORIGINAL
|
|
@@ -344,7 +374,9 @@ export declare function mergeSessionList(localResult: unknown, remoteResult: unk
|
|
|
344
374
|
* order, RT dsh-client-ui-model-selection lib/client.js:510 — appended
|
|
345
375
|
* groups render last); each group id becomes the virtual group id
|
|
346
376
|
* `zr~<serverId>~<original>` and its name is prefixed
|
|
347
|
-
* `${
|
|
377
|
+
* `${encodeServerIdZeroWidth(serverId)}${serverName} · ${name}` (MS-4: the
|
|
378
|
+
* WORD JOINER mark plus the serverId as 32 zero-width bits, so the browser
|
|
379
|
+
* can hide OTHER paired servers' groups too) — the same workspace
|
|
348
380
|
* title discipline the merger uses, PLUS the invisible WORD JOINER (T74):
|
|
349
381
|
* the model menu's groups stopped carrying their id in the markup (0.2.0's
|
|
350
382
|
* MenuGroup renders `aria-labelledby={useId()}` only), so the browser
|
|
@@ -434,4 +466,50 @@ export declare function virtualSessionIdsInWorkspaceFrames(frames: readonly unkn
|
|
|
434
466
|
* remote result means "the server said nothing" — no frames.
|
|
435
467
|
*/
|
|
436
468
|
export declare function sessionSummaryAddedFrames(remoteResult: unknown, serverId: string): unknown[];
|
|
469
|
+
/** The cumulative LOCAL lists one workspace merger's `local` side holds. */
|
|
470
|
+
export interface LocalWorkspaceLists {
|
|
471
|
+
orderIds: string[];
|
|
472
|
+
archivedIds: string[];
|
|
473
|
+
pinnedIds: string[];
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* MS-3: fold one LOCAL `workspace/follow` frame into the orchestrator's
|
|
477
|
+
* cumulative local lists — the baseline replaces all three, `order` /
|
|
478
|
+
* `archived` / `pinned` each replace their own list, and every other frame
|
|
479
|
+
* (upsert / remove / junk) observes nothing. The parsing is the merger's own
|
|
480
|
+
* `observeLocal` reading, extracted so the multi-server orchestrator keeps
|
|
481
|
+
* the same truth WITHOUT a second shape definition drifting away from it.
|
|
482
|
+
*/
|
|
483
|
+
export declare function localWorkspaceLists(frame: unknown, current: LocalWorkspaceLists): LocalWorkspaceLists;
|
|
484
|
+
/** One slot's remote contribution for {@link composeMergedWorkspaceFrames}
|
|
485
|
+
* — the `remote` half of {@link WorkspaceMergerParts}. */
|
|
486
|
+
export interface RemoteWorkspaceContribution {
|
|
487
|
+
orderIds: string[];
|
|
488
|
+
archivedIds: string[];
|
|
489
|
+
pinnedIds: string[];
|
|
490
|
+
workspaces: Record<string, unknown>[];
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* MS-3: the canonical merged frames over N servers — local first, then each
|
|
494
|
+
* server's contribution in the given (pairing) order. The order list is
|
|
495
|
+
* plain concatenation, the archived set is DEDUPLICATED in that order (the
|
|
496
|
+
* single-server merger dedupes the same way), and pinned concatenates (the
|
|
497
|
+
* single-server pinned frame never deduped either). With no remotes the
|
|
498
|
+
* frames collapse to the local-only form.
|
|
499
|
+
*/
|
|
500
|
+
export declare function composeMergedWorkspaceFrames(local: LocalWorkspaceLists, remotes: readonly RemoteWorkspaceContribution[]): {
|
|
501
|
+
order: {
|
|
502
|
+
type: 'order';
|
|
503
|
+
workspaceIds: string[];
|
|
504
|
+
};
|
|
505
|
+
archived: {
|
|
506
|
+
type: 'archived';
|
|
507
|
+
archivedSessionIds: string[];
|
|
508
|
+
};
|
|
509
|
+
pinned: {
|
|
510
|
+
type: 'pinned';
|
|
511
|
+
pinnedSessionIds: string[];
|
|
512
|
+
};
|
|
513
|
+
workspaces: Record<string, unknown>[];
|
|
514
|
+
};
|
|
437
515
|
//# sourceMappingURL=merge-streams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-streams.d.ts","sourceRoot":"","sources":["../../src/merge-streams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8IG;AAIH;;8DAE8D;AAC9D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"merge-streams.d.ts","sourceRoot":"","sources":["../../src/merge-streams.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8IG;AAIH;;8DAE8D;AAC9D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;AACvF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAA;AAkEpC,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D;kDAC8C;IAC9C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAA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AAG,OAAO,EAAE,CAc5F;AAID,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,mBAAmB,CAcrG;AAED;0DAC0D;AAC1D,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACtC;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,SAAS,2BAA2B,EAAE,GAC9C;IACD,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IAChD,QAAQ,EAAE;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,kBAAkB,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IAC5D,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,gBAAgB,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IACtD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;CACtC,CA0BA"}
|
|
@@ -116,15 +116,19 @@ export interface InstallPluginRouteInterceptOptions {
|
|
|
116
116
|
webServer: object;
|
|
117
117
|
/** The local declaration registry (the `zenRemote` service's table). */
|
|
118
118
|
registry: BridgeRegistry;
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
|
|
119
|
+
/** SINGLE-SERVER mode: the client relay client; `pluginRequest` is the
|
|
120
|
+
* forwarding door. Required together with {@link getServerId} and
|
|
121
|
+
* {@link getStatus} unless the MS-4 per-server faces below are given
|
|
122
|
+
* (MS-5's pool wiring). */
|
|
123
|
+
relay?: RelayClient;
|
|
124
|
+
/** SINGLE-SERVER mode: the CURRENT handshake's server id, read live per
|
|
125
|
+
* call; a virtual id minted for another server (or before any handshake)
|
|
126
|
+
* refuses `server-changed`. */
|
|
127
|
+
getServerId?: () => string | undefined;
|
|
128
|
+
/** SINGLE-SERVER mode: the PB-2 bridge verdicts, computed live per call; a
|
|
129
|
+
* plugin that is not bridged right now refuses with the status's own
|
|
130
|
+
* reason. */
|
|
131
|
+
getStatus?: () => BridgeStatus[];
|
|
128
132
|
/** The validated adapters (PB-11), as the wiring registered them.
|
|
129
133
|
* Absent/empty — the pluggable default — means no adapter routes exist
|
|
130
134
|
* and this interception behaves exactly as before. */
|
|
@@ -150,6 +154,18 @@ export interface InstallPluginRouteInterceptOptions {
|
|
|
150
154
|
* consumption: nothing here mutates merge state. Absent → the scan is
|
|
151
155
|
* exactly the request-local PB-22 behavior. */
|
|
152
156
|
getKnownRealIds?: () => ReadonlySet<string>;
|
|
157
|
+
/** MS-4: the per-server faces of the connection pool. A request whose
|
|
158
|
+
* located ids are `zr~<serverId>~…` is validated, forwarded and
|
|
159
|
+
* response-rewritten against THAT server alone: its relay client
|
|
160
|
+
* (`undefined` — a server the pool does not hold — refuses
|
|
161
|
+
* `server-changed`), its bridge verdicts and its known-real-id inventory.
|
|
162
|
+
* Each is optional and falls back on its own to the single-server face
|
|
163
|
+
* above: no `getRelayForServer` → `relay` exactly when the id belongs to
|
|
164
|
+
* `getServerId()`; no `getStatusForServer` → `getStatus()`; no
|
|
165
|
+
* `getKnownRealIdsForServer` → `getKnownRealIds()`. All read live. */
|
|
166
|
+
getRelayForServer?: (serverId: string) => RelayClient | undefined;
|
|
167
|
+
getStatusForServer?: (serverId: string) => BridgeStatus[];
|
|
168
|
+
getKnownRealIdsForServer?: (serverId: string) => ReadonlySet<string>;
|
|
153
169
|
/** PB-26a: called with the virtual session ids a response rewrite
|
|
154
170
|
* PRODUCED — a `rewriteIds.fields` route's wrapped positions, or the ids
|
|
155
171
|
* an adapter's `client.response` hook passed through `virtualize` (e.g.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-route-intercept.d.ts","sourceRoot":"","sources":["../../src/plugin-route-intercept.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAGH,OAAO,KAAK,EAAiB,cAAc,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAA;AAK5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGpD,OAAO,KAAK,EAAE,iBAAiB,EAA8E,MAAM,0BAA0B,CAAA;AAW7I;;;;;4CAK4C;AAC5C,MAAM,MAAM,mBAAmB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AAwMjF;wDACwD;AACxD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAO,GAAG,mBAAmB,CAS3E;AAED;0EAC0E;AAC1E,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qEAAqE;AACrE,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,mBAAmB,CAAA;IAC1B;4BACwB;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,oCAAoC;IACpC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S,CAAA;IACjE,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,YAAY,EAAE,CAAA;IACzD,wBAAwB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC,MAAM,CAAC,CAAA;IACpE;;;;;;0EAMsE;IACtE,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAA;IAC5D,iEAAiE;IACjE,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;CACnD;AAED,MAAM,WAAW,0BAA0B;IACzC;4DACwD;IACxD,SAAS,IAAI,IAAI,CAAA;IACjB,WAAW,IAAI,+BAA+B,CAAA;CAC/C;AAkED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,kCAAkC,GAAG,0BAA0B,CAy0DnH"}
|
|
@@ -143,12 +143,14 @@ export type InvokeDecision = {
|
|
|
143
143
|
/** One stream decision: allow (global streams carry a `streamFilter`, scoped
|
|
144
144
|
* streams list the session ids the subscription depends on — the relay kills
|
|
145
145
|
* the stream and counts viewers with them, and the event subscription sets
|
|
146
|
-
* `events`
|
|
146
|
+
* `events`; a duplex entry sets `uplink` so the route arms the
|
|
147
|
+
* `/v1/stream-uplink` channel), or the 403 reason. */
|
|
147
148
|
export type StreamDecision = {
|
|
148
149
|
allow: true;
|
|
149
150
|
filter?: StreamFilter;
|
|
150
151
|
sessionIds: string[];
|
|
151
152
|
events?: true;
|
|
153
|
+
uplink?: true;
|
|
152
154
|
} | {
|
|
153
155
|
allow: false;
|
|
154
156
|
reason: InvokeDenyReason;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-access.d.ts","sourceRoot":"","sources":["../../src/relay-access.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,KAAK,OAAO,GAC3C,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"}
|
|
@@ -231,8 +231,12 @@ export interface RelayClient {
|
|
|
231
231
|
/** Open the NDJSON stream route. `frame` lines are yielded, `ping` lines
|
|
232
232
|
* only refresh the idle clock, `end` finishes the iteration, an `error`
|
|
233
233
|
* line throws its RelayError. A caller abort ENDS the iteration normally;
|
|
234
|
-
* `break` aborts the underlying request.
|
|
235
|
-
|
|
234
|
+
* `break` aborts the underlying request. TA-1: with `options.uplink` the
|
|
235
|
+
* stream is DUPLEX — the server's handshake line names the stream id and
|
|
236
|
+
* the pump forwards the host's frames through `/v1/stream-uplink`
|
|
237
|
+
* (single-flight batched, strictly ordered); an uplink refusal surfaces as
|
|
238
|
+
* the stream's error, and the host iterable is always released. */
|
|
239
|
+
openStream(namespace: string, method: string, args: unknown, signal?: AbortSignal, options?: RelayStreamOptions): AsyncIterable<unknown>;
|
|
236
240
|
/** One plain-HTTP round-trip (T41b): `route` / `query` name a registered
|
|
237
241
|
* `/api` GET (relay-access's RELAY_HTTP_ROUTES; `query` is the URL-encoded
|
|
238
242
|
* query string with the session id already restored). Resolves with the
|
|
@@ -341,6 +345,23 @@ export interface RelayHttpResult {
|
|
|
341
345
|
* answer buffered JSON). */
|
|
342
346
|
body: string;
|
|
343
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* The duplex-stream options (TA-1). `uplink` is the HOST-side frame source
|
|
350
|
+
* (the local `UplinkInbox` a `terminal/attach` session writes keystrokes and
|
|
351
|
+
* resize frames into); while the stream is open the pump below forwards its
|
|
352
|
+
* frames to the server through `/v1/stream-uplink`, single-flight batched,
|
|
353
|
+
* and — on stream exit — calls its `return()` so the host inbox is released
|
|
354
|
+
* even when the pump was parked mid-read. `uplinkWindow` is the host's own
|
|
355
|
+
* inbox budget, forwarded verbatim so the relay's bounded queue and the
|
|
356
|
+
* host's overflow accounting mean the same thing.
|
|
357
|
+
*/
|
|
358
|
+
export interface RelayStreamOptions {
|
|
359
|
+
uplink?: AsyncIterable<unknown>;
|
|
360
|
+
uplinkWindow?: {
|
|
361
|
+
maxBytes: number;
|
|
362
|
+
frameOverheadBytes: number;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
344
365
|
/**
|
|
345
366
|
* The credential digest recorded beside a completed handshake (T23a-fix):
|
|
346
367
|
* sha256 over `url + "\n" + token`, first 16 hex chars. Enough to detect a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-client.d.ts","sourceRoot":"","sources":["../../src/relay-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"relay-client.d.ts","sourceRoot":"","sources":["../../src/relay-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AA4F3D;;;;;GAKG;AACH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ired server in the state file, replacing
|
|
4
|
+
* the single row-driven client the client role used to keep. The paired
|
|
5
|
+
* list itself lives in `zen-remote-state.json` (src/state-store.ts — MS-1's
|
|
6
|
+
* three-in-one file); this module owns the LIVE half: start, handshake
|
|
7
|
+
* bookkeeping, re-pair, unpair, and the second dedupe layer's teardown.
|
|
8
|
+
*
|
|
9
|
+
* Two bookkeeping paths meet here. When one client's handshake lands, the
|
|
10
|
+
* handshake facts (serverId/serverName/deviceName) are persisted onto its
|
|
11
|
+
* state-file record — `recordServerHandshake` also REMOVES any other record
|
|
12
|
+
* that carries the same serverId (the same server re-paired under a new
|
|
13
|
+
* address), and this module stops that stale entry's client and announces it
|
|
14
|
+
* with `reason: 'dedupe'`. Removals the USER makes go out with
|
|
15
|
+
* `reason: 'unpair'`.
|
|
16
|
+
*
|
|
17
|
+
* Display names: several servers report the same `serverName` (the default is
|
|
18
|
+
* just the hostname), so the merged sidebar would show N identical rows.
|
|
19
|
+
* {@link deriveDisplayServerNames} numbers duplicates in pairing order
|
|
20
|
+
* (`home-1`, `home-2`, …) and leaves unique names bare; a rename that removes
|
|
21
|
+
* the collision removes the suffixes with it, because the derivation is
|
|
22
|
+
* recomputed on every `entries()` read.
|
|
23
|
+
*
|
|
24
|
+
* The clients themselves are the plain T23a relay clients — their getters
|
|
25
|
+
* read the pool's in-memory record per request, so a re-pair only updates
|
|
26
|
+
* that record and calls `credentialsChanged()`. `createClient` is injectable:
|
|
27
|
+
* the tests drive the whole lifecycle without a socket.
|
|
28
|
+
*/
|
|
29
|
+
import { createRelayClient } from './relay-client.js';
|
|
30
|
+
import type { RelayClient, RelayClock, RelayState } from './relay-client.js';
|
|
31
|
+
import { MAX_PAIRED_SERVERS } from './state-store.js';
|
|
32
|
+
/** One entry's name inputs for {@link deriveDisplayServerNames}. */
|
|
33
|
+
export interface ServerNameEntry {
|
|
34
|
+
entryId: string;
|
|
35
|
+
serverName: string;
|
|
36
|
+
serverUrl: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The display name of every entry: a trimmed non-empty `serverName` is the
|
|
40
|
+
* base, otherwise the server URL. Bases appearing once keep their name; bases
|
|
41
|
+
* appearing twice or more are numbered `-1`, `-2`, `-3`… in `entries` order
|
|
42
|
+
* (pairing order). Pure — recomputed whenever the pool is asked for entries,
|
|
43
|
+
* so a rename that removes a collision removes the suffixes too.
|
|
44
|
+
*/
|
|
45
|
+
export declare function deriveDisplayServerNames(entries: readonly ServerNameEntry[]): Map<string, string>;
|
|
46
|
+
/** One live pool entry as the callers see it. */
|
|
47
|
+
export interface RelayPoolEntryView {
|
|
48
|
+
/** The stable state-file record id. */
|
|
49
|
+
entryId: string;
|
|
50
|
+
/** The normalized server address. */
|
|
51
|
+
serverUrl: string;
|
|
52
|
+
/** The handshake's server id; the persisted record id until one lands. */
|
|
53
|
+
serverId: string | undefined;
|
|
54
|
+
/** The handshake's server name; the persisted name until one lands. */
|
|
55
|
+
serverName: string | undefined;
|
|
56
|
+
/** {@link deriveDisplayServerNames} over the current entries. */
|
|
57
|
+
displayName: string;
|
|
58
|
+
/** The live client. */
|
|
59
|
+
client: RelayClient;
|
|
60
|
+
/** When the pairing was first added (epoch ms). */
|
|
61
|
+
createdAt: number;
|
|
62
|
+
}
|
|
63
|
+
/** Why an entry left the pool: the user removed it, or a handshake proved it
|
|
64
|
+
* a stale duplicate of another entry pointing at the same server. */
|
|
65
|
+
export type RelayPoolRemovalReason = 'unpair' | 'dedupe';
|
|
66
|
+
export interface RelayPoolOptions {
|
|
67
|
+
/** The state file (`<DSH_HOME>/zen-remote-state.json`). */
|
|
68
|
+
stateFile: string;
|
|
69
|
+
/** The row's legacy single-server credentials, read once at startup: when
|
|
70
|
+
* the paired list is still empty they become `servers[0]`. */
|
|
71
|
+
legacySource?: () => {
|
|
72
|
+
serverUrl?: string;
|
|
73
|
+
deviceToken?: string;
|
|
74
|
+
} | undefined;
|
|
75
|
+
/** This side's own interface fingerprints (T42), handed to every client.
|
|
76
|
+
* May be async (the real wiring computes against the typert registry,
|
|
77
|
+
* which loads package by package); the clients await it per handshake. */
|
|
78
|
+
computeOwnFingerprints: () => Record<string, string> | Promise<Record<string, string>>;
|
|
79
|
+
/** Outbound fetch for the clients; defaults to the global one. */
|
|
80
|
+
fetchImpl?: typeof fetch;
|
|
81
|
+
/** Clock for the clients' reconnect machinery; defaults to the real one. */
|
|
82
|
+
clock?: RelayClock;
|
|
83
|
+
/** The client factory; injectable so tests run without sockets. */
|
|
84
|
+
createClient?: typeof createRelayClient;
|
|
85
|
+
/** Every client state change, with the entry it belongs to. */
|
|
86
|
+
onStateChange?: (event: {
|
|
87
|
+
entryId: string;
|
|
88
|
+
serverId?: string;
|
|
89
|
+
state: RelayState;
|
|
90
|
+
lastError?: string;
|
|
91
|
+
}) => void;
|
|
92
|
+
/** Every entry removal, with why it left. */
|
|
93
|
+
onServerRemoved?: (removed: {
|
|
94
|
+
entryId: string;
|
|
95
|
+
serverId?: string;
|
|
96
|
+
reason: RelayPoolRemovalReason;
|
|
97
|
+
}) => void;
|
|
98
|
+
}
|
|
99
|
+
export interface RelayPool {
|
|
100
|
+
/** Every entry in pairing order, with fresh display names. */
|
|
101
|
+
entries(): RelayPoolEntryView[];
|
|
102
|
+
/** Locate one entry by its state-file record id. */
|
|
103
|
+
getByEntryId(entryId: string): RelayPoolEntryView | undefined;
|
|
104
|
+
/** Locate one entry by its (handshake or persisted) server id. */
|
|
105
|
+
getByServerId(serverId: string): RelayPoolEntryView | undefined;
|
|
106
|
+
/** Add or re-pair one server: the record lands on disk first, then the
|
|
107
|
+
* live half follows (re-credentialed in place, or a fresh client). */
|
|
108
|
+
pair(input: {
|
|
109
|
+
serverUrl: string;
|
|
110
|
+
token: string;
|
|
111
|
+
deviceId?: string;
|
|
112
|
+
deviceName?: string;
|
|
113
|
+
}): Promise<{
|
|
114
|
+
ok: true;
|
|
115
|
+
entry: RelayPoolEntryView;
|
|
116
|
+
replaced: boolean;
|
|
117
|
+
} | {
|
|
118
|
+
ok: false;
|
|
119
|
+
code: 'invalid-url' | 'limit-reached';
|
|
120
|
+
}>;
|
|
121
|
+
/** Stop and remove one entry (disk record included). */
|
|
122
|
+
unpair(entryId: string): boolean;
|
|
123
|
+
/** Stop everything and empty the paired list; answers the record count. */
|
|
124
|
+
unpairAll(): number;
|
|
125
|
+
/** One entry's immediate reconnect, or every `offline` client's. Answers
|
|
126
|
+
* whether any attempt was started. */
|
|
127
|
+
reconnect(entryId?: string): Promise<boolean>;
|
|
128
|
+
/** One authenticated ping per `offline` client; the reachable ones get
|
|
129
|
+
* `networkRestored()` (the controlled fast-path back online). */
|
|
130
|
+
probeAndRestoreAll(): Promise<{
|
|
131
|
+
reachable: boolean;
|
|
132
|
+
reconnected: boolean;
|
|
133
|
+
}>;
|
|
134
|
+
/** Forward a device rename to every paired server (T59). */
|
|
135
|
+
queueDeviceNameAll(name: string): void;
|
|
136
|
+
/** Stop every client and detach the listeners (row teardown). */
|
|
137
|
+
stop(): void;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Build the pool: one legacy migration pass, then one client per persisted
|
|
141
|
+
* record, each with a fire-and-forget startup connect — a failed first dial
|
|
142
|
+
* is the backoff ladder's business, exactly like the single-client wiring
|
|
143
|
+
* before it.
|
|
144
|
+
*/
|
|
145
|
+
export declare function createRelayPool(options: RelayPoolOptions): RelayPool;
|
|
146
|
+
/** Re-exported so the pool's consumers never import state-store for the cap. */
|
|
147
|
+
export { MAX_PAIRED_SERVERS };
|
|
148
|
+
//# sourceMappingURL=relay-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-pool.d.ts","sourceRoot":"","sources":["../../src/relay-pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAA4B,MAAM,m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AI,MAAM,CAAA;IACnB;0CACsC;IACtC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7C;qEACiE;IACjE,kBAAkB,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IAC3E,4DAA4D;IAC5D,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,iEAAiE;IACjE,IAAI,IAAI,IAAI,CAAA;CACb;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA0NpE;AAED,gFAAgF;AAChF,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -43,6 +43,24 @@ export { MAX_UPLOAD_BYTES };
|
|
|
43
43
|
/** The `/api` route the upload channel dispatches into, verbatim from the
|
|
44
44
|
* host's own registration (RT dsh-client-file-upload lib/index.js:73). */
|
|
45
45
|
export declare const UPLOAD_HTTP_PATH = "/api/session/uploadFileBinary";
|
|
46
|
+
/**
|
|
47
|
+
* The duplex uplink's buffering ceiling (TA-1): how many bytes of
|
|
48
|
+
* not-yet-consumed uplink frames one live stream may hold — the same budget
|
|
49
|
+
* the host's own stream inbox applies (`DEFAULT_STREAM_INBOX_BYTES`), so a
|
|
50
|
+
* stalled terminal consumer backs up at exactly the point the local session
|
|
51
|
+
* would have. Past it the `/v1/stream-uplink` route answers 413
|
|
52
|
+
* `uplink-overflow` and the stream is aborted.
|
|
53
|
+
*/
|
|
54
|
+
export declare const MAX_STREAM_UPLINK_BYTES = 262144;
|
|
55
|
+
/** The per-stream uplink window the client may advertise (TA-1): how many
|
|
56
|
+
* bytes the host's uplink inbox buffers before it stops draining, and the
|
|
57
|
+
* per-frame framing overhead it charges against that budget. The relay
|
|
58
|
+
* forwards it verbatim — only the shape is validated, the numbers are the
|
|
59
|
+
* host's own contract with itself. */
|
|
60
|
+
export interface RelayUplinkWindow {
|
|
61
|
+
maxBytes: number;
|
|
62
|
+
frameOverheadBytes: number;
|
|
63
|
+
}
|
|
46
64
|
/** Shape of the `typertGateway` service this route needs (measured live,
|
|
47
65
|
* docs/spike-relay.md §2.1: invoke returns the unwrapped business value and
|
|
48
66
|
* throws errors carrying a string `code`; stream opens one `mode: 'stream'`
|
|
@@ -78,6 +96,12 @@ export interface RelayGateway {
|
|
|
78
96
|
args: unknown;
|
|
79
97
|
signal?: AbortSignal;
|
|
80
98
|
peer?: unknown;
|
|
99
|
+
/** TA-1: the duplex uplink queue (a duplex method like `terminal/attach`
|
|
100
|
+
* reads keystrokes/resize frames from it). Absent on one-direction
|
|
101
|
+
* streams — the field's presence IS the duplex flag. */
|
|
102
|
+
uplink?: AsyncIterable<unknown>;
|
|
103
|
+
/** TA-1: the client's advertised uplink window, forwarded verbatim. */
|
|
104
|
+
uplinkWindow?: RelayUplinkWindow;
|
|
81
105
|
}): Promise<AsyncIterable<unknown>>;
|
|
82
106
|
/** The host's wire adapter, shared by the WebSocket mux and the local
|
|
83
107
|
* transports. `open` is the async 0.2.0 method. */
|
|
@@ -195,9 +219,12 @@ export interface RelayHandler {
|
|
|
195
219
|
}
|
|
196
220
|
/**
|
|
197
221
|
* Read the persisted server id, creating (and persisting) one on first use.
|
|
198
|
-
* A
|
|
199
|
-
*
|
|
200
|
-
*
|
|
222
|
+
* A pre-multi-server `zen-remote-server.json` identity migrates in first
|
|
223
|
+
* (and its file is deleted) — an upgraded host keeps its id, so paired
|
|
224
|
+
* devices never see a stranger. A missing file is the normal first run; an
|
|
225
|
+
* unreadable or damaged file must never take the host down, so every failure
|
|
226
|
+
* degrades to a fresh per-process id that simply is not remembered across
|
|
227
|
+
* restarts.
|
|
201
228
|
*/
|
|
202
229
|
export declare function loadServerId(home: string): string;
|
|
203
230
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-server.d.ts","sourceRoot":"","sources":["../../src/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AAM,GAAG,IAAI,CAAA;CAC/B;AAeD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBjD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C;AAgjBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CA2/D7E;AAaD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,wBAAwB,CAAA"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* effect (T17): `role` chooses which halves load; `port` / `host` /
|
|
4
4
|
* `targetPort` / `rateLimit` / `trustedProxies` become the gateway child's
|
|
5
5
|
* runtime shape; `vapidSubject` / `lang` / `pushEvents` / `pushDebounceMs` /
|
|
6
|
-
* `pushSummary` / `pushTurnEnd` / `pushTool`
|
|
7
|
-
* values. Everything else
|
|
8
|
-
* serverUrl, deviceToken, and
|
|
9
|
-
* and needs no reload.
|
|
6
|
+
* `pushSummary` / `pushTurnEnd` / `pushTool` / `pushEnabled` /
|
|
7
|
+
* `pushSessionName` are the push leg's startup values. Everything else
|
|
8
|
+
* (serverName, idleHours, autoShareNewSessions, serverUrl, deviceToken, and
|
|
9
|
+
* the interface-half knobs) is read live per use and needs no reload.
|
|
10
10
|
*
|
|
11
11
|
* Single source shared by both halves: the host's restart watcher
|
|
12
12
|
* (src/restart-watcher.ts) fingerprints exactly these fields, and the
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* this file must never import node builtins or schemastery, which is why the
|
|
17
17
|
* list does not live in src/config.ts (T17b).
|
|
18
18
|
*/
|
|
19
|
-
export declare const RESTART_FIELDS: readonly ["role", "port", "host", "targetPort", "rateLimit", "trustedProxies", "vapidSubject", "lang", "pushEvents", "pushDebounceMs", "pushSummary", "pushTurnEnd", "pushTool"];
|
|
19
|
+
export declare const RESTART_FIELDS: readonly ["role", "port", "host", "targetPort", "rateLimit", "trustedProxies", "vapidSubject", "lang", "pushEvents", "pushDebounceMs", "pushSummary", "pushTurnEnd", "pushTool", "pushEnabled", "pushSessionName"];
|
|
20
20
|
/** One field of {@link RESTART_FIELDS}. */
|
|
21
21
|
export type RestartField = (typeof RESTART_FIELDS)[number];
|
|
22
22
|
//# sourceMappingURL=restart-fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restart-fields.d.ts","sourceRoot":"","sources":["../../src/restart-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"restart-fields.d.ts","sourceRoot":"","sources":["../../src/restart-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,oNAgBjB,CAAA;AAEV,2CAA2C;AAC3C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
package/lib/types/share-ops.d.ts
CHANGED
|
@@ -29,12 +29,58 @@ export interface AgentStatusLike {
|
|
|
29
29
|
}
|
|
30
30
|
/** The slice of a DSH session header the share decision reads. Field names
|
|
31
31
|
* per `validateSessionHeader`: `id` (matches the session id), `origin`
|
|
32
|
-
* (only legal value `'subagent'`), `parentSession` (a string when set)
|
|
32
|
+
* (only legal value `'subagent'`), `parentSession` (a string when set),
|
|
33
|
+
* `isSeeded` (true on a fork). */
|
|
33
34
|
export interface CreatedSessionHeaderLike {
|
|
34
35
|
id?: unknown;
|
|
35
36
|
origin?: unknown;
|
|
36
37
|
parentSession?: unknown;
|
|
38
|
+
isSeeded?: unknown;
|
|
37
39
|
}
|
|
40
|
+
/** The slice of a DSH Session read to detect an unused blank placeholder
|
|
41
|
+
* reclaimed by `session/create` (`dsh-api-session-controller`'s `claim`
|
|
42
|
+
* resumes persisted blank sessions with `source: 'resume'`). */
|
|
43
|
+
export interface CreatedSessionLike {
|
|
44
|
+
header?: CreatedSessionHeaderLike | null | undefined;
|
|
45
|
+
snapshotEvents?: (() => readonly {
|
|
46
|
+
type?: unknown;
|
|
47
|
+
}[]) | undefined;
|
|
48
|
+
}
|
|
49
|
+
/** The slice of `ctx.agents.turnBoundaryOf(session)` (DSH 0.2+ projection
|
|
50
|
+
* reader, the non-deprecated replacement for `snapshotEvents()`). */
|
|
51
|
+
export interface TurnBoundaryLike {
|
|
52
|
+
openTurnStartSeq?: unknown;
|
|
53
|
+
lastTurn?: unknown;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Whether `session` is an unseeded, non-subagent blank session (zero turns
|
|
57
|
+
* ever started). DSH's `createInWorkspace` reuses persisted blank sessions
|
|
58
|
+
* via `session/create` → `agents.resume` (`source: 'resume'`); judging
|
|
59
|
+
* blankness lets `agent/created` auto-share a reclaimed blank placeholder
|
|
60
|
+
* while keeping established conversations closed across reopens.
|
|
61
|
+
*
|
|
62
|
+
* Prefers `turnBoundaryOf(session)` (DSH's `sessionProjections`-backed
|
|
63
|
+
* `ctx.agents.turnBoundaryOf`, the predicate `dsh-api-session-controller`'s
|
|
64
|
+
* own `isBlank` uses: `openTurnStartSeq === null && lastTurn === 0`); falls
|
|
65
|
+
* back to `session.snapshotEvents()` when `turnBoundaryOf` is absent (DSH
|
|
66
|
+
* 0.1.7 compatibility or unit-test mocks; ponytail: remove `snapshotEvents`
|
|
67
|
+
* fallback once 0.1.7 support is dropped and `@deepseek-ai/dsh-session`
|
|
68
|
+
* retires synchronous event-log reads).
|
|
69
|
+
*/
|
|
70
|
+
export declare function isBlankSession(session: CreatedSessionLike | undefined | null, turnBoundaryOf?: ((session: CreatedSessionLike) => TurnBoundaryLike | undefined) | undefined): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether `event` is the very first `turn/start` (`turn === 1`) of an
|
|
73
|
+
* unseeded non-subagent session. Covers the in-memory `reuseLive` path of
|
|
74
|
+
* `session/create`, where a live blank session (created before
|
|
75
|
+
* `autoShareNewSessions` was enabled, or after its idle window expired in
|
|
76
|
+
* memory) is reused without emitting `agent/created`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isFirstTurnStart(session: {
|
|
79
|
+
header?: CreatedSessionHeaderLike | null | undefined;
|
|
80
|
+
} | undefined | null, event: {
|
|
81
|
+
type?: unknown;
|
|
82
|
+
data?: unknown;
|
|
83
|
+
} | undefined | null): boolean;
|
|
38
84
|
/**
|
|
39
85
|
* Re-mark the busy flags a restart wiped. `busy` is deliberately never
|
|
40
86
|
* persisted, so after a plugin-row restart every shared session resumes as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share-ops.d.ts","sourceRoot":"","sources":["../../src/share-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD;;uEAEuE;AACvE,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED
|
|
1
|
+
{"version":3,"file":"share-ops.d.ts","sourceRoot":"","sources":["../../src/share-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD;;uEAEuE;AACvE,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;kCAGkC;AAClC,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;gEAEgE;A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