livedesk 0.1.462 → 0.1.464

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 (40) hide show
  1. package/README.md +28 -8
  2. package/bin/livedesk.js +36 -9
  3. package/client/bin/livedesk-client-node.js +506 -555
  4. package/client/bin/livedesk-client-update-bootstrap.cjs +59 -0
  5. package/client/bin/livedesk-client.js +195 -58
  6. package/client/package.json +11 -11
  7. package/client/src/runtime/agent-process-lifecycle.js +85 -23
  8. package/client/src/runtime/client-runtime-server.js +719 -131
  9. package/client/src/runtime/hub-wake-listener.js +42 -11
  10. package/diagnostics/livedesk-mac-physical-gate-core.mjs +992 -54
  11. package/diagnostics/livedesk-mac-physical-isolation.mjs +48 -5
  12. package/diagnostics/livedesk-mode3-capture-smoke.mjs +549 -88
  13. package/electron/bounded-desktop-log.mjs +609 -0
  14. package/electron/main.mjs +316 -132
  15. package/electron/runtime-process-owner.mjs +287 -0
  16. package/electron/update-manager.mjs +59 -18
  17. package/hub/package.json +2 -2
  18. package/hub/src/agents/agent-manager.js +27 -11
  19. package/hub/src/agents/codex-agent-runtime.js +325 -41
  20. package/hub/src/frame-packet-contract.mjs +427 -0
  21. package/hub/src/live-capture-transition-retry.mjs +297 -0
  22. package/hub/src/mode4-atlas-pool.js +17 -3
  23. package/hub/src/mode4-atlas-worker.js +134 -21
  24. package/hub/src/mode4-atlas.js +180 -16
  25. package/hub/src/remote-audio-subscription-contract.mjs +109 -0
  26. package/hub/src/remote-audio-subscription-contract.test.mjs +72 -0
  27. package/hub/src/remote-hub.js +6405 -4236
  28. package/hub/src/server.js +3234 -2206
  29. package/hub/src/transport/agent-binary-ingress.js +810 -0
  30. package/hub/src/transport/relay-hub-control.js +372 -56
  31. package/hub/src/transport/udp-hub-transport.js +186 -45
  32. package/hub/src/transport/udp-protocol.js +302 -70
  33. package/package.json +11 -11
  34. package/runtime-core/package.json +1 -1
  35. package/runtime-core/src/windows-owned-process-tree.js +172 -24
  36. package/scripts/sync-web-dist.js +1 -0
  37. package/web/dist/assets/index-Bjyg25Sq.js +186 -0
  38. package/web/dist/index.html +1 -1
  39. package/web/dist/livedesk-build-evidence.json +64 -0
  40. package/web/dist/assets/index-CIwiMILW.js +0 -25
package/README.md CHANGED
@@ -72,29 +72,49 @@ reboot; the generated startup command uses the unified launcher.
72
72
  ## macOS physical diagnostic
73
73
 
74
74
  On a Mac with two connected displays, stop every running LiveDesk runtime,
75
- show visibly different content on the two displays, grant Screen Recording and
76
- Accessibility permissions, then run:
75
+ start visibly different continuously moving content on both displays, grant
76
+ Screen Recording and Accessibility permissions, then explicitly confirm that
77
+ the motion is already running:
77
78
 
78
79
  ```bash
79
- npx -y --prefer-online livedesk@latest diagnose mac-physical
80
+ npx -y --prefer-online livedesk@latest diagnose mac-physical --confirm-active-motion
80
81
  ```
81
82
 
82
83
  This command branches before role resolution, state migration, and the normal
83
84
  runtime lock. It refuses to overlap an existing LiveDesk runtime or capture
84
85
  helper, and normal macOS startup reciprocally refuses an active diagnostic
85
- lease. It starts only an isolated loopback Hub and temporary RemoteFast Client
86
- and stops only the exact children it created. Ctrl+C and termination signals
87
- join the same owned cleanup before exit. The default JSON report is written to
86
+ lease. The lease owner authorizes exactly one direct-child production unified
87
+ Hub launcher and one direct-child production unified Client launcher using the
88
+ lease PID, parent PID, and token, then each launcher consumes and removes that
89
+ capability before starting descendants. The Client therefore runs
90
+ the normal Client bootstrap and starts its normal RemoteFast child instead of
91
+ testing RemoteFast in isolation. All state and network discovery remain
92
+ isolated. Cleanup joins those exact launcher roots after their Hub, RemoteFast,
93
+ and ScreenCaptureKit descendants drain. Ctrl+C and termination signals join the
94
+ same owned cleanup before exit. The default JSON report is written to
88
95
  one final path after cleanup, and run/cleanup errors always produce a failed
89
96
  result. It is written under `~/.livedesk/diagnostics`. To select a path relative
90
97
  to the directory where the command was invoked:
91
98
 
92
99
  ```bash
93
- npx -y --prefer-online livedesk@latest diagnose mac-physical --report ./mac-result.json
100
+ npx -y --prefer-online livedesk@latest diagnose mac-physical --confirm-active-motion --report ./mac-result.json
94
101
  ```
95
102
 
96
103
  Use `diagnose mac-physical --help` to inspect requirements without starting a
97
- runtime or changing cached role/account state.
104
+ runtime or changing cached role/account state. The confirmation flag is not
105
+ treated as proof by itself: each display must also show two different decoded
106
+ pixel hashes while native capture/compression/stdout counters advance at the
107
+ active cadence. Diagnostic ffmpeg observers run sequentially after product
108
+ CPU/RSS/process sampling, are labeled as diagnostic observers, and are excluded
109
+ from those product budgets. Product resource evidence covers both unified
110
+ launcher roots plus the Hub, RemoteFast, and ScreenCaptureKit descendants.
111
+ VideoToolbox ownership comes from native active and terminal telemetry. The
112
+ terminal v4 record must match the exact final restored-Wall helper observation,
113
+ PID, profile, start time, capture generation, purpose, and stream, and must be
114
+ newer than that stream's stop request. Its PID must equal the single OS helper
115
+ sampled at that exact restored-Wall ready point; an earlier aggregate PID sighting
116
+ is insufficient. A stale/ownerless/internal-only terminal record or a retired
117
+ helper process alone is not accepted as encoder-session cleanup proof.
98
118
 
99
119
  ## Physical transport diagnostic
100
120
 
package/bin/livedesk.js CHANGED
@@ -150,9 +150,33 @@ function isPidAlive(pid) {
150
150
 
151
151
  async function assertNoActiveMacPhysicalDiagnosticLease() {
152
152
  if (os.platform() !== 'darwin') return;
153
- const lease = await inspectMacDiagnosticLease();
153
+ const lease = await inspectMacDiagnosticLease({ includeOwnerToken: true });
154
154
  if (lease.status === 'missing' || lease.status === 'stale') return;
155
155
  if (lease.status === 'active') {
156
+ const diagnosticOwnerPid = Number(
157
+ process.env.LIVEDESK_MAC_PHYSICAL_DIAGNOSTIC_OWNER_PID || 0
158
+ );
159
+ const diagnosticOwnerToken = String(
160
+ process.env.LIVEDESK_MAC_PHYSICAL_DIAGNOSTIC_OWNER_TOKEN || ''
161
+ ).trim();
162
+ const isExactDiagnosticChild = process.env.LIVEDESK_MAC_PHYSICAL_DIAGNOSTIC_CHILD === '1'
163
+ && Number.isInteger(diagnosticOwnerPid)
164
+ && diagnosticOwnerPid > 1
165
+ && diagnosticOwnerPid === Number(lease.pid)
166
+ && Number(process.ppid) === diagnosticOwnerPid
167
+ && diagnosticOwnerToken.length >= 16
168
+ && diagnosticOwnerToken === String(lease.ownerToken || '');
169
+ if (isExactDiagnosticChild) {
170
+ // The public diagnostic must exercise this same production launcher.
171
+ // Only the coordinator that owns the active lease can authorize its
172
+ // isolated Hub/Client roots; no neighboring normal startup is admitted.
173
+ // Do not propagate the lease capability into Hub, Client, RemoteFast,
174
+ // capture-helper, or utility descendants after this exact admission.
175
+ delete process.env.LIVEDESK_MAC_PHYSICAL_DIAGNOSTIC_CHILD;
176
+ delete process.env.LIVEDESK_MAC_PHYSICAL_DIAGNOSTIC_OWNER_PID;
177
+ delete process.env.LIVEDESK_MAC_PHYSICAL_DIAGNOSTIC_OWNER_TOKEN;
178
+ return;
179
+ }
156
180
  throw new Error(
157
181
  `Mac physical diagnostic is running (pid ${lease.pid}); normal LiveDesk startup was not started. `
158
182
  + 'Wait for its owned cleanup to finish or stop the diagnostic with Ctrl+C.'
@@ -337,7 +361,7 @@ Usage:
337
361
  npx -y --prefer-online livedesk@latest
338
362
  npx -y --prefer-online livedesk@latest --force-role hub
339
363
  npx -y --prefer-online livedesk@latest --force-role client
340
- npx -y --prefer-online livedesk@latest diagnose mac-physical
364
+ npx -y --prefer-online livedesk@latest diagnose mac-physical --confirm-active-motion
341
365
  npx -y --prefer-online livedesk@latest diagnose transport-physical
342
366
 
343
367
  Commands:
@@ -377,26 +401,29 @@ function printMacPhysicalDiagnosticHelp() {
377
401
  LiveDesk macOS physical diagnostic
378
402
 
379
403
  Usage:
380
- npx -y --prefer-online livedesk@latest diagnose mac-physical
381
- npx -y --prefer-online livedesk@latest diagnose mac-physical --report ./mac-result.json
404
+ npx -y --prefer-online livedesk@latest diagnose mac-physical --confirm-active-motion
405
+ npx -y --prefer-online livedesk@latest diagnose mac-physical --confirm-active-motion --report ./mac-result.json
382
406
 
383
407
  Requirements:
384
- macOS with two connected displays showing visibly different content.
408
+ macOS with two connected displays showing visibly different, continuously moving content.
385
409
  Screen Recording permission for the terminal/LiveDesk capture helper.
386
410
  Accessibility permission for the terminal/LiveDesk input helper.
387
411
  Stop every existing LiveDesk Hub, Client, and desktop runtime first.
412
+ --confirm-active-motion attests that motion is already running on both displays;
413
+ measured decoded-pixel change and native cadence must still prove it.
388
414
 
389
415
  Behavior:
390
- Starts one isolated loopback Hub and one temporary RemoteFast Client.
416
+ Starts one production unified Hub root and one production unified Client root
417
+ with isolated loopback state; the Client starts its normal RemoteFast child.
391
418
  Refuses to overlap a running LiveDesk runtime or capture helper.
392
- Stops only the exact child processes created by this diagnostic.
419
+ Stops only those exact launcher roots after their descendants drain.
393
420
  Writes the default report under ~/.livedesk/diagnostics.
394
421
 
395
422
  Options:
396
423
  --report <path> Write the JSON report relative to the invocation directory.
397
424
  --monitor <n> Initial zero-based display index. Default: 0.
398
- --width <px> Requested capture width. Default: 1920.
399
- --height <px> Requested capture height. Default: 1080.
425
+ --width <px> Requested capture width. Release gate: exactly 960.
426
+ --height <px> Requested capture height. Release gate: exactly 540.
400
427
  --help Show this help without resolving a role or acquiring a runtime lock.
401
428
  `.trimStart());
402
429
  }