chat-recall 0.7.80 → 0.7.81

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/mcp.js CHANGED
@@ -11679,7 +11679,38 @@ var init_first_prompt = __esm({
11679
11679
  });
11680
11680
 
11681
11681
  // ../engine/dist/core/project-dir-name.js
11682
- import { readdirSync as readdirSync11 } from "node:fs";
11682
+ import { readdirSync as readdirSync11, statSync as statSync13 } from "node:fs";
11683
+ function makeChildDirsLister(fs2 = realFs) {
11684
+ const cache4 = /* @__PURE__ */ new Map();
11685
+ let diskListings = 0;
11686
+ return {
11687
+ list(path2) {
11688
+ let stamp = null;
11689
+ try {
11690
+ stamp = fs2.statDir(path2);
11691
+ } catch {
11692
+ }
11693
+ const hit = cache4.get(path2);
11694
+ if (stamp && hit && hit.mtimeMs === stamp.mtimeMs && hit.nlink === stamp.nlink)
11695
+ return hit.names;
11696
+ const listedAt = fs2.now();
11697
+ const names = fs2.listDirs(path2);
11698
+ diskListings++;
11699
+ cache4.delete(path2);
11700
+ if (stamp && listedAt - stamp.mtimeMs > CHILD_DIRS_RACY_MS) {
11701
+ if (cache4.size >= CHILD_DIRS_CACHE_MAX) {
11702
+ const oldest = cache4.keys().next().value;
11703
+ if (oldest !== void 0)
11704
+ cache4.delete(oldest);
11705
+ }
11706
+ cache4.set(path2, { ...stamp, names });
11707
+ }
11708
+ return names;
11709
+ },
11710
+ diskListings: () => diskListings,
11711
+ clear: () => cache4.clear()
11712
+ };
11713
+ }
11683
11714
  function looksWindowsEncoded(dirName) {
11684
11715
  return /^[A-Za-z]--/.test(dirName);
11685
11716
  }
@@ -11699,7 +11730,7 @@ function resolveProjectDirName(dirName, deps = {}) {
11699
11730
  return structural;
11700
11731
  if (looksWindowsEncoded(dirName))
11701
11732
  return structural;
11702
- const readdir3 = deps.readdir ?? ((p) => readdirSync11(p, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name));
11733
+ const readdir3 = deps.readdir ?? childDirs.list;
11703
11734
  const encodeName = (name) => name.replace(/[-_.]/g, "-");
11704
11735
  let remaining = dirName.replace(/^-/, "");
11705
11736
  let current = "/";
@@ -11730,14 +11761,26 @@ function resolveProjectDirName(dirName, deps = {}) {
11730
11761
  }
11731
11762
  return remaining ? structural : current;
11732
11763
  }
11764
+ var CHILD_DIRS_RACY_MS, CHILD_DIRS_CACHE_MAX, realFs, childDirs;
11733
11765
  var init_project_dir_name = __esm({
11734
11766
  "../engine/dist/core/project-dir-name.js"() {
11735
11767
  "use strict";
11768
+ CHILD_DIRS_RACY_MS = 2e3;
11769
+ CHILD_DIRS_CACHE_MAX = 512;
11770
+ realFs = {
11771
+ statDir: (p) => {
11772
+ const st = statSync13(p);
11773
+ return { mtimeMs: st.mtimeMs, nlink: st.nlink };
11774
+ },
11775
+ listDirs: (p) => readdirSync11(p, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name),
11776
+ now: () => Date.now()
11777
+ };
11778
+ childDirs = makeChildDirsLister();
11736
11779
  }
11737
11780
  });
11738
11781
 
11739
11782
  // ../engine/dist/core/backends/claude.js
11740
- import { existsSync as existsSync14, readdirSync as readdirSync12, readFileSync as readFileSync13, statSync as statSync13, openSync as openSync5, readSync as readSync5, closeSync as closeSync5 } from "fs";
11783
+ import { existsSync as existsSync14, readdirSync as readdirSync12, readFileSync as readFileSync13, statSync as statSync14, openSync as openSync5, readSync as readSync5, closeSync as closeSync5 } from "fs";
11741
11784
  import { join as join16, basename as basename9 } from "path";
11742
11785
  function stripReminders(text) {
11743
11786
  return text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "").trim();
@@ -11868,7 +11911,7 @@ var init_claude = __esm({
11868
11911
  let mtime = 0;
11869
11912
  for (const c of copies) {
11870
11913
  try {
11871
- mtime = Math.max(mtime, statSync13(c.path).mtimeMs);
11914
+ mtime = Math.max(mtime, statSync14(c.path).mtimeMs);
11872
11915
  } catch {
11873
11916
  }
11874
11917
  }
@@ -11935,7 +11978,7 @@ var init_claude = __esm({
11935
11978
  if (!f.endsWith(".jsonl") || f === "sessions-index.json")
11936
11979
  continue;
11937
11980
  try {
11938
- if (statSync13(join16(projPath, f)).mtimeMs >= cutoff)
11981
+ if (statSync14(join16(projPath, f)).mtimeMs >= cutoff)
11939
11982
  ids.add(basename9(f, ".jsonl"));
11940
11983
  } catch {
11941
11984
  }
@@ -12013,7 +12056,7 @@ var init_claude = __esm({
12013
12056
  const fullPath = join16(projPath, f);
12014
12057
  let stat3;
12015
12058
  try {
12016
- stat3 = statSync13(fullPath);
12059
+ stat3 = statSync14(fullPath);
12017
12060
  } catch {
12018
12061
  continue;
12019
12062
  }
@@ -12267,7 +12310,7 @@ var init_claude = __esm({
12267
12310
  const events = this.readEvents(rawId);
12268
12311
  let fileMtime = 0;
12269
12312
  try {
12270
- fileMtime = statSync13(located.path).mtimeMs;
12313
+ fileMtime = statSync14(located.path).mtimeMs;
12271
12314
  } catch {
12272
12315
  }
12273
12316
  return liveScanEditsFromEvents(events, this.fileToolMap, {
@@ -12322,13 +12365,13 @@ var init_claude = __esm({
12322
12365
  continue;
12323
12366
  const fp = join16(projPath, f);
12324
12367
  try {
12325
- const st = statSync13(fp);
12368
+ const st = statSync14(fp);
12326
12369
  let mtime = st.mtimeMs;
12327
12370
  const subDir = join16(projPath, f.slice(0, -6), "subagents");
12328
12371
  if (existsSync14(subDir)) {
12329
12372
  for (const sub of readdirSync12(subDir)) {
12330
12373
  try {
12331
- const subSt = statSync13(join16(subDir, sub));
12374
+ const subSt = statSync14(join16(subDir, sub));
12332
12375
  if (subSt.mtimeMs > mtime)
12333
12376
  mtime = subSt.mtimeMs;
12334
12377
  } catch {
@@ -12393,7 +12436,7 @@ var init_claude = __esm({
12393
12436
  let total = 0;
12394
12437
  for (const located of findSessionFiles(this.toRawId(prefixedId))) {
12395
12438
  try {
12396
- total += statSync13(located.path).size;
12439
+ total += statSync14(located.path).size;
12397
12440
  } catch {
12398
12441
  }
12399
12442
  }
@@ -12422,7 +12465,7 @@ var init_claude = __esm({
12422
12465
  return copies.slice(0, -1).map((c) => {
12423
12466
  let size = -1;
12424
12467
  try {
12425
- size = statSync13(c.path).size;
12468
+ size = statSync14(c.path).size;
12426
12469
  } catch {
12427
12470
  }
12428
12471
  return `${c.path}:${size}`;
@@ -12618,7 +12661,7 @@ var init_model_pricing = __esm({
12618
12661
  });
12619
12662
 
12620
12663
  // ../engine/dist/parsers/session.js
12621
- import { createReadStream as createReadStream2, existsSync as existsSync15, readdirSync as readdirSync13, readFileSync as readFileSync14, statSync as statSync14, openSync as openSync6, readSync as readSync6, closeSync as closeSync6 } from "fs";
12664
+ import { createReadStream as createReadStream2, existsSync as existsSync15, readdirSync as readdirSync13, readFileSync as readFileSync14, statSync as statSync15, openSync as openSync6, readSync as readSync6, closeSync as closeSync6 } from "fs";
12622
12665
  import { createInterface } from "readline";
12623
12666
  import { join as join17, basename as basename10 } from "path";
12624
12667
  function removeCodeBlocks(text) {
@@ -13924,7 +13967,7 @@ var init_raw = __esm({
13924
13967
  // ../engine/dist/transcript/shadow.js
13925
13968
  import { gzipSync as gzipSync2, gunzipSync as gunzipSync2 } from "zlib";
13926
13969
  import { createHash as createHash5 } from "crypto";
13927
- import { existsSync as existsSync16, mkdirSync as mkdirSync4, readFileSync as readFileSync15, writeFileSync as writeFileSync3, renameSync as renameSync2, statSync as statSync15, openSync as openSync7, readSync as readSync7, closeSync as closeSync7 } from "fs";
13970
+ import { existsSync as existsSync16, mkdirSync as mkdirSync4, readFileSync as readFileSync15, writeFileSync as writeFileSync3, renameSync as renameSync2, statSync as statSync16, openSync as openSync7, readSync as readSync7, closeSync as closeSync7 } from "fs";
13928
13971
  import { dirname as dirname13, join as join20 } from "path";
13929
13972
  function shadowRoot() {
13930
13973
  return join20(getDataDir(), "shadow");
@@ -14105,7 +14148,7 @@ function shadowUncompressedBytes(tool, rawId) {
14105
14148
  const path2 = shadowFileFor(tool, rawId);
14106
14149
  let fd = null;
14107
14150
  try {
14108
- const size = statSync15(path2).size;
14151
+ const size = statSync16(path2).size;
14109
14152
  if (size < 18)
14110
14153
  return 0;
14111
14154
  fd = openSync7(path2, "r");
@@ -14137,7 +14180,7 @@ var init_shadow = __esm({
14137
14180
  });
14138
14181
 
14139
14182
  // ../engine/dist/core/live-session-scan.js
14140
- import { existsSync as existsSync17, readdirSync as readdirSync14, readFileSync as readFileSync16, statSync as statSync16, openSync as openSync8, readSync as readSync8, closeSync as closeSync8 } from "fs";
14183
+ import { existsSync as existsSync17, readdirSync as readdirSync14, readFileSync as readFileSync16, statSync as statSync17, openSync as openSync8, readSync as readSync8, closeSync as closeSync8 } from "fs";
14141
14184
  import { join as join21, basename as basename13 } from "path";
14142
14185
  function detectTool(sessionId) {
14143
14186
  return getBackendForId(sessionId)?.id ?? "claude";
@@ -14286,7 +14329,7 @@ function readSessionGroupText(group) {
14286
14329
  const parts = [];
14287
14330
  for (const p of group.paths) {
14288
14331
  try {
14289
- const st = statSync16(p);
14332
+ const st = statSync17(p);
14290
14333
  parts.push(`${p}:${st.mtimeMs}:${st.size}`);
14291
14334
  } catch {
14292
14335
  parts.push(`${p}:missing`);
@@ -14306,7 +14349,7 @@ function readSessionGroupText(group) {
14306
14349
  continue;
14307
14350
  }
14308
14351
  try {
14309
- mtime = Math.max(mtime, statSync16(p).mtimeMs);
14352
+ mtime = Math.max(mtime, statSync17(p).mtimeMs);
14310
14353
  } catch {
14311
14354
  }
14312
14355
  text = text ? mergeLineText(text, raw).text : raw;
@@ -14406,7 +14449,7 @@ var init_live_session_scan = __esm({
14406
14449
  INDEX_RECHECK_MS = 1e3;
14407
14450
  dirMtime = (p) => {
14408
14451
  try {
14409
- return statSync16(p).mtimeMs;
14452
+ return statSync17(p).mtimeMs;
14410
14453
  } catch {
14411
14454
  return -1;
14412
14455
  }
@@ -14534,7 +14577,7 @@ var init_opencode2 = __esm({
14534
14577
  });
14535
14578
 
14536
14579
  // ../engine/dist/transcript/index.js
14537
- import { statSync as statSync17 } from "fs";
14580
+ import { statSync as statSync18 } from "fs";
14538
14581
  async function parseTranscript(sessionId, opts = {}) {
14539
14582
  const t = await parseTranscriptUncut(sessionId, opts);
14540
14583
  const cap = opts.payloadCap;
@@ -14612,7 +14655,7 @@ async function parseTranscriptUncut(sessionId, opts) {
14612
14655
  }
14613
14656
  function safeMtime(path2) {
14614
14657
  try {
14615
- return statSync17(path2).mtimeMs;
14658
+ return statSync18(path2).mtimeMs;
14616
14659
  } catch {
14617
14660
  return 0;
14618
14661
  }
@@ -14729,7 +14772,7 @@ var init_login_prompt = __esm({
14729
14772
  });
14730
14773
 
14731
14774
  // ../engine/dist/core/secret-redactor.js
14732
- import { statSync as statSync18 } from "fs";
14775
+ import { statSync as statSync19 } from "fs";
14733
14776
  function secretOf(rule, m) {
14734
14777
  const raw = rule.secret != null ? m[rule.secret] : m[0];
14735
14778
  if (raw == null)
@@ -14787,7 +14830,7 @@ function isEnvRedactionRequested() {
14787
14830
  function settingsView() {
14788
14831
  let mtimeMs = -1;
14789
14832
  try {
14790
- mtimeMs = statSync18(settingsFilePath()).mtimeMs;
14833
+ mtimeMs = statSync19(settingsFilePath()).mtimeMs;
14791
14834
  } catch {
14792
14835
  }
14793
14836
  if (cache && cache.mtimeMs === mtimeMs)
@@ -15312,11 +15355,11 @@ var init_session_messages = __esm({
15312
15355
  });
15313
15356
 
15314
15357
  // ../engine/dist/core/which.js
15315
- import { existsSync as existsSync19, statSync as statSync19, accessSync, constants } from "node:fs";
15358
+ import { existsSync as existsSync19, statSync as statSync20, accessSync, constants } from "node:fs";
15316
15359
  import { join as join25, isAbsolute as isAbsolute3, delimiter as delimiter2, sep as sep2 } from "node:path";
15317
15360
  function executable(p) {
15318
15361
  try {
15319
- if (!statSync19(p).isFile())
15362
+ if (!statSync20(p).isFile())
15320
15363
  return false;
15321
15364
  } catch {
15322
15365
  return false;
@@ -15517,7 +15560,7 @@ var init_code_intel = __esm({
15517
15560
  });
15518
15561
 
15519
15562
  // ../engine/dist/core/companions.js
15520
- import { existsSync as existsSync20, mkdirSync as mkdirSync7, statSync as statSync20, chmodSync as chmodSync4, unlinkSync, renameSync as renameSync3, createWriteStream, readFileSync as readFileSync21, writeFileSync as writeFileSync5 } from "node:fs";
15563
+ import { existsSync as existsSync20, mkdirSync as mkdirSync7, statSync as statSync21, chmodSync as chmodSync4, unlinkSync, renameSync as renameSync3, createWriteStream, readFileSync as readFileSync21, writeFileSync as writeFileSync5 } from "node:fs";
15521
15564
  import { homedir as homedir6 } from "node:os";
15522
15565
  import { join as join27 } from "node:path";
15523
15566
  import { execSync as execSync2 } from "node:child_process";
@@ -15568,7 +15611,7 @@ function checkCodeindexStatus() {
15568
15611
  status.installed = true;
15569
15612
  status.path = foundPath;
15570
15613
  try {
15571
- status.size = statSync20(foundPath).size;
15614
+ status.size = statSync21(foundPath).size;
15572
15615
  } catch {
15573
15616
  }
15574
15617
  try {
@@ -15671,7 +15714,7 @@ var init_companions = __esm({
15671
15714
 
15672
15715
  // ../engine/dist/core/detector-install.js
15673
15716
  import { createHash as createHash8 } from "crypto";
15674
- import { existsSync as existsSync21, mkdirSync as mkdirSync8, mkdtempSync, chmodSync as chmodSync5, renameSync as renameSync4, rmSync as rmSync2, writeFileSync as writeFileSync6, readFileSync as readFileSync22, statSync as statSync21, copyFileSync as copyFileSync2 } from "fs";
15717
+ import { existsSync as existsSync21, mkdirSync as mkdirSync8, mkdtempSync, chmodSync as chmodSync5, renameSync as renameSync4, rmSync as rmSync2, writeFileSync as writeFileSync6, readFileSync as readFileSync22, statSync as statSync22, copyFileSync as copyFileSync2 } from "fs";
15675
15718
  import { join as join28 } from "path";
15676
15719
  function managedDetectorPath(name) {
15677
15720
  return join28(getDetectorBinDir(), name + exeSuffix());
@@ -15692,7 +15735,7 @@ function readReceipt(name) {
15692
15735
  function verifiedSha(path2) {
15693
15736
  let st;
15694
15737
  try {
15695
- st = statSync21(path2);
15738
+ st = statSync22(path2);
15696
15739
  } catch {
15697
15740
  return null;
15698
15741
  }
@@ -17160,7 +17203,7 @@ var init_memory_guard = __esm({
17160
17203
 
17161
17204
  // ../engine/dist/core/source-discovery.js
17162
17205
  import { createHash as createHash9 } from "crypto";
17163
- import { existsSync as existsSync24, readdirSync as readdirSync16, statSync as statSync23 } from "fs";
17206
+ import { existsSync as existsSync24, readdirSync as readdirSync16, statSync as statSync24 } from "fs";
17164
17207
  import { join as join33 } from "path";
17165
17208
  function sourceId(path2) {
17166
17209
  return "src_" + createHash9("sha256").update(path2).digest("hex").slice(0, 12);
@@ -17211,7 +17254,7 @@ function countTranscripts(root, tool) {
17211
17254
  continue;
17212
17255
  sessions++;
17213
17256
  try {
17214
- const m = statSync23(full).mtimeMs;
17257
+ const m = statSync24(full).mtimeMs;
17215
17258
  if (m > newestMtime)
17216
17259
  newestMtime = m;
17217
17260
  } catch {
@@ -17223,7 +17266,7 @@ function countTranscripts(root, tool) {
17223
17266
  }
17224
17267
  function countDbSessions(dbPath) {
17225
17268
  try {
17226
- const st = statSync23(dbPath);
17269
+ const st = statSync24(dbPath);
17227
17270
  return { sessions: 0, newestMtime: st.mtimeMs };
17228
17271
  } catch {
17229
17272
  return { sessions: 0, newestMtime: 0 };
@@ -17273,7 +17316,7 @@ var init_source_discovery = __esm({
17273
17316
 
17274
17317
  // ../engine/dist/core/home-discovery.js
17275
17318
  import { execFileSync as execFileSync2 } from "child_process";
17276
- import { existsSync as existsSync25, readdirSync as readdirSync17, readFileSync as readFileSync27, realpathSync as realpathSync4, statSync as statSync24 } from "fs";
17319
+ import { existsSync as existsSync25, readdirSync as readdirSync17, readFileSync as readFileSync27, realpathSync as realpathSync4, statSync as statSync25 } from "fs";
17277
17320
  import { homedir as homedir8, platform as osPlatform } from "os";
17278
17321
  import { basename as basename15, join as join34 } from "path";
17279
17322
  function candidateRoots(plat = osPlatform(), env = process.env) {
@@ -17510,7 +17553,7 @@ function discoverHomes(opts = {}) {
17510
17553
  return;
17511
17554
  }
17512
17555
  try {
17513
- if (!statSync24(real).isDirectory())
17556
+ if (!statSync25(real).isDirectory())
17514
17557
  return;
17515
17558
  } catch {
17516
17559
  return;
@@ -17840,7 +17883,7 @@ var init_extractor_version = __esm({
17840
17883
  });
17841
17884
 
17842
17885
  // src/sync-ledger.ts
17843
- import { readFileSync as readFileSync29, writeFileSync as writeFileSync8, renameSync as renameSync5, mkdirSync as mkdirSync9, statSync as statSync25 } from "node:fs";
17886
+ import { readFileSync as readFileSync29, writeFileSync as writeFileSync8, renameSync as renameSync5, mkdirSync as mkdirSync9, statSync as statSync26 } from "node:fs";
17844
17887
  import { join as join35, dirname as dirname15 } from "node:path";
17845
17888
  function toRow(entry) {
17846
17889
  if (entry === void 0) return void 0;
@@ -17848,7 +17891,7 @@ function toRow(entry) {
17848
17891
  }
17849
17892
  function stampOf(path2) {
17850
17893
  try {
17851
- const st = statSync25(path2);
17894
+ const st = statSync26(path2);
17852
17895
  return `${st.mtimeMs}:${st.size}`;
17853
17896
  } catch {
17854
17897
  return null;
@@ -18712,11 +18755,11 @@ var init_entity_extractor = __esm({
18712
18755
  });
18713
18756
 
18714
18757
  // ../engine/dist/core/source-policy.js
18715
- import { statSync as statSync26 } from "fs";
18758
+ import { statSync as statSync27 } from "fs";
18716
18759
  function settings() {
18717
18760
  let mtimeMs = -1;
18718
18761
  try {
18719
- mtimeMs = statSync26(settingsFilePath()).mtimeMs;
18762
+ mtimeMs = statSync27(settingsFilePath()).mtimeMs;
18720
18763
  } catch {
18721
18764
  }
18722
18765
  if (cache3 && cache3.mtimeMs === mtimeMs)
@@ -18986,7 +19029,7 @@ var init_utils = __esm({
18986
19029
  });
18987
19030
 
18988
19031
  // ../engine/dist/parsers/plan-source.js
18989
- import { existsSync as existsSync27, readdirSync as readdirSync19, readFileSync as readFileSync30, statSync as statSync27 } from "fs";
19032
+ import { existsSync as existsSync27, readdirSync as readdirSync19, readFileSync as readFileSync30, statSync as statSync28 } from "fs";
18990
19033
  import { homedir as homedir10 } from "os";
18991
19034
  import { join as join37, basename as basename16 } from "path";
18992
19035
  function parseFrontmatter(content) {
@@ -19085,7 +19128,7 @@ var init_plan_source = __esm({
19085
19128
  seenClaude.add(file);
19086
19129
  const filePath = join37(plansDir, file);
19087
19130
  try {
19088
- const stat3 = statSync27(filePath);
19131
+ const stat3 = statSync28(filePath);
19089
19132
  const planName = basename16(file, ".md");
19090
19133
  const isAgentPlan = planName.includes("-agent-");
19091
19134
  const content = readFileSync30(filePath, "utf-8");
@@ -19129,7 +19172,7 @@ var init_plan_source = __esm({
19129
19172
  for (const file of files) {
19130
19173
  const filePath = join37(plansDir, file);
19131
19174
  try {
19132
- const stat3 = statSync27(filePath);
19175
+ const stat3 = statSync28(filePath);
19133
19176
  const content = readFileSync30(filePath, "utf-8");
19134
19177
  const firstLine = content.split("\n").find((l) => l.trim())?.replace(/^#+\s*/, "").trim() || file;
19135
19178
  const planName = `${opencodeBackend.idPrefix}plan_${basename16(file, ".md")}`;
@@ -19332,7 +19375,7 @@ var init_plan_source = __esm({
19332
19375
  for (const rawId of sessionDirs) {
19333
19376
  const sessionPath = join37(brainDir, rawId);
19334
19377
  try {
19335
- if (!statSync27(sessionPath).isDirectory())
19378
+ if (!statSync28(sessionPath).isDirectory())
19336
19379
  continue;
19337
19380
  } catch {
19338
19381
  continue;
@@ -19346,7 +19389,7 @@ var init_plan_source = __esm({
19346
19389
  for (const file of files) {
19347
19390
  const filePath = join37(sessionPath, file);
19348
19391
  try {
19349
- const stat3 = statSync27(filePath);
19392
+ const stat3 = statSync28(filePath);
19350
19393
  const content = readFileSync30(filePath, "utf-8");
19351
19394
  const firstLine = content.split("\n").find((l) => l.trim())?.replace(/^#+\s*/, "").trim() || file;
19352
19395
  const sessionLoc = agyBackend.findSession(rawId);
@@ -19376,7 +19419,7 @@ var init_plan_source = __esm({
19376
19419
  });
19377
19420
 
19378
19421
  // ../engine/dist/parsers/task-source.js
19379
- import { existsSync as existsSync28, readdirSync as readdirSync20, readFileSync as readFileSync31, statSync as statSync28 } from "fs";
19422
+ import { existsSync as existsSync28, readdirSync as readdirSync20, readFileSync as readFileSync31, statSync as statSync29 } from "fs";
19380
19423
  import { join as join38 } from "path";
19381
19424
  var MAX_CHUNK_CHARS2, TaskSource;
19382
19425
  var init_task_source = __esm({
@@ -19418,7 +19461,7 @@ var init_task_source = __esm({
19418
19461
  const filePath = join38(todosDir, file);
19419
19462
  let stat3;
19420
19463
  try {
19421
- stat3 = statSync28(filePath);
19464
+ stat3 = statSync29(filePath);
19422
19465
  } catch {
19423
19466
  continue;
19424
19467
  }
@@ -19466,7 +19509,7 @@ var init_task_source = __esm({
19466
19509
  const sessionUuid = entry.name;
19467
19510
  const taskDir = join38(tasksDir, sessionUuid);
19468
19511
  try {
19469
- const stat3 = statSync28(taskDir);
19512
+ const stat3 = statSync29(taskDir);
19470
19513
  const taskFiles = readdirSync20(taskDir).filter((f) => f.endsWith(".json"));
19471
19514
  if (taskFiles.length === 0)
19472
19515
  continue;
@@ -19612,7 +19655,7 @@ ${task.description}`.slice(0, MAX_CHUNK_CHARS2);
19612
19655
  });
19613
19656
 
19614
19657
  // ../engine/dist/parsers/claude-md-source.js
19615
- import { existsSync as existsSync29, readFileSync as readFileSync32, readdirSync as readdirSync21, statSync as statSync29 } from "fs";
19658
+ import { existsSync as existsSync29, readFileSync as readFileSync32, readdirSync as readdirSync21, statSync as statSync30 } from "fs";
19616
19659
  import { homedir as homedir11 } from "os";
19617
19660
  import { join as join39, basename as basename17, dirname as dirname16 } from "path";
19618
19661
  import { createHash as createHash10 } from "crypto";
@@ -19809,7 +19852,7 @@ var init_claude_md_source = __esm({
19809
19852
  }
19810
19853
  fileToItem(filePath, filename, tool) {
19811
19854
  try {
19812
- const stat3 = statSync29(filePath);
19855
+ const stat3 = statSync30(filePath);
19813
19856
  const projectDir = dirname16(filePath);
19814
19857
  const projectName2 = basename17(projectDir);
19815
19858
  const projectPath = projectDir;
@@ -19838,7 +19881,7 @@ var init_claude_md_source = __esm({
19838
19881
  });
19839
19882
 
19840
19883
  // ../engine/dist/parsers/agent-memory-source.js
19841
- import { existsSync as existsSync30, readFileSync as readFileSync33, readdirSync as readdirSync22, statSync as statSync30 } from "fs";
19884
+ import { existsSync as existsSync30, readFileSync as readFileSync33, readdirSync as readdirSync22, statSync as statSync31 } from "fs";
19842
19885
  import { homedir as homedir12 } from "os";
19843
19886
  import { join as join40, basename as basename18 } from "path";
19844
19887
  function parseFrontmatter2(content) {
@@ -19991,7 +20034,7 @@ var init_agent_memory_source = __esm({
19991
20034
  }
19992
20035
  fileToItem(filePath, filename, projectPath, _projectHash) {
19993
20036
  try {
19994
- const stat3 = statSync30(filePath);
20037
+ const stat3 = statSync31(filePath);
19995
20038
  const content = readFileSync33(filePath, "utf-8");
19996
20039
  const { fm } = parseFrontmatter2(content);
19997
20040
  const stem = filename.replace(/\.md$/, "");
@@ -20023,7 +20066,7 @@ var init_agent_memory_source = __esm({
20023
20066
  });
20024
20067
 
20025
20068
  // ../engine/dist/parsers/history-source.js
20026
- import { existsSync as existsSync31, readdirSync as readdirSync23, statSync as statSync31 } from "fs";
20069
+ import { existsSync as existsSync31, readdirSync as readdirSync23, statSync as statSync32 } from "fs";
20027
20070
  import { createReadStream as createReadStream3 } from "fs";
20028
20071
  import { createInterface as createInterface2 } from "readline";
20029
20072
  import { homedir as homedir13 } from "os";
@@ -20066,7 +20109,7 @@ var init_history_source = __esm({
20066
20109
  const historyPath = this.historyPaths.find((p) => existsSync31(p));
20067
20110
  if (!historyPath)
20068
20111
  return;
20069
- const stat3 = statSync31(historyPath);
20112
+ const stat3 = statSync32(historyPath);
20070
20113
  const groups = await this.groupByProject();
20071
20114
  for (const [project, group] of groups) {
20072
20115
  const projectId = project.replace(/\//g, "-").replace(/^-/, "");
@@ -20207,7 +20250,7 @@ var init_history_source = __esm({
20207
20250
  });
20208
20251
 
20209
20252
  // ../engine/dist/parsers/paste-source.js
20210
- import { existsSync as existsSync32, readdirSync as readdirSync24, readFileSync as readFileSync34, statSync as statSync32 } from "fs";
20253
+ import { existsSync as existsSync32, readdirSync as readdirSync24, readFileSync as readFileSync34, statSync as statSync33 } from "fs";
20211
20254
  import { homedir as homedir14 } from "os";
20212
20255
  import { join as join42, basename as basename19 } from "path";
20213
20256
  var MAX_CHUNK_CHARS6, MAX_FILE_SIZE, PasteSource;
@@ -20257,7 +20300,7 @@ var init_paste_source = __esm({
20257
20300
  seen.add(file);
20258
20301
  const filePath = join42(cacheDir, file);
20259
20302
  try {
20260
- const stat3 = statSync32(filePath);
20303
+ const stat3 = statSync33(filePath);
20261
20304
  if (stat3.size > MAX_FILE_SIZE)
20262
20305
  continue;
20263
20306
  if (stat3.size < 10)
@@ -20307,7 +20350,7 @@ var init_paste_source = __esm({
20307
20350
  });
20308
20351
 
20309
20352
  // ../engine/dist/parsers/antigravity-brain-source.js
20310
- import { existsSync as existsSync33, readdirSync as readdirSync25, readFileSync as readFileSync35, statSync as statSync33 } from "fs";
20353
+ import { existsSync as existsSync33, readdirSync as readdirSync25, readFileSync as readFileSync35, statSync as statSync34 } from "fs";
20311
20354
  import { join as join43 } from "path";
20312
20355
  var MAX_CHUNK_CHARS7, AntigravityBrainSource;
20313
20356
  var init_antigravity_brain_source = __esm({
@@ -20339,7 +20382,7 @@ var init_antigravity_brain_source = __esm({
20339
20382
  for (const file of files) {
20340
20383
  const filePath = join43(sessionDir, file);
20341
20384
  try {
20342
- const stat3 = statSync33(filePath);
20385
+ const stat3 = statSync34(filePath);
20343
20386
  const content = readFileSync35(filePath, "utf-8");
20344
20387
  const firstLine = content.split("\n").find((l) => l.trim() && !l.startsWith("#"))?.trim() || "";
20345
20388
  const heading = content.split("\n").find((l) => l.startsWith("#"))?.replace(/^#+\s*/, "").trim() || file;
@@ -20721,7 +20764,7 @@ var init_opencode_todo_source = __esm({
20721
20764
  });
20722
20765
 
20723
20766
  // ../engine/dist/parsers/codex-session-source.js
20724
- import { existsSync as existsSync36, readdirSync as readdirSync26, readFileSync as readFileSync36, statSync as statSync34 } from "fs";
20767
+ import { existsSync as existsSync36, readdirSync as readdirSync26, readFileSync as readFileSync36, statSync as statSync35 } from "fs";
20725
20768
  import { join as join44, basename as basename20 } from "path";
20726
20769
  function getCodexSessionsDir() {
20727
20770
  return codexBackend.sessionsDir();
@@ -20783,7 +20826,7 @@ var init_codex_session_source = __esm({
20783
20826
  const jsonlFiles = this.collectJsonlFiles(this.sessionsDir);
20784
20827
  for (const filePath of jsonlFiles) {
20785
20828
  try {
20786
- const stat3 = statSync34(filePath);
20829
+ const stat3 = statSync35(filePath);
20787
20830
  const lines = readFileSync36(filePath, "utf-8").split("\n");
20788
20831
  const firstLine = lines.find((l) => l.trim());
20789
20832
  if (!firstLine)
@@ -20957,7 +21000,7 @@ var init_codex_session_source = __esm({
20957
21000
  });
20958
21001
 
20959
21002
  // ../engine/dist/parsers/diary-source.js
20960
- import { existsSync as existsSync37, mkdirSync as mkdirSync10, readdirSync as readdirSync27, readFileSync as readFileSync37, writeFileSync as writeFileSync9, statSync as statSync35 } from "fs";
21003
+ import { existsSync as existsSync37, mkdirSync as mkdirSync10, readdirSync as readdirSync27, readFileSync as readFileSync37, writeFileSync as writeFileSync9, statSync as statSync36 } from "fs";
20961
21004
  import { join as join45, basename as basename21 } from "path";
20962
21005
  var MAX_CHUNK_CHARS10, DiarySource;
20963
21006
  var init_diary_source = __esm({
@@ -20982,7 +21025,7 @@ var init_diary_source = __esm({
20982
21025
  for (const file of files) {
20983
21026
  const filePath = join45(agentPath, file);
20984
21027
  try {
20985
- const stat3 = statSync35(filePath);
21028
+ const stat3 = statSync36(filePath);
20986
21029
  const raw = readFileSync37(filePath, "utf-8");
20987
21030
  const entry = JSON.parse(raw);
20988
21031
  const entryId = basename21(file, ".json");
@@ -21118,7 +21161,7 @@ var init_redact_inline = __esm({
21118
21161
  });
21119
21162
 
21120
21163
  // ../engine/dist/parsers/skills-source.js
21121
- import { existsSync as existsSync38, readdirSync as readdirSync28, readFileSync as readFileSync38, statSync as statSync36 } from "fs";
21164
+ import { existsSync as existsSync38, readdirSync as readdirSync28, readFileSync as readFileSync38, statSync as statSync37 } from "fs";
21122
21165
  import { homedir as homedir15 } from "os";
21123
21166
  import { join as join46 } from "path";
21124
21167
  function rebuildBody(content) {
@@ -21226,7 +21269,7 @@ var init_skills_source = __esm({
21226
21269
  const skillDir = join46(root.path, name);
21227
21270
  let st;
21228
21271
  try {
21229
- st = statSync36(skillDir);
21272
+ st = statSync37(skillDir);
21230
21273
  } catch {
21231
21274
  continue;
21232
21275
  }
@@ -21248,7 +21291,7 @@ var init_skills_source = __esm({
21248
21291
  const skillName = fm.name || name;
21249
21292
  let mtime = st.mtimeMs;
21250
21293
  try {
21251
- mtime = statSync36(skillMd).mtimeMs;
21294
+ mtime = statSync37(skillMd).mtimeMs;
21252
21295
  } catch {
21253
21296
  }
21254
21297
  const subdirs = {};
@@ -21256,7 +21299,7 @@ var init_skills_source = __esm({
21256
21299
  for (const sub of readdirSync28(skillDir)) {
21257
21300
  const subPath = join46(skillDir, sub);
21258
21301
  try {
21259
- const ss = statSync36(subPath);
21302
+ const ss = statSync37(subPath);
21260
21303
  if (ss.isDirectory()) {
21261
21304
  let count = 0;
21262
21305
  try {
@@ -28681,7 +28724,7 @@ var init_hermes_config = __esm({
28681
28724
  });
28682
28725
 
28683
28726
  // ../engine/dist/parsers/mcps-source.js
28684
- import { existsSync as existsSync40, readFileSync as readFileSync40, statSync as statSync37 } from "fs";
28727
+ import { existsSync as existsSync40, readFileSync as readFileSync40, statSync as statSync38 } from "fs";
28685
28728
  import { homedir as homedir16 } from "os";
28686
28729
  import { join as join48 } from "path";
28687
28730
  function readJson(path2) {
@@ -28820,7 +28863,7 @@ var init_mcps_source = __esm({
28820
28863
  return;
28821
28864
  let mtime = 0;
28822
28865
  try {
28823
- mtime = statSync37(ctx.filePath).mtimeMs;
28866
+ mtime = statSync38(ctx.filePath).mtimeMs;
28824
28867
  } catch {
28825
28868
  }
28826
28869
  for (const [name, cfgRaw] of Object.entries(obj2)) {
@@ -29017,7 +29060,7 @@ var init_toolkit_format = __esm({
29017
29060
  });
29018
29061
 
29019
29062
  // ../engine/dist/parsers/slash-commands-source.js
29020
- import { existsSync as existsSync41, readdirSync as readdirSync29, readFileSync as readFileSync41, statSync as statSync38 } from "fs";
29063
+ import { existsSync as existsSync41, readdirSync as readdirSync29, readFileSync as readFileSync41, statSync as statSync39 } from "fs";
29021
29064
  import { join as join49, basename as basename22 } from "path";
29022
29065
  function rebuildBody2(content) {
29023
29066
  const { text, redacted } = redactInlineSecrets(content);
@@ -29115,7 +29158,7 @@ var init_slash_commands_source = __esm({
29115
29158
  for (const file of files) {
29116
29159
  const filePath = join49(root.path, file);
29117
29160
  try {
29118
- const stat3 = statSync38(filePath);
29161
+ const stat3 = statSync39(filePath);
29119
29162
  const content = readFileSync41(filePath, "utf-8");
29120
29163
  const parsed = parseCommand(content, basename22(file, ext), root.format);
29121
29164
  yield {
@@ -29168,7 +29211,7 @@ var init_slash_commands_source = __esm({
29168
29211
  });
29169
29212
 
29170
29213
  // ../engine/dist/parsers/subagents-source.js
29171
- import { existsSync as existsSync42, readdirSync as readdirSync30, readFileSync as readFileSync42, statSync as statSync39 } from "fs";
29214
+ import { existsSync as existsSync42, readdirSync as readdirSync30, readFileSync as readFileSync42, statSync as statSync40 } from "fs";
29172
29215
  import { join as join50, basename as basename23 } from "path";
29173
29216
  function rebuildBody3(content) {
29174
29217
  const { text, redacted } = redactInlineSecrets(content);
@@ -29264,7 +29307,7 @@ var init_subagents_source = __esm({
29264
29307
  for (const file of files) {
29265
29308
  const filePath = join50(root.path, file);
29266
29309
  try {
29267
- const stat3 = statSync39(filePath);
29310
+ const stat3 = statSync40(filePath);
29268
29311
  const content = readFileSync42(filePath, "utf-8");
29269
29312
  const parsed = parseAgent(content, basename23(file, ext), root.format);
29270
29313
  yield {
@@ -29318,7 +29361,7 @@ var init_subagents_source = __esm({
29318
29361
  });
29319
29362
 
29320
29363
  // ../engine/dist/parsers/hooks-source.js
29321
- import { existsSync as existsSync43, readFileSync as readFileSync43, readdirSync as readdirSync31, statSync as statSync40 } from "fs";
29364
+ import { existsSync as existsSync43, readFileSync as readFileSync43, readdirSync as readdirSync31, statSync as statSync41 } from "fs";
29322
29365
  import { join as join51 } from "path";
29323
29366
  function readJson2(path2) {
29324
29367
  if (!existsSync43(path2))
@@ -29367,7 +29410,7 @@ var init_hooks_source = __esm({
29367
29410
  return;
29368
29411
  let mtime = 0;
29369
29412
  try {
29370
- mtime = statSync40(settingsPath2).mtimeMs;
29413
+ mtime = statSync41(settingsPath2).mtimeMs;
29371
29414
  } catch {
29372
29415
  }
29373
29416
  for (const [event, groups] of Object.entries(hooks)) {
@@ -29441,7 +29484,7 @@ var init_hooks_source = __esm({
29441
29484
  });
29442
29485
 
29443
29486
  // ../engine/dist/parsers/plugins-source.js
29444
- import { existsSync as existsSync44, readFileSync as readFileSync44, readdirSync as readdirSync32, statSync as statSync41 } from "fs";
29487
+ import { existsSync as existsSync44, readFileSync as readFileSync44, readdirSync as readdirSync32, statSync as statSync42 } from "fs";
29445
29488
  import { homedir as homedir17 } from "os";
29446
29489
  import { join as join52 } from "path";
29447
29490
  function readJson3(path2) {
@@ -29470,7 +29513,7 @@ var init_plugins_source = __esm({
29470
29513
  if (claudeJson?.plugins && typeof claudeJson.plugins === "object") {
29471
29514
  let mtime = 0;
29472
29515
  try {
29473
- mtime = statSync41(claudePluginsManifest).mtimeMs;
29516
+ mtime = statSync42(claudePluginsManifest).mtimeMs;
29474
29517
  } catch {
29475
29518
  }
29476
29519
  for (const [pluginRef, installs] of Object.entries(claudeJson.plugins)) {
@@ -29511,7 +29554,7 @@ var init_plugins_source = __esm({
29511
29554
  const dir = join52(gemRoot, name);
29512
29555
  let st;
29513
29556
  try {
29514
- st = statSync41(dir);
29557
+ st = statSync42(dir);
29515
29558
  } catch {
29516
29559
  continue;
29517
29560
  }
@@ -29523,7 +29566,7 @@ var init_plugins_source = __esm({
29523
29566
  continue;
29524
29567
  let mtime = st.mtimeMs;
29525
29568
  try {
29526
- mtime = statSync41(manifestPath).mtimeMs;
29569
+ mtime = statSync42(manifestPath).mtimeMs;
29527
29570
  } catch {
29528
29571
  }
29529
29572
  const mcpServers = manifest.mcpServers ? Object.keys(manifest.mcpServers) : [];
@@ -29551,7 +29594,7 @@ var init_plugins_source = __esm({
29551
29594
  for (const { name, dir: pluginDir } of codexBackend.installedPluginDirs()) {
29552
29595
  let st;
29553
29596
  try {
29554
- st = statSync41(pluginDir);
29597
+ st = statSync42(pluginDir);
29555
29598
  } catch {
29556
29599
  continue;
29557
29600
  }
@@ -29686,7 +29729,7 @@ var init_sync_fields = __esm({
29686
29729
  });
29687
29730
 
29688
29731
  // ../engine/dist/core/index-lock.js
29689
- import { existsSync as existsSync45, mkdirSync as mkdirSync11, openSync as openSync10, writeFileSync as writeFileSync10, readFileSync as readFileSync45, rmSync as rmSync4, statSync as statSync42, closeSync as closeSync10 } from "fs";
29732
+ import { existsSync as existsSync45, mkdirSync as mkdirSync11, openSync as openSync10, writeFileSync as writeFileSync10, readFileSync as readFileSync45, rmSync as rmSync4, statSync as statSync43, closeSync as closeSync10 } from "fs";
29690
29733
  import { dirname as dirname17, join as join53 } from "path";
29691
29734
  function acquireIndexLock(opts) {
29692
29735
  const lockPath = lockFilePath(opts.file);
@@ -29736,7 +29779,7 @@ function lockFilePath(file = ".compact.lock") {
29736
29779
  }
29737
29780
  function stealStaleLock(lockPath, staleAfterMs) {
29738
29781
  try {
29739
- const s = statSync42(lockPath);
29782
+ const s = statSync43(lockPath);
29740
29783
  const age = Date.now() - s.mtimeMs;
29741
29784
  let payload;
29742
29785
  try {
@@ -30322,13 +30365,13 @@ var init_telemetry = __esm({
30322
30365
 
30323
30366
  // src/session-file-scan.ts
30324
30367
  import { open as open3 } from "node:fs/promises";
30325
- import { statSync as statSync43 } from "node:fs";
30368
+ import { statSync as statSync44 } from "node:fs";
30326
30369
  function sessionGroupsBytes(groups) {
30327
30370
  let total = 0;
30328
30371
  for (const g of groups) {
30329
30372
  for (const p of g.paths) {
30330
30373
  try {
30331
- total += statSync43(p).size;
30374
+ total += statSync44(p).size;
30332
30375
  } catch {
30333
30376
  }
30334
30377
  }
@@ -30447,7 +30490,7 @@ var init_session_file_scan = __esm({
30447
30490
  });
30448
30491
 
30449
30492
  // src/raw-archive-parts.ts
30450
- import { createReadStream as createReadStream4, createWriteStream as createWriteStream2, openSync as openSync11, readSync as readSync9, closeSync as closeSync11, rmSync as rmSync5, statSync as statSync44 } from "node:fs";
30493
+ import { createReadStream as createReadStream4, createWriteStream as createWriteStream2, openSync as openSync11, readSync as readSync9, closeSync as closeSync11, rmSync as rmSync5, statSync as statSync45 } from "node:fs";
30451
30494
  import { tmpdir as tmpdir2 } from "node:os";
30452
30495
  import { join as join54 } from "node:path";
30453
30496
  import { randomBytes } from "node:crypto";
@@ -30515,7 +30558,7 @@ async function writeArchiveFile(source, meta, redact, dir = tmpdir2()) {
30515
30558
  rmSync5(path2, { force: true });
30516
30559
  throw err;
30517
30560
  }
30518
- return { path: path2, gzSize: statSync44(path2).size, size };
30561
+ return { path: path2, gzSize: statSync45(path2).size, size };
30519
30562
  }
30520
30563
  async function putPart(url, body2) {
30521
30564
  let last;
@@ -30590,6 +30633,16 @@ var init_raw_archive_parts = __esm({
30590
30633
  }
30591
30634
  });
30592
30635
 
30636
+ // src/yield-loop.ts
30637
+ function yieldToEventLoop() {
30638
+ return new Promise((resolve3) => setImmediate(resolve3));
30639
+ }
30640
+ var init_yield_loop = __esm({
30641
+ "src/yield-loop.ts"() {
30642
+ "use strict";
30643
+ }
30644
+ });
30645
+
30593
30646
  // src/server-probe.ts
30594
30647
  var server_probe_exports = {};
30595
30648
  __export(server_probe_exports, {
@@ -30753,7 +30806,7 @@ __export(auto_update_exports, {
30753
30806
  import { execSync as execSync4, execFileSync as execFileSync3 } from "node:child_process";
30754
30807
  import { readFileSync as readFileSync47, existsSync as existsSync47 } from "node:fs";
30755
30808
  import { fileURLToPath as fileURLToPath2 } from "node:url";
30756
- import { writeFileSync as writeFileSync11, mkdtempSync as mkdtempSync3, rmSync as rmSync6, readdirSync as readdirSync33, statSync as statSync45, mkdirSync as mkdirSync12 } from "node:fs";
30809
+ import { writeFileSync as writeFileSync11, mkdtempSync as mkdtempSync3, rmSync as rmSync6, readdirSync as readdirSync33, statSync as statSync46, mkdirSync as mkdirSync12 } from "node:fs";
30757
30810
  import { join as join55, dirname as dirname18, sep as sep3, posix as pathPosix, win32 as pathWin32 } from "node:path";
30758
30811
  import { tmpdir as tmpdir3, homedir as homedir18 } from "node:os";
30759
30812
  import { createHash as createHash11 } from "node:crypto";
@@ -30806,7 +30859,7 @@ function sweepStaleStaging(root = tmpdir3(), now = Date.now()) {
30806
30859
  if (!MKDTEMP_SUFFIX.test(name)) continue;
30807
30860
  const dir = join55(root, name);
30808
30861
  try {
30809
- const st = statSync45(dir);
30862
+ const st = statSync46(dir);
30810
30863
  if (!st.isDirectory() || now - st.mtimeMs < COLD_MS) continue;
30811
30864
  const inside = readdirSync33(dir);
30812
30865
  if (inside.length > 1 || inside.length === 1 && inside[0] !== "chat-recall.tgz") continue;
@@ -31092,7 +31145,7 @@ __export(sync_client_exports, {
31092
31145
  syncSessions: () => syncSessions
31093
31146
  });
31094
31147
  import { join as join56, dirname as dirname19, basename as basename24 } from "node:path";
31095
- import { readFileSync as readFileSync48, writeFileSync as writeFileSync12, mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync4, rmSync as rmSync7, chmodSync as chmodSync6, unlinkSync as unlinkSync3, readdirSync as readdirSync34, statSync as statSync46 } from "node:fs";
31148
+ import { readFileSync as readFileSync48, writeFileSync as writeFileSync12, mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync4, rmSync as rmSync7, chmodSync as chmodSync6, unlinkSync as unlinkSync3, readdirSync as readdirSync34, statSync as statSync47 } from "node:fs";
31096
31149
  import { tmpdir as tmpdir4, hostname as hostname2 } from "node:os";
31097
31150
  import { createHash as createHash12 } from "node:crypto";
31098
31151
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -31569,7 +31622,7 @@ function reapStaleScanDirs(dir = tmpdir4(), maxAgeMs = 6 * 36e5, now = Date.now(
31569
31622
  if (!name.startsWith("cr-batchscan-")) continue;
31570
31623
  const p = join56(dir, name);
31571
31624
  try {
31572
- if (now - statSync46(p).mtimeMs < maxAgeMs) continue;
31625
+ if (now - statSync47(p).mtimeMs < maxAgeMs) continue;
31573
31626
  rmSync7(p, { recursive: true, force: true });
31574
31627
  reaped++;
31575
31628
  } catch {
@@ -32096,7 +32149,7 @@ async function syncToTargetInScope(cred, opts = {}) {
32096
32149
  let walkPaused = false;
32097
32150
  let considered = 0;
32098
32151
  for (const ref of slice) {
32099
- await new Promise((resolve3) => setImmediate(resolve3));
32152
+ await yieldToEventLoop();
32100
32153
  considered++;
32101
32154
  const usedNow = usedMb();
32102
32155
  if (shouldPause(usedNow, memBudget, sessionsBuilt)) {
@@ -32449,6 +32502,7 @@ async function scanTranscriptFindingsChunked(ref, tenantRules) {
32449
32502
  let offset = 0;
32450
32503
  let lineBase = 0;
32451
32504
  for (; ; ) {
32505
+ await yieldToEventLoop();
32452
32506
  const chunk = await backend.readFromOffset(ref.prefixedId, offset, SYNC_CHUNK_BYTES);
32453
32507
  if (chunk.newOffset <= offset) break;
32454
32508
  offset = chunk.newOffset;
@@ -33008,6 +33062,7 @@ var init_sync_client = __esm({
33008
33062
  init_live_session_scan();
33009
33063
  init_session_file_scan();
33010
33064
  init_raw_archive_parts();
33065
+ init_yield_loop();
33011
33066
  init_backends();
33012
33067
  ownVersion = "0.0.0";
33013
33068
  try {
@@ -33584,7 +33639,7 @@ __export(install_skills_exports, {
33584
33639
  skillsSourceDir: () => skillsSourceDir,
33585
33640
  uninstallSkills: () => uninstallSkills
33586
33641
  });
33587
- import { readdirSync as readdirSync36, existsSync as existsSync49, mkdirSync as mkdirSync16, rmSync as rmSync9, cpSync, writeFileSync as writeFileSync16, readFileSync as readFileSync54, statSync as statSync48, realpathSync as realpathSync5 } from "fs";
33642
+ import { readdirSync as readdirSync36, existsSync as existsSync49, mkdirSync as mkdirSync16, rmSync as rmSync9, cpSync, writeFileSync as writeFileSync16, readFileSync as readFileSync54, statSync as statSync49, realpathSync as realpathSync5 } from "fs";
33588
33643
  import { createHash as createHash13 } from "crypto";
33589
33644
  import { join as join60, basename as basename25 } from "path";
33590
33645
  function skillsSourceDir() {
@@ -38116,7 +38171,7 @@ function inputSchemaOf(schema) {
38116
38171
  }
38117
38172
 
38118
38173
  // ../engine/dist/mcp/tools.js
38119
- import { existsSync as existsSync23, readFileSync as readFileSync25, statSync as statSync22 } from "fs";
38174
+ import { existsSync as existsSync23, readFileSync as readFileSync25, statSync as statSync23 } from "fs";
38120
38175
  import { join as join31 } from "path";
38121
38176
 
38122
38177
  // ../engine/dist/core/context.js
@@ -41125,7 +41180,7 @@ _Edits stayed local or window was off \u2014 try increasing buffer_minutes._` }]
41125
41180
  }
41126
41181
  case "recall_project_context": {
41127
41182
  const params = RecallProjectContextSchema.parse(args);
41128
- const target = existsSync23(params.project_path) && statSync22(params.project_path).isDirectory() ? resolveProjectId(params.project_path).id : params.project_path;
41183
+ const target = existsSync23(params.project_path) && statSync23(params.project_path).isDirectory() ? resolveProjectId(params.project_path).id : params.project_path;
41129
41184
  const dossier = await remoteGetQS(`/api/projects/${encodeURIComponent(target)}/dossier`, { sessions: params.limit, tasks: params.tasks, plans: params.plans });
41130
41185
  return { content: [{ type: "text", text: dossier.markdown }] };
41131
41186
  }
@@ -42993,7 +43048,7 @@ function channelDecision(env = process.env, args = process.argv.slice(2), ancest
42993
43048
  // src/channel-state.ts
42994
43049
  init_data_dir();
42995
43050
  import { execFileSync as execFileSync5 } from "node:child_process";
42996
- import { mkdirSync as mkdirSync14, readFileSync as readFileSync52, readdirSync as readdirSync35, statSync as statSync47, unlinkSync as unlinkSync4, writeFileSync as writeFileSync14 } from "node:fs";
43051
+ import { mkdirSync as mkdirSync14, readFileSync as readFileSync52, readdirSync as readdirSync35, statSync as statSync48, unlinkSync as unlinkSync4, writeFileSync as writeFileSync14 } from "node:fs";
42997
43052
  import { join as join58 } from "node:path";
42998
43053
  function channelStateDir() {
42999
43054
  return join58(getDataDir(), "hook-state", "messages");
@@ -43063,7 +43118,7 @@ function readMarker(sessionId) {
43063
43118
  const [pidText, started] = readFileSync52(path2, "utf-8").trim().split(" ");
43064
43119
  const pid = Number(pidText);
43065
43120
  if (!Number.isInteger(pid) || pid <= 1) return null;
43066
- return { pid, started, mtime: statSync47(path2).mtimeMs };
43121
+ return { pid, started, mtime: statSync48(path2).mtimeMs };
43067
43122
  } catch {
43068
43123
  return null;
43069
43124
  }