@ccpocket/bridge 1.69.3 → 1.69.5

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/README.md CHANGED
@@ -177,7 +177,7 @@ future.
177
177
 
178
178
  ## Requirements
179
179
 
180
- - Node.js v18+
180
+ - Node.js v20.18.1+
181
181
  - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) and/or [Codex CLI](https://github.com/openai/codex)
182
182
 
183
183
  Current Codex CLI docs recommend the standalone installer for macOS/Linux:
@@ -136,7 +136,12 @@ export declare class CodexProcess extends EventEmitter<CodexProcessEvents> {
136
136
  get apps(): CodexAppMetadata[];
137
137
  private rpcSeq;
138
138
  private pendingRpc;
139
- private stdoutBuffer;
139
+ /**
140
+ * App-server responses can contain tens of MiB of inline image data.
141
+ * Keep incomplete JSONL records as chunks so every transport chunk is
142
+ * copied at most once instead of repeatedly rebuilding one growing string.
143
+ */
144
+ private stdoutLineChunks;
140
145
  private _approvalPolicy;
141
146
  private _approvalsReviewer;
142
147
  private _codexPermissionsMode;
@@ -330,6 +335,7 @@ export declare class CodexProcess extends EventEmitter<CodexProcessEvents> {
330
335
  private emitCompletionEntitiesSnapshot;
331
336
  private runInputLoop;
332
337
  private handleStdoutChunk;
338
+ private completeStdoutLine;
333
339
  private handleRpcEnvelope;
334
340
  private handleRpcResponse;
335
341
  private handleServerRequest;
@@ -89,7 +89,12 @@ export class CodexProcess extends EventEmitter {
89
89
  }
90
90
  rpcSeq = 1;
91
91
  pendingRpc = new Map();
92
- stdoutBuffer = "";
92
+ /**
93
+ * App-server responses can contain tens of MiB of inline image data.
94
+ * Keep incomplete JSONL records as chunks so every transport chunk is
95
+ * copied at most once instead of repeatedly rebuilding one growing string.
96
+ */
97
+ stdoutLineChunks = [];
93
98
  // Collaboration mode & plan completion state
94
99
  _approvalPolicy = undefined;
95
100
  _approvalsReviewer = undefined;
@@ -469,6 +474,7 @@ export class CodexProcess extends EventEmitter {
469
474
  this.pendingPlanCompletion = null;
470
475
  this._pendingPlanInput = null;
471
476
  this._projectPath = projectPath;
477
+ this.stdoutLineChunks = [];
472
478
  }
473
479
  launchAppServer(projectPath, options) {
474
480
  const sandboxLog = options?.sandboxMode ?? "config";
@@ -1422,13 +1428,18 @@ export class CodexProcess extends EventEmitter {
1422
1428
  }
1423
1429
  }
1424
1430
  handleStdoutChunk(chunk) {
1425
- this.stdoutBuffer += chunk;
1426
- while (true) {
1427
- const newlineIndex = this.stdoutBuffer.indexOf("\n");
1428
- if (newlineIndex < 0)
1429
- break;
1430
- const line = this.stdoutBuffer.slice(0, newlineIndex).trim();
1431
- this.stdoutBuffer = this.stdoutBuffer.slice(newlineIndex + 1);
1431
+ let lineStart = 0;
1432
+ while (lineStart < chunk.length) {
1433
+ const newlineIndex = chunk.indexOf("\n", lineStart);
1434
+ if (newlineIndex < 0) {
1435
+ this.stdoutLineChunks.push(chunk.slice(lineStart));
1436
+ return;
1437
+ }
1438
+ const lineFragment = chunk.slice(lineStart, newlineIndex);
1439
+ const line = this.stdoutLineChunks.length === 0
1440
+ ? lineFragment.trim()
1441
+ : this.completeStdoutLine(lineFragment);
1442
+ lineStart = newlineIndex + 1;
1432
1443
  if (!line)
1433
1444
  continue;
1434
1445
  try {
@@ -1446,6 +1457,12 @@ export class CodexProcess extends EventEmitter {
1446
1457
  }
1447
1458
  }
1448
1459
  }
1460
+ completeStdoutLine(finalChunk) {
1461
+ this.stdoutLineChunks.push(finalChunk);
1462
+ const line = this.stdoutLineChunks.join("").trim();
1463
+ this.stdoutLineChunks = [];
1464
+ return line;
1465
+ }
1449
1466
  handleRpcEnvelope(envelope) {
1450
1467
  if (envelope.id != null &&
1451
1468
  envelope.method &&