@adhdev/daemon-core 1.0.23-rc.1 → 1.0.24-rc.1
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/cli-adapters/provider-cli-shared.d.ts +2 -0
- package/dist/commands/upgrade-helper.d.ts +8 -0
- package/dist/commands/windows-atomic-upgrade.d.ts +8 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +229 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -37
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +24 -0
- package/package.json +3 -3
- package/src/cli-adapters/provider-cli-shared.ts +109 -6
- package/src/commands/upgrade-helper.d.ts +3 -0
- package/src/commands/upgrade-helper.ts +35 -8
- package/src/commands/windows-atomic-upgrade.ts +26 -4
- package/src/index.ts +2 -1
- package/src/providers/cli-provider-instance.ts +86 -14
- package/src/session-host/managed-host.ts +47 -1
package/dist/index.js
CHANGED
|
@@ -791,10 +791,10 @@ function readInjected(value) {
|
|
|
791
791
|
}
|
|
792
792
|
function getDaemonBuildInfo() {
|
|
793
793
|
if (cached) return cached;
|
|
794
|
-
const commit = readInjected(true ? "
|
|
795
|
-
const commitShort = readInjected(true ? "
|
|
796
|
-
const version = readInjected(true ? "1.0.
|
|
797
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
794
|
+
const commit = readInjected(true ? "159c481abed0a48a043711e3c9c8a3a12b900336" : void 0) ?? "unknown";
|
|
795
|
+
const commitShort = readInjected(true ? "159c481a" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
796
|
+
const version = readInjected(true ? "1.0.24-rc.1" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
797
|
+
const builtAt = readInjected(true ? "2026-07-24T11:39:26.052Z" : void 0);
|
|
798
798
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
799
799
|
return cached;
|
|
800
800
|
}
|
|
@@ -13227,6 +13227,73 @@ function buildCliScreenSnapshot(text) {
|
|
|
13227
13227
|
linesBelowPrompt: promptLineIndex >= 0 ? lines.slice(promptLineIndex + 1) : []
|
|
13228
13228
|
};
|
|
13229
13229
|
}
|
|
13230
|
+
function windowsExecutableExtensions() {
|
|
13231
|
+
const raw = process.env.PATHEXT;
|
|
13232
|
+
const fromEnv = raw ? raw.split(";").map((e) => e.trim().toLowerCase()).filter(Boolean) : [".exe", ".cmd", ".bat"];
|
|
13233
|
+
const merged = [...fromEnv];
|
|
13234
|
+
if (!merged.includes(".ps1")) merged.push(".ps1");
|
|
13235
|
+
if (!merged.includes("")) merged.push("");
|
|
13236
|
+
return Array.from(new Set(merged));
|
|
13237
|
+
}
|
|
13238
|
+
function npmGlobalPrefix() {
|
|
13239
|
+
if (cachedNpmPrefix !== void 0) return cachedNpmPrefix ?? void 0;
|
|
13240
|
+
try {
|
|
13241
|
+
const prefix = (0, import_child_process2.execSync)("npm config get prefix", {
|
|
13242
|
+
encoding: "utf-8",
|
|
13243
|
+
timeout: 2e3,
|
|
13244
|
+
windowsHide: true,
|
|
13245
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
13246
|
+
}).trim();
|
|
13247
|
+
cachedNpmPrefix = prefix && prefix !== "undefined" ? prefix : null;
|
|
13248
|
+
} catch {
|
|
13249
|
+
cachedNpmPrefix = null;
|
|
13250
|
+
}
|
|
13251
|
+
return cachedNpmPrefix ?? void 0;
|
|
13252
|
+
}
|
|
13253
|
+
function windowsExtraBinDirs() {
|
|
13254
|
+
const dirs = [];
|
|
13255
|
+
const fs44 = require("fs");
|
|
13256
|
+
const push = (dir) => {
|
|
13257
|
+
if (!dir) return;
|
|
13258
|
+
try {
|
|
13259
|
+
if (fs44.existsSync(dir)) dirs.push(dir);
|
|
13260
|
+
} catch {
|
|
13261
|
+
}
|
|
13262
|
+
};
|
|
13263
|
+
if (process.env.APPDATA) push(path11.join(process.env.APPDATA, "npm"));
|
|
13264
|
+
if (process.env.LOCALAPPDATA) push(path11.join(process.env.LOCALAPPDATA, "npm"));
|
|
13265
|
+
if (process.env.USERPROFILE) push(path11.join(process.env.USERPROFILE, "scoop", "shims"));
|
|
13266
|
+
push(npmGlobalPrefix());
|
|
13267
|
+
try {
|
|
13268
|
+
push(path11.dirname(process.execPath));
|
|
13269
|
+
} catch {
|
|
13270
|
+
}
|
|
13271
|
+
return dirs;
|
|
13272
|
+
}
|
|
13273
|
+
function unixExtraBinDirs() {
|
|
13274
|
+
const dirs = [];
|
|
13275
|
+
const fs44 = require("fs");
|
|
13276
|
+
const home = os6.homedir();
|
|
13277
|
+
const push = (dir) => {
|
|
13278
|
+
if (!dir) return;
|
|
13279
|
+
try {
|
|
13280
|
+
if (fs44.existsSync(dir)) dirs.push(dir);
|
|
13281
|
+
} catch {
|
|
13282
|
+
}
|
|
13283
|
+
};
|
|
13284
|
+
push(path11.join(home, ".local", "bin"));
|
|
13285
|
+
push(path11.join(home, ".claude", "local", "bin"));
|
|
13286
|
+
push(path11.join(home, ".npm-global", "bin"));
|
|
13287
|
+
push("/usr/local/bin");
|
|
13288
|
+
push("/opt/homebrew/bin");
|
|
13289
|
+
const prefix = npmGlobalPrefix();
|
|
13290
|
+
if (prefix) push(path11.join(prefix, "bin"));
|
|
13291
|
+
try {
|
|
13292
|
+
push(path11.dirname(process.execPath));
|
|
13293
|
+
} catch {
|
|
13294
|
+
}
|
|
13295
|
+
return dirs;
|
|
13296
|
+
}
|
|
13230
13297
|
function findBinary(name) {
|
|
13231
13298
|
const trimmed = String(name || "").trim();
|
|
13232
13299
|
if (!trimmed) return trimmed;
|
|
@@ -13238,21 +13305,12 @@ function findBinary(name) {
|
|
|
13238
13305
|
const paths = (process.env.PATH || "").split(path11.delimiter);
|
|
13239
13306
|
const extraDirs = [];
|
|
13240
13307
|
if (isWin) {
|
|
13241
|
-
|
|
13242
|
-
try {
|
|
13243
|
-
extraDirs.push(path11.dirname(process.execPath));
|
|
13244
|
-
} catch {
|
|
13245
|
-
}
|
|
13308
|
+
extraDirs.push(...windowsExtraBinDirs());
|
|
13246
13309
|
} else {
|
|
13247
|
-
extraDirs.push(
|
|
13248
|
-
extraDirs.push("/usr/local/bin", "/opt/homebrew/bin");
|
|
13249
|
-
try {
|
|
13250
|
-
extraDirs.push(path11.dirname(process.execPath));
|
|
13251
|
-
} catch {
|
|
13252
|
-
}
|
|
13310
|
+
extraDirs.push(...unixExtraBinDirs());
|
|
13253
13311
|
}
|
|
13254
13312
|
const searchDirs = [...paths, ...extraDirs];
|
|
13255
|
-
const exes = isWin ?
|
|
13313
|
+
const exes = isWin ? windowsExecutableExtensions() : [""];
|
|
13256
13314
|
for (const p of searchDirs) {
|
|
13257
13315
|
if (!p) continue;
|
|
13258
13316
|
for (const ext of exes) {
|
|
@@ -13377,12 +13435,13 @@ function normalizeCliProviderForRuntime(raw) {
|
|
|
13377
13435
|
}
|
|
13378
13436
|
};
|
|
13379
13437
|
}
|
|
13380
|
-
var os6, path11, TerminalTranscriptAccumulator, MESH_SEND_KEY_ENCODING, MESH_DESTRUCTIVE_KEYS, MESH_SEND_KEYS_MAX_ITEMS, MESH_SEND_KEYS_MAX_TEXT_BYTES, buildCliSpawnEnv;
|
|
13438
|
+
var os6, path11, import_child_process2, TerminalTranscriptAccumulator, MESH_SEND_KEY_ENCODING, MESH_DESTRUCTIVE_KEYS, MESH_SEND_KEYS_MAX_ITEMS, MESH_SEND_KEYS_MAX_TEXT_BYTES, buildCliSpawnEnv, cachedNpmPrefix;
|
|
13381
13439
|
var init_provider_cli_shared = __esm({
|
|
13382
13440
|
"src/cli-adapters/provider-cli-shared.ts"() {
|
|
13383
13441
|
"use strict";
|
|
13384
13442
|
os6 = __toESM(require("os"));
|
|
13385
13443
|
path11 = __toESM(require("path"));
|
|
13444
|
+
import_child_process2 = require("child_process");
|
|
13386
13445
|
init_spawn_env();
|
|
13387
13446
|
TerminalTranscriptAccumulator = class {
|
|
13388
13447
|
lines = [[]];
|
|
@@ -13555,6 +13614,7 @@ var init_provider_cli_shared = __esm({
|
|
|
13555
13614
|
MESH_SEND_KEYS_MAX_ITEMS = 64;
|
|
13556
13615
|
MESH_SEND_KEYS_MAX_TEXT_BYTES = 4096;
|
|
13557
13616
|
buildCliSpawnEnv = import_session_host_core2.sanitizeSpawnEnv;
|
|
13617
|
+
cachedNpmPrefix = void 0;
|
|
13558
13618
|
}
|
|
13559
13619
|
});
|
|
13560
13620
|
|
|
@@ -13597,7 +13657,7 @@ async function resolveDetectionPath(command, whichCmd) {
|
|
|
13597
13657
|
}
|
|
13598
13658
|
function execAsync(cmd, timeoutMs = 5e3) {
|
|
13599
13659
|
return new Promise((resolve28) => {
|
|
13600
|
-
const child = (0,
|
|
13660
|
+
const child = (0, import_child_process3.exec)(cmd, {
|
|
13601
13661
|
encoding: "utf-8",
|
|
13602
13662
|
timeout: timeoutMs,
|
|
13603
13663
|
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
@@ -13722,11 +13782,11 @@ function getCachedProviderVersions(providerLoader) {
|
|
|
13722
13782
|
}
|
|
13723
13783
|
return { ...cachedProviderVersions };
|
|
13724
13784
|
}
|
|
13725
|
-
var
|
|
13785
|
+
var import_child_process3, os7, path12, import_fs12, PROVIDER_VERSIONS_TTL_MS, cachedProviderVersions, cachedProviderVersionsAt, providerVersionsRefreshInFlight, defaultProviderLoader;
|
|
13726
13786
|
var init_cli_detector = __esm({
|
|
13727
13787
|
"src/detection/cli-detector.ts"() {
|
|
13728
13788
|
"use strict";
|
|
13729
|
-
|
|
13789
|
+
import_child_process3 = require("child_process");
|
|
13730
13790
|
os7 = __toESM(require("os"));
|
|
13731
13791
|
path12 = __toESM(require("path"));
|
|
13732
13792
|
import_fs12 = require("fs");
|
|
@@ -18682,14 +18742,14 @@ function getHostMemorySnapshot() {
|
|
|
18682
18742
|
availableMem
|
|
18683
18743
|
};
|
|
18684
18744
|
}
|
|
18685
|
-
var os8,
|
|
18745
|
+
var os8, import_child_process4, import_util, execAsync2, cachedDarwinAvail, darwinMemoryInterval;
|
|
18686
18746
|
var init_host_memory = __esm({
|
|
18687
18747
|
"src/system/host-memory.ts"() {
|
|
18688
18748
|
"use strict";
|
|
18689
18749
|
os8 = __toESM(require("os"));
|
|
18690
|
-
|
|
18750
|
+
import_child_process4 = require("child_process");
|
|
18691
18751
|
import_util = require("util");
|
|
18692
|
-
execAsync2 = (0, import_util.promisify)(
|
|
18752
|
+
execAsync2 = (0, import_util.promisify)(import_child_process4.exec);
|
|
18693
18753
|
cachedDarwinAvail = null;
|
|
18694
18754
|
darwinMemoryInterval = null;
|
|
18695
18755
|
}
|
|
@@ -32380,6 +32440,7 @@ __export(index_exports, {
|
|
|
32380
32440
|
getActiveMeshMissionSummaries: () => getActiveMeshMissionSummaries,
|
|
32381
32441
|
getActiveSessionDeliveries: () => getActiveSessionDeliveries,
|
|
32382
32442
|
getAvailableIdeIds: () => getAvailableIdeIds,
|
|
32443
|
+
getConfigDir: () => getConfigDir,
|
|
32383
32444
|
getCoordinatorForSession: () => getCoordinatorForSession,
|
|
32384
32445
|
getCurrentDaemonLogPath: () => getCurrentDaemonLogPath,
|
|
32385
32446
|
getDaemonBuildInfo: () => getDaemonBuildInfo,
|
|
@@ -32556,6 +32617,7 @@ __export(index_exports, {
|
|
|
32556
32617
|
resolveDeliveryDecision: () => resolveDeliveryDecision,
|
|
32557
32618
|
resolveEffectiveMeshNodeHealth: () => resolveEffectiveMeshNodeHealth,
|
|
32558
32619
|
resolveGitRepository: () => resolveGitRepository,
|
|
32620
|
+
resolveInstanceDir: () => resolveInstanceDir,
|
|
32559
32621
|
resolveMagiSessionCleanupMode: () => resolveMagiSessionCleanupMode,
|
|
32560
32622
|
resolveMaxParallelTasks: () => resolveMaxParallelTasks,
|
|
32561
32623
|
resolveMeshHostStatus: () => resolveMeshHostStatus,
|
|
@@ -34167,7 +34229,7 @@ var P2pRelayFailureError = class extends Error {
|
|
|
34167
34229
|
init_state_store();
|
|
34168
34230
|
|
|
34169
34231
|
// src/detection/ide-detector.ts
|
|
34170
|
-
var
|
|
34232
|
+
var import_child_process5 = require("child_process");
|
|
34171
34233
|
var import_util2 = require("util");
|
|
34172
34234
|
var import_fs16 = require("fs");
|
|
34173
34235
|
var import_os2 = require("os");
|
|
@@ -34228,7 +34290,7 @@ function isKnownWin32GuiExe(binPath, win32ProcessNames) {
|
|
|
34228
34290
|
}
|
|
34229
34291
|
|
|
34230
34292
|
// src/detection/ide-detector.ts
|
|
34231
|
-
var execAsync3 = (0, import_util2.promisify)(
|
|
34293
|
+
var execAsync3 = (0, import_util2.promisify)(import_child_process5.exec);
|
|
34232
34294
|
var BUILTIN_IDE_DEFINITIONS = [];
|
|
34233
34295
|
var registeredIDEs = /* @__PURE__ */ new Map();
|
|
34234
34296
|
function registerIDEDefinition(def) {
|
|
@@ -44077,22 +44139,22 @@ var notificationHandlers = {
|
|
|
44077
44139
|
init_config();
|
|
44078
44140
|
|
|
44079
44141
|
// src/commands/upgrade-helper.ts
|
|
44080
|
-
var import_child_process7 = require("child_process");
|
|
44081
44142
|
var import_child_process8 = require("child_process");
|
|
44143
|
+
var import_child_process9 = require("child_process");
|
|
44082
44144
|
var fs15 = __toESM(require("fs"));
|
|
44083
44145
|
var os14 = __toESM(require("os"));
|
|
44084
44146
|
var path21 = __toESM(require("path"));
|
|
44085
44147
|
|
|
44086
44148
|
// src/commands/windows-atomic-upgrade.ts
|
|
44087
|
-
var
|
|
44149
|
+
var import_child_process7 = require("child_process");
|
|
44088
44150
|
var fs14 = __toESM(require("fs"));
|
|
44089
44151
|
var http2 = __toESM(require("http"));
|
|
44090
44152
|
var path20 = __toESM(require("path"));
|
|
44091
44153
|
|
|
44092
44154
|
// src/commands/process-lifecycle.ts
|
|
44093
|
-
var
|
|
44155
|
+
var import_child_process6 = require("child_process");
|
|
44094
44156
|
function defaultExecFileSync() {
|
|
44095
|
-
return
|
|
44157
|
+
return import_child_process6.execFileSync;
|
|
44096
44158
|
}
|
|
44097
44159
|
function getWindowsProcessCommandLine(pid, exec7) {
|
|
44098
44160
|
const pidFilter = `ProcessId=${pid}`;
|
|
@@ -44311,10 +44373,16 @@ var ADHDEV_OWNED_MARKERS = [
|
|
|
44311
44373
|
function normalizeForCompare(value) {
|
|
44312
44374
|
return path20.resolve(value).replace(/[\\/]+$/, "").toLowerCase();
|
|
44313
44375
|
}
|
|
44376
|
+
var DEFAULT_INSTANCE_DIR = ".adhdev";
|
|
44377
|
+
function normalizeInstanceDir(instanceDir) {
|
|
44378
|
+
const trimmed = instanceDir?.trim();
|
|
44379
|
+
return trimmed ? trimmed : DEFAULT_INSTANCE_DIR;
|
|
44380
|
+
}
|
|
44314
44381
|
function resolveWindowsInstallerLayout(options) {
|
|
44315
44382
|
if ((options.platform || process.platform) !== "win32" || !options.installPrefix) return null;
|
|
44316
|
-
const
|
|
44317
|
-
const
|
|
44383
|
+
const instanceDir = normalizeInstanceDir(options.instanceDir);
|
|
44384
|
+
const installRoot = path20.join(options.homeDir, instanceDir, "npm-installs");
|
|
44385
|
+
const stablePrefix = path20.join(options.homeDir, instanceDir, "npm-global");
|
|
44318
44386
|
const pointerPath = path20.join(stablePrefix, POINTER_NAME);
|
|
44319
44387
|
const activeVersionName = path20.basename(options.installPrefix);
|
|
44320
44388
|
if (!activeVersionName.startsWith("version-")) return null;
|
|
@@ -44330,7 +44398,7 @@ function resolveWindowsInstallerLayout(options) {
|
|
|
44330
44398
|
}
|
|
44331
44399
|
function nodeMajor(nodeExecutable) {
|
|
44332
44400
|
try {
|
|
44333
|
-
const version = String((0,
|
|
44401
|
+
const version = String((0, import_child_process7.execFileSync)(nodeExecutable, ["-p", "process.versions.node"], {
|
|
44334
44402
|
encoding: "utf8",
|
|
44335
44403
|
timeout: 5e3,
|
|
44336
44404
|
windowsHide: true,
|
|
@@ -44342,9 +44410,9 @@ function nodeMajor(nodeExecutable) {
|
|
|
44342
44410
|
return null;
|
|
44343
44411
|
}
|
|
44344
44412
|
}
|
|
44345
|
-
function findPortableNode22(homeDir, currentNode = process.execPath) {
|
|
44413
|
+
function findPortableNode22(homeDir, currentNode = process.execPath, instanceDir = DEFAULT_INSTANCE_DIR) {
|
|
44346
44414
|
const candidates = [currentNode];
|
|
44347
|
-
const portableRoot = path20.join(homeDir,
|
|
44415
|
+
const portableRoot = path20.join(homeDir, normalizeInstanceDir(instanceDir), "tools", "node22");
|
|
44348
44416
|
try {
|
|
44349
44417
|
const dirs = fs14.readdirSync(portableRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path20.join(portableRoot, entry.name, "node.exe"));
|
|
44350
44418
|
candidates.push(...dirs);
|
|
@@ -44418,7 +44486,7 @@ exec "${portableNode}" "${cliEntry}" "$@"
|
|
|
44418
44486
|
}
|
|
44419
44487
|
}
|
|
44420
44488
|
function validateStagedCli(portableNode, cliEntry, targetVersion) {
|
|
44421
|
-
const output = String((0,
|
|
44489
|
+
const output = String((0, import_child_process7.execFileSync)(portableNode, [cliEntry, "--version"], {
|
|
44422
44490
|
encoding: "utf8",
|
|
44423
44491
|
timeout: 15e3,
|
|
44424
44492
|
windowsHide: true,
|
|
@@ -44447,7 +44515,7 @@ function atomicWrite(destination, content, encoding) {
|
|
|
44447
44515
|
`} finally { if ([IO.File]::Exists($temporary)) { [IO.File]::Delete($temporary) } }`
|
|
44448
44516
|
].join("\n");
|
|
44449
44517
|
const encoded = Buffer.from(script, "utf16le").toString("base64");
|
|
44450
|
-
const result = (0,
|
|
44518
|
+
const result = (0, import_child_process7.spawnSync)("powershell.exe", [
|
|
44451
44519
|
"-NoLogo",
|
|
44452
44520
|
"-NoProfile",
|
|
44453
44521
|
"-NonInteractive",
|
|
@@ -44607,7 +44675,7 @@ function createDefaultWindowsAtomicHooks(options) {
|
|
|
44607
44675
|
};
|
|
44608
44676
|
const pathKey = Object.keys(env).find((key2) => key2.toLowerCase() === "path") || "Path";
|
|
44609
44677
|
env[pathKey] = `${path20.dirname(portableNode)};${env[pathKey] || ""}`;
|
|
44610
|
-
const installOutput = String((0,
|
|
44678
|
+
const installOutput = String((0, import_child_process7.execFileSync)(portableNode, [
|
|
44611
44679
|
options.npmCliPath,
|
|
44612
44680
|
"install",
|
|
44613
44681
|
"-g",
|
|
@@ -44628,7 +44696,7 @@ function createDefaultWindowsAtomicHooks(options) {
|
|
|
44628
44696
|
restart: (portableNode, stagedCliEntry) => {
|
|
44629
44697
|
const restartArgv = options.restartArgv.map((arg, index) => index === 0 ? stagedCliEntry : arg);
|
|
44630
44698
|
if (restartArgv.length === 0) throw new Error("replacement daemon restart arguments are missing");
|
|
44631
|
-
const child = (0,
|
|
44699
|
+
const child = (0, import_child_process7.spawn)(portableNode, restartArgv, {
|
|
44632
44700
|
detached: true,
|
|
44633
44701
|
stdio: "ignore",
|
|
44634
44702
|
windowsHide: true,
|
|
@@ -44640,7 +44708,7 @@ function createDefaultWindowsAtomicHooks(options) {
|
|
|
44640
44708
|
},
|
|
44641
44709
|
restartOld: (portableNode) => {
|
|
44642
44710
|
if (options.restartArgv.length === 0) return;
|
|
44643
|
-
const child = (0,
|
|
44711
|
+
const child = (0, import_child_process7.spawn)(portableNode, options.restartArgv, {
|
|
44644
44712
|
detached: true,
|
|
44645
44713
|
stdio: "ignore",
|
|
44646
44714
|
windowsHide: true,
|
|
@@ -44680,7 +44748,7 @@ function createDefaultWindowsAtomicHooks(options) {
|
|
|
44680
44748
|
},
|
|
44681
44749
|
stopProcess: (pid) => {
|
|
44682
44750
|
try {
|
|
44683
|
-
(0,
|
|
44751
|
+
(0, import_child_process7.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
|
44684
44752
|
} catch {
|
|
44685
44753
|
}
|
|
44686
44754
|
},
|
|
@@ -44728,7 +44796,12 @@ function removeInactivePrefix(target, log) {
|
|
|
44728
44796
|
}
|
|
44729
44797
|
|
|
44730
44798
|
// src/commands/upgrade-helper.ts
|
|
44799
|
+
init_config();
|
|
44731
44800
|
var UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
|
|
44801
|
+
function resolveInstanceDir(configDir = getConfigDir()) {
|
|
44802
|
+
const base = path21.basename(configDir).trim();
|
|
44803
|
+
return base || ".adhdev";
|
|
44804
|
+
}
|
|
44732
44805
|
function getUpgradeLogPath(home = os14.homedir()) {
|
|
44733
44806
|
const dir = path21.join(home, ".adhdev");
|
|
44734
44807
|
fs15.mkdirSync(dir, { recursive: true });
|
|
@@ -44810,16 +44883,16 @@ function resolveInstallPrefixFromPackageRoot(packageRoot, packageName) {
|
|
|
44810
44883
|
}
|
|
44811
44884
|
return maybeLibDir;
|
|
44812
44885
|
}
|
|
44813
|
-
function isPortableNode22Prefix(prefix, homeDir) {
|
|
44886
|
+
function isPortableNode22Prefix(prefix, homeDir, instanceDir = ".adhdev") {
|
|
44814
44887
|
if (!prefix) return false;
|
|
44815
|
-
const portableRoot = path21.join(homeDir,
|
|
44888
|
+
const portableRoot = path21.join(homeDir, instanceDir, "tools", "node22");
|
|
44816
44889
|
const normalizedPrefix = path21.resolve(prefix).replace(/[\\/]+$/, "").toLowerCase();
|
|
44817
44890
|
const normalizedRoot = path21.resolve(portableRoot).replace(/[\\/]+$/, "").toLowerCase();
|
|
44818
44891
|
return normalizedPrefix === normalizedRoot || normalizedPrefix.startsWith(`${normalizedRoot}${path21.sep.toLowerCase()}`);
|
|
44819
44892
|
}
|
|
44820
|
-
function canonicalDispatcherInstallPrefix(homeDir) {
|
|
44821
|
-
const installRoot = path21.join(homeDir,
|
|
44822
|
-
const pointerPath = path21.join(homeDir,
|
|
44893
|
+
function canonicalDispatcherInstallPrefix(homeDir, instanceDir = ".adhdev") {
|
|
44894
|
+
const installRoot = path21.join(homeDir, instanceDir, "npm-installs");
|
|
44895
|
+
const pointerPath = path21.join(homeDir, instanceDir, "npm-global", ".adhdev-current");
|
|
44823
44896
|
try {
|
|
44824
44897
|
const activeVersion = fs15.readFileSync(pointerPath, "utf8").trim();
|
|
44825
44898
|
if (activeVersion.startsWith("version-")) return path21.join(installRoot, activeVersion);
|
|
@@ -44832,9 +44905,10 @@ function resolveCurrentGlobalInstallSurface(options) {
|
|
|
44832
44905
|
const npmInvocation = resolveSiblingNpmInvocation(options.nodeExecutable || process.execPath, options.platform);
|
|
44833
44906
|
const platform10 = options.platform || process.platform;
|
|
44834
44907
|
const homeDir = options.homeDir || os14.homedir();
|
|
44908
|
+
const instanceDir = options.instanceDir || resolveInstanceDir();
|
|
44835
44909
|
let installPrefix = packageRoot ? resolveInstallPrefixFromPackageRoot(packageRoot, options.packageName) : null;
|
|
44836
|
-
if (platform10 === "win32" && isPortableNode22Prefix(installPrefix, homeDir)) {
|
|
44837
|
-
installPrefix = canonicalDispatcherInstallPrefix(homeDir);
|
|
44910
|
+
if (platform10 === "win32" && isPortableNode22Prefix(installPrefix, homeDir, instanceDir)) {
|
|
44911
|
+
installPrefix = canonicalDispatcherInstallPrefix(homeDir, instanceDir);
|
|
44838
44912
|
}
|
|
44839
44913
|
return {
|
|
44840
44914
|
npmExecutable: npmInvocation.executable,
|
|
@@ -44876,7 +44950,7 @@ function getNpmExecOptions(platform10 = process.platform) {
|
|
|
44876
44950
|
}
|
|
44877
44951
|
function execNpmCommandSync(args, options = {}, surface) {
|
|
44878
44952
|
const execOptions = surface?.execOptions || getNpmExecOptions();
|
|
44879
|
-
return (0,
|
|
44953
|
+
return (0, import_child_process8.execFileSync)(
|
|
44880
44954
|
surface?.npmExecutable || "npm",
|
|
44881
44955
|
[...surface?.npmArgsPrefix || [], ...args],
|
|
44882
44956
|
{
|
|
@@ -44933,7 +45007,7 @@ function listForeignNativeAddonHolders(packageRoot) {
|
|
|
44933
45007
|
].join("\n");
|
|
44934
45008
|
let out = "";
|
|
44935
45009
|
try {
|
|
44936
|
-
out = String((0,
|
|
45010
|
+
out = String((0, import_child_process8.execFileSync)("powershell.exe", [
|
|
44937
45011
|
"-NoProfile",
|
|
44938
45012
|
"-NonInteractive",
|
|
44939
45013
|
"-ExecutionPolicy",
|
|
@@ -45057,7 +45131,7 @@ function cleanupStaleGlobalInstallDirs(pkgName, surface) {
|
|
|
45057
45131
|
}
|
|
45058
45132
|
function spawnDetachedDaemonUpgradeHelper(payload) {
|
|
45059
45133
|
const env = { ...process.env, [UPGRADE_HELPER_ENV]: JSON.stringify(payload) };
|
|
45060
|
-
const child = (0,
|
|
45134
|
+
const child = (0, import_child_process9.spawn)(process.execPath, process.argv.slice(1), {
|
|
45061
45135
|
detached: true,
|
|
45062
45136
|
stdio: "ignore",
|
|
45063
45137
|
windowsHide: true,
|
|
@@ -45084,12 +45158,14 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
45084
45158
|
}
|
|
45085
45159
|
await stopSessionHostProcesses(sessionHostAppName);
|
|
45086
45160
|
removeDaemonPidFile();
|
|
45161
|
+
const instanceDir = resolveInstanceDir();
|
|
45087
45162
|
const windowsInstallerLayout = resolveWindowsInstallerLayout({
|
|
45088
45163
|
homeDir: os14.homedir(),
|
|
45089
|
-
installPrefix: installCommand.surface.installPrefix
|
|
45164
|
+
installPrefix: installCommand.surface.installPrefix,
|
|
45165
|
+
instanceDir
|
|
45090
45166
|
});
|
|
45091
45167
|
if (windowsInstallerLayout) {
|
|
45092
|
-
const portableNode = findPortableNode22(os14.homedir());
|
|
45168
|
+
const portableNode = findPortableNode22(os14.homedir(), process.execPath, instanceDir);
|
|
45093
45169
|
if (!portableNode) {
|
|
45094
45170
|
throw new Error("installer-managed Windows update requires the portable Node.js 22 runtime");
|
|
45095
45171
|
}
|
|
@@ -45151,7 +45227,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
45151
45227
|
let installOutput = "";
|
|
45152
45228
|
for (let attempt = 1; attempt <= maxInstallAttempts; attempt++) {
|
|
45153
45229
|
try {
|
|
45154
|
-
installOutput = String((0,
|
|
45230
|
+
installOutput = String((0, import_child_process8.execFileSync)(
|
|
45155
45231
|
installCommand.command,
|
|
45156
45232
|
installCommand.args,
|
|
45157
45233
|
{
|
|
@@ -45204,7 +45280,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
45204
45280
|
const env = { ...process.env };
|
|
45205
45281
|
delete env[UPGRADE_HELPER_ENV];
|
|
45206
45282
|
appendUpgradeLog(`Restarting daemon with args: ${restartArgv.join(" ")}`);
|
|
45207
|
-
const child = (0,
|
|
45283
|
+
const child = (0, import_child_process9.spawn)(process.execPath, restartArgv, {
|
|
45208
45284
|
detached: true,
|
|
45209
45285
|
stdio: "ignore",
|
|
45210
45286
|
windowsHide: true,
|
|
@@ -45786,7 +45862,7 @@ var os23 = __toESM(require("os"));
|
|
|
45786
45862
|
var path30 = __toESM(require("path"));
|
|
45787
45863
|
var crypto6 = __toESM(require("crypto"));
|
|
45788
45864
|
var import_fs17 = require("fs");
|
|
45789
|
-
var
|
|
45865
|
+
var import_child_process11 = require("child_process");
|
|
45790
45866
|
var import_chalk = __toESM(require("chalk"));
|
|
45791
45867
|
init_provider_cli_adapter();
|
|
45792
45868
|
init_cli_detector();
|
|
@@ -49470,6 +49546,7 @@ init_logger();
|
|
|
49470
49546
|
init_debug_trace();
|
|
49471
49547
|
init_debug_config();
|
|
49472
49548
|
init_mesh_event_trace();
|
|
49549
|
+
init_mesh_events_utils();
|
|
49473
49550
|
init_control_effects();
|
|
49474
49551
|
init_approval_utils();
|
|
49475
49552
|
init_provider_patch_state();
|
|
@@ -50953,6 +51030,17 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
50953
51030
|
// this to refuse a SECOND completion for a turn whose completion already fired —
|
|
50954
51031
|
// so a worker that finished cleanly and is simply being auto-cleaned never emits a
|
|
50955
51032
|
// duplicate. taskId '' covers an ad-hoc (no-task) turn. null = none emitted yet.
|
|
51033
|
+
//
|
|
51034
|
+
// COMPLETION-WEAK-REARM (fix1): the latch now carries the EVIDENCE STRENGTH of the
|
|
51035
|
+
// recorded emit. `weak` mirrors isWeakCompletionEvidence() over the exact event that
|
|
51036
|
+
// was pushed (evidenceLevel ∈ {weak,insufficient}, reviewRecommended, or a
|
|
51037
|
+
// missing_final_assistant diagnostic — the CANON-C decoupled-immediate emit and the
|
|
51038
|
+
// startup-grace fast-collapse synth are the two weak producers). `emittedAtEpoch`
|
|
51039
|
+
// snapshots busyEpoch at emit time so the transcript re-emit paths can require a real
|
|
51040
|
+
// generating→idle transition (busyEpoch advanced past this) before re-arming — a
|
|
51041
|
+
// static idle screen can never re-fire the same weak frame. A weak latch is a
|
|
51042
|
+
// ONE-SHOT re-arm: the genuine re-emit overwrites this with weak=false, so a
|
|
51043
|
+
// subsequent idle tick hits the non-weak latch and stops (never a third emit).
|
|
50956
51044
|
lastEmittedCompletion = null;
|
|
50957
51045
|
async enforceFreshSessionLaunchIfNeeded() {
|
|
50958
51046
|
const scriptName = getForcedNewSessionScriptName(this.provider, this.launchMode);
|
|
@@ -51708,7 +51796,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
51708
51796
|
flushMeshCompletionBeforeCleanup() {
|
|
51709
51797
|
if (!this.isMeshWorkerSession()) return false;
|
|
51710
51798
|
const taskId = this.completingTurnTaskId();
|
|
51711
|
-
if (this.
|
|
51799
|
+
if (this.shouldSuppressCompletionReEmit(taskId)) {
|
|
51712
51800
|
return false;
|
|
51713
51801
|
}
|
|
51714
51802
|
if (!this.injectedTaskHasStartedGenerating()) return false;
|
|
@@ -51772,7 +51860,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
51772
51860
|
if (observedStatus !== "idle") return false;
|
|
51773
51861
|
if (this.hasAdapterPendingResponse()) return false;
|
|
51774
51862
|
const taskId = this.completingTurnTaskId();
|
|
51775
|
-
if (this.
|
|
51863
|
+
if (this.shouldSuppressCompletionReEmit(taskId)) {
|
|
51776
51864
|
return false;
|
|
51777
51865
|
}
|
|
51778
51866
|
if (!this.injectedTaskHasStartedGenerating()) return false;
|
|
@@ -51837,7 +51925,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
51837
51925
|
if (observedStatus !== "idle") return false;
|
|
51838
51926
|
if (this.hasAdapterPendingResponse()) return false;
|
|
51839
51927
|
const taskId = this.completingTurnTaskId();
|
|
51840
|
-
if (this.
|
|
51928
|
+
if (this.shouldSuppressCompletionReEmit(taskId)) {
|
|
51841
51929
|
return false;
|
|
51842
51930
|
}
|
|
51843
51931
|
if (!this.injectedTaskHasStartedGenerating()) return false;
|
|
@@ -52270,8 +52358,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
52270
52358
|
if (summary) {
|
|
52271
52359
|
this.lastCompletionSummary = { content: summary, receivedAt: opts.timestamp };
|
|
52272
52360
|
}
|
|
52273
|
-
|
|
52274
|
-
this.pushEvent({
|
|
52361
|
+
const completionEvent = {
|
|
52275
52362
|
event: "agent:generating_completed",
|
|
52276
52363
|
chatTitle: opts.chatTitle,
|
|
52277
52364
|
duration: opts.duration,
|
|
@@ -52283,11 +52370,49 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
52283
52370
|
finalSummary: opts.finalSummary,
|
|
52284
52371
|
...opts.evidenceLevel !== void 0 ? { evidenceLevel: opts.evidenceLevel } : {},
|
|
52285
52372
|
...opts.completionDiagnostic !== void 0 ? { completionDiagnostic: opts.completionDiagnostic } : {}
|
|
52286
|
-
}
|
|
52373
|
+
};
|
|
52374
|
+
this.lastEmittedCompletion = {
|
|
52375
|
+
taskId: typeof opts.taskId === "string" ? opts.taskId : "",
|
|
52376
|
+
at: Date.now(),
|
|
52377
|
+
evidenceLevel: opts.evidenceLevel,
|
|
52378
|
+
weak: isWeakCompletionEvidence(completionEvent),
|
|
52379
|
+
emittedAtEpoch: this.busyEpoch
|
|
52380
|
+
};
|
|
52381
|
+
this.pushEvent(completionEvent);
|
|
52287
52382
|
if (this.settings?.silentNextIdlePush === true) {
|
|
52288
52383
|
this.updateSettings({ silentNextIdlePush: void 0, silentNextIdlePushArmedAt: void 0 });
|
|
52289
52384
|
}
|
|
52290
52385
|
}
|
|
52386
|
+
/**
|
|
52387
|
+
* COMPLETION-WEAK-REARM (fix1): the double-emit guard shared by the three transcript
|
|
52388
|
+
* re-emit paths (flushMeshCompletionBeforeCleanup, tryReconcilePurePtyCompletionForStall,
|
|
52389
|
+
* tryReconcileNativeSourceCompletionForStall). Returns true when a re-emit for `taskId`
|
|
52390
|
+
* must be SUPPRESSED because this turn's completion already fired with strong evidence.
|
|
52391
|
+
*
|
|
52392
|
+
* The defect this replaces: the old guard short-circuited on ANY prior emit for the
|
|
52393
|
+
* taskId, regardless of its evidence. After a WEAK completion (CANON-C decoupled-immediate
|
|
52394
|
+
* missing_final_assistant, or a startup-grace fast-collapse synth), the same session
|
|
52395
|
+
* reaching a GENUINE idle later (final assistant present) was silently swallowed — the
|
|
52396
|
+
* worker never emitted the genuine completion and the coordinator held on the acked-death
|
|
52397
|
+
* deadline (8 min).
|
|
52398
|
+
*
|
|
52399
|
+
* New behavior:
|
|
52400
|
+
* • no latch / taskId mismatch → NOT suppressed (the caller's own evidence gate runs).
|
|
52401
|
+
* • prior emit was GENUINE (not weak) → SUPPRESSED (single-shot; a clean completion is
|
|
52402
|
+
* never re-emitted).
|
|
52403
|
+
* • prior emit was WEAK → re-arm ONE-SHOT, but only across a real generating→idle
|
|
52404
|
+
* transition: require busyEpoch to have advanced past the weak emit's epoch, so a
|
|
52405
|
+
* static idle screen cannot re-fire the same weak frame. The genuine re-emit passes
|
|
52406
|
+
* evidenceLevel:'transcript' (non-weak), overwriting the latch → any subsequent idle
|
|
52407
|
+
* tick hits the now-genuine latch and is suppressed. Never a third emit.
|
|
52408
|
+
*/
|
|
52409
|
+
shouldSuppressCompletionReEmit(taskId) {
|
|
52410
|
+
const latch = this.lastEmittedCompletion;
|
|
52411
|
+
if (!latch || latch.taskId !== (taskId ?? "")) return false;
|
|
52412
|
+
if (!latch.weak) return true;
|
|
52413
|
+
if (this.busyEpoch <= latch.emittedAtEpoch) return true;
|
|
52414
|
+
return false;
|
|
52415
|
+
}
|
|
52291
52416
|
/**
|
|
52292
52417
|
* AUTOAPPROVE-FLAP-INBOX-MISSING sticky-approval overlay. Returns the adapterStatus a
|
|
52293
52418
|
* flap-prone claude-cli approval SHOULD present this frame — either the raw status
|
|
@@ -53409,7 +53534,7 @@ ${buttons.join("\n")}`;
|
|
|
53409
53534
|
// src/providers/acp-provider-instance.ts
|
|
53410
53535
|
var path29 = __toESM(require("path"));
|
|
53411
53536
|
var import_stream = require("stream");
|
|
53412
|
-
var
|
|
53537
|
+
var import_child_process10 = require("child_process");
|
|
53413
53538
|
var import_sdk = require("@agentclientprotocol/sdk");
|
|
53414
53539
|
init_contracts2();
|
|
53415
53540
|
init_provider_input_support();
|
|
@@ -53933,7 +54058,7 @@ var AcpProviderInstance = class {
|
|
|
53933
54058
|
this.errorMessage = null;
|
|
53934
54059
|
this.errorReason = null;
|
|
53935
54060
|
this.stderrBuffer = [];
|
|
53936
|
-
this.process = (0,
|
|
54061
|
+
this.process = (0, import_child_process10.spawn)(command, args, {
|
|
53937
54062
|
cwd: this.workingDir,
|
|
53938
54063
|
env,
|
|
53939
54064
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -54684,7 +54809,7 @@ function commandExists(command) {
|
|
|
54684
54809
|
return (0, import_fs17.existsSync)(expandExecutable(trimmed));
|
|
54685
54810
|
}
|
|
54686
54811
|
try {
|
|
54687
|
-
(0,
|
|
54812
|
+
(0, import_child_process11.execFileSync)(process.platform === "win32" ? "where" : "which", [trimmed], {
|
|
54688
54813
|
stdio: "ignore",
|
|
54689
54814
|
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
54690
54815
|
});
|
|
@@ -56200,7 +56325,7 @@ var cliAgentHandlers = {
|
|
|
56200
56325
|
};
|
|
56201
56326
|
|
|
56202
56327
|
// src/launch.ts
|
|
56203
|
-
var
|
|
56328
|
+
var import_child_process12 = require("child_process");
|
|
56204
56329
|
var net = __toESM(require("net"));
|
|
56205
56330
|
var os28 = __toESM(require("os"));
|
|
56206
56331
|
var path38 = __toESM(require("path"));
|
|
@@ -60204,7 +60329,7 @@ function findMacAppProcessPids(psOutput, appPaths) {
|
|
|
60204
60329
|
// src/launch.ts
|
|
60205
60330
|
async function execQuiet(command, options = {}) {
|
|
60206
60331
|
return new Promise((resolve28) => {
|
|
60207
|
-
(0,
|
|
60332
|
+
(0, import_child_process12.exec)(command, options, (error, stdout) => {
|
|
60208
60333
|
if (error) return resolve28("");
|
|
60209
60334
|
resolve28(stdout.toString());
|
|
60210
60335
|
});
|
|
@@ -60604,10 +60729,10 @@ async function launchMacOS(ide, port, workspace, newWindow) {
|
|
|
60604
60729
|
const canUseAppLauncher = !!appName;
|
|
60605
60730
|
const useAppLauncher = preferredMethod === "app" ? canUseAppLauncher : preferredMethod === "cli" ? false : !canUseCli && canUseAppLauncher;
|
|
60606
60731
|
if (!useAppLauncher && ide.cliCommand) {
|
|
60607
|
-
(0,
|
|
60732
|
+
(0, import_child_process12.spawn)(ide.cliCommand, args, { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
60608
60733
|
} else if (appName) {
|
|
60609
60734
|
const openArgs = ["-a", appName, "--args", ...args];
|
|
60610
|
-
(0,
|
|
60735
|
+
(0, import_child_process12.spawn)("open", openArgs, { detached: true, stdio: "ignore" }).unref();
|
|
60611
60736
|
} else {
|
|
60612
60737
|
throw new Error(`No app identifier or CLI for ${ide.displayName}`);
|
|
60613
60738
|
}
|
|
@@ -60633,7 +60758,7 @@ async function launchLinux(ide, port, workspace, newWindow) {
|
|
|
60633
60758
|
const args = ["--remote-debugging-port=" + port];
|
|
60634
60759
|
if (newWindow) args.push("--new-window");
|
|
60635
60760
|
if (workspace) args.push(workspace);
|
|
60636
|
-
(0,
|
|
60761
|
+
(0, import_child_process12.spawn)(cli, args, { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
60637
60762
|
}
|
|
60638
60763
|
function getAvailableIdeIds() {
|
|
60639
60764
|
return getProviderLoader().getAvailableIdeTypes();
|
|
@@ -70675,7 +70800,7 @@ var fs38 = __toESM(require("fs"));
|
|
|
70675
70800
|
var path40 = __toESM(require("path"));
|
|
70676
70801
|
var os30 = __toESM(require("os"));
|
|
70677
70802
|
var import_os5 = require("os");
|
|
70678
|
-
var
|
|
70803
|
+
var import_child_process13 = require("child_process");
|
|
70679
70804
|
var ARCHIVE_PATH = path40.join(os30.homedir(), ".adhdev", "version-history.json");
|
|
70680
70805
|
var MAX_ENTRIES_PER_PROVIDER = 20;
|
|
70681
70806
|
var VersionArchive = class {
|
|
@@ -70731,7 +70856,7 @@ var VersionArchive = class {
|
|
|
70731
70856
|
};
|
|
70732
70857
|
async function runCommand(cmd, timeout = 1e4) {
|
|
70733
70858
|
return new Promise((resolve28) => {
|
|
70734
|
-
(0,
|
|
70859
|
+
(0, import_child_process13.exec)(cmd, {
|
|
70735
70860
|
encoding: "utf-8",
|
|
70736
70861
|
timeout
|
|
70737
70862
|
}, (error, stdout) => {
|
|
@@ -76290,7 +76415,7 @@ async function listHostedCliRuntimes(endpoint) {
|
|
|
76290
76415
|
}
|
|
76291
76416
|
|
|
76292
76417
|
// src/session-host/managed-host.ts
|
|
76293
|
-
var
|
|
76418
|
+
var import_child_process14 = require("child_process");
|
|
76294
76419
|
var fs43 = __toESM(require("fs"));
|
|
76295
76420
|
var os32 = __toESM(require("os"));
|
|
76296
76421
|
var path45 = __toESM(require("path"));
|
|
@@ -76345,7 +76470,7 @@ function createManagedSessionHost(options) {
|
|
|
76345
76470
|
if (process.platform === "win32") {
|
|
76346
76471
|
const spawnOpts = { stdio: "ignore" };
|
|
76347
76472
|
if (options.killWindowsHide) spawnOpts.windowsHide = true;
|
|
76348
|
-
(0,
|
|
76473
|
+
(0, import_child_process14.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], spawnOpts);
|
|
76349
76474
|
} else {
|
|
76350
76475
|
process.kill(pid, "SIGTERM");
|
|
76351
76476
|
}
|
|
@@ -76354,8 +76479,31 @@ function createManagedSessionHost(options) {
|
|
|
76354
76479
|
return false;
|
|
76355
76480
|
}
|
|
76356
76481
|
}
|
|
76482
|
+
function resolveSessionHostNode() {
|
|
76483
|
+
if (process.platform !== "win32") {
|
|
76484
|
+
return process.execPath;
|
|
76485
|
+
}
|
|
76486
|
+
let portableNode = null;
|
|
76487
|
+
try {
|
|
76488
|
+
portableNode = findPortableNode22(os32.homedir(), process.execPath, resolveInstanceDir());
|
|
76489
|
+
} catch (error) {
|
|
76490
|
+
LOG.warn(
|
|
76491
|
+
"SessionHost",
|
|
76492
|
+
`Failed to resolve portable Node 22 for the session-host spawn: ${error instanceof Error ? error.message : String(error)}`
|
|
76493
|
+
);
|
|
76494
|
+
}
|
|
76495
|
+
if (portableNode) {
|
|
76496
|
+
return portableNode;
|
|
76497
|
+
}
|
|
76498
|
+
LOG.warn(
|
|
76499
|
+
"SessionHost",
|
|
76500
|
+
`Portable Node 22 not found; spawning the session-host with ${process.execPath}. node-pty may fail to load its conpty.node prebuild under a non-22 Node on win32.`
|
|
76501
|
+
);
|
|
76502
|
+
return process.execPath;
|
|
76503
|
+
}
|
|
76357
76504
|
function spawnHost() {
|
|
76358
76505
|
const entry = resolveEntry();
|
|
76506
|
+
const nodeExecutable = resolveSessionHostNode();
|
|
76359
76507
|
let stdio = "ignore";
|
|
76360
76508
|
let logFd = null;
|
|
76361
76509
|
if (options.spawnStdio === "logfile") {
|
|
@@ -76364,7 +76512,7 @@ function createManagedSessionHost(options) {
|
|
|
76364
76512
|
logFd = fs43.openSync(path45.join(logDir, "session-host.log"), "a");
|
|
76365
76513
|
stdio = ["ignore", logFd, logFd];
|
|
76366
76514
|
}
|
|
76367
|
-
const child = (0,
|
|
76515
|
+
const child = (0, import_child_process14.spawn)(nodeExecutable, [entry], {
|
|
76368
76516
|
detached: true,
|
|
76369
76517
|
stdio,
|
|
76370
76518
|
windowsHide: true,
|
|
@@ -76466,7 +76614,7 @@ function shouldAutoRestoreHostedSessionsOnStartup(env = process.env) {
|
|
|
76466
76614
|
}
|
|
76467
76615
|
|
|
76468
76616
|
// src/installer.ts
|
|
76469
|
-
var
|
|
76617
|
+
var import_child_process15 = require("child_process");
|
|
76470
76618
|
var import_util3 = require("util");
|
|
76471
76619
|
var EXTENSION_CATALOG = [
|
|
76472
76620
|
// AI Agent extensions
|
|
@@ -76554,7 +76702,7 @@ var EXTENSION_CATALOG = [
|
|
|
76554
76702
|
apiKeyName: "OpenAI/Anthropic API key"
|
|
76555
76703
|
}
|
|
76556
76704
|
];
|
|
76557
|
-
var execAsync4 = (0, import_util3.promisify)(
|
|
76705
|
+
var execAsync4 = (0, import_util3.promisify)(import_child_process15.exec);
|
|
76558
76706
|
async function isExtensionInstalled(ide, marketplaceId) {
|
|
76559
76707
|
if (!ide.cliCommand) return false;
|
|
76560
76708
|
try {
|
|
@@ -76598,7 +76746,7 @@ async function installExtension(ide, extension) {
|
|
|
76598
76746
|
fs44.writeFileSync(vsixPath, buffer);
|
|
76599
76747
|
return new Promise((resolve28) => {
|
|
76600
76748
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
76601
|
-
(0,
|
|
76749
|
+
(0, import_child_process15.exec)(cmd, { timeout: 6e4 }, (error, _stdout, stderr) => {
|
|
76602
76750
|
resolve28({
|
|
76603
76751
|
extensionId: extension.id,
|
|
76604
76752
|
marketplaceId: extension.marketplaceId,
|
|
@@ -76614,7 +76762,7 @@ async function installExtension(ide, extension) {
|
|
|
76614
76762
|
}
|
|
76615
76763
|
return new Promise((resolve28) => {
|
|
76616
76764
|
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
76617
|
-
(0,
|
|
76765
|
+
(0, import_child_process15.exec)(cmd, { timeout: 6e4 }, (error, stdout, stderr) => {
|
|
76618
76766
|
if (error) {
|
|
76619
76767
|
resolve28({
|
|
76620
76768
|
extensionId: extension.id,
|
|
@@ -76651,7 +76799,7 @@ function launchIDE(ide, workspacePath) {
|
|
|
76651
76799
|
if (!ide.cliCommand) return false;
|
|
76652
76800
|
try {
|
|
76653
76801
|
const args = workspacePath ? `"${workspacePath}"` : "";
|
|
76654
|
-
(0,
|
|
76802
|
+
(0, import_child_process15.exec)(`"${ide.cliCommand}" ${args}`, { timeout: 1e4 });
|
|
76655
76803
|
return true;
|
|
76656
76804
|
} catch {
|
|
76657
76805
|
return false;
|
|
@@ -77511,6 +77659,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
77511
77659
|
getActiveMeshMissionSummaries,
|
|
77512
77660
|
getActiveSessionDeliveries,
|
|
77513
77661
|
getAvailableIdeIds,
|
|
77662
|
+
getConfigDir,
|
|
77514
77663
|
getCoordinatorForSession,
|
|
77515
77664
|
getCurrentDaemonLogPath,
|
|
77516
77665
|
getDaemonBuildInfo,
|
|
@@ -77687,6 +77836,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
77687
77836
|
resolveDeliveryDecision,
|
|
77688
77837
|
resolveEffectiveMeshNodeHealth,
|
|
77689
77838
|
resolveGitRepository,
|
|
77839
|
+
resolveInstanceDir,
|
|
77690
77840
|
resolveMagiSessionCleanupMode,
|
|
77691
77841
|
resolveMaxParallelTasks,
|
|
77692
77842
|
resolveMeshHostStatus,
|