@4pm/cli 1.19.0 → 1.19.2

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38032,6 +38032,9 @@ var OutputBatcher = class {
38032
38032
  flushIntervalMs: 200,
38033
38033
  flushSizeKb: 64,
38034
38034
  maxBufferKb: 512,
38035
+ // Well under the cli-server WS maxPayload (8 MiB — ADR-0322) even after the enveloped frame's
38036
+ // AES-256-GCM + base64 + JSON inflation (~1.37×), and small enough to keep SSE replay chunks light.
38037
+ maxFrameKb: 256,
38035
38038
  overflow: "backpressure",
38036
38039
  ...options
38037
38040
  };
@@ -38062,7 +38065,9 @@ var OutputBatcher = class {
38062
38065
  }
38063
38066
  }
38064
38067
  /**
38065
- * Flush the entire current buffer immediately (one batch).
38068
+ * Flush the current buffer immediately, splitting it into frames no larger than `maxFrameKb`
38069
+ * (ADR-0322) so a single large burst never produces one over-`maxPayload` WS frame. The
38070
+ * `truncated` flag is carried on the last frame only.
38066
38071
  */
38067
38072
  flush() {
38068
38073
  if (this.timer) {
@@ -38070,7 +38075,7 @@ var OutputBatcher = class {
38070
38075
  this.timer = null;
38071
38076
  }
38072
38077
  if (this.buffer.length === 0 && !this.truncated) return;
38073
- const chunk = this.buffer;
38078
+ const buf = this.buffer;
38074
38079
  const truncated = this.truncated;
38075
38080
  this.buffer = "";
38076
38081
  this.truncated = false;
@@ -38078,7 +38083,16 @@ var OutputBatcher = class {
38078
38083
  this.paused = false;
38079
38084
  this.opts.onPressure?.(false);
38080
38085
  }
38081
- this.opts.onFlush(chunk, truncated);
38086
+ const max = this.opts.maxFrameKb * 1024;
38087
+ if (buf.length <= max) {
38088
+ this.opts.onFlush(buf, truncated);
38089
+ return;
38090
+ }
38091
+ for (let i = 0; i < buf.length; i += max) {
38092
+ const slice = buf.slice(i, i + max);
38093
+ const isLast = i + max >= buf.length;
38094
+ this.opts.onFlush(slice, isLast && truncated);
38095
+ }
38082
38096
  }
38083
38097
  };
38084
38098
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4pm/cli",
3
- "version": "1.19.0",
3
+ "version": "1.19.2",
4
4
  "private": false,
5
5
  "description": "4PM CLI — drives Claude/Codex CLIs on AI worker machines (Node + TypeScript)",
6
6
  "license": "LicenseRef-4PM-Source-Available",