@threadbase-sh/streamer 1.27.2 → 1.27.3

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/cli.cjs CHANGED
@@ -100397,11 +100397,11 @@ var require_out = __commonJS({
100397
100397
  async.read(path2, getSettings(optionsOrSettingsOrCallback), callback);
100398
100398
  }
100399
100399
  exports2.stat = stat10;
100400
- function statSync9(path2, optionsOrSettings) {
100400
+ function statSync10(path2, optionsOrSettings) {
100401
100401
  const settings = getSettings(optionsOrSettings);
100402
100402
  return sync.read(path2, settings);
100403
100403
  }
100404
- exports2.statSync = statSync9;
100404
+ exports2.statSync = statSync10;
100405
100405
  function getSettings(settingsOrOptions = {}) {
100406
100406
  if (settingsOrOptions instanceof settings_1.default) {
100407
100407
  return settingsOrOptions;
@@ -128554,9 +128554,10 @@ var import_promises8 = require("timers/promises");
128554
128554
  var import_crypto2 = require("crypto");
128555
128555
  var import_fs11 = require("fs");
128556
128556
  var import_fs12 = require("fs");
128557
+ var import_fs13 = require("fs");
128557
128558
  var import_readline3 = require("readline");
128558
128559
  var import_better_sqlite3 = __toESM(require("better-sqlite3"), 1);
128559
- var import_fs13 = require("fs");
128560
+ var import_fs14 = require("fs");
128560
128561
  var import_path9 = require("path");
128561
128562
  var import_promises9 = require("fs/promises");
128562
128563
  var import_path10 = require("path");
@@ -131600,7 +131601,7 @@ async function parseMetaWithProvider(provider, filePath, account, tier) {
131600
131601
  const log8 = getLogger2();
131601
131602
  const acc = provider.createEmptyAccumulator();
131602
131603
  const rl = (0, import_readline3.createInterface)({
131603
- input: (0, import_fs12.createReadStream)(filePath),
131604
+ input: (0, import_fs13.createReadStream)(filePath),
131604
131605
  crlfDelay: Infinity
131605
131606
  });
131606
131607
  try {
@@ -131823,7 +131824,7 @@ function hasColumn(db, table, column) {
131823
131824
  }
131824
131825
  function openDatabase(dbPath) {
131825
131826
  if (dbPath !== ":memory:") {
131826
- (0, import_fs13.mkdirSync)((0, import_path9.dirname)(dbPath), { recursive: true });
131827
+ (0, import_fs14.mkdirSync)((0, import_path9.dirname)(dbPath), { recursive: true });
131827
131828
  }
131828
131829
  const db = new import_better_sqlite3.default(dbPath);
131829
131830
  db.pragma("journal_mode = WAL");
@@ -132623,7 +132624,13 @@ var PersistentEngine = class {
132623
132624
  await this.ensureCheckpoints(filePath, total);
132624
132625
  const beforeIndex = options.beforeIndex ?? total;
132625
132626
  const fromIndex = Math.max(0, beforeIndex - options.limit);
132626
- const floor = this.checkpoints.floor(filePath, fromIndex);
132627
+ let floor = this.checkpoints.floor(filePath, fromIndex);
132628
+ if (floor) {
132629
+ try {
132630
+ if (floor.byteOffset > (0, import_fs12.statSync)(filePath).size) floor = null;
132631
+ } catch {
132632
+ }
132633
+ }
132627
132634
  return readPage(filePath, total, options, floor);
132628
132635
  }
132629
132636
  // Build or extend the checkpoint chain so it covers `total` messages. Cold
@@ -133512,7 +133519,7 @@ async function search(query, options, scanner) {
133512
133519
 
133513
133520
  // src/server.ts
133514
133521
  var import_events3 = require("events");
133515
- var import_fs24 = require("fs");
133522
+ var import_fs25 = require("fs");
133516
133523
  var import_promises17 = require("fs/promises");
133517
133524
  var import_http = require("http");
133518
133525
  var import_os10 = require("os");
@@ -136658,11 +136665,11 @@ async function createDirectory(parentAbsolutePath, name) {
136658
136665
 
136659
136666
  // src/conversation-cache.ts
136660
136667
  var import_better_sqlite32 = __toESM(require("better-sqlite3"), 1);
136661
- var import_fs16 = require("fs");
136668
+ var import_fs17 = require("fs");
136662
136669
  var import_path13 = require("path");
136663
136670
 
136664
136671
  // src/db/sqlite-migrate.ts
136665
- var import_fs14 = require("fs");
136672
+ var import_fs15 = require("fs");
136666
136673
  var import_path12 = require("path");
136667
136674
  var import_url6 = require("url");
136668
136675
  var import_meta = {};
@@ -136681,7 +136688,7 @@ CREATE TABLE IF NOT EXISTS schema_migrations (
136681
136688
  function runSqliteMigrations(db, migrationsDir) {
136682
136689
  db.exec(SCHEMA_MIGRATIONS_SQL);
136683
136690
  const dir = migrationsDir ?? (0, import_path12.join)(getMigrationsDir(), "migrations");
136684
- const files = (0, import_fs14.readdirSync)(dir).filter((f2) => f2.endsWith(".sql")).sort();
136691
+ const files = (0, import_fs15.readdirSync)(dir).filter((f2) => f2.endsWith(".sql")).sort();
136685
136692
  const appliedRows = db.prepare("SELECT id FROM schema_migrations").all();
136686
136693
  const appliedSet = new Set(appliedRows.map((r) => r.id));
136687
136694
  const recordApplied = db.prepare("INSERT INTO schema_migrations (id, applied_at) VALUES (?, ?)");
@@ -136692,7 +136699,7 @@ function runSqliteMigrations(db, migrationsDir) {
136692
136699
  skipped.push(file2);
136693
136700
  continue;
136694
136701
  }
136695
- const sql = (0, import_fs14.readFileSync)((0, import_path12.join)(dir, file2), "utf-8");
136702
+ const sql = (0, import_fs15.readFileSync)((0, import_path12.join)(dir, file2), "utf-8");
136696
136703
  const tx = db.transaction(() => {
136697
136704
  db.exec(sql);
136698
136705
  recordApplied.run(file2, (/* @__PURE__ */ new Date()).toISOString());
@@ -136717,7 +136724,7 @@ function isProviderResumable(_provider, availabilityResumable) {
136717
136724
  }
136718
136725
 
136719
136726
  // src/services/conversations/isAgentConversation.ts
136720
- var import_fs15 = require("fs");
136727
+ var import_fs16 = require("fs");
136721
136728
  var DEFAULT_AGENT_ENTRYPOINTS = /* @__PURE__ */ new Set(["sdk-cli", "claude-vscode"]);
136722
136729
  var CHUNK_BYTES = 64 * 1024;
136723
136730
  var ENTRYPOINT_PROBE = `"entrypoint":`;
@@ -136739,12 +136746,12 @@ function isAgentFile(filePath, entrypoints = DEFAULT_AGENT_ENTRYPOINTS) {
136739
136746
  if (cached3 !== void 0) return cached3;
136740
136747
  let fd;
136741
136748
  try {
136742
- fd = (0, import_fs15.openSync)(filePath, "r");
136749
+ fd = (0, import_fs16.openSync)(filePath, "r");
136743
136750
  } catch {
136744
136751
  return false;
136745
136752
  }
136746
136753
  try {
136747
- const fileSize = (0, import_fs15.statSync)(filePath).size;
136754
+ const fileSize = (0, import_fs16.statSync)(filePath).size;
136748
136755
  if (fileSize === 0) {
136749
136756
  fileDecisionCache.set(key, false);
136750
136757
  return false;
@@ -136755,7 +136762,7 @@ function isAgentFile(filePath, entrypoints = DEFAULT_AGENT_ENTRYPOINTS) {
136755
136762
  let carry = "";
136756
136763
  while (offset < fileSize) {
136757
136764
  const toRead = Math.min(CHUNK_BYTES, fileSize - offset);
136758
- const got = (0, import_fs15.readSync)(fd, buf, 0, toRead, offset);
136765
+ const got = (0, import_fs16.readSync)(fd, buf, 0, toRead, offset);
136759
136766
  if (got <= 0) break;
136760
136767
  const chunk = carry + buf.toString("utf8", 0, got);
136761
136768
  for (const marker of markers) {
@@ -136776,7 +136783,7 @@ function isAgentFile(filePath, entrypoints = DEFAULT_AGENT_ENTRYPOINTS) {
136776
136783
  } catch {
136777
136784
  return false;
136778
136785
  } finally {
136779
- (0, import_fs15.closeSync)(fd);
136786
+ (0, import_fs16.closeSync)(fd);
136780
136787
  }
136781
136788
  }
136782
136789
  function parseAgentEntrypointsEnv(raw2) {
@@ -137030,14 +137037,14 @@ var ConversationCache = class _ConversationCache {
137030
137037
  isAgentFileCached(filePath) {
137031
137038
  let s3;
137032
137039
  try {
137033
- s3 = (0, import_fs16.statSync)(filePath);
137040
+ s3 = (0, import_fs17.statSync)(filePath);
137034
137041
  } catch {
137035
137042
  return false;
137036
137043
  }
137037
137044
  return this.classifyAgentFile(filePath, s3.mtimeMs, s3.size);
137038
137045
  }
137039
137046
  static open(dbPath, tailSize = 10, migrationsDir, options) {
137040
- (0, import_fs16.mkdirSync)((0, import_path13.dirname)(dbPath), { recursive: true });
137047
+ (0, import_fs17.mkdirSync)((0, import_path13.dirname)(dbPath), { recursive: true });
137041
137048
  const db = new import_better_sqlite32.default(dbPath);
137042
137049
  db.pragma("journal_mode = WAL");
137043
137050
  db.pragma("foreign_keys = ON");
@@ -137218,7 +137225,7 @@ var ConversationCache = class _ConversationCache {
137218
137225
  let mtimeMs = null;
137219
137226
  let fileSize = null;
137220
137227
  try {
137221
- const s3 = (0, import_fs16.statSync)(m2.filePath);
137228
+ const s3 = (0, import_fs17.statSync)(m2.filePath);
137222
137229
  mtimeMs = s3.mtimeMs;
137223
137230
  fileSize = s3.size;
137224
137231
  } catch {
@@ -137277,8 +137284,8 @@ var ConversationCache = class _ConversationCache {
137277
137284
  let fileSize;
137278
137285
  let fd;
137279
137286
  try {
137280
- fileSize = (0, import_fs16.statSync)(filePath).size;
137281
- fd = (0, import_fs16.openSync)(filePath, "r");
137287
+ fileSize = (0, import_fs17.statSync)(filePath).size;
137288
+ fd = (0, import_fs17.openSync)(filePath, "r");
137282
137289
  } catch {
137283
137290
  return false;
137284
137291
  }
@@ -137291,7 +137298,7 @@ var ConversationCache = class _ConversationCache {
137291
137298
  while (pos > 0 && lines.length < this.tailSize * 4) {
137292
137299
  const toRead = Math.min(CHUNK, pos);
137293
137300
  pos -= toRead;
137294
- (0, import_fs16.readSync)(fd, buf, 0, toRead, pos);
137301
+ (0, import_fs17.readSync)(fd, buf, 0, toRead, pos);
137295
137302
  const chunk = buf.subarray(0, toRead).toString("utf8");
137296
137303
  const combined = chunk + partial2;
137297
137304
  const parts = combined.split("\n");
@@ -137302,7 +137309,7 @@ var ConversationCache = class _ConversationCache {
137302
137309
  }
137303
137310
  if (partial2) lines.push(partial2);
137304
137311
  } finally {
137305
- (0, import_fs16.closeSync)(fd);
137312
+ (0, import_fs17.closeSync)(fd);
137306
137313
  }
137307
137314
  const msgs = [];
137308
137315
  for (let i = 0; i < lines.length && msgs.length < this.tailSize; i++) {
@@ -137504,7 +137511,7 @@ var ConversationCache = class _ConversationCache {
137504
137511
  * `handleGetConversation` can still serve the cached tail even when the
137505
137512
  * JSONL has been deleted.
137506
137513
  */
137507
- pruneGhostFiles(exists = import_fs16.existsSync) {
137514
+ pruneGhostFiles(exists = import_fs17.existsSync) {
137508
137515
  const rows = this.stmts.allFilePaths.all();
137509
137516
  const ghosts = [];
137510
137517
  const prune = this.db.transaction((ids) => {
@@ -137559,7 +137566,7 @@ var ConversationCache = class _ConversationCache {
137559
137566
  * Returns the removed IDs.
137560
137567
  */
137561
137568
  reconcileDeletions(livePaths, opts) {
137562
- const exists = opts?.exists ?? import_fs16.existsSync;
137569
+ const exists = opts?.exists ?? import_fs17.existsSync;
137563
137570
  const rows = this.stmts.allFilePaths.all();
137564
137571
  const removed = [];
137565
137572
  const drop = this.db.transaction((ids) => {
@@ -137617,7 +137624,7 @@ function getDbConfig() {
137617
137624
  }
137618
137625
 
137619
137626
  // src/db/migrations.ts
137620
- var import_fs17 = require("fs");
137627
+ var import_fs18 = require("fs");
137621
137628
  var import_path14 = require("path");
137622
137629
  var import_url7 = require("url");
137623
137630
  var import_meta2 = {};
@@ -137640,10 +137647,10 @@ async function runMigrations2(pool2, migrationsDir) {
137640
137647
  );
137641
137648
  const appliedSet = new Set(applied.map((r) => r.name));
137642
137649
  const dir = migrationsDir ?? (0, import_path14.join)(getMigrationsDir2(), "pg-migrations");
137643
- const files = (0, import_fs17.readdirSync)(dir).filter((f2) => f2.endsWith(".sql")).sort();
137650
+ const files = (0, import_fs18.readdirSync)(dir).filter((f2) => f2.endsWith(".sql")).sort();
137644
137651
  for (const file2 of files) {
137645
137652
  if (appliedSet.has(file2)) continue;
137646
- const sql = (0, import_fs17.readFileSync)((0, import_path14.join)(dir, file2), "utf-8");
137653
+ const sql = (0, import_fs18.readFileSync)((0, import_path14.join)(dir, file2), "utf-8");
137647
137654
  await pool2.query(sql);
137648
137655
  await pool2.query("INSERT INTO _migrations (name) VALUES ($1)", [file2]);
137649
137656
  }
@@ -137878,7 +137885,7 @@ async function recordUpload(pool2, instanceId, row) {
137878
137885
  }
137879
137886
 
137880
137887
  // src/handlers/handleListProjects.ts
137881
- var import_fs18 = require("fs");
137888
+ var import_fs19 = require("fs");
137882
137889
  var import_os7 = require("os");
137883
137890
  var import_path15 = require("path");
137884
137891
  function decodeProjectPath(dirName) {
@@ -137890,11 +137897,11 @@ function handleListProjects(url2, res) {
137890
137897
  const projectsDir = (0, import_path15.join)((0, import_os7.homedir)(), ".claude", "projects");
137891
137898
  let entries;
137892
137899
  try {
137893
- entries = (0, import_fs18.readdirSync)(projectsDir).map((dirName) => {
137900
+ entries = (0, import_fs19.readdirSync)(projectsDir).map((dirName) => {
137894
137901
  const fullPath = (0, import_path15.join)(projectsDir, dirName);
137895
137902
  let mtime = 0;
137896
137903
  try {
137897
- mtime = (0, import_fs18.statSync)(fullPath).mtimeMs;
137904
+ mtime = (0, import_fs19.statSync)(fullPath).mtimeMs;
137898
137905
  } catch {
137899
137906
  }
137900
137907
  const path2 = decodeProjectPath(dirName);
@@ -137918,13 +137925,13 @@ var import_path19 = require("path");
137918
137925
  // src/codex-pty-runner.ts
137919
137926
  var import_headless = __toESM(require_xterm_headless(), 1);
137920
137927
  var import_crypto6 = require("crypto");
137921
- var import_fs20 = require("fs");
137928
+ var import_fs21 = require("fs");
137922
137929
  var import_path17 = require("path");
137923
137930
  init_logger();
137924
137931
 
137925
137932
  // src/platform.ts
137926
137933
  var import_child_process = require("child_process");
137927
- var import_fs19 = require("fs");
137934
+ var import_fs20 = require("fs");
137928
137935
  var import_os8 = require("os");
137929
137936
  var import_path16 = require("path");
137930
137937
  var isWindows2 = (0, import_os8.platform)() === "win32";
@@ -137954,7 +137961,7 @@ function resolveClaudeExe() {
137954
137961
  )
137955
137962
  ];
137956
137963
  for (const p2 of candidates) {
137957
- if ((0, import_fs19.existsSync)(p2)) {
137964
+ if ((0, import_fs20.existsSync)(p2)) {
137958
137965
  _claudeExe = p2;
137959
137966
  return _claudeExe;
137960
137967
  }
@@ -137965,7 +137972,7 @@ function resolveClaudeExe() {
137965
137972
  encoding: "utf-8",
137966
137973
  timeout: 3e3
137967
137974
  }).trim().split("\n")[0].trim();
137968
- if (found && (0, import_fs19.existsSync)(found)) {
137975
+ if (found && (0, import_fs20.existsSync)(found)) {
137969
137976
  _claudeExe = found;
137970
137977
  return _claudeExe;
137971
137978
  }
@@ -137977,7 +137984,7 @@ function resolveClaudeExe() {
137977
137984
  (0, import_path16.join)((0, import_os8.homedir)(), ".local", "bin", "claude")
137978
137985
  ];
137979
137986
  for (const p2 of candidates) {
137980
- if ((0, import_fs19.existsSync)(p2)) {
137987
+ if ((0, import_fs20.existsSync)(p2)) {
137981
137988
  _claudeExe = p2;
137982
137989
  return _claudeExe;
137983
137990
  }
@@ -138012,7 +138019,7 @@ function resolveCodexExe() {
138012
138019
  )
138013
138020
  ];
138014
138021
  for (const p2 of candidates) {
138015
- if ((0, import_fs19.existsSync)(p2)) {
138022
+ if ((0, import_fs20.existsSync)(p2)) {
138016
138023
  _codexExe = p2;
138017
138024
  return _codexExe;
138018
138025
  }
@@ -138023,7 +138030,7 @@ function resolveCodexExe() {
138023
138030
  encoding: "utf-8",
138024
138031
  timeout: 3e3
138025
138032
  }).trim().split("\n")[0].trim();
138026
- if (found && (0, import_fs19.existsSync)(found)) {
138033
+ if (found && (0, import_fs20.existsSync)(found)) {
138027
138034
  _codexExe = found;
138028
138035
  return _codexExe;
138029
138036
  }
@@ -138035,7 +138042,7 @@ function resolveCodexExe() {
138035
138042
  (0, import_path16.join)((0, import_os8.homedir)(), ".local", "bin", "codex")
138036
138043
  ];
138037
138044
  for (const p2 of candidates) {
138038
- if ((0, import_fs19.existsSync)(p2)) {
138045
+ if ((0, import_fs20.existsSync)(p2)) {
138039
138046
  _codexExe = p2;
138040
138047
  return _codexExe;
138041
138048
  }
@@ -138465,7 +138472,7 @@ var CodexPtyRunner = class {
138465
138472
  session.status = "idle";
138466
138473
  const elapsedMs = session.completedAt.getTime() - session.startedAt.getTime();
138467
138474
  if (exitCode !== 0 && elapsedMs < 2e3 && session.lastOutput === "") {
138468
- if (!(0, import_fs20.existsSync)(session.projectPath)) {
138475
+ if (!(0, import_fs21.existsSync)(session.projectPath)) {
138469
138476
  session.failureReason = `Project directory not found: ${session.projectPath}`;
138470
138477
  } else {
138471
138478
  session.failureReason = `Codex process exited immediately (code ${exitCode}).`;
@@ -138502,7 +138509,7 @@ function stripAnsi(str) {
138502
138509
  // src/pty-manager.ts
138503
138510
  var import_headless2 = __toESM(require_xterm_headless(), 1);
138504
138511
  var import_crypto7 = require("crypto");
138505
- var import_fs21 = require("fs");
138512
+ var import_fs22 = require("fs");
138506
138513
  var import_path18 = require("path");
138507
138514
  init_logger();
138508
138515
 
@@ -139350,7 +139357,7 @@ var PTYManager = class {
139350
139357
  session.status = "idle";
139351
139358
  const elapsedMs = session.completedAt.getTime() - session.startedAt.getTime();
139352
139359
  if (exitCode !== 0 && elapsedMs < 2e3 && session.lastOutput === "") {
139353
- if (!(0, import_fs21.existsSync)(session.projectPath)) {
139360
+ if (!(0, import_fs22.existsSync)(session.projectPath)) {
139354
139361
  session.failureReason = `Project directory not found: ${session.projectPath}`;
139355
139362
  } else {
139356
139363
  session.failureReason = `Process exited immediately (code ${exitCode}). Check that the Claude binary is installed and accessible.`;
@@ -141439,7 +141446,7 @@ function watch2(paths, options = {}) {
141439
141446
  var chokidar_default = { watch: watch2, FSWatcher: FSWatcher2 };
141440
141447
 
141441
141448
  // src/services/conversations/conversationWatcher.ts
141442
- var import_fs22 = require("fs");
141449
+ var import_fs23 = require("fs");
141443
141450
  var import_promises15 = require("fs/promises");
141444
141451
  var ConversationWatcher = class {
141445
141452
  files = /* @__PURE__ */ new Map();
@@ -141460,7 +141467,7 @@ var ConversationWatcher = class {
141460
141467
  if (this.files.has(filePath)) return;
141461
141468
  let offset;
141462
141469
  try {
141463
- offset = (0, import_fs22.statSync)(filePath).size;
141470
+ offset = (0, import_fs23.statSync)(filePath).size;
141464
141471
  } catch {
141465
141472
  offset = 0;
141466
141473
  }
@@ -141631,14 +141638,14 @@ function findSearchTarget(messages, query) {
141631
141638
  }
141632
141639
 
141633
141640
  // src/services/conversations/pruneAgentConversations.ts
141634
- var import_fs23 = require("fs");
141641
+ var import_fs24 = require("fs");
141635
141642
  function pruneAgentConversations(cache) {
141636
141643
  const db = cache.getDatabase();
141637
141644
  const rows = db.prepare("SELECT id, file_path FROM conversation_meta").all();
141638
141645
  let pruned = 0;
141639
141646
  let missing = 0;
141640
141647
  for (const row of rows) {
141641
- if (!(0, import_fs23.existsSync)(row.file_path)) {
141648
+ if (!(0, import_fs24.existsSync)(row.file_path)) {
141642
141649
  missing += 1;
141643
141650
  continue;
141644
141651
  }
@@ -142420,6 +142427,7 @@ var WSHub = class {
142420
142427
  var BROWSE_SYSTEM_PROMPT = (browseRoot) => `You are working within the project boundary: ${browseRoot}. Do not read, write, or execute commands that access files or directories outside this boundary.`;
142421
142428
  var DEFAULT_SYSTEM_PROMPT = "When presenting options or choices to the user, limit the options to at most 3.";
142422
142429
  var DEFAULT_PTY_GRACE_PERIOD_MS = 27e4;
142430
+ var REFRESH_TTL_MS = 2e3;
142423
142431
  var START_READY_TIMEOUT_MS = 15e3;
142424
142432
  function parseIncludeAgentsEnv(raw2) {
142425
142433
  if (raw2 === void 0) return false;
@@ -142459,6 +142467,12 @@ var StreamerServer = class {
142459
142467
  // Set by onConversationChanged while a scan is in-flight; getScanner() does
142460
142468
  // a single rescan after the current one completes instead of restarting it.
142461
142469
  scannerStale = false;
142470
+ // Single-flight + TTL guard around scanner.refreshFile (see refreshFileGuarded).
142471
+ // A live file's mtime is always newer than the snapshot, so an unguarded
142472
+ // refresh fires on every request and re-parses the whole file from byte 0.
142473
+ // Keyed by filePath; entries drop on settle + TTL expiry, so the map stays
142474
+ // bounded by the active-file set.
142475
+ refreshInFlight = /* @__PURE__ */ new Map();
142462
142476
  // True only while bindWithRetry is actively retrying. The persistent
142463
142477
  // listener-level 'error' handler demotes EADDRINUSE to debug during this
142464
142478
  // window so the self-healing kickstart-relaunch race doesn't spam warn.
@@ -142657,7 +142671,7 @@ var StreamerServer = class {
142657
142671
  if (session.status === "waiting_input" || session.status === "idle") {
142658
142672
  const filePath = this.sessionFileMap.get(session.id);
142659
142673
  if (filePath) {
142660
- this.getScanner().then((scanner) => scanner.refreshFile(filePath)).then((meta3) => {
142674
+ this.getScanner().then((scanner) => this.refreshFileGuarded(scanner, filePath)).then((meta3) => {
142661
142675
  this.log.info("scanner.refreshFile: ok", {
142662
142676
  event: "scanner.refresh",
142663
142677
  sessionId: session.id,
@@ -143106,6 +143120,34 @@ var StreamerServer = class {
143106
143120
  this.inFlightCacheWrites.delete(guarded);
143107
143121
  });
143108
143122
  }
143123
+ // Single-flight + TTL wrapper for scanner.refreshFile. Both call sites (the
143124
+ // detail-stale branch and the per-turn refresh) route through here so that
143125
+ // N stacked retries on a live, actively-appended file cost one parse, not N:
143126
+ // - a refresh already in flight for the path → await the same promise;
143127
+ // - a refresh that settled within REFRESH_TTL_MS → skip, return null (the
143128
+ // caller keeps serving the current snapshot);
143129
+ // - otherwise start one, cache the promise, and stamp completedAt on settle.
143130
+ // The map is bounded by the active-file set (entries only live while a
143131
+ // refresh is in flight or within its TTL and are overwritten on the next
143132
+ // refresh of the same path).
143133
+ refreshFileGuarded(scanner, filePath) {
143134
+ const existing = this.refreshInFlight.get(filePath);
143135
+ if (existing) {
143136
+ const settled = existing.completedAt > 0;
143137
+ if (!settled) {
143138
+ return existing.promise;
143139
+ }
143140
+ if (Date.now() - existing.completedAt < REFRESH_TTL_MS) {
143141
+ return Promise.resolve(null);
143142
+ }
143143
+ }
143144
+ const entry = { promise: Promise.resolve(null), completedAt: 0 };
143145
+ entry.promise = scanner.refreshFile(filePath).finally(() => {
143146
+ entry.completedAt = Date.now();
143147
+ });
143148
+ this.refreshInFlight.set(filePath, entry);
143149
+ return entry.promise;
143150
+ }
143109
143151
  async close() {
143110
143152
  for (const timer of this.ptyGraceTimers.values()) clearTimeout(timer);
143111
143153
  this.ptyGraceTimers.clear();
@@ -143516,16 +143558,16 @@ var StreamerServer = class {
143516
143558
  }
143517
143559
  findJsonlPath(uuid3) {
143518
143560
  const projectsDir = (0, import_path22.join)((0, import_os10.homedir)(), ".claude", "projects");
143519
- if (!(0, import_fs24.existsSync)(projectsDir)) return null;
143561
+ if (!(0, import_fs25.existsSync)(projectsDir)) return null;
143520
143562
  const filename = `${uuid3}.jsonl`;
143521
- for (const dir of (0, import_fs24.readdirSync)(projectsDir)) {
143563
+ for (const dir of (0, import_fs25.readdirSync)(projectsDir)) {
143522
143564
  const fp = (0, import_path22.join)(projectsDir, dir, filename);
143523
- if ((0, import_fs24.existsSync)(fp)) return fp;
143565
+ if ((0, import_fs25.existsSync)(fp)) return fp;
143524
143566
  const projectDir = (0, import_path22.join)(projectsDir, dir);
143525
143567
  try {
143526
- for (const sub of (0, import_fs24.readdirSync)(projectDir)) {
143568
+ for (const sub of (0, import_fs25.readdirSync)(projectDir)) {
143527
143569
  const subagentPath = (0, import_path22.join)(projectDir, sub, "subagents", filename);
143528
- if ((0, import_fs24.existsSync)(subagentPath)) return subagentPath;
143570
+ if ((0, import_fs25.existsSync)(subagentPath)) return subagentPath;
143529
143571
  }
143530
143572
  } catch {
143531
143573
  }
@@ -143534,7 +143576,7 @@ var StreamerServer = class {
143534
143576
  }
143535
143577
  async readCwdFromJsonl(filePath) {
143536
143578
  return new Promise((resolve6) => {
143537
- const rl = (0, import_readline4.createInterface)({ input: (0, import_fs24.createReadStream)(filePath), crlfDelay: Infinity });
143579
+ const rl = (0, import_readline4.createInterface)({ input: (0, import_fs25.createReadStream)(filePath), crlfDelay: Infinity });
143538
143580
  let found = false;
143539
143581
  rl.on("line", (line) => {
143540
143582
  if (found) return;
@@ -143570,10 +143612,22 @@ var StreamerServer = class {
143570
143612
  const scanner = await this.getScanner(true);
143571
143613
  const fromIndex = await scanner.getConversation(uuid3);
143572
143614
  if (fromIndex) {
143615
+ if (this.ptyManager.hasSession(uuid3)) {
143616
+ return fromIndex;
143617
+ }
143573
143618
  if (fromIndex.filePath && this.isConversationSnapshotStale(fromIndex)) {
143574
- const refreshedMeta = await scanner.refreshFile(fromIndex.filePath);
143575
- if (!refreshedMeta) return null;
143576
- return await scanner.getConversation(uuid3) ?? fromIndex;
143619
+ const filePath2 = fromIndex.filePath;
143620
+ this.trackCacheWrite(
143621
+ this.refreshFileGuarded(scanner, filePath2).catch((err) => {
143622
+ this.log.warn("scanner.refreshFile: failed", {
143623
+ event: "scanner.refresh_failed",
143624
+ conversationId: uuid3,
143625
+ filePath: filePath2,
143626
+ trigger: "detail-swr",
143627
+ err
143628
+ });
143629
+ })
143630
+ );
143577
143631
  }
143578
143632
  return fromIndex;
143579
143633
  }
@@ -143591,7 +143645,7 @@ var StreamerServer = class {
143591
143645
  if (!conv.filePath) return false;
143592
143646
  let mtimeMs = null;
143593
143647
  try {
143594
- mtimeMs = (0, import_fs24.statSync)(conv.filePath).mtimeMs;
143648
+ mtimeMs = (0, import_fs25.statSync)(conv.filePath).mtimeMs;
143595
143649
  } catch {
143596
143650
  return false;
143597
143651
  }
@@ -143921,7 +143975,7 @@ var StreamerServer = class {
143921
143975
  handleGetSession(sessionId, res) {
143922
143976
  const session = this.sessionStore.get(sessionId, this.ptyAttachedIds());
143923
143977
  if (session) {
143924
- if (!(0, import_fs24.existsSync)(session.projectPath)) {
143978
+ if (!(0, import_fs25.existsSync)(session.projectPath)) {
143925
143979
  session.failureReason = `Project directory not found: ${session.projectPath}`;
143926
143980
  }
143927
143981
  json2(res, 200, session);
@@ -144478,11 +144532,11 @@ var StreamerServer = class {
144478
144532
  cleanup();
144479
144533
  return;
144480
144534
  }
144481
- let resolvedFilePath = (0, import_fs24.existsSync)(filePath) ? filePath : null;
144482
- if (!resolvedFilePath && (0, import_fs24.existsSync)(projectsDir)) {
144535
+ let resolvedFilePath = (0, import_fs25.existsSync)(filePath) ? filePath : null;
144536
+ if (!resolvedFilePath && (0, import_fs25.existsSync)(projectsDir)) {
144483
144537
  try {
144484
144538
  const now = Date.now();
144485
- const recent = (0, import_fs24.readdirSync)(projectsDir).filter((f2) => f2.endsWith(".jsonl")).map((f2) => ({ f: f2, mtime: (0, import_fs24.statSync)((0, import_path22.join)(projectsDir, f2)).mtimeMs })).filter(({ mtime }) => now - mtime < 5e3).sort((a, b2) => b2.mtime - a.mtime)[0];
144539
+ const recent = (0, import_fs25.readdirSync)(projectsDir).filter((f2) => f2.endsWith(".jsonl")).map((f2) => ({ f: f2, mtime: (0, import_fs25.statSync)((0, import_path22.join)(projectsDir, f2)).mtimeMs })).filter(({ mtime }) => now - mtime < 5e3).sort((a, b2) => b2.mtime - a.mtime)[0];
144486
144540
  if (recent) resolvedFilePath = (0, import_path22.join)(projectsDir, recent.f);
144487
144541
  } catch {
144488
144542
  }
@@ -144492,7 +144546,7 @@ var StreamerServer = class {
144492
144546
  this.sessionFileMap.set(sessionId, resolvedFilePath);
144493
144547
  this.fileWatcher.watch(resolvedFilePath);
144494
144548
  try {
144495
- const existing = (0, import_fs24.readFileSync)(resolvedFilePath, "utf8").split("\n").filter(Boolean);
144549
+ const existing = (0, import_fs25.readFileSync)(resolvedFilePath, "utf8").split("\n").filter(Boolean);
144496
144550
  if (existing.length > 0) {
144497
144551
  this.wsHub.broadcast({ type: "conversation_events", sessionId, lines: existing });
144498
144552
  for (const line of existing) {
@@ -144518,7 +144572,7 @@ var StreamerServer = class {
144518
144572
  if (this.sessionFileMap.has(sessionId)) return;
144519
144573
  try {
144520
144574
  require("fs").mkdirSync(projectsDir, { recursive: true });
144521
- watcher = (0, import_fs24.watch)(projectsDir, tryWire);
144575
+ watcher = (0, import_fs25.watch)(projectsDir, tryWire);
144522
144576
  watcher.on("error", cleanup);
144523
144577
  } catch {
144524
144578
  }
@@ -144547,7 +144601,7 @@ var StreamerServer = class {
144547
144601
  };
144548
144602
  const matchesProjectPath = (candidatePath) => {
144549
144603
  try {
144550
- const firstLine = (0, import_fs24.readFileSync)(candidatePath, "utf8").split("\n", 1)[0];
144604
+ const firstLine = (0, import_fs25.readFileSync)(candidatePath, "utf8").split("\n", 1)[0];
144551
144605
  if (!firstLine) return null;
144552
144606
  const parsed = JSON.parse(firstLine);
144553
144607
  if (parsed?.type !== "session_meta") return null;
@@ -144576,15 +144630,15 @@ var StreamerServer = class {
144576
144630
  );
144577
144631
  for (const root of this.codexRoots) {
144578
144632
  const sessionsDir = (0, import_path22.join)(root, dateDir);
144579
- if (!(0, import_fs24.existsSync)(sessionsDir)) continue;
144633
+ if (!(0, import_fs25.existsSync)(sessionsDir)) continue;
144580
144634
  let candidateFiles;
144581
144635
  try {
144582
- candidateFiles = (0, import_fs24.readdirSync)(sessionsDir).filter((f2) => f2.endsWith(".jsonl"));
144636
+ candidateFiles = (0, import_fs25.readdirSync)(sessionsDir).filter((f2) => f2.endsWith(".jsonl"));
144583
144637
  } catch {
144584
144638
  continue;
144585
144639
  }
144586
144640
  const nowMs = Date.now();
144587
- const recentCandidates = candidateFiles.map((f2) => ({ f: f2, mtime: (0, import_fs24.statSync)((0, import_path22.join)(sessionsDir, f2)).mtimeMs })).filter(({ mtime }) => nowMs - mtime < 1e4).sort((a, b2) => b2.mtime - a.mtime);
144641
+ const recentCandidates = candidateFiles.map((f2) => ({ f: f2, mtime: (0, import_fs25.statSync)((0, import_path22.join)(sessionsDir, f2)).mtimeMs })).filter(({ mtime }) => nowMs - mtime < 1e4).sort((a, b2) => b2.mtime - a.mtime);
144588
144642
  for (const { f: f2 } of recentCandidates) {
144589
144643
  const candidatePath = (0, import_path22.join)(sessionsDir, f2);
144590
144644
  const match2 = matchesProjectPath(candidatePath);
@@ -144596,7 +144650,7 @@ var StreamerServer = class {
144596
144650
  this.sessionFileMap.set(sessionId, candidatePath);
144597
144651
  this.fileWatcher.watch(candidatePath);
144598
144652
  try {
144599
- const existing = (0, import_fs24.readFileSync)(candidatePath, "utf8").split("\n").filter(Boolean);
144653
+ const existing = (0, import_fs25.readFileSync)(candidatePath, "utf8").split("\n").filter(Boolean);
144600
144654
  if (existing.length > 0) {
144601
144655
  this.wsHub.broadcast({ type: "conversation_events", sessionId, lines: existing });
144602
144656
  for (const line of existing) {
@@ -144721,7 +144775,7 @@ var StreamerServer = class {
144721
144775
  };
144722
144776
  function classifyResumability(cwd) {
144723
144777
  if (!cwd) return { resumable: true };
144724
- if ((0, import_fs24.existsSync)(cwd)) return { resumable: true };
144778
+ if ((0, import_fs25.existsSync)(cwd)) return { resumable: true };
144725
144779
  const ranInWorktree = /\/\.worktrees\//.test(cwd) || /\/\.claude\/worktrees\//.test(cwd);
144726
144780
  return {
144727
144781
  resumable: false,
@@ -145301,7 +145355,7 @@ var import_node_fs17 = require("fs");
145301
145355
 
145302
145356
  // node_modules/tar/dist/esm/index.min.js
145303
145357
  var import_events4 = __toESM(require("events"), 1);
145304
- var import_fs25 = __toESM(require("fs"), 1);
145358
+ var import_fs26 = __toESM(require("fs"), 1);
145305
145359
  var import_node_events3 = require("events");
145306
145360
  var import_node_stream3 = __toESM(require("stream"), 1);
145307
145361
  var import_node_string_decoder = require("string_decoder");
@@ -145315,8 +145369,8 @@ var Ps = __toESM(require("zlib"), 1);
145315
145369
  var import_zlib = __toESM(require("zlib"), 1);
145316
145370
  var import_node_path15 = require("path");
145317
145371
  var import_node_path16 = require("path");
145318
- var import_fs26 = __toESM(require("fs"), 1);
145319
145372
  var import_fs27 = __toESM(require("fs"), 1);
145373
+ var import_fs28 = __toESM(require("fs"), 1);
145320
145374
  var import_path24 = __toESM(require("path"), 1);
145321
145375
  var import_node_path17 = require("path");
145322
145376
  var import_path25 = __toESM(require("path"), 1);
@@ -145325,7 +145379,7 @@ var import_node_assert = __toESM(require("assert"), 1);
145325
145379
  var import_node_crypto5 = require("crypto");
145326
145380
  var import_node_fs13 = __toESM(require("fs"), 1);
145327
145381
  var import_node_path18 = __toESM(require("path"), 1);
145328
- var import_fs28 = __toESM(require("fs"), 1);
145382
+ var import_fs29 = __toESM(require("fs"), 1);
145329
145383
  var import_node_fs14 = __toESM(require("fs"), 1);
145330
145384
  var import_node_path19 = __toESM(require("path"), 1);
145331
145385
  var import_node_fs15 = __toESM(require("fs"), 1);
@@ -145677,7 +145731,7 @@ var A = class extends import_node_events3.EventEmitter {
145677
145731
  return Wr;
145678
145732
  }
145679
145733
  };
145680
- var Jr = import_fs25.default.writev;
145734
+ var Jr = import_fs26.default.writev;
145681
145735
  var ht = /* @__PURE__ */ Symbol("_autoClose");
145682
145736
  var H = /* @__PURE__ */ Symbol("_close");
145683
145737
  var te = /* @__PURE__ */ Symbol("_ended");
@@ -145732,7 +145786,7 @@ var _t = class extends A {
145732
145786
  throw new TypeError("this is a readable stream");
145733
145787
  }
145734
145788
  [at]() {
145735
- import_fs25.default.open(this[U2], "r", (t2, e) => this[Ht](t2, e));
145789
+ import_fs26.default.open(this[U2], "r", (t2, e) => this[Ht](t2, e));
145736
145790
  }
145737
145791
  [Ht](t2, e) {
145738
145792
  t2 ? this[Ut](t2) : (this[u2] = e, this.emit("open", e), this[zt]());
@@ -145745,7 +145799,7 @@ var _t = class extends A {
145745
145799
  this[j] = true;
145746
145800
  let t2 = this[vi]();
145747
145801
  if (t2.length === 0) return process.nextTick(() => this[Ii](null, 0, t2));
145748
- import_fs25.default.read(this[u2], t2, 0, t2.length, null, (e, i, r) => this[Ii](e, i, r));
145802
+ import_fs26.default.read(this[u2], t2, 0, t2.length, null, (e, i, r) => this[Ii](e, i, r));
145749
145803
  }
145750
145804
  }
145751
145805
  [Ii](t2, e, i) {
@@ -145754,7 +145808,7 @@ var _t = class extends A {
145754
145808
  [H]() {
145755
145809
  if (this[ht] && typeof this[u2] == "number") {
145756
145810
  let t2 = this[u2];
145757
- this[u2] = void 0, import_fs25.default.close(t2, (e) => e ? this.emit("error", e) : this.emit("close"));
145811
+ this[u2] = void 0, import_fs26.default.close(t2, (e) => e ? this.emit("error", e) : this.emit("close"));
145758
145812
  }
145759
145813
  }
145760
145814
  [Ut](t2) {
@@ -145782,7 +145836,7 @@ var Be = class extends _t {
145782
145836
  [at]() {
145783
145837
  let t2 = true;
145784
145838
  try {
145785
- this[Ht](null, import_fs25.default.openSync(this[U2], "r")), t2 = false;
145839
+ this[Ht](null, import_fs26.default.openSync(this[U2], "r")), t2 = false;
145786
145840
  } finally {
145787
145841
  t2 && this[H]();
145788
145842
  }
@@ -145793,7 +145847,7 @@ var Be = class extends _t {
145793
145847
  if (!this[j]) {
145794
145848
  this[j] = true;
145795
145849
  do {
145796
- let e = this[vi](), i = e.length === 0 ? 0 : import_fs25.default.readSync(this[u2], e, 0, e.length, null);
145850
+ let e = this[vi](), i = e.length === 0 ? 0 : import_fs26.default.readSync(this[u2], e, 0, e.length, null);
145797
145851
  if (!this[ki](i, e)) break;
145798
145852
  } while (true);
145799
145853
  this[j] = false;
@@ -145806,7 +145860,7 @@ var Be = class extends _t {
145806
145860
  [H]() {
145807
145861
  if (this[ht] && typeof this[u2] == "number") {
145808
145862
  let t2 = this[u2];
145809
- this[u2] = void 0, import_fs25.default.closeSync(t2), this.emit("close");
145863
+ this[u2] = void 0, import_fs26.default.closeSync(t2), this.emit("close");
145810
145864
  }
145811
145865
  }
145812
145866
  };
@@ -145848,7 +145902,7 @@ var et = class extends import_events4.default {
145848
145902
  this[H](), this[gt] = true, this.emit("error", t2);
145849
145903
  }
145850
145904
  [at]() {
145851
- import_fs25.default.open(this[U2], this[tt], this[ie], (t2, e) => this[Ht](t2, e));
145905
+ import_fs26.default.open(this[U2], this[tt], this[ie], (t2, e) => this[Ht](t2, e));
145852
145906
  }
145853
145907
  [Ht](t2, e) {
145854
145908
  this[Me] && this[tt] === "r+" && t2 && t2.code === "ENOENT" ? (this[tt] = "w", this[at]()) : t2 ? this[Ut](t2) : (this[u2] = e, this.emit("open", e), this[gt] || this[Ai]());
@@ -145860,7 +145914,7 @@ var et = class extends import_events4.default {
145860
145914
  return typeof t2 == "string" && (t2 = Buffer.from(t2, e)), this[te] ? (this.emit("error", new Error("write() after end()")), false) : this[u2] === void 0 || this[gt] || this[Y2].length ? (this[Y2].push(t2), this[ke] = true, false) : (this[gt] = true, this[ve](t2), true);
145861
145915
  }
145862
145916
  [ve](t2) {
145863
- import_fs25.default.write(this[u2], t2, 0, t2.length, this[ot], (e, i) => this[Pt](e, i));
145917
+ import_fs26.default.write(this[u2], t2, 0, t2.length, this[ot], (e, i) => this[Pt](e, i));
145864
145918
  }
145865
145919
  [Pt](t2, e) {
145866
145920
  t2 ? this[Ut](t2) : (this[ot] !== void 0 && typeof e == "number" && (this[ot] += e), this[Y2].length ? this[Ai]() : (this[gt] = false, this[te] && !this[Ni] ? (this[Ni] = true, this[H](), this.emit("finish")) : this[ke] && (this[ke] = false, this.emit("drain"))));
@@ -145876,7 +145930,7 @@ var et = class extends import_events4.default {
145876
145930
  [H]() {
145877
145931
  if (this[ht] && typeof this[u2] == "number") {
145878
145932
  let t2 = this[u2];
145879
- this[u2] = void 0, import_fs25.default.close(t2, (e) => e ? this.emit("error", e) : this.emit("close"));
145933
+ this[u2] = void 0, import_fs26.default.close(t2, (e) => e ? this.emit("error", e) : this.emit("close"));
145880
145934
  }
145881
145935
  }
145882
145936
  };
@@ -145884,24 +145938,24 @@ var Wt = class extends et {
145884
145938
  [at]() {
145885
145939
  let t2;
145886
145940
  if (this[Me] && this[tt] === "r+") try {
145887
- t2 = import_fs25.default.openSync(this[U2], this[tt], this[ie]);
145941
+ t2 = import_fs26.default.openSync(this[U2], this[tt], this[ie]);
145888
145942
  } catch (e) {
145889
145943
  if (e?.code === "ENOENT") return this[tt] = "w", this[at]();
145890
145944
  throw e;
145891
145945
  }
145892
- else t2 = import_fs25.default.openSync(this[U2], this[tt], this[ie]);
145946
+ else t2 = import_fs26.default.openSync(this[U2], this[tt], this[ie]);
145893
145947
  this[Ht](null, t2);
145894
145948
  }
145895
145949
  [H]() {
145896
145950
  if (this[ht] && typeof this[u2] == "number") {
145897
145951
  let t2 = this[u2];
145898
- this[u2] = void 0, import_fs25.default.closeSync(t2), this.emit("close");
145952
+ this[u2] = void 0, import_fs26.default.closeSync(t2), this.emit("close");
145899
145953
  }
145900
145954
  }
145901
145955
  [ve](t2) {
145902
145956
  let e = true;
145903
145957
  try {
145904
- this[Pt](null, import_fs25.default.writeSync(this[u2], t2, 0, t2.length, this[ot])), e = false;
145958
+ this[Pt](null, import_fs26.default.writeSync(this[u2], t2, 0, t2.length, this[ot])), e = false;
145905
145959
  } finally {
145906
145960
  if (e) try {
145907
145961
  this[H]();
@@ -146819,7 +146873,7 @@ var de = class extends A {
146819
146873
  return t2 === "error" && (this.#t = true), super.emit(t2, ...e);
146820
146874
  }
146821
146875
  [ss]() {
146822
- import_fs27.default.lstat(this.absolute, (t2, e) => {
146876
+ import_fs28.default.lstat(this.absolute, (t2, e) => {
146823
146877
  if (t2) return this.emit("error", t2);
146824
146878
  this[si](e);
146825
146879
  });
@@ -146857,7 +146911,7 @@ var de = class extends A {
146857
146911
  this.path.slice(-1) !== "/" && (this.path += "/"), this.stat.size = 0, this[fe](), this.end();
146858
146912
  }
146859
146913
  [is]() {
146860
- import_fs27.default.readlink(this.absolute, (t2, e) => {
146914
+ import_fs28.default.readlink(this.absolute, (t2, e) => {
146861
146915
  if (t2) return this.emit("error", t2);
146862
146916
  this[ns](e);
146863
146917
  });
@@ -146880,7 +146934,7 @@ var de = class extends A {
146880
146934
  this[os]();
146881
146935
  }
146882
146936
  [os]() {
146883
- import_fs27.default.open(this.absolute, "r", (t2, e) => {
146937
+ import_fs28.default.open(this.absolute, "r", (t2, e) => {
146884
146938
  if (t2) return this.emit("error", t2);
146885
146939
  this[hs](e);
146886
146940
  });
@@ -146895,14 +146949,14 @@ var de = class extends A {
146895
146949
  [ii]() {
146896
146950
  let { fd: t2, buf: e, offset: i, length: r, pos: n } = this;
146897
146951
  if (t2 === void 0 || e === void 0) throw new Error("cannot read file without first opening");
146898
- import_fs27.default.read(t2, e, i, r, n, (o, h) => {
146952
+ import_fs28.default.read(t2, e, i, r, n, (o, h) => {
146899
146953
  if (o) return this[pt](() => this.emit("error", o));
146900
146954
  this[rs](h);
146901
146955
  });
146902
146956
  }
146903
146957
  [pt](t2 = () => {
146904
146958
  }) {
146905
- this.fd !== void 0 && import_fs27.default.close(this.fd, t2);
146959
+ this.fd !== void 0 && import_fs28.default.close(this.fd, t2);
146906
146960
  }
146907
146961
  [rs](t2) {
146908
146962
  if (t2 <= 0 && this.remain > 0) {
@@ -146937,20 +146991,20 @@ var de = class extends A {
146937
146991
  var ni = class extends de {
146938
146992
  sync = true;
146939
146993
  [ss]() {
146940
- this[si](import_fs27.default.lstatSync(this.absolute));
146994
+ this[si](import_fs28.default.lstatSync(this.absolute));
146941
146995
  }
146942
146996
  [is]() {
146943
- this[ns](import_fs27.default.readlinkSync(this.absolute));
146997
+ this[ns](import_fs28.default.readlinkSync(this.absolute));
146944
146998
  }
146945
146999
  [os]() {
146946
- this[hs](import_fs27.default.openSync(this.absolute, "r"));
147000
+ this[hs](import_fs28.default.openSync(this.absolute, "r"));
146947
147001
  }
146948
147002
  [ii]() {
146949
147003
  let t2 = true;
146950
147004
  try {
146951
147005
  let { fd: e, buf: i, offset: r, length: n, pos: o } = this;
146952
147006
  if (e === void 0 || i === void 0) throw new Error("fd and buf must be set in READ method");
146953
- let h = import_fs27.default.readSync(e, i, r, n, o);
147007
+ let h = import_fs28.default.readSync(e, i, r, n, o);
146954
147008
  this[rs](h), t2 = false;
146955
147009
  } finally {
146956
147010
  if (t2) try {
@@ -146965,7 +147019,7 @@ var ni = class extends de {
146965
147019
  }
146966
147020
  [pt](t2 = () => {
146967
147021
  }) {
146968
- this.fd !== void 0 && import_fs27.default.closeSync(this.fd), t2();
147022
+ this.fd !== void 0 && import_fs28.default.closeSync(this.fd), t2();
146969
147023
  }
146970
147024
  };
146971
147025
  var oi = class extends A {
@@ -147296,7 +147350,7 @@ var wt = class extends A {
147296
147350
  [ds](t2) {
147297
147351
  t2.pending = true, this[G2] += 1;
147298
147352
  let e = this.follow ? "stat" : "lstat";
147299
- import_fs26.default[e](t2.absolute, (i, r) => {
147353
+ import_fs27.default[e](t2.absolute, (i, r) => {
147300
147354
  t2.pending = false, this[G2] -= 1, i ? this.emit("error", i) : this[li](t2, r);
147301
147355
  });
147302
147356
  }
@@ -147310,7 +147364,7 @@ var wt = class extends A {
147310
147364
  this[Ft]();
147311
147365
  }
147312
147366
  [ms](t2) {
147313
- t2.pending = true, this[G2] += 1, import_fs26.default.readdir(t2.absolute, (e, i) => {
147367
+ t2.pending = true, this[G2] += 1, import_fs27.default.readdir(t2.absolute, (e, i) => {
147314
147368
  if (t2.pending = false, this[G2] -= 1, e) return this.emit("error", e);
147315
147369
  this[fi](t2, i);
147316
147370
  });
@@ -147411,10 +147465,10 @@ var kt = class extends wt {
147411
147465
  }
147412
147466
  [ds](t2) {
147413
147467
  let e = this.follow ? "statSync" : "lstatSync";
147414
- this[li](t2, import_fs26.default[e](t2.absolute));
147468
+ this[li](t2, import_fs27.default[e](t2.absolute));
147415
147469
  }
147416
147470
  [ms](t2) {
147417
- this[fi](t2, import_fs26.default.readdirSync(t2.absolute));
147471
+ this[fi](t2, import_fs27.default.readdirSync(t2.absolute));
147418
147472
  }
147419
147473
  [di](t2) {
147420
147474
  let e = t2.entry, i = this.zip;
@@ -147465,8 +147519,8 @@ var Qn = K2(Vn, $n, Xn, qn, (s3, t2) => {
147465
147519
  });
147466
147520
  var Jn = process.env.__FAKE_PLATFORM__ || process.platform;
147467
147521
  var Er = Jn === "win32";
147468
- var { O_CREAT: wr, O_NOFOLLOW: mr, O_TRUNC: Sr, O_WRONLY: yr } = import_fs28.default.constants;
147469
- var Rr = Number(process.env.__FAKE_FS_O_FILENAME__) || import_fs28.default.constants.UV_FS_O_FILEMAP || 0;
147522
+ var { O_CREAT: wr, O_NOFOLLOW: mr, O_TRUNC: Sr, O_WRONLY: yr } = import_fs29.default.constants;
147523
+ var Rr = Number(process.env.__FAKE_FS_O_FILENAME__) || import_fs29.default.constants.UV_FS_O_FILEMAP || 0;
147470
147524
  var jn = Er && !!Rr;
147471
147525
  var to = 512 * 1024;
147472
147526
  var eo = Rr | Sr | wr | yr;