@adhdev/daemon-core 0.9.82-rc.301 → 0.9.82-rc.302

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.mjs CHANGED
@@ -288,10 +288,10 @@ function readInjected(value) {
288
288
  }
289
289
  function getDaemonBuildInfo() {
290
290
  if (cached) return cached;
291
- const commit = readInjected(true ? "72f1b6e675346bbc37de202b195675150ebb3d82" : void 0) ?? "unknown";
292
- const commitShort = readInjected(true ? "72f1b6e6" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
293
- const version = readInjected(true ? "0.9.82-rc.301" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
294
- const builtAt = readInjected(true ? "2026-06-16T23:37:22.009Z" : void 0);
291
+ const commit = readInjected(true ? "850c147fda8183e55c145fcef876d2c25a22c8d2" : void 0) ?? "unknown";
292
+ const commitShort = readInjected(true ? "850c147f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
293
+ const version = readInjected(true ? "0.9.82-rc.302" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
294
+ const builtAt = readInjected(true ? "2026-06-17T02:29:22.806Z" : void 0);
295
295
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
296
296
  return cached;
297
297
  }
@@ -633,12 +633,12 @@ function parseSubmoduleStatusOutput(output, repoRoot, ignorePaths) {
633
633
  if (!match) continue;
634
634
  const prefix = match[1];
635
635
  const commit = match[2];
636
- const path40 = match[3];
637
- if (ignoreSet.has(path40)) continue;
636
+ const path41 = match[3];
637
+ if (ignoreSet.has(path41)) continue;
638
638
  submodules.push({
639
- path: path40,
639
+ path: path41,
640
640
  commit,
641
- repoPath: repoRoot + "/" + path40,
641
+ repoPath: repoRoot + "/" + path41,
642
642
  dirty: prefix === "U",
643
643
  outOfSync: prefix === "-" || prefix === "+",
644
644
  lastCheckedAt: Date.now()
@@ -1463,10 +1463,10 @@ function getMeshConfigPath() {
1463
1463
  return join4(getConfigDir(), "meshes.json");
1464
1464
  }
1465
1465
  function loadMeshConfig() {
1466
- const path40 = getMeshConfigPath();
1467
- if (!existsSync4(path40)) return { meshes: [] };
1466
+ const path41 = getMeshConfigPath();
1467
+ if (!existsSync4(path41)) return { meshes: [] };
1468
1468
  try {
1469
- const raw = JSON.parse(readFileSync2(path40, "utf-8"));
1469
+ const raw = JSON.parse(readFileSync2(path41, "utf-8"));
1470
1470
  if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
1471
1471
  return raw;
1472
1472
  } catch {
@@ -1484,16 +1484,16 @@ function normalizeCapabilityTags(value) {
1484
1484
  return tags.length ? tags : void 0;
1485
1485
  }
1486
1486
  function saveMeshConfig(config) {
1487
- const path40 = getMeshConfigPath();
1488
- writeFileSync2(path40, JSON.stringify(config, null, 2), { encoding: "utf-8", mode: 384 });
1487
+ const path41 = getMeshConfigPath();
1488
+ writeFileSync2(path41, JSON.stringify(config, null, 2), { encoding: "utf-8", mode: 384 });
1489
1489
  }
1490
1490
  function normalizeRepoIdentity(remoteUrl) {
1491
1491
  let identity = remoteUrl.trim();
1492
1492
  if (identity.startsWith("http://") || identity.startsWith("https://")) {
1493
1493
  try {
1494
1494
  const url = new URL(identity);
1495
- const path40 = url.pathname.replace(/^\//, "").replace(/\.git$/, "");
1496
- return `${url.hostname}/${path40}`;
1495
+ const path41 = url.pathname.replace(/^\//, "").replace(/\.git$/, "");
1496
+ return `${url.hostname}/${path41}`;
1497
1497
  } catch {
1498
1498
  }
1499
1499
  }
@@ -2176,10 +2176,10 @@ function rotateArchiveFile(meshId, archivePath) {
2176
2176
  }
2177
2177
  }
2178
2178
  function readArchivedCounts(meshId) {
2179
- const path40 = getArchivedCountsPath(meshId);
2180
- if (!existsSync5(path40)) return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
2179
+ const path41 = getArchivedCountsPath(meshId);
2180
+ if (!existsSync5(path41)) return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
2181
2181
  try {
2182
- return JSON.parse(readFileSync4(path40, "utf-8"));
2182
+ return JSON.parse(readFileSync4(path41, "utf-8"));
2183
2183
  } catch {
2184
2184
  return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
2185
2185
  }
@@ -3579,10 +3579,10 @@ var init_mesh_runtime_store = __esm({
3579
3579
  this.migratedMeshIds.add(meshId);
3580
3580
  const count = this.db.prepare("SELECT COUNT(*) AS count FROM mesh_queue WHERE mesh_id = ?").get(meshId);
3581
3581
  if (count.count > 0) return;
3582
- const path40 = legacyQueuePath(meshId);
3583
- if (!existsSync6(path40)) return;
3582
+ const path41 = legacyQueuePath(meshId);
3583
+ if (!existsSync6(path41)) return;
3584
3584
  try {
3585
- const entries = JSON.parse(readFileSync5(path40, "utf-8"));
3585
+ const entries = JSON.parse(readFileSync5(path41, "utf-8"));
3586
3586
  if (!Array.isArray(entries)) return;
3587
3587
  const insert = this.db.prepare(`
3588
3588
  INSERT OR REPLACE INTO mesh_queue (
@@ -5340,8 +5340,8 @@ function resolveMeshCoordinatorSetup(options) {
5340
5340
  }
5341
5341
  const serverName = mcpConfig.serverName?.trim() || DEFAULT_SERVER_NAME;
5342
5342
  if (mcpConfig.mode === "auto_import") {
5343
- const path40 = mcpConfig.path?.trim();
5344
- if (!path40) {
5343
+ const path41 = mcpConfig.path?.trim();
5344
+ if (!path41) {
5345
5345
  return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
5346
5346
  }
5347
5347
  const mcpServer = resolveAdhdevMcpServerLaunch({
@@ -5361,7 +5361,7 @@ function resolveMeshCoordinatorSetup(options) {
5361
5361
  return {
5362
5362
  kind: "auto_import",
5363
5363
  serverName,
5364
- configPath: resolveMcpConfigPath(path40, workspace),
5364
+ configPath: resolveMcpConfigPath(path41, workspace),
5365
5365
  configFormat: mcpConfig.format,
5366
5366
  mcpServer
5367
5367
  };
@@ -6369,12 +6369,12 @@ function readGitSubmodules(value, parentRepoRoot) {
6369
6369
  if (!Array.isArray(value)) return void 0;
6370
6370
  const submodules = value.map((entry) => {
6371
6371
  const submodule = readRecord3(entry);
6372
- const path40 = readString5(submodule.path);
6372
+ const path41 = readString5(submodule.path);
6373
6373
  const commit = readString5(submodule.commit);
6374
- const repoPath = readString5(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path40);
6375
- if (!path40 || !commit) return null;
6374
+ const repoPath = readString5(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path41);
6375
+ if (!path41 || !commit) return null;
6376
6376
  const result = {
6377
- path: path40,
6377
+ path: path41,
6378
6378
  commit,
6379
6379
  dirty: readBoolean(submodule.dirty) ?? false,
6380
6380
  outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
@@ -6776,10 +6776,10 @@ function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
6776
6776
  const primaryDaemonId = daemonIds[0];
6777
6777
  const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
6778
6778
  const events = [];
6779
- for (const path40 of paths) {
6780
- if (!existsSync12(path40)) continue;
6779
+ for (const path41 of paths) {
6780
+ if (!existsSync12(path41)) continue;
6781
6781
  try {
6782
- const raw = readFileSync10(path40, "utf-8");
6782
+ const raw = readFileSync10(path41, "utf-8");
6783
6783
  const parsed = raw.split("\n").filter(Boolean).flatMap((line) => {
6784
6784
  try {
6785
6785
  return [JSON.parse(line)];
@@ -6787,7 +6787,7 @@ function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
6787
6787
  return [];
6788
6788
  }
6789
6789
  });
6790
- const filtered = primaryDaemonId && path40 === getPendingEventsPath(meshId) ? parsed.filter((e) => !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId)) : parsed;
6790
+ const filtered = primaryDaemonId && path41 === getPendingEventsPath(meshId) ? parsed.filter((e) => !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId)) : parsed;
6791
6791
  events.push(...filtered);
6792
6792
  } catch {
6793
6793
  }
@@ -6852,13 +6852,13 @@ function reconcilePendingMeshCoordinatorEvents(meshId, events) {
6852
6852
  const reconciled = terminalJobIds.size === 0 ? events : events.filter((event) => !(event.event === "refine:accepted" && terminalJobIds.has(readRefineJobId2(event))));
6853
6853
  return backfilled.length === 0 ? reconciled : [...reconciled, ...backfilled];
6854
6854
  }
6855
- function trimPendingEventsIfNeeded(path40) {
6855
+ function trimPendingEventsIfNeeded(path41) {
6856
6856
  try {
6857
- if (!existsSync12(path40)) return;
6858
- if (statSync5(path40).size <= MAX_PENDING_EVENTS_BYTES) return;
6859
- const lines = readFileSync10(path40, "utf-8").split("\n").filter(Boolean);
6857
+ if (!existsSync12(path41)) return;
6858
+ if (statSync5(path41).size <= MAX_PENDING_EVENTS_BYTES) return;
6859
+ const lines = readFileSync10(path41, "utf-8").split("\n").filter(Boolean);
6860
6860
  if (lines.length <= MAX_PENDING_EVENTS_KEEP) return;
6861
- writeFileSync6(path40, lines.slice(-MAX_PENDING_EVENTS_KEEP).join("\n") + "\n", "utf-8");
6861
+ writeFileSync6(path41, lines.slice(-MAX_PENDING_EVENTS_KEEP).join("\n") + "\n", "utf-8");
6862
6862
  } catch {
6863
6863
  }
6864
6864
  }
@@ -6885,19 +6885,19 @@ function queuePendingMeshCoordinatorEvent(event) {
6885
6885
  });
6886
6886
  } catch {
6887
6887
  }
6888
- const path40 = getPendingEventsPath(event.meshId, event.targetCoordinatorDaemonId);
6889
- trimPendingEventsIfNeeded(path40);
6890
- appendFileSync2(path40, JSON.stringify(event) + "\n", "utf-8");
6888
+ const path41 = getPendingEventsPath(event.meshId, event.targetCoordinatorDaemonId);
6889
+ trimPendingEventsIfNeeded(path41);
6890
+ appendFileSync2(path41, JSON.stringify(event) + "\n", "utf-8");
6891
6891
  return true;
6892
6892
  } catch (e) {
6893
6893
  LOG.warn("MeshEvents", `Failed to persist pending coordinator event: ${e?.message || e}`);
6894
6894
  return false;
6895
6895
  }
6896
6896
  }
6897
- function atomicDrainFile(path40) {
6898
- const tmpPath = `${path40}.draining`;
6897
+ function atomicDrainFile(path41) {
6898
+ const tmpPath = `${path41}.draining`;
6899
6899
  try {
6900
- renameSync4(path40, tmpPath);
6900
+ renameSync4(path41, tmpPath);
6901
6901
  } catch {
6902
6902
  return null;
6903
6903
  }
@@ -6916,10 +6916,10 @@ function atomicDrainFile(path40) {
6916
6916
  return null;
6917
6917
  }
6918
6918
  }
6919
- function selectiveDrainFile(path40, predicate) {
6920
- const tmpPath = `${path40}.draining`;
6919
+ function selectiveDrainFile(path41, predicate) {
6920
+ const tmpPath = `${path41}.draining`;
6921
6921
  try {
6922
- renameSync4(path40, tmpPath);
6922
+ renameSync4(path41, tmpPath);
6923
6923
  } catch {
6924
6924
  return [];
6925
6925
  }
@@ -6951,12 +6951,12 @@ function selectiveDrainFile(path40, predicate) {
6951
6951
  }
6952
6952
  try {
6953
6953
  if (keptLines.length > 0) {
6954
- writeFileSync6(path40, keptLines.join("\n") + "\n", "utf-8");
6954
+ writeFileSync6(path41, keptLines.join("\n") + "\n", "utf-8");
6955
6955
  }
6956
6956
  unlinkSync2(tmpPath);
6957
6957
  } catch {
6958
6958
  try {
6959
- if (existsSync12(tmpPath) && !existsSync12(path40)) renameSync4(tmpPath, path40);
6959
+ if (existsSync12(tmpPath) && !existsSync12(path41)) renameSync4(tmpPath, path41);
6960
6960
  } catch {
6961
6961
  }
6962
6962
  return [];
@@ -6990,16 +6990,16 @@ function drainPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId, opts) {
6990
6990
  } catch {
6991
6991
  }
6992
6992
  const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
6993
- for (const path40 of paths) {
6994
- const isSharedFile = !!primaryDaemonId && path40 === getPendingEventsPath(meshId);
6993
+ for (const path41 of paths) {
6994
+ const isSharedFile = !!primaryDaemonId && path41 === getPendingEventsPath(meshId);
6995
6995
  const targets = (e) => !isSharedFile || !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId);
6996
6996
  if (onlyEvents) {
6997
- for (const event of selectiveDrainFile(path40, (e) => targets(e) && matchesFilter(e.event))) {
6997
+ for (const event of selectiveDrainFile(path41, (e) => targets(e) && matchesFilter(e.event))) {
6998
6998
  pushUnique(event);
6999
6999
  }
7000
7000
  continue;
7001
7001
  }
7002
- const content = atomicDrainFile(path40);
7002
+ const content = atomicDrainFile(path41);
7003
7003
  if (!content) continue;
7004
7004
  const parsed = content.split("\n").filter(Boolean).flatMap((line) => {
7005
7005
  try {
@@ -7049,9 +7049,9 @@ function clearPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId) {
7049
7049
  } catch {
7050
7050
  }
7051
7051
  const paths = coordinatorDaemonId ? [getPendingEventsPath(meshId, coordinatorDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
7052
- for (const path40 of paths) {
7053
- if (existsSync12(path40)) try {
7054
- unlinkSync2(path40);
7052
+ for (const path41 of paths) {
7053
+ if (existsSync12(path41)) try {
7054
+ unlinkSync2(path41);
7055
7055
  } catch {
7056
7056
  }
7057
7057
  }
@@ -10060,7 +10060,7 @@ function getCliValidator() {
10060
10060
  return _cliValidator;
10061
10061
  }
10062
10062
  function formatIssue(err) {
10063
- const path40 = err.instancePath || "";
10063
+ const path41 = err.instancePath || "";
10064
10064
  const params = err.params;
10065
10065
  let message = err.message || "validation failed";
10066
10066
  let allowed;
@@ -10078,7 +10078,7 @@ function formatIssue(err) {
10078
10078
  } else if (err.keyword === "type") {
10079
10079
  message = `must be ${params.type}`;
10080
10080
  }
10081
- return { path: path40, keyword: err.keyword, message, ...allowed !== void 0 ? { allowed } : {} };
10081
+ return { path: path41, keyword: err.keyword, message, ...allowed !== void 0 ? { allowed } : {} };
10082
10082
  }
10083
10083
  function validateCliProviderManifest(manifest) {
10084
10084
  const validator = getCliValidator();
@@ -10437,6 +10437,37 @@ var init_spawn_env = __esm({
10437
10437
  }
10438
10438
  });
10439
10439
 
10440
+ // src/cli-adapters/resolve-executable.ts
10441
+ import { execFileSync } from "child_process";
10442
+ import { existsSync as existsSync20 } from "fs";
10443
+ import * as path16 from "path";
10444
+ function resolveWin32Executable(command) {
10445
+ if (process.platform !== "win32") return command;
10446
+ const trimmed = (command || "").trim();
10447
+ if (!trimmed) return command;
10448
+ if (path16.isAbsolute(trimmed) && existsSync20(trimmed)) return trimmed;
10449
+ try {
10450
+ const out = execFileSync("where", [trimmed], {
10451
+ encoding: "utf8",
10452
+ windowsHide: true
10453
+ }).trim();
10454
+ if (out) {
10455
+ const matches = out.split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
10456
+ const direct = matches.find((m) => DIRECT_EXEC_EXT.has(path16.extname(m).toLowerCase()));
10457
+ return direct || matches[0] || command;
10458
+ }
10459
+ } catch {
10460
+ }
10461
+ return command;
10462
+ }
10463
+ var DIRECT_EXEC_EXT;
10464
+ var init_resolve_executable = __esm({
10465
+ "src/cli-adapters/resolve-executable.ts"() {
10466
+ "use strict";
10467
+ DIRECT_EXEC_EXT = /* @__PURE__ */ new Set([".exe", ".com"]);
10468
+ }
10469
+ });
10470
+
10440
10471
  // src/cli-adapters/pty-transport.ts
10441
10472
  var pty_transport_exports = {};
10442
10473
  __export(pty_transport_exports, {
@@ -10458,6 +10489,7 @@ var init_pty_transport = __esm({
10458
10489
  "src/cli-adapters/pty-transport.ts"() {
10459
10490
  "use strict";
10460
10491
  init_spawn_env();
10492
+ init_resolve_executable();
10461
10493
  NodePtyRuntimeTransport = class {
10462
10494
  constructor(handle) {
10463
10495
  this.handle = handle;
@@ -10500,7 +10532,7 @@ var init_pty_transport = __esm({
10500
10532
  cwd = os11.homedir();
10501
10533
  }
10502
10534
  }
10503
- const handle = pty.spawn(command, args, {
10535
+ const handle = pty.spawn(resolveWin32Executable(command), args, {
10504
10536
  name: "xterm-256color",
10505
10537
  cols: options.cols,
10506
10538
  rows: options.rows,
@@ -10515,7 +10547,7 @@ var init_pty_transport = __esm({
10515
10547
 
10516
10548
  // src/cli-adapters/provider-cli-shared.ts
10517
10549
  import * as os12 from "os";
10518
- import * as path16 from "path";
10550
+ import * as path17 from "path";
10519
10551
  function stripAnsi(str) {
10520
10552
  return str.replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, "").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
10521
10553
  }
@@ -10591,17 +10623,17 @@ function buildCliScreenSnapshot(text) {
10591
10623
  function findBinary(name) {
10592
10624
  const trimmed = String(name || "").trim();
10593
10625
  if (!trimmed) return trimmed;
10594
- const expanded = trimmed.startsWith("~") ? path16.join(os12.homedir(), trimmed.slice(1)) : trimmed;
10595
- if (path16.isAbsolute(expanded) || expanded.includes("/") || expanded.includes("\\")) {
10596
- return path16.isAbsolute(expanded) ? expanded : path16.resolve(expanded);
10626
+ const expanded = trimmed.startsWith("~") ? path17.join(os12.homedir(), trimmed.slice(1)) : trimmed;
10627
+ if (path17.isAbsolute(expanded) || expanded.includes("/") || expanded.includes("\\")) {
10628
+ return path17.isAbsolute(expanded) ? expanded : path17.resolve(expanded);
10597
10629
  }
10598
10630
  const isWin = os12.platform() === "win32";
10599
- const paths = (process.env.PATH || "").split(path16.delimiter);
10631
+ const paths = (process.env.PATH || "").split(path17.delimiter);
10600
10632
  const exes = isWin ? [".exe", ".cmd", ".bat", ""] : [""];
10601
10633
  for (const p of paths) {
10602
10634
  if (!p) continue;
10603
10635
  for (const ext of exes) {
10604
- const fullPath = path16.join(p, trimmed + ext);
10636
+ const fullPath = path17.join(p, trimmed + ext);
10605
10637
  try {
10606
10638
  const fs30 = __require("fs");
10607
10639
  if (fs30.existsSync(fullPath)) {
@@ -10617,7 +10649,7 @@ function findBinary(name) {
10617
10649
  return isWin ? `${trimmed}.cmd` : trimmed;
10618
10650
  }
10619
10651
  function isScriptBinary(binaryPath) {
10620
- if (!path16.isAbsolute(binaryPath)) return false;
10652
+ if (!path17.isAbsolute(binaryPath)) return false;
10621
10653
  try {
10622
10654
  const fs30 = __require("fs");
10623
10655
  const resolved = fs30.realpathSync(binaryPath);
@@ -10633,7 +10665,7 @@ function isScriptBinary(binaryPath) {
10633
10665
  }
10634
10666
  }
10635
10667
  function looksLikeMachOOrElf(filePath) {
10636
- if (!path16.isAbsolute(filePath)) return false;
10668
+ if (!path17.isAbsolute(filePath)) return false;
10637
10669
  try {
10638
10670
  const fs30 = __require("fs");
10639
10671
  const resolved = fs30.realpathSync(filePath);
@@ -12673,7 +12705,7 @@ var init_provider_cli_config = __esm({
12673
12705
 
12674
12706
  // src/cli-adapters/provider-cli-runtime.ts
12675
12707
  import * as os13 from "os";
12676
- import * as path17 from "path";
12708
+ import * as path18 from "path";
12677
12709
  import { DEFAULT_SESSION_HOST_COLS as DEFAULT_SESSION_HOST_COLS3, DEFAULT_SESSION_HOST_ROWS as DEFAULT_SESSION_HOST_ROWS3 } from "@adhdev/session-host-core";
12678
12710
  function resolveCliSpawnPlan(options) {
12679
12711
  const { provider, runtimeSettings, workingDir, extraArgs, extraEnv } = options;
@@ -12686,9 +12718,9 @@ function resolveCliSpawnPlan(options) {
12686
12718
  );
12687
12719
  let shellCmd;
12688
12720
  let shellArgs;
12689
- const useShellUnix = !isWin && (!!spawnConfig.shell || !path17.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
12721
+ const useShellUnix = !isWin && (!!spawnConfig.shell || !path18.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
12690
12722
  const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
12691
- const useShellWin = !!spawnConfig.shell || isCmdShim || !path17.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
12723
+ const useShellWin = !!spawnConfig.shell || isCmdShim || !path18.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
12692
12724
  const useShell = isWin ? useShellWin : useShellUnix;
12693
12725
  if (useShell) {
12694
12726
  shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
@@ -14951,40 +14983,40 @@ function validateFsmSpec(raw) {
14951
14983
  }
14952
14984
  return errs;
14953
14985
  }
14954
- function validateCondition(c, sectionIds, path40) {
14986
+ function validateCondition(c, sectionIds, path41) {
14955
14987
  const errs = [];
14956
14988
  const w = c;
14957
14989
  if ("all" in w) {
14958
- w.all.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path40}.all[${i}]`)));
14990
+ w.all.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path41}.all[${i}]`)));
14959
14991
  return errs;
14960
14992
  }
14961
14993
  if ("any" in w) {
14962
- w.any.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path40}.any[${i}]`)));
14994
+ w.any.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path41}.any[${i}]`)));
14963
14995
  return errs;
14964
14996
  }
14965
14997
  if ("not" in w) {
14966
- errs.push(...validateCondition(w.not, sectionIds, `${path40}.not`));
14998
+ errs.push(...validateCondition(w.not, sectionIds, `${path41}.not`));
14967
14999
  return errs;
14968
15000
  }
14969
15001
  if ("matches" in w) {
14970
- if (w.section && !sectionIds.has(w.section)) errs.push(`${path40}.section "${w.section}" unknown`);
15002
+ if (w.section && !sectionIds.has(w.section)) errs.push(`${path41}.section "${w.section}" unknown`);
14971
15003
  try {
14972
15004
  new RegExp(w.matches, w.flags ?? "i");
14973
15005
  } catch (e) {
14974
- errs.push(`${path40}.matches invalid regex: ${e.message}`);
15006
+ errs.push(`${path41}.matches invalid regex: ${e.message}`);
14975
15007
  }
14976
15008
  return errs;
14977
15009
  }
14978
15010
  if ("cursor_above" in w && "changed" in w) return errs;
14979
15011
  if ("elapsed_ms" in w) {
14980
- if (typeof w.elapsed_ms !== "number") errs.push(`${path40}.elapsed_ms must be a number`);
15012
+ if (typeof w.elapsed_ms !== "number") errs.push(`${path41}.elapsed_ms must be a number`);
14981
15013
  return errs;
14982
15014
  }
14983
15015
  if ("stable_ms" in w) {
14984
- if (typeof w.stable_ms !== "number") errs.push(`${path40}.stable_ms must be a number`);
15016
+ if (typeof w.stable_ms !== "number") errs.push(`${path41}.stable_ms must be a number`);
14985
15017
  return errs;
14986
15018
  }
14987
- errs.push(`${path40} is not a recognized condition`);
15019
+ errs.push(`${path41} is not a recognized condition`);
14988
15020
  return errs;
14989
15021
  }
14990
15022
  var init_fsm_loader = __esm({
@@ -15005,7 +15037,7 @@ __export(require_whitelist_exports, {
15005
15037
  registerProviderScriptRoot: () => registerProviderScriptRoot,
15006
15038
  unregisterProviderScriptRoot: () => unregisterProviderScriptRoot
15007
15039
  });
15008
- import * as path30 from "path";
15040
+ import * as path31 from "path";
15009
15041
  import { createRequire as createRequire3 } from "module";
15010
15042
  import * as nodeFs from "fs";
15011
15043
  import * as nodeChildProcess from "child_process";
@@ -15146,7 +15178,7 @@ function _getRegisteredRoots() {
15146
15178
  }
15147
15179
  function canonicalize(p) {
15148
15180
  try {
15149
- const resolved = path30.resolve(p);
15181
+ const resolved = path31.resolve(p);
15150
15182
  try {
15151
15183
  return nodeFs.realpathSync.native ? nodeFs.realpathSync.native(resolved) : nodeFs.realpathSync(resolved);
15152
15184
  } catch {
@@ -15166,7 +15198,7 @@ function isCallerInsideGatedRoot(callerFilename) {
15166
15198
  }
15167
15199
  for (const root of _gatedRoots) {
15168
15200
  if (normalized === root.rootPath) return root;
15169
- if (normalized.startsWith(root.rootPath + path30.sep)) return root;
15201
+ if (normalized.startsWith(root.rootPath + path31.sep)) return root;
15170
15202
  }
15171
15203
  return null;
15172
15204
  }
@@ -15185,16 +15217,16 @@ function ensureInstalled() {
15185
15217
  };
15186
15218
  }
15187
15219
  function gatedRequire(request, parent, isMain, gated, originalLoad) {
15188
- if (request.startsWith("./") || request.startsWith("../") || path30.isAbsolute(request)) {
15220
+ if (request.startsWith("./") || request.startsWith("../") || path31.isAbsolute(request)) {
15189
15221
  let resolved;
15190
15222
  try {
15191
- const callerRequire = parent?.filename ? createRequire3(parent.filename) : createRequire3(path30.join(gated.rootPath, "__entry__.js"));
15223
+ const callerRequire = parent?.filename ? createRequire3(parent.filename) : createRequire3(path31.join(gated.rootPath, "__entry__.js"));
15192
15224
  resolved = callerRequire.resolve(request);
15193
15225
  } catch {
15194
15226
  return originalLoad.call(this, request, parent, isMain);
15195
15227
  }
15196
15228
  const resolvedCanon = canonicalize(resolved) || resolved;
15197
- if (!(resolvedCanon === gated.rootPath || resolvedCanon.startsWith(gated.rootPath + path30.sep))) {
15229
+ if (!(resolvedCanon === gated.rootPath || resolvedCanon.startsWith(gated.rootPath + path31.sep))) {
15198
15230
  denyRequire(request, parent, `relative path escapes provider root (resolved to ${resolvedCanon})`);
15199
15231
  }
15200
15232
  return originalLoad.call(this, request, parent, isMain);
@@ -17065,10 +17097,10 @@ function getRegistryPath() {
17065
17097
  return join10(getDaemonDataDir(), "mesh-coordinators.json");
17066
17098
  }
17067
17099
  function loadMeshCoordinatorRegistry() {
17068
- const path40 = getRegistryPath();
17069
- if (!existsSync9(path40)) return;
17100
+ const path41 = getRegistryPath();
17101
+ if (!existsSync9(path41)) return;
17070
17102
  try {
17071
- const raw = JSON.parse(readFileSync7(path40, "utf-8"));
17103
+ const raw = JSON.parse(readFileSync7(path41, "utf-8"));
17072
17104
  if (!Array.isArray(raw)) return;
17073
17105
  _registry.clear();
17074
17106
  for (const entry of raw) {
@@ -17306,8 +17338,8 @@ function validateMeshRefineConfig(config, source = "inline") {
17306
17338
  if (rejectedCommands.length) errors.push("one or more validation commands are invalid");
17307
17339
  return { valid: errors.length === 0, errors, bootstrapCommands, commands, rejectedCommands, bootstrapMode, deprecationWarnings };
17308
17340
  }
17309
- function parseConfigText(path40, text) {
17310
- if (/\.json$/i.test(path40)) return JSON.parse(text);
17341
+ function parseConfigText(path41, text) {
17342
+ if (/\.json$/i.test(path41)) return JSON.parse(text);
17311
17343
  return yaml.load(text);
17312
17344
  }
17313
17345
  function loadMeshRefineConfig(mesh, workspace) {
@@ -17465,8 +17497,8 @@ var MESH_WORKTREE_BOOTSTRAP_CONFIG_SCHEMA = {
17465
17497
  var DEFAULT_TIMEOUT_MS2 = 12e4;
17466
17498
  var DEFAULT_OUTPUT_LIMIT_BYTES = 128 * 1024;
17467
17499
  var OUTPUT_SUMMARY_CHARS = 2e3;
17468
- function parseConfigText2(path40, text) {
17469
- if (/\.json$/i.test(path40)) return JSON.parse(text);
17500
+ function parseConfigText2(path41, text) {
17501
+ if (/\.json$/i.test(path41)) return JSON.parse(text);
17470
17502
  return yaml2.load(text);
17471
17503
  }
17472
17504
  function truncateOutput(value) {
@@ -29194,8 +29226,8 @@ var DaemonCommandHandler = class {
29194
29226
  */
29195
29227
  getUpstreamInstallRoot() {
29196
29228
  const os30 = __require("os");
29197
- const path40 = __require("path");
29198
- return path40.join(os30.homedir(), ".adhdev", "providers", ".upstream");
29229
+ const path41 = __require("path");
29230
+ return path41.join(os30.homedir(), ".adhdev", "providers", ".upstream");
29199
29231
  }
29200
29232
  /**
29201
29233
  * Download a single provider manifest from the registry and write it to
@@ -29220,7 +29252,7 @@ var DaemonCommandHandler = class {
29220
29252
  }
29221
29253
  const https = __require("https");
29222
29254
  const fs30 = __require("fs");
29223
- const path40 = __require("path");
29255
+ const path41 = __require("path");
29224
29256
  const crypto6 = __require("crypto");
29225
29257
  const REGISTRY = "https://api.adhf.dev/api/v1/registry";
29226
29258
  function fetchText(url, timeoutMs) {
@@ -29258,9 +29290,9 @@ var DaemonCommandHandler = class {
29258
29290
  return { success: false, error: `checksum mismatch: expected ${meta.checksum}, got ${actualChecksum}` };
29259
29291
  }
29260
29292
  const installRoot = this.getUpstreamInstallRoot();
29261
- const installRootResolved = path40.resolve(installRoot);
29262
- const targetDir = path40.resolve(path40.join(installRoot, category, type));
29263
- if (!targetDir.startsWith(installRootResolved + path40.sep)) {
29293
+ const installRootResolved = path41.resolve(installRoot);
29294
+ const targetDir = path41.resolve(path41.join(installRoot, category, type));
29295
+ if (!targetDir.startsWith(installRootResolved + path41.sep)) {
29264
29296
  return { success: false, error: "install path escaped upstream root" };
29265
29297
  }
29266
29298
  fs30.mkdirSync(targetDir, { recursive: true });
@@ -29287,7 +29319,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29287
29319
  }
29288
29320
  }
29289
29321
  const targetFile = isV1 ? "provider.v1.json" : "provider.json";
29290
- const targetPath = path40.join(targetDir, targetFile);
29322
+ const targetPath = path41.join(targetDir, targetFile);
29291
29323
  fs30.writeFileSync(targetPath, manifestBody, "utf-8");
29292
29324
  const manifestJson = JSON.parse(manifestBody);
29293
29325
  const scriptFetch = await this.fetchProviderSources(
@@ -29359,7 +29391,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29359
29391
  const ref = source.ref;
29360
29392
  const https = __require("https");
29361
29393
  const fs30 = __require("fs");
29362
- const path40 = __require("path");
29394
+ const path41 = __require("path");
29363
29395
  function fetchJson(url, timeoutMs) {
29364
29396
  return new Promise((resolve24, reject) => {
29365
29397
  const req = https.get(url, {
@@ -29415,9 +29447,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29415
29447
  }
29416
29448
  let fetchedCount = 0;
29417
29449
  const sharedDirRel = `${category}/_shared`;
29418
- const sharedTargetDir = path40.resolve(path40.join(targetDir, "../_shared"));
29419
- const installRootResolved = path40.resolve(path40.join(targetDir, "../.."));
29420
- if (sharedTargetDir.startsWith(installRootResolved + path40.sep)) {
29450
+ const sharedTargetDir = path41.resolve(path41.join(targetDir, "../_shared"));
29451
+ const installRootResolved = path41.resolve(path41.join(targetDir, "../.."));
29452
+ if (sharedTargetDir.startsWith(installRootResolved + path41.sep)) {
29421
29453
  const sharedStack = [sharedDirRel];
29422
29454
  while (sharedStack.length) {
29423
29455
  const relDir = sharedStack.pop();
@@ -29440,9 +29472,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29440
29472
  try {
29441
29473
  const body = await fetchBinary(entry.download_url, 3e4);
29442
29474
  const relInside = entry.path.startsWith(sharedDirRel + "/") ? entry.path.slice(sharedDirRel.length + 1) : entry.path;
29443
- const outPath = path40.resolve(path40.join(sharedTargetDir, relInside));
29444
- if (!outPath.startsWith(path40.resolve(sharedTargetDir) + path40.sep)) continue;
29445
- fs30.mkdirSync(path40.dirname(outPath), { recursive: true });
29475
+ const outPath = path41.resolve(path41.join(sharedTargetDir, relInside));
29476
+ if (!outPath.startsWith(path41.resolve(sharedTargetDir) + path41.sep)) continue;
29477
+ fs30.mkdirSync(path41.dirname(outPath), { recursive: true });
29446
29478
  fs30.writeFileSync(outPath, body);
29447
29479
  fetchedCount++;
29448
29480
  } catch (e) {
@@ -29476,12 +29508,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29476
29508
  try {
29477
29509
  const body = await fetchBinary(entry.download_url, 3e4);
29478
29510
  const relInsideProvider = entry.path.startsWith(subdir + "/") ? entry.path.slice(subdir.length + 1) : entry.path;
29479
- const outPath = path40.resolve(path40.join(targetDir, relInsideProvider));
29480
- if (!outPath.startsWith(path40.resolve(targetDir) + path40.sep)) {
29511
+ const outPath = path41.resolve(path41.join(targetDir, relInsideProvider));
29512
+ if (!outPath.startsWith(path41.resolve(targetDir) + path41.sep)) {
29481
29513
  errors.push(`refusing to write outside targetDir: ${entry.path}`);
29482
29514
  continue;
29483
29515
  }
29484
- fs30.mkdirSync(path40.dirname(outPath), { recursive: true });
29516
+ fs30.mkdirSync(path41.dirname(outPath), { recursive: true });
29485
29517
  fs30.writeFileSync(outPath, body);
29486
29518
  fetchedCount++;
29487
29519
  } catch (e) {
@@ -29511,12 +29543,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29511
29543
  return { success: false, error: `unknown category: ${category}` };
29512
29544
  }
29513
29545
  const fs30 = __require("fs");
29514
- const path40 = __require("path");
29546
+ const path41 = __require("path");
29515
29547
  try {
29516
29548
  const installRoot = this.getUpstreamInstallRoot();
29517
- const installRootResolved = path40.resolve(installRoot);
29518
- const targetDir = path40.resolve(path40.join(installRoot, category, type));
29519
- if (!targetDir.startsWith(installRootResolved + path40.sep)) {
29549
+ const installRootResolved = path41.resolve(installRoot);
29550
+ const targetDir = path41.resolve(path41.join(installRoot, category, type));
29551
+ if (!targetDir.startsWith(installRootResolved + path41.sep)) {
29520
29552
  return { success: false, error: "refusing to delete outside upstream root" };
29521
29553
  }
29522
29554
  if (!fs30.existsSync(targetDir)) {
@@ -29539,13 +29571,13 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29539
29571
  */
29540
29572
  handleListInstalledProviders(_args) {
29541
29573
  const fs30 = __require("fs");
29542
- const path40 = __require("path");
29574
+ const path41 = __require("path");
29543
29575
  const installRoot = this.getUpstreamInstallRoot();
29544
29576
  if (!fs30.existsSync(installRoot)) return { success: true, providers: [] };
29545
29577
  const CATEGORIES = ["cli", "ide", "extension", "acp"];
29546
29578
  const items = [];
29547
29579
  for (const category of CATEGORIES) {
29548
- const categoryDir = path40.join(installRoot, category);
29580
+ const categoryDir = path41.join(installRoot, category);
29549
29581
  if (!fs30.existsSync(categoryDir)) continue;
29550
29582
  let entries;
29551
29583
  try {
@@ -29554,8 +29586,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29554
29586
  continue;
29555
29587
  }
29556
29588
  for (const type of entries) {
29557
- const v1Path = path40.join(categoryDir, type, "provider.v1.json");
29558
- const v0Path = path40.join(categoryDir, type, "provider.json");
29589
+ const v1Path = path41.join(categoryDir, type, "provider.v1.json");
29590
+ const v0Path = path41.join(categoryDir, type, "provider.json");
29559
29591
  const manifestPath = fs30.existsSync(v1Path) ? v1Path : fs30.existsSync(v0Path) ? v0Path : null;
29560
29592
  if (!manifestPath) continue;
29561
29593
  try {
@@ -29671,7 +29703,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29671
29703
  return { success: false, error: "name must match @[a-z0-9_-]+" };
29672
29704
  }
29673
29705
  const fs30 = __require("fs");
29674
- const path40 = __require("path");
29706
+ const path41 = __require("path");
29675
29707
  const { spawnSync: spawnSync2 } = __require("child_process");
29676
29708
  const file = ext.loadExternalSources();
29677
29709
  if (file.sources.some((s) => s.name === requestedName)) {
@@ -29680,7 +29712,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29680
29712
  if (file.sources.some((s) => s.url === url && s.ref === ref)) {
29681
29713
  return { success: false, error: `source url+ref already registered (use a different name to track another ref)` };
29682
29714
  }
29683
- const sourceDir = path40.join(ext.externalRoot(), requestedName);
29715
+ const sourceDir = path41.join(ext.externalRoot(), requestedName);
29684
29716
  if (!fs30.existsSync(ext.externalRoot())) fs30.mkdirSync(ext.externalRoot(), { recursive: true });
29685
29717
  if (fs30.existsSync(sourceDir)) {
29686
29718
  return { success: false, error: `directory already exists: ${sourceDir} (rename or remove first)` };
@@ -29737,11 +29769,11 @@ ${formatManifestValidationIssues2(validation.issues)}`,
29737
29769
  if (!name) return { success: false, error: "name is required" };
29738
29770
  const ext = (init_external_sources(), __toCommonJS(external_sources_exports));
29739
29771
  const fs30 = __require("fs");
29740
- const path40 = __require("path");
29772
+ const path41 = __require("path");
29741
29773
  const file = ext.loadExternalSources();
29742
29774
  const match = file.sources.find((s) => s.name === name);
29743
29775
  if (!match) return { success: false, error: `source "${name}" not registered` };
29744
- const sourceDir = path40.join(ext.externalRoot(), name);
29776
+ const sourceDir = path41.join(ext.externalRoot(), name);
29745
29777
  if (fs30.existsSync(sourceDir)) {
29746
29778
  try {
29747
29779
  fs30.rmSync(sourceDir, { recursive: true, force: true });
@@ -29922,15 +29954,15 @@ init_provider_cli_adapter();
29922
29954
  init_cli_detector();
29923
29955
  init_config();
29924
29956
  import * as os19 from "os";
29925
- import * as path24 from "path";
29957
+ import * as path25 from "path";
29926
29958
  import * as crypto5 from "crypto";
29927
- import { existsSync as existsSync24, mkdirSync as mkdirSync12, writeFileSync as writeFileSync15 } from "fs";
29928
- import { execFileSync } from "child_process";
29959
+ import { existsSync as existsSync25, mkdirSync as mkdirSync12, writeFileSync as writeFileSync15 } from "fs";
29960
+ import { execFileSync as execFileSync2 } from "child_process";
29929
29961
  import chalk from "chalk";
29930
29962
 
29931
29963
  // src/providers/cli-provider-instance.ts
29932
29964
  import * as os18 from "os";
29933
- import * as path22 from "path";
29965
+ import * as path23 from "path";
29934
29966
  import * as crypto4 from "crypto";
29935
29967
  import * as fs15 from "fs";
29936
29968
  import { createRequire as createRequire2 } from "module";
@@ -29938,12 +29970,12 @@ import { createRequire as createRequire2 } from "module";
29938
29970
  // src/providers/spec/route.ts
29939
29971
  init_provider_cli_adapter();
29940
29972
  import * as fs14 from "fs";
29941
- import * as path21 from "path";
29973
+ import * as path22 from "path";
29942
29974
 
29943
29975
  // src/providers/spec/fsm-driver.ts
29944
29976
  import * as fs11 from "fs";
29945
29977
  import * as os16 from "os";
29946
- import * as path19 from "path";
29978
+ import * as path20 from "path";
29947
29979
 
29948
29980
  // src/providers/spec/adapter.ts
29949
29981
  init_terminal_screen();
@@ -30070,17 +30102,17 @@ import { DEFAULT_SESSION_HOST_COLS as DEFAULT_SESSION_HOST_COLS6, DEFAULT_SESSIO
30070
30102
  init_logger();
30071
30103
  import * as fs10 from "fs";
30072
30104
  import * as os15 from "os";
30073
- import * as path18 from "path";
30105
+ import * as path19 from "path";
30074
30106
  function expandHome2(p) {
30075
30107
  if (p === "~") return os15.homedir();
30076
- if (p.startsWith("~/")) return path18.join(os15.homedir(), p.slice(2));
30108
+ if (p.startsWith("~/")) return path19.join(os15.homedir(), p.slice(2));
30077
30109
  return p;
30078
30110
  }
30079
30111
  function realWorkspacePath(workingDir) {
30080
30112
  try {
30081
30113
  return fs10.realpathSync(workingDir);
30082
30114
  } catch {
30083
- return path18.resolve(workingDir);
30115
+ return path19.resolve(workingDir);
30084
30116
  }
30085
30117
  }
30086
30118
  function applyPreLaunchTrust(trust, workingDir) {
@@ -30106,7 +30138,7 @@ function applyPreLaunchTrust(trust, workingDir) {
30106
30138
  }
30107
30139
  list.push(real);
30108
30140
  parsed[key] = list;
30109
- fs10.mkdirSync(path18.dirname(settingsPath), { recursive: true });
30141
+ fs10.mkdirSync(path19.dirname(settingsPath), { recursive: true });
30110
30142
  fs10.writeFileSync(settingsPath, `${JSON.stringify(parsed, null, 2)}
30111
30143
  `, "utf8");
30112
30144
  LOG.info("pre-launch-trust", `pre-trusted workspace in ${trust.settings_path} (key="${key}")`);
@@ -30355,8 +30387,8 @@ var FsmDriver = class {
30355
30387
  }
30356
30388
  armSpecWatcher() {
30357
30389
  try {
30358
- const dir = path19.dirname(this.opts.specPath);
30359
- const base = path19.basename(this.opts.specPath);
30390
+ const dir = path20.dirname(this.opts.specPath);
30391
+ const base = path20.basename(this.opts.specPath);
30360
30392
  this.specWatcher = fs11.watch(dir, { persistent: false }, (_event, filename) => {
30361
30393
  if (filename && filename !== base) return;
30362
30394
  const res = loadFsmSpec(this.opts.specPath);
@@ -30657,7 +30689,7 @@ var FsmDriver = class {
30657
30689
  const ctl = (this.spec.control_bar ?? []).find((c) => c.action.type === "attach_image");
30658
30690
  if (!ctl || ctl.action.type !== "attach_image") return;
30659
30691
  const ext = guessExt(mime);
30660
- const tmp = path19.join(os16.tmpdir(), `adhdev-attach-${Date.now()}${ext}`);
30692
+ const tmp = path20.join(os16.tmpdir(), `adhdev-attach-${Date.now()}${ext}`);
30661
30693
  try {
30662
30694
  fs11.writeFileSync(tmp, Buffer.from(blob, "base64"));
30663
30695
  } catch {
@@ -30767,7 +30799,7 @@ function collectStableSizes(when, sizes) {
30767
30799
  // src/providers/spec/native-history-executor.ts
30768
30800
  import * as fs12 from "fs";
30769
30801
  import * as os17 from "os";
30770
- import * as path20 from "path";
30802
+ import * as path21 from "path";
30771
30803
  var UUID_RE = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
30772
30804
  function executeNativeHistory(cfg, input) {
30773
30805
  if (!cfg?.source) return null;
@@ -30811,7 +30843,7 @@ function executeJsonl(src, input) {
30811
30843
  const v = jsonPathGet(lines[0], src.session_id_path);
30812
30844
  if (typeof v === "string" && v) providerSessionId = v;
30813
30845
  } else if (src.session_id_from === "filename_uuid" || !src.session_id_from) {
30814
- const m = path20.basename(sourcePath).match(UUID_RE);
30846
+ const m = path21.basename(sourcePath).match(UUID_RE);
30815
30847
  if (m) providerSessionId = m[1];
30816
30848
  }
30817
30849
  const requested = requestedSessionId || "";
@@ -30924,13 +30956,13 @@ function expandPath2(template, input) {
30924
30956
  if (!template) return null;
30925
30957
  let out = template;
30926
30958
  if (out.startsWith("~/") || out === "~") {
30927
- out = path20.join(os17.homedir(), out.slice(2));
30959
+ out = path21.join(os17.homedir(), out.slice(2));
30928
30960
  }
30929
30961
  out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
30930
30962
  const v = input.envOverrides?.[name] ?? process.env[name];
30931
30963
  return v != null && v !== "" ? v : fallback ?? "";
30932
30964
  });
30933
- if (out.startsWith("~/")) out = path20.join(os17.homedir(), out.slice(2));
30965
+ if (out.startsWith("~/")) out = path21.join(os17.homedir(), out.slice(2));
30934
30966
  const now = /* @__PURE__ */ new Date();
30935
30967
  const workspaceRaw = input.workspace ?? "";
30936
30968
  let workspaceResolved = workspaceRaw;
@@ -30987,12 +31019,12 @@ function expandDirGlob(template) {
30987
31019
  continue;
30988
31020
  }
30989
31021
  for (const e of entries) {
30990
- if (e.isDirectory() && re.test(e.name)) next.push(path20.join(d, e.name));
31022
+ if (e.isDirectory() && re.test(e.name)) next.push(path21.join(d, e.name));
30991
31023
  }
30992
31024
  }
30993
31025
  } else {
30994
31026
  for (const d of dirs) {
30995
- const candidate = path20.join(d, seg);
31027
+ const candidate = path21.join(d, seg);
30996
31028
  let stat2 = null;
30997
31029
  try {
30998
31030
  stat2 = fs12.statSync(candidate);
@@ -31015,7 +31047,7 @@ function walkAllDirs(root, out) {
31015
31047
  }
31016
31048
  out.push(root);
31017
31049
  for (const e of entries) {
31018
- if (e.isDirectory()) walkAllDirs(path20.join(root, e.name), out);
31050
+ if (e.isDirectory()) walkAllDirs(path21.join(root, e.name), out);
31019
31051
  }
31020
31052
  }
31021
31053
  function newestRecentFileAcrossGlob(template, pattern, windowMs, sessionFloorMs = 0) {
@@ -31031,7 +31063,7 @@ function newestRecentFileAcrossGlob(template, pattern, windowMs, sessionFloorMs
31031
31063
  }
31032
31064
  for (const e of entries) {
31033
31065
  if (!e.isFile() || !pattern.test(e.name)) continue;
31034
- const p = path20.join(d, e.name);
31066
+ const p = path21.join(d, e.name);
31035
31067
  const mtime = safeMtimeMs(p);
31036
31068
  if (mtime < cutoff) continue;
31037
31069
  if (!best || mtime > best.mtime) best = { p, mtime };
@@ -31058,7 +31090,7 @@ function newestRecentFileAcrossDateWindow(template, input, pattern, windowMs, se
31058
31090
  }
31059
31091
  for (const e of entries) {
31060
31092
  if (!e.isFile() || !pattern.test(e.name)) continue;
31061
- const p = path20.join(resolved, e.name);
31093
+ const p = path21.join(resolved, e.name);
31062
31094
  const mtime = safeMtimeMs(p);
31063
31095
  if (mtime < cutoff) continue;
31064
31096
  if (!best || mtime > best.mtime) best = { p, mtime };
@@ -31070,13 +31102,13 @@ function expandPathForDate(template, input, day) {
31070
31102
  if (!template) return null;
31071
31103
  let out = template;
31072
31104
  if (out.startsWith("~/") || out === "~") {
31073
- out = path20.join(os17.homedir(), out.slice(2));
31105
+ out = path21.join(os17.homedir(), out.slice(2));
31074
31106
  }
31075
31107
  out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
31076
31108
  const v = input.envOverrides?.[name] ?? process.env[name];
31077
31109
  return v != null && v !== "" ? v : fallback ?? "";
31078
31110
  });
31079
- if (out.startsWith("~/")) out = path20.join(os17.homedir(), out.slice(2));
31111
+ if (out.startsWith("~/")) out = path21.join(os17.homedir(), out.slice(2));
31080
31112
  const workspaceRaw = input.workspace ?? "";
31081
31113
  let workspaceResolved = workspaceRaw;
31082
31114
  if (workspaceRaw) {
@@ -31114,7 +31146,7 @@ function newestRecentFile(dir, pattern, windowMs, sessionFloorMs = 0) {
31114
31146
  let best = null;
31115
31147
  for (const e of entries) {
31116
31148
  if (!e.isFile() || !pattern.test(e.name)) continue;
31117
- const p = path20.join(dir, e.name);
31149
+ const p = path21.join(dir, e.name);
31118
31150
  const mtime = safeMtimeMs(p);
31119
31151
  if (mtime < cutoff) continue;
31120
31152
  if (!best || mtime > best.mtime) best = { p, mtime };
@@ -31134,7 +31166,7 @@ function readRequestedSessionId(input) {
31134
31166
  return UUID_RE.test(value) ? value : "";
31135
31167
  }
31136
31168
  function filenameUuid(filePath) {
31137
- const match = path20.basename(filePath).match(UUID_RE);
31169
+ const match = path21.basename(filePath).match(UUID_RE);
31138
31170
  return match?.[1] || "";
31139
31171
  }
31140
31172
  function pickExactSessionFile(dir, pattern, requestedSessionId) {
@@ -31229,7 +31261,7 @@ function listMatchingFiles(dir, pattern) {
31229
31261
  const out = [];
31230
31262
  for (const e of entries) {
31231
31263
  if (!e.isFile() || !pattern.test(e.name)) continue;
31232
- out.push(path20.join(dir, e.name));
31264
+ out.push(path21.join(dir, e.name));
31233
31265
  }
31234
31266
  return out;
31235
31267
  }
@@ -32171,12 +32203,12 @@ function createCliAdapter(provider, workingDir, cliArgs, extraEnv, transportFact
32171
32203
  const dir = provider._resolvedProviderDir;
32172
32204
  let specPath = resolvedSpecPath && fs14.existsSync(resolvedSpecPath) ? resolvedSpecPath : void 0;
32173
32205
  if (!specPath && dir) {
32174
- const legacy = path21.join(dir, "spec.json");
32206
+ const legacy = path22.join(dir, "spec.json");
32175
32207
  if (fs14.existsSync(legacy)) specPath = legacy;
32176
32208
  }
32177
32209
  if (specPath) {
32178
32210
  try {
32179
- LOG.info("spec-route", `[${provider.type}] routing through SpecCliAdapter (${path21.relative(dir || "", specPath) || specPath})`);
32211
+ LOG.info("spec-route", `[${provider.type}] routing through SpecCliAdapter (${path22.relative(dir || "", specPath) || specPath})`);
32180
32212
  return new SpecCliAdapter(specPath, workingDir, cliArgs, extraEnv, transportFactory);
32181
32213
  } catch (err) {
32182
32214
  LOG.warn("spec-route", `[${provider.type}] spec invalid, falling back to ProviderCliAdapter: ${err.message}`);
@@ -32243,7 +32275,7 @@ function filePathFromUri(uri) {
32243
32275
  return uri.slice("file://".length);
32244
32276
  }
32245
32277
  }
32246
- if (path22.isAbsolute(uri)) return uri;
32278
+ if (path23.isAbsolute(uri)) return uri;
32247
32279
  return null;
32248
32280
  }
32249
32281
  function extensionForImageMime(mimeType) {
@@ -32259,7 +32291,7 @@ function materializeImageDataPart(part, index, dir) {
32259
32291
  const rawData = part.data.includes(",") ? part.data.split(",").pop() || "" : part.data;
32260
32292
  if (!rawData) return null;
32261
32293
  fs15.mkdirSync(dir, { recursive: true });
32262
- const filePath = path22.join(dir, safeInputImageBasename(index, part.mimeType));
32294
+ const filePath = path23.join(dir, safeInputImageBasename(index, part.mimeType));
32263
32295
  fs15.writeFileSync(filePath, Buffer.from(rawData, "base64"));
32264
32296
  cleanupStaleMaterializedImages(dir);
32265
32297
  return filePath;
@@ -32275,7 +32307,7 @@ function cleanupStaleMaterializedImages(dir) {
32275
32307
  const entries = fs15.readdirSync(dir);
32276
32308
  for (const entry of entries) {
32277
32309
  if (!entry.startsWith("adhdev-input-image-")) continue;
32278
- const fullPath = path22.join(dir, entry);
32310
+ const fullPath = path23.join(dir, entry);
32279
32311
  try {
32280
32312
  const stat2 = fs15.statSync(fullPath);
32281
32313
  if (now - stat2.mtimeMs > MATERIALIZED_IMAGE_MAX_AGE_MS) {
@@ -32298,7 +32330,7 @@ function buildCliStructuredInputPrompt(input, options = {}) {
32298
32330
  const promptParts = [];
32299
32331
  const imageRefs = [];
32300
32332
  const resourceRefs = [];
32301
- const materializeDir = options.materializeDir || path22.join(os18.tmpdir(), "adhdev-input-media");
32333
+ const materializeDir = options.materializeDir || path23.join(os18.tmpdir(), "adhdev-input-media");
32302
32334
  input.parts.forEach((part, index) => {
32303
32335
  if (part.type === "text" && part.text.trim()) {
32304
32336
  promptParts.push(part.text.trim());
@@ -32365,7 +32397,7 @@ function buildIncrementalHistoryAppendMessages(previousMessages, currentMessages
32365
32397
  var CachedDatabaseSync = null;
32366
32398
  function getDatabaseSync() {
32367
32399
  if (CachedDatabaseSync) return CachedDatabaseSync;
32368
- const requireFn = typeof __require === "function" ? __require : createRequire2(path22.join(process.cwd(), "__adhdev_sqlite_loader__.js"));
32400
+ const requireFn = typeof __require === "function" ? __require : createRequire2(path23.join(process.cwd(), "__adhdev_sqlite_loader__.js"));
32369
32401
  const sqliteModule = requireFn(`node:${"sqlite"}`);
32370
32402
  CachedDatabaseSync = sqliteModule.DatabaseSync;
32371
32403
  if (!CachedDatabaseSync) {
@@ -34002,7 +34034,7 @@ ${effect.notification.body || ""}`.trim();
34002
34034
  };
34003
34035
 
34004
34036
  // src/providers/acp-provider-instance.ts
34005
- import * as path23 from "path";
34037
+ import * as path24 from "path";
34006
34038
  import { Readable, Writable } from "stream";
34007
34039
  import { spawn } from "child_process";
34008
34040
  import {
@@ -34793,7 +34825,7 @@ var AcpProviderInstance = class {
34793
34825
  return b.uri ? {
34794
34826
  type: "resource_link",
34795
34827
  uri: b.uri,
34796
- name: path23.basename(b.uri),
34828
+ name: path24.basename(b.uri),
34797
34829
  mimeType: b.mimeType,
34798
34830
  ...b.transcript ? { description: b.transcript } : {}
34799
34831
  } : { type: "text", text: b.transcript || `[Video attachment: ${b.mimeType}]` };
@@ -35253,20 +35285,20 @@ function shouldRestoreHostedRuntime(record, managerTag) {
35253
35285
  // src/commands/cli-manager.ts
35254
35286
  function isExplicitCommand(command) {
35255
35287
  const trimmed = command.trim();
35256
- return path24.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~");
35288
+ return path25.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~");
35257
35289
  }
35258
35290
  function expandExecutable(command) {
35259
35291
  const trimmed = command.trim();
35260
- return trimmed.startsWith("~") ? path24.join(os19.homedir(), trimmed.slice(1)) : trimmed;
35292
+ return trimmed.startsWith("~") ? path25.join(os19.homedir(), trimmed.slice(1)) : trimmed;
35261
35293
  }
35262
35294
  function commandExists(command) {
35263
35295
  const trimmed = command.trim();
35264
35296
  if (!trimmed) return false;
35265
35297
  if (isExplicitCommand(trimmed)) {
35266
- return existsSync24(expandExecutable(trimmed));
35298
+ return existsSync25(expandExecutable(trimmed));
35267
35299
  }
35268
35300
  try {
35269
- execFileSync(process.platform === "win32" ? "where" : "which", [trimmed], {
35301
+ execFileSync2(process.platform === "win32" ? "where" : "which", [trimmed], {
35270
35302
  stdio: "ignore",
35271
35303
  ...process.platform === "win32" ? { windowsHide: true } : {}
35272
35304
  });
@@ -35398,10 +35430,10 @@ function hasConfigOverride(args, key) {
35398
35430
  return false;
35399
35431
  }
35400
35432
  function ensureEmptyDelegatedMcpConfig(workspace) {
35401
- const baseDir = path24.join(os19.tmpdir(), "adhdev-delegated-agent-empty-mcp");
35433
+ const baseDir = path25.join(os19.tmpdir(), "adhdev-delegated-agent-empty-mcp");
35402
35434
  mkdirSync12(baseDir, { recursive: true });
35403
- const workspaceHash = crypto5.createHash("sha256").update(path24.resolve(workspace || os19.tmpdir())).digest("hex").slice(0, 16);
35404
- const filePath = path24.join(baseDir, `${workspaceHash}.json`);
35435
+ const workspaceHash = crypto5.createHash("sha256").update(path25.resolve(workspace || os19.tmpdir())).digest("hex").slice(0, 16);
35436
+ const filePath = path25.join(baseDir, `${workspaceHash}.json`);
35405
35437
  writeFileSync15(filePath, JSON.stringify({ mcpServers: {} }, null, 2), "utf-8");
35406
35438
  return filePath;
35407
35439
  }
@@ -35715,7 +35747,7 @@ var DaemonCliManager = class {
35715
35747
  async startSession(cliType, workingDir, cliArgs, initialModel, options) {
35716
35748
  const trimmed = (workingDir || "").trim();
35717
35749
  if (!trimmed) throw new Error("working directory required");
35718
- const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os19.homedir()) : path24.resolve(trimmed);
35750
+ const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os19.homedir()) : path25.resolve(trimmed);
35719
35751
  const normalizedType = this.providerLoader.resolveAlias(cliType);
35720
35752
  const rawProvider = this.providerLoader.getByAlias(cliType);
35721
35753
  const provider = rawProvider ? this.providerLoader.resolve(normalizedType) || rawProvider : void 0;
@@ -36320,11 +36352,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
36320
36352
  import { exec as exec4, spawn as spawn2 } from "child_process";
36321
36353
  import * as net from "net";
36322
36354
  import * as os24 from "os";
36323
- import * as path32 from "path";
36355
+ import * as path33 from "path";
36324
36356
 
36325
36357
  // src/providers/provider-loader.ts
36326
36358
  import * as fs21 from "fs";
36327
- import * as path31 from "path";
36359
+ import * as path32 from "path";
36328
36360
  import * as os23 from "os";
36329
36361
  import * as chokidar from "chokidar";
36330
36362
  init_logger();
@@ -36717,11 +36749,11 @@ init_external_sources();
36717
36749
  // src/providers/native-history/dispatcher.ts
36718
36750
  import * as fs20 from "fs";
36719
36751
  import * as os22 from "os";
36720
- import * as path29 from "path";
36752
+ import * as path30 from "path";
36721
36753
 
36722
36754
  // src/providers/native-history/claude-cli-transcript.ts
36723
36755
  import * as fs16 from "fs";
36724
- import * as path25 from "path";
36756
+ import * as path26 from "path";
36725
36757
  function extractTimestampValue(value) {
36726
36758
  if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
36727
36759
  if (typeof value === "string") {
@@ -36877,8 +36909,8 @@ function parseTranscriptFile(filePath, sessionId, workspaceFallback) {
36877
36909
  return records;
36878
36910
  }
36879
36911
  function readSession(sessionPath) {
36880
- if (!sessionPath || !path25.isAbsolute(sessionPath)) return null;
36881
- const basename14 = path25.basename(sessionPath, ".jsonl");
36912
+ if (!sessionPath || !path26.isAbsolute(sessionPath)) return null;
36913
+ const basename14 = path26.basename(sessionPath, ".jsonl");
36882
36914
  if (!isSafeSessionId(basename14)) return null;
36883
36915
  if (!fs16.existsSync(sessionPath)) return null;
36884
36916
  const sourceMtimeMs = statMtimeMs(sessionPath);
@@ -36899,7 +36931,7 @@ function readSession(sessionPath) {
36899
36931
 
36900
36932
  // src/providers/native-history/codex-cli-transcript.ts
36901
36933
  import * as fs17 from "fs";
36902
- import * as path26 from "path";
36934
+ import * as path27 from "path";
36903
36935
  function extractTimestampValue2(value) {
36904
36936
  if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
36905
36937
  if (typeof value === "string") {
@@ -37136,11 +37168,11 @@ function parseSessionFile(filePath, sessionId, workspaceFallback) {
37136
37168
  return records;
37137
37169
  }
37138
37170
  function readSession2(sessionPath) {
37139
- if (!sessionPath || !path26.isAbsolute(sessionPath)) return null;
37171
+ if (!sessionPath || !path27.isAbsolute(sessionPath)) return null;
37140
37172
  if (!fs17.existsSync(sessionPath)) return null;
37141
37173
  const meta = readSessionMeta(sessionPath);
37142
37174
  const metaId = String(meta?.id ?? "").trim();
37143
- const basename14 = path26.basename(sessionPath, ".jsonl");
37175
+ const basename14 = path27.basename(sessionPath, ".jsonl");
37144
37176
  const uuidMatch = basename14.match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);
37145
37177
  const filenameUuid2 = uuidMatch ? uuidMatch[1] : "";
37146
37178
  if (metaId && filenameUuid2 && metaId !== filenameUuid2) return null;
@@ -37165,7 +37197,7 @@ function readSession2(sessionPath) {
37165
37197
 
37166
37198
  // src/providers/native-history/antigravity-cli-transcript.ts
37167
37199
  import * as fs18 from "fs";
37168
- import * as path27 from "path";
37200
+ import * as path28 from "path";
37169
37201
  import * as os20 from "os";
37170
37202
  function extractTimestampValue3(value) {
37171
37203
  if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
@@ -37188,13 +37220,13 @@ function isUuidLike(value) {
37188
37220
  return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
37189
37221
  }
37190
37222
  function antigravityRoot() {
37191
- return path27.join(os20.homedir(), ".gemini", "antigravity-cli");
37223
+ return path28.join(os20.homedir(), ".gemini", "antigravity-cli");
37192
37224
  }
37193
37225
  function historyJsonlPath() {
37194
- return path27.join(antigravityRoot(), "history.jsonl");
37226
+ return path28.join(antigravityRoot(), "history.jsonl");
37195
37227
  }
37196
37228
  function brainRoot() {
37197
- return path27.join(antigravityRoot(), "brain");
37229
+ return path28.join(antigravityRoot(), "brain");
37198
37230
  }
37199
37231
  function extractUserRequestContent(content) {
37200
37232
  const raw = content.trim();
@@ -37341,13 +37373,13 @@ function parsePbFile(filePath, sessionId) {
37341
37373
  ];
37342
37374
  }
37343
37375
  function readSession3(sessionPath, sessionId, workspace) {
37344
- if (!sessionPath || !path27.isAbsolute(sessionPath)) return null;
37376
+ if (!sessionPath || !path28.isAbsolute(sessionPath)) return null;
37345
37377
  if (!fs18.existsSync(sessionPath)) return null;
37346
37378
  const sourceMtimeMs = statMtimeMs3(sessionPath);
37347
37379
  const brainRootPath = brainRoot();
37348
- if (sessionPath.startsWith(brainRootPath + path27.sep) && sessionPath.endsWith(".jsonl")) {
37380
+ if (sessionPath.startsWith(brainRootPath + path28.sep) && sessionPath.endsWith(".jsonl")) {
37349
37381
  const relative5 = sessionPath.slice(brainRootPath.length + 1);
37350
- const uuidFromPath = relative5.split(path27.sep)[0];
37382
+ const uuidFromPath = relative5.split(path28.sep)[0];
37351
37383
  const resolvedSessionId = sessionId || (isUuidLike(uuidFromPath) ? uuidFromPath : "");
37352
37384
  if (!resolvedSessionId) return null;
37353
37385
  const messages = parseBrainTranscript(sessionPath, resolvedSessionId, workspace);
@@ -37363,7 +37395,7 @@ function readSession3(sessionPath, sessionId, workspace) {
37363
37395
  };
37364
37396
  }
37365
37397
  if (sessionPath.endsWith(".pb")) {
37366
- const pbSessionId = sessionId || path27.basename(sessionPath, ".pb");
37398
+ const pbSessionId = sessionId || path28.basename(sessionPath, ".pb");
37367
37399
  if (!isUuidLike(pbSessionId)) return null;
37368
37400
  const messages = parsePbFile(sessionPath, pbSessionId);
37369
37401
  if (!messages || messages.length === 0) return null;
@@ -37377,7 +37409,7 @@ function readSession3(sessionPath, sessionId, workspace) {
37377
37409
  partialReason: "antigravity_cli_pb_raw_text_extraction"
37378
37410
  };
37379
37411
  }
37380
- if (path27.basename(sessionPath) === "history.jsonl") {
37412
+ if (path28.basename(sessionPath) === "history.jsonl") {
37381
37413
  const resolvedSessionId = sessionId || "";
37382
37414
  if (!resolvedSessionId || !isUuidLike(resolvedSessionId)) return null;
37383
37415
  const rows = readHistoryRows().filter((r) => r.conversationId === resolvedSessionId);
@@ -37425,10 +37457,10 @@ function readSession3(sessionPath, sessionId, workspace) {
37425
37457
 
37426
37458
  // src/providers/native-history/hermes-cli-transcript.ts
37427
37459
  import * as fs19 from "fs";
37428
- import * as path28 from "path";
37460
+ import * as path29 from "path";
37429
37461
  import * as os21 from "os";
37430
- var HERMES_STATE_DB = path28.join(os21.homedir(), ".hermes", "state.db");
37431
- var HERMES_LEGACY_SESSIONS_DIR = path28.join(os21.homedir(), ".hermes", "sessions");
37462
+ var HERMES_STATE_DB = path29.join(os21.homedir(), ".hermes", "state.db");
37463
+ var HERMES_LEGACY_SESSIONS_DIR = path29.join(os21.homedir(), ".hermes", "sessions");
37432
37464
  function statMtimeMs4(p) {
37433
37465
  try {
37434
37466
  return Math.floor(fs19.statSync(p).mtimeMs);
@@ -37494,7 +37526,7 @@ function readSession4(sessionPath) {
37494
37526
  }
37495
37527
  }
37496
37528
  }
37497
- if (!path28.isAbsolute(sessionPath) || !fs19.existsSync(sessionPath)) return null;
37529
+ if (!path29.isAbsolute(sessionPath) || !fs19.existsSync(sessionPath)) return null;
37498
37530
  let raw;
37499
37531
  try {
37500
37532
  raw = JSON.parse(fs19.readFileSync(sessionPath, "utf8"));
@@ -37520,7 +37552,7 @@ function readSession4(sessionPath) {
37520
37552
  });
37521
37553
  }
37522
37554
  if (messages.length === 0) return null;
37523
- const sessionId = typeof raw.session_id === "string" && raw.session_id ? raw.session_id : path28.basename(sessionPath, ".json").replace(/^session_/, "");
37555
+ const sessionId = typeof raw.session_id === "string" && raw.session_id ? raw.session_id : path29.basename(sessionPath, ".json").replace(/^session_/, "");
37524
37556
  return {
37525
37557
  messages,
37526
37558
  providerSessionId: sessionId,
@@ -37586,10 +37618,10 @@ function resolveSourcePath(reader, workspace, sessionId, sessionStartedAtMs) {
37586
37618
  }
37587
37619
  }
37588
37620
  function resolveClaudePath(workspace, sessionId) {
37589
- const dir = path29.join(os22.homedir(), ".claude", "projects", cwdAsDashes(workspace));
37621
+ const dir = path30.join(os22.homedir(), ".claude", "projects", cwdAsDashes(workspace));
37590
37622
  if (!fs20.existsSync(dir)) return null;
37591
37623
  if (sessionId) {
37592
- const candidate = path29.join(dir, `${sessionId}.jsonl`);
37624
+ const candidate = path30.join(dir, `${sessionId}.jsonl`);
37593
37625
  if (fs20.existsSync(candidate)) return candidate;
37594
37626
  }
37595
37627
  return null;
@@ -37615,7 +37647,7 @@ function findCodexPathBySessionId(root, sessionId) {
37615
37647
  continue;
37616
37648
  }
37617
37649
  for (const entry of entries) {
37618
- const entryPath = path29.join(current, entry.name);
37650
+ const entryPath = path30.join(current, entry.name);
37619
37651
  if (entry.isDirectory()) {
37620
37652
  stack.push(entryPath);
37621
37653
  continue;
@@ -37645,7 +37677,7 @@ function findCodexPathByRuntime(root, workspace, sessionStartedAtMs) {
37645
37677
  continue;
37646
37678
  }
37647
37679
  for (const entry of entries) {
37648
- const entryPath = path29.join(current, entry.name);
37680
+ const entryPath = path30.join(current, entry.name);
37649
37681
  if (entry.isDirectory()) {
37650
37682
  stack.push(entryPath);
37651
37683
  continue;
@@ -37698,12 +37730,12 @@ function resolveRealPath(value) {
37698
37730
  }
37699
37731
  function resolveAntigravityPath(workspace) {
37700
37732
  void workspace;
37701
- const brainRoot2 = path29.join(os22.homedir(), ".gemini", "antigravity-cli", "brain");
37733
+ const brainRoot2 = path30.join(os22.homedir(), ".gemini", "antigravity-cli", "brain");
37702
37734
  if (!fs20.existsSync(brainRoot2)) return null;
37703
37735
  const cutoff = Date.now() - RECENT_WINDOW_MS;
37704
- const entries = fs20.readdirSync(brainRoot2, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => ({ p: path29.join(brainRoot2, e.name), mtime: safeMtime(path29.join(brainRoot2, e.name)) })).filter((e) => e.mtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
37736
+ const entries = fs20.readdirSync(brainRoot2, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => ({ p: path30.join(brainRoot2, e.name), mtime: safeMtime(path30.join(brainRoot2, e.name)) })).filter((e) => e.mtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
37705
37737
  for (const e of entries) {
37706
- const t = path29.join(e.p, ".system_generated", "logs", "transcript.jsonl");
37738
+ const t = path30.join(e.p, ".system_generated", "logs", "transcript.jsonl");
37707
37739
  if (fs20.existsSync(t)) return t;
37708
37740
  }
37709
37741
  return null;
@@ -37711,9 +37743,9 @@ function resolveAntigravityPath(workspace) {
37711
37743
  function resolveHermesPath(workspace, sessionId) {
37712
37744
  void workspace;
37713
37745
  void sessionId;
37714
- const dbPath = path29.join(os22.homedir(), ".hermes", "state.db");
37746
+ const dbPath = path30.join(os22.homedir(), ".hermes", "state.db");
37715
37747
  if (fs20.existsSync(dbPath)) return dbPath;
37716
- const dir = path29.join(os22.homedir(), ".hermes", "sessions");
37748
+ const dir = path30.join(os22.homedir(), ".hermes", "sessions");
37717
37749
  if (!fs20.existsSync(dir)) return null;
37718
37750
  return newestRecentFile2(dir, /^session_.*\.json$/);
37719
37751
  }
@@ -37734,7 +37766,7 @@ function cwdAsDashes(cwd) {
37734
37766
  return cwd.replace(/\//g, "-");
37735
37767
  }
37736
37768
  function codexSessionsRoot() {
37737
- return path29.join(os22.homedir(), ".codex", "sessions");
37769
+ return path30.join(os22.homedir(), ".codex", "sessions");
37738
37770
  }
37739
37771
  function isUuidLikeSessionId2(sessionId) {
37740
37772
  return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(sessionId);
@@ -37746,7 +37778,7 @@ var RECENT_WINDOW_MS = 5 * 60 * 1e3;
37746
37778
  function newestRecentFile2(dir, pattern) {
37747
37779
  try {
37748
37780
  const cutoff = Date.now() - RECENT_WINDOW_MS;
37749
- const entries = fs20.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && pattern.test(e.name)).map((e) => ({ p: path29.join(dir, e.name), mtime: safeMtime(path29.join(dir, e.name)) })).filter((e) => e.mtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
37781
+ const entries = fs20.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && pattern.test(e.name)).map((e) => ({ p: path30.join(dir, e.name), mtime: safeMtime(path30.join(dir, e.name)) })).filter((e) => e.mtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
37750
37782
  return entries[0]?.p ?? null;
37751
37783
  } catch {
37752
37784
  return null;
@@ -37809,7 +37841,7 @@ var ProviderLoader = class _ProviderLoader {
37809
37841
  try {
37810
37842
  if (!fs21.existsSync(candidate) || !fs21.statSync(candidate).isDirectory()) return false;
37811
37843
  return ["ide", "extension", "cli", "acp"].some(
37812
- (category) => fs21.existsSync(path31.join(candidate, category))
37844
+ (category) => fs21.existsSync(path32.join(candidate, category))
37813
37845
  );
37814
37846
  } catch {
37815
37847
  return false;
@@ -37817,20 +37849,20 @@ var ProviderLoader = class _ProviderLoader {
37817
37849
  }
37818
37850
  static hasProviderRootMarker(candidate) {
37819
37851
  try {
37820
- return fs21.existsSync(path31.join(candidate, _ProviderLoader.SIBLING_MARKER_FILE));
37852
+ return fs21.existsSync(path32.join(candidate, _ProviderLoader.SIBLING_MARKER_FILE));
37821
37853
  } catch {
37822
37854
  return false;
37823
37855
  }
37824
37856
  }
37825
37857
  detectDefaultUserDir() {
37826
- const fallback = path31.join(os23.homedir(), ".adhdev", "providers");
37858
+ const fallback = path32.join(os23.homedir(), ".adhdev", "providers");
37827
37859
  const envOptIn = process.env[_ProviderLoader.SIBLING_ENV_VAR] === "1";
37828
37860
  const visited = /* @__PURE__ */ new Set();
37829
37861
  for (const start of this.probeStarts) {
37830
- let current = path31.resolve(start);
37862
+ let current = path32.resolve(start);
37831
37863
  while (!visited.has(current)) {
37832
37864
  visited.add(current);
37833
- const siblingCandidate = path31.join(path31.dirname(current), _ProviderLoader.REPO_PROVIDER_DIRNAME);
37865
+ const siblingCandidate = path32.join(path32.dirname(current), _ProviderLoader.REPO_PROVIDER_DIRNAME);
37834
37866
  if (_ProviderLoader.looksLikeProviderRoot(siblingCandidate)) {
37835
37867
  const hasMarker = _ProviderLoader.hasProviderRootMarker(siblingCandidate);
37836
37868
  if (envOptIn || hasMarker) {
@@ -37852,7 +37884,7 @@ var ProviderLoader = class _ProviderLoader {
37852
37884
  return { path: siblingCandidate, source };
37853
37885
  }
37854
37886
  }
37855
- const parent = path31.dirname(current);
37887
+ const parent = path32.dirname(current);
37856
37888
  if (parent === current) break;
37857
37889
  current = parent;
37858
37890
  }
@@ -37862,11 +37894,11 @@ var ProviderLoader = class _ProviderLoader {
37862
37894
  constructor(options) {
37863
37895
  this.logFn = options?.logFn || LOG.forComponent("Provider").asLogFn();
37864
37896
  this.probeStarts = options?.probeStarts ?? [process.cwd(), __dirname];
37865
- this.defaultProvidersDir = path31.join(os23.homedir(), ".adhdev", "providers");
37897
+ this.defaultProvidersDir = path32.join(os23.homedir(), ".adhdev", "providers");
37866
37898
  const detected = this.detectDefaultUserDir();
37867
37899
  this.userDir = detected.path;
37868
37900
  this.userDirSource = detected.source;
37869
- this.upstreamDir = path31.join(this.defaultProvidersDir, ".upstream");
37901
+ this.upstreamDir = path32.join(this.defaultProvidersDir, ".upstream");
37870
37902
  this.disableUpstream = false;
37871
37903
  this.applySourceConfig({
37872
37904
  userDir: options?.userDir,
@@ -37878,8 +37910,8 @@ var ProviderLoader = class _ProviderLoader {
37878
37910
  migrateMarketplaceDirToExternal() {
37879
37911
  try {
37880
37912
  const home = os23.homedir();
37881
- const oldDir = path31.join(home, ".adhdev", "marketplace");
37882
- const newDir = path31.join(home, ".adhdev", "external");
37913
+ const oldDir = path32.join(home, ".adhdev", "marketplace");
37914
+ const newDir = path32.join(home, ".adhdev", "external");
37883
37915
  if (!fs21.existsSync(oldDir)) return;
37884
37916
  if (fs21.existsSync(newDir)) {
37885
37917
  this.log(`Migration skipped: both ~/.adhdev/marketplace and ~/.adhdev/external exist (marketplace dir is now inert and can be removed manually).`);
@@ -37915,7 +37947,7 @@ var ProviderLoader = class _ProviderLoader {
37915
37947
  * Highest-priority editable overrides come first.
37916
37948
  */
37917
37949
  getProviderRoots() {
37918
- const externalDir = path31.join(os23.homedir(), ".adhdev", "external");
37950
+ const externalDir = path32.join(os23.homedir(), ".adhdev", "external");
37919
37951
  return [this.userDir, externalDir, this.upstreamDir];
37920
37952
  }
37921
37953
  getSourceConfig() {
@@ -37943,7 +37975,7 @@ var ProviderLoader = class _ProviderLoader {
37943
37975
  this.userDir = detected.path;
37944
37976
  this.userDirSource = detected.source;
37945
37977
  }
37946
- this.upstreamDir = path31.join(this.defaultProvidersDir, ".upstream");
37978
+ this.upstreamDir = path32.join(this.defaultProvidersDir, ".upstream");
37947
37979
  this.disableUpstream = this.sourceMode === "no-upstream";
37948
37980
  if (this.explicitProviderDir) {
37949
37981
  this.log(`Config 'providerDir' applied: ${this.userDir}`);
@@ -37957,7 +37989,7 @@ var ProviderLoader = class _ProviderLoader {
37957
37989
  * Canonical provider directory shape for a given root.
37958
37990
  */
37959
37991
  getProviderDir(root, category, type) {
37960
- return path31.join(root, category, type);
37992
+ return path32.join(root, category, type);
37961
37993
  }
37962
37994
  /**
37963
37995
  * Canonical user override directory for a provider.
@@ -37984,7 +38016,7 @@ var ProviderLoader = class _ProviderLoader {
37984
38016
  resolveProviderFile(type, ...segments) {
37985
38017
  const dir = this.findProviderDirInternal(type);
37986
38018
  if (!dir) return null;
37987
- return path31.join(dir, ...segments);
38019
+ return path32.join(dir, ...segments);
37988
38020
  }
37989
38021
  /**
37990
38022
  * Load all providers (3-tier priority)
@@ -38008,7 +38040,7 @@ var ProviderLoader = class _ProviderLoader {
38008
38040
  } else if (this.disableUpstream) {
38009
38041
  this.log("Upstream loading disabled (sourceMode=no-upstream)");
38010
38042
  }
38011
- const externalDir = path31.join(os23.homedir(), ".adhdev", "external");
38043
+ const externalDir = path32.join(os23.homedir(), ".adhdev", "external");
38012
38044
  if (fs21.existsSync(externalDir)) {
38013
38045
  const rootEntries = (() => {
38014
38046
  try {
@@ -38030,7 +38062,7 @@ var ProviderLoader = class _ProviderLoader {
38030
38062
  const ambiguousTypes = [];
38031
38063
  for (const sourceEntry of rootEntries) {
38032
38064
  if (!sourceEntry.isDirectory()) continue;
38033
- const sourceDir = path31.join(externalDir, sourceEntry.name);
38065
+ const sourceDir = path32.join(externalDir, sourceEntry.name);
38034
38066
  const sourceLoaded = this.loadDir(sourceDir);
38035
38067
  if (sourceLoaded > 0) {
38036
38068
  totalLoaded += sourceLoaded;
@@ -38046,7 +38078,7 @@ var ProviderLoader = class _ProviderLoader {
38046
38078
  ambiguousTypes.push({ type, chosen: resolved.source ?? "?", candidates: resolved.candidates });
38047
38079
  }
38048
38080
  if (resolved.source && resolved.source !== "?") {
38049
- const sourceDir = path31.join(externalDir, resolved.source);
38081
+ const sourceDir = path32.join(externalDir, resolved.source);
38050
38082
  const reloadCount = this.loadDir(sourceDir);
38051
38083
  if (reloadCount === 0) {
38052
38084
  this.log(`Active source "${resolved.source}" no longer provides ${type}`);
@@ -38079,7 +38111,7 @@ var ProviderLoader = class _ProviderLoader {
38079
38111
  if (!fs21.existsSync(this.upstreamDir)) return false;
38080
38112
  try {
38081
38113
  return fs21.readdirSync(this.upstreamDir).some(
38082
- (d) => fs21.statSync(path31.join(this.upstreamDir, d)).isDirectory()
38114
+ (d) => fs21.statSync(path32.join(this.upstreamDir, d)).isDirectory()
38083
38115
  );
38084
38116
  } catch {
38085
38117
  return false;
@@ -38577,8 +38609,8 @@ var ProviderLoader = class _ProviderLoader {
38577
38609
  resolved._resolvedScriptDir = entry.scriptDir;
38578
38610
  resolved._resolvedScriptsSource = `compatibility:${entry.ideVersion}`;
38579
38611
  if (providerDir) {
38580
- const fullDir = path31.join(providerDir, entry.scriptDir);
38581
- resolved._resolvedScriptsPath = fs21.existsSync(path31.join(fullDir, "scripts.js")) ? path31.join(fullDir, "scripts.js") : fullDir;
38612
+ const fullDir = path32.join(providerDir, entry.scriptDir);
38613
+ resolved._resolvedScriptsPath = fs21.existsSync(path32.join(fullDir, "scripts.js")) ? path32.join(fullDir, "scripts.js") : fullDir;
38582
38614
  }
38583
38615
  matched = true;
38584
38616
  }
@@ -38596,8 +38628,8 @@ var ProviderLoader = class _ProviderLoader {
38596
38628
  resolved._resolvedScriptDir = base.defaultScriptDir;
38597
38629
  resolved._resolvedScriptsSource = "defaultScriptDir:version_miss";
38598
38630
  if (providerDir) {
38599
- const fullDir = path31.join(providerDir, base.defaultScriptDir);
38600
- resolved._resolvedScriptsPath = fs21.existsSync(path31.join(fullDir, "scripts.js")) ? path31.join(fullDir, "scripts.js") : fullDir;
38631
+ const fullDir = path32.join(providerDir, base.defaultScriptDir);
38632
+ resolved._resolvedScriptsPath = fs21.existsSync(path32.join(fullDir, "scripts.js")) ? path32.join(fullDir, "scripts.js") : fullDir;
38601
38633
  }
38602
38634
  }
38603
38635
  resolved._versionWarning = `Version ${currentVersion} not in compatibility matrix. Using default scripts.`;
@@ -38614,8 +38646,8 @@ var ProviderLoader = class _ProviderLoader {
38614
38646
  resolved._resolvedScriptDir = dirOverride;
38615
38647
  resolved._resolvedScriptsSource = `versions:${range}`;
38616
38648
  if (providerDir) {
38617
- const fullDir = path31.join(providerDir, dirOverride);
38618
- resolved._resolvedScriptsPath = fs21.existsSync(path31.join(fullDir, "scripts.js")) ? path31.join(fullDir, "scripts.js") : fullDir;
38649
+ const fullDir = path32.join(providerDir, dirOverride);
38650
+ resolved._resolvedScriptsPath = fs21.existsSync(path32.join(fullDir, "scripts.js")) ? path32.join(fullDir, "scripts.js") : fullDir;
38619
38651
  }
38620
38652
  }
38621
38653
  } else if (override.scripts) {
@@ -38631,8 +38663,8 @@ var ProviderLoader = class _ProviderLoader {
38631
38663
  resolved._resolvedScriptDir = base.defaultScriptDir;
38632
38664
  resolved._resolvedScriptsSource = "defaultScriptDir:no_version";
38633
38665
  if (providerDir) {
38634
- const fullDir = path31.join(providerDir, base.defaultScriptDir);
38635
- resolved._resolvedScriptsPath = fs21.existsSync(path31.join(fullDir, "scripts.js")) ? path31.join(fullDir, "scripts.js") : fullDir;
38666
+ const fullDir = path32.join(providerDir, base.defaultScriptDir);
38667
+ resolved._resolvedScriptsPath = fs21.existsSync(path32.join(fullDir, "scripts.js")) ? path32.join(fullDir, "scripts.js") : fullDir;
38636
38668
  }
38637
38669
  }
38638
38670
  }
@@ -38649,13 +38681,13 @@ var ProviderLoader = class _ProviderLoader {
38649
38681
  if (providerDir2) {
38650
38682
  for (const [scriptName, override] of Object.entries(base.overrides)) {
38651
38683
  if (!override || typeof override.path !== "string") continue;
38652
- const fullPath = path31.join(providerDir2, override.path);
38684
+ const fullPath = path32.join(providerDir2, override.path);
38653
38685
  if (!fs21.existsSync(fullPath)) {
38654
38686
  this.log(` [overrides] ${base.type}: ${scriptName} path not found: ${fullPath}`);
38655
38687
  continue;
38656
38688
  }
38657
38689
  try {
38658
- registerProviderScriptRootSafely(path31.dirname(path31.dirname(providerDir2)));
38690
+ registerProviderScriptRootSafely(path32.dirname(path32.dirname(providerDir2)));
38659
38691
  delete __require.cache[__require.resolve(fullPath)];
38660
38692
  const fn = __require(fullPath);
38661
38693
  const target = typeof fn === "function" ? fn : fn && fn[scriptName];
@@ -38681,17 +38713,17 @@ var ProviderLoader = class _ProviderLoader {
38681
38713
  if (providerDir) {
38682
38714
  try {
38683
38715
  const fs30 = __require("fs");
38684
- const path40 = __require("path");
38716
+ const path41 = __require("path");
38685
38717
  const candidates = [];
38686
38718
  if (Array.isArray(base.compatibility)) {
38687
38719
  for (const entry of base.compatibility) {
38688
38720
  if (typeof entry?.spec !== "string") continue;
38689
38721
  const matches = !entry.ideVersion || currentVersion && this.matchesVersion(currentVersion, entry.ideVersion) || !currentVersion;
38690
- if (matches) candidates.push(path40.join(providerDir, entry.spec));
38722
+ if (matches) candidates.push(path41.join(providerDir, entry.spec));
38691
38723
  }
38692
38724
  }
38693
- candidates.push(path40.join(providerDir, "specs", "default.json"));
38694
- candidates.push(path40.join(providerDir, "spec.json"));
38725
+ candidates.push(path41.join(providerDir, "specs", "default.json"));
38726
+ candidates.push(path41.join(providerDir, "spec.json"));
38695
38727
  const specPath = candidates.find((p) => fs30.existsSync(p));
38696
38728
  if (specPath) {
38697
38729
  resolved._resolvedSpecPath = specPath;
@@ -38722,10 +38754,10 @@ var ProviderLoader = class _ProviderLoader {
38722
38754
  format = `spec-${nh.source.kind}`;
38723
38755
  reader = (input) => executeNativeHistory(nh, input);
38724
38756
  } else if (nh.override_path) {
38725
- const overrideFile = path40.resolve(providerDir, nh.override_path);
38757
+ const overrideFile = path41.resolve(providerDir, nh.override_path);
38726
38758
  if (fs30.existsSync(overrideFile)) {
38727
38759
  try {
38728
- registerProviderScriptRootSafely(path40.dirname(path40.dirname(providerDir)));
38760
+ registerProviderScriptRootSafely(path41.dirname(path41.dirname(providerDir)));
38729
38761
  delete __require.cache[__require.resolve(overrideFile)];
38730
38762
  const mod = __require(overrideFile);
38731
38763
  const fn = typeof mod === "function" ? mod : mod && typeof mod.default === "function" ? mod.default : null;
@@ -38768,15 +38800,15 @@ var ProviderLoader = class _ProviderLoader {
38768
38800
  this.debugLog(`[loadScriptsFromDir] ${type}: providerDir not found`);
38769
38801
  return null;
38770
38802
  }
38771
- const dir = path31.join(providerDir, scriptDir);
38803
+ const dir = path32.join(providerDir, scriptDir);
38772
38804
  if (!fs21.existsSync(dir)) {
38773
38805
  this.debugLog(`[loadScriptsFromDir] ${type}: dir not found: ${dir}`);
38774
38806
  return null;
38775
38807
  }
38776
- registerProviderScriptRootSafely(path31.dirname(path31.dirname(providerDir)));
38808
+ registerProviderScriptRootSafely(path32.dirname(path32.dirname(providerDir)));
38777
38809
  const cached2 = this.scriptsCache.get(dir);
38778
38810
  if (cached2) return cached2;
38779
- const scriptsJs = path31.join(dir, "scripts.js");
38811
+ const scriptsJs = path32.join(dir, "scripts.js");
38780
38812
  if (fs21.existsSync(scriptsJs)) {
38781
38813
  try {
38782
38814
  delete __require.cache[__require.resolve(scriptsJs)];
@@ -38821,7 +38853,7 @@ var ProviderLoader = class _ProviderLoader {
38821
38853
  if (filePath.endsWith(".js") || filePath.endsWith(".json")) {
38822
38854
  if (reloadTimer) clearTimeout(reloadTimer);
38823
38855
  reloadTimer = setTimeout(() => {
38824
- this.log(`File changed: ${path31.basename(filePath)}, reloading...`);
38856
+ this.log(`File changed: ${path32.basename(filePath)}, reloading...`);
38825
38857
  this.reload();
38826
38858
  }, 300);
38827
38859
  }
@@ -38889,7 +38921,7 @@ var ProviderLoader = class _ProviderLoader {
38889
38921
  }
38890
38922
  this.log(`Registry sync starting (${_ProviderLoader.REGISTRY_BASE_URL})...`);
38891
38923
  const https = __require("https");
38892
- const regMetaPath = path31.join(this.upstreamDir, _ProviderLoader.REGISTRY_META_FILE);
38924
+ const regMetaPath = path32.join(this.upstreamDir, _ProviderLoader.REGISTRY_META_FILE);
38893
38925
  let cachedChecksums = {};
38894
38926
  try {
38895
38927
  if (fs21.existsSync(regMetaPath)) {
@@ -38947,9 +38979,9 @@ var ProviderLoader = class _ProviderLoader {
38947
38979
  this.log(`\u26A0 Registry checksum mismatch for ${type}@${version} \u2014 skipping`);
38948
38980
  continue;
38949
38981
  }
38950
- const providerDir = path31.join(this.upstreamDir, category, type);
38982
+ const providerDir = path32.join(this.upstreamDir, category, type);
38951
38983
  fs21.mkdirSync(providerDir, { recursive: true });
38952
- fs21.writeFileSync(path31.join(providerDir, "provider.json"), manifestBody, "utf-8");
38984
+ fs21.writeFileSync(path32.join(providerDir, "provider.json"), manifestBody, "utf-8");
38953
38985
  cachedChecksums[cacheKey] = checksum;
38954
38986
  updatedCount++;
38955
38987
  this.log(`\u2713 Registry updated: ${category}/${type}@${version}`);
@@ -38976,7 +39008,7 @@ var ProviderLoader = class _ProviderLoader {
38976
39008
  const { exec: exec7 } = __require("child_process");
38977
39009
  const { promisify: promisify8 } = __require("util");
38978
39010
  const execAsync5 = promisify8(exec7);
38979
- const metaPath = path31.join(this.upstreamDir, _ProviderLoader.META_FILE);
39011
+ const metaPath = path32.join(this.upstreamDir, _ProviderLoader.META_FILE);
38980
39012
  let prevEtag = "";
38981
39013
  let prevTimestamp = 0;
38982
39014
  try {
@@ -39036,17 +39068,17 @@ var ProviderLoader = class _ProviderLoader {
39036
39068
  return { updated: false };
39037
39069
  }
39038
39070
  this.log("Downloading latest providers from GitHub...");
39039
- const tmpTar = path31.join(os23.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
39040
- const tmpExtract = path31.join(os23.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
39071
+ const tmpTar = path32.join(os23.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
39072
+ const tmpExtract = path32.join(os23.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
39041
39073
  await this.downloadFile(_ProviderLoader.GITHUB_TARBALL_URL, tmpTar);
39042
39074
  fs21.mkdirSync(tmpExtract, { recursive: true });
39043
39075
  await execAsync5(`tar -xzf "${tmpTar}" -C "${tmpExtract}"`, { timeout: 3e4 });
39044
39076
  const extracted = fs21.readdirSync(tmpExtract);
39045
39077
  const rootDir = extracted.find(
39046
- (d) => fs21.statSync(path31.join(tmpExtract, d)).isDirectory() && d.startsWith("adhdev-providers")
39078
+ (d) => fs21.statSync(path32.join(tmpExtract, d)).isDirectory() && d.startsWith("adhdev-providers")
39047
39079
  );
39048
39080
  if (!rootDir) throw new Error("Unexpected tarball structure");
39049
- const sourceDir = path31.join(tmpExtract, rootDir);
39081
+ const sourceDir = path32.join(tmpExtract, rootDir);
39050
39082
  const backupDir = this.upstreamDir + ".bak";
39051
39083
  if (fs21.existsSync(this.upstreamDir)) {
39052
39084
  if (fs21.existsSync(backupDir)) fs21.rmSync(backupDir, { recursive: true, force: true });
@@ -39121,8 +39153,8 @@ var ProviderLoader = class _ProviderLoader {
39121
39153
  copyDirRecursive(src, dest) {
39122
39154
  fs21.mkdirSync(dest, { recursive: true });
39123
39155
  for (const entry of fs21.readdirSync(src, { withFileTypes: true })) {
39124
- const srcPath = path31.join(src, entry.name);
39125
- const destPath = path31.join(dest, entry.name);
39156
+ const srcPath = path32.join(src, entry.name);
39157
+ const destPath = path32.join(dest, entry.name);
39126
39158
  if (entry.isDirectory()) {
39127
39159
  this.copyDirRecursive(srcPath, destPath);
39128
39160
  } else {
@@ -39133,7 +39165,7 @@ var ProviderLoader = class _ProviderLoader {
39133
39165
  /** .meta.json save */
39134
39166
  writeMeta(metaPath, etag, timestamp) {
39135
39167
  try {
39136
- fs21.mkdirSync(path31.dirname(metaPath), { recursive: true });
39168
+ fs21.mkdirSync(path32.dirname(metaPath), { recursive: true });
39137
39169
  fs21.writeFileSync(metaPath, JSON.stringify({
39138
39170
  etag,
39139
39171
  timestamp,
@@ -39153,7 +39185,7 @@ var ProviderLoader = class _ProviderLoader {
39153
39185
  const hasManifest = entries.some((e) => e.name === "provider.v1.json" || e.name === "provider.json");
39154
39186
  if (hasManifest) count++;
39155
39187
  for (const entry of entries) {
39156
- if (entry.isDirectory()) scan(path31.join(d, entry.name));
39188
+ if (entry.isDirectory()) scan(path32.join(d, entry.name));
39157
39189
  }
39158
39190
  } catch {
39159
39191
  }
@@ -39379,10 +39411,10 @@ var ProviderLoader = class _ProviderLoader {
39379
39411
  if (!provider) return null;
39380
39412
  const cat = provider.category;
39381
39413
  const searchRoots = this.getProviderRoots();
39382
- const hasManifest = (dir) => fs21.existsSync(path31.join(dir, "provider.v1.json")) || fs21.existsSync(path31.join(dir, "provider.json"));
39414
+ const hasManifest = (dir) => fs21.existsSync(path32.join(dir, "provider.v1.json")) || fs21.existsSync(path32.join(dir, "provider.json"));
39383
39415
  const readManifestType = (dir) => {
39384
39416
  for (const file of ["provider.v1.json", "provider.json"]) {
39385
- const p = path31.join(dir, file);
39417
+ const p = path32.join(dir, file);
39386
39418
  if (!fs21.existsSync(p)) continue;
39387
39419
  try {
39388
39420
  const data = JSON.parse(fs21.readFileSync(p, "utf-8"));
@@ -39396,12 +39428,12 @@ var ProviderLoader = class _ProviderLoader {
39396
39428
  if (!fs21.existsSync(root)) continue;
39397
39429
  const candidate = this.getProviderDir(root, cat, type);
39398
39430
  if (hasManifest(candidate)) return candidate;
39399
- const catDir = path31.join(root, cat);
39431
+ const catDir = path32.join(root, cat);
39400
39432
  if (fs21.existsSync(catDir)) {
39401
39433
  try {
39402
39434
  for (const entry of fs21.readdirSync(catDir, { withFileTypes: true })) {
39403
39435
  if (!entry.isDirectory()) continue;
39404
- const entryDir = path31.join(catDir, entry.name);
39436
+ const entryDir = path32.join(catDir, entry.name);
39405
39437
  const manifestType = readManifestType(entryDir);
39406
39438
  if (manifestType === type) return entryDir;
39407
39439
  }
@@ -39417,7 +39449,7 @@ var ProviderLoader = class _ProviderLoader {
39417
39449
  * (template substitution is NOT applied here — scripts.js handles that)
39418
39450
  */
39419
39451
  buildScriptWrappersFromDir(dir) {
39420
- const scriptsJs = path31.join(dir, "scripts.js");
39452
+ const scriptsJs = path32.join(dir, "scripts.js");
39421
39453
  if (fs21.existsSync(scriptsJs)) {
39422
39454
  try {
39423
39455
  delete __require.cache[__require.resolve(scriptsJs)];
@@ -39431,7 +39463,7 @@ var ProviderLoader = class _ProviderLoader {
39431
39463
  for (const file of fs21.readdirSync(dir)) {
39432
39464
  if (!file.endsWith(".js")) continue;
39433
39465
  const scriptName = toCamel(file.replace(".js", ""));
39434
- const filePath = path31.join(dir, file);
39466
+ const filePath = path32.join(dir, file);
39435
39467
  result[scriptName] = (...args) => {
39436
39468
  try {
39437
39469
  let content = fs21.readFileSync(filePath, "utf-8");
@@ -39493,7 +39525,7 @@ var ProviderLoader = class _ProviderLoader {
39493
39525
  const hasJson = entries.some((e) => e.name === "provider.json");
39494
39526
  if (hasV1 || hasJson) {
39495
39527
  const manifestFile = hasV1 ? "provider.v1.json" : "provider.json";
39496
- const jsonPath = path31.join(d, manifestFile);
39528
+ const jsonPath = path32.join(d, manifestFile);
39497
39529
  try {
39498
39530
  const raw = fs21.readFileSync(jsonPath, "utf-8");
39499
39531
  const mod = JSON.parse(raw);
@@ -39533,10 +39565,10 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
39533
39565
  this.log(`\u26A0 Invalid provider at ${jsonPath}: ${validation.errors.join("; ")}`);
39534
39566
  } else {
39535
39567
  const hasCompatibility = Array.isArray(normalizedProvider.compatibility);
39536
- const scriptsPath = path31.join(d, "scripts.js");
39568
+ const scriptsPath = path32.join(d, "scripts.js");
39537
39569
  if (!hasCompatibility && fs21.existsSync(scriptsPath)) {
39538
39570
  try {
39539
- registerProviderScriptRootSafely(path31.dirname(path31.dirname(d)));
39571
+ registerProviderScriptRootSafely(path32.dirname(path32.dirname(d)));
39540
39572
  delete __require.cache[__require.resolve(scriptsPath)];
39541
39573
  const scripts = __require(scriptsPath);
39542
39574
  normalizedProvider.scripts = scripts;
@@ -39544,7 +39576,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
39544
39576
  this.log(`\u26A0 Failed to load scripts: ${scriptsPath}: ${e.message}`);
39545
39577
  }
39546
39578
  }
39547
- const externalDirAbs = path31.join(os23.homedir(), ".adhdev", "external");
39579
+ const externalDirAbs = path32.join(os23.homedir(), ".adhdev", "external");
39548
39580
  const layer = d.startsWith(externalDirAbs) ? "external" : d.startsWith(this.userDir) && !d.includes(".upstream") ? "user" : "upstream";
39549
39581
  try {
39550
39582
  const { inspectManifestShape: inspectManifestShape2, classifyTrust: classifyTrust2 } = (init_provider_trust(), __toCommonJS(provider_trust_exports));
@@ -39554,8 +39586,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
39554
39586
  normalizedProvider._sourceTrust = trust;
39555
39587
  normalizedProvider._manifestShape = shape;
39556
39588
  if (layer === "external") {
39557
- const rel = path31.relative(externalDirAbs, d);
39558
- const firstSeg = rel.split(path31.sep)[0];
39589
+ const rel = path32.relative(externalDirAbs, d);
39590
+ const firstSeg = rel.split(path32.sep)[0];
39559
39591
  if (firstSeg && firstSeg !== "..") normalizedProvider._sourceName = firstSeg;
39560
39592
  }
39561
39593
  } catch {
@@ -39579,7 +39611,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
39579
39611
  if (entry.name.startsWith("_") || entry.name.startsWith(".")) continue;
39580
39612
  if (d === dir && entry.name === "examples") continue;
39581
39613
  if (excludeDirs && d === dir && excludeDirs.includes(entry.name)) continue;
39582
- scan(path31.join(d, entry.name));
39614
+ scan(path32.join(d, entry.name));
39583
39615
  }
39584
39616
  }
39585
39617
  };
@@ -39912,8 +39944,8 @@ async function detectCurrentWorkspace(ideId) {
39912
39944
  const appNameMap = getMacAppIdentifiers();
39913
39945
  const appName = appNameMap[ideId];
39914
39946
  if (appName) {
39915
- const storagePath = path32.join(
39916
- process.env.APPDATA || path32.join(os24.homedir(), "AppData", "Roaming"),
39947
+ const storagePath = path33.join(
39948
+ process.env.APPDATA || path33.join(os24.homedir(), "AppData", "Roaming"),
39917
39949
  appName,
39918
39950
  "storage.json"
39919
39951
  );
@@ -40105,9 +40137,9 @@ init_logger();
40105
40137
 
40106
40138
  // src/logging/command-log.ts
40107
40139
  import * as fs22 from "fs";
40108
- import * as path33 from "path";
40140
+ import * as path34 from "path";
40109
40141
  import * as os25 from "os";
40110
- var LOG_DIR2 = process.platform === "win32" ? path33.join(process.env.LOCALAPPDATA || process.env.APPDATA || path33.join(os25.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path33.join(os25.homedir(), "Library", "Logs", "adhdev") : path33.join(os25.homedir(), ".local", "share", "adhdev", "logs");
40142
+ var LOG_DIR2 = process.platform === "win32" ? path34.join(process.env.LOCALAPPDATA || process.env.APPDATA || path34.join(os25.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path34.join(os25.homedir(), "Library", "Logs", "adhdev") : path34.join(os25.homedir(), ".local", "share", "adhdev", "logs");
40111
40143
  var MAX_FILE_SIZE = 5 * 1024 * 1024;
40112
40144
  var MAX_DAYS = 7;
40113
40145
  try {
@@ -40145,13 +40177,13 @@ function getDateStr2() {
40145
40177
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
40146
40178
  }
40147
40179
  var currentDate2 = getDateStr2();
40148
- var currentFile = path33.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
40180
+ var currentFile = path34.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
40149
40181
  var writeCount2 = 0;
40150
40182
  function checkRotation() {
40151
40183
  const today = getDateStr2();
40152
40184
  if (today !== currentDate2) {
40153
40185
  currentDate2 = today;
40154
- currentFile = path33.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
40186
+ currentFile = path34.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
40155
40187
  cleanOldFiles();
40156
40188
  }
40157
40189
  }
@@ -40165,7 +40197,7 @@ function cleanOldFiles() {
40165
40197
  const dateMatch = file.match(/commands-(\d{4}-\d{2}-\d{2})/);
40166
40198
  if (dateMatch && dateMatch[1] < cutoffStr) {
40167
40199
  try {
40168
- fs22.unlinkSync(path33.join(LOG_DIR2, file));
40200
+ fs22.unlinkSync(path34.join(LOG_DIR2, file));
40169
40201
  } catch {
40170
40202
  }
40171
40203
  }
@@ -40262,9 +40294,9 @@ import { execFile as execFile4 } from "child_process";
40262
40294
  import { promisify as promisify6 } from "util";
40263
40295
  var execFileAsync3 = promisify6(execFile4);
40264
40296
  var MAX_CHANGED_FILES2 = 500;
40265
- function topLevel(path40) {
40266
- const slash = path40.indexOf("/");
40267
- return slash === -1 ? path40 : path40.slice(0, slash);
40297
+ function topLevel(path41) {
40298
+ const slash = path41.indexOf("/");
40299
+ return slash === -1 ? path41 : path41.slice(0, slash);
40268
40300
  }
40269
40301
  async function analyzeMeshRefineNodeChangeArea(args) {
40270
40302
  const { nodeId, workspace, branch, baseRef, branchRef, diffCwd, submodulePaths } = args;
@@ -40345,13 +40377,13 @@ function orderMeshRefineBatchNodes(changeAreas) {
40345
40377
  }
40346
40378
 
40347
40379
  // src/mesh/preview-freshness.ts
40348
- import { execFileSync as execFileSync3 } from "child_process";
40349
- import { existsSync as existsSync32, readFileSync as readFileSync25 } from "fs";
40380
+ import { execFileSync as execFileSync4 } from "child_process";
40381
+ import { existsSync as existsSync33, readFileSync as readFileSync25 } from "fs";
40350
40382
  import { resolve as resolve19 } from "path";
40351
40383
  var PREVIEW_DEPLOY_RECORD = ".adhdev/preview-deploy.json";
40352
40384
  function runGit2(repoRoot, args) {
40353
40385
  try {
40354
- return execFileSync3("git", args, {
40386
+ return execFileSync4("git", args, {
40355
40387
  cwd: repoRoot,
40356
40388
  encoding: "utf8",
40357
40389
  stdio: ["ignore", "pipe", "ignore"],
@@ -40362,10 +40394,10 @@ function runGit2(repoRoot, args) {
40362
40394
  }
40363
40395
  }
40364
40396
  function readRecord6(repoRoot) {
40365
- const path40 = resolve19(repoRoot, PREVIEW_DEPLOY_RECORD);
40366
- if (!existsSync32(path40)) return null;
40397
+ const path41 = resolve19(repoRoot, PREVIEW_DEPLOY_RECORD);
40398
+ if (!existsSync33(path41)) return null;
40367
40399
  try {
40368
- const parsed = JSON.parse(readFileSync25(path40, "utf8"));
40400
+ const parsed = JSON.parse(readFileSync25(path41, "utf8"));
40369
40401
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
40370
40402
  } catch {
40371
40403
  return null;
@@ -40430,7 +40462,7 @@ function buildPreviewFreshness(repoRoot) {
40430
40462
  init_mesh_refine_status();
40431
40463
 
40432
40464
  // src/mesh/mesh-init.ts
40433
- import { existsSync as existsSync33, mkdirSync as mkdirSync15, writeFileSync as writeFileSync17 } from "fs";
40465
+ import { existsSync as existsSync34, mkdirSync as mkdirSync15, writeFileSync as writeFileSync17 } from "fs";
40434
40466
  import { dirname as dirname7, join as join37 } from "path";
40435
40467
  var MESH_INIT_REFINE_CONFIG_PATH = MESH_REFINE_CONFIG_LOCATIONS[0];
40436
40468
  var MESH_INIT_WORKTREE_BOOTSTRAP_CONFIG_PATH = MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS[0];
@@ -40453,14 +40485,14 @@ function writeConfigFile(workspace, relativePath, config) {
40453
40485
  }
40454
40486
  function suggestMeshWorktreeBootstrapConfig(workspace) {
40455
40487
  const commands = [];
40456
- const hasPackageJson = existsSync33(join37(workspace, "package.json"));
40457
- const hasNpmLock = existsSync33(join37(workspace, "package-lock.json"));
40488
+ const hasPackageJson = existsSync34(join37(workspace, "package.json"));
40489
+ const hasNpmLock = existsSync34(join37(workspace, "package-lock.json"));
40458
40490
  if (hasPackageJson) {
40459
40491
  commands.push(
40460
40492
  hasNpmLock ? { command: "npm", args: ["ci"] } : { command: "npm", args: ["install"] }
40461
40493
  );
40462
40494
  }
40463
- const staleInputs = CANDIDATE_STALE_INPUTS.filter((relative5) => existsSync33(join37(workspace, relative5)));
40495
+ const staleInputs = CANDIDATE_STALE_INPUTS.filter((relative5) => existsSync34(join37(workspace, relative5)));
40464
40496
  if (!commands.length) {
40465
40497
  return { commands, staleInputs };
40466
40498
  }
@@ -40892,17 +40924,17 @@ function buildStatusSnapshot(options) {
40892
40924
  init_build_info();
40893
40925
 
40894
40926
  // src/commands/upgrade-helper.ts
40895
- import { execFileSync as execFileSync4 } from "child_process";
40927
+ import { execFileSync as execFileSync5 } from "child_process";
40896
40928
  import { spawn as spawn3 } from "child_process";
40897
40929
  import * as fs23 from "fs";
40898
40930
  import * as os27 from "os";
40899
- import * as path34 from "path";
40931
+ import * as path35 from "path";
40900
40932
  var UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
40901
40933
  function getUpgradeLogPath() {
40902
40934
  const home = os27.homedir();
40903
- const dir = path34.join(home, ".adhdev");
40935
+ const dir = path35.join(home, ".adhdev");
40904
40936
  fs23.mkdirSync(dir, { recursive: true });
40905
- return path34.join(dir, "daemon-upgrade.log");
40937
+ return path35.join(dir, "daemon-upgrade.log");
40906
40938
  }
40907
40939
  function appendUpgradeLog(message) {
40908
40940
  const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}
@@ -40913,14 +40945,14 @@ function appendUpgradeLog(message) {
40913
40945
  }
40914
40946
  }
40915
40947
  function resolveSiblingNpmInvocation(nodeExecutable, platform10 = process.platform) {
40916
- const binDir = path34.dirname(nodeExecutable);
40948
+ const binDir = path35.dirname(nodeExecutable);
40917
40949
  if (platform10 === "win32") {
40918
- const npmCliPath = path34.join(binDir, "node_modules", "npm", "bin", "npm-cli.js");
40950
+ const npmCliPath = path35.join(binDir, "node_modules", "npm", "bin", "npm-cli.js");
40919
40951
  if (fs23.existsSync(npmCliPath)) {
40920
40952
  return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: getNpmExecOptions(platform10) };
40921
40953
  }
40922
40954
  for (const candidate of ["npm.exe", "npm"]) {
40923
- const candidatePath = path34.join(binDir, candidate);
40955
+ const candidatePath = path35.join(binDir, candidate);
40924
40956
  if (fs23.existsSync(candidatePath)) {
40925
40957
  return { executable: candidatePath, argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
40926
40958
  }
@@ -40928,7 +40960,7 @@ function resolveSiblingNpmInvocation(nodeExecutable, platform10 = process.platfo
40928
40960
  return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: getNpmExecOptions(platform10) };
40929
40961
  }
40930
40962
  for (const candidate of ["npm"]) {
40931
- const candidatePath = path34.join(binDir, candidate);
40963
+ const candidatePath = path35.join(binDir, candidate);
40932
40964
  if (fs23.existsSync(candidatePath)) {
40933
40965
  return { executable: candidatePath, argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
40934
40966
  }
@@ -40945,13 +40977,13 @@ function findCurrentPackageRoot(currentCliPath, packageName) {
40945
40977
  let currentDir = resolvedPath;
40946
40978
  try {
40947
40979
  if (fs23.statSync(resolvedPath).isFile()) {
40948
- currentDir = path34.dirname(resolvedPath);
40980
+ currentDir = path35.dirname(resolvedPath);
40949
40981
  }
40950
40982
  } catch {
40951
- currentDir = path34.dirname(resolvedPath);
40983
+ currentDir = path35.dirname(resolvedPath);
40952
40984
  }
40953
40985
  while (true) {
40954
- const packageJsonPath = path34.join(currentDir, "package.json");
40986
+ const packageJsonPath = path35.join(currentDir, "package.json");
40955
40987
  try {
40956
40988
  if (fs23.existsSync(packageJsonPath)) {
40957
40989
  const parsed = JSON.parse(fs23.readFileSync(packageJsonPath, "utf8"));
@@ -40962,7 +40994,7 @@ function findCurrentPackageRoot(currentCliPath, packageName) {
40962
40994
  }
40963
40995
  } catch {
40964
40996
  }
40965
- const parentDir = path34.dirname(currentDir);
40997
+ const parentDir = path35.dirname(currentDir);
40966
40998
  if (parentDir === currentDir) {
40967
40999
  return null;
40968
41000
  }
@@ -40970,13 +41002,13 @@ function findCurrentPackageRoot(currentCliPath, packageName) {
40970
41002
  }
40971
41003
  }
40972
41004
  function resolveInstallPrefixFromPackageRoot(packageRoot, packageName) {
40973
- const nodeModulesDir = packageName.startsWith("@") ? path34.dirname(path34.dirname(packageRoot)) : path34.dirname(packageRoot);
40974
- if (path34.basename(nodeModulesDir) !== "node_modules") {
41005
+ const nodeModulesDir = packageName.startsWith("@") ? path35.dirname(path35.dirname(packageRoot)) : path35.dirname(packageRoot);
41006
+ if (path35.basename(nodeModulesDir) !== "node_modules") {
40975
41007
  return null;
40976
41008
  }
40977
- const maybeLibDir = path34.dirname(nodeModulesDir);
40978
- if (path34.basename(maybeLibDir) === "lib") {
40979
- return path34.dirname(maybeLibDir);
41009
+ const maybeLibDir = path35.dirname(nodeModulesDir);
41010
+ if (path35.basename(maybeLibDir) === "lib") {
41011
+ return path35.dirname(maybeLibDir);
40980
41012
  }
40981
41013
  return maybeLibDir;
40982
41014
  }
@@ -41004,6 +41036,16 @@ function buildPinnedGlobalInstallCommand(options) {
41004
41036
  execOptions: surface.execOptions || getNpmExecOptions(options.platform)
41005
41037
  };
41006
41038
  }
41039
+ function buildInstallEnvWithNodeOnPath(baseEnv = process.env) {
41040
+ if (process.platform !== "win32") return { ...baseEnv };
41041
+ const nodeBinDir = path35.dirname(process.execPath);
41042
+ if (!nodeBinDir) return { ...baseEnv };
41043
+ const env = { ...baseEnv };
41044
+ const pathKey = Object.keys(env).find((k) => k.toLowerCase() === "path") || "PATH";
41045
+ const current = env[pathKey] || "";
41046
+ env[pathKey] = current ? `${nodeBinDir};${current}` : nodeBinDir;
41047
+ return env;
41048
+ }
41007
41049
  function getNpmExecOptions(platform10 = process.platform) {
41008
41050
  if (platform10 === "win32") {
41009
41051
  return { shell: false, windowsHide: true };
@@ -41012,7 +41054,7 @@ function getNpmExecOptions(platform10 = process.platform) {
41012
41054
  }
41013
41055
  function execNpmCommandSync(args, options = {}, surface) {
41014
41056
  const execOptions = surface?.execOptions || getNpmExecOptions();
41015
- return execFileSync4(
41057
+ return execFileSync5(
41016
41058
  surface?.npmExecutable || "npm",
41017
41059
  [...surface?.npmArgsPrefix || [], ...args],
41018
41060
  {
@@ -41025,7 +41067,7 @@ function execNpmCommandSync(args, options = {}, surface) {
41025
41067
  function killPid(pid) {
41026
41068
  try {
41027
41069
  if (process.platform === "win32") {
41028
- execFileSync4("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
41070
+ execFileSync5("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
41029
41071
  } else {
41030
41072
  process.kill(pid, "SIGTERM");
41031
41073
  }
@@ -41037,7 +41079,7 @@ function killPid(pid) {
41037
41079
  function getWindowsProcessCommandLine(pid) {
41038
41080
  const pidFilter = `ProcessId=${pid}`;
41039
41081
  try {
41040
- const psOut = execFileSync4("powershell.exe", [
41082
+ const psOut = execFileSync5("powershell.exe", [
41041
41083
  "-NoProfile",
41042
41084
  "-NonInteractive",
41043
41085
  "-ExecutionPolicy",
@@ -41049,7 +41091,7 @@ function getWindowsProcessCommandLine(pid) {
41049
41091
  } catch {
41050
41092
  }
41051
41093
  try {
41052
- const wmicOut = execFileSync4("wmic", [
41094
+ const wmicOut = execFileSync5("wmic", [
41053
41095
  "process",
41054
41096
  "where",
41055
41097
  pidFilter,
@@ -41065,7 +41107,7 @@ function getProcessCommandLine(pid) {
41065
41107
  if (!Number.isFinite(pid) || pid <= 0) return null;
41066
41108
  if (process.platform === "win32") return getWindowsProcessCommandLine(pid);
41067
41109
  try {
41068
- const text = execFileSync4("ps", ["-o", "command=", "-p", String(pid)], {
41110
+ const text = execFileSync5("ps", ["-o", "command=", "-p", String(pid)], {
41069
41111
  encoding: "utf8",
41070
41112
  timeout: 3e3,
41071
41113
  stdio: ["ignore", "pipe", "ignore"]
@@ -41091,7 +41133,7 @@ async function waitForPidExit(pid, timeoutMs) {
41091
41133
  }
41092
41134
  }
41093
41135
  function stopSessionHostProcesses(appName) {
41094
- const pidFile = path34.join(os27.homedir(), ".adhdev", `${appName}-session-host.pid`);
41136
+ const pidFile = path35.join(os27.homedir(), ".adhdev", `${appName}-session-host.pid`);
41095
41137
  try {
41096
41138
  if (fs23.existsSync(pidFile)) {
41097
41139
  const pid = Number.parseInt(fs23.readFileSync(pidFile, "utf8").trim(), 10);
@@ -41108,7 +41150,7 @@ function stopSessionHostProcesses(appName) {
41108
41150
  }
41109
41151
  }
41110
41152
  function removeDaemonPidFile() {
41111
- const pidFile = path34.join(os27.homedir(), ".adhdev", "daemon.pid");
41153
+ const pidFile = path35.join(os27.homedir(), ".adhdev", "daemon.pid");
41112
41154
  try {
41113
41155
  fs23.unlinkSync(pidFile);
41114
41156
  } catch {
@@ -41119,7 +41161,7 @@ function cleanupStaleGlobalInstallDirs(pkgName, surface) {
41119
41161
  const npmRoot = String(execNpmCommandSync(["root", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
41120
41162
  if (!npmRoot) return;
41121
41163
  const npmPrefix = surface.installPrefix || String(execNpmCommandSync(["prefix", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
41122
- const binDir = process.platform === "win32" ? npmPrefix : path34.join(npmPrefix, "bin");
41164
+ const binDir = process.platform === "win32" ? npmPrefix : path35.join(npmPrefix, "bin");
41123
41165
  const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
41124
41166
  const binNames = /* @__PURE__ */ new Set([packageBaseName]);
41125
41167
  if (pkgName === "@adhdev/daemon-standalone") {
@@ -41127,25 +41169,25 @@ function cleanupStaleGlobalInstallDirs(pkgName, surface) {
41127
41169
  }
41128
41170
  if (pkgName.startsWith("@")) {
41129
41171
  const [scope, name] = pkgName.split("/");
41130
- const scopeDir = path34.join(npmRoot, scope);
41172
+ const scopeDir = path35.join(npmRoot, scope);
41131
41173
  if (!fs23.existsSync(scopeDir)) return;
41132
41174
  for (const entry of fs23.readdirSync(scopeDir)) {
41133
41175
  if (!entry.startsWith(`.${name}-`)) continue;
41134
- fs23.rmSync(path34.join(scopeDir, entry), { recursive: true, force: true });
41135
- appendUpgradeLog(`Removed stale scoped staging dir: ${path34.join(scopeDir, entry)}`);
41176
+ fs23.rmSync(path35.join(scopeDir, entry), { recursive: true, force: true });
41177
+ appendUpgradeLog(`Removed stale scoped staging dir: ${path35.join(scopeDir, entry)}`);
41136
41178
  }
41137
41179
  } else {
41138
41180
  for (const entry of fs23.readdirSync(npmRoot)) {
41139
41181
  if (!entry.startsWith(`.${pkgName}-`)) continue;
41140
- fs23.rmSync(path34.join(npmRoot, entry), { recursive: true, force: true });
41141
- appendUpgradeLog(`Removed stale staging dir: ${path34.join(npmRoot, entry)}`);
41182
+ fs23.rmSync(path35.join(npmRoot, entry), { recursive: true, force: true });
41183
+ appendUpgradeLog(`Removed stale staging dir: ${path35.join(npmRoot, entry)}`);
41142
41184
  }
41143
41185
  }
41144
41186
  if (fs23.existsSync(binDir)) {
41145
41187
  for (const entry of fs23.readdirSync(binDir)) {
41146
41188
  if (!Array.from(binNames).some((name) => entry.startsWith(`.${name}-`))) continue;
41147
- fs23.rmSync(path34.join(binDir, entry), { recursive: true, force: true });
41148
- appendUpgradeLog(`Removed stale bin staging entry: ${path34.join(binDir, entry)}`);
41189
+ fs23.rmSync(path35.join(binDir, entry), { recursive: true, force: true });
41190
+ appendUpgradeLog(`Removed stale bin staging entry: ${path35.join(binDir, entry)}`);
41149
41191
  }
41150
41192
  }
41151
41193
  }
@@ -41181,13 +41223,14 @@ async function runDaemonUpgradeHelper(payload) {
41181
41223
  cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
41182
41224
  const spec = `${payload.packageName}@${payload.targetVersion || "latest"}`;
41183
41225
  appendUpgradeLog(`Installing ${spec}`);
41184
- const installOutput = execFileSync4(
41226
+ const installOutput = execFileSync5(
41185
41227
  installCommand.command,
41186
41228
  installCommand.args,
41187
41229
  {
41188
41230
  encoding: "utf8",
41189
41231
  stdio: "pipe",
41190
41232
  maxBuffer: 20 * 1024 * 1024,
41233
+ env: buildInstallEnvWithNodeOnPath(),
41191
41234
  ...installCommand.execOptions
41192
41235
  }
41193
41236
  );
@@ -41235,7 +41278,7 @@ init_repo_mesh_types();
41235
41278
  import { homedir as homedir26, hostname as osHostname } from "os";
41236
41279
  import { basename as pathBasename, join as pathJoin, resolve as pathResolve2 } from "path";
41237
41280
  import * as fs24 from "fs";
41238
- import { execFileSync as execFileSync5 } from "child_process";
41281
+ import { execFileSync as execFileSync6 } from "child_process";
41239
41282
  var CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
41240
41283
  var CHANNEL_SERVER_URL = {
41241
41284
  stable: "https://api.adhf.dev",
@@ -42212,18 +42255,18 @@ function resolveRefineryAutoPublishSubmoduleMainCommits(mesh, workspace) {
42212
42255
  return { enabled: false };
42213
42256
  }
42214
42257
  async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
42215
- const { execFileSync: execFileSync6 } = await import("child_process");
42258
+ const { execFileSync: execFileSync7 } = await import("child_process");
42216
42259
  const diffArgs = ["diff", "--patch", "--full-index", fromRef, toRef];
42217
42260
  if (excludePaths.length > 0) {
42218
- diffArgs.push("--", ".", ...excludePaths.map((path40) => `:(exclude)${path40}`));
42261
+ diffArgs.push("--", ".", ...excludePaths.map((path41) => `:(exclude)${path41}`));
42219
42262
  }
42220
- const diff = execFileSync6("git", diffArgs, {
42263
+ const diff = execFileSync7("git", diffArgs, {
42221
42264
  cwd,
42222
42265
  encoding: "utf8",
42223
42266
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
42224
42267
  });
42225
42268
  if (!diff.trim()) return "";
42226
- const patchId = execFileSync6("git", ["patch-id", "--stable"], {
42269
+ const patchId = execFileSync7("git", ["patch-id", "--stable"], {
42227
42270
  cwd,
42228
42271
  input: diff,
42229
42272
  encoding: "utf8",
@@ -42234,8 +42277,8 @@ async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
42234
42277
  async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead) {
42235
42278
  const startedAt = Date.now();
42236
42279
  try {
42237
- const { execFileSync: execFileSync6 } = await import("child_process");
42238
- const git = (args) => execFileSync6("git", args, {
42280
+ const { execFileSync: execFileSync7 } = await import("child_process");
42281
+ const git = (args) => execFileSync7("git", args, {
42239
42282
  cwd: repoRoot,
42240
42283
  encoding: "utf8",
42241
42284
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
@@ -42326,8 +42369,8 @@ ${e?.stderr || ""}`
42326
42369
  async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
42327
42370
  const startedAt = Date.now();
42328
42371
  try {
42329
- const { execFileSync: execFileSync6 } = await import("child_process");
42330
- const git = (args, opts) => execFileSync6("git", args, {
42372
+ const { execFileSync: execFileSync7 } = await import("child_process");
42373
+ const git = (args, opts) => execFileSync7("git", args, {
42331
42374
  cwd: opts?.cwd || repoRoot,
42332
42375
  encoding: "utf8",
42333
42376
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
@@ -42352,9 +42395,9 @@ async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
42352
42395
  if (!trimmed) continue;
42353
42396
  if (trimmed.startsWith("+")) {
42354
42397
  const parts = trimmed.slice(1).trim().split(/\s+/);
42355
- const path40 = parts[1] || parts[0] || "(unknown)";
42398
+ const path41 = parts[1] || parts[0] || "(unknown)";
42356
42399
  submoduleHints.push({
42357
- path: path40,
42400
+ path: path41,
42358
42401
  reason: "submodule checked-out commit differs from the committed gitlink (pointer bump not committed on the root branch)"
42359
42402
  });
42360
42403
  }
@@ -42384,10 +42427,10 @@ async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
42384
42427
  }
42385
42428
  function buildPatchEquivalenceSubmoduleConflictHint(repoRoot, baseHead, branchHead, output) {
42386
42429
  if (!/(submodule|160000)/i.test(output) || !/(conflict|failed to merge)/i.test(output)) return void 0;
42387
- const conflicts = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path40) => ({
42388
- path: path40,
42389
- baseCommit: readTreeObject(repoRoot, baseHead, path40),
42390
- branchCommit: readTreeObject(repoRoot, branchHead, path40)
42430
+ const conflicts = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path41) => ({
42431
+ path: path41,
42432
+ baseCommit: readTreeObject(repoRoot, baseHead, path41),
42433
+ branchCommit: readTreeObject(repoRoot, branchHead, path41)
42391
42434
  }));
42392
42435
  if (conflicts.length === 0) return void 0;
42393
42436
  return {
@@ -42403,7 +42446,7 @@ function buildPatchEquivalenceSubmoduleConflictHint(repoRoot, baseHead, branchHe
42403
42446
  }
42404
42447
  function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
42405
42448
  try {
42406
- const output = execFileSync5("git", ["diff", "--raw", "--no-abbrev", fromRef, toRef], {
42449
+ const output = execFileSync6("git", ["diff", "--raw", "--no-abbrev", fromRef, toRef], {
42407
42450
  cwd: repoRoot,
42408
42451
  encoding: "utf8",
42409
42452
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
@@ -42413,11 +42456,11 @@ function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
42413
42456
  if (!line.trim()) continue;
42414
42457
  const metaAndPath = line.split(" ");
42415
42458
  const meta = metaAndPath[0] || "";
42416
- const path40 = metaAndPath[metaAndPath.length - 1]?.trim();
42417
- if (!path40) continue;
42459
+ const path41 = metaAndPath[metaAndPath.length - 1]?.trim();
42460
+ if (!path41) continue;
42418
42461
  const parts = meta.split(/\s+/);
42419
42462
  if (parts[0]?.includes("160000") || parts[1]?.includes("160000")) {
42420
- paths.add(path40);
42463
+ paths.add(path41);
42421
42464
  }
42422
42465
  }
42423
42466
  return [...paths].sort();
@@ -42425,9 +42468,9 @@ function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
42425
42468
  return [];
42426
42469
  }
42427
42470
  }
42428
- function readTreeObject(repoRoot, ref, path40) {
42471
+ function readTreeObject(repoRoot, ref, path41) {
42429
42472
  try {
42430
- const output = execFileSync5("git", ["ls-tree", ref, "--", path40], {
42473
+ const output = execFileSync6("git", ["ls-tree", ref, "--", path41], {
42431
42474
  cwd: repoRoot,
42432
42475
  encoding: "utf8",
42433
42476
  maxBuffer: 1024 * 1024
@@ -42439,7 +42482,7 @@ function readTreeObject(repoRoot, ref, path40) {
42439
42482
  }
42440
42483
  }
42441
42484
  function resolveGitDir(repoRoot) {
42442
- const out = execFileSync5("git", ["rev-parse", "--absolute-git-dir"], {
42485
+ const out = execFileSync6("git", ["rev-parse", "--absolute-git-dir"], {
42443
42486
  cwd: repoRoot,
42444
42487
  encoding: "utf8",
42445
42488
  maxBuffer: 1024 * 1024
@@ -42451,9 +42494,9 @@ function isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit) {
42451
42494
  if (baseCommit === branchCommit) return true;
42452
42495
  try {
42453
42496
  if (!fs24.existsSync(submoduleRepoPath)) return false;
42454
- execFileSync5("git", ["cat-file", "-e", `${baseCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
42455
- execFileSync5("git", ["cat-file", "-e", `${branchCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
42456
- execFileSync5("git", ["merge-base", "--is-ancestor", baseCommit, branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
42497
+ execFileSync6("git", ["cat-file", "-e", `${baseCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
42498
+ execFileSync6("git", ["cat-file", "-e", `${branchCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
42499
+ execFileSync6("git", ["merge-base", "--is-ancestor", baseCommit, branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
42457
42500
  return true;
42458
42501
  } catch {
42459
42502
  return false;
@@ -42461,7 +42504,7 @@ function isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit) {
42461
42504
  }
42462
42505
  function readChangedPathKinds(repoRoot, fromRef, toRef) {
42463
42506
  try {
42464
- const output = execFileSync5("git", ["diff", "--raw", "--no-abbrev", fromRef, toRef], {
42507
+ const output = execFileSync6("git", ["diff", "--raw", "--no-abbrev", fromRef, toRef], {
42465
42508
  cwd: repoRoot,
42466
42509
  encoding: "utf8",
42467
42510
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
@@ -42472,12 +42515,12 @@ function readChangedPathKinds(repoRoot, fromRef, toRef) {
42472
42515
  if (!line.trim()) continue;
42473
42516
  const metaAndPath = line.split(" ");
42474
42517
  const meta = metaAndPath[0] || "";
42475
- const path40 = metaAndPath[metaAndPath.length - 1]?.trim();
42476
- if (!path40 || seen.has(path40)) continue;
42477
- seen.add(path40);
42518
+ const path41 = metaAndPath[metaAndPath.length - 1]?.trim();
42519
+ if (!path41 || seen.has(path41)) continue;
42520
+ seen.add(path41);
42478
42521
  const parts = meta.split(/\s+/);
42479
42522
  const isGitlink = !!(parts[0]?.includes("160000") || parts[1]?.includes("160000"));
42480
- result.push({ path: path40, isGitlink });
42523
+ result.push({ path: path41, isGitlink });
42481
42524
  }
42482
42525
  return result;
42483
42526
  } catch {
@@ -42485,20 +42528,20 @@ function readChangedPathKinds(repoRoot, fromRef, toRef) {
42485
42528
  }
42486
42529
  }
42487
42530
  function collectFastForwardGitlinkPaths(repoRoot, baseHead, branchHead) {
42488
- return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((path40) => {
42489
- const baseCommit = readTreeObject(repoRoot, baseHead, path40);
42490
- const branchCommit = readTreeObject(repoRoot, branchHead, path40);
42531
+ return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((path41) => {
42532
+ const baseCommit = readTreeObject(repoRoot, baseHead, path41);
42533
+ const branchCommit = readTreeObject(repoRoot, branchHead, path41);
42491
42534
  if (!baseCommit || !branchCommit) return false;
42492
- return isSubmoduleFastForward(pathResolve2(repoRoot, path40), baseCommit, branchCommit);
42535
+ return isSubmoduleFastForward(pathResolve2(repoRoot, path41), baseCommit, branchCommit);
42493
42536
  });
42494
42537
  }
42495
42538
  function evaluateGitlinkTrivialFastForward(repoRoot, baseHead, branchHead) {
42496
- const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path40) => {
42497
- const baseCommit = readTreeObject(repoRoot, baseHead, path40);
42498
- const branchCommit = readTreeObject(repoRoot, branchHead, path40);
42499
- const submoduleRepoPath = pathResolve2(repoRoot, path40);
42539
+ const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path41) => {
42540
+ const baseCommit = readTreeObject(repoRoot, baseHead, path41);
42541
+ const branchCommit = readTreeObject(repoRoot, branchHead, path41);
42542
+ const submoduleRepoPath = pathResolve2(repoRoot, path41);
42500
42543
  const fastForward = !!baseCommit && !!branchCommit && isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit);
42501
- return { path: path40, baseCommit, branchCommit, fastForward };
42544
+ return { path: path41, baseCommit, branchCommit, fastForward };
42502
42545
  });
42503
42546
  if (changedGitlinks.length === 0) {
42504
42547
  return { trivial: false, reason: "no_changed_gitlinks", gitlinks: changedGitlinks };
@@ -42513,7 +42556,7 @@ function evaluateGitlinkTrivialFastForward(repoRoot, baseHead, branchHead) {
42513
42556
  }
42514
42557
  let mergeBase = "";
42515
42558
  try {
42516
- mergeBase = execFileSync5("git", ["merge-base", baseHead, branchHead], {
42559
+ mergeBase = execFileSync6("git", ["merge-base", baseHead, branchHead], {
42517
42560
  cwd: repoRoot,
42518
42561
  encoding: "utf8",
42519
42562
  maxBuffer: 1024 * 1024
@@ -42543,19 +42586,19 @@ function evaluateGitlinkTrivialFastForward(repoRoot, baseHead, branchHead) {
42543
42586
  }
42544
42587
  function buildTreeWithGitlinksEqualized(repoRoot, commitish, paths, placeholderCommit) {
42545
42588
  try {
42546
- const tree = execFileSync5("git", ["rev-parse", `${commitish}^{tree}`], {
42589
+ const tree = execFileSync6("git", ["rev-parse", `${commitish}^{tree}`], {
42547
42590
  cwd: repoRoot,
42548
42591
  encoding: "utf8",
42549
42592
  maxBuffer: 1024 * 1024
42550
42593
  }).trim();
42551
42594
  if (!tree) return void 0;
42552
- const updates = paths.map((path40) => `160000 commit ${placeholderCommit} ${path40}`).join("\n");
42595
+ const updates = paths.map((path41) => `160000 commit ${placeholderCommit} ${path41}`).join("\n");
42553
42596
  if (!updates) return tree;
42554
42597
  const tmpIndex = pathJoin(resolveGitDir(repoRoot), `adhdev-refine-eq-${commitish.slice(0, 12)}.index`);
42555
42598
  const env = { ...process.env, GIT_INDEX_FILE: tmpIndex };
42556
42599
  try {
42557
- execFileSync5("git", ["read-tree", tree], { cwd: repoRoot, env, stdio: "ignore" });
42558
- execFileSync5("git", ["update-index", "--index-info"], {
42600
+ execFileSync6("git", ["read-tree", tree], { cwd: repoRoot, env, stdio: "ignore" });
42601
+ execFileSync6("git", ["update-index", "--index-info"], {
42559
42602
  cwd: repoRoot,
42560
42603
  env,
42561
42604
  input: `${updates}
@@ -42563,7 +42606,7 @@ function buildTreeWithGitlinksEqualized(repoRoot, commitish, paths, placeholderC
42563
42606
  encoding: "utf8",
42564
42607
  stdio: ["pipe", "ignore", "ignore"]
42565
42608
  });
42566
- const newTree = execFileSync5("git", ["write-tree"], { cwd: repoRoot, env, encoding: "utf8" }).trim();
42609
+ const newTree = execFileSync6("git", ["write-tree"], { cwd: repoRoot, env, encoding: "utf8" }).trim();
42567
42610
  return newTree || void 0;
42568
42611
  } finally {
42569
42612
  try {
@@ -42579,7 +42622,7 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
42579
42622
  try {
42580
42623
  const branchGitlinks = gitlinks.filter((entry) => entry.branchCommit);
42581
42624
  const gitlinkPaths = branchGitlinks.map((entry) => entry.path);
42582
- const mergeBase = execFileSync5("git", ["merge-base", baseHead, branchHead], {
42625
+ const mergeBase = execFileSync6("git", ["merge-base", baseHead, branchHead], {
42583
42626
  cwd: repoRoot,
42584
42627
  encoding: "utf8",
42585
42628
  maxBuffer: 1024 * 1024
@@ -42592,22 +42635,22 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
42592
42635
  const theirsEqTree = buildTreeWithGitlinksEqualized(repoRoot, branchHead, gitlinkPaths, placeholder);
42593
42636
  if (baseEqTree && oursEqTree && theirsEqTree) {
42594
42637
  try {
42595
- const baseEqCommit = execFileSync5("git", ["commit-tree", baseEqTree, "-m", "refine-ff-base"], {
42638
+ const baseEqCommit = execFileSync6("git", ["commit-tree", baseEqTree, "-m", "refine-ff-base"], {
42596
42639
  cwd: repoRoot,
42597
42640
  encoding: "utf8",
42598
42641
  maxBuffer: 1024 * 1024
42599
42642
  }).trim();
42600
- const oursEqCommit = execFileSync5("git", ["commit-tree", oursEqTree, "-p", baseEqCommit, "-m", "refine-ff-ours"], {
42643
+ const oursEqCommit = execFileSync6("git", ["commit-tree", oursEqTree, "-p", baseEqCommit, "-m", "refine-ff-ours"], {
42601
42644
  cwd: repoRoot,
42602
42645
  encoding: "utf8",
42603
42646
  maxBuffer: 1024 * 1024
42604
42647
  }).trim();
42605
- const theirsEqCommit = execFileSync5("git", ["commit-tree", theirsEqTree, "-p", baseEqCommit, "-m", "refine-ff-theirs"], {
42648
+ const theirsEqCommit = execFileSync6("git", ["commit-tree", theirsEqTree, "-p", baseEqCommit, "-m", "refine-ff-theirs"], {
42606
42649
  cwd: repoRoot,
42607
42650
  encoding: "utf8",
42608
42651
  maxBuffer: 1024 * 1024
42609
42652
  }).trim();
42610
- const mergeOut = execFileSync5("git", ["merge-tree", "--write-tree", oursEqCommit, theirsEqCommit], {
42653
+ const mergeOut = execFileSync6("git", ["merge-tree", "--write-tree", oursEqCommit, theirsEqCommit], {
42611
42654
  cwd: repoRoot,
42612
42655
  encoding: "utf8",
42613
42656
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
@@ -42618,7 +42661,7 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
42618
42661
  }
42619
42662
  }
42620
42663
  }
42621
- const contentTree = mergedContentTree || execFileSync5("git", ["rev-parse", `${baseHead}^{tree}`], {
42664
+ const contentTree = mergedContentTree || execFileSync6("git", ["rev-parse", `${baseHead}^{tree}`], {
42622
42665
  cwd: repoRoot,
42623
42666
  encoding: "utf8",
42624
42667
  maxBuffer: 1024 * 1024
@@ -42629,8 +42672,8 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
42629
42672
  const tmpIndex = pathJoin(resolveGitDir(repoRoot), `adhdev-refine-ff-${baseHead.slice(0, 12)}-${branchHead.slice(0, 12)}.index`);
42630
42673
  const env = { ...process.env, GIT_INDEX_FILE: tmpIndex };
42631
42674
  try {
42632
- execFileSync5("git", ["read-tree", contentTree], { cwd: repoRoot, env, stdio: "ignore" });
42633
- execFileSync5("git", ["update-index", "--index-info"], {
42675
+ execFileSync6("git", ["read-tree", contentTree], { cwd: repoRoot, env, stdio: "ignore" });
42676
+ execFileSync6("git", ["update-index", "--index-info"], {
42634
42677
  cwd: repoRoot,
42635
42678
  env,
42636
42679
  input: `${updates}
@@ -42638,7 +42681,7 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
42638
42681
  encoding: "utf8",
42639
42682
  stdio: ["pipe", "ignore", "ignore"]
42640
42683
  });
42641
- const newTree = execFileSync5("git", ["write-tree"], { cwd: repoRoot, env, encoding: "utf8" }).trim();
42684
+ const newTree = execFileSync6("git", ["write-tree"], { cwd: repoRoot, env, encoding: "utf8" }).trim();
42642
42685
  return newTree || void 0;
42643
42686
  } finally {
42644
42687
  try {
@@ -42652,7 +42695,7 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
42652
42695
  }
42653
42696
  async function alignRefinerySubmodulesAfterMerge(repoRoot, previousBaseHead, currentHead, options = {}) {
42654
42697
  const startedAt = Date.now();
42655
- const changedGitlinkPaths = readChangedGitlinkPaths(repoRoot, previousBaseHead, currentHead).filter((path40) => !(options.submoduleIgnorePaths || []).includes(path40));
42698
+ const changedGitlinkPaths = readChangedGitlinkPaths(repoRoot, previousBaseHead, currentHead).filter((path41) => !(options.submoduleIgnorePaths || []).includes(path41));
42656
42699
  const preStatus = await getGitRepoStatus(repoRoot, {
42657
42700
  includeSubmodules: true,
42658
42701
  submoduleIgnorePaths: options.submoduleIgnorePaths,
@@ -42693,7 +42736,7 @@ async function alignRefinerySubmodulesAfterMerge(repoRoot, previousBaseHead, cur
42693
42736
  changedGitlinkPaths,
42694
42737
  outOfSyncPaths,
42695
42738
  updatedPaths: updatePaths,
42696
- verifiedPaths: updatePaths.filter((path40) => !remaining.some((submodule) => submodule.path === path40)),
42739
+ verifiedPaths: updatePaths.filter((path41) => !remaining.some((submodule) => submodule.path === path41)),
42697
42740
  durationMs: Date.now() - startedAt,
42698
42741
  command: `git ${commandArgs.join(" ")}`,
42699
42742
  stdout: truncateValidationOutput(result.stdout),
@@ -44316,7 +44359,7 @@ ${tail}` : ""
44316
44359
  let didAutoRebase = false;
44317
44360
  let isBehindBase = false;
44318
44361
  try {
44319
- execFileSync5("git", ["merge-base", "--is-ancestor", branchHead, baseHead], {
44362
+ execFileSync6("git", ["merge-base", "--is-ancestor", branchHead, baseHead], {
44320
44363
  cwd: node.workspace,
44321
44364
  stdio: "ignore"
44322
44365
  });
@@ -44326,7 +44369,7 @@ ${tail}` : ""
44326
44369
  if (isBehindBase) {
44327
44370
  const autoRebaseStarted = Date.now();
44328
44371
  try {
44329
- execFileSync5("git", ["rebase", baseHead], {
44372
+ execFileSync6("git", ["rebase", baseHead], {
44330
44373
  cwd: node.workspace,
44331
44374
  stdio: ["ignore", "pipe", "pipe"]
44332
44375
  });
@@ -44367,7 +44410,7 @@ ${tail}` : ""
44367
44410
  }
44368
44411
  } catch (rebaseErr) {
44369
44412
  try {
44370
- execFileSync5("git", ["rebase", "--abort"], { cwd: node.workspace, stdio: "ignore" });
44413
+ execFileSync6("git", ["rebase", "--abort"], { cwd: node.workspace, stdio: "ignore" });
44371
44414
  } catch {
44372
44415
  }
44373
44416
  recordMeshRefineStage(refineStages, "patch_equivalence_after_auto_rebase", "failed", autoRebaseStarted, {
@@ -45991,9 +46034,9 @@ ${hintLines.join("\n")}` : "",
45991
46034
  // commands instead of going through fs from the browser.
45992
46035
  case "list_coordinator_prompts": {
45993
46036
  const fs30 = await import("fs");
45994
- const path40 = await import("path");
46037
+ const path41 = await import("path");
45995
46038
  const os30 = await import("os");
45996
- const dir = path40.join(os30.homedir(), ".adhdev", "coordinator-prompts");
46039
+ const dir = path41.join(os30.homedir(), ".adhdev", "coordinator-prompts");
45997
46040
  const entries = {};
45998
46041
  try {
45999
46042
  if (fs30.existsSync(dir)) {
@@ -46004,7 +46047,7 @@ ${hintLines.join("\n")}` : "",
46004
46047
  if (!m) continue;
46005
46048
  const isAppend = !!matchAppend;
46006
46049
  const key = m[1];
46007
- const full = path40.join(dir, name);
46050
+ const full = path41.join(dir, name);
46008
46051
  let content = "";
46009
46052
  try {
46010
46053
  content = fs30.readFileSync(full, "utf8");
@@ -46022,7 +46065,7 @@ ${hintLines.join("\n")}` : "",
46022
46065
  }
46023
46066
  case "write_coordinator_prompt": {
46024
46067
  const fs30 = await import("fs");
46025
- const path40 = await import("path");
46068
+ const path41 = await import("path");
46026
46069
  const os30 = await import("os");
46027
46070
  const key = typeof args?.key === "string" ? args.key.trim() : "";
46028
46071
  const kind = args?.kind === "append" ? "append" : "override";
@@ -46030,9 +46073,9 @@ ${hintLines.join("\n")}` : "",
46030
46073
  if (!key || !/^[a-zA-Z0-9_.-]+$/.test(key)) {
46031
46074
  return { success: false, error: "key must match [a-zA-Z0-9_.-]+" };
46032
46075
  }
46033
- const dir = path40.join(os30.homedir(), ".adhdev", "coordinator-prompts");
46076
+ const dir = path41.join(os30.homedir(), ".adhdev", "coordinator-prompts");
46034
46077
  const filename = kind === "append" ? `${key}.append.md` : `${key}.md`;
46035
- const full = path40.join(dir, filename);
46078
+ const full = path41.join(dir, filename);
46036
46079
  try {
46037
46080
  fs30.mkdirSync(dir, { recursive: true });
46038
46081
  if (content.trim()) {
@@ -47587,7 +47630,7 @@ ${ptyResult.output.slice(-2e3)}`);
47587
47630
  workspace
47588
47631
  };
47589
47632
  }
47590
- const { existsSync: existsSync42, readFileSync: readFileSync35, writeFileSync: writeFileSync23, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
47633
+ const { existsSync: existsSync43, readFileSync: readFileSync35, writeFileSync: writeFileSync23, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
47591
47634
  const { dirname: dirname14 } = await import("path");
47592
47635
  const mcpConfigPath = coordinatorSetup.configPath;
47593
47636
  const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
@@ -47630,7 +47673,7 @@ ${ptyResult.output.slice(-2e3)}`);
47630
47673
  if (hermesManualFallback) return returnManualFallback(message);
47631
47674
  return { success: false, code: "mesh_coordinator_config_write_failed", error: message, meshId, cliType, workspace };
47632
47675
  }
47633
- const hadExistingMcpConfig = existsSync42(mcpConfigPath);
47676
+ const hadExistingMcpConfig = existsSync43(mcpConfigPath);
47634
47677
  let existingMcpConfig = hermesBaseConfig?.config || {};
47635
47678
  if (hermesBaseConfig) {
47636
47679
  copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname14(mcpConfigPath));
@@ -48148,7 +48191,7 @@ ${ptyResult.output.slice(-2e3)}`);
48148
48191
  const { deriveMeshReviewInboxItems: deriveMeshReviewInboxItems2 } = await Promise.resolve().then(() => (init_mesh_review_inbox(), mesh_review_inbox_exports));
48149
48192
  const { readLedgerEntries: readLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
48150
48193
  const { getGitDiffSummary: getGitDiffSummary2 } = await Promise.resolve().then(() => (init_git_diff(), git_diff_exports));
48151
- const { existsSync: existsSync42 } = await import("fs");
48194
+ const { existsSync: existsSync43 } = await import("fs");
48152
48195
  const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
48153
48196
  const mesh = meshRecord?.mesh;
48154
48197
  if (!mesh) return { success: false, error: "Mesh not found" };
@@ -48167,7 +48210,7 @@ ${ptyResult.output.slice(-2e3)}`);
48167
48210
  const derivation = deriveMeshReviewInboxItems2({ nodes: nodeStatuses, ledgerEntries });
48168
48211
  for (const item of derivation.items) {
48169
48212
  const workspace = item.workspace;
48170
- if (!workspace || !existsSync42(workspace)) continue;
48213
+ if (!workspace || !existsSync43(workspace)) continue;
48171
48214
  const baseRef = item.defaultBranch ? `origin/${item.defaultBranch}` : "origin/main";
48172
48215
  try {
48173
48216
  const diffResult = await getGitDiffSummary2(workspace, { baseRef, maxFiles: 100 });
@@ -49914,11 +49957,11 @@ var ProviderInstanceManager = class {
49914
49957
 
49915
49958
  // src/providers/version-archive.ts
49916
49959
  import * as fs25 from "fs";
49917
- import * as path35 from "path";
49960
+ import * as path36 from "path";
49918
49961
  import * as os28 from "os";
49919
49962
  import { platform as platform8 } from "os";
49920
49963
  import { exec as exec5 } from "child_process";
49921
- var ARCHIVE_PATH = path35.join(os28.homedir(), ".adhdev", "version-history.json");
49964
+ var ARCHIVE_PATH = path36.join(os28.homedir(), ".adhdev", "version-history.json");
49922
49965
  var MAX_ENTRIES_PER_PROVIDER = 20;
49923
49966
  var VersionArchive = class {
49924
49967
  history = {};
@@ -49965,7 +50008,7 @@ var VersionArchive = class {
49965
50008
  }
49966
50009
  save() {
49967
50010
  try {
49968
- fs25.mkdirSync(path35.dirname(ARCHIVE_PATH), { recursive: true });
50011
+ fs25.mkdirSync(path36.dirname(ARCHIVE_PATH), { recursive: true });
49969
50012
  fs25.writeFileSync(ARCHIVE_PATH, JSON.stringify(this.history, null, 2));
49970
50013
  } catch {
49971
50014
  }
@@ -49989,7 +50032,7 @@ function findBinary2(name) {
49989
50032
  for (const p of paths) {
49990
50033
  if (!p) continue;
49991
50034
  for (const ext of exes) {
49992
- const fullPath = path35.join(p, name + ext);
50035
+ const fullPath = path36.join(p, name + ext);
49993
50036
  try {
49994
50037
  if (fs25.existsSync(fullPath)) {
49995
50038
  const stat2 = fs25.statSync(fullPath);
@@ -50038,7 +50081,7 @@ function checkPathExists2(paths) {
50038
50081
  for (const p of paths) {
50039
50082
  if (p.includes("*")) {
50040
50083
  const home = os28.homedir();
50041
- const resolved = p.replace(/\*/g, home.split(path35.sep).pop() || "");
50084
+ const resolved = p.replace(/\*/g, home.split(path36.sep).pop() || "");
50042
50085
  if (fs25.existsSync(resolved)) return resolved;
50043
50086
  } else {
50044
50087
  if (fs25.existsSync(p)) return p;
@@ -50048,7 +50091,7 @@ function checkPathExists2(paths) {
50048
50091
  }
50049
50092
  async function getMacAppVersion(appPath) {
50050
50093
  if (platform8() !== "darwin" || !appPath.endsWith(".app")) return null;
50051
- const plistPath = path35.join(appPath, "Contents", "Info.plist");
50094
+ const plistPath = path36.join(appPath, "Contents", "Info.plist");
50052
50095
  if (!fs25.existsSync(plistPath)) return null;
50053
50096
  const raw = await runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
50054
50097
  return raw || null;
@@ -50074,7 +50117,7 @@ async function detectAllVersions(loader, archive) {
50074
50117
  const cliBin = provider.cli ? findBinary2(provider.cli) : null;
50075
50118
  let resolvedBin = cliBin;
50076
50119
  if (!resolvedBin && appPath && currentOs === "darwin") {
50077
- const bundled = path35.join(appPath, "Contents", "Resources", "app", "bin", provider.cli || "");
50120
+ const bundled = path36.join(appPath, "Contents", "Resources", "app", "bin", provider.cli || "");
50078
50121
  if (provider.cli && fs25.existsSync(bundled)) resolvedBin = bundled;
50079
50122
  }
50080
50123
  info.installed = !!(appPath || resolvedBin);
@@ -50115,7 +50158,7 @@ async function detectAllVersions(loader, archive) {
50115
50158
  // src/daemon/dev-server.ts
50116
50159
  import * as http2 from "http";
50117
50160
  import * as fs29 from "fs";
50118
- import * as path39 from "path";
50161
+ import * as path40 from "path";
50119
50162
  init_config();
50120
50163
 
50121
50164
  // src/daemon/scaffold-template.ts
@@ -50467,7 +50510,7 @@ init_logger();
50467
50510
  // src/daemon/dev-cdp-handlers.ts
50468
50511
  init_logger();
50469
50512
  import * as fs26 from "fs";
50470
- import * as path36 from "path";
50513
+ import * as path37 from "path";
50471
50514
  async function handleCdpEvaluate(ctx, req, res) {
50472
50515
  const body = await ctx.readBody(req);
50473
50516
  const { expression, timeout, ideType } = body;
@@ -50645,17 +50688,17 @@ async function handleScriptHints(ctx, type, _req, res) {
50645
50688
  return;
50646
50689
  }
50647
50690
  let scriptsPath = "";
50648
- const directScripts = path36.join(dir, "scripts.js");
50691
+ const directScripts = path37.join(dir, "scripts.js");
50649
50692
  if (fs26.existsSync(directScripts)) {
50650
50693
  scriptsPath = directScripts;
50651
50694
  } else {
50652
- const scriptsDir = path36.join(dir, "scripts");
50695
+ const scriptsDir = path37.join(dir, "scripts");
50653
50696
  if (fs26.existsSync(scriptsDir)) {
50654
50697
  const versions = fs26.readdirSync(scriptsDir).filter((d) => {
50655
- return fs26.statSync(path36.join(scriptsDir, d)).isDirectory();
50698
+ return fs26.statSync(path37.join(scriptsDir, d)).isDirectory();
50656
50699
  }).sort().reverse();
50657
50700
  for (const ver of versions) {
50658
- const p = path36.join(scriptsDir, ver, "scripts.js");
50701
+ const p = path37.join(scriptsDir, ver, "scripts.js");
50659
50702
  if (fs26.existsSync(p)) {
50660
50703
  scriptsPath = p;
50661
50704
  break;
@@ -51484,7 +51527,7 @@ async function handleDomContext(ctx, type, req, res) {
51484
51527
 
51485
51528
  // src/daemon/dev-cli-debug.ts
51486
51529
  import * as fs27 from "fs";
51487
- import * as path37 from "path";
51530
+ import * as path38 from "path";
51488
51531
  function slugifyFixtureName(value) {
51489
51532
  const normalized = String(value || "").trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
51490
51533
  return normalized || `fixture-${Date.now()}`;
@@ -51494,11 +51537,11 @@ function getCliFixtureDir(ctx, type) {
51494
51537
  if (!providerDir) {
51495
51538
  throw new Error(`Provider directory not found for '${type}'`);
51496
51539
  }
51497
- return path37.join(providerDir, "fixtures");
51540
+ return path38.join(providerDir, "fixtures");
51498
51541
  }
51499
51542
  function readCliFixture(ctx, type, name) {
51500
51543
  const fixtureDir = getCliFixtureDir(ctx, type);
51501
- const filePath = path37.join(fixtureDir, `${name}.json`);
51544
+ const filePath = path38.join(fixtureDir, `${name}.json`);
51502
51545
  if (!fs27.existsSync(filePath)) {
51503
51546
  throw new Error(`Fixture not found: ${filePath}`);
51504
51547
  }
@@ -52274,7 +52317,7 @@ async function handleCliFixtureCapture(ctx, req, res) {
52274
52317
  },
52275
52318
  notes: typeof body?.notes === "string" ? body.notes : void 0
52276
52319
  };
52277
- const filePath = path37.join(fixtureDir, `${name}.json`);
52320
+ const filePath = path38.join(fixtureDir, `${name}.json`);
52278
52321
  fs27.writeFileSync(filePath, JSON.stringify(fixture, null, 2));
52279
52322
  ctx.json(res, 200, {
52280
52323
  saved: true,
@@ -52298,7 +52341,7 @@ async function handleCliFixtureList(ctx, type, _req, res) {
52298
52341
  return;
52299
52342
  }
52300
52343
  const fixtures = fs27.readdirSync(fixtureDir).filter((file) => file.endsWith(".json")).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" })).map((file) => {
52301
- const fullPath = path37.join(fixtureDir, file);
52344
+ const fullPath = path38.join(fixtureDir, file);
52302
52345
  try {
52303
52346
  const raw = JSON.parse(fs27.readFileSync(fullPath, "utf-8"));
52304
52347
  return {
@@ -52434,7 +52477,7 @@ async function handleCliRaw(ctx, req, res) {
52434
52477
 
52435
52478
  // src/daemon/dev-auto-implement.ts
52436
52479
  import * as fs28 from "fs";
52437
- import * as path38 from "path";
52480
+ import * as path39 from "path";
52438
52481
  import * as os29 from "os";
52439
52482
  import { DEFAULT_SESSION_HOST_COLS as DEFAULT_SESSION_HOST_COLS7, DEFAULT_SESSION_HOST_ROWS as DEFAULT_SESSION_HOST_ROWS7 } from "@adhdev/session-host-core";
52440
52483
  function getAutoImplPid(ctx) {
@@ -52485,22 +52528,22 @@ function getLatestScriptVersionDir(scriptsDir) {
52485
52528
  if (!fs28.existsSync(scriptsDir)) return null;
52486
52529
  const versions = fs28.readdirSync(scriptsDir).filter((d) => {
52487
52530
  try {
52488
- return fs28.statSync(path38.join(scriptsDir, d)).isDirectory();
52531
+ return fs28.statSync(path39.join(scriptsDir, d)).isDirectory();
52489
52532
  } catch {
52490
52533
  return false;
52491
52534
  }
52492
52535
  }).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" }));
52493
52536
  if (versions.length === 0) return null;
52494
- return path38.join(scriptsDir, versions[0]);
52537
+ return path39.join(scriptsDir, versions[0]);
52495
52538
  }
52496
52539
  function resolveAutoImplWritableProviderDir(ctx, category, type, requestedDir) {
52497
- const canonicalUserDir = path38.resolve(ctx.providerLoader.getUserProviderDir(category, type));
52498
- const desiredDir = requestedDir ? path38.resolve(requestedDir) : canonicalUserDir;
52499
- const upstreamRoot = path38.resolve(ctx.providerLoader.getUpstreamDir());
52500
- if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path38.sep}`)) {
52540
+ const canonicalUserDir = path39.resolve(ctx.providerLoader.getUserProviderDir(category, type));
52541
+ const desiredDir = requestedDir ? path39.resolve(requestedDir) : canonicalUserDir;
52542
+ const upstreamRoot = path39.resolve(ctx.providerLoader.getUpstreamDir());
52543
+ if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path39.sep}`)) {
52501
52544
  return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
52502
52545
  }
52503
- if (path38.basename(desiredDir) !== type) {
52546
+ if (path39.basename(desiredDir) !== type) {
52504
52547
  return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
52505
52548
  }
52506
52549
  const sourceDir = ctx.findProviderDir(type);
@@ -52508,11 +52551,11 @@ function resolveAutoImplWritableProviderDir(ctx, category, type, requestedDir) {
52508
52551
  return { dir: null, reason: `Provider source directory not found for '${type}'` };
52509
52552
  }
52510
52553
  if (!fs28.existsSync(desiredDir)) {
52511
- fs28.mkdirSync(path38.dirname(desiredDir), { recursive: true });
52554
+ fs28.mkdirSync(path39.dirname(desiredDir), { recursive: true });
52512
52555
  fs28.cpSync(sourceDir, desiredDir, { recursive: true });
52513
52556
  ctx.log(`Auto-implement writable copy created: ${desiredDir}`);
52514
52557
  }
52515
- const providerJson = path38.join(desiredDir, "provider.json");
52558
+ const providerJson = path39.join(desiredDir, "provider.json");
52516
52559
  if (!fs28.existsSync(providerJson)) {
52517
52560
  return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
52518
52561
  }
@@ -52523,13 +52566,13 @@ function loadAutoImplReferenceScripts(ctx, referenceType) {
52523
52566
  const refDir = ctx.findProviderDir(referenceType);
52524
52567
  if (!refDir || !fs28.existsSync(refDir)) return {};
52525
52568
  const referenceScripts = {};
52526
- const scriptsDir = path38.join(refDir, "scripts");
52569
+ const scriptsDir = path39.join(refDir, "scripts");
52527
52570
  const latestDir = getLatestScriptVersionDir(scriptsDir);
52528
52571
  if (!latestDir) return referenceScripts;
52529
52572
  for (const file of fs28.readdirSync(latestDir)) {
52530
52573
  if (!file.endsWith(".js")) continue;
52531
52574
  try {
52532
- referenceScripts[file] = fs28.readFileSync(path38.join(latestDir, file), "utf-8");
52575
+ referenceScripts[file] = fs28.readFileSync(path39.join(latestDir, file), "utf-8");
52533
52576
  } catch {
52534
52577
  }
52535
52578
  }
@@ -52637,9 +52680,9 @@ async function handleAutoImplement(ctx, type, req, res) {
52637
52680
  });
52638
52681
  const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
52639
52682
  const prompt = buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
52640
- const tmpDir = path38.join(os29.tmpdir(), "adhdev-autoimpl");
52683
+ const tmpDir = path39.join(os29.tmpdir(), "adhdev-autoimpl");
52641
52684
  if (!fs28.existsSync(tmpDir)) fs28.mkdirSync(tmpDir, { recursive: true });
52642
- const promptFile = path38.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
52685
+ const promptFile = path39.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
52643
52686
  fs28.writeFileSync(promptFile, prompt, "utf-8");
52644
52687
  ctx.log(`Auto-implement prompt written to ${promptFile} (${prompt.length} chars)`);
52645
52688
  const agentProvider = ctx.providerLoader.resolve(agent) || ctx.providerLoader.getMeta(agent);
@@ -53071,7 +53114,7 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
53071
53114
  setMode: "set_mode.js"
53072
53115
  };
53073
53116
  const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
53074
- const scriptsDir = path38.join(providerDir, "scripts");
53117
+ const scriptsDir = path39.join(providerDir, "scripts");
53075
53118
  const latestScriptsDir = getLatestScriptVersionDir(scriptsDir);
53076
53119
  if (latestScriptsDir) {
53077
53120
  lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
@@ -53082,7 +53125,7 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
53082
53125
  for (const file of fs28.readdirSync(latestScriptsDir)) {
53083
53126
  if (file.endsWith(".js") && targetFileNames.has(file)) {
53084
53127
  try {
53085
- const content = fs28.readFileSync(path38.join(latestScriptsDir, file), "utf-8");
53128
+ const content = fs28.readFileSync(path39.join(latestScriptsDir, file), "utf-8");
53086
53129
  lines.push(`### \`${file}\` \u270F\uFE0F EDIT`);
53087
53130
  lines.push("```javascript");
53088
53131
  lines.push(content);
@@ -53099,7 +53142,7 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
53099
53142
  lines.push("");
53100
53143
  for (const file of refFiles) {
53101
53144
  try {
53102
- const content = fs28.readFileSync(path38.join(latestScriptsDir, file), "utf-8");
53145
+ const content = fs28.readFileSync(path39.join(latestScriptsDir, file), "utf-8");
53103
53146
  lines.push(`### \`${file}\` \u{1F512}`);
53104
53147
  lines.push("```javascript");
53105
53148
  lines.push(content);
@@ -53140,10 +53183,10 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
53140
53183
  lines.push("");
53141
53184
  }
53142
53185
  }
53143
- const docsDir = path38.join(providerDir, "../../docs");
53186
+ const docsDir = path39.join(providerDir, "../../docs");
53144
53187
  const loadGuide = (name) => {
53145
53188
  try {
53146
- const p = path38.join(docsDir, name);
53189
+ const p = path39.join(docsDir, name);
53147
53190
  if (fs28.existsSync(p)) return fs28.readFileSync(p, "utf-8");
53148
53191
  } catch {
53149
53192
  }
@@ -53380,7 +53423,7 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
53380
53423
  parseApproval: "parse_approval.js"
53381
53424
  };
53382
53425
  const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
53383
- const scriptsDir = path38.join(providerDir, "scripts");
53426
+ const scriptsDir = path39.join(providerDir, "scripts");
53384
53427
  const latestScriptsDir = getLatestScriptVersionDir(scriptsDir);
53385
53428
  if (latestScriptsDir) {
53386
53429
  lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
@@ -53392,7 +53435,7 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
53392
53435
  if (!file.endsWith(".js")) continue;
53393
53436
  if (!targetFileNames.has(file)) continue;
53394
53437
  try {
53395
- const content = fs28.readFileSync(path38.join(latestScriptsDir, file), "utf-8");
53438
+ const content = fs28.readFileSync(path39.join(latestScriptsDir, file), "utf-8");
53396
53439
  lines.push(`### \`${file}\` \u270F\uFE0F EDIT`);
53397
53440
  lines.push("```javascript");
53398
53441
  lines.push(content);
@@ -53408,7 +53451,7 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
53408
53451
  lines.push("");
53409
53452
  for (const file of refFiles) {
53410
53453
  try {
53411
- const content = fs28.readFileSync(path38.join(latestScriptsDir, file), "utf-8");
53454
+ const content = fs28.readFileSync(path39.join(latestScriptsDir, file), "utf-8");
53412
53455
  lines.push(`### \`${file}\` \u{1F512}`);
53413
53456
  lines.push("```javascript");
53414
53457
  lines.push(content);
@@ -53441,10 +53484,10 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
53441
53484
  lines.push("");
53442
53485
  }
53443
53486
  }
53444
- const docsDir = path38.join(providerDir, "../../docs");
53487
+ const docsDir = path39.join(providerDir, "../../docs");
53445
53488
  const loadGuide = (name) => {
53446
53489
  try {
53447
- const p = path38.join(docsDir, name);
53490
+ const p = path39.join(docsDir, name);
53448
53491
  if (fs28.existsSync(p)) return fs28.readFileSync(p, "utf-8");
53449
53492
  } catch {
53450
53493
  }
@@ -53891,8 +53934,8 @@ var DevServer = class _DevServer {
53891
53934
  }
53892
53935
  getEndpointList() {
53893
53936
  return this.routes.map((r) => {
53894
- const path40 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
53895
- return `${r.method.padEnd(5)} ${path40}`;
53937
+ const path41 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
53938
+ return `${r.method.padEnd(5)} ${path41}`;
53896
53939
  });
53897
53940
  }
53898
53941
  async start(port = DEV_SERVER_PORT) {
@@ -54180,12 +54223,12 @@ var DevServer = class _DevServer {
54180
54223
  // ─── DevConsole SPA ───
54181
54224
  getConsoleDistDir() {
54182
54225
  const candidates = [
54183
- path39.resolve(__dirname, "../../web-devconsole/dist"),
54184
- path39.resolve(__dirname, "../../../web-devconsole/dist"),
54185
- path39.join(process.cwd(), "packages/web-devconsole/dist")
54226
+ path40.resolve(__dirname, "../../web-devconsole/dist"),
54227
+ path40.resolve(__dirname, "../../../web-devconsole/dist"),
54228
+ path40.join(process.cwd(), "packages/web-devconsole/dist")
54186
54229
  ];
54187
54230
  for (const dir of candidates) {
54188
- if (fs29.existsSync(path39.join(dir, "index.html"))) return dir;
54231
+ if (fs29.existsSync(path40.join(dir, "index.html"))) return dir;
54189
54232
  }
54190
54233
  return null;
54191
54234
  }
@@ -54195,7 +54238,7 @@ var DevServer = class _DevServer {
54195
54238
  this.json(res, 500, { error: "DevConsole not found. Run: npm run build -w packages/web-devconsole" });
54196
54239
  return;
54197
54240
  }
54198
- const htmlPath = path39.join(distDir, "index.html");
54241
+ const htmlPath = path40.join(distDir, "index.html");
54199
54242
  try {
54200
54243
  const html = fs29.readFileSync(htmlPath, "utf-8");
54201
54244
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
@@ -54220,15 +54263,15 @@ var DevServer = class _DevServer {
54220
54263
  this.json(res, 404, { error: "Not found" });
54221
54264
  return;
54222
54265
  }
54223
- const safePath = path39.normalize(pathname).replace(/^\.\.\//, "");
54224
- const filePath = path39.join(distDir, safePath);
54266
+ const safePath = path40.normalize(pathname).replace(/^\.\.\//, "");
54267
+ const filePath = path40.join(distDir, safePath);
54225
54268
  if (!filePath.startsWith(distDir)) {
54226
54269
  this.json(res, 403, { error: "Forbidden" });
54227
54270
  return;
54228
54271
  }
54229
54272
  try {
54230
54273
  const content = fs29.readFileSync(filePath);
54231
- const ext = path39.extname(filePath);
54274
+ const ext = path40.extname(filePath);
54232
54275
  const contentType = _DevServer.MIME_MAP[ext] || "application/octet-stream";
54233
54276
  res.writeHead(200, { "Content-Type": contentType, "Cache-Control": "public, max-age=31536000, immutable" });
54234
54277
  res.end(content);
@@ -54341,9 +54384,9 @@ var DevServer = class _DevServer {
54341
54384
  const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
54342
54385
  if (entry.isDirectory()) {
54343
54386
  files.push({ path: rel, size: 0, type: "dir" });
54344
- scan(path39.join(d, entry.name), rel);
54387
+ scan(path40.join(d, entry.name), rel);
54345
54388
  } else {
54346
- const stat2 = fs29.statSync(path39.join(d, entry.name));
54389
+ const stat2 = fs29.statSync(path40.join(d, entry.name));
54347
54390
  files.push({ path: rel, size: stat2.size, type: "file" });
54348
54391
  }
54349
54392
  }
@@ -54366,7 +54409,7 @@ var DevServer = class _DevServer {
54366
54409
  this.json(res, 404, { error: `Provider directory not found: ${type}` });
54367
54410
  return;
54368
54411
  }
54369
- const fullPath = path39.resolve(dir, path39.normalize(filePath));
54412
+ const fullPath = path40.resolve(dir, path40.normalize(filePath));
54370
54413
  if (!fullPath.startsWith(dir)) {
54371
54414
  this.json(res, 403, { error: "Forbidden" });
54372
54415
  return;
@@ -54391,14 +54434,14 @@ var DevServer = class _DevServer {
54391
54434
  this.json(res, 404, { error: `Provider directory not found: ${type}` });
54392
54435
  return;
54393
54436
  }
54394
- const fullPath = path39.resolve(dir, path39.normalize(filePath));
54437
+ const fullPath = path40.resolve(dir, path40.normalize(filePath));
54395
54438
  if (!fullPath.startsWith(dir)) {
54396
54439
  this.json(res, 403, { error: "Forbidden" });
54397
54440
  return;
54398
54441
  }
54399
54442
  try {
54400
54443
  if (fs29.existsSync(fullPath)) fs29.copyFileSync(fullPath, fullPath + ".bak");
54401
- fs29.mkdirSync(path39.dirname(fullPath), { recursive: true });
54444
+ fs29.mkdirSync(path40.dirname(fullPath), { recursive: true });
54402
54445
  fs29.writeFileSync(fullPath, content, "utf-8");
54403
54446
  this.log(`File saved: ${fullPath} (${content.length} chars)`);
54404
54447
  this.providerLoader.reload();
@@ -54415,7 +54458,7 @@ var DevServer = class _DevServer {
54415
54458
  return;
54416
54459
  }
54417
54460
  for (const name of ["scripts.js", "provider.json"]) {
54418
- const p = path39.join(dir, name);
54461
+ const p = path40.join(dir, name);
54419
54462
  if (fs29.existsSync(p)) {
54420
54463
  const source = fs29.readFileSync(p, "utf-8");
54421
54464
  this.json(res, 200, { type, path: p, source, lines: source.split("\n").length });
@@ -54436,8 +54479,8 @@ var DevServer = class _DevServer {
54436
54479
  this.json(res, 404, { error: `Provider not found: ${type}` });
54437
54480
  return;
54438
54481
  }
54439
- const target = fs29.existsSync(path39.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
54440
- const targetPath = path39.join(dir, target);
54482
+ const target = fs29.existsSync(path40.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
54483
+ const targetPath = path40.join(dir, target);
54441
54484
  try {
54442
54485
  if (fs29.existsSync(targetPath)) fs29.copyFileSync(targetPath, targetPath + ".bak");
54443
54486
  fs29.writeFileSync(targetPath, source, "utf-8");
@@ -54584,7 +54627,7 @@ var DevServer = class _DevServer {
54584
54627
  }
54585
54628
  let targetDir;
54586
54629
  targetDir = this.providerLoader.getUserProviderDir(category, type);
54587
- const jsonPath = path39.join(targetDir, "provider.json");
54630
+ const jsonPath = path40.join(targetDir, "provider.json");
54588
54631
  if (fs29.existsSync(jsonPath)) {
54589
54632
  this.json(res, 409, { error: `Provider already exists at ${targetDir}`, path: targetDir });
54590
54633
  return;
@@ -54596,8 +54639,8 @@ var DevServer = class _DevServer {
54596
54639
  const createdFiles = ["provider.json"];
54597
54640
  if (result.files) {
54598
54641
  for (const [relPath, content] of Object.entries(result.files)) {
54599
- const fullPath = path39.join(targetDir, relPath);
54600
- fs29.mkdirSync(path39.dirname(fullPath), { recursive: true });
54642
+ const fullPath = path40.join(targetDir, relPath);
54643
+ fs29.mkdirSync(path40.dirname(fullPath), { recursive: true });
54601
54644
  fs29.writeFileSync(fullPath, content, "utf-8");
54602
54645
  createdFiles.push(relPath);
54603
54646
  }
@@ -54650,22 +54693,22 @@ var DevServer = class _DevServer {
54650
54693
  if (!fs29.existsSync(scriptsDir)) return null;
54651
54694
  const versions = fs29.readdirSync(scriptsDir).filter((d) => {
54652
54695
  try {
54653
- return fs29.statSync(path39.join(scriptsDir, d)).isDirectory();
54696
+ return fs29.statSync(path40.join(scriptsDir, d)).isDirectory();
54654
54697
  } catch {
54655
54698
  return false;
54656
54699
  }
54657
54700
  }).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" }));
54658
54701
  if (versions.length === 0) return null;
54659
- return path39.join(scriptsDir, versions[0]);
54702
+ return path40.join(scriptsDir, versions[0]);
54660
54703
  }
54661
54704
  resolveAutoImplWritableProviderDir(category, type, requestedDir) {
54662
- const canonicalUserDir = path39.resolve(this.providerLoader.getUserProviderDir(category, type));
54663
- const desiredDir = requestedDir ? path39.resolve(requestedDir) : canonicalUserDir;
54664
- const upstreamRoot = path39.resolve(this.providerLoader.getUpstreamDir());
54665
- if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path39.sep}`)) {
54705
+ const canonicalUserDir = path40.resolve(this.providerLoader.getUserProviderDir(category, type));
54706
+ const desiredDir = requestedDir ? path40.resolve(requestedDir) : canonicalUserDir;
54707
+ const upstreamRoot = path40.resolve(this.providerLoader.getUpstreamDir());
54708
+ if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path40.sep}`)) {
54666
54709
  return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
54667
54710
  }
54668
- if (path39.basename(desiredDir) !== type) {
54711
+ if (path40.basename(desiredDir) !== type) {
54669
54712
  return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
54670
54713
  }
54671
54714
  const sourceDir = this.findProviderDir(type);
@@ -54673,11 +54716,11 @@ var DevServer = class _DevServer {
54673
54716
  return { dir: null, reason: `Provider source directory not found for '${type}'` };
54674
54717
  }
54675
54718
  if (!fs29.existsSync(desiredDir)) {
54676
- fs29.mkdirSync(path39.dirname(desiredDir), { recursive: true });
54719
+ fs29.mkdirSync(path40.dirname(desiredDir), { recursive: true });
54677
54720
  fs29.cpSync(sourceDir, desiredDir, { recursive: true });
54678
54721
  this.log(`Auto-implement writable copy created: ${desiredDir}`);
54679
54722
  }
54680
- const providerJson = path39.join(desiredDir, "provider.json");
54723
+ const providerJson = path40.join(desiredDir, "provider.json");
54681
54724
  if (!fs29.existsSync(providerJson)) {
54682
54725
  return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
54683
54726
  }
@@ -54713,7 +54756,7 @@ var DevServer = class _DevServer {
54713
54756
  setMode: "set_mode.js"
54714
54757
  };
54715
54758
  const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
54716
- const scriptsDir = path39.join(providerDir, "scripts");
54759
+ const scriptsDir = path40.join(providerDir, "scripts");
54717
54760
  const latestScriptsDir = this.getLatestScriptVersionDir(scriptsDir);
54718
54761
  if (latestScriptsDir) {
54719
54762
  lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
@@ -54724,7 +54767,7 @@ var DevServer = class _DevServer {
54724
54767
  for (const file of fs29.readdirSync(latestScriptsDir)) {
54725
54768
  if (file.endsWith(".js") && targetFileNames.has(file)) {
54726
54769
  try {
54727
- const content = fs29.readFileSync(path39.join(latestScriptsDir, file), "utf-8");
54770
+ const content = fs29.readFileSync(path40.join(latestScriptsDir, file), "utf-8");
54728
54771
  lines.push(`### \`${file}\` \u270F\uFE0F EDIT`);
54729
54772
  lines.push("```javascript");
54730
54773
  lines.push(content);
@@ -54741,7 +54784,7 @@ var DevServer = class _DevServer {
54741
54784
  lines.push("");
54742
54785
  for (const file of refFiles) {
54743
54786
  try {
54744
- const content = fs29.readFileSync(path39.join(latestScriptsDir, file), "utf-8");
54787
+ const content = fs29.readFileSync(path40.join(latestScriptsDir, file), "utf-8");
54745
54788
  lines.push(`### \`${file}\` \u{1F512}`);
54746
54789
  lines.push("```javascript");
54747
54790
  lines.push(content);
@@ -54782,10 +54825,10 @@ var DevServer = class _DevServer {
54782
54825
  lines.push("");
54783
54826
  }
54784
54827
  }
54785
- const docsDir = path39.join(providerDir, "../../docs");
54828
+ const docsDir = path40.join(providerDir, "../../docs");
54786
54829
  const loadGuide = (name) => {
54787
54830
  try {
54788
- const p = path39.join(docsDir, name);
54831
+ const p = path40.join(docsDir, name);
54789
54832
  if (fs29.existsSync(p)) return fs29.readFileSync(p, "utf-8");
54790
54833
  } catch {
54791
54834
  }
@@ -54959,7 +55002,7 @@ var DevServer = class _DevServer {
54959
55002
  parseApproval: "parse_approval.js"
54960
55003
  };
54961
55004
  const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
54962
- const scriptsDir = path39.join(providerDir, "scripts");
55005
+ const scriptsDir = path40.join(providerDir, "scripts");
54963
55006
  const latestScriptsDir = this.getLatestScriptVersionDir(scriptsDir);
54964
55007
  if (latestScriptsDir) {
54965
55008
  lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
@@ -54971,7 +55014,7 @@ var DevServer = class _DevServer {
54971
55014
  if (!file.endsWith(".js")) continue;
54972
55015
  if (!targetFileNames.has(file)) continue;
54973
55016
  try {
54974
- const content = fs29.readFileSync(path39.join(latestScriptsDir, file), "utf-8");
55017
+ const content = fs29.readFileSync(path40.join(latestScriptsDir, file), "utf-8");
54975
55018
  lines.push(`### \`${file}\` \u270F\uFE0F EDIT`);
54976
55019
  lines.push("```javascript");
54977
55020
  lines.push(content);
@@ -54987,7 +55030,7 @@ var DevServer = class _DevServer {
54987
55030
  lines.push("");
54988
55031
  for (const file of refFiles) {
54989
55032
  try {
54990
- const content = fs29.readFileSync(path39.join(latestScriptsDir, file), "utf-8");
55033
+ const content = fs29.readFileSync(path40.join(latestScriptsDir, file), "utf-8");
54991
55034
  lines.push(`### \`${file}\` \u{1F512}`);
54992
55035
  lines.push("```javascript");
54993
55036
  lines.push(content);
@@ -55020,10 +55063,10 @@ var DevServer = class _DevServer {
55020
55063
  lines.push("");
55021
55064
  }
55022
55065
  }
55023
- const docsDir = path39.join(providerDir, "../../docs");
55066
+ const docsDir = path40.join(providerDir, "../../docs");
55024
55067
  const loadGuide = (name) => {
55025
55068
  try {
55026
- const p = path39.join(docsDir, name);
55069
+ const p = path40.join(docsDir, name);
55027
55070
  if (fs29.existsSync(p)) return fs29.readFileSync(p, "utf-8");
55028
55071
  } catch {
55029
55072
  }
@@ -55287,6 +55330,7 @@ init_pty_transport();
55287
55330
 
55288
55331
  // src/cli-adapters/session-host-transport.ts
55289
55332
  init_logger();
55333
+ init_resolve_executable();
55290
55334
  import {
55291
55335
  SessionHostClient
55292
55336
  } from "@adhdev/session-host-core";
@@ -55669,7 +55713,7 @@ var SessionHostPtyTransportFactory = class {
55669
55713
  spawn(command, args, spawnOptions) {
55670
55714
  return new SessionHostRuntimeTransport({
55671
55715
  ...this.options,
55672
- command,
55716
+ command: resolveWin32Executable(command),
55673
55717
  args,
55674
55718
  spawnOptions
55675
55719
  });
@@ -56712,7 +56756,7 @@ import { readFileSync as readFileSync33 } from "fs";
56712
56756
  import { dirname as dirname12, resolve as resolve22 } from "path";
56713
56757
 
56714
56758
  // src/providers/sdk/v1/validators/taint.ts
56715
- import { readFileSync as readFileSync34, existsSync as existsSync41 } from "fs";
56759
+ import { readFileSync as readFileSync34, existsSync as existsSync42 } from "fs";
56716
56760
  import { resolve as resolve23, dirname as dirname13, join as join44 } from "path";
56717
56761
 
56718
56762
  // src/providers/sdk/v1/validators/index.ts