@episoda/cli 0.2.157 → 0.2.158
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.
|
@@ -2913,7 +2913,7 @@ var require_package = __commonJS({
|
|
|
2913
2913
|
"package.json"(exports2, module2) {
|
|
2914
2914
|
module2.exports = {
|
|
2915
2915
|
name: "@episoda/cli",
|
|
2916
|
-
version: "0.2.
|
|
2916
|
+
version: "0.2.158",
|
|
2917
2917
|
description: "CLI tool for Episoda local development workflow orchestration",
|
|
2918
2918
|
main: "dist/index.js",
|
|
2919
2919
|
types: "dist/index.d.ts",
|
|
@@ -4936,6 +4936,8 @@ var ClaudePersistentRuntime = class {
|
|
|
4936
4936
|
this.maxStderrTailBytes = 8192;
|
|
4937
4937
|
// Stdout JSONL parsing state
|
|
4938
4938
|
this.stdoutBuffer = "";
|
|
4939
|
+
this.stdoutLineQueue = [];
|
|
4940
|
+
this.drainingStdoutQueue = false;
|
|
4939
4941
|
this.parsedLineCount = 0;
|
|
4940
4942
|
this.chunksSent = 0;
|
|
4941
4943
|
this.hasContent = false;
|
|
@@ -4998,21 +5000,9 @@ var ClaudePersistentRuntime = class {
|
|
|
4998
5000
|
this.stdoutBuffer += data.toString();
|
|
4999
5001
|
const lines = this.stdoutBuffer.split("\n");
|
|
5000
5002
|
this.stdoutBuffer = lines.pop() || "";
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
const parsed = JSON.parse(line);
|
|
5005
|
-
this.parsedLineCount++;
|
|
5006
|
-
if (this.parsedLineCount === 1) {
|
|
5007
|
-
const ttftMs = Date.now() - this.spawnTimestamp;
|
|
5008
|
-
console.log(`[ClaudePersistentRuntime] EP1360: TTFT (spawn to first JSON): ${ttftMs}ms, session=${this.sessionId}`);
|
|
5009
|
-
}
|
|
5010
|
-
this.handleParsedEvent(parsed);
|
|
5011
|
-
} catch {
|
|
5012
|
-
if (line.trim() && this.callbacks) {
|
|
5013
|
-
this.callbacks.onChunk(line + "\n");
|
|
5014
|
-
}
|
|
5015
|
-
}
|
|
5003
|
+
if (lines.length > 0) {
|
|
5004
|
+
this.stdoutLineQueue.push(...lines);
|
|
5005
|
+
this.drainStdoutQueue();
|
|
5016
5006
|
}
|
|
5017
5007
|
});
|
|
5018
5008
|
this.process.on("exit", (code, signal) => {
|
|
@@ -5118,6 +5108,41 @@ var ClaudePersistentRuntime = class {
|
|
|
5118
5108
|
// -------------------------------------------------------------------------
|
|
5119
5109
|
// Event handling
|
|
5120
5110
|
// -------------------------------------------------------------------------
|
|
5111
|
+
drainStdoutQueue() {
|
|
5112
|
+
if (this.drainingStdoutQueue) return;
|
|
5113
|
+
this.drainingStdoutQueue = true;
|
|
5114
|
+
const BATCH_SIZE = 5;
|
|
5115
|
+
const processBatch = () => {
|
|
5116
|
+
let processed = 0;
|
|
5117
|
+
while (processed < BATCH_SIZE && this.stdoutLineQueue.length > 0) {
|
|
5118
|
+
const line = this.stdoutLineQueue.shift();
|
|
5119
|
+
processed++;
|
|
5120
|
+
if (!line.trim()) continue;
|
|
5121
|
+
try {
|
|
5122
|
+
const parsed = JSON.parse(line);
|
|
5123
|
+
this.parsedLineCount++;
|
|
5124
|
+
if (this.parsedLineCount === 1) {
|
|
5125
|
+
const ttftMs = Date.now() - this.spawnTimestamp;
|
|
5126
|
+
console.log(`[ClaudePersistentRuntime] EP1360: TTFT (spawn to first JSON): ${ttftMs}ms, session=${this.sessionId}`);
|
|
5127
|
+
}
|
|
5128
|
+
this.handleParsedEvent(parsed);
|
|
5129
|
+
} catch {
|
|
5130
|
+
if (line.trim() && this.callbacks) {
|
|
5131
|
+
this.callbacks.onChunk(line + "\n");
|
|
5132
|
+
}
|
|
5133
|
+
}
|
|
5134
|
+
}
|
|
5135
|
+
if (this.stdoutLineQueue.length > 0) {
|
|
5136
|
+
setImmediate(processBatch);
|
|
5137
|
+
return;
|
|
5138
|
+
}
|
|
5139
|
+
this.drainingStdoutQueue = false;
|
|
5140
|
+
if (this.stdoutLineQueue.length > 0) {
|
|
5141
|
+
this.drainStdoutQueue();
|
|
5142
|
+
}
|
|
5143
|
+
};
|
|
5144
|
+
processBatch();
|
|
5145
|
+
}
|
|
5121
5146
|
handleParsedEvent(parsed) {
|
|
5122
5147
|
const type = parsed.type;
|
|
5123
5148
|
if (this._turnState === "waiting_for_echo") {
|
|
@@ -5429,6 +5454,8 @@ var CodexPersistentRuntime = class {
|
|
|
5429
5454
|
this.stderrTail = "";
|
|
5430
5455
|
this.maxStderrTailBytes = 8192;
|
|
5431
5456
|
this.stdoutBuffer = "";
|
|
5457
|
+
this.stdoutLineQueue = [];
|
|
5458
|
+
this.drainingStdoutQueue = false;
|
|
5432
5459
|
this.parsedLineCount = 0;
|
|
5433
5460
|
// Per-turn accounting
|
|
5434
5461
|
this.turnStartTime = 0;
|
|
@@ -5483,21 +5510,9 @@ var CodexPersistentRuntime = class {
|
|
|
5483
5510
|
this.stdoutBuffer += data.toString();
|
|
5484
5511
|
const lines = this.stdoutBuffer.split("\n");
|
|
5485
5512
|
this.stdoutBuffer = lines.pop() || "";
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
const parsed = JSON.parse(line);
|
|
5490
|
-
this.parsedLineCount++;
|
|
5491
|
-
if (this.parsedLineCount === 1) {
|
|
5492
|
-
const ttftMs = Date.now() - this.spawnTimestamp;
|
|
5493
|
-
console.log(`[CodexPersistentRuntime] EP1360: TTFT (spawn to first JSON): ${ttftMs}ms, session=${this.sessionId}`);
|
|
5494
|
-
}
|
|
5495
|
-
this.handleJsonRpcMessage(parsed);
|
|
5496
|
-
} catch {
|
|
5497
|
-
if (line.trim() && this.callbacks) {
|
|
5498
|
-
this.callbacks.onChunk(line + "\n");
|
|
5499
|
-
}
|
|
5500
|
-
}
|
|
5513
|
+
if (lines.length > 0) {
|
|
5514
|
+
this.stdoutLineQueue.push(...lines);
|
|
5515
|
+
this.drainStdoutQueue();
|
|
5501
5516
|
}
|
|
5502
5517
|
});
|
|
5503
5518
|
this.process.on("exit", (code, signal) => {
|
|
@@ -5608,6 +5623,41 @@ var CodexPersistentRuntime = class {
|
|
|
5608
5623
|
// -------------------------------------------------------------------------
|
|
5609
5624
|
// JSON-RPC plumbing
|
|
5610
5625
|
// -------------------------------------------------------------------------
|
|
5626
|
+
drainStdoutQueue() {
|
|
5627
|
+
if (this.drainingStdoutQueue) return;
|
|
5628
|
+
this.drainingStdoutQueue = true;
|
|
5629
|
+
const BATCH_SIZE = 5;
|
|
5630
|
+
const processBatch = () => {
|
|
5631
|
+
let processed = 0;
|
|
5632
|
+
while (processed < BATCH_SIZE && this.stdoutLineQueue.length > 0) {
|
|
5633
|
+
const line = this.stdoutLineQueue.shift();
|
|
5634
|
+
processed++;
|
|
5635
|
+
if (!line.trim()) continue;
|
|
5636
|
+
try {
|
|
5637
|
+
const parsed = JSON.parse(line);
|
|
5638
|
+
this.parsedLineCount++;
|
|
5639
|
+
if (this.parsedLineCount === 1) {
|
|
5640
|
+
const ttftMs = Date.now() - this.spawnTimestamp;
|
|
5641
|
+
console.log(`[CodexPersistentRuntime] EP1360: TTFT (spawn to first JSON): ${ttftMs}ms, session=${this.sessionId}`);
|
|
5642
|
+
}
|
|
5643
|
+
this.handleJsonRpcMessage(parsed);
|
|
5644
|
+
} catch {
|
|
5645
|
+
if (line.trim() && this.callbacks) {
|
|
5646
|
+
this.callbacks.onChunk(line + "\n");
|
|
5647
|
+
}
|
|
5648
|
+
}
|
|
5649
|
+
}
|
|
5650
|
+
if (this.stdoutLineQueue.length > 0) {
|
|
5651
|
+
setImmediate(processBatch);
|
|
5652
|
+
return;
|
|
5653
|
+
}
|
|
5654
|
+
this.drainingStdoutQueue = false;
|
|
5655
|
+
if (this.stdoutLineQueue.length > 0) {
|
|
5656
|
+
this.drainStdoutQueue();
|
|
5657
|
+
}
|
|
5658
|
+
};
|
|
5659
|
+
processBatch();
|
|
5660
|
+
}
|
|
5611
5661
|
handleJsonRpcMessage(msg) {
|
|
5612
5662
|
if (RUNTIME_DEBUG2 && this.debugTraceCount < 20) {
|
|
5613
5663
|
this.debugTraceCount++;
|