sprag-cli 3.127.0 → 3.128.0

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": "sprag-cli",
3
- "version": "3.127.0",
3
+ "version": "3.128.0",
4
4
  "description": "The delegation layer for Claude Code and Codex: each task goes to the model and effort that fits it, down to cheaper models for lookups and up to higher effort when a cheaper run would miss, backed by public replay cases, with a live statusline and team rules for Pro and Enterprise.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -217,8 +217,21 @@ export function dropOffsets(dir = userDataDir()) {
217
217
  try { rmSync(promptOffsetsPath(dir), { force: true }); } catch (e) { debug('team-prompts', e); }
218
218
  }
219
219
 
220
+ // ino as a decimal string from a bigint stat. On Windows the NTFS file id keeps a
221
+ // sequence number in its top 16 bits, so the plain number stat rounds it past
222
+ // 2^53 and two files can share one ino; a rotated log then looked unchanged.
220
223
  function statOf(path) {
221
- try { const s = statSync(path); return { size: s.size, ino: s.ino }; } catch { return null; }
224
+ try {
225
+ const s = statSync(path, { bigint: true });
226
+ return { size: Number(s.size), ino: s.ino ? s.ino.toString() : null };
227
+ } catch { return null; }
228
+ }
229
+
230
+ /** Offsets written before 3.128 hold ino as a rounded number: compare those the same rounded way. */
231
+ export function inoChanged(stored, current) {
232
+ if (!stored || !current) return false;
233
+ if (typeof stored === 'number') return stored !== Number(BigInt(current));
234
+ return String(stored) !== current;
222
235
  }
223
236
 
224
237
  /** First sight of capture = on: pin every existing file at its current size. */
@@ -241,7 +254,7 @@ function scanFile(file, entry, { maxPrompts, maxBytes }) {
241
254
  const s = statOf(file.path);
242
255
  if (!s) return null;
243
256
  let offset = entry ? entry.offset : 0;
244
- if (entry && (s.size < entry.offset || (entry.ino && s.ino && entry.ino !== s.ino))) offset = 0; // shrank or rotated
257
+ if (entry && (s.size < entry.offset || inoChanged(entry.ino, s.ino))) offset = 0; // shrank or rotated
245
258
  if (s.size <= offset) return { chunks: [], end: offset, size: s.size, ino: s.ino };
246
259
  let fd;
247
260
  try {
@@ -330,7 +343,7 @@ export async function uploadPrompts({
330
343
  const entry = offsets[f.path];
331
344
  const scan = scanFile(f, entry, { maxPrompts: promptsLeft, maxBytes: bytesLeft });
332
345
  if (!scan) continue;
333
- const restart = entry && (scan.size < entry.offset || (entry.ino && scan.ino && entry.ino !== scan.ino));
346
+ const restart = entry && (scan.size < entry.offset || inoChanged(entry.ino, scan.ino));
334
347
  if (restart) { offsets[f.path] = { offset: 0, size: scan.size, ino: scan.ino }; }
335
348
  const key = fileKey(f.path);
336
349
  for (const c of scan.chunks) {