@parall/daemon 1.62.0 → 1.64.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.
@@ -7,22 +7,26 @@ const realTimers = {
7
7
  * version healthy enough to confirm?" policy in ONE place so it isn't smeared
8
8
  * across the supervisor's WS handlers.
9
9
  *
10
- * A pending update is confirmed only when BOTH hold:
11
- * - the control-plane handshake (machine.hello) is seen at least once, AND
12
- * - the process + supervisor then stay up for `stabilityWindowMs` without the
13
- * supervisor soft-crashing or the process exiting.
10
+ * A pending update is confirmed by process stability alone: the process +
11
+ * supervisor stay up for `stabilityWindowMs` after the supervisor instance
12
+ * starts, without the supervisor soft-crashing or the process exiting. Nothing
13
+ * about the control plane participates — not the bootstrap, not the WebSocket
14
+ * handshake. A daemon that cannot reach the server (offline, or its machine key
15
+ * rejected) is still a healthy *process*, and rollback exists to catch bundles
16
+ * that crash, not bundles that cannot authenticate; tying confirmation to the
17
+ * server froze such machines on their pending version forever.
14
18
  *
15
19
  * Lifecycle:
16
- * - `onMachineHello()` — the first hello with a pending update arms the
17
- * stability timer. The timer is process-level (lives in this gate, which the
18
- * process owns), so it survives WS reconnects; a disconnect does NOT cancel
19
- * it.
20
+ * - `onSupervisorStarted()` — a supervisor instance starting with a pending
21
+ * update arms the stability timer. The timer is process-level (lives in this
22
+ * gate, which the process owns), so it survives WS reconnects; a disconnect
23
+ * does NOT cancel it.
20
24
  * - timer elapses with the process still alive → `confirmVersion()`. (A
21
25
  * process exit/crash before the timer means it simply never fires.)
22
26
  * - `onSupervisorEnded()` — the supervisor instance stopped (clean shutdown OR
23
27
  * a runForever-caught soft crash). Cancel the timer so a stale timer can't
24
- * confirm across supervisor instances; the next supervisor's machine.hello
25
- * re-arms it. This RESETS the health window but NEVER records a rollback
28
+ * confirm across supervisor instances; the next supervisor instance re-arms
29
+ * it. This RESETS the health window but NEVER records a rollback
26
30
  * failure — soft crashes are not rollback signals. Rollback `boot_count` is
27
31
  * incremented only by process-level unclean exits (crash / kill / power loss
28
32
  * / uncaught fatal exit), tracked via the `daemon-running` marker in
@@ -48,11 +52,11 @@ export class PendingUpdateHealthGate {
48
52
  this.timers = timers;
49
53
  }
50
54
  /**
51
- * Control-plane handshake. Arms the stability timer on the first hello that
52
- * sees a pending (unconfirmed) update. No-op once confirmed, while a timer is
55
+ * A supervisor instance started. Arms the stability timer when there is a
56
+ * pending (unconfirmed) update. No-op once confirmed, while a timer is
53
57
  * already running, or when there is nothing pending to confirm.
54
58
  */
55
- onMachineHello() {
59
+ onSupervisorStarted() {
56
60
  if (this.confirmed || this.timer)
57
61
  return;
58
62
  if (!this.updater.hasPendingActivation())
@@ -71,7 +75,7 @@ export class PendingUpdateHealthGate {
71
75
  * The current supervisor instance ended — a clean shutdown or a
72
76
  * runForever-caught soft crash. Reset the health window (cancel the pending
73
77
  * confirm timer) without recording any rollback failure; the next supervisor
74
- * re-arms via `onMachineHello`.
78
+ * re-arms via `onSupervisorStarted`.
75
79
  */
76
80
  onSupervisorEnded() {
77
81
  if (this.timer) {
package/dist/updater.d.ts CHANGED
@@ -1,6 +1,16 @@
1
1
  import type { GatewayLogger } from '@parall/agent-core';
2
2
  import type { UpdateOutcome, UpdateReason } from './daemon-telemetry.js';
3
3
  import { type LocalManifest } from './updater-manifest.js';
4
+ export interface UpdateState {
5
+ confirmed_version?: string;
6
+ confirmed_at?: string;
7
+ previous_version?: string;
8
+ pending_version?: string;
9
+ pending_at?: string;
10
+ boot_count?: number;
11
+ rollback_from?: string;
12
+ rollback_at?: string;
13
+ }
4
14
  export declare class DaemonUpdater {
5
15
  private readonly bundleDir;
6
16
  private readonly cdnBaseUrl;
@@ -73,4 +83,8 @@ export declare class DaemonUpdater {
73
83
  private downloadFile;
74
84
  private cleanDir;
75
85
  }
86
+ /** `<bundleDir>/current/manifest.json`, or null when absent or unreadable. */
87
+ export declare function loadLocalManifest(bundleDir: string): LocalManifest | null;
88
+ /** `<bundleDir>/update-state.json`, or null when absent or unreadable. */
89
+ export declare function loadUpdateState(bundleDir: string): UpdateState | null;
76
90
  //# sourceMappingURL=updater.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../src/updater.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,uBAAuB,CAAC;AA2B/B,qBAAa,aAAa;IAMtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,cAAc;IARjC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,aAAa,CAA0E;gBAG5E,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,aAAa,EAClB,cAAc,EAAE,OAAO;IAK1C,yGAAyG;IACzG,kBAAkB,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAIrF,OAAO,CAAC,MAAM;IAId;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAU5C,iBAAiB,IAAI,IAAI;IAOzB;;;OAGG;IACG,aAAa,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAc7D;;OAEG;IACG,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAQhF;;;;;;OAMG;IACH,aAAa,CAAC,eAAe,EAAE,OAAO,GAAG,OAAO;IAuDhD;;;OAGG;IACH,cAAc,IAA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GAAG,IAAI;IAIzC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,eAAe;IA+BvB,OAAO,CAAC,QAAQ;IAYhB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,OAAO;IAuCf,OAAO,CAAC,YAAY;IA6CpB,OAAO,CAAC,QAAQ;CAKjB;AAID,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAEzE;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAErE"}
package/dist/updater.js CHANGED
@@ -206,15 +206,11 @@ export class DaemonUpdater {
206
206
  async doUpdate(targetVersion) {
207
207
  const local = this.loadLocalManifest();
208
208
  const state = this.loadUpdateState();
209
- // Keep the canary state machine single-flight: while the currently running
210
- // bundle is still pending health confirmation, do not stack another update
211
- // on top of it. Rollback must always target the last confirmed version, not
212
- // an unconfirmed intermediate bundle.
213
- if (state?.pending_version && local?.version === state.pending_version) {
214
- this.log.info(`update: ${local.version} is still pending activation — skipping new update until confirmed`);
215
- this.report('skipped', 'pending_activation');
216
- return false;
217
- }
209
+ // A newer bundle may land on top of a still-pending one. Rollback safety
210
+ // does not depend on single-flight: `previous_version` below is always the
211
+ // last CONFIRMED version, never the pending intermediate, so a machine that
212
+ // cannot confirm (offline, machine key rejected) keeps receiving updates
213
+ // instead of freezing on the version it could not prove.
218
214
  const manifestUrl = targetVersion
219
215
  ? `${this.cdnBaseUrl}/${targetVersion}/manifest.json`
220
216
  : `${this.cdnBaseUrl}/latest/manifest.json`;
@@ -398,23 +394,10 @@ export class DaemonUpdater {
398
394
  }
399
395
  // --- Manifest & State I/O ---
400
396
  loadLocalManifest() {
401
- const currentDir = path.join(this.bundleDir, 'current');
402
- const manifestPath = path.join(currentDir, 'manifest.json');
403
- try {
404
- return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
405
- }
406
- catch {
407
- return null;
408
- }
397
+ return loadLocalManifest(this.bundleDir);
409
398
  }
410
399
  loadUpdateState() {
411
- const statePath = path.join(this.bundleDir, 'update-state.json');
412
- try {
413
- return JSON.parse(fs.readFileSync(statePath, 'utf-8'));
414
- }
415
- catch {
416
- return null;
417
- }
400
+ return loadUpdateState(this.bundleDir);
418
401
  }
419
402
  saveUpdateState(state) {
420
403
  const statePath = path.join(this.bundleDir, 'update-state.json');
@@ -558,3 +541,20 @@ export class DaemonUpdater {
558
541
  catch { }
559
542
  }
560
543
  }
544
+ // --- Bundle-dir layout readers (shared with the diagnostics collector) ---
545
+ /** `<bundleDir>/current/manifest.json`, or null when absent or unreadable. */
546
+ export function loadLocalManifest(bundleDir) {
547
+ return readJsonFile(path.join(bundleDir, 'current', 'manifest.json'));
548
+ }
549
+ /** `<bundleDir>/update-state.json`, or null when absent or unreadable. */
550
+ export function loadUpdateState(bundleDir) {
551
+ return readJsonFile(path.join(bundleDir, 'update-state.json'));
552
+ }
553
+ function readJsonFile(file) {
554
+ try {
555
+ return JSON.parse(fs.readFileSync(file, 'utf-8'));
556
+ }
557
+ catch {
558
+ return null;
559
+ }
560
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/daemon",
3
- "version": "1.62.0",
3
+ "version": "1.64.0",
4
4
  "description": "Parall local agent runtime — daemon supervisor + bridge runtimes, bundled as standalone JS files",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,11 +34,11 @@
34
34
  "@opentelemetry/api": "^1.9.0",
35
35
  "@pinixai/bb-browser-pro": "0.15.0",
36
36
  "ws": "^8.18.0",
37
- "@parall/agent-core": "1.62.0",
38
- "@parall/sdk": "1.62.0",
39
- "@parall/claude-agent": "1.62.0",
40
- "@parall/codex-agent": "1.62.0",
41
- "@parall/openclaw-agent": "1.62.0"
37
+ "@parall/sdk": "1.64.0",
38
+ "@parall/claude-agent": "1.64.0",
39
+ "@parall/codex-agent": "1.64.0",
40
+ "@parall/openclaw-agent": "1.64.0",
41
+ "@parall/agent-core": "1.64.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^22.0.0",