@adhdev/daemon-standalone 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
@@ -30036,10 +30036,10 @@ var require_dist3 = __commonJS({
30036
30036
  }
30037
30037
  function getDaemonBuildInfo() {
30038
30038
  if (cached2) return cached2;
30039
- const commit = readInjected(true ? "2466d8b001000d509eb9058a0c51ec6f383741ed" : void 0) ?? "unknown";
30040
- const commitShort = readInjected(true ? "2466d8b0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
- const version2 = readInjected(true ? "0.9.82-rc.332" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
- const builtAt = readInjected(true ? "2026-06-20T01:56:22.624Z" : void 0);
30039
+ const commit = readInjected(true ? "5d9635b2a6476691469ecfe32b26a17e13484b2b" : void 0) ?? "unknown";
30040
+ const commitShort = readInjected(true ? "5d9635b2" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
+ const version2 = readInjected(true ? "0.9.82-rc.333" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
+ const builtAt = readInjected(true ? "2026-06-20T02:24:25.156Z" : void 0);
30043
30043
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30044
30044
  return cached2;
30045
30045
  }
@@ -30307,10 +30307,10 @@ var require_dist3 = __commonJS({
30307
30307
  } catch (error48) {
30308
30308
  const gitError = error48 instanceof GitCommandError ? error48 : new GitCommandError("git_command_failed", "Failed to read Git status", { cause: error48 });
30309
30309
  if (isTransientGitFailure(gitError)) {
30310
- const cached22 = lastKnownGoodStatus.get(workspace);
30311
- if (cached22) {
30310
+ const cached3 = lastKnownGoodStatus.get(workspace);
30311
+ if (cached3) {
30312
30312
  return {
30313
- ...cached22,
30313
+ ...cached3,
30314
30314
  lastCheckedAt,
30315
30315
  upstreamStatus: "unavailable",
30316
30316
  error: gitError.stderr || gitError.message,
@@ -30433,9 +30433,9 @@ var require_dist3 = __commonJS({
30433
30433
  return { config: null, sourceKey: "no-repo-root" };
30434
30434
  }
30435
30435
  const loaded = loadChangeImpactConfig(repoRoot);
30436
- const cached22 = changeImpactConfigCache.get(repoRoot);
30437
- if (cached22 && cached22.sourceKey === loaded.sourceKey) {
30438
- return { config: cached22.config, sourceKey: loaded.sourceKey };
30436
+ const cached3 = changeImpactConfigCache.get(repoRoot);
30437
+ if (cached3 && cached3.sourceKey === loaded.sourceKey) {
30438
+ return { config: cached3.config, sourceKey: loaded.sourceKey };
30439
30439
  }
30440
30440
  const config2 = loaded.sourceType === "repo_file" ? loaded.config ?? null : null;
30441
30441
  changeImpactConfigCache.set(repoRoot, { sourceKey: loaded.sourceKey, config: config2 });
@@ -32279,6 +32279,47 @@ Follow these recovery rules:
32279
32279
  4. **Always record what happened**: After handling a failure, briefly note the outcome in your report to the user.`;
32280
32280
  }
32281
32281
  });
32282
+ function loadBetterSqlite3() {
32283
+ if (cached22) return cached22;
32284
+ const errors = [];
32285
+ if (typeof require === "function") {
32286
+ try {
32287
+ cached22 = require("better-sqlite3");
32288
+ return cached22;
32289
+ } catch (e) {
32290
+ errors.push(e);
32291
+ }
32292
+ }
32293
+ try {
32294
+ const metaUrl = typeof import_meta?.url === "string" ? import_meta.url : void 0;
32295
+ if (metaUrl) {
32296
+ cached22 = (0, import_module.createRequire)(metaUrl)("better-sqlite3");
32297
+ return cached22;
32298
+ }
32299
+ } catch (e) {
32300
+ errors.push(e);
32301
+ }
32302
+ try {
32303
+ cached22 = (0, import_module.createRequire)(`${process.cwd()}/__adhdev_better_sqlite3_loader__.js`)(
32304
+ "better-sqlite3"
32305
+ );
32306
+ return cached22;
32307
+ } catch (e) {
32308
+ errors.push(e);
32309
+ }
32310
+ const detail = errors.map((e) => e instanceof Error ? e.message : String(e)).join("; ");
32311
+ throw new Error(`Failed to load better-sqlite3: ${detail}`);
32312
+ }
32313
+ var import_module;
32314
+ var import_meta;
32315
+ var cached22;
32316
+ var init_load_better_sqlite3 = __esm2({
32317
+ "src/system/load-better-sqlite3.ts"() {
32318
+ "use strict";
32319
+ import_module = require("module");
32320
+ import_meta = {};
32321
+ }
32322
+ });
32282
32323
  var mesh_ledger_exports = {};
32283
32324
  __export2(mesh_ledger_exports, {
32284
32325
  MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
@@ -32707,8 +32748,8 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
32707
32748
  }
32708
32749
  function getCachedRawEntries(meshId) {
32709
32750
  const now = Date.now();
32710
- const cached22 = ledgerReadCache.get(meshId);
32711
- if (cached22 && now - cached22.cachedAt < LEDGER_CACHE_TTL_MS) return cached22.entries;
32751
+ const cached3 = ledgerReadCache.get(meshId);
32752
+ if (cached3 && now - cached3.cachedAt < LEDGER_CACHE_TTL_MS) return cached3.entries;
32712
32753
  let entries;
32713
32754
  try {
32714
32755
  entries = readLedgerFromStore(meshId);
@@ -33612,8 +33653,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
33612
33653
  });
33613
33654
  function loadDatabaseCtor() {
33614
33655
  if (DatabaseCtor) return DatabaseCtor;
33615
- const runtimeRequire = typeof require === "function" ? require : (0, import_module.createRequire)(import_meta.url);
33616
- DatabaseCtor = runtimeRequire("better-sqlite3");
33656
+ DatabaseCtor = loadBetterSqlite3();
33617
33657
  return DatabaseCtor;
33618
33658
  }
33619
33659
  function safeMeshId(meshId) {
@@ -33642,8 +33682,6 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
33642
33682
  }
33643
33683
  var import_fs5;
33644
33684
  var import_path5;
33645
- var import_module;
33646
- var import_meta;
33647
33685
  var DatabaseCtor;
33648
33686
  var MeshRuntimeStore;
33649
33687
  var init_mesh_runtime_store = __esm2({
@@ -33651,10 +33689,9 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
33651
33689
  "use strict";
33652
33690
  import_fs5 = require("fs");
33653
33691
  import_path5 = require("path");
33654
- import_module = require("module");
33692
+ init_load_better_sqlite3();
33655
33693
  init_mesh_ledger();
33656
33694
  init_mesh_work_queue();
33657
- import_meta = {};
33658
33695
  MeshRuntimeStore = class _MeshRuntimeStore {
33659
33696
  static instance;
33660
33697
  db;
@@ -39194,8 +39231,8 @@ Next step: ${nextStep}`;
39194
39231
  }
39195
39232
  function getCachedMeshByWorkspace(workspace) {
39196
39233
  const now = Date.now();
39197
- const cached22 = meshByWorkspaceCache.get(workspace);
39198
- if (cached22 && now - cached22.cachedAt < MESH_WORKSPACE_CACHE_TTL_MS) return cached22.mesh;
39234
+ const cached3 = meshByWorkspaceCache.get(workspace);
39235
+ if (cached3 && now - cached3.cachedAt < MESH_WORKSPACE_CACHE_TTL_MS) return cached3.mesh;
39199
39236
  const mesh = getMeshByRepo(workspace);
39200
39237
  meshByWorkspaceCache.set(workspace, { mesh, cachedAt: now });
39201
39238
  return mesh;
@@ -45061,10 +45098,10 @@ ${lastSnapshot}`;
45061
45098
  return this.accumulatedRawBuffer.replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, "").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
45062
45099
  }
45063
45100
  getFreshParsedStatusCache() {
45064
- const cached22 = this.parsedStatusCache;
45101
+ const cached3 = this.parsedStatusCache;
45065
45102
  const accumulatedRawBufferKey = this.getAccumulatedRawBufferCacheKey();
45066
- if (cached22 && cached22.responseBuffer === this.responseBuffer && cached22.currentTurnScope === this.engine.currentTurnScope && cached22.recentOutputBuffer === this.recentOutputBuffer && cached22.accumulatedBuffer === this.accumulatedBuffer && cached22.accumulatedRawBufferKey === accumulatedRawBufferKey && cached22.screenText === this.lastScreenText && cached22.currentStatus === this.engine.currentStatus && cached22.activeModal === this.engine.activeModal && cached22.cliName === this.cliName) {
45067
- return cached22.result;
45103
+ 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) {
45104
+ return cached3.result;
45068
45105
  }
45069
45106
  return null;
45070
45107
  }
@@ -45526,10 +45563,10 @@ ${lastSnapshot}`;
45526
45563
  getScriptParsedStatus() {
45527
45564
  const screenText = this.readTerminalScreenText();
45528
45565
  const parseScreenText = this.getParseScreenText(screenText);
45529
- const cached22 = this.parsedStatusCache;
45566
+ const cached3 = this.parsedStatusCache;
45530
45567
  const accumulatedRawBufferKey = this.getAccumulatedRawBufferCacheKey();
45531
- if (!this.providerOwnsTranscript() && cached22 && cached22.responseBuffer === this.responseBuffer && cached22.currentTurnScope === this.engine.currentTurnScope && cached22.recentOutputBuffer === this.recentOutputBuffer && cached22.accumulatedBuffer === this.accumulatedBuffer && cached22.accumulatedRawBufferKey === accumulatedRawBufferKey && cached22.screenText === parseScreenText && cached22.currentStatus === this.engine.currentStatus && cached22.activeModal === this.engine.activeModal && cached22.cliName === this.cliName) {
45532
- return cached22.result;
45568
+ 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) {
45569
+ return cached3.result;
45533
45570
  }
45534
45571
  const parsed = this.runParseSession();
45535
45572
  if (!parsed || !Array.isArray(parsed.messages)) {
@@ -52214,11 +52251,11 @@ ${cleanBody}`;
52214
52251
  var BOUNDED_TAIL_CACHE_MAX_ENTRIES = 64;
52215
52252
  var boundedTailReadCache = /* @__PURE__ */ new Map();
52216
52253
  function readBoundedTailCache(key, signature) {
52217
- const cached22 = boundedTailReadCache.get(key);
52218
- if (!cached22 || cached22.signature !== signature) return null;
52254
+ const cached3 = boundedTailReadCache.get(key);
52255
+ if (!cached3 || cached3.signature !== signature) return null;
52219
52256
  boundedTailReadCache.delete(key);
52220
- boundedTailReadCache.set(key, cached22);
52221
- return cached22.result;
52257
+ boundedTailReadCache.set(key, cached3);
52258
+ return cached3.result;
52222
52259
  }
52223
52260
  function writeBoundedTailCache(key, signature, result) {
52224
52261
  boundedTailReadCache.delete(key);
@@ -52702,9 +52739,9 @@ ${cleanBody}`;
52702
52739
  for (const file2 of files.slice().sort()) {
52703
52740
  const filePath = path14.join(dir, file2);
52704
52741
  const signature = fileSignatures.get(file2) || `${file2}:missing`;
52705
- const cached22 = savedHistoryFileSummaryCache.get(filePath);
52742
+ const cached3 = savedHistoryFileSummaryCache.get(filePath);
52706
52743
  const persisted = persistedEntries.get(file2);
52707
- const reusableEntry = cached22?.signature === signature ? cached22 : persisted?.signature === signature ? persisted : null;
52744
+ const reusableEntry = cached3?.signature === signature ? cached3 : persisted?.signature === signature ? persisted : null;
52708
52745
  const fileSummary = reusableEntry?.summary || computeSavedHistoryFileSummary(dir, file2);
52709
52746
  const nextEntry = reusableEntry || {
52710
52747
  signature,
@@ -53200,16 +53237,16 @@ ${cleanBody}`;
53200
53237
  incrementalTailCache.delete(filePath);
53201
53238
  return { lines: [], coversWholeFile: true };
53202
53239
  }
53203
- const cached22 = incrementalTailCache.get(filePath);
53204
- if (cached22) {
53205
- if (cached22.size === size && cached22.mtimeMs === mtimeMs) {
53240
+ const cached3 = incrementalTailCache.get(filePath);
53241
+ if (cached3) {
53242
+ if (cached3.size === size && cached3.mtimeMs === mtimeMs) {
53206
53243
  incrementalTailCache.delete(filePath);
53207
- incrementalTailCache.set(filePath, cached22);
53208
- if (cached22.coversWholeFile || cached22.lines.length >= needed) {
53209
- return { lines: cached22.lines, coversWholeFile: cached22.coversWholeFile };
53244
+ incrementalTailCache.set(filePath, cached3);
53245
+ if (cached3.coversWholeFile || cached3.lines.length >= needed) {
53246
+ return { lines: cached3.lines, coversWholeFile: cached3.coversWholeFile };
53210
53247
  }
53211
- } else if (size > cached22.size) {
53212
- const incremental = tryIncrementalTailGrowth(filePath, cached22, size, mtimeMs, needed);
53248
+ } else if (size > cached3.size) {
53249
+ const incremental = tryIncrementalTailGrowth(filePath, cached3, size, mtimeMs, needed);
53213
53250
  if (incremental) return { lines: incremental.lines, coversWholeFile: incremental.coversWholeFile };
53214
53251
  }
53215
53252
  incrementalTailCache.delete(filePath);
@@ -53235,22 +53272,22 @@ ${cleanBody}`;
53235
53272
  storeIncrementalTailCache(filePath, result.size, result.mtimeMs, result.lines, result.coversWholeFile);
53236
53273
  return { lines: result.lines, coversWholeFile: result.coversWholeFile };
53237
53274
  }
53238
- function tryIncrementalTailGrowth(filePath, cached22, size, mtimeMs, needed) {
53275
+ function tryIncrementalTailGrowth(filePath, cached3, size, mtimeMs, needed) {
53239
53276
  const fd = fs6.openSync(filePath, "r");
53240
53277
  try {
53241
- if (cached22.size > 0) {
53278
+ if (cached3.size > 0) {
53242
53279
  const boundary = Buffer.alloc(1);
53243
- fs6.readSync(fd, boundary, 0, 1, cached22.size - 1);
53280
+ fs6.readSync(fd, boundary, 0, 1, cached3.size - 1);
53244
53281
  if (boundary[0] !== 10) return null;
53245
53282
  }
53246
- const appendedLength = size - cached22.size;
53283
+ const appendedLength = size - cached3.size;
53247
53284
  const appended = Buffer.alloc(appendedLength);
53248
- fs6.readSync(fd, appended, 0, appendedLength, cached22.size);
53285
+ fs6.readSync(fd, appended, 0, appendedLength, cached3.size);
53249
53286
  const newLines = appended.toString("utf-8").split("\n");
53250
53287
  if (newLines.length && newLines[newLines.length - 1] === "") newLines.pop();
53251
- const merged = cached22.lines.concat(newLines);
53288
+ const merged = cached3.lines.concat(newLines);
53252
53289
  const trimmed = merged.length > TAIL_LINES_RETAINED ? merged.slice(merged.length - TAIL_LINES_RETAINED) : merged;
53253
- const coversWholeFile = cached22.coversWholeFile && trimmed.length === merged.length;
53290
+ const coversWholeFile = cached3.coversWholeFile && trimmed.length === merged.length;
53254
53291
  storeIncrementalTailCache(filePath, size, mtimeMs, trimmed, coversWholeFile);
53255
53292
  if (coversWholeFile || trimmed.length >= needed) {
53256
53293
  return { lines: trimmed, coversWholeFile };
@@ -53315,8 +53352,8 @@ ${cleanBody}`;
53315
53352
  const fileSignatures = buildSavedHistoryFileSignatureMap(dir, files);
53316
53353
  const cacheKey = `${sanitized}\0${historySessionId || ""}\0${offset}\0${limit}\0${excludeRecentCount}\0${historyBehavior?.collapseConsecutiveAssistantTurns ? "1" : "0"}`;
53317
53354
  const signature = buildSavedHistoryCacheSignature(files, fileSignatures);
53318
- const cached22 = readBoundedTailCache(cacheKey, signature);
53319
- if (cached22) return cached22;
53355
+ const cached3 = readBoundedTailCache(cacheKey, signature);
53356
+ if (cached3) return cached3;
53320
53357
  const numericLimit = Math.max(1, Number(limit));
53321
53358
  const numericOffset = Math.max(0, Number(offset));
53322
53359
  const numericExclude = Math.max(0, Number(excludeRecentCount));
@@ -53359,23 +53396,23 @@ ${cleanBody}`;
53359
53396
  savedHistorySessionCache.delete(sanitized);
53360
53397
  return { sessions: [], hasMore: false };
53361
53398
  }
53362
- const cached22 = savedHistorySessionCache.get(sanitized);
53399
+ const cached3 = savedHistorySessionCache.get(sanitized);
53363
53400
  const offset = Math.max(0, options.offset || 0);
53364
53401
  const limit = Math.max(1, options.limit || 30);
53365
53402
  const indexSignature = buildSavedHistoryIndexFileSignature(dir);
53366
53403
  let cacheWasInvalidated = false;
53367
- if (cached22) {
53368
- const cacheLooksPersisted = cached22.signature.startsWith("index:");
53369
- const cacheStillValid = cacheLooksPersisted ? cached22.signature === indexSignature : (() => {
53404
+ if (cached3) {
53405
+ const cacheLooksPersisted = cached3.signature.startsWith("index:");
53406
+ const cacheStillValid = cacheLooksPersisted ? cached3.signature === indexSignature : (() => {
53370
53407
  const files2 = listHistoryFiles(dir);
53371
53408
  const fileSignatures2 = buildSavedHistoryFileSignatureMap(dir, files2);
53372
- return cached22.signature === buildSavedHistoryCacheSignature(files2, fileSignatures2);
53409
+ return cached3.signature === buildSavedHistoryCacheSignature(files2, fileSignatures2);
53373
53410
  })();
53374
53411
  if (cacheStillValid) {
53375
- const sliced2 = cached22.summaries.slice(offset, offset + limit);
53412
+ const sliced2 = cached3.summaries.slice(offset, offset + limit);
53376
53413
  return {
53377
53414
  sessions: sliced2,
53378
- hasMore: cached22.summaries.length > offset + limit
53415
+ hasMore: cached3.summaries.length > offset + limit
53379
53416
  };
53380
53417
  }
53381
53418
  cacheWasInvalidated = true;
@@ -62235,6 +62272,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
62235
62272
  var os17 = __toESM2(require("os"));
62236
62273
  var path222 = __toESM2(require("path"));
62237
62274
  init_logger();
62275
+ init_load_better_sqlite3();
62238
62276
  var UUID_RE = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
62239
62277
  function executeNativeHistory(cfg, input) {
62240
62278
  if (!cfg?.source) return null;
@@ -62359,7 +62397,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
62359
62397
  if (!resolved || !fs13.existsSync(resolved)) return null;
62360
62398
  let Database;
62361
62399
  try {
62362
- Database = require("better-sqlite3");
62400
+ Database = loadBetterSqlite3();
62363
62401
  } catch {
62364
62402
  return null;
62365
62403
  }
@@ -69143,6 +69181,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
69143
69181
  var fs20 = __toESM2(require("fs"));
69144
69182
  var path30 = __toESM2(require("path"));
69145
69183
  var os21 = __toESM2(require("os"));
69184
+ init_load_better_sqlite3();
69146
69185
  var HERMES_STATE_DB = path30.join(os21.homedir(), ".hermes", "state.db");
69147
69186
  var HERMES_LEGACY_SESSIONS_DIR = path30.join(os21.homedir(), ".hermes", "sessions");
69148
69187
  function statMtimeMs4(p) {
@@ -69155,7 +69194,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
69155
69194
  function openDb() {
69156
69195
  if (!fs20.existsSync(HERMES_STATE_DB)) return null;
69157
69196
  try {
69158
- const Database = require("better-sqlite3");
69197
+ const Database = loadBetterSqlite3();
69159
69198
  return new Database(HERMES_STATE_DB, { readonly: true, fileMustExist: true });
69160
69199
  } catch {
69161
69200
  return null;
@@ -70526,8 +70565,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
70526
70565
  return null;
70527
70566
  }
70528
70567
  registerProviderScriptRootSafely(path332.dirname(path332.dirname(providerDir)));
70529
- const cached22 = this.scriptsCache.get(dir);
70530
- if (cached22) return cached22;
70568
+ const cached3 = this.scriptsCache.get(dir);
70569
+ if (cached3) return cached3;
70531
70570
  const scriptsJs = path332.join(dir, "scripts.js");
70532
70571
  if (fs222.existsSync(scriptsJs)) {
70533
70572
  try {
@@ -73574,13 +73613,13 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
73574
73613
  nodes
73575
73614
  };
73576
73615
  }
73577
- function reconcileInlineMeshCache(cached22, incoming) {
73578
- if (!cached22 || typeof cached22 !== "object" || Array.isArray(cached22)) return incoming;
73579
- if (!incoming || typeof incoming !== "object" || Array.isArray(incoming)) return cached22;
73580
- const cachedNodes = Array.isArray(cached22.nodes) ? cached22.nodes : [];
73616
+ function reconcileInlineMeshCache(cached3, incoming) {
73617
+ if (!cached3 || typeof cached3 !== "object" || Array.isArray(cached3)) return incoming;
73618
+ if (!incoming || typeof incoming !== "object" || Array.isArray(incoming)) return cached3;
73619
+ const cachedNodes = Array.isArray(cached3.nodes) ? cached3.nodes : [];
73581
73620
  const incomingNodes = Array.isArray(incoming.nodes) ? incoming.nodes : [];
73582
- if (!cachedNodes.length || !incomingNodes.length) return { ...cached22, ...incoming };
73583
- const cachedUpdatedAt = Date.parse(readStringValue(cached22.updatedAt, cached22.updated_at) || "");
73621
+ if (!cachedNodes.length || !incomingNodes.length) return { ...cached3, ...incoming };
73622
+ const cachedUpdatedAt = Date.parse(readStringValue(cached3.updatedAt, cached3.updated_at) || "");
73584
73623
  const incomingUpdatedAt = Date.parse(readStringValue(incoming.updatedAt, incoming.updated_at) || "");
73585
73624
  const preserveCachedMembership = Number.isFinite(cachedUpdatedAt) && (!Number.isFinite(incomingUpdatedAt) || cachedUpdatedAt > incomingUpdatedAt);
73586
73625
  const cachedById = /* @__PURE__ */ new Map();
@@ -73609,7 +73648,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
73609
73648
  }
73610
73649
  }
73611
73650
  return {
73612
- ...cached22,
73651
+ ...cached3,
73613
73652
  ...incoming,
73614
73653
  nodes
73615
73654
  };
@@ -73942,9 +73981,9 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
73942
73981
  */
73943
73982
  async probe(daemonId, workspace, probe) {
73944
73983
  const key = this.key(daemonId, workspace);
73945
- const cached22 = this.recent.get(key);
73946
- if (cached22 && this.now() - cached22.at < this.reuseMs) {
73947
- return cached22.value;
73984
+ const cached3 = this.recent.get(key);
73985
+ if (cached3 && this.now() - cached3.at < this.reuseMs) {
73986
+ return cached3.value;
73948
73987
  }
73949
73988
  const existing = this.inflight.get(key);
73950
73989
  if (existing) return existing;
@@ -75592,13 +75631,13 @@ ${mergeTreeErr?.stderr || ""}`;
75592
75631
  };
75593
75632
  }
75594
75633
  getCachedAggregateMeshStatus(meshId, mesh, options) {
75595
- const cached22 = this.aggregateMeshStatusCache.get(meshId);
75596
- if (!cached22?.snapshot || cached22.snapshot.success !== true || !Array.isArray(cached22.snapshot.nodes)) return null;
75597
- if (cached22.queueRevision !== getMeshQueueRevision(meshId)) return null;
75598
- let snapshot = this.cloneJsonValue(cached22.snapshot);
75634
+ const cached3 = this.aggregateMeshStatusCache.get(meshId);
75635
+ if (!cached3?.snapshot || cached3.snapshot.success !== true || !Array.isArray(cached3.snapshot.nodes)) return null;
75636
+ if (cached3.queueRevision !== getMeshQueueRevision(meshId)) return null;
75637
+ let snapshot = this.cloneJsonValue(cached3.snapshot);
75599
75638
  snapshot = this.hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options);
75600
75639
  if (shouldRefreshStalePendingAggregate(snapshot, options)) return null;
75601
- const ageMs = Math.max(0, Date.now() - cached22.builtAt);
75640
+ const ageMs = Math.max(0, Date.now() - cached3.builtAt);
75602
75641
  const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
75603
75642
  snapshot.sourceOfTruth = {
75604
75643
  ...sourceOfTruth,
@@ -75609,7 +75648,7 @@ ${mergeTreeErr?.stderr || ""}`;
75609
75648
  source: "memory",
75610
75649
  refreshReason: "memory_cache_hit",
75611
75650
  ageMs,
75612
- cachedAt: new Date(cached22.builtAt).toISOString(),
75651
+ cachedAt: new Date(cached3.builtAt).toISOString(),
75613
75652
  returnedAt: (/* @__PURE__ */ new Date()).toISOString()
75614
75653
  }
75615
75654
  };
@@ -75656,9 +75695,9 @@ ${mergeTreeErr?.stderr || ""}`;
75656
75695
  meshId,
75657
75696
  sanitizeInlineMesh(normalizeInlineMeshNodeIdentity(inlineMesh))
75658
75697
  );
75659
- const cached22 = this.inlineMeshCache.get(meshId);
75660
- if (cached22) {
75661
- const merged = reconcileInlineMeshCache(cached22, sanitizedInlineMesh);
75698
+ const cached3 = this.inlineMeshCache.get(meshId);
75699
+ if (cached3) {
75700
+ const merged = reconcileInlineMeshCache(cached3, sanitizedInlineMesh);
75662
75701
  this.inlineMeshCache.set(meshId, merged);
75663
75702
  return merged;
75664
75703
  }
@@ -75668,17 +75707,17 @@ ${mergeTreeErr?.stderr || ""}`;
75668
75707
  async getMeshForCommand(meshId, inlineMesh, options) {
75669
75708
  const preferInline = options?.preferInline === true;
75670
75709
  if (preferInline) {
75671
- const cached3 = this.getCachedInlineMesh(meshId);
75672
- if (cached3) {
75710
+ const cached4 = this.getCachedInlineMesh(meshId);
75711
+ if (cached4) {
75673
75712
  if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
75674
75713
  const merged = reconcileInlineMeshCache(
75675
- cached3,
75714
+ cached4,
75676
75715
  this.applyInlineMeshNodeTombstones(meshId, inlineMesh)
75677
75716
  );
75678
75717
  this.inlineMeshCache.set(meshId, sanitizeInlineMesh(normalizeInlineMeshNodeIdentity(merged)));
75679
75718
  return { mesh: merged, inline: true, source: "inline_cache" };
75680
75719
  }
75681
- return { mesh: cached3, inline: true, source: "inline_cache" };
75720
+ return { mesh: cached4, inline: true, source: "inline_cache" };
75682
75721
  }
75683
75722
  if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
75684
75723
  this.warmInlineMeshCache(meshId, inlineMesh);
@@ -75691,8 +75730,8 @@ ${mergeTreeErr?.stderr || ""}`;
75691
75730
  if (mesh) return { mesh, inline: false, source: "local_config" };
75692
75731
  } catch {
75693
75732
  }
75694
- const cached22 = this.getCachedInlineMesh(meshId);
75695
- if (cached22) return { mesh: cached22, inline: true, source: "inline_cache" };
75733
+ const cached3 = this.getCachedInlineMesh(meshId);
75734
+ if (cached3) return { mesh: cached3, inline: true, source: "inline_cache" };
75696
75735
  const warmedInline = this.warmInlineMeshCache(meshId, inlineMesh);
75697
75736
  return warmedInline ? { mesh: warmedInline, inline: true, source: "inline_bootstrap" } : null;
75698
75737
  }
@@ -77122,8 +77161,8 @@ ${hintLines.join("\n")}` : "",
77122
77161
  const repoRootBaseRef = /* @__PURE__ */ new Map();
77123
77162
  const submodulePathsByRepoRoot = /* @__PURE__ */ new Map();
77124
77163
  const resolveBaseRef = async (repoRoot) => {
77125
- const cached22 = repoRootBaseRef.get(repoRoot);
77126
- if (cached22) return cached22;
77164
+ const cached3 = repoRootBaseRef.get(repoRoot);
77165
+ if (cached3) return cached3;
77127
77166
  let baseBranch = "main";
77128
77167
  try {
77129
77168
  const { stdout } = await execFileAsync4("git", ["branch", "--show-current"], { cwd: repoRoot, encoding: "utf8" });