@threadbase-sh/scanner 0.10.0 → 0.10.2

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.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
  import pino2 from "pino";
6
6
 
7
7
  // package.json
8
- var version = "0.10.0";
8
+ var version = "0.10.2";
9
9
 
10
10
  // src/logger.ts
11
11
  import pino from "pino";
@@ -60,7 +60,7 @@ async function saveProfiles(profiles, configPath) {
60
60
 
61
61
  // src/scanner.ts
62
62
  import { EventEmitter } from "events";
63
- import { closeSync as closeSync2, openSync as openSync2, readSync as readSync2, statSync as statSync2 } from "fs";
63
+ import { closeSync as closeSync2, openSync as openSync2, readSync as readSync2, statSync as statSync3 } from "fs";
64
64
  import { homedir as homedir2 } from "os";
65
65
  import { join as join4 } from "path";
66
66
 
@@ -1143,6 +1143,9 @@ function classify(filePath, existing) {
1143
1143
  return { change: "reindex", stat: stat4 };
1144
1144
  }
1145
1145
 
1146
+ // src/persistent/index-engine.ts
1147
+ import { statSync as statSync2 } from "fs";
1148
+
1146
1149
  // src/providers/codex-cli.ts
1147
1150
  import fg2 from "fast-glob";
1148
1151
  import { createReadStream as createReadStream4 } from "fs";
@@ -2464,7 +2467,13 @@ var PersistentEngine = class {
2464
2467
  await this.ensureCheckpoints(filePath, total);
2465
2468
  const beforeIndex = options.beforeIndex ?? total;
2466
2469
  const fromIndex = Math.max(0, beforeIndex - options.limit);
2467
- const floor = this.checkpoints.floor(filePath, fromIndex);
2470
+ let floor = this.checkpoints.floor(filePath, fromIndex);
2471
+ if (floor) {
2472
+ try {
2473
+ if (floor.byteOffset > statSync2(filePath).size) floor = null;
2474
+ } catch {
2475
+ }
2476
+ }
2468
2477
  return readPage(filePath, total, options, floor);
2469
2478
  }
2470
2479
  // Build or extend the checkpoint chain so it covers `total` messages. Cold
@@ -2797,7 +2806,7 @@ var ConversationScanner = class {
2797
2806
  const cached = statCache.get(filePath);
2798
2807
  if (cached) {
2799
2808
  try {
2800
- const s = statSync2(filePath);
2809
+ const s = statSync3(filePath);
2801
2810
  if (s.mtimeMs === cached.stat.mtimeMs && s.size === cached.stat.size) {
2802
2811
  return cached.meta;
2803
2812
  }