@adhdev/daemon-core 0.9.82-rc.313 → 0.9.82-rc.314

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.
@@ -40,5 +40,17 @@ export declare function buildPinnedGlobalInstallCommand(options: {
40
40
  export declare function getNpmExecOptions(platform?: NodeJS.Platform): NpmExecOptions;
41
41
  export declare function execNpmCommandSync(args: string[], options?: ExecFileSyncOptions, surface?: Pick<CurrentGlobalInstallSurface, 'npmExecutable' | 'npmArgsPrefix' | 'execOptions'>): Buffer | string;
42
42
  export declare function stopSessionHostProcesses(appName: string): void;
43
+ /**
44
+ * Best-effort removal of a leftover npm staging entry.
45
+ *
46
+ * A stale staging dir can hold a locked native binary — e.g. `ghostty-vt.dll`
47
+ * from `@adhdev/ghostty-vt-node` still mapped by a lingering session-host
48
+ * process — which makes `rmSync` throw `EPERM` on Windows. Staging cleanup is
49
+ * only housekeeping: the leftover is inert and npm creates its own fresh
50
+ * staging dir for the real install, so a lock on an old leftover must NOT abort
51
+ * the upgrade. Log and continue instead of letting the error propagate.
52
+ */
53
+ export declare function safeRemoveStaleEntry(target: string, label: string): void;
54
+ export declare function cleanupStaleGlobalInstallDirs(pkgName: string, surface: CurrentGlobalInstallSurface): void;
43
55
  export declare function spawnDetachedDaemonUpgradeHelper(payload: DaemonUpgradeHelperPayload): void;
44
56
  export declare function maybeRunDaemonUpgradeHelperFromEnv(): Promise<boolean>;
package/dist/index.js CHANGED
@@ -316,10 +316,10 @@ function readInjected(value) {
316
316
  }
317
317
  function getDaemonBuildInfo() {
318
318
  if (cached) return cached;
319
- const commit = readInjected(true ? "ed3b7279be8ea9fa191f854f7e9b6ce969159e67" : void 0) ?? "unknown";
320
- const commitShort = readInjected(true ? "ed3b7279" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
- const version = readInjected(true ? "0.9.82-rc.313" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
- const builtAt = readInjected(true ? "2026-06-18T00:14:56.582Z" : void 0);
319
+ const commit = readInjected(true ? "f236ed7432cf04dbcfd2e530fa6c69e77e809c80" : void 0) ?? "unknown";
320
+ const commitShort = readInjected(true ? "f236ed74" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
+ const version = readInjected(true ? "0.9.82-rc.314" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
+ const builtAt = readInjected(true ? "2026-06-18T04:15:40.033Z" : void 0);
323
323
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
324
324
  return cached;
325
325
  }
@@ -42167,39 +42167,48 @@ function removeDaemonPidFile() {
42167
42167
  } catch {
42168
42168
  }
42169
42169
  }
42170
+ function safeRemoveStaleEntry(target, label) {
42171
+ try {
42172
+ fs24.rmSync(target, { recursive: true, force: true });
42173
+ appendUpgradeLog(`${label}: ${target}`);
42174
+ } catch (error) {
42175
+ appendUpgradeLog(`Skipped locked stale entry (${error?.code || "error"}): ${target} \u2014 ${error?.message || String(error)}`);
42176
+ }
42177
+ }
42170
42178
  function cleanupStaleGlobalInstallDirs(pkgName, surface) {
42171
- const prefixArgs = surface.installPrefix ? ["--prefix", surface.installPrefix] : [];
42172
- const npmRoot = String(execNpmCommandSync(["root", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
42173
- if (!npmRoot) return;
42174
- const npmPrefix = surface.installPrefix || String(execNpmCommandSync(["prefix", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
42175
- const binDir = process.platform === "win32" ? npmPrefix : path35.join(npmPrefix, "bin");
42176
- const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
42177
- const binNames = /* @__PURE__ */ new Set([packageBaseName]);
42178
- if (pkgName === "@adhdev/daemon-standalone") {
42179
- binNames.add("adhdev-standalone");
42180
- }
42181
- if (pkgName.startsWith("@")) {
42182
- const [scope, name] = pkgName.split("/");
42183
- const scopeDir = path35.join(npmRoot, scope);
42184
- if (!fs24.existsSync(scopeDir)) return;
42185
- for (const entry of fs24.readdirSync(scopeDir)) {
42186
- if (!entry.startsWith(`.${name}-`)) continue;
42187
- fs24.rmSync(path35.join(scopeDir, entry), { recursive: true, force: true });
42188
- appendUpgradeLog(`Removed stale scoped staging dir: ${path35.join(scopeDir, entry)}`);
42189
- }
42190
- } else {
42191
- for (const entry of fs24.readdirSync(npmRoot)) {
42192
- if (!entry.startsWith(`.${pkgName}-`)) continue;
42193
- fs24.rmSync(path35.join(npmRoot, entry), { recursive: true, force: true });
42194
- appendUpgradeLog(`Removed stale staging dir: ${path35.join(npmRoot, entry)}`);
42179
+ try {
42180
+ const prefixArgs = surface.installPrefix ? ["--prefix", surface.installPrefix] : [];
42181
+ const npmRoot = String(execNpmCommandSync(["root", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
42182
+ if (!npmRoot) return;
42183
+ const npmPrefix = surface.installPrefix || String(execNpmCommandSync(["prefix", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
42184
+ const binDir = process.platform === "win32" ? npmPrefix : path35.join(npmPrefix, "bin");
42185
+ const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
42186
+ const binNames = /* @__PURE__ */ new Set([packageBaseName]);
42187
+ if (pkgName === "@adhdev/daemon-standalone") {
42188
+ binNames.add("adhdev-standalone");
42189
+ }
42190
+ if (pkgName.startsWith("@")) {
42191
+ const [scope, name] = pkgName.split("/");
42192
+ const scopeDir = path35.join(npmRoot, scope);
42193
+ if (!fs24.existsSync(scopeDir)) return;
42194
+ for (const entry of fs24.readdirSync(scopeDir)) {
42195
+ if (!entry.startsWith(`.${name}-`)) continue;
42196
+ safeRemoveStaleEntry(path35.join(scopeDir, entry), "Removed stale scoped staging dir");
42197
+ }
42198
+ } else {
42199
+ for (const entry of fs24.readdirSync(npmRoot)) {
42200
+ if (!entry.startsWith(`.${pkgName}-`)) continue;
42201
+ safeRemoveStaleEntry(path35.join(npmRoot, entry), "Removed stale staging dir");
42202
+ }
42195
42203
  }
42196
- }
42197
- if (fs24.existsSync(binDir)) {
42198
- for (const entry of fs24.readdirSync(binDir)) {
42199
- if (!Array.from(binNames).some((name) => entry.startsWith(`.${name}-`))) continue;
42200
- fs24.rmSync(path35.join(binDir, entry), { recursive: true, force: true });
42201
- appendUpgradeLog(`Removed stale bin staging entry: ${path35.join(binDir, entry)}`);
42204
+ if (fs24.existsSync(binDir)) {
42205
+ for (const entry of fs24.readdirSync(binDir)) {
42206
+ if (!Array.from(binNames).some((name) => entry.startsWith(`.${name}-`))) continue;
42207
+ safeRemoveStaleEntry(path35.join(binDir, entry), "Removed stale bin staging entry");
42208
+ }
42202
42209
  }
42210
+ } catch (error) {
42211
+ appendUpgradeLog(`Stale staging cleanup skipped (${error?.code || "error"}): ${error?.message || String(error)}`);
42203
42212
  }
42204
42213
  }
42205
42214
  function spawnDetachedDaemonUpgradeHelper(payload) {