replicas-engine 0.1.38 → 0.1.39
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/src/index.js +17 -33
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -2452,35 +2452,30 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
2452
2452
|
};
|
|
2453
2453
|
}
|
|
2454
2454
|
let active = true;
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2455
|
+
const seenLines = /* @__PURE__ */ new Set();
|
|
2456
|
+
const seedSeenLines = async () => {
|
|
2457
|
+
try {
|
|
2458
|
+
const content = await readFile5(sessionFile, "utf-8");
|
|
2459
|
+
const lines = content.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
2460
|
+
for (const line of lines) {
|
|
2461
|
+
seenLines.add(line);
|
|
2462
|
+
}
|
|
2463
|
+
} catch {
|
|
2464
|
+
}
|
|
2465
|
+
};
|
|
2466
|
+
await seedSeenLines();
|
|
2463
2467
|
const pump = async () => {
|
|
2464
2468
|
let emitted = 0;
|
|
2465
2469
|
try {
|
|
2466
2470
|
const content = await readFile5(sessionFile, "utf-8");
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
}
|
|
2471
|
-
const chunk = content.slice(offset);
|
|
2472
|
-
offset = content.length;
|
|
2473
|
-
if (!chunk) {
|
|
2474
|
-
return 0;
|
|
2475
|
-
}
|
|
2476
|
-
const buffered = `${remainder}${chunk}`;
|
|
2477
|
-
const lines = buffered.split("\n");
|
|
2478
|
-
remainder = lines.pop() ?? "";
|
|
2479
|
-
for (const line of lines) {
|
|
2471
|
+
const lines = content.split("\n");
|
|
2472
|
+
const completeLines = content.endsWith("\n") ? lines : lines.slice(0, -1);
|
|
2473
|
+
for (const line of completeLines) {
|
|
2480
2474
|
const trimmed = line.trim();
|
|
2481
|
-
if (!trimmed) {
|
|
2475
|
+
if (!trimmed || seenLines.has(trimmed)) {
|
|
2482
2476
|
continue;
|
|
2483
2477
|
}
|
|
2478
|
+
seenLines.add(trimmed);
|
|
2484
2479
|
try {
|
|
2485
2480
|
const parsed = JSON.parse(trimmed);
|
|
2486
2481
|
if (isJsonlEvent2(parsed)) {
|
|
@@ -2512,17 +2507,6 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
2512
2507
|
}
|
|
2513
2508
|
await sleep(100);
|
|
2514
2509
|
}
|
|
2515
|
-
const tail = remainder.trim();
|
|
2516
|
-
if (!tail) {
|
|
2517
|
-
return;
|
|
2518
|
-
}
|
|
2519
|
-
try {
|
|
2520
|
-
const parsed = JSON.parse(tail);
|
|
2521
|
-
if (isJsonlEvent2(parsed)) {
|
|
2522
|
-
onEvent(parsed);
|
|
2523
|
-
}
|
|
2524
|
-
} catch {
|
|
2525
|
-
}
|
|
2526
2510
|
};
|
|
2527
2511
|
}
|
|
2528
2512
|
};
|