@nac3/forge-cli 1.0.92 → 1.0.93
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/chat/server.js +15 -4
- package/dist/chat/server.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/chat/server.js
CHANGED
|
@@ -7604,13 +7604,24 @@ function generateRequestId() {
|
|
|
7604
7604
|
}
|
|
7605
7605
|
return s;
|
|
7606
7606
|
}
|
|
7607
|
-
|
|
7607
|
+
/* Cap for JSON request bodies. Raised from the old hardcoded 1MB, which
|
|
7608
|
+
* rejected legitimate large chat turns (long history + pasted docs)
|
|
7609
|
+
* BEFORE they ever reached Claude -- the panel surfaced it as if the
|
|
7610
|
+
* model failed. The panel<->server link is local and the relay path is
|
|
7611
|
+
* authenticated, so a generous cap matching the Anthropic API ceiling
|
|
7612
|
+
* (~32MB) is safe. Parameterizable so a specific endpoint can opt into a
|
|
7613
|
+
* tighter limit if ever needed. (Pablo 2026-08-05) */
|
|
7614
|
+
const MAX_JSON_BODY_BYTES = 32 * 1024 * 1024;
|
|
7615
|
+
async function readBody(req, maxBytes = MAX_JSON_BODY_BYTES) {
|
|
7608
7616
|
const chunks = [];
|
|
7617
|
+
let total = 0;
|
|
7609
7618
|
for await (const chunk of req) {
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7619
|
+
const buf = chunk;
|
|
7620
|
+
total += buf.length;
|
|
7621
|
+
if (total > maxBytes) {
|
|
7622
|
+
throw new Error('request body too large (>' + maxBytes + ' bytes)');
|
|
7613
7623
|
}
|
|
7624
|
+
chunks.push(buf);
|
|
7614
7625
|
}
|
|
7615
7626
|
return Buffer.concat(chunks).toString('utf-8');
|
|
7616
7627
|
}
|