ccsniff 1.1.23 → 1.1.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccsniff",
3
- "version": "1.1.23",
3
+ "version": "1.1.24",
4
4
  "description": "Watch Claude Code JSONL output files and emit structured events as a Node.js EventEmitter",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.cjs CHANGED
@@ -199,7 +199,11 @@ class JsonlReplayer extends JsonlWatcher {
199
199
  } catch {}
200
200
  };
201
201
  if (fs.existsSync(this._dir)) collect(this._dir, 0);
202
- const chosen = fileFilter ? all.filter(fileFilter) : all;
202
+ let chosen = fileFilter ? all.filter(fileFilter) : all;
203
+ if (since > 0) {
204
+ const cutoff = since - 300000;
205
+ chosen = chosen.filter(fp => { try { return fs.statSync(fp).mtimeMs >= cutoff; } catch { return true; } });
206
+ }
203
207
  let emitted = 0;
204
208
  for (const fp of chosen) {
205
209
  const fallbackSid = path.basename(fp, '.jsonl');
@@ -245,7 +249,7 @@ function vault({ projectsDir = DEFAULT_DIR, destDir = path.join(os.homedir(), '.
245
249
  try { srcStat = fs.statSync(srcPath); } catch { continue; }
246
250
  try {
247
251
  const dstStat = fs.statSync(dstPath);
248
- if (dstStat.size === srcStat.size && dstStat.mtimeMs >= srcStat.mtimeMs) { skipped++; continue; }
252
+ if (dstStat.size === srcStat.size && dstStat.mtimeMs >= srcStat.mtimeMs - 2000) { skipped++; continue; }
249
253
  } catch {}
250
254
  try {
251
255
  fs.mkdirSync(path.dirname(dstPath), { recursive: true });
package/src/index.js CHANGED
@@ -209,6 +209,10 @@ export class JsonlReplayer extends JsonlWatcher {
209
209
  };
210
210
  if (fs.existsSync(this._dir)) collect(this._dir, 0);
211
211
  let chosen = fileFilter ? all.filter(fileFilter) : all;
212
+ if (since > 0) {
213
+ const cutoff = since - 300000;
214
+ chosen = chosen.filter(fp => { try { return fs.statSync(fp).mtimeMs >= cutoff; } catch { return true; } });
215
+ }
212
216
  // When a maxEvents budget is set, read newest files first and stop once the
213
217
  // budget is met — so a huge projects tree never has its full backlog parsed
214
218
  // into the heap at once (the load-time memory peak this guards against).
@@ -264,7 +268,7 @@ export function vault({ projectsDir = DEFAULT_DIR, destDir = path.join(os.homedi
264
268
  try { srcStat = fs.statSync(srcPath); } catch { continue; }
265
269
  try {
266
270
  const dstStat = fs.statSync(dstPath);
267
- if (dstStat.size === srcStat.size && dstStat.mtimeMs >= srcStat.mtimeMs) { skipped++; continue; }
271
+ if (dstStat.size === srcStat.size && dstStat.mtimeMs >= srcStat.mtimeMs - 2000) { skipped++; continue; }
268
272
  } catch {}
269
273
  try {
270
274
  fs.mkdirSync(path.dirname(dstPath), { recursive: true });