@adhdev/daemon-core 0.9.82-rc.332 → 0.9.82-rc.333

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.js CHANGED
@@ -316,10 +316,10 @@ function readInjected(value) {
316
316
  }
317
317
  function getDaemonBuildInfo() {
318
318
  if (cached) return cached;
319
- const commit = readInjected(true ? "2466d8b001000d509eb9058a0c51ec6f383741ed" : void 0) ?? "unknown";
320
- const commitShort = readInjected(true ? "2466d8b0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
- const version = readInjected(true ? "0.9.82-rc.332" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
- const builtAt = readInjected(true ? "2026-06-20T01:55:54.421Z" : void 0);
319
+ const commit = readInjected(true ? "5d9635b2a6476691469ecfe32b26a17e13484b2b" : void 0) ?? "unknown";
320
+ const commitShort = readInjected(true ? "5d9635b2" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
+ const version = readInjected(true ? "0.9.82-rc.333" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
+ const builtAt = readInjected(true ? "2026-06-20T02:23:56.856Z" : void 0);
323
323
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
324
324
  return cached;
325
325
  }
@@ -587,10 +587,10 @@ async function getGitRepoStatus(workspace, options = {}) {
587
587
  } catch (error) {
588
588
  const gitError = error instanceof GitCommandError ? error : new GitCommandError("git_command_failed", "Failed to read Git status", { cause: error });
589
589
  if (isTransientGitFailure(gitError)) {
590
- const cached2 = lastKnownGoodStatus.get(workspace);
591
- if (cached2) {
590
+ const cached3 = lastKnownGoodStatus.get(workspace);
591
+ if (cached3) {
592
592
  return {
593
- ...cached2,
593
+ ...cached3,
594
594
  lastCheckedAt,
595
595
  upstreamStatus: "unavailable",
596
596
  error: gitError.stderr || gitError.message,
@@ -713,9 +713,9 @@ function resolveChangeImpactConfigForRepo(repoRoot, options) {
713
713
  return { config: null, sourceKey: "no-repo-root" };
714
714
  }
715
715
  const loaded = loadChangeImpactConfig(repoRoot);
716
- const cached2 = changeImpactConfigCache.get(repoRoot);
717
- if (cached2 && cached2.sourceKey === loaded.sourceKey) {
718
- return { config: cached2.config, sourceKey: loaded.sourceKey };
716
+ const cached3 = changeImpactConfigCache.get(repoRoot);
717
+ if (cached3 && cached3.sourceKey === loaded.sourceKey) {
718
+ return { config: cached3.config, sourceKey: loaded.sourceKey };
719
719
  }
720
720
  const config = loaded.sourceType === "repo_file" ? loaded.config ?? null : null;
721
721
  changeImpactConfigCache.set(repoRoot, { sourceKey: loaded.sourceKey, config });
@@ -2541,6 +2541,47 @@ Follow these recovery rules:
2541
2541
  }
2542
2542
  });
2543
2543
 
2544
+ // src/system/load-better-sqlite3.ts
2545
+ function loadBetterSqlite3() {
2546
+ if (cached2) return cached2;
2547
+ const errors = [];
2548
+ if (typeof require === "function") {
2549
+ try {
2550
+ cached2 = require("better-sqlite3");
2551
+ return cached2;
2552
+ } catch (e) {
2553
+ errors.push(e);
2554
+ }
2555
+ }
2556
+ try {
2557
+ const metaUrl = typeof import_meta?.url === "string" ? import_meta.url : void 0;
2558
+ if (metaUrl) {
2559
+ cached2 = (0, import_module.createRequire)(metaUrl)("better-sqlite3");
2560
+ return cached2;
2561
+ }
2562
+ } catch (e) {
2563
+ errors.push(e);
2564
+ }
2565
+ try {
2566
+ cached2 = (0, import_module.createRequire)(`${process.cwd()}/__adhdev_better_sqlite3_loader__.js`)(
2567
+ "better-sqlite3"
2568
+ );
2569
+ return cached2;
2570
+ } catch (e) {
2571
+ errors.push(e);
2572
+ }
2573
+ const detail = errors.map((e) => e instanceof Error ? e.message : String(e)).join("; ");
2574
+ throw new Error(`Failed to load better-sqlite3: ${detail}`);
2575
+ }
2576
+ var import_module, import_meta, cached2;
2577
+ var init_load_better_sqlite3 = __esm({
2578
+ "src/system/load-better-sqlite3.ts"() {
2579
+ "use strict";
2580
+ import_module = require("module");
2581
+ import_meta = {};
2582
+ }
2583
+ });
2584
+
2544
2585
  // src/mesh/mesh-ledger.ts
2545
2586
  var mesh_ledger_exports = {};
2546
2587
  __export(mesh_ledger_exports, {
@@ -2970,8 +3011,8 @@ function readLedgerFromStore(meshId) {
2970
3011
  }
2971
3012
  function getCachedRawEntries(meshId) {
2972
3013
  const now = Date.now();
2973
- const cached2 = ledgerReadCache.get(meshId);
2974
- if (cached2 && now - cached2.cachedAt < LEDGER_CACHE_TTL_MS) return cached2.entries;
3014
+ const cached3 = ledgerReadCache.get(meshId);
3015
+ if (cached3 && now - cached3.cachedAt < LEDGER_CACHE_TTL_MS) return cached3.entries;
2975
3016
  let entries;
2976
3017
  try {
2977
3018
  entries = readLedgerFromStore(meshId);
@@ -3854,8 +3895,7 @@ var init_mesh_work_queue = __esm({
3854
3895
  // src/mesh/mesh-runtime-store.ts
3855
3896
  function loadDatabaseCtor() {
3856
3897
  if (DatabaseCtor) return DatabaseCtor;
3857
- const runtimeRequire = typeof require === "function" ? require : (0, import_module.createRequire)(import_meta.url);
3858
- DatabaseCtor = runtimeRequire("better-sqlite3");
3898
+ DatabaseCtor = loadBetterSqlite3();
3859
3899
  return DatabaseCtor;
3860
3900
  }
3861
3901
  function safeMeshId(meshId) {
@@ -3882,16 +3922,15 @@ function meshRuntimeStorePath() {
3882
3922
  }
3883
3923
  return nextPath;
3884
3924
  }
3885
- var import_fs5, import_path5, import_module, import_meta, DatabaseCtor, MeshRuntimeStore;
3925
+ var import_fs5, import_path5, DatabaseCtor, MeshRuntimeStore;
3886
3926
  var init_mesh_runtime_store = __esm({
3887
3927
  "src/mesh/mesh-runtime-store.ts"() {
3888
3928
  "use strict";
3889
3929
  import_fs5 = require("fs");
3890
3930
  import_path5 = require("path");
3891
- import_module = require("module");
3931
+ init_load_better_sqlite3();
3892
3932
  init_mesh_ledger();
3893
3933
  init_mesh_work_queue();
3894
- import_meta = {};
3895
3934
  MeshRuntimeStore = class _MeshRuntimeStore {
3896
3935
  static instance;
3897
3936
  db;
@@ -9418,8 +9457,8 @@ function resolveCoordinatorDrainDaemonIds(components) {
9418
9457
  }
9419
9458
  function getCachedMeshByWorkspace(workspace) {
9420
9459
  const now = Date.now();
9421
- const cached2 = meshByWorkspaceCache.get(workspace);
9422
- if (cached2 && now - cached2.cachedAt < MESH_WORKSPACE_CACHE_TTL_MS) return cached2.mesh;
9460
+ const cached3 = meshByWorkspaceCache.get(workspace);
9461
+ if (cached3 && now - cached3.cachedAt < MESH_WORKSPACE_CACHE_TTL_MS) return cached3.mesh;
9423
9462
  const mesh = getMeshByRepo(workspace);
9424
9463
  meshByWorkspaceCache.set(workspace, { mesh, cachedAt: now });
9425
9464
  return mesh;
@@ -15265,10 +15304,10 @@ ${lastSnapshot}`;
15265
15304
  return this.accumulatedRawBuffer.replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, "").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
15266
15305
  }
15267
15306
  getFreshParsedStatusCache() {
15268
- const cached2 = this.parsedStatusCache;
15307
+ const cached3 = this.parsedStatusCache;
15269
15308
  const accumulatedRawBufferKey = this.getAccumulatedRawBufferCacheKey();
15270
- if (cached2 && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.engine.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.accumulatedRawBufferKey === accumulatedRawBufferKey && cached2.screenText === this.lastScreenText && cached2.currentStatus === this.engine.currentStatus && cached2.activeModal === this.engine.activeModal && cached2.cliName === this.cliName) {
15271
- return cached2.result;
15309
+ if (cached3 && cached3.responseBuffer === this.responseBuffer && cached3.currentTurnScope === this.engine.currentTurnScope && cached3.recentOutputBuffer === this.recentOutputBuffer && cached3.accumulatedBuffer === this.accumulatedBuffer && cached3.accumulatedRawBufferKey === accumulatedRawBufferKey && cached3.screenText === this.lastScreenText && cached3.currentStatus === this.engine.currentStatus && cached3.activeModal === this.engine.activeModal && cached3.cliName === this.cliName) {
15310
+ return cached3.result;
15272
15311
  }
15273
15312
  return null;
15274
15313
  }
@@ -15730,10 +15769,10 @@ ${lastSnapshot}`;
15730
15769
  getScriptParsedStatus() {
15731
15770
  const screenText = this.readTerminalScreenText();
15732
15771
  const parseScreenText = this.getParseScreenText(screenText);
15733
- const cached2 = this.parsedStatusCache;
15772
+ const cached3 = this.parsedStatusCache;
15734
15773
  const accumulatedRawBufferKey = this.getAccumulatedRawBufferCacheKey();
15735
- if (!this.providerOwnsTranscript() && cached2 && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.engine.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.accumulatedRawBufferKey === accumulatedRawBufferKey && cached2.screenText === parseScreenText && cached2.currentStatus === this.engine.currentStatus && cached2.activeModal === this.engine.activeModal && cached2.cliName === this.cliName) {
15736
- return cached2.result;
15774
+ if (!this.providerOwnsTranscript() && cached3 && cached3.responseBuffer === this.responseBuffer && cached3.currentTurnScope === this.engine.currentTurnScope && cached3.recentOutputBuffer === this.recentOutputBuffer && cached3.accumulatedBuffer === this.accumulatedBuffer && cached3.accumulatedRawBufferKey === accumulatedRawBufferKey && cached3.screenText === parseScreenText && cached3.currentStatus === this.engine.currentStatus && cached3.activeModal === this.engine.activeModal && cached3.cliName === this.cliName) {
15775
+ return cached3.result;
15737
15776
  }
15738
15777
  const parsed = this.runParseSession();
15739
15778
  if (!parsed || !Array.isArray(parsed.messages)) {
@@ -22489,11 +22528,11 @@ var savedHistoryRollupInFlight = /* @__PURE__ */ new Set();
22489
22528
  var BOUNDED_TAIL_CACHE_MAX_ENTRIES = 64;
22490
22529
  var boundedTailReadCache = /* @__PURE__ */ new Map();
22491
22530
  function readBoundedTailCache(key, signature) {
22492
- const cached2 = boundedTailReadCache.get(key);
22493
- if (!cached2 || cached2.signature !== signature) return null;
22531
+ const cached3 = boundedTailReadCache.get(key);
22532
+ if (!cached3 || cached3.signature !== signature) return null;
22494
22533
  boundedTailReadCache.delete(key);
22495
- boundedTailReadCache.set(key, cached2);
22496
- return cached2.result;
22534
+ boundedTailReadCache.set(key, cached3);
22535
+ return cached3.result;
22497
22536
  }
22498
22537
  function writeBoundedTailCache(key, signature, result) {
22499
22538
  boundedTailReadCache.delete(key);
@@ -22977,9 +23016,9 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
22977
23016
  for (const file of files.slice().sort()) {
22978
23017
  const filePath = path14.join(dir, file);
22979
23018
  const signature = fileSignatures.get(file) || `${file}:missing`;
22980
- const cached2 = savedHistoryFileSummaryCache.get(filePath);
23019
+ const cached3 = savedHistoryFileSummaryCache.get(filePath);
22981
23020
  const persisted = persistedEntries.get(file);
22982
- const reusableEntry = cached2?.signature === signature ? cached2 : persisted?.signature === signature ? persisted : null;
23021
+ const reusableEntry = cached3?.signature === signature ? cached3 : persisted?.signature === signature ? persisted : null;
22983
23022
  const fileSummary = reusableEntry?.summary || computeSavedHistoryFileSummary(dir, file);
22984
23023
  const nextEntry = reusableEntry || {
22985
23024
  signature,
@@ -23475,16 +23514,16 @@ function readFileTailLines(filePath, needed) {
23475
23514
  incrementalTailCache.delete(filePath);
23476
23515
  return { lines: [], coversWholeFile: true };
23477
23516
  }
23478
- const cached2 = incrementalTailCache.get(filePath);
23479
- if (cached2) {
23480
- if (cached2.size === size && cached2.mtimeMs === mtimeMs) {
23517
+ const cached3 = incrementalTailCache.get(filePath);
23518
+ if (cached3) {
23519
+ if (cached3.size === size && cached3.mtimeMs === mtimeMs) {
23481
23520
  incrementalTailCache.delete(filePath);
23482
- incrementalTailCache.set(filePath, cached2);
23483
- if (cached2.coversWholeFile || cached2.lines.length >= needed) {
23484
- return { lines: cached2.lines, coversWholeFile: cached2.coversWholeFile };
23521
+ incrementalTailCache.set(filePath, cached3);
23522
+ if (cached3.coversWholeFile || cached3.lines.length >= needed) {
23523
+ return { lines: cached3.lines, coversWholeFile: cached3.coversWholeFile };
23485
23524
  }
23486
- } else if (size > cached2.size) {
23487
- const incremental = tryIncrementalTailGrowth(filePath, cached2, size, mtimeMs, needed);
23525
+ } else if (size > cached3.size) {
23526
+ const incremental = tryIncrementalTailGrowth(filePath, cached3, size, mtimeMs, needed);
23488
23527
  if (incremental) return { lines: incremental.lines, coversWholeFile: incremental.coversWholeFile };
23489
23528
  }
23490
23529
  incrementalTailCache.delete(filePath);
@@ -23510,22 +23549,22 @@ function readFileTailLines(filePath, needed) {
23510
23549
  storeIncrementalTailCache(filePath, result.size, result.mtimeMs, result.lines, result.coversWholeFile);
23511
23550
  return { lines: result.lines, coversWholeFile: result.coversWholeFile };
23512
23551
  }
23513
- function tryIncrementalTailGrowth(filePath, cached2, size, mtimeMs, needed) {
23552
+ function tryIncrementalTailGrowth(filePath, cached3, size, mtimeMs, needed) {
23514
23553
  const fd = fs6.openSync(filePath, "r");
23515
23554
  try {
23516
- if (cached2.size > 0) {
23555
+ if (cached3.size > 0) {
23517
23556
  const boundary = Buffer.alloc(1);
23518
- fs6.readSync(fd, boundary, 0, 1, cached2.size - 1);
23557
+ fs6.readSync(fd, boundary, 0, 1, cached3.size - 1);
23519
23558
  if (boundary[0] !== 10) return null;
23520
23559
  }
23521
- const appendedLength = size - cached2.size;
23560
+ const appendedLength = size - cached3.size;
23522
23561
  const appended = Buffer.alloc(appendedLength);
23523
- fs6.readSync(fd, appended, 0, appendedLength, cached2.size);
23562
+ fs6.readSync(fd, appended, 0, appendedLength, cached3.size);
23524
23563
  const newLines = appended.toString("utf-8").split("\n");
23525
23564
  if (newLines.length && newLines[newLines.length - 1] === "") newLines.pop();
23526
- const merged = cached2.lines.concat(newLines);
23565
+ const merged = cached3.lines.concat(newLines);
23527
23566
  const trimmed = merged.length > TAIL_LINES_RETAINED ? merged.slice(merged.length - TAIL_LINES_RETAINED) : merged;
23528
- const coversWholeFile = cached2.coversWholeFile && trimmed.length === merged.length;
23567
+ const coversWholeFile = cached3.coversWholeFile && trimmed.length === merged.length;
23529
23568
  storeIncrementalTailCache(filePath, size, mtimeMs, trimmed, coversWholeFile);
23530
23569
  if (coversWholeFile || trimmed.length >= needed) {
23531
23570
  return { lines: trimmed, coversWholeFile };
@@ -23590,8 +23629,8 @@ function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, ex
23590
23629
  const fileSignatures = buildSavedHistoryFileSignatureMap(dir, files);
23591
23630
  const cacheKey = `${sanitized}\0${historySessionId || ""}\0${offset}\0${limit}\0${excludeRecentCount}\0${historyBehavior?.collapseConsecutiveAssistantTurns ? "1" : "0"}`;
23592
23631
  const signature = buildSavedHistoryCacheSignature(files, fileSignatures);
23593
- const cached2 = readBoundedTailCache(cacheKey, signature);
23594
- if (cached2) return cached2;
23632
+ const cached3 = readBoundedTailCache(cacheKey, signature);
23633
+ if (cached3) return cached3;
23595
23634
  const numericLimit = Math.max(1, Number(limit));
23596
23635
  const numericOffset = Math.max(0, Number(offset));
23597
23636
  const numericExclude = Math.max(0, Number(excludeRecentCount));
@@ -23634,23 +23673,23 @@ function listSavedHistorySessions(agentType, options = {}, historyBehavior) {
23634
23673
  savedHistorySessionCache.delete(sanitized);
23635
23674
  return { sessions: [], hasMore: false };
23636
23675
  }
23637
- const cached2 = savedHistorySessionCache.get(sanitized);
23676
+ const cached3 = savedHistorySessionCache.get(sanitized);
23638
23677
  const offset = Math.max(0, options.offset || 0);
23639
23678
  const limit = Math.max(1, options.limit || 30);
23640
23679
  const indexSignature = buildSavedHistoryIndexFileSignature(dir);
23641
23680
  let cacheWasInvalidated = false;
23642
- if (cached2) {
23643
- const cacheLooksPersisted = cached2.signature.startsWith("index:");
23644
- const cacheStillValid = cacheLooksPersisted ? cached2.signature === indexSignature : (() => {
23681
+ if (cached3) {
23682
+ const cacheLooksPersisted = cached3.signature.startsWith("index:");
23683
+ const cacheStillValid = cacheLooksPersisted ? cached3.signature === indexSignature : (() => {
23645
23684
  const files2 = listHistoryFiles(dir);
23646
23685
  const fileSignatures2 = buildSavedHistoryFileSignatureMap(dir, files2);
23647
- return cached2.signature === buildSavedHistoryCacheSignature(files2, fileSignatures2);
23686
+ return cached3.signature === buildSavedHistoryCacheSignature(files2, fileSignatures2);
23648
23687
  })();
23649
23688
  if (cacheStillValid) {
23650
- const sliced2 = cached2.summaries.slice(offset, offset + limit);
23689
+ const sliced2 = cached3.summaries.slice(offset, offset + limit);
23651
23690
  return {
23652
23691
  sessions: sliced2,
23653
- hasMore: cached2.summaries.length > offset + limit
23692
+ hasMore: cached3.summaries.length > offset + limit
23654
23693
  };
23655
23694
  }
23656
23695
  cacheWasInvalidated = true;
@@ -32598,6 +32637,7 @@ var fs13 = __toESM(require("fs"));
32598
32637
  var os17 = __toESM(require("os"));
32599
32638
  var path22 = __toESM(require("path"));
32600
32639
  init_logger();
32640
+ init_load_better_sqlite3();
32601
32641
  var UUID_RE = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
32602
32642
  function executeNativeHistory(cfg, input) {
32603
32643
  if (!cfg?.source) return null;
@@ -32722,7 +32762,7 @@ function executeSqlite(src, input) {
32722
32762
  if (!resolved || !fs13.existsSync(resolved)) return null;
32723
32763
  let Database;
32724
32764
  try {
32725
- Database = require("better-sqlite3");
32765
+ Database = loadBetterSqlite3();
32726
32766
  } catch {
32727
32767
  return null;
32728
32768
  }
@@ -39546,6 +39586,7 @@ function readSession3(sessionPath, sessionId, workspace) {
39546
39586
  var fs20 = __toESM(require("fs"));
39547
39587
  var path30 = __toESM(require("path"));
39548
39588
  var os21 = __toESM(require("os"));
39589
+ init_load_better_sqlite3();
39549
39590
  var HERMES_STATE_DB = path30.join(os21.homedir(), ".hermes", "state.db");
39550
39591
  var HERMES_LEGACY_SESSIONS_DIR = path30.join(os21.homedir(), ".hermes", "sessions");
39551
39592
  function statMtimeMs4(p) {
@@ -39558,7 +39599,7 @@ function statMtimeMs4(p) {
39558
39599
  function openDb() {
39559
39600
  if (!fs20.existsSync(HERMES_STATE_DB)) return null;
39560
39601
  try {
39561
- const Database = require("better-sqlite3");
39602
+ const Database = loadBetterSqlite3();
39562
39603
  return new Database(HERMES_STATE_DB, { readonly: true, fileMustExist: true });
39563
39604
  } catch {
39564
39605
  return null;
@@ -40933,8 +40974,8 @@ var ProviderLoader = class _ProviderLoader {
40933
40974
  return null;
40934
40975
  }
40935
40976
  registerProviderScriptRootSafely(path33.dirname(path33.dirname(providerDir)));
40936
- const cached2 = this.scriptsCache.get(dir);
40937
- if (cached2) return cached2;
40977
+ const cached3 = this.scriptsCache.get(dir);
40978
+ if (cached3) return cached3;
40938
40979
  const scriptsJs = path33.join(dir, "scripts.js");
40939
40980
  if (fs22.existsSync(scriptsJs)) {
40940
40981
  try {
@@ -44013,13 +44054,13 @@ function sanitizeInlineMesh(inlineMesh) {
44013
44054
  nodes
44014
44055
  };
44015
44056
  }
44016
- function reconcileInlineMeshCache(cached2, incoming) {
44017
- if (!cached2 || typeof cached2 !== "object" || Array.isArray(cached2)) return incoming;
44018
- if (!incoming || typeof incoming !== "object" || Array.isArray(incoming)) return cached2;
44019
- const cachedNodes = Array.isArray(cached2.nodes) ? cached2.nodes : [];
44057
+ function reconcileInlineMeshCache(cached3, incoming) {
44058
+ if (!cached3 || typeof cached3 !== "object" || Array.isArray(cached3)) return incoming;
44059
+ if (!incoming || typeof incoming !== "object" || Array.isArray(incoming)) return cached3;
44060
+ const cachedNodes = Array.isArray(cached3.nodes) ? cached3.nodes : [];
44020
44061
  const incomingNodes = Array.isArray(incoming.nodes) ? incoming.nodes : [];
44021
- if (!cachedNodes.length || !incomingNodes.length) return { ...cached2, ...incoming };
44022
- const cachedUpdatedAt = Date.parse(readStringValue(cached2.updatedAt, cached2.updated_at) || "");
44062
+ if (!cachedNodes.length || !incomingNodes.length) return { ...cached3, ...incoming };
44063
+ const cachedUpdatedAt = Date.parse(readStringValue(cached3.updatedAt, cached3.updated_at) || "");
44023
44064
  const incomingUpdatedAt = Date.parse(readStringValue(incoming.updatedAt, incoming.updated_at) || "");
44024
44065
  const preserveCachedMembership = Number.isFinite(cachedUpdatedAt) && (!Number.isFinite(incomingUpdatedAt) || cachedUpdatedAt > incomingUpdatedAt);
44025
44066
  const cachedById = /* @__PURE__ */ new Map();
@@ -44048,7 +44089,7 @@ function reconcileInlineMeshCache(cached2, incoming) {
44048
44089
  }
44049
44090
  }
44050
44091
  return {
44051
- ...cached2,
44092
+ ...cached3,
44052
44093
  ...incoming,
44053
44094
  nodes
44054
44095
  };
@@ -44381,9 +44422,9 @@ var MeshGitProbeCache = class {
44381
44422
  */
44382
44423
  async probe(daemonId, workspace, probe) {
44383
44424
  const key = this.key(daemonId, workspace);
44384
- const cached2 = this.recent.get(key);
44385
- if (cached2 && this.now() - cached2.at < this.reuseMs) {
44386
- return cached2.value;
44425
+ const cached3 = this.recent.get(key);
44426
+ if (cached3 && this.now() - cached3.at < this.reuseMs) {
44427
+ return cached3.value;
44387
44428
  }
44388
44429
  const existing = this.inflight.get(key);
44389
44430
  if (existing) return existing;
@@ -46031,13 +46072,13 @@ var DaemonCommandRouter = class {
46031
46072
  };
46032
46073
  }
46033
46074
  getCachedAggregateMeshStatus(meshId, mesh, options) {
46034
- const cached2 = this.aggregateMeshStatusCache.get(meshId);
46035
- if (!cached2?.snapshot || cached2.snapshot.success !== true || !Array.isArray(cached2.snapshot.nodes)) return null;
46036
- if (cached2.queueRevision !== getMeshQueueRevision(meshId)) return null;
46037
- let snapshot = this.cloneJsonValue(cached2.snapshot);
46075
+ const cached3 = this.aggregateMeshStatusCache.get(meshId);
46076
+ if (!cached3?.snapshot || cached3.snapshot.success !== true || !Array.isArray(cached3.snapshot.nodes)) return null;
46077
+ if (cached3.queueRevision !== getMeshQueueRevision(meshId)) return null;
46078
+ let snapshot = this.cloneJsonValue(cached3.snapshot);
46038
46079
  snapshot = this.hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options);
46039
46080
  if (shouldRefreshStalePendingAggregate(snapshot, options)) return null;
46040
- const ageMs = Math.max(0, Date.now() - cached2.builtAt);
46081
+ const ageMs = Math.max(0, Date.now() - cached3.builtAt);
46041
46082
  const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
46042
46083
  snapshot.sourceOfTruth = {
46043
46084
  ...sourceOfTruth,
@@ -46048,7 +46089,7 @@ var DaemonCommandRouter = class {
46048
46089
  source: "memory",
46049
46090
  refreshReason: "memory_cache_hit",
46050
46091
  ageMs,
46051
- cachedAt: new Date(cached2.builtAt).toISOString(),
46092
+ cachedAt: new Date(cached3.builtAt).toISOString(),
46052
46093
  returnedAt: (/* @__PURE__ */ new Date()).toISOString()
46053
46094
  }
46054
46095
  };
@@ -46095,9 +46136,9 @@ var DaemonCommandRouter = class {
46095
46136
  meshId,
46096
46137
  sanitizeInlineMesh(normalizeInlineMeshNodeIdentity(inlineMesh))
46097
46138
  );
46098
- const cached2 = this.inlineMeshCache.get(meshId);
46099
- if (cached2) {
46100
- const merged = reconcileInlineMeshCache(cached2, sanitizedInlineMesh);
46139
+ const cached3 = this.inlineMeshCache.get(meshId);
46140
+ if (cached3) {
46141
+ const merged = reconcileInlineMeshCache(cached3, sanitizedInlineMesh);
46101
46142
  this.inlineMeshCache.set(meshId, merged);
46102
46143
  return merged;
46103
46144
  }
@@ -46107,17 +46148,17 @@ var DaemonCommandRouter = class {
46107
46148
  async getMeshForCommand(meshId, inlineMesh, options) {
46108
46149
  const preferInline = options?.preferInline === true;
46109
46150
  if (preferInline) {
46110
- const cached3 = this.getCachedInlineMesh(meshId);
46111
- if (cached3) {
46151
+ const cached4 = this.getCachedInlineMesh(meshId);
46152
+ if (cached4) {
46112
46153
  if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
46113
46154
  const merged = reconcileInlineMeshCache(
46114
- cached3,
46155
+ cached4,
46115
46156
  this.applyInlineMeshNodeTombstones(meshId, inlineMesh)
46116
46157
  );
46117
46158
  this.inlineMeshCache.set(meshId, sanitizeInlineMesh(normalizeInlineMeshNodeIdentity(merged)));
46118
46159
  return { mesh: merged, inline: true, source: "inline_cache" };
46119
46160
  }
46120
- return { mesh: cached3, inline: true, source: "inline_cache" };
46161
+ return { mesh: cached4, inline: true, source: "inline_cache" };
46121
46162
  }
46122
46163
  if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
46123
46164
  this.warmInlineMeshCache(meshId, inlineMesh);
@@ -46130,8 +46171,8 @@ var DaemonCommandRouter = class {
46130
46171
  if (mesh) return { mesh, inline: false, source: "local_config" };
46131
46172
  } catch {
46132
46173
  }
46133
- const cached2 = this.getCachedInlineMesh(meshId);
46134
- if (cached2) return { mesh: cached2, inline: true, source: "inline_cache" };
46174
+ const cached3 = this.getCachedInlineMesh(meshId);
46175
+ if (cached3) return { mesh: cached3, inline: true, source: "inline_cache" };
46135
46176
  const warmedInline = this.warmInlineMeshCache(meshId, inlineMesh);
46136
46177
  return warmedInline ? { mesh: warmedInline, inline: true, source: "inline_bootstrap" } : null;
46137
46178
  }
@@ -47561,8 +47602,8 @@ ${hintLines.join("\n")}` : "",
47561
47602
  const repoRootBaseRef = /* @__PURE__ */ new Map();
47562
47603
  const submodulePathsByRepoRoot = /* @__PURE__ */ new Map();
47563
47604
  const resolveBaseRef = async (repoRoot) => {
47564
- const cached2 = repoRootBaseRef.get(repoRoot);
47565
- if (cached2) return cached2;
47605
+ const cached3 = repoRootBaseRef.get(repoRoot);
47606
+ if (cached3) return cached3;
47566
47607
  let baseBranch = "main";
47567
47608
  try {
47568
47609
  const { stdout } = await execFileAsync4("git", ["branch", "--show-current"], { cwd: repoRoot, encoding: "utf8" });