livedesk 0.1.461 → 0.1.463

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 +775 -127
  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-l4YzRK9d.js +0 -25
@@ -68,15 +68,56 @@ export function buildMacDiagnosticTeardownPlan({
68
68
  agentStopped = false,
69
69
  hubStopped = false,
70
70
  decodersStopped = false,
71
- helperFinalCount = -1
71
+ helperFinalCount = -1,
72
+ afterCleanupResources
72
73
  } = {}) {
73
74
  const reasons = [];
74
- if (agentStopped !== true) reasons.push('owned RemoteFast did not confirm exit');
75
- if (hubStopped !== true) reasons.push('owned Hub did not confirm exit');
75
+ if (agentStopped !== true) reasons.push('owned unified Client tree did not confirm exit');
76
+ if (hubStopped !== true) reasons.push('owned unified Hub tree did not confirm exit');
76
77
  if (decodersStopped !== true) reasons.push('owned decoder did not confirm exit');
77
78
  if (Number(helperFinalCount) !== 0) {
78
79
  reasons.push(`capture helper drain ended at ${Number(helperFinalCount)}`);
79
80
  }
81
+ const resourceEvidenceAvailable = afterCleanupResources
82
+ && typeof afterCleanupResources === 'object'
83
+ && afterCleanupResources.ownershipModel === 'unified-production-v1'
84
+ && Number(afterCleanupResources.sampleCount) >= 1;
85
+ if (!resourceEvidenceAvailable) {
86
+ reasons.push('post-cleanup process tree evidence is unavailable');
87
+ } else {
88
+ const remainingProcesses = Array.isArray(afterCleanupResources.processes)
89
+ ? afterCleanupResources.processes
90
+ : [];
91
+ const unownedPids = Array.isArray(afterCleanupResources.unownedLiveDeskPids)
92
+ ? afterCleanupResources.unownedLiveDeskPids
93
+ .map(Number)
94
+ .filter(pid => Number.isInteger(pid) && pid > 1)
95
+ : [];
96
+ const remainingPids = [...new Set([
97
+ ...remainingProcesses.map(record => Number(record?.pid)),
98
+ ...unownedPids
99
+ ].filter(pid => Number.isInteger(pid) && pid > 1))].sort((left, right) => left - right);
100
+ const processTreeTerminal =
101
+ Number(afterCleanupResources.totalLiveDeskProcessCount) === 0
102
+ && Number(afterCleanupResources.totalLiveDeskProcessCountPeak) === 0
103
+ && Number(afterCleanupResources.captureHelperCountPeak) === 0
104
+ && Number(afterCleanupResources.ownedProcessCountPeak) === 0
105
+ && Number(afterCleanupResources.ownedChildProcessCountPeak) === 0
106
+ && Number(afterCleanupResources.ownedRssBytesPeak) === 0
107
+ && remainingProcesses.length === 0
108
+ && unownedPids.length === 0;
109
+ if (!processTreeTerminal) {
110
+ reasons.push(
111
+ 'post-cleanup process tree did not reach terminal zero '
112
+ + `(live=${Number(afterCleanupResources.totalLiveDeskProcessCount)} `
113
+ + `owned=${Number(afterCleanupResources.ownedProcessCountPeak)} `
114
+ + `children=${Number(afterCleanupResources.ownedChildProcessCountPeak)} `
115
+ + `helpers=${Number(afterCleanupResources.captureHelperCountPeak)} `
116
+ + `rss=${Number(afterCleanupResources.ownedRssBytesPeak)} `
117
+ + `pids=${remainingPids.join(',') || '-'})`
118
+ );
119
+ }
120
+ }
80
121
  return Object.freeze({
81
122
  canRemoveState: reasons.length === 0,
82
123
  reasons: Object.freeze(reasons)
@@ -195,7 +236,8 @@ export function isProcessAlive(pid) {
195
236
 
196
237
  export async function inspectMacDiagnosticLease({
197
238
  directory = path.join(homedir(), '.livedesk', 'diagnostics'),
198
- pidAlive = isProcessAlive
239
+ pidAlive = isProcessAlive,
240
+ includeOwnerToken = false
199
241
  } = {}) {
200
242
  const lockPath = path.join(path.resolve(directory), 'mac-physical-gate.lock');
201
243
  let owner;
@@ -236,7 +278,8 @@ export async function inspectMacDiagnosticLease({
236
278
  return Object.freeze({
237
279
  status: active ? 'active' : 'stale',
238
280
  path: lockPath,
239
- pid: ownerPid
281
+ pid: ownerPid,
282
+ ...(includeOwnerToken ? { ownerToken } : {})
240
283
  });
241
284
  }
242
285