@adhdev/daemon-core 0.9.82-rc.377 → 0.9.82-rc.378

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
@@ -311,10 +311,10 @@ function readInjected(value) {
311
311
  }
312
312
  function getDaemonBuildInfo() {
313
313
  if (cached) return cached;
314
- const commit = readInjected(true ? "7393d1a7f559903bac031c3787d50b910d986783" : void 0) ?? "unknown";
315
- const commitShort = readInjected(true ? "7393d1a7" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
316
- const version = readInjected(true ? "0.9.82-rc.377" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
317
- const builtAt = readInjected(true ? "2026-06-25T06:26:06.511Z" : void 0);
314
+ const commit = readInjected(true ? "3920b23e979544d74c4024a0ff18e5deab7b2932" : void 0) ?? "unknown";
315
+ const commitShort = readInjected(true ? "3920b23e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
316
+ const version = readInjected(true ? "0.9.82-rc.378" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
317
+ const builtAt = readInjected(true ? "2026-06-25T07:59:13.420Z" : void 0);
318
318
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
319
319
  return cached;
320
320
  }
@@ -7268,8 +7268,8 @@ function stripCoordinatorWrapperFile(filePath) {
7268
7268
  const remaining = (existing.slice(0, openIdx) + existing.slice(closeIdx + CLOSE.length)).replace(/^\s*\n+/, "").replace(/\n+\s*$/, "");
7269
7269
  if (!remaining.trim()) {
7270
7270
  try {
7271
- const fs35 = __require("fs");
7272
- fs35.unlinkSync(filePath);
7271
+ const fs38 = __require("fs");
7272
+ fs38.unlinkSync(filePath);
7273
7273
  } catch {
7274
7274
  }
7275
7275
  } else {
@@ -9798,9 +9798,9 @@ function findBinary(name) {
9798
9798
  for (const ext of exes) {
9799
9799
  const fullPath = path11.join(p, trimmed + ext);
9800
9800
  try {
9801
- const fs35 = __require("fs");
9802
- if (fs35.existsSync(fullPath)) {
9803
- const stat2 = fs35.statSync(fullPath);
9801
+ const fs38 = __require("fs");
9802
+ if (fs38.existsSync(fullPath)) {
9803
+ const stat2 = fs38.statSync(fullPath);
9804
9804
  if (stat2.isFile() && (isWin || stat2.mode & 73)) {
9805
9805
  return fullPath;
9806
9806
  }
@@ -9814,12 +9814,12 @@ function findBinary(name) {
9814
9814
  function isScriptBinary(binaryPath) {
9815
9815
  if (!path11.isAbsolute(binaryPath)) return false;
9816
9816
  try {
9817
- const fs35 = __require("fs");
9818
- const resolved = fs35.realpathSync(binaryPath);
9817
+ const fs38 = __require("fs");
9818
+ const resolved = fs38.realpathSync(binaryPath);
9819
9819
  const head = Buffer.alloc(8);
9820
- const fd = fs35.openSync(resolved, "r");
9821
- fs35.readSync(fd, head, 0, 8, 0);
9822
- fs35.closeSync(fd);
9820
+ const fd = fs38.openSync(resolved, "r");
9821
+ fs38.readSync(fd, head, 0, 8, 0);
9822
+ fs38.closeSync(fd);
9823
9823
  let i = 0;
9824
9824
  if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
9825
9825
  return head[i] === 35 && head[i + 1] === 33;
@@ -9830,12 +9830,12 @@ function isScriptBinary(binaryPath) {
9830
9830
  function looksLikeMachOOrElf(filePath) {
9831
9831
  if (!path11.isAbsolute(filePath)) return false;
9832
9832
  try {
9833
- const fs35 = __require("fs");
9834
- const resolved = fs35.realpathSync(filePath);
9833
+ const fs38 = __require("fs");
9834
+ const resolved = fs38.realpathSync(filePath);
9835
9835
  const buf = Buffer.alloc(8);
9836
- const fd = fs35.openSync(resolved, "r");
9837
- fs35.readSync(fd, buf, 0, 8, 0);
9838
- fs35.closeSync(fd);
9836
+ const fd = fs38.openSync(resolved, "r");
9837
+ fs38.readSync(fd, buf, 0, 8, 0);
9838
+ fs38.closeSync(fd);
9839
9839
  let i = 0;
9840
9840
  if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
9841
9841
  const b = buf.subarray(i);
@@ -16971,8 +16971,8 @@ var init_pty_transport = __esm({
16971
16971
  let cwd = options.cwd;
16972
16972
  if (cwd) {
16973
16973
  try {
16974
- const fs35 = __require("fs");
16975
- const stat2 = fs35.statSync(cwd);
16974
+ const fs38 = __require("fs");
16975
+ const stat2 = fs38.statSync(cwd);
16976
16976
  if (!stat2.isDirectory()) cwd = os14.homedir();
16977
16977
  } catch {
16978
16978
  cwd = os14.homedir();
@@ -32548,7 +32548,7 @@ var DaemonCommandHandler = class {
32548
32548
  return { success: false, error: "invalid type" };
32549
32549
  }
32550
32550
  const https = __require("https");
32551
- const fs35 = __require("fs");
32551
+ const fs38 = __require("fs");
32552
32552
  const path43 = __require("path");
32553
32553
  const REGISTRY = "https://api.adhf.dev/api/v1/registry";
32554
32554
  function fetchText(url, timeoutMs) {
@@ -32591,7 +32591,7 @@ var DaemonCommandHandler = class {
32591
32591
  if (!targetDir.startsWith(installRootResolved + path43.sep)) {
32592
32592
  return { success: false, error: "install path escaped upstream root" };
32593
32593
  }
32594
- fs35.mkdirSync(targetDir, { recursive: true });
32594
+ fs38.mkdirSync(targetDir, { recursive: true });
32595
32595
  let manifestProbe = {};
32596
32596
  try {
32597
32597
  manifestProbe = JSON.parse(manifestBody);
@@ -32616,7 +32616,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
32616
32616
  }
32617
32617
  const targetFile = isV1 ? "provider.v1.json" : "provider.json";
32618
32618
  const targetPath = path43.join(targetDir, targetFile);
32619
- fs35.writeFileSync(targetPath, manifestBody, "utf-8");
32619
+ fs38.writeFileSync(targetPath, manifestBody, "utf-8");
32620
32620
  const manifestJson = JSON.parse(manifestBody);
32621
32621
  const scriptFetch = await this.fetchProviderSources(
32622
32622
  manifestJson,
@@ -32686,7 +32686,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
32686
32686
  const repo = source.repo;
32687
32687
  const ref = source.ref;
32688
32688
  const https = __require("https");
32689
- const fs35 = __require("fs");
32689
+ const fs38 = __require("fs");
32690
32690
  const path43 = __require("path");
32691
32691
  function fetchJson(url, timeoutMs) {
32692
32692
  return new Promise((resolve24, reject) => {
@@ -32770,8 +32770,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
32770
32770
  const relInside = entry.path.startsWith(sharedDirRel + "/") ? entry.path.slice(sharedDirRel.length + 1) : entry.path;
32771
32771
  const outPath = path43.resolve(path43.join(sharedTargetDir, relInside));
32772
32772
  if (!outPath.startsWith(path43.resolve(sharedTargetDir) + path43.sep)) continue;
32773
- fs35.mkdirSync(path43.dirname(outPath), { recursive: true });
32774
- fs35.writeFileSync(outPath, body);
32773
+ fs38.mkdirSync(path43.dirname(outPath), { recursive: true });
32774
+ fs38.writeFileSync(outPath, body);
32775
32775
  fetchedCount++;
32776
32776
  } catch (e) {
32777
32777
  errors.push(`fetch shared ${entry.path}: ${e?.message ?? e}`);
@@ -32809,8 +32809,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
32809
32809
  errors.push(`refusing to write outside targetDir: ${entry.path}`);
32810
32810
  continue;
32811
32811
  }
32812
- fs35.mkdirSync(path43.dirname(outPath), { recursive: true });
32813
- fs35.writeFileSync(outPath, body);
32812
+ fs38.mkdirSync(path43.dirname(outPath), { recursive: true });
32813
+ fs38.writeFileSync(outPath, body);
32814
32814
  fetchedCount++;
32815
32815
  } catch (e) {
32816
32816
  errors.push(`fetch ${entry.path}: ${e?.message ?? e}`);
@@ -32838,7 +32838,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
32838
32838
  if (!["cli", "ide", "extension", "acp"].includes(category)) {
32839
32839
  return { success: false, error: `unknown category: ${category}` };
32840
32840
  }
32841
- const fs35 = __require("fs");
32841
+ const fs38 = __require("fs");
32842
32842
  const path43 = __require("path");
32843
32843
  try {
32844
32844
  const installRoot = this.getUpstreamInstallRoot();
@@ -32847,10 +32847,10 @@ ${formatManifestValidationIssues2(validation.issues)}`,
32847
32847
  if (!targetDir.startsWith(installRootResolved + path43.sep)) {
32848
32848
  return { success: false, error: "refusing to delete outside upstream root" };
32849
32849
  }
32850
- if (!fs35.existsSync(targetDir)) {
32850
+ if (!fs38.existsSync(targetDir)) {
32851
32851
  return { success: false, error: "not installed" };
32852
32852
  }
32853
- fs35.rmSync(targetDir, { recursive: true, force: true });
32853
+ fs38.rmSync(targetDir, { recursive: true, force: true });
32854
32854
  if (this._ctx.providerLoader) {
32855
32855
  this._ctx.providerLoader.reload();
32856
32856
  this._ctx.providerLoader.registerToDetector();
@@ -32866,28 +32866,28 @@ ${formatManifestValidationIssues2(validation.issues)}`,
32866
32866
  * the UI and by the update checker.
32867
32867
  */
32868
32868
  handleListInstalledProviders(_args) {
32869
- const fs35 = __require("fs");
32869
+ const fs38 = __require("fs");
32870
32870
  const path43 = __require("path");
32871
32871
  const installRoot = this.getUpstreamInstallRoot();
32872
- if (!fs35.existsSync(installRoot)) return { success: true, providers: [] };
32872
+ if (!fs38.existsSync(installRoot)) return { success: true, providers: [] };
32873
32873
  const CATEGORIES = ["cli", "ide", "extension", "acp"];
32874
32874
  const items = [];
32875
32875
  for (const category of CATEGORIES) {
32876
32876
  const categoryDir = path43.join(installRoot, category);
32877
- if (!fs35.existsSync(categoryDir)) continue;
32877
+ if (!fs38.existsSync(categoryDir)) continue;
32878
32878
  let entries;
32879
32879
  try {
32880
- entries = fs35.readdirSync(categoryDir);
32880
+ entries = fs38.readdirSync(categoryDir);
32881
32881
  } catch {
32882
32882
  continue;
32883
32883
  }
32884
32884
  for (const type of entries) {
32885
32885
  const v1Path = path43.join(categoryDir, type, "provider.v1.json");
32886
32886
  const v0Path = path43.join(categoryDir, type, "provider.json");
32887
- const manifestPath = fs35.existsSync(v1Path) ? v1Path : fs35.existsSync(v0Path) ? v0Path : null;
32887
+ const manifestPath = fs38.existsSync(v1Path) ? v1Path : fs38.existsSync(v0Path) ? v0Path : null;
32888
32888
  if (!manifestPath) continue;
32889
32889
  try {
32890
- const m = JSON.parse(fs35.readFileSync(manifestPath, "utf-8"));
32890
+ const m = JSON.parse(fs38.readFileSync(manifestPath, "utf-8"));
32891
32891
  items.push({
32892
32892
  type,
32893
32893
  category,
@@ -32998,7 +32998,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
32998
32998
  if (!/^@[a-z0-9_-]+$/i.test(requestedName)) {
32999
32999
  return { success: false, error: "name must match @[a-z0-9_-]+" };
33000
33000
  }
33001
- const fs35 = __require("fs");
33001
+ const fs38 = __require("fs");
33002
33002
  const path43 = __require("path");
33003
33003
  const { spawnSync: spawnSync2 } = __require("child_process");
33004
33004
  const file = ext.loadExternalSources();
@@ -33009,8 +33009,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
33009
33009
  return { success: false, error: `source url+ref already registered (use a different name to track another ref)` };
33010
33010
  }
33011
33011
  const sourceDir = path43.join(ext.externalRoot(), requestedName);
33012
- if (!fs35.existsSync(ext.externalRoot())) fs35.mkdirSync(ext.externalRoot(), { recursive: true });
33013
- if (fs35.existsSync(sourceDir)) {
33012
+ if (!fs38.existsSync(ext.externalRoot())) fs38.mkdirSync(ext.externalRoot(), { recursive: true });
33013
+ if (fs38.existsSync(sourceDir)) {
33014
33014
  return { success: false, error: `directory already exists: ${sourceDir} (rename or remove first)` };
33015
33015
  }
33016
33016
  const clone = spawnSync2("git", ["clone", "--depth=1", "--branch", ref, "--", url, sourceDir], {
@@ -33020,7 +33020,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
33020
33020
  });
33021
33021
  if (clone.status !== 0) {
33022
33022
  try {
33023
- fs35.rmSync(sourceDir, { recursive: true, force: true });
33023
+ fs38.rmSync(sourceDir, { recursive: true, force: true });
33024
33024
  } catch {
33025
33025
  }
33026
33026
  return { success: false, error: `git clone failed: ${(clone.stderr || clone.stdout || "").trim() || "unknown error"}` };
@@ -33064,15 +33064,15 @@ ${formatManifestValidationIssues2(validation.issues)}`,
33064
33064
  const name = typeof args?.name === "string" ? args.name.trim() : "";
33065
33065
  if (!name) return { success: false, error: "name is required" };
33066
33066
  const ext = (init_external_sources(), __toCommonJS(external_sources_exports));
33067
- const fs35 = __require("fs");
33067
+ const fs38 = __require("fs");
33068
33068
  const path43 = __require("path");
33069
33069
  const file = ext.loadExternalSources();
33070
33070
  const match = file.sources.find((s2) => s2.name === name);
33071
33071
  if (!match) return { success: false, error: `source "${name}" not registered` };
33072
33072
  const sourceDir = path43.join(ext.externalRoot(), name);
33073
- if (fs35.existsSync(sourceDir)) {
33073
+ if (fs38.existsSync(sourceDir)) {
33074
33074
  try {
33075
- fs35.rmSync(sourceDir, { recursive: true, force: true });
33075
+ fs38.rmSync(sourceDir, { recursive: true, force: true });
33076
33076
  } catch (e) {
33077
33077
  return { success: false, error: `failed to delete ${sourceDir}: ${e?.message || e}` };
33078
33078
  }
@@ -33853,14 +33853,14 @@ var statusMetaHandlers = {
33853
33853
  // src/commands/low-family/coordinator-prompt.ts
33854
33854
  var coordinatorPromptHandlers = {
33855
33855
  list_coordinator_prompts: async (_ctx, _args) => {
33856
- const fs35 = await import("fs");
33856
+ const fs38 = await import("fs");
33857
33857
  const path43 = await import("path");
33858
33858
  const os30 = await import("os");
33859
33859
  const dir = path43.join(os30.homedir(), ".adhdev", "coordinator-prompts");
33860
33860
  const entries = {};
33861
33861
  try {
33862
- if (fs35.existsSync(dir)) {
33863
- for (const name of fs35.readdirSync(dir)) {
33862
+ if (fs38.existsSync(dir)) {
33863
+ for (const name of fs38.readdirSync(dir)) {
33864
33864
  const matchOverride = name.match(/^([a-zA-Z0-9_.-]+)\.md$/);
33865
33865
  const matchAppend = name.match(/^([a-zA-Z0-9_.-]+)\.append\.md$/);
33866
33866
  const m = matchAppend || matchOverride;
@@ -33870,7 +33870,7 @@ var coordinatorPromptHandlers = {
33870
33870
  const full = path43.join(dir, name);
33871
33871
  let content = "";
33872
33872
  try {
33873
- content = fs35.readFileSync(full, "utf8");
33873
+ content = fs38.readFileSync(full, "utf8");
33874
33874
  } catch {
33875
33875
  }
33876
33876
  if (!entries[key]) entries[key] = { override: "", append: "" };
@@ -33884,7 +33884,7 @@ var coordinatorPromptHandlers = {
33884
33884
  return { success: true, dir, entries };
33885
33885
  },
33886
33886
  write_coordinator_prompt: async (_ctx, args) => {
33887
- const fs35 = await import("fs");
33887
+ const fs38 = await import("fs");
33888
33888
  const path43 = await import("path");
33889
33889
  const os30 = await import("os");
33890
33890
  const key = typeof args?.key === "string" ? args.key.trim() : "";
@@ -33897,11 +33897,11 @@ var coordinatorPromptHandlers = {
33897
33897
  const filename = kind === "append" ? `${key}.append.md` : `${key}.md`;
33898
33898
  const full = path43.join(dir, filename);
33899
33899
  try {
33900
- fs35.mkdirSync(dir, { recursive: true });
33900
+ fs38.mkdirSync(dir, { recursive: true });
33901
33901
  if (content.trim()) {
33902
- fs35.writeFileSync(full, content, { encoding: "utf8", mode: 384 });
33903
- } else if (fs35.existsSync(full)) {
33904
- fs35.unlinkSync(full);
33902
+ fs38.writeFileSync(full, content, { encoding: "utf8", mode: 384 });
33903
+ } else if (fs38.existsSync(full)) {
33904
+ fs38.unlinkSync(full);
33905
33905
  }
33906
33906
  return { success: true, path: full, kind, key };
33907
33907
  } catch (error) {
@@ -44990,7 +44990,7 @@ var ProviderLoader = class _ProviderLoader {
44990
44990
  }
44991
44991
  if (providerDir) {
44992
44992
  try {
44993
- const fs35 = __require("fs");
44993
+ const fs38 = __require("fs");
44994
44994
  const path43 = __require("path");
44995
44995
  const candidates = [];
44996
44996
  if (Array.isArray(base.compatibility)) {
@@ -45002,13 +45002,13 @@ var ProviderLoader = class _ProviderLoader {
45002
45002
  }
45003
45003
  candidates.push(path43.join(providerDir, "specs", "default.json"));
45004
45004
  candidates.push(path43.join(providerDir, "spec.json"));
45005
- const specPath = candidates.find((p) => fs35.existsSync(p));
45005
+ const specPath = candidates.find((p) => fs38.existsSync(p));
45006
45006
  if (specPath) {
45007
45007
  resolved._resolvedSpecPath = specPath;
45008
45008
  let specControls;
45009
45009
  let nh;
45010
45010
  try {
45011
- const rawSpec = JSON.parse(fs35.readFileSync(specPath, "utf8"));
45011
+ const rawSpec = JSON.parse(fs38.readFileSync(specPath, "utf8"));
45012
45012
  specControls = rawSpec.control_bar;
45013
45013
  nh = rawSpec.native_history;
45014
45014
  } catch {
@@ -45040,7 +45040,7 @@ var ProviderLoader = class _ProviderLoader {
45040
45040
  reader = (input) => executeNativeHistory(nh, input);
45041
45041
  } else if (nh.override_path) {
45042
45042
  const overrideFile = path43.resolve(providerDir, nh.override_path);
45043
- if (fs35.existsSync(overrideFile)) {
45043
+ if (fs38.existsSync(overrideFile)) {
45044
45044
  try {
45045
45045
  registerProviderScriptRootSafely(path43.dirname(path43.dirname(providerDir)));
45046
45046
  delete __require.cache[__require.resolve(overrideFile)];
@@ -46222,7 +46222,7 @@ async function detectCurrentWorkspace(ideId) {
46222
46222
  }
46223
46223
  } else if (plat === "win32") {
46224
46224
  try {
46225
- const fs35 = __require("fs");
46225
+ const fs38 = __require("fs");
46226
46226
  const appNameMap = getMacAppIdentifiers();
46227
46227
  const appName = appNameMap[ideId];
46228
46228
  if (appName) {
@@ -46231,8 +46231,8 @@ async function detectCurrentWorkspace(ideId) {
46231
46231
  appName,
46232
46232
  "storage.json"
46233
46233
  );
46234
- if (fs35.existsSync(storagePath)) {
46235
- const data = JSON.parse(fs35.readFileSync(storagePath, "utf-8"));
46234
+ if (fs38.existsSync(storagePath)) {
46235
+ const data = JSON.parse(fs38.readFileSync(storagePath, "utf-8"));
46236
46236
  const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
46237
46237
  if (workspaces.length > 0) {
46238
46238
  const recent = workspaces[0];
@@ -48190,7 +48190,7 @@ ${ptyResult.output.slice(-2e3)}`);
48190
48190
  workspace
48191
48191
  };
48192
48192
  }
48193
- const { existsSync: existsSync49, readFileSync: readFileSync40, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
48193
+ const { existsSync: existsSync52, readFileSync: readFileSync40, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
48194
48194
  const { dirname: dirname17 } = await import("path");
48195
48195
  const mcpConfigPath = coordinatorSetup.configPath;
48196
48196
  const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
@@ -48233,7 +48233,7 @@ ${ptyResult.output.slice(-2e3)}`);
48233
48233
  if (hermesManualFallback) return returnManualFallback(message);
48234
48234
  return { success: false, code: "mesh_coordinator_config_write_failed", error: message, meshId, cliType, workspace };
48235
48235
  }
48236
- const hadExistingMcpConfig = existsSync49(mcpConfigPath);
48236
+ const hadExistingMcpConfig = existsSync52(mcpConfigPath);
48237
48237
  let existingMcpConfig = hermesBaseConfig?.config || {};
48238
48238
  if (hermesBaseConfig) {
48239
48239
  copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname17(mcpConfigPath));
@@ -48838,7 +48838,7 @@ var meshStatusHandlers = {
48838
48838
  const { deriveMeshReviewInboxItems: deriveMeshReviewInboxItems2 } = await Promise.resolve().then(() => (init_mesh_review_inbox(), mesh_review_inbox_exports));
48839
48839
  const { readLedgerEntries: readLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
48840
48840
  const { getGitDiffSummary: getGitDiffSummary2 } = await Promise.resolve().then(() => (init_git_diff(), git_diff_exports));
48841
- const { existsSync: existsSync49 } = await import("fs");
48841
+ const { existsSync: existsSync52 } = await import("fs");
48842
48842
  const meshRecord = await ctx.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
48843
48843
  const mesh = meshRecord?.mesh;
48844
48844
  if (!mesh) return { success: false, error: "Mesh not found" };
@@ -48857,7 +48857,7 @@ var meshStatusHandlers = {
48857
48857
  const derivation = deriveMeshReviewInboxItems2({ nodes: nodeStatuses, ledgerEntries });
48858
48858
  for (const item of derivation.items) {
48859
48859
  const workspace = item.workspace;
48860
- if (!workspace || !existsSync49(workspace)) continue;
48860
+ if (!workspace || !existsSync52(workspace)) continue;
48861
48861
  const baseRef = item.defaultBranch ? `origin/${item.defaultBranch}` : "origin/main";
48862
48862
  try {
48863
48863
  const diffResult = await getGitDiffSummary2(workspace, { baseRef, maxFiles: 100 });
@@ -48906,8 +48906,6 @@ var highFamilyRegistry = new Map(
48906
48906
  );
48907
48907
 
48908
48908
  // src/commands/router.ts
48909
- init_cli_detector();
48910
- init_git_status();
48911
48909
  init_dist();
48912
48910
  init_logger();
48913
48911
 
@@ -49057,7 +49055,6 @@ function getRecentCommands(count = 50) {
49057
49055
  cleanOldFiles();
49058
49056
 
49059
49057
  // src/commands/router.ts
49060
- import * as yaml4 from "js-yaml";
49061
49058
  init_mesh_events();
49062
49059
  init_mesh_host_ownership();
49063
49060
 
@@ -49150,13 +49147,18 @@ function orderMeshRefineBatchNodes(changeAreas) {
49150
49147
 
49151
49148
  // src/commands/router.ts
49152
49149
  init_mesh_work_queue();
49153
- init_mesh_warmup_deadline();
49154
49150
  init_repo_mesh_types();
49155
- import { homedir as homedir26 } from "os";
49156
- import { basename as pathBasename, join as pathJoin2, resolve as pathResolve2 } from "path";
49151
+ import { resolve as pathResolve4 } from "path";
49152
+ import * as fs32 from "fs";
49153
+ import { execFileSync as execFileSync7 } from "child_process";
49154
+
49155
+ // src/mesh/mesh-node-identity.ts
49156
+ init_cli_detector();
49157
+ init_git_status();
49158
+ init_dist();
49159
+ init_logger();
49160
+ init_mesh_warmup_deadline();
49157
49161
  import * as fs29 from "fs";
49158
- import { execFileSync as execFileSync6 } from "child_process";
49159
- init_resolve_executable();
49160
49162
  init_runtime_defaults();
49161
49163
  function readProviderPriorityFromPolicy(policy) {
49162
49164
  const record = policy && typeof policy === "object" && !Array.isArray(policy) ? policy : {};
@@ -50377,6 +50379,13 @@ async function resolveProviderTypeFromPriority(args) {
50377
50379
  }
50378
50380
  return { error: `No usable provider detected for node '${args.nodeId}' from providerPriority: ${failed.join("; ")}` };
50379
50381
  }
50382
+
50383
+ // src/mesh/mesh-refine-gates.ts
50384
+ init_git_status();
50385
+ init_resolve_executable();
50386
+ import { basename as pathBasename, join as pathJoin2, resolve as pathResolve2 } from "path";
50387
+ import * as fs30 from "fs";
50388
+ import { execFileSync as execFileSync6 } from "child_process";
50380
50389
  var REFINE_VALIDATION_TIMEOUT_MS = 12e4;
50381
50390
  var REFINE_VALIDATION_OUTPUT_LIMIT_BYTES = 128 * 1024;
50382
50391
  var REFINE_VALIDATION_SUMMARY_CHARS = 2e3;
@@ -50430,18 +50439,18 @@ function resolveRefineryAutoPublishSubmoduleMainCommits(mesh, workspace) {
50430
50439
  return { enabled: false };
50431
50440
  }
50432
50441
  async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
50433
- const { execFileSync: execFileSync7 } = await import("child_process");
50442
+ const { execFileSync: execFileSync8 } = await import("child_process");
50434
50443
  const diffArgs = ["diff", "--patch", "--full-index", fromRef, toRef];
50435
50444
  if (excludePaths.length > 0) {
50436
50445
  diffArgs.push("--", ".", ...excludePaths.map((path43) => `:(exclude)${path43}`));
50437
50446
  }
50438
- const diff = execFileSync7("git", diffArgs, {
50447
+ const diff = execFileSync8("git", diffArgs, {
50439
50448
  cwd,
50440
50449
  encoding: "utf8",
50441
50450
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
50442
50451
  });
50443
50452
  if (!diff.trim()) return "";
50444
- const patchId = execFileSync7("git", ["patch-id", "--stable"], {
50453
+ const patchId = execFileSync8("git", ["patch-id", "--stable"], {
50445
50454
  cwd,
50446
50455
  input: diff,
50447
50456
  encoding: "utf8",
@@ -50452,8 +50461,8 @@ async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
50452
50461
  async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead) {
50453
50462
  const startedAt = Date.now();
50454
50463
  try {
50455
- const { execFileSync: execFileSync7 } = await import("child_process");
50456
- const git = (args) => execFileSync7("git", args, {
50464
+ const { execFileSync: execFileSync8 } = await import("child_process");
50465
+ const git = (args) => execFileSync8("git", args, {
50457
50466
  cwd: repoRoot,
50458
50467
  encoding: "utf8",
50459
50468
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
@@ -50544,8 +50553,8 @@ ${e?.stderr || ""}`
50544
50553
  async function checkWorktreeChangesPatchEquivalentInRef(repoRoot, ref, worktreeHead) {
50545
50554
  const startedAt = Date.now();
50546
50555
  try {
50547
- const { execFileSync: execFileSync7 } = await import("child_process");
50548
- const git = (gitArgs) => execFileSync7("git", gitArgs, {
50556
+ const { execFileSync: execFileSync8 } = await import("child_process");
50557
+ const git = (gitArgs) => execFileSync8("git", gitArgs, {
50549
50558
  cwd: repoRoot,
50550
50559
  encoding: "utf8",
50551
50560
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
@@ -50608,8 +50617,8 @@ ${mergeTreeErr?.stderr || ""}`;
50608
50617
  async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
50609
50618
  const startedAt = Date.now();
50610
50619
  try {
50611
- const { execFileSync: execFileSync7 } = await import("child_process");
50612
- const git = (args, opts) => execFileSync7("git", args, {
50620
+ const { execFileSync: execFileSync8 } = await import("child_process");
50621
+ const git = (args, opts) => execFileSync8("git", args, {
50613
50622
  cwd: opts?.cwd || repoRoot,
50614
50623
  encoding: "utf8",
50615
50624
  maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
@@ -50732,7 +50741,7 @@ function isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit) {
50732
50741
  if (!baseCommit || !branchCommit) return false;
50733
50742
  if (baseCommit === branchCommit) return true;
50734
50743
  try {
50735
- if (!fs29.existsSync(submoduleRepoPath)) return false;
50744
+ if (!fs30.existsSync(submoduleRepoPath)) return false;
50736
50745
  execFileSync6("git", ["cat-file", "-e", `${baseCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
50737
50746
  execFileSync6("git", ["cat-file", "-e", `${branchCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
50738
50747
  execFileSync6("git", ["merge-base", "--is-ancestor", baseCommit, branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
@@ -50849,7 +50858,7 @@ function buildTreeWithGitlinksEqualized(repoRoot, commitish, paths, placeholderC
50849
50858
  return newTree || void 0;
50850
50859
  } finally {
50851
50860
  try {
50852
- fs29.rmSync(tmpIndex, { force: true });
50861
+ fs30.rmSync(tmpIndex, { force: true });
50853
50862
  } catch {
50854
50863
  }
50855
50864
  }
@@ -50924,7 +50933,7 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
50924
50933
  return newTree || void 0;
50925
50934
  } finally {
50926
50935
  try {
50927
- fs29.rmSync(tmpIndex, { force: true });
50936
+ fs30.rmSync(tmpIndex, { force: true });
50928
50937
  } catch {
50929
50938
  }
50930
50939
  }
@@ -51030,7 +51039,7 @@ async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree, opti
51030
51039
  return { stdout: String(stdout || ""), stderr: String(stderr || ""), refspec };
51031
51040
  };
51032
51041
  const importCommitFromWorktreeSubmodule = async (submodulePath, worktreeSubmodulePath, commit) => {
51033
- if (!fs29.existsSync(worktreeSubmodulePath)) return false;
51042
+ if (!fs30.existsSync(worktreeSubmodulePath)) return false;
51034
51043
  try {
51035
51044
  await runGit3(worktreeSubmodulePath, ["cat-file", "-e", `${commit}^{commit}`]);
51036
51045
  } catch {
@@ -51053,7 +51062,7 @@ async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree, opti
51053
51062
  reachable: false
51054
51063
  };
51055
51064
  try {
51056
- if (!fs29.existsSync(submodulePath)) {
51065
+ if (!fs30.existsSync(submodulePath)) {
51057
51066
  entry.error = `Submodule checkout missing at ${gitlink.path}`;
51058
51067
  entry.publishRequired = true;
51059
51068
  if (options.allowAutoPublishSubmoduleMainCommits === true) {
@@ -51290,9 +51299,9 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
51290
51299
  return ["npm", "pnpm", "yarn", "bun"].includes(command) && candidate.args.some((arg) => arg === "run" || arg === "test" || arg === "exec");
51291
51300
  };
51292
51301
  const dependenciesLikelyMissing = (cwd) => {
51293
- if (!fs29.existsSync(pathJoin2(cwd, "package.json"))) return false;
51294
- if (fs29.existsSync(pathJoin2(cwd, "node_modules"))) return false;
51295
- return ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "bun.lock"].some((lock) => fs29.existsSync(pathJoin2(cwd, lock)));
51302
+ if (!fs30.existsSync(pathJoin2(cwd, "package.json"))) return false;
51303
+ if (fs30.existsSync(pathJoin2(cwd, "node_modules"))) return false;
51304
+ return ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "bun.lock"].some((lock) => fs30.existsSync(pathJoin2(cwd, lock)));
51296
51305
  };
51297
51306
  if (runLegacyBootstrapCommands) {
51298
51307
  summary.bootstrap = { stage: "legacy" };
@@ -51379,6 +51388,13 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
51379
51388
  summary.status = "passed";
51380
51389
  return summary;
51381
51390
  }
51391
+
51392
+ // src/mesh/mesh-coordinator-config.ts
51393
+ init_logger();
51394
+ import * as yaml4 from "js-yaml";
51395
+ import { homedir as homedir26 } from "os";
51396
+ import { join as pathJoin3, resolve as pathResolve3 } from "path";
51397
+ import * as fs31 from "fs";
51382
51398
  function loadYamlModule() {
51383
51399
  return yaml4;
51384
51400
  }
@@ -51397,14 +51413,14 @@ function serializeMeshCoordinatorMcpConfig(config, format) {
51397
51413
  }
51398
51414
  function resolveHermesUserHome() {
51399
51415
  const explicitHome = process.env.HERMES_HOME?.trim();
51400
- return explicitHome || pathJoin2(homedir26(), ".hermes");
51416
+ return explicitHome || pathJoin3(homedir26(), ".hermes");
51401
51417
  }
51402
51418
  function loadHermesCoordinatorBaseConfig(targetConfigPath) {
51403
51419
  const sourceHome = resolveHermesUserHome();
51404
- const sourceConfigPath = pathJoin2(sourceHome, "config.yaml");
51405
- if (!fs29.existsSync(sourceConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
51406
- if (pathResolve2(sourceConfigPath) === pathResolve2(targetConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
51407
- const parsed = parseMeshCoordinatorMcpConfig(fs29.readFileSync(sourceConfigPath, "utf-8"), "hermes_config_yaml");
51420
+ const sourceConfigPath = pathJoin3(sourceHome, "config.yaml");
51421
+ if (!fs31.existsSync(sourceConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
51422
+ if (pathResolve3(sourceConfigPath) === pathResolve3(targetConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
51423
+ const parsed = parseMeshCoordinatorMcpConfig(fs31.readFileSync(sourceConfigPath, "utf-8"), "hermes_config_yaml");
51408
51424
  const { mcp_servers: _mcpServers, ...baseConfig } = parsed;
51409
51425
  return { config: baseConfig, sourceHome, sourceConfigPath };
51410
51426
  }
@@ -51437,18 +51453,20 @@ function stripHermesCoordinatorTempModelProviderOverrides(config) {
51437
51453
  return sanitized;
51438
51454
  }
51439
51455
  function copyHermesCoordinatorCredentialFiles(sourceHome, targetHome) {
51440
- if (pathResolve2(sourceHome) === pathResolve2(targetHome)) return;
51456
+ if (pathResolve3(sourceHome) === pathResolve3(targetHome)) return;
51441
51457
  for (const fileName of [".env", "auth.json"]) {
51442
- const sourcePath = pathJoin2(sourceHome, fileName);
51443
- const targetPath = pathJoin2(targetHome, fileName);
51444
- if (!fs29.existsSync(sourcePath)) continue;
51458
+ const sourcePath = pathJoin3(sourceHome, fileName);
51459
+ const targetPath = pathJoin3(targetHome, fileName);
51460
+ if (!fs31.existsSync(sourcePath)) continue;
51445
51461
  try {
51446
- fs29.copyFileSync(sourcePath, targetPath);
51462
+ fs31.copyFileSync(sourcePath, targetPath);
51447
51463
  } catch (error) {
51448
51464
  LOG.warn("MeshCoordinator", `Could not copy Hermes ${fileName} into isolated coordinator home: ${error?.message || error}`);
51449
51465
  }
51450
51466
  }
51451
51467
  }
51468
+
51469
+ // src/commands/router.ts
51452
51470
  var CHAT_COMMANDS = [
51453
51471
  "send_chat",
51454
51472
  "new_chat",
@@ -51915,7 +51933,7 @@ var DaemonCommandRouter = class {
51915
51933
  const nodeId = readInlineMeshNodeId(node);
51916
51934
  if (!nodeId || !tombstones.has(nodeId)) return true;
51917
51935
  const workspace = readStringValue(node?.workspace);
51918
- if (workspace && fs29.existsSync(workspace)) {
51936
+ if (workspace && fs32.existsSync(workspace)) {
51919
51937
  tombstones.delete(nodeId);
51920
51938
  return true;
51921
51939
  }
@@ -51950,14 +51968,14 @@ var DaemonCommandRouter = class {
51950
51968
  * to give handles time to release, and reports whether residue remains.
51951
51969
  */
51952
51970
  async bestEffortRemoveWorktreeDir(dir) {
51953
- if (!dir || !fs29.existsSync(dir)) return { removed: true, residue: false };
51971
+ if (!dir || !fs32.existsSync(dir)) return { removed: true, residue: false };
51954
51972
  const sleep3 = (ms) => new Promise((resolve24) => setTimeout(resolve24, ms));
51955
51973
  const ABSORB = /* @__PURE__ */ new Set(["EINVAL", "EPERM", "EBUSY", "ENOTEMPTY", "EACCES", "EMFILE", "ENFILE"]);
51956
51974
  let lastErr;
51957
51975
  for (let attempt = 0; attempt < 4; attempt++) {
51958
51976
  try {
51959
- fs29.rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
51960
- if (!fs29.existsSync(dir)) return { removed: true, residue: false };
51977
+ fs32.rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
51978
+ if (!fs32.existsSync(dir)) return { removed: true, residue: false };
51961
51979
  lastErr = new Error("directory still present after rmSync");
51962
51980
  } catch (e) {
51963
51981
  lastErr = e;
@@ -51968,7 +51986,7 @@ var DaemonCommandRouter = class {
51968
51986
  }
51969
51987
  await sleep3(150 * (attempt + 1));
51970
51988
  }
51971
- return fs29.existsSync(dir) ? { removed: false, residue: true, error: String(lastErr?.message || lastErr || "unknown rm error") } : { removed: true, residue: false };
51989
+ return fs32.existsSync(dir) ? { removed: false, residue: true, error: String(lastErr?.message || lastErr || "unknown rm error") } : { removed: true, residue: false };
51972
51990
  }
51973
51991
  async cleanupLocalWorktreeNode(args) {
51974
51992
  const workspace = typeof args.node?.workspace === "string" ? args.node.workspace.trim() : "";
@@ -51980,13 +51998,13 @@ var DaemonCommandRouter = class {
51980
51998
  recoveryHint: "Inspect the mesh node record before removing it, or remove stale metadata manually only after confirming no managed worktree remains."
51981
51999
  };
51982
52000
  }
51983
- const worktreeExists = fs29.existsSync(workspace);
52001
+ const worktreeExists = fs32.existsSync(workspace);
51984
52002
  const sourceNode = args.node?.clonedFromNodeId ? args.mesh?.nodes?.find((n) => meshNodeIdMatches(n, args.node.clonedFromNodeId)) : args.mesh?.nodes?.find((n) => !n.isLocalWorktree);
51985
52003
  const repoRoot = typeof sourceNode?.repoRoot === "string" && sourceNode.repoRoot.trim() ? sourceNode.repoRoot.trim() : typeof sourceNode?.workspace === "string" && sourceNode.workspace.trim() ? sourceNode.workspace.trim() : "";
51986
52004
  if (!worktreeExists) {
51987
52005
  return { success: true, skipped: true, removedPath: workspace, repoRoot: repoRoot || void 0, reason: "worktree_path_missing" };
51988
52006
  }
51989
- if (!repoRoot || !fs29.existsSync(repoRoot)) {
52007
+ if (!repoRoot || !fs32.existsSync(repoRoot)) {
51990
52008
  return {
51991
52009
  success: false,
51992
52010
  code: "mesh_worktree_cleanup_missing_source_repo",
@@ -52004,9 +52022,9 @@ var DaemonCommandRouter = class {
52004
52022
  }
52005
52023
  const { resolveWorktreePath: resolveWorktreePath2, listWorktrees: listWorktrees2, removeWorktree: removeWorktree2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
52006
52024
  const normalizePath = (value) => {
52007
- const resolved = pathResolve2(value);
52025
+ const resolved = pathResolve4(value);
52008
52026
  try {
52009
- return fs29.realpathSync(resolved);
52027
+ return fs32.realpathSync(resolved);
52010
52028
  } catch {
52011
52029
  return resolved;
52012
52030
  }
@@ -52800,7 +52818,7 @@ ${tail}` : ""
52800
52818
  let didAutoRebase = false;
52801
52819
  let isBehindBase = false;
52802
52820
  try {
52803
- execFileSync6("git", ["merge-base", "--is-ancestor", branchHead, baseHead], {
52821
+ execFileSync7("git", ["merge-base", "--is-ancestor", branchHead, baseHead], {
52804
52822
  cwd: node.workspace,
52805
52823
  stdio: "ignore"
52806
52824
  });
@@ -52810,7 +52828,7 @@ ${tail}` : ""
52810
52828
  if (isBehindBase) {
52811
52829
  const autoRebaseStarted = Date.now();
52812
52830
  try {
52813
- execFileSync6("git", ["rebase", baseHead], {
52831
+ execFileSync7("git", ["rebase", baseHead], {
52814
52832
  cwd: node.workspace,
52815
52833
  stdio: ["ignore", "pipe", "pipe"]
52816
52834
  });
@@ -52851,7 +52869,7 @@ ${tail}` : ""
52851
52869
  }
52852
52870
  } catch (rebaseErr) {
52853
52871
  try {
52854
- execFileSync6("git", ["rebase", "--abort"], { cwd: node.workspace, stdio: "ignore" });
52872
+ execFileSync7("git", ["rebase", "--abort"], { cwd: node.workspace, stdio: "ignore" });
52855
52873
  } catch {
52856
52874
  }
52857
52875
  recordMeshRefineStage(refineStages, "patch_equivalence_after_auto_rebase", "failed", autoRebaseStarted, {
@@ -55614,7 +55632,7 @@ init_io_contracts();
55614
55632
  init_chat_message_normalization();
55615
55633
 
55616
55634
  // src/providers/version-archive.ts
55617
- import * as fs30 from "fs";
55635
+ import * as fs33 from "fs";
55618
55636
  import * as path38 from "path";
55619
55637
  import * as os28 from "os";
55620
55638
  import { platform as platform8 } from "os";
@@ -55628,8 +55646,8 @@ var VersionArchive = class {
55628
55646
  }
55629
55647
  load() {
55630
55648
  try {
55631
- if (fs30.existsSync(ARCHIVE_PATH)) {
55632
- this.history = JSON.parse(fs30.readFileSync(ARCHIVE_PATH, "utf-8"));
55649
+ if (fs33.existsSync(ARCHIVE_PATH)) {
55650
+ this.history = JSON.parse(fs33.readFileSync(ARCHIVE_PATH, "utf-8"));
55633
55651
  }
55634
55652
  } catch {
55635
55653
  this.history = {};
@@ -55666,8 +55684,8 @@ var VersionArchive = class {
55666
55684
  }
55667
55685
  save() {
55668
55686
  try {
55669
- fs30.mkdirSync(path38.dirname(ARCHIVE_PATH), { recursive: true });
55670
- fs30.writeFileSync(ARCHIVE_PATH, JSON.stringify(this.history, null, 2));
55687
+ fs33.mkdirSync(path38.dirname(ARCHIVE_PATH), { recursive: true });
55688
+ fs33.writeFileSync(ARCHIVE_PATH, JSON.stringify(this.history, null, 2));
55671
55689
  } catch {
55672
55690
  }
55673
55691
  }
@@ -55692,8 +55710,8 @@ function findBinary2(name) {
55692
55710
  for (const ext of exes) {
55693
55711
  const fullPath = path38.join(p, name + ext);
55694
55712
  try {
55695
- if (fs30.existsSync(fullPath)) {
55696
- const stat2 = fs30.statSync(fullPath);
55713
+ if (fs33.existsSync(fullPath)) {
55714
+ const stat2 = fs33.statSync(fullPath);
55697
55715
  if (stat2.isFile() && (isWin || stat2.mode & 73)) {
55698
55716
  return fullPath;
55699
55717
  }
@@ -55740,9 +55758,9 @@ function checkPathExists2(paths) {
55740
55758
  if (p.includes("*")) {
55741
55759
  const home = os28.homedir();
55742
55760
  const resolved = p.replace(/\*/g, home.split(path38.sep).pop() || "");
55743
- if (fs30.existsSync(resolved)) return resolved;
55761
+ if (fs33.existsSync(resolved)) return resolved;
55744
55762
  } else {
55745
- if (fs30.existsSync(p)) return p;
55763
+ if (fs33.existsSync(p)) return p;
55746
55764
  }
55747
55765
  }
55748
55766
  return null;
@@ -55750,7 +55768,7 @@ function checkPathExists2(paths) {
55750
55768
  async function getMacAppVersion(appPath) {
55751
55769
  if (platform8() !== "darwin" || !appPath.endsWith(".app")) return null;
55752
55770
  const plistPath = path38.join(appPath, "Contents", "Info.plist");
55753
- if (!fs30.existsSync(plistPath)) return null;
55771
+ if (!fs33.existsSync(plistPath)) return null;
55754
55772
  const raw = await runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
55755
55773
  return raw || null;
55756
55774
  }
@@ -55777,7 +55795,7 @@ async function detectAllVersions(loader, archive) {
55777
55795
  let resolvedBin = cliBin;
55778
55796
  if (!resolvedBin && appPath && currentOs === "darwin") {
55779
55797
  const bundled = path38.join(appPath, "Contents", "Resources", "app", "bin", provider.cli || "");
55780
- if (provider.cli && fs30.existsSync(bundled)) resolvedBin = bundled;
55798
+ if (provider.cli && fs33.existsSync(bundled)) resolvedBin = bundled;
55781
55799
  }
55782
55800
  info.installed = !!(appPath || resolvedBin);
55783
55801
  info.path = appPath || null;
@@ -55825,7 +55843,7 @@ async function detectAllVersions(loader, archive) {
55825
55843
 
55826
55844
  // src/daemon/dev-server.ts
55827
55845
  import * as http2 from "http";
55828
- import * as fs34 from "fs";
55846
+ import * as fs37 from "fs";
55829
55847
  import * as path42 from "path";
55830
55848
  init_config();
55831
55849
 
@@ -56178,7 +56196,7 @@ init_builders();
56178
56196
 
56179
56197
  // src/daemon/dev-cdp-handlers.ts
56180
56198
  init_logger();
56181
- import * as fs31 from "fs";
56199
+ import * as fs34 from "fs";
56182
56200
  import * as path39 from "path";
56183
56201
  async function handleCdpEvaluate(ctx, req, res) {
56184
56202
  const body = await ctx.readBody(req);
@@ -56358,17 +56376,17 @@ async function handleScriptHints(ctx, type, _req, res) {
56358
56376
  }
56359
56377
  let scriptsPath = "";
56360
56378
  const directScripts = path39.join(dir, "scripts.js");
56361
- if (fs31.existsSync(directScripts)) {
56379
+ if (fs34.existsSync(directScripts)) {
56362
56380
  scriptsPath = directScripts;
56363
56381
  } else {
56364
56382
  const scriptsDir = path39.join(dir, "scripts");
56365
- if (fs31.existsSync(scriptsDir)) {
56366
- const versions = fs31.readdirSync(scriptsDir).filter((d) => {
56367
- return fs31.statSync(path39.join(scriptsDir, d)).isDirectory();
56383
+ if (fs34.existsSync(scriptsDir)) {
56384
+ const versions = fs34.readdirSync(scriptsDir).filter((d) => {
56385
+ return fs34.statSync(path39.join(scriptsDir, d)).isDirectory();
56368
56386
  }).sort().reverse();
56369
56387
  for (const ver of versions) {
56370
56388
  const p = path39.join(scriptsDir, ver, "scripts.js");
56371
- if (fs31.existsSync(p)) {
56389
+ if (fs34.existsSync(p)) {
56372
56390
  scriptsPath = p;
56373
56391
  break;
56374
56392
  }
@@ -56380,7 +56398,7 @@ async function handleScriptHints(ctx, type, _req, res) {
56380
56398
  return;
56381
56399
  }
56382
56400
  try {
56383
- const source = fs31.readFileSync(scriptsPath, "utf-8");
56401
+ const source = fs34.readFileSync(scriptsPath, "utf-8");
56384
56402
  const hints = {};
56385
56403
  const funcRegex = /module\.exports\.(\w+)\s*=\s*function\s+\w+\s*\(params\)/g;
56386
56404
  let match;
@@ -57195,7 +57213,7 @@ async function handleDomContext(ctx, type, req, res) {
57195
57213
  }
57196
57214
 
57197
57215
  // src/daemon/dev-cli-debug.ts
57198
- import * as fs32 from "fs";
57216
+ import * as fs35 from "fs";
57199
57217
  import * as path40 from "path";
57200
57218
  function slugifyFixtureName(value) {
57201
57219
  const normalized = String(value || "").trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
@@ -57211,10 +57229,10 @@ function getCliFixtureDir(ctx, type) {
57211
57229
  function readCliFixture(ctx, type, name) {
57212
57230
  const fixtureDir = getCliFixtureDir(ctx, type);
57213
57231
  const filePath = path40.join(fixtureDir, `${name}.json`);
57214
- if (!fs32.existsSync(filePath)) {
57232
+ if (!fs35.existsSync(filePath)) {
57215
57233
  throw new Error(`Fixture not found: ${filePath}`);
57216
57234
  }
57217
- return JSON.parse(fs32.readFileSync(filePath, "utf-8"));
57235
+ return JSON.parse(fs35.readFileSync(filePath, "utf-8"));
57218
57236
  }
57219
57237
  function getExerciseTranscriptText(result) {
57220
57238
  const parts = [];
@@ -57959,7 +57977,7 @@ async function handleCliFixtureCapture(ctx, req, res) {
57959
57977
  return;
57960
57978
  }
57961
57979
  const fixtureDir = getCliFixtureDir(ctx, type);
57962
- fs32.mkdirSync(fixtureDir, { recursive: true });
57980
+ fs35.mkdirSync(fixtureDir, { recursive: true });
57963
57981
  const name = slugifyFixtureName(String(body?.name || `${type}-${Date.now()}`));
57964
57982
  const result = await runCliExerciseInternal(ctx, { ...request, type });
57965
57983
  const fixture = {
@@ -57987,7 +58005,7 @@ async function handleCliFixtureCapture(ctx, req, res) {
57987
58005
  notes: typeof body?.notes === "string" ? body.notes : void 0
57988
58006
  };
57989
58007
  const filePath = path40.join(fixtureDir, `${name}.json`);
57990
- fs32.writeFileSync(filePath, JSON.stringify(fixture, null, 2));
58008
+ fs35.writeFileSync(filePath, JSON.stringify(fixture, null, 2));
57991
58009
  ctx.json(res, 200, {
57992
58010
  saved: true,
57993
58011
  name,
@@ -58005,14 +58023,14 @@ async function handleCliFixtureCapture(ctx, req, res) {
58005
58023
  async function handleCliFixtureList(ctx, type, _req, res) {
58006
58024
  try {
58007
58025
  const fixtureDir = getCliFixtureDir(ctx, type);
58008
- if (!fs32.existsSync(fixtureDir)) {
58026
+ if (!fs35.existsSync(fixtureDir)) {
58009
58027
  ctx.json(res, 200, { fixtures: [], count: 0 });
58010
58028
  return;
58011
58029
  }
58012
- const fixtures = fs32.readdirSync(fixtureDir).filter((file) => file.endsWith(".json")).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" })).map((file) => {
58030
+ const fixtures = fs35.readdirSync(fixtureDir).filter((file) => file.endsWith(".json")).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" })).map((file) => {
58013
58031
  const fullPath = path40.join(fixtureDir, file);
58014
58032
  try {
58015
- const raw = JSON.parse(fs32.readFileSync(fullPath, "utf-8"));
58033
+ const raw = JSON.parse(fs35.readFileSync(fullPath, "utf-8"));
58016
58034
  return {
58017
58035
  name: raw.name || file.replace(/\.json$/i, ""),
58018
58036
  path: fullPath,
@@ -58145,7 +58163,7 @@ async function handleCliRaw(ctx, req, res) {
58145
58163
  }
58146
58164
 
58147
58165
  // src/daemon/dev-auto-implement.ts
58148
- import * as fs33 from "fs";
58166
+ import * as fs36 from "fs";
58149
58167
  import * as path41 from "path";
58150
58168
  import * as os29 from "os";
58151
58169
  import { DEFAULT_SESSION_HOST_COLS as DEFAULT_SESSION_HOST_COLS7, DEFAULT_SESSION_HOST_ROWS as DEFAULT_SESSION_HOST_ROWS7 } from "@adhdev/session-host-core";
@@ -58194,10 +58212,10 @@ function resolveAutoImplReference(ctx, category, requestedReference, targetType)
58194
58212
  return fallback?.type || null;
58195
58213
  }
58196
58214
  function getLatestScriptVersionDir(scriptsDir) {
58197
- if (!fs33.existsSync(scriptsDir)) return null;
58198
- const versions = fs33.readdirSync(scriptsDir).filter((d) => {
58215
+ if (!fs36.existsSync(scriptsDir)) return null;
58216
+ const versions = fs36.readdirSync(scriptsDir).filter((d) => {
58199
58217
  try {
58200
- return fs33.statSync(path41.join(scriptsDir, d)).isDirectory();
58218
+ return fs36.statSync(path41.join(scriptsDir, d)).isDirectory();
58201
58219
  } catch {
58202
58220
  return false;
58203
58221
  }
@@ -58219,13 +58237,13 @@ function resolveAutoImplWritableProviderDir(ctx, category, type, requestedDir) {
58219
58237
  if (!sourceDir) {
58220
58238
  return { dir: null, reason: `Provider source directory not found for '${type}'` };
58221
58239
  }
58222
- if (!fs33.existsSync(desiredDir)) {
58223
- fs33.mkdirSync(path41.dirname(desiredDir), { recursive: true });
58224
- fs33.cpSync(sourceDir, desiredDir, { recursive: true });
58240
+ if (!fs36.existsSync(desiredDir)) {
58241
+ fs36.mkdirSync(path41.dirname(desiredDir), { recursive: true });
58242
+ fs36.cpSync(sourceDir, desiredDir, { recursive: true });
58225
58243
  ctx.log(`Auto-implement writable copy created: ${desiredDir}`);
58226
58244
  }
58227
58245
  const providerJson = path41.join(desiredDir, "provider.json");
58228
- if (!fs33.existsSync(providerJson)) {
58246
+ if (!fs36.existsSync(providerJson)) {
58229
58247
  return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
58230
58248
  }
58231
58249
  return { dir: desiredDir };
@@ -58233,15 +58251,15 @@ function resolveAutoImplWritableProviderDir(ctx, category, type, requestedDir) {
58233
58251
  function loadAutoImplReferenceScripts(ctx, referenceType) {
58234
58252
  if (!referenceType) return {};
58235
58253
  const refDir = ctx.findProviderDir(referenceType);
58236
- if (!refDir || !fs33.existsSync(refDir)) return {};
58254
+ if (!refDir || !fs36.existsSync(refDir)) return {};
58237
58255
  const referenceScripts = {};
58238
58256
  const scriptsDir = path41.join(refDir, "scripts");
58239
58257
  const latestDir = getLatestScriptVersionDir(scriptsDir);
58240
58258
  if (!latestDir) return referenceScripts;
58241
- for (const file of fs33.readdirSync(latestDir)) {
58259
+ for (const file of fs36.readdirSync(latestDir)) {
58242
58260
  if (!file.endsWith(".js")) continue;
58243
58261
  try {
58244
- referenceScripts[file] = fs33.readFileSync(path41.join(latestDir, file), "utf-8");
58262
+ referenceScripts[file] = fs36.readFileSync(path41.join(latestDir, file), "utf-8");
58245
58263
  } catch {
58246
58264
  }
58247
58265
  }
@@ -58350,15 +58368,15 @@ async function handleAutoImplement(ctx, type, req, res) {
58350
58368
  const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
58351
58369
  const prompt = buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
58352
58370
  const tmpDir = path41.join(os29.tmpdir(), "adhdev-autoimpl");
58353
- if (!fs33.existsSync(tmpDir)) fs33.mkdirSync(tmpDir, { recursive: true });
58371
+ if (!fs36.existsSync(tmpDir)) fs36.mkdirSync(tmpDir, { recursive: true });
58354
58372
  const promptFile = path41.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
58355
- fs33.writeFileSync(promptFile, prompt, "utf-8");
58373
+ fs36.writeFileSync(promptFile, prompt, "utf-8");
58356
58374
  ctx.log(`Auto-implement prompt written to ${promptFile} (${prompt.length} chars)`);
58357
58375
  const agentProvider = ctx.providerLoader.resolve(agent) || ctx.providerLoader.getMeta(agent);
58358
58376
  const spawn4 = agentProvider?.spawn;
58359
58377
  if (!spawn4?.command) {
58360
58378
  try {
58361
- fs33.unlinkSync(promptFile);
58379
+ fs36.unlinkSync(promptFile);
58362
58380
  } catch {
58363
58381
  }
58364
58382
  ctx.json(res, 400, { error: `Agent '${agent}' has no spawn config. Select a CLI provider with a spawn configuration.` });
@@ -58460,7 +58478,7 @@ async function handleAutoImplement(ctx, type, req, res) {
58460
58478
  } catch {
58461
58479
  }
58462
58480
  try {
58463
- fs33.unlinkSync(promptFile);
58481
+ fs36.unlinkSync(promptFile);
58464
58482
  } catch {
58465
58483
  }
58466
58484
  ctx.log(`Auto-implement (ACP) ${success ? "completed" : "failed"}: ${type} (exit: ${code})`);
@@ -58686,7 +58704,7 @@ async function handleAutoImplement(ctx, type, req, res) {
58686
58704
  }
58687
58705
  });
58688
58706
  try {
58689
- fs33.unlinkSync(promptFile);
58707
+ fs36.unlinkSync(promptFile);
58690
58708
  } catch {
58691
58709
  }
58692
58710
  ctx.log(`Auto-implement ${success ? "completed" : "failed"}: ${type} (exit: ${code})${verificationSummary ? ` verify=${verificationSummary.pass ? "pass" : "fail"}` : ""}`);
@@ -58791,10 +58809,10 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
58791
58809
  lines.push("## \u270F\uFE0F Target Files (EDIT THESE)");
58792
58810
  lines.push("These are the ONLY files you are allowed to modify. Replace the TODO stubs with working implementations.");
58793
58811
  lines.push("");
58794
- for (const file of fs33.readdirSync(latestScriptsDir)) {
58812
+ for (const file of fs36.readdirSync(latestScriptsDir)) {
58795
58813
  if (file.endsWith(".js") && targetFileNames.has(file)) {
58796
58814
  try {
58797
- const content = fs33.readFileSync(path41.join(latestScriptsDir, file), "utf-8");
58815
+ const content = fs36.readFileSync(path41.join(latestScriptsDir, file), "utf-8");
58798
58816
  lines.push(`### \`${file}\` \u270F\uFE0F EDIT`);
58799
58817
  lines.push("```javascript");
58800
58818
  lines.push(content);
@@ -58804,14 +58822,14 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
58804
58822
  }
58805
58823
  }
58806
58824
  }
58807
- const refFiles = fs33.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
58825
+ const refFiles = fs36.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
58808
58826
  if (refFiles.length > 0) {
58809
58827
  lines.push("## \u{1F512} Other Scripts (REFERENCE ONLY \u2014 DO NOT EDIT)");
58810
58828
  lines.push("These files are shown for context only. Do NOT modify them under any circumstances.");
58811
58829
  lines.push("");
58812
58830
  for (const file of refFiles) {
58813
58831
  try {
58814
- const content = fs33.readFileSync(path41.join(latestScriptsDir, file), "utf-8");
58832
+ const content = fs36.readFileSync(path41.join(latestScriptsDir, file), "utf-8");
58815
58833
  lines.push(`### \`${file}\` \u{1F512}`);
58816
58834
  lines.push("```javascript");
58817
58835
  lines.push(content);
@@ -58856,7 +58874,7 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
58856
58874
  const loadGuide = (name) => {
58857
58875
  try {
58858
58876
  const p = path41.join(docsDir, name);
58859
- if (fs33.existsSync(p)) return fs33.readFileSync(p, "utf-8");
58877
+ if (fs36.existsSync(p)) return fs36.readFileSync(p, "utf-8");
58860
58878
  } catch {
58861
58879
  }
58862
58880
  return null;
@@ -59100,11 +59118,11 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
59100
59118
  lines.push("## \u270F\uFE0F Target Files (EDIT THESE)");
59101
59119
  lines.push("These are the ONLY files you are allowed to modify. Replace TODO or heuristic-only logic with working PTY-aware implementations.");
59102
59120
  lines.push("");
59103
- for (const file of fs33.readdirSync(latestScriptsDir)) {
59121
+ for (const file of fs36.readdirSync(latestScriptsDir)) {
59104
59122
  if (!file.endsWith(".js")) continue;
59105
59123
  if (!targetFileNames.has(file)) continue;
59106
59124
  try {
59107
- const content = fs33.readFileSync(path41.join(latestScriptsDir, file), "utf-8");
59125
+ const content = fs36.readFileSync(path41.join(latestScriptsDir, file), "utf-8");
59108
59126
  lines.push(`### \`${file}\` \u270F\uFE0F EDIT`);
59109
59127
  lines.push("```javascript");
59110
59128
  lines.push(content);
@@ -59113,14 +59131,14 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
59113
59131
  } catch {
59114
59132
  }
59115
59133
  }
59116
- const refFiles = fs33.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
59134
+ const refFiles = fs36.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
59117
59135
  if (refFiles.length > 0) {
59118
59136
  lines.push("## \u{1F512} Other Scripts (REFERENCE ONLY \u2014 DO NOT EDIT)");
59119
59137
  lines.push("These files are shown for context only. Do NOT modify them under any circumstances.");
59120
59138
  lines.push("");
59121
59139
  for (const file of refFiles) {
59122
59140
  try {
59123
- const content = fs33.readFileSync(path41.join(latestScriptsDir, file), "utf-8");
59141
+ const content = fs36.readFileSync(path41.join(latestScriptsDir, file), "utf-8");
59124
59142
  lines.push(`### \`${file}\` \u{1F512}`);
59125
59143
  lines.push("```javascript");
59126
59144
  lines.push(content);
@@ -59157,7 +59175,7 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
59157
59175
  const loadGuide = (name) => {
59158
59176
  try {
59159
59177
  const p = path41.join(docsDir, name);
59160
- if (fs33.existsSync(p)) return fs33.readFileSync(p, "utf-8");
59178
+ if (fs36.existsSync(p)) return fs36.readFileSync(p, "utf-8");
59161
59179
  } catch {
59162
59180
  }
59163
59181
  return null;
@@ -59897,7 +59915,7 @@ var DevServer = class _DevServer {
59897
59915
  path42.join(process.cwd(), "packages/web-devconsole/dist")
59898
59916
  ];
59899
59917
  for (const dir of candidates) {
59900
- if (fs34.existsSync(path42.join(dir, "index.html"))) return dir;
59918
+ if (fs37.existsSync(path42.join(dir, "index.html"))) return dir;
59901
59919
  }
59902
59920
  return null;
59903
59921
  }
@@ -59909,7 +59927,7 @@ var DevServer = class _DevServer {
59909
59927
  }
59910
59928
  const htmlPath = path42.join(distDir, "index.html");
59911
59929
  try {
59912
- const html = fs34.readFileSync(htmlPath, "utf-8");
59930
+ const html = fs37.readFileSync(htmlPath, "utf-8");
59913
59931
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
59914
59932
  res.end(html);
59915
59933
  } catch (e) {
@@ -59939,7 +59957,7 @@ var DevServer = class _DevServer {
59939
59957
  return;
59940
59958
  }
59941
59959
  try {
59942
- const content = fs34.readFileSync(filePath);
59960
+ const content = fs37.readFileSync(filePath);
59943
59961
  const ext = path42.extname(filePath);
59944
59962
  const contentType = _DevServer.MIME_MAP[ext] || "application/octet-stream";
59945
59963
  res.writeHead(200, { "Content-Type": contentType, "Cache-Control": "public, max-age=31536000, immutable" });
@@ -60048,14 +60066,14 @@ var DevServer = class _DevServer {
60048
60066
  const files = [];
60049
60067
  const scan = (d, prefix) => {
60050
60068
  try {
60051
- for (const entry of fs34.readdirSync(d, { withFileTypes: true })) {
60069
+ for (const entry of fs37.readdirSync(d, { withFileTypes: true })) {
60052
60070
  if (entry.name.startsWith(".") || entry.name.endsWith(".bak")) continue;
60053
60071
  const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
60054
60072
  if (entry.isDirectory()) {
60055
60073
  files.push({ path: rel, size: 0, type: "dir" });
60056
60074
  scan(path42.join(d, entry.name), rel);
60057
60075
  } else {
60058
- const stat2 = fs34.statSync(path42.join(d, entry.name));
60076
+ const stat2 = fs37.statSync(path42.join(d, entry.name));
60059
60077
  files.push({ path: rel, size: stat2.size, type: "file" });
60060
60078
  }
60061
60079
  }
@@ -60083,11 +60101,11 @@ var DevServer = class _DevServer {
60083
60101
  this.json(res, 403, { error: "Forbidden" });
60084
60102
  return;
60085
60103
  }
60086
- if (!fs34.existsSync(fullPath) || fs34.statSync(fullPath).isDirectory()) {
60104
+ if (!fs37.existsSync(fullPath) || fs37.statSync(fullPath).isDirectory()) {
60087
60105
  this.json(res, 404, { error: `File not found: ${filePath}` });
60088
60106
  return;
60089
60107
  }
60090
- const content = fs34.readFileSync(fullPath, "utf-8");
60108
+ const content = fs37.readFileSync(fullPath, "utf-8");
60091
60109
  this.json(res, 200, { type, path: filePath, content, lines: content.split("\n").length });
60092
60110
  }
60093
60111
  /** POST /api/providers/:type/file — write a file { path, content } */
@@ -60109,9 +60127,9 @@ var DevServer = class _DevServer {
60109
60127
  return;
60110
60128
  }
60111
60129
  try {
60112
- if (fs34.existsSync(fullPath)) fs34.copyFileSync(fullPath, fullPath + ".bak");
60113
- fs34.mkdirSync(path42.dirname(fullPath), { recursive: true });
60114
- fs34.writeFileSync(fullPath, content, "utf-8");
60130
+ if (fs37.existsSync(fullPath)) fs37.copyFileSync(fullPath, fullPath + ".bak");
60131
+ fs37.mkdirSync(path42.dirname(fullPath), { recursive: true });
60132
+ fs37.writeFileSync(fullPath, content, "utf-8");
60115
60133
  this.log(`File saved: ${fullPath} (${content.length} chars)`);
60116
60134
  this.providerLoader.reload();
60117
60135
  this.json(res, 200, { saved: true, path: filePath, chars: content.length });
@@ -60128,8 +60146,8 @@ var DevServer = class _DevServer {
60128
60146
  }
60129
60147
  for (const name of ["scripts.js", "provider.json"]) {
60130
60148
  const p = path42.join(dir, name);
60131
- if (fs34.existsSync(p)) {
60132
- const source = fs34.readFileSync(p, "utf-8");
60149
+ if (fs37.existsSync(p)) {
60150
+ const source = fs37.readFileSync(p, "utf-8");
60133
60151
  this.json(res, 200, { type, path: p, source, lines: source.split("\n").length });
60134
60152
  return;
60135
60153
  }
@@ -60148,11 +60166,11 @@ var DevServer = class _DevServer {
60148
60166
  this.json(res, 404, { error: `Provider not found: ${type}` });
60149
60167
  return;
60150
60168
  }
60151
- const target = fs34.existsSync(path42.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
60169
+ const target = fs37.existsSync(path42.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
60152
60170
  const targetPath = path42.join(dir, target);
60153
60171
  try {
60154
- if (fs34.existsSync(targetPath)) fs34.copyFileSync(targetPath, targetPath + ".bak");
60155
- fs34.writeFileSync(targetPath, source, "utf-8");
60172
+ if (fs37.existsSync(targetPath)) fs37.copyFileSync(targetPath, targetPath + ".bak");
60173
+ fs37.writeFileSync(targetPath, source, "utf-8");
60156
60174
  this.log(`Saved provider: ${targetPath} (${source.length} chars)`);
60157
60175
  this.providerLoader.reload();
60158
60176
  this.json(res, 200, { saved: true, path: targetPath, chars: source.length });
@@ -60297,20 +60315,20 @@ var DevServer = class _DevServer {
60297
60315
  let targetDir;
60298
60316
  targetDir = this.providerLoader.getUserProviderDir(category, type);
60299
60317
  const jsonPath = path42.join(targetDir, "provider.json");
60300
- if (fs34.existsSync(jsonPath)) {
60318
+ if (fs37.existsSync(jsonPath)) {
60301
60319
  this.json(res, 409, { error: `Provider already exists at ${targetDir}`, path: targetDir });
60302
60320
  return;
60303
60321
  }
60304
60322
  try {
60305
60323
  const result = generateFiles(type, name, category, { cdpPorts, cli, processName, installPath, binary, extensionId, version, osPaths, processNames });
60306
- fs34.mkdirSync(targetDir, { recursive: true });
60307
- fs34.writeFileSync(jsonPath, result["provider.json"], "utf-8");
60324
+ fs37.mkdirSync(targetDir, { recursive: true });
60325
+ fs37.writeFileSync(jsonPath, result["provider.json"], "utf-8");
60308
60326
  const createdFiles = ["provider.json"];
60309
60327
  if (result.files) {
60310
60328
  for (const [relPath, content] of Object.entries(result.files)) {
60311
60329
  const fullPath = path42.join(targetDir, relPath);
60312
- fs34.mkdirSync(path42.dirname(fullPath), { recursive: true });
60313
- fs34.writeFileSync(fullPath, content, "utf-8");
60330
+ fs37.mkdirSync(path42.dirname(fullPath), { recursive: true });
60331
+ fs37.writeFileSync(fullPath, content, "utf-8");
60314
60332
  createdFiles.push(relPath);
60315
60333
  }
60316
60334
  }
@@ -60359,10 +60377,10 @@ var DevServer = class _DevServer {
60359
60377
  }
60360
60378
  // ─── Phase 2: Auto-Implement Backend ───
60361
60379
  getLatestScriptVersionDir(scriptsDir) {
60362
- if (!fs34.existsSync(scriptsDir)) return null;
60363
- const versions = fs34.readdirSync(scriptsDir).filter((d) => {
60380
+ if (!fs37.existsSync(scriptsDir)) return null;
60381
+ const versions = fs37.readdirSync(scriptsDir).filter((d) => {
60364
60382
  try {
60365
- return fs34.statSync(path42.join(scriptsDir, d)).isDirectory();
60383
+ return fs37.statSync(path42.join(scriptsDir, d)).isDirectory();
60366
60384
  } catch {
60367
60385
  return false;
60368
60386
  }
@@ -60384,13 +60402,13 @@ var DevServer = class _DevServer {
60384
60402
  if (!sourceDir) {
60385
60403
  return { dir: null, reason: `Provider source directory not found for '${type}'` };
60386
60404
  }
60387
- if (!fs34.existsSync(desiredDir)) {
60388
- fs34.mkdirSync(path42.dirname(desiredDir), { recursive: true });
60389
- fs34.cpSync(sourceDir, desiredDir, { recursive: true });
60405
+ if (!fs37.existsSync(desiredDir)) {
60406
+ fs37.mkdirSync(path42.dirname(desiredDir), { recursive: true });
60407
+ fs37.cpSync(sourceDir, desiredDir, { recursive: true });
60390
60408
  this.log(`Auto-implement writable copy created: ${desiredDir}`);
60391
60409
  }
60392
60410
  const providerJson = path42.join(desiredDir, "provider.json");
60393
- if (!fs34.existsSync(providerJson)) {
60411
+ if (!fs37.existsSync(providerJson)) {
60394
60412
  return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
60395
60413
  }
60396
60414
  return { dir: desiredDir };
@@ -61374,8 +61392,8 @@ async function installExtension(ide, extension) {
61374
61392
  const res = await fetch(extension.vsixUrl);
61375
61393
  if (res.ok) {
61376
61394
  const buffer = Buffer.from(await res.arrayBuffer());
61377
- const fs35 = await import("fs");
61378
- fs35.writeFileSync(vsixPath, buffer);
61395
+ const fs38 = await import("fs");
61396
+ fs38.writeFileSync(vsixPath, buffer);
61379
61397
  return new Promise((resolve24) => {
61380
61398
  const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
61381
61399
  exec6(cmd, { timeout: 6e4 }, (error, _stdout, stderr) => {
@@ -61958,7 +61976,7 @@ import { readFileSync as readFileSync38 } from "fs";
61958
61976
  import { dirname as dirname15, resolve as resolve22 } from "path";
61959
61977
 
61960
61978
  // src/providers/sdk/v1/validators/taint.ts
61961
- import { readFileSync as readFileSync39, existsSync as existsSync48 } from "fs";
61979
+ import { readFileSync as readFileSync39, existsSync as existsSync51 } from "fs";
61962
61980
  import { resolve as resolve23, dirname as dirname16, join as join47 } from "path";
61963
61981
 
61964
61982
  // src/providers/sdk/v1/validators/index.ts