@adhdev/daemon-standalone 1.0.39-rc.7 → 1.0.39-rc.8

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/dist/index.js CHANGED
@@ -31423,9 +31423,9 @@ var require_streamx = __commonJS({
31423
31423
  }
31424
31424
  });
31425
31425
 
31426
- // ../daemon-core/node_modules/b4a/index.js
31426
+ // ../../node_modules/tar-stream/node_modules/b4a/index.js
31427
31427
  var require_b4a2 = __commonJS({
31428
- "../daemon-core/node_modules/b4a/index.js"(exports2, module2) {
31428
+ "../../node_modules/tar-stream/node_modules/b4a/index.js"(exports2, module2) {
31429
31429
  "use strict";
31430
31430
  function isBuffer(value) {
31431
31431
  return Buffer.isBuffer(value) || value instanceof Uint8Array;
@@ -31581,9 +31581,9 @@ var require_b4a2 = __commonJS({
31581
31581
  }
31582
31582
  });
31583
31583
 
31584
- // ../daemon-core/node_modules/tar-stream/headers.js
31584
+ // ../../node_modules/tar-stream/headers.js
31585
31585
  var require_headers = __commonJS({
31586
- "../daemon-core/node_modules/tar-stream/headers.js"(exports2) {
31586
+ "../../node_modules/tar-stream/headers.js"(exports2) {
31587
31587
  "use strict";
31588
31588
  var b4a = require_b4a2();
31589
31589
  var ZEROS = "0000000000000000000";
@@ -31844,9 +31844,9 @@ var require_headers = __commonJS({
31844
31844
  }
31845
31845
  });
31846
31846
 
31847
- // ../daemon-core/node_modules/tar-stream/extract.js
31847
+ // ../../node_modules/tar-stream/extract.js
31848
31848
  var require_extract = __commonJS({
31849
- "../daemon-core/node_modules/tar-stream/extract.js"(exports2, module2) {
31849
+ "../../node_modules/tar-stream/extract.js"(exports2, module2) {
31850
31850
  "use strict";
31851
31851
  var { Writable, Readable, getStreamError } = require_streamx();
31852
31852
  var FIFO = require_fast_fifo();
@@ -32189,9 +32189,9 @@ var require_extract = __commonJS({
32189
32189
  }
32190
32190
  });
32191
32191
 
32192
- // ../daemon-core/node_modules/tar-stream/constants.js
32192
+ // ../../node_modules/tar-stream/constants.js
32193
32193
  var require_constants = __commonJS({
32194
- "../daemon-core/node_modules/tar-stream/constants.js"(exports2, module2) {
32194
+ "../../node_modules/tar-stream/constants.js"(exports2, module2) {
32195
32195
  "use strict";
32196
32196
  var constants = {
32197
32197
  // just for envs without fs
@@ -32210,9 +32210,9 @@ var require_constants = __commonJS({
32210
32210
  }
32211
32211
  });
32212
32212
 
32213
- // ../daemon-core/node_modules/tar-stream/pack.js
32213
+ // ../../node_modules/tar-stream/pack.js
32214
32214
  var require_pack = __commonJS({
32215
- "../daemon-core/node_modules/tar-stream/pack.js"(exports2, module2) {
32215
+ "../../node_modules/tar-stream/pack.js"(exports2, module2) {
32216
32216
  "use strict";
32217
32217
  var { Readable, Writable, getStreamError } = require_streamx();
32218
32218
  var b4a = require_b4a2();
@@ -32445,9 +32445,9 @@ var require_pack = __commonJS({
32445
32445
  }
32446
32446
  });
32447
32447
 
32448
- // ../daemon-core/node_modules/tar-stream/index.js
32448
+ // ../../node_modules/tar-stream/index.js
32449
32449
  var require_tar_stream = __commonJS({
32450
- "../daemon-core/node_modules/tar-stream/index.js"(exports2) {
32450
+ "../../node_modules/tar-stream/index.js"(exports2) {
32451
32451
  "use strict";
32452
32452
  exports2.extract = require_extract();
32453
32453
  exports2.pack = require_pack();
@@ -32690,9 +32690,9 @@ var require_pump = __commonJS({
32690
32690
  }
32691
32691
  });
32692
32692
 
32693
- // ../daemon-core/node_modules/tar-fs/index.js
32693
+ // ../../node_modules/tar-fs/index.js
32694
32694
  var require_tar_fs = __commonJS({
32695
- "../daemon-core/node_modules/tar-fs/index.js"(exports2) {
32695
+ "../../node_modules/tar-fs/index.js"(exports2) {
32696
32696
  "use strict";
32697
32697
  var tar = require_tar_stream();
32698
32698
  var pump = require_pump();
@@ -36528,10 +36528,10 @@ var require_dist3 = __commonJS({
36528
36528
  }
36529
36529
  function getDaemonBuildInfo() {
36530
36530
  if (cached2) return cached2;
36531
- const commit = readInjected(true ? "2e7dae960e88d61879ec103eaa86df36e1671d8e" : void 0) ?? "unknown";
36532
- const commitShort = readInjected(true ? "2e7dae96" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36533
- const version2 = readInjected(true ? "1.0.39-rc.7" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36534
- const builtAt = readInjected(true ? "2026-08-08T01:41:54.555Z" : void 0);
36531
+ const commit = readInjected(true ? "37babf91fc649f590da3e4993d4aef18060c88d8" : void 0) ?? "unknown";
36532
+ const commitShort = readInjected(true ? "37babf91" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36533
+ const version2 = readInjected(true ? "1.0.39-rc.8" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36534
+ const builtAt = readInjected(true ? "2026-08-08T02:45:35.197Z" : void 0);
36535
36535
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36536
36536
  return cached2;
36537
36537
  }
@@ -38643,6 +38643,7 @@ child.on('exit', () => process.exit(0));
38643
38643
  });
38644
38644
  var config_exports = {};
38645
38645
  __export2(config_exports, {
38646
+ clearAuthCredentials: () => clearAuthCredentials,
38646
38647
  generateMachineId: () => generateMachineId,
38647
38648
  getConfigDir: () => getConfigDir2,
38648
38649
  getDaemonDataDir: () => getDaemonDataDir,
@@ -38879,6 +38880,13 @@ child.on('exit', () => process.exit(0));
38879
38880
  function resetConfig() {
38880
38881
  saveConfig({ ...DEFAULT_CONFIG });
38881
38882
  }
38883
+ function clearAuthCredentials() {
38884
+ const config2 = loadConfig2();
38885
+ config2.machineSecret = void 0;
38886
+ config2.userEmail = null;
38887
+ config2.userName = null;
38888
+ saveConfig(config2);
38889
+ }
38882
38890
  var import_path4;
38883
38891
  var import_fs3;
38884
38892
  var import_crypto2;
@@ -77321,6 +77329,7 @@ ${lastSnapshot}`;
77321
77329
  classifyShadowDivergence: () => classifyShadowDivergence,
77322
77330
  classifyStaleDirectForPrune: () => classifyStaleDirectForPrune,
77323
77331
  cleanupTerminalDirectDispatches: () => cleanupTerminalDirectDispatches,
77332
+ clearAuthCredentials: () => clearAuthCredentials,
77324
77333
  clearDebugTrace: () => clearDebugTrace,
77325
77334
  clearPendingMeshCoordinatorEvents: () => clearPendingMeshCoordinatorEvents,
77326
77335
  collectPendingApprovals: () => collectPendingApprovals,
@@ -90449,6 +90458,11 @@ exec "${portableNode}" "${cliEntry}" "$@"
90449
90458
  publishStableShimsAndPointer(layout, versionName);
90450
90459
  hooks.log(`Atomically activated ${versionName}`);
90451
90460
  restarted = hooks.restart(portableNode, stagedCliEntry);
90461
+ if (restarted === null) {
90462
+ hooks.log(`Activated ${targetVersion} without restarting a daemon (none was running)`);
90463
+ await hooks.cleanup(layout, stagedPrefix);
90464
+ return { stagedPrefix, stagedCliEntry, daemonPid: null };
90465
+ }
90452
90466
  const daemonPid = restarted.pid;
90453
90467
  if (!daemonPid || !await hooks.waitForHealth(daemonPid, targetVersion)) {
90454
90468
  throw new Error("replacement daemon did not pass the health/version gate");
@@ -90512,7 +90526,10 @@ exec "${portableNode}" "${cliEntry}" "$@"
90512
90526
  },
90513
90527
  restart: (portableNode, stagedCliEntry) => {
90514
90528
  const restartArgv = options.restartArgv.map((arg, index) => index === 0 ? stagedCliEntry : arg);
90515
- if (restartArgv.length === 0) throw new Error("replacement daemon restart arguments are missing");
90529
+ if (restartArgv.length === 0) {
90530
+ options.log("No restart arguments provided (daemon was not running); leaving the activated version in place without starting a daemon");
90531
+ return null;
90532
+ }
90516
90533
  const child = (0, import_child_process7.spawn)(portableNode, restartArgv, {
90517
90534
  detached: true,
90518
90535
  stdio: "ignore",
@@ -90613,6 +90630,7 @@ exec "${portableNode}" "${cliEntry}" "$@"
90613
90630
  }
90614
90631
  var import_session_host_core6 = require_dist();
90615
90632
  init_config();
90633
+ init_track_identity();
90616
90634
  var UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
90617
90635
  function resolveInstanceDir(configDir = getConfigDir2()) {
90618
90636
  const base = path26.basename(configDir).trim();
@@ -91104,8 +91122,9 @@ ${marker}`,
91104
91122
  `Cannot upgrade: owned processes still running under current prefix: ${preStop.survivors.map((s2) => s2.pid).join(", ")}`
91105
91123
  );
91106
91124
  }
91125
+ let atomicResult;
91107
91126
  try {
91108
- await performWindowsAtomicUpgrade({
91127
+ atomicResult = await performWindowsAtomicUpgrade({
91109
91128
  layout: windowsInstallerLayout,
91110
91129
  packageName: payload.packageName,
91111
91130
  targetVersion: payload.targetVersion,
@@ -91130,7 +91149,13 @@ ${marker}`,
91130
91149
  throw error48;
91131
91150
  }
91132
91151
  clearUpgradeFailureNotice();
91133
- appendUpgradeLog("Installer-managed Windows atomic upgrade completed");
91152
+ if (atomicResult.daemonPid === null) {
91153
+ appendUpgradeLog(
91154
+ `Installer-managed Windows atomic upgrade completed (no daemon was running, so none was started \u2014 run \`${IDENTITY.binaryName} daemon\` to start it)`
91155
+ );
91156
+ } else {
91157
+ appendUpgradeLog("Installer-managed Windows atomic upgrade completed");
91158
+ }
91134
91159
  return;
91135
91160
  }
91136
91161
  await stopForeignNativeAddonHolders(installCommand.surface.packageRoot, { parentPid: payload.parentPid });
@@ -115152,6 +115177,7 @@ ${e?.stderr || ""}`;
115152
115177
  return handle;
115153
115178
  }
115154
115179
  var fs44 = __toESM2(require("fs"));
115180
+ var import_node_os2 = require("os");
115155
115181
  var import_path19 = require("path");
115156
115182
  init_logger();
115157
115183
  init_dist();
@@ -115182,6 +115208,19 @@ ${e?.stderr || ""}`;
115182
115208
  const v = mesh?.policy?.worktreeBaseDir;
115183
115209
  return typeof v === "string" && v.trim() ? v.trim() : void 0;
115184
115210
  }
115211
+ var TRACK_CONFIG_DIR_NAMES = [".adhdev", ".adhdev-preview"];
115212
+ function looksLikeCrossTrackWorktreePath(actualPath, normalizePath2) {
115213
+ const home = normalizePath2((0, import_node_os2.homedir)());
115214
+ return TRACK_CONFIG_DIR_NAMES.some((trackDirName) => {
115215
+ const trackWorktreesDir = (0, import_path19.join)(home, trackDirName, "worktrees");
115216
+ return actualPath === normalizePath2(trackWorktreesDir) || actualPath.startsWith(normalizePath2(trackWorktreesDir) + import_path19.sep);
115217
+ });
115218
+ }
115219
+ function unexpectedPathRecoveryHint(actualPath, normalizePath2, suffix) {
115220
+ const base = "Use git worktree list/status to inspect the path. Retry only after confirming the mesh node metadata points to an ADHDev-managed worktree.";
115221
+ const legacyHint = looksLikeCrossTrackWorktreePath(actualPath, normalizePath2) ? " This path matches the layout used before worktree paths became build-track-aware (oss c24ae254) and is likely a legacy worktree from an older daemon version \u2014 mesh_remove_node will not remove it automatically. To clean it up: run `git worktree remove --force '" + actualPath + "'` directly, then retry mesh_remove_node so it can drop the now-missing-path node from the mesh registry." : "";
115222
+ return base + legacyHint + suffix;
115223
+ }
115185
115224
  function sessionMatchesMeshNode(self, record2, node, nodeId, sessionIds) {
115186
115225
  const sessionId = typeof record2?.sessionId === "string" ? record2.sessionId : "";
115187
115226
  if (!sessionId) return false;
@@ -115266,7 +115305,7 @@ ${e?.stderr || ""}`;
115266
115305
  ok: false,
115267
115306
  code: "mesh_worktree_cleanup_unexpected_path",
115268
115307
  error: `Refusing to remove worktree '${workspace}' because it is not at the expected managed path '${expectedPaths[0]}'`,
115269
- recoveryHint: "Use git worktree list/status to inspect the path. Retry only after confirming the mesh node metadata points to an ADHDev-managed worktree." + sessionPreservedNote
115308
+ recoveryHint: unexpectedPathRecoveryHint(actualPath, normalizePath2, sessionPreservedNote)
115270
115309
  };
115271
115310
  }
115272
115311
  const entries = await listWorktrees2(repoRoot);
@@ -115362,7 +115401,7 @@ ${e?.stderr || ""}`;
115362
115401
  success: false,
115363
115402
  code: "mesh_worktree_cleanup_unexpected_path",
115364
115403
  error: `Refusing to remove worktree '${workspace}' because it is not at the expected managed path '${expectedPaths[0]}'`,
115365
- recoveryHint: "Use git worktree list/status to inspect the path. Retry only after confirming the mesh node metadata points to an ADHDev-managed worktree."
115404
+ recoveryHint: unexpectedPathRecoveryHint(actualPath, normalizePath2, "")
115366
115405
  };
115367
115406
  }
115368
115407
  const entries = await listWorktrees2(repoRoot);