@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.
- package/dist/commands/upgrade-helper.d.ts +12 -0
- package/dist/index.js +43 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/commands/upgrade-helper.ts +52 -30
|
@@ -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 ? "
|
|
320
|
-
const commitShort = readInjected(true ? "
|
|
321
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
322
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
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
|
-
|
|
42172
|
-
|
|
42173
|
-
|
|
42174
|
-
|
|
42175
|
-
|
|
42176
|
-
|
|
42177
|
-
|
|
42178
|
-
|
|
42179
|
-
|
|
42180
|
-
|
|
42181
|
-
|
|
42182
|
-
|
|
42183
|
-
|
|
42184
|
-
|
|
42185
|
-
|
|
42186
|
-
|
|
42187
|
-
|
|
42188
|
-
|
|
42189
|
-
|
|
42190
|
-
|
|
42191
|
-
|
|
42192
|
-
|
|
42193
|
-
|
|
42194
|
-
|
|
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
|
-
|
|
42198
|
-
|
|
42199
|
-
|
|
42200
|
-
|
|
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) {
|