@inerrata-corporation/errata 2.0.8-dev.2932 → 2.0.8-dev.2956
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/errata.mjs +22 -13
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -74144,18 +74144,21 @@ function readTailWithLosses(path2, maxBytes) {
|
|
|
74144
74144
|
try {
|
|
74145
74145
|
fd = openSync(path2, "r");
|
|
74146
74146
|
} catch {
|
|
74147
|
-
return { text: "", bytesUnreachable: 0, ioFailed: true };
|
|
74147
|
+
return { text: "", bytesUnreachable: 0, parseStartByte: 0, ioFailed: true };
|
|
74148
74148
|
}
|
|
74149
74149
|
try {
|
|
74150
74150
|
const size = fstatSync(fd).size;
|
|
74151
74151
|
const start2 = Math.max(0, size - maxBytes);
|
|
74152
74152
|
const len = size - start2;
|
|
74153
|
-
if (len <= 0) return { text: "", bytesUnreachable: 0, ioFailed: false };
|
|
74153
|
+
if (len <= 0) return { text: "", bytesUnreachable: 0, parseStartByte: 0, ioFailed: false };
|
|
74154
74154
|
const buf = Buffer.allocUnsafe(len);
|
|
74155
74155
|
readSync(fd, buf, 0, len, start2);
|
|
74156
|
-
|
|
74156
|
+
const text = buf.toString("utf8");
|
|
74157
|
+
const firstNewline = buf.indexOf(10);
|
|
74158
|
+
const parseStartByte = firstNewline < 0 ? start2 : start2 + firstNewline + 1 - Buffer.byteLength(buf.subarray(0, firstNewline + 1).toString("utf8"));
|
|
74159
|
+
return { text, bytesUnreachable: start2, parseStartByte, ioFailed: false };
|
|
74157
74160
|
} catch {
|
|
74158
|
-
return { text: "", bytesUnreachable: 0, ioFailed: true };
|
|
74161
|
+
return { text: "", bytesUnreachable: 0, parseStartByte: 0, ioFailed: true };
|
|
74159
74162
|
} finally {
|
|
74160
74163
|
closeSync(fd);
|
|
74161
74164
|
}
|
|
@@ -74219,7 +74222,7 @@ function isUserTurnBoundary(obj) {
|
|
|
74219
74222
|
}
|
|
74220
74223
|
function readAssistantTurnsWithLosses(transcriptPath, includeThinking = true, maxBytes = 2e6) {
|
|
74221
74224
|
const tail = readTailWithLosses(transcriptPath, maxBytes);
|
|
74222
|
-
const parsed = parseAssistantTurns(tail.text, includeThinking, false);
|
|
74225
|
+
const parsed = parseAssistantTurns(tail.text, includeThinking, false, tail.parseStartByte);
|
|
74223
74226
|
return {
|
|
74224
74227
|
turns: parsed.turns,
|
|
74225
74228
|
losses: {
|
|
@@ -74231,7 +74234,8 @@ function readAssistantTurnsWithLosses(transcriptPath, includeThinking = true, ma
|
|
|
74231
74234
|
}
|
|
74232
74235
|
function readAssistantTurnsFrom(transcriptPath, fromByte, includeThinking = true, maxBytes) {
|
|
74233
74236
|
const { text, nextOffset, more, ioFailed } = readFrom(transcriptPath, fromByte, maxBytes);
|
|
74234
|
-
const
|
|
74237
|
+
const startByte = fromByte > 0 && fromByte <= nextOffset ? fromByte : 0;
|
|
74238
|
+
const parsed = parseAssistantTurns(text, includeThinking, fromByte > 0, startByte);
|
|
74235
74239
|
return {
|
|
74236
74240
|
turns: parsed.turns,
|
|
74237
74241
|
nextOffset,
|
|
@@ -74267,10 +74271,10 @@ function detectHostHarness(raw2) {
|
|
|
74267
74271
|
}
|
|
74268
74272
|
return "claude_code";
|
|
74269
74273
|
}
|
|
74270
|
-
function parseAssistantTurns(raw2, includeThinking, skipFirstLineParseFailure = false) {
|
|
74274
|
+
function parseAssistantTurns(raw2, includeThinking, skipFirstLineParseFailure = false, startByte = 0) {
|
|
74271
74275
|
if (!raw2) return { turns: [], parseFailures: 0 };
|
|
74272
74276
|
const harness = detectHostHarness(raw2);
|
|
74273
|
-
if (harness === "codex") return parseCodexAssistantTurns(raw2, skipFirstLineParseFailure);
|
|
74277
|
+
if (harness === "codex") return parseCodexAssistantTurns(raw2, skipFirstLineParseFailure, startByte);
|
|
74274
74278
|
if (harness === "gemini") return parseGeminiAssistantTurns(raw2, skipFirstLineParseFailure);
|
|
74275
74279
|
if (harness === "opencode") return parseOpencodeAssistantTurns(raw2, skipFirstLineParseFailure);
|
|
74276
74280
|
return parseClaudeAssistantTurns(raw2, includeThinking, skipFirstLineParseFailure);
|
|
@@ -74361,13 +74365,16 @@ function parseGeminiAssistantTurns(raw2, skipFirstLineParseFailure = false) {
|
|
|
74361
74365
|
const turns = [...byId.entries()].sort((a, b) => a[1].order - b[1].order).map(([uuid3, v]) => ({ uuid: uuid3, text: v.text, hostHarness: "gemini" }));
|
|
74362
74366
|
return { turns, parseFailures };
|
|
74363
74367
|
}
|
|
74364
|
-
function parseCodexAssistantTurns(raw2, skipFirstLineParseFailure = false) {
|
|
74368
|
+
function parseCodexAssistantTurns(raw2, skipFirstLineParseFailure = false, startByte = 0) {
|
|
74365
74369
|
const turns = [];
|
|
74366
|
-
const lines = raw2.split(
|
|
74370
|
+
const lines = raw2.split("\n");
|
|
74367
74371
|
let parseFailures = 0;
|
|
74372
|
+
let nextByte = startByte;
|
|
74368
74373
|
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
74369
74374
|
const line = lines[i2];
|
|
74370
|
-
|
|
74375
|
+
const lineByte = nextByte;
|
|
74376
|
+
nextByte += Buffer.byteLength(line ?? "", "utf8") + 1;
|
|
74377
|
+
if (!line?.trim()) continue;
|
|
74371
74378
|
let obj;
|
|
74372
74379
|
try {
|
|
74373
74380
|
obj = JSON.parse(line);
|
|
@@ -74386,7 +74393,9 @@ function parseCodexAssistantTurns(raw2, skipFirstLineParseFailure = false) {
|
|
|
74386
74393
|
}
|
|
74387
74394
|
if (parts2.length === 0) continue;
|
|
74388
74395
|
turns.push({
|
|
74389
|
-
|
|
74396
|
+
// Slice-local line numbers repeat on every Stop. Position distinguishes
|
|
74397
|
+
// identical messages; the digest distinguishes a replaced row at that position.
|
|
74398
|
+
uuid: typeof payload["id"] === "string" && payload["id"].length > 0 ? payload["id"] : `codex-${lineByte}-${createHash14("sha256").update(line.trimEnd()).digest("hex")}`,
|
|
74390
74399
|
text: parts2.join("\n\n"),
|
|
74391
74400
|
hostHarness: "codex"
|
|
74392
74401
|
});
|
|
@@ -80279,7 +80288,7 @@ function createWatchBreaker(deps) {
|
|
|
80279
80288
|
}
|
|
80280
80289
|
|
|
80281
80290
|
// src/engine.ts
|
|
80282
|
-
var DAEMON_VERSION = true ? "2.0.8-dev.
|
|
80291
|
+
var DAEMON_VERSION = true ? "2.0.8-dev.2956" : "2.0.0-alpha.0";
|
|
80283
80292
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
80284
80293
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
80285
80294
|
var GIT_OP_MUTE_MS = 4e3;
|