@adhdev/daemon-core 0.9.82-rc.312 → 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 +84 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/commands/upgrade-helper.ts +52 -30
- package/src/providers/provider-loader.ts +78 -0
- package/src/providers/spec/cli-adapter.ts +6 -0
|
@@ -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
|
}
|
|
@@ -32409,7 +32409,7 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
32409
32409
|
}
|
|
32410
32410
|
if (action.type === "open_picker") {
|
|
32411
32411
|
const choiceIndex = typeof flat.choiceIndex === "number" ? flat.choiceIndex : typeof flat.choiceIndex === "string" && flat.choiceIndex.trim() ? Number(flat.choiceIndex) : void 0;
|
|
32412
|
-
const choiceLabel = typeof flat.choiceLabel === "string" ? flat.choiceLabel : typeof flat.choice === "string" ? flat.choice : void 0;
|
|
32412
|
+
const choiceLabel = typeof flat.choiceLabel === "string" ? flat.choiceLabel : typeof flat.choice === "string" ? flat.choice : typeof flat.value === "string" ? flat.value : void 0;
|
|
32413
32413
|
if (typeof choiceIndex === "number" && Number.isFinite(choiceIndex) || choiceLabel && choiceLabel.trim()) {
|
|
32414
32414
|
return this.selectPickerChoice(ctl, action, choiceIndex, choiceLabel);
|
|
32415
32415
|
}
|
|
@@ -38575,6 +38575,39 @@ function registerProviderScriptRootSafely(root) {
|
|
|
38575
38575
|
} catch {
|
|
38576
38576
|
}
|
|
38577
38577
|
}
|
|
38578
|
+
function synthesizeControlsFromControlBar(specControls) {
|
|
38579
|
+
const out = [];
|
|
38580
|
+
specControls.forEach((ctl, index) => {
|
|
38581
|
+
const id = typeof ctl?.id === "string" ? ctl.id.trim() : "";
|
|
38582
|
+
const actionType = ctl?.action?.type;
|
|
38583
|
+
if (!id || !actionType) return;
|
|
38584
|
+
const label = typeof ctl?.label === "string" && ctl.label.trim() ? ctl.label : id;
|
|
38585
|
+
if (actionType === "open_picker") {
|
|
38586
|
+
out.push({
|
|
38587
|
+
id,
|
|
38588
|
+
type: "select",
|
|
38589
|
+
label,
|
|
38590
|
+
placement: "bar",
|
|
38591
|
+
dynamic: true,
|
|
38592
|
+
listScript: id,
|
|
38593
|
+
setScript: id,
|
|
38594
|
+
readFrom: id,
|
|
38595
|
+
order: index
|
|
38596
|
+
});
|
|
38597
|
+
} else if (actionType === "send_keys") {
|
|
38598
|
+
out.push({
|
|
38599
|
+
id,
|
|
38600
|
+
type: "action",
|
|
38601
|
+
label,
|
|
38602
|
+
placement: "bar",
|
|
38603
|
+
invokeScript: id,
|
|
38604
|
+
resultDisplay: "none",
|
|
38605
|
+
order: index
|
|
38606
|
+
});
|
|
38607
|
+
}
|
|
38608
|
+
});
|
|
38609
|
+
return out;
|
|
38610
|
+
}
|
|
38578
38611
|
var ProviderLoader = class _ProviderLoader {
|
|
38579
38612
|
providers = /* @__PURE__ */ new Map();
|
|
38580
38613
|
providerAvailability = /* @__PURE__ */ new Map();
|
|
@@ -39513,6 +39546,13 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
39513
39546
|
});
|
|
39514
39547
|
}
|
|
39515
39548
|
}
|
|
39549
|
+
const hasDeclaredControls = Array.isArray(resolved.controls) && resolved.controls.length > 0;
|
|
39550
|
+
if (!hasDeclaredControls) {
|
|
39551
|
+
const synthesized = synthesizeControlsFromControlBar(specControls);
|
|
39552
|
+
if (synthesized.length > 0) {
|
|
39553
|
+
resolved.controls = synthesized;
|
|
39554
|
+
}
|
|
39555
|
+
}
|
|
39516
39556
|
}
|
|
39517
39557
|
if (nh) {
|
|
39518
39558
|
let reader = null;
|
|
@@ -42127,39 +42167,48 @@ function removeDaemonPidFile() {
|
|
|
42127
42167
|
} catch {
|
|
42128
42168
|
}
|
|
42129
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
|
+
}
|
|
42130
42178
|
function cleanupStaleGlobalInstallDirs(pkgName, surface) {
|
|
42131
|
-
|
|
42132
|
-
|
|
42133
|
-
|
|
42134
|
-
|
|
42135
|
-
|
|
42136
|
-
|
|
42137
|
-
|
|
42138
|
-
|
|
42139
|
-
|
|
42140
|
-
|
|
42141
|
-
|
|
42142
|
-
|
|
42143
|
-
|
|
42144
|
-
|
|
42145
|
-
|
|
42146
|
-
|
|
42147
|
-
|
|
42148
|
-
|
|
42149
|
-
|
|
42150
|
-
|
|
42151
|
-
|
|
42152
|
-
|
|
42153
|
-
|
|
42154
|
-
|
|
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
|
+
}
|
|
42155
42203
|
}
|
|
42156
|
-
|
|
42157
|
-
|
|
42158
|
-
|
|
42159
|
-
|
|
42160
|
-
|
|
42161
|
-
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
|
+
}
|
|
42162
42209
|
}
|
|
42210
|
+
} catch (error) {
|
|
42211
|
+
appendUpgradeLog(`Stale staging cleanup skipped (${error?.code || "error"}): ${error?.message || String(error)}`);
|
|
42163
42212
|
}
|
|
42164
42213
|
}
|
|
42165
42214
|
function spawnDetachedDaemonUpgradeHelper(payload) {
|