claude-use 11.20.1 → 11.21.0
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/cli.cjs +391 -388
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -27955,8 +27955,8 @@ function redactJsonValue(value2) {
|
|
|
27955
27955
|
}
|
|
27956
27956
|
return value2;
|
|
27957
27957
|
}
|
|
27958
|
-
function redactBody(
|
|
27959
|
-
const text2 =
|
|
27958
|
+
function redactBody(chunk2) {
|
|
27959
|
+
const text2 = chunk2.toString("utf8");
|
|
27960
27960
|
try {
|
|
27961
27961
|
const parsed = JSON.parse(text2);
|
|
27962
27962
|
return JSON.stringify(redactJsonValue(parsed));
|
|
@@ -27988,13 +27988,13 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
|
|
|
27988
27988
|
const stored = { "client-to-server": 0, "server-to-client": 0 };
|
|
27989
27989
|
const sequences = { "client-to-server": 0, "server-to-client": 0 };
|
|
27990
27990
|
return {
|
|
27991
|
-
onChunk: (direction,
|
|
27991
|
+
onChunk: (direction, chunk2) => {
|
|
27992
27992
|
sequences[direction] += 1;
|
|
27993
27993
|
const budget = STREAM_LOG_CAP_BYTES - stored[direction];
|
|
27994
27994
|
if (budget <= 0) {
|
|
27995
27995
|
return;
|
|
27996
27996
|
}
|
|
27997
|
-
const excerpt2 =
|
|
27997
|
+
const excerpt2 = chunk2.subarray(0, Math.min(CHUNK_LOG_CAP_BYTES, budget));
|
|
27998
27998
|
stored[direction] += excerpt2.length;
|
|
27999
27999
|
const text2 = excerpt2.toString("utf8");
|
|
28000
28000
|
const faithful = Buffer.from(text2, "utf8").equals(excerpt2);
|
|
@@ -28003,9 +28003,9 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
|
|
|
28003
28003
|
id: id2,
|
|
28004
28004
|
dir: direction,
|
|
28005
28005
|
seq: sequences[direction],
|
|
28006
|
-
bytes:
|
|
28006
|
+
bytes: chunk2.length,
|
|
28007
28007
|
stored: excerpt2.length,
|
|
28008
|
-
truncated: excerpt2.length <
|
|
28008
|
+
truncated: excerpt2.length < chunk2.length,
|
|
28009
28009
|
...faithful ? { body: redactText(text2) } : { b64: excerpt2.toString("base64") }
|
|
28010
28010
|
});
|
|
28011
28011
|
},
|
|
@@ -28020,7 +28020,7 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
|
|
|
28020
28020
|
append({ kind: "request", id: id2, method: request7.method ?? "?", url: request7.url ?? "?", headers: redactHeaders(request7.headers) });
|
|
28021
28021
|
const logged = { request: 0, response: 0 };
|
|
28022
28022
|
const sequences = { request: 0, response: 0 };
|
|
28023
|
-
const
|
|
28023
|
+
const chunk2 = (direction, incoming) => {
|
|
28024
28024
|
sequences[direction] += 1;
|
|
28025
28025
|
const budget = STREAM_LOG_CAP_BYTES - logged[direction];
|
|
28026
28026
|
if (budget <= 0) {
|
|
@@ -28040,13 +28040,13 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
|
|
|
28040
28040
|
};
|
|
28041
28041
|
return {
|
|
28042
28042
|
onRequestChunk: (incoming) => {
|
|
28043
|
-
|
|
28043
|
+
chunk2("request", incoming);
|
|
28044
28044
|
},
|
|
28045
28045
|
onResponse: (status, headers) => {
|
|
28046
28046
|
append({ kind: "response", id: id2, status, headers: redactHeaders(headers) });
|
|
28047
28047
|
},
|
|
28048
28048
|
onResponseChunk: (incoming) => {
|
|
28049
|
-
|
|
28049
|
+
chunk2("response", incoming);
|
|
28050
28050
|
},
|
|
28051
28051
|
onEnd: () => {
|
|
28052
28052
|
append({ kind: "end", id: id2, requestBytesCapped: logged.request >= STREAM_LOG_CAP_BYTES, responseBytesCapped: logged.response >= STREAM_LOG_CAP_BYTES });
|
|
@@ -34181,7 +34181,7 @@ var init_package = __esm({
|
|
|
34181
34181
|
"package.json"() {
|
|
34182
34182
|
package_default = {
|
|
34183
34183
|
name: "claude-use",
|
|
34184
|
-
version: "11.
|
|
34184
|
+
version: "11.21.0",
|
|
34185
34185
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
34186
34186
|
license: "MIT",
|
|
34187
34187
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -38431,13 +38431,13 @@ var require_request = __commonJS({
|
|
|
38431
38431
|
channels.create.publish({ request: this });
|
|
38432
38432
|
}
|
|
38433
38433
|
}
|
|
38434
|
-
onBodySent(
|
|
38434
|
+
onBodySent(chunk2) {
|
|
38435
38435
|
if (channels.bodyChunkSent.hasSubscribers) {
|
|
38436
|
-
channels.bodyChunkSent.publish({ request: this, chunk });
|
|
38436
|
+
channels.bodyChunkSent.publish({ request: this, chunk: chunk2 });
|
|
38437
38437
|
}
|
|
38438
38438
|
if (this[kHandler].onBodySent) {
|
|
38439
38439
|
try {
|
|
38440
|
-
return this[kHandler].onBodySent(
|
|
38440
|
+
return this[kHandler].onBodySent(chunk2);
|
|
38441
38441
|
} catch (err) {
|
|
38442
38442
|
this.abort(err);
|
|
38443
38443
|
}
|
|
@@ -38480,14 +38480,14 @@ var require_request = __commonJS({
|
|
|
38480
38480
|
this.abort(err);
|
|
38481
38481
|
}
|
|
38482
38482
|
}
|
|
38483
|
-
onData(
|
|
38483
|
+
onData(chunk2) {
|
|
38484
38484
|
assert2(!this.aborted);
|
|
38485
38485
|
assert2(!this.completed);
|
|
38486
38486
|
if (channels.bodyChunkReceived.hasSubscribers) {
|
|
38487
|
-
channels.bodyChunkReceived.publish({ request: this, chunk });
|
|
38487
|
+
channels.bodyChunkReceived.publish({ request: this, chunk: chunk2 });
|
|
38488
38488
|
}
|
|
38489
38489
|
try {
|
|
38490
|
-
return this[kHandler].onData(
|
|
38490
|
+
return this[kHandler].onData(chunk2);
|
|
38491
38491
|
} catch (err) {
|
|
38492
38492
|
this.abort(err);
|
|
38493
38493
|
return false;
|
|
@@ -41652,17 +41652,17 @@ var require_util3 = __commonJS({
|
|
|
41652
41652
|
const bytes = [];
|
|
41653
41653
|
let byteLength = 0;
|
|
41654
41654
|
do {
|
|
41655
|
-
const { done, value:
|
|
41655
|
+
const { done, value: chunk2 } = await reader.read();
|
|
41656
41656
|
if (done) {
|
|
41657
41657
|
successSteps(Buffer.concat(bytes, byteLength));
|
|
41658
41658
|
return;
|
|
41659
41659
|
}
|
|
41660
|
-
if (!isUint8Array(
|
|
41660
|
+
if (!isUint8Array(chunk2)) {
|
|
41661
41661
|
failureSteps(new TypeError("Received non-Uint8Array chunk"));
|
|
41662
41662
|
return;
|
|
41663
41663
|
}
|
|
41664
|
-
bytes.push(
|
|
41665
|
-
byteLength +=
|
|
41664
|
+
bytes.push(chunk2);
|
|
41665
|
+
byteLength += chunk2.length;
|
|
41666
41666
|
} while (true);
|
|
41667
41667
|
} catch (e14) {
|
|
41668
41668
|
failureSteps(e14);
|
|
@@ -41768,18 +41768,18 @@ var require_util3 = __commonJS({
|
|
|
41768
41768
|
super();
|
|
41769
41769
|
this.#zlibOptions = zlibOptions;
|
|
41770
41770
|
}
|
|
41771
|
-
_transform(
|
|
41771
|
+
_transform(chunk2, encoding, callback) {
|
|
41772
41772
|
if (!this._inflateStream) {
|
|
41773
|
-
if (
|
|
41773
|
+
if (chunk2.length === 0) {
|
|
41774
41774
|
callback();
|
|
41775
41775
|
return;
|
|
41776
41776
|
}
|
|
41777
|
-
this._inflateStream = (
|
|
41777
|
+
this._inflateStream = (chunk2[0] & 15) === 8 ? zlib2.createInflate(this.#zlibOptions) : zlib2.createInflateRaw(this.#zlibOptions);
|
|
41778
41778
|
this._inflateStream.on("data", this.push.bind(this));
|
|
41779
41779
|
this._inflateStream.on("end", () => this.push(null));
|
|
41780
41780
|
this._inflateStream.on("error", (err) => this.destroy(err));
|
|
41781
41781
|
}
|
|
41782
|
-
this._inflateStream.write(
|
|
41782
|
+
this._inflateStream.write(chunk2, encoding, callback);
|
|
41783
41783
|
}
|
|
41784
41784
|
_final(callback) {
|
|
41785
41785
|
if (this._inflateStream) {
|
|
@@ -42520,29 +42520,29 @@ Content-Disposition: form-data`;
|
|
|
42520
42520
|
let hasUnknownSizeValue = false;
|
|
42521
42521
|
for (const [name, value2] of object3) {
|
|
42522
42522
|
if (typeof value2 === "string") {
|
|
42523
|
-
const
|
|
42523
|
+
const chunk3 = textEncoder.encode(prefix + `; name="${formdataEscape(normalizeLinefeeds(name))}"\r
|
|
42524
42524
|
\r
|
|
42525
42525
|
${normalizeLinefeeds(value2)}\r
|
|
42526
42526
|
`);
|
|
42527
|
-
blobParts.push(
|
|
42528
|
-
length +=
|
|
42527
|
+
blobParts.push(chunk3);
|
|
42528
|
+
length += chunk3.byteLength;
|
|
42529
42529
|
} else {
|
|
42530
|
-
const
|
|
42530
|
+
const chunk3 = textEncoder.encode(`${prefix}; name="${formdataEscape(normalizeLinefeeds(name))}"` + (value2.name ? `; filename="${formdataEscape(value2.name)}"` : "") + `\r
|
|
42531
42531
|
Content-Type: ${value2.type || "application/octet-stream"}\r
|
|
42532
42532
|
\r
|
|
42533
42533
|
`);
|
|
42534
|
-
blobParts.push(
|
|
42534
|
+
blobParts.push(chunk3, value2, rn2);
|
|
42535
42535
|
if (typeof value2.size === "number") {
|
|
42536
|
-
length +=
|
|
42536
|
+
length += chunk3.byteLength + value2.size + rn2.byteLength;
|
|
42537
42537
|
} else {
|
|
42538
42538
|
hasUnknownSizeValue = true;
|
|
42539
42539
|
}
|
|
42540
42540
|
}
|
|
42541
42541
|
}
|
|
42542
|
-
const
|
|
42542
|
+
const chunk2 = textEncoder.encode(`--${boundary}--\r
|
|
42543
42543
|
`);
|
|
42544
|
-
blobParts.push(
|
|
42545
|
-
length +=
|
|
42544
|
+
blobParts.push(chunk2);
|
|
42545
|
+
length += chunk2.byteLength;
|
|
42546
42546
|
if (hasUnknownSizeValue) {
|
|
42547
42547
|
length = null;
|
|
42548
42548
|
}
|
|
@@ -42974,41 +42974,41 @@ var require_client_h1 = __commonJS({
|
|
|
42974
42974
|
}
|
|
42975
42975
|
readMore() {
|
|
42976
42976
|
while (!this.paused && this.ptr) {
|
|
42977
|
-
const
|
|
42978
|
-
if (
|
|
42977
|
+
const chunk2 = this.socket.read();
|
|
42978
|
+
if (chunk2 === null) {
|
|
42979
42979
|
break;
|
|
42980
42980
|
}
|
|
42981
|
-
this.execute(
|
|
42981
|
+
this.execute(chunk2);
|
|
42982
42982
|
}
|
|
42983
42983
|
}
|
|
42984
42984
|
/**
|
|
42985
42985
|
* @param {Buffer} chunk
|
|
42986
42986
|
*/
|
|
42987
|
-
execute(
|
|
42987
|
+
execute(chunk2) {
|
|
42988
42988
|
assert2(currentParser === null);
|
|
42989
42989
|
assert2(this.ptr != null);
|
|
42990
42990
|
assert2(!this.paused);
|
|
42991
42991
|
const { socket, llhttp } = this;
|
|
42992
|
-
if (
|
|
42992
|
+
if (chunk2.length > currentBufferSize) {
|
|
42993
42993
|
if (currentBufferPtr) {
|
|
42994
42994
|
llhttp.free(currentBufferPtr);
|
|
42995
42995
|
}
|
|
42996
|
-
currentBufferSize = Math.ceil(
|
|
42996
|
+
currentBufferSize = Math.ceil(chunk2.length / 4096) * 4096;
|
|
42997
42997
|
currentBufferPtr = llhttp.malloc(currentBufferSize);
|
|
42998
42998
|
}
|
|
42999
|
-
new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(
|
|
42999
|
+
new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(chunk2);
|
|
43000
43000
|
try {
|
|
43001
43001
|
let ret;
|
|
43002
43002
|
try {
|
|
43003
|
-
currentBufferRef =
|
|
43003
|
+
currentBufferRef = chunk2;
|
|
43004
43004
|
currentParser = this;
|
|
43005
|
-
ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr,
|
|
43005
|
+
ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, chunk2.length);
|
|
43006
43006
|
} finally {
|
|
43007
43007
|
currentParser = null;
|
|
43008
43008
|
currentBufferRef = null;
|
|
43009
43009
|
}
|
|
43010
43010
|
if (ret !== constants2.ERROR.OK) {
|
|
43011
|
-
const data =
|
|
43011
|
+
const data = chunk2.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
|
|
43012
43012
|
if (ret === constants2.ERROR.PAUSED_UPGRADE) {
|
|
43013
43013
|
this.onUpgrade(data);
|
|
43014
43014
|
} else if (ret === constants2.ERROR.PAUSED) {
|
|
@@ -43707,12 +43707,12 @@ upgrade: ${upgrade}\r
|
|
|
43707
43707
|
assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
|
43708
43708
|
let finished = false;
|
|
43709
43709
|
const writer = new AsyncWriter({ abort, socket, request: request7, contentLength, client, expectsPayload, header });
|
|
43710
|
-
const onData = function(
|
|
43710
|
+
const onData = function(chunk2) {
|
|
43711
43711
|
if (finished) {
|
|
43712
43712
|
return;
|
|
43713
43713
|
}
|
|
43714
43714
|
try {
|
|
43715
|
-
if (!writer.write(
|
|
43715
|
+
if (!writer.write(chunk2) && this.pause) {
|
|
43716
43716
|
this.pause();
|
|
43717
43717
|
}
|
|
43718
43718
|
} catch (err) {
|
|
@@ -43847,11 +43847,11 @@ upgrade: ${upgrade}\r
|
|
|
43847
43847
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
43848
43848
|
const writer = new AsyncWriter({ abort, socket, request: request7, contentLength, client, expectsPayload, header });
|
|
43849
43849
|
try {
|
|
43850
|
-
for await (const
|
|
43850
|
+
for await (const chunk2 of body) {
|
|
43851
43851
|
if (socket[kError]) {
|
|
43852
43852
|
throw socket[kError];
|
|
43853
43853
|
}
|
|
43854
|
-
if (!writer.write(
|
|
43854
|
+
if (!writer.write(chunk2)) {
|
|
43855
43855
|
await waitForDrain();
|
|
43856
43856
|
}
|
|
43857
43857
|
}
|
|
@@ -43889,7 +43889,7 @@ upgrade: ${upgrade}\r
|
|
|
43889
43889
|
* @param {Buffer} chunk
|
|
43890
43890
|
* @returns
|
|
43891
43891
|
*/
|
|
43892
|
-
write(
|
|
43892
|
+
write(chunk2) {
|
|
43893
43893
|
const { socket, request: request7, contentLength, client, bytesWritten, expectsPayload, header } = this;
|
|
43894
43894
|
if (socket[kError]) {
|
|
43895
43895
|
throw socket[kError];
|
|
@@ -43897,7 +43897,7 @@ upgrade: ${upgrade}\r
|
|
|
43897
43897
|
if (socket.destroyed) {
|
|
43898
43898
|
return false;
|
|
43899
43899
|
}
|
|
43900
|
-
const len = Buffer.byteLength(
|
|
43900
|
+
const len = Buffer.byteLength(chunk2);
|
|
43901
43901
|
if (!len) {
|
|
43902
43902
|
return true;
|
|
43903
43903
|
}
|
|
@@ -43927,9 +43927,9 @@ ${len.toString(16)}\r
|
|
|
43927
43927
|
`, "latin1");
|
|
43928
43928
|
}
|
|
43929
43929
|
this.bytesWritten += len;
|
|
43930
|
-
const ret = socket.write(
|
|
43930
|
+
const ret = socket.write(chunk2);
|
|
43931
43931
|
socket.uncork();
|
|
43932
|
-
request7.onBodySent(
|
|
43932
|
+
request7.onBodySent(chunk2);
|
|
43933
43933
|
if (!ret) {
|
|
43934
43934
|
if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
|
|
43935
43935
|
if (socket[kParser].timeout.refresh) {
|
|
@@ -44508,11 +44508,11 @@ var require_client_h2 = __commonJS({
|
|
|
44508
44508
|
if (request7.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) {
|
|
44509
44509
|
stream.pause();
|
|
44510
44510
|
}
|
|
44511
|
-
stream.on("data", (
|
|
44511
|
+
stream.on("data", (chunk2) => {
|
|
44512
44512
|
if (request7.aborted || request7.completed) {
|
|
44513
44513
|
return;
|
|
44514
44514
|
}
|
|
44515
|
-
if (request7.onData(
|
|
44515
|
+
if (request7.onData(chunk2) === false) {
|
|
44516
44516
|
stream.pause();
|
|
44517
44517
|
}
|
|
44518
44518
|
});
|
|
@@ -44682,8 +44682,8 @@ var require_client_h2 = __commonJS({
|
|
|
44682
44682
|
}
|
|
44683
44683
|
);
|
|
44684
44684
|
util2.addListener(pipe2, "data", onPipeData);
|
|
44685
|
-
function onPipeData(
|
|
44686
|
-
request7.onBodySent(
|
|
44685
|
+
function onPipeData(chunk2) {
|
|
44686
|
+
request7.onBodySent(chunk2);
|
|
44687
44687
|
}
|
|
44688
44688
|
}
|
|
44689
44689
|
async function writeBlob(abort, h2stream, body, client, request7, socket, contentLength, expectsPayload) {
|
|
@@ -44727,12 +44727,12 @@ var require_client_h2 = __commonJS({
|
|
|
44727
44727
|
});
|
|
44728
44728
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
44729
44729
|
try {
|
|
44730
|
-
for await (const
|
|
44730
|
+
for await (const chunk2 of body) {
|
|
44731
44731
|
if (socket[kError]) {
|
|
44732
44732
|
throw socket[kError];
|
|
44733
44733
|
}
|
|
44734
|
-
const res = h2stream.write(
|
|
44735
|
-
request7.onBodySent(
|
|
44734
|
+
const res = h2stream.write(chunk2);
|
|
44735
|
+
request7.onBodySent(chunk2);
|
|
44736
44736
|
if (!res) {
|
|
44737
44737
|
await waitForDrain();
|
|
44738
44738
|
}
|
|
@@ -47395,12 +47395,12 @@ var require_retry_handler = __commonJS({
|
|
|
47395
47395
|
});
|
|
47396
47396
|
}
|
|
47397
47397
|
}
|
|
47398
|
-
onResponseData(controller,
|
|
47398
|
+
onResponseData(controller, chunk2) {
|
|
47399
47399
|
if (this.error) {
|
|
47400
47400
|
return;
|
|
47401
47401
|
}
|
|
47402
|
-
this.start +=
|
|
47403
|
-
this.handler.onResponseData?.(controller,
|
|
47402
|
+
this.start += chunk2.length;
|
|
47403
|
+
this.handler.onResponseData?.(controller, chunk2);
|
|
47404
47404
|
}
|
|
47405
47405
|
onResponseEnd(controller, trailers) {
|
|
47406
47406
|
if (this.error && this.retryOpts.throwOnError) {
|
|
@@ -47655,15 +47655,15 @@ var require_readable = __commonJS({
|
|
|
47655
47655
|
* @param {Buffer|null} chunk
|
|
47656
47656
|
* @returns {boolean}
|
|
47657
47657
|
*/
|
|
47658
|
-
push(
|
|
47659
|
-
if (
|
|
47660
|
-
this[kBytesRead] +=
|
|
47658
|
+
push(chunk2) {
|
|
47659
|
+
if (chunk2) {
|
|
47660
|
+
this[kBytesRead] += chunk2.length;
|
|
47661
47661
|
if (this[kConsume]) {
|
|
47662
|
-
consumePush(this[kConsume],
|
|
47663
|
-
return this[kReading] ? super.push(
|
|
47662
|
+
consumePush(this[kConsume], chunk2);
|
|
47663
|
+
return this[kReading] ? super.push(chunk2) : true;
|
|
47664
47664
|
}
|
|
47665
47665
|
}
|
|
47666
|
-
return super.push(
|
|
47666
|
+
return super.push(chunk2);
|
|
47667
47667
|
}
|
|
47668
47668
|
/**
|
|
47669
47669
|
* Consumes and returns the body as a string.
|
|
@@ -47854,8 +47854,8 @@ var require_readable = __commonJS({
|
|
|
47854
47854
|
consumePush(consume2, state.buffer[n10]);
|
|
47855
47855
|
}
|
|
47856
47856
|
} else {
|
|
47857
|
-
for (const
|
|
47858
|
-
consumePush(consume2,
|
|
47857
|
+
for (const chunk2 of state.buffer) {
|
|
47858
|
+
consumePush(consume2, chunk2);
|
|
47859
47859
|
}
|
|
47860
47860
|
}
|
|
47861
47861
|
if (state.endEmitted) {
|
|
@@ -47892,9 +47892,9 @@ var require_readable = __commonJS({
|
|
|
47892
47892
|
const buffer2 = new Uint8Array(Buffer.allocUnsafeSlow(length).buffer);
|
|
47893
47893
|
let offset = 0;
|
|
47894
47894
|
for (let i10 = 0; i10 < chunks.length; ++i10) {
|
|
47895
|
-
const
|
|
47896
|
-
buffer2.set(
|
|
47897
|
-
offset +=
|
|
47895
|
+
const chunk2 = chunks[i10];
|
|
47896
|
+
buffer2.set(chunk2, offset);
|
|
47897
|
+
offset += chunk2.length;
|
|
47898
47898
|
}
|
|
47899
47899
|
return buffer2;
|
|
47900
47900
|
}
|
|
@@ -47917,9 +47917,9 @@ var require_readable = __commonJS({
|
|
|
47917
47917
|
stream.destroy(err);
|
|
47918
47918
|
}
|
|
47919
47919
|
}
|
|
47920
|
-
function consumePush(consume2,
|
|
47921
|
-
consume2.length +=
|
|
47922
|
-
consume2.body.push(
|
|
47920
|
+
function consumePush(consume2, chunk2) {
|
|
47921
|
+
consume2.length += chunk2.length;
|
|
47922
|
+
consume2.body.push(chunk2);
|
|
47923
47923
|
}
|
|
47924
47924
|
function consumeFinish(consume2, err) {
|
|
47925
47925
|
if (consume2.body === null) {
|
|
@@ -48064,8 +48064,8 @@ var require_api_request = __commonJS({
|
|
|
48064
48064
|
}
|
|
48065
48065
|
}
|
|
48066
48066
|
}
|
|
48067
|
-
onData(
|
|
48068
|
-
return this.res.push(
|
|
48067
|
+
onData(chunk2) {
|
|
48068
|
+
return this.res.push(chunk2);
|
|
48069
48069
|
}
|
|
48070
48070
|
onComplete(trailers) {
|
|
48071
48071
|
util2.parseHeaders(trailers, this.trailers);
|
|
@@ -48280,9 +48280,9 @@ var require_api_stream = __commonJS({
|
|
|
48280
48280
|
const needDrain = res.writableNeedDrain !== void 0 ? res.writableNeedDrain : res._writableState?.needDrain;
|
|
48281
48281
|
return needDrain !== true;
|
|
48282
48282
|
}
|
|
48283
|
-
onData(
|
|
48283
|
+
onData(chunk2) {
|
|
48284
48284
|
const { res } = this;
|
|
48285
|
-
return res ? res.write(
|
|
48285
|
+
return res ? res.write(chunk2) : true;
|
|
48286
48286
|
}
|
|
48287
48287
|
onComplete(trailers) {
|
|
48288
48288
|
const { res } = this;
|
|
@@ -48423,9 +48423,9 @@ var require_api_pipeline = __commonJS({
|
|
|
48423
48423
|
body.resume();
|
|
48424
48424
|
}
|
|
48425
48425
|
},
|
|
48426
|
-
write: (
|
|
48426
|
+
write: (chunk2, encoding, callback) => {
|
|
48427
48427
|
const { req } = this;
|
|
48428
|
-
if (req.push(
|
|
48428
|
+
if (req.push(chunk2, encoding) || req._readableState.destroyed) {
|
|
48429
48429
|
callback();
|
|
48430
48430
|
} else {
|
|
48431
48431
|
req[kResume] = callback;
|
|
@@ -48490,9 +48490,9 @@ var require_api_pipeline = __commonJS({
|
|
|
48490
48490
|
if (!body || typeof body.on !== "function") {
|
|
48491
48491
|
throw new InvalidReturnValueError("expected Readable");
|
|
48492
48492
|
}
|
|
48493
|
-
body.on("data", (
|
|
48493
|
+
body.on("data", (chunk2) => {
|
|
48494
48494
|
const { ret, body: body2 } = this;
|
|
48495
|
-
if (!ret.push(
|
|
48495
|
+
if (!ret.push(chunk2) && body2.pause) {
|
|
48496
48496
|
body2.pause();
|
|
48497
48497
|
}
|
|
48498
48498
|
}).on("error", (err) => {
|
|
@@ -48509,9 +48509,9 @@ var require_api_pipeline = __commonJS({
|
|
|
48509
48509
|
});
|
|
48510
48510
|
this.body = body;
|
|
48511
48511
|
}
|
|
48512
|
-
onData(
|
|
48512
|
+
onData(chunk2) {
|
|
48513
48513
|
const { res } = this;
|
|
48514
|
-
return res.push(
|
|
48514
|
+
return res.push(chunk2);
|
|
48515
48515
|
}
|
|
48516
48516
|
onComplete(trailers) {
|
|
48517
48517
|
const { res } = this;
|
|
@@ -49670,8 +49670,8 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
49670
49670
|
module2.exports = class PendingInterceptorsFormatter {
|
|
49671
49671
|
constructor({ disableColors } = {}) {
|
|
49672
49672
|
this.transform = new Transform({
|
|
49673
|
-
transform(
|
|
49674
|
-
cb2(null,
|
|
49673
|
+
transform(chunk2, _enc, cb2) {
|
|
49674
|
+
cb2(null, chunk2);
|
|
49675
49675
|
}
|
|
49676
49676
|
});
|
|
49677
49677
|
this.logger = new Console({
|
|
@@ -50465,9 +50465,9 @@ var require_snapshot_agent = __commonJS({
|
|
|
50465
50465
|
responseData.headers = headers;
|
|
50466
50466
|
return handler.onResponseStart(controller, statusCode, headers, statusMessage);
|
|
50467
50467
|
},
|
|
50468
|
-
onResponseData(controller,
|
|
50469
|
-
responseData.body.push(
|
|
50470
|
-
return handler.onResponseData(controller,
|
|
50468
|
+
onResponseData(controller, chunk2) {
|
|
50469
|
+
responseData.body.push(chunk2);
|
|
50470
|
+
return handler.onResponseData(controller, chunk2);
|
|
50471
50471
|
},
|
|
50472
50472
|
onResponseEnd(controller, trailers) {
|
|
50473
50473
|
responseData.trailers = trailers;
|
|
@@ -50849,10 +50849,10 @@ var require_redirect_handler = __commonJS({
|
|
|
50849
50849
|
this.opts.origin = origin;
|
|
50850
50850
|
this.opts.query = null;
|
|
50851
50851
|
}
|
|
50852
|
-
onResponseData(controller,
|
|
50852
|
+
onResponseData(controller, chunk2) {
|
|
50853
50853
|
if (this.location) {
|
|
50854
50854
|
} else {
|
|
50855
|
-
this.handler.onResponseData?.(controller,
|
|
50855
|
+
this.handler.onResponseData?.(controller, chunk2);
|
|
50856
50856
|
}
|
|
50857
50857
|
}
|
|
50858
50858
|
onResponseEnd(controller, trailers) {
|
|
@@ -50962,11 +50962,11 @@ var require_response_error = __commonJS({
|
|
|
50962
50962
|
this.#decoder = new TextDecoder("utf-8");
|
|
50963
50963
|
}
|
|
50964
50964
|
}
|
|
50965
|
-
onResponseData(controller,
|
|
50965
|
+
onResponseData(controller, chunk2) {
|
|
50966
50966
|
if (this.#statusCode < 400) {
|
|
50967
|
-
return super.onResponseData(controller,
|
|
50967
|
+
return super.onResponseData(controller, chunk2);
|
|
50968
50968
|
}
|
|
50969
|
-
this.#body += this.#decoder?.decode(
|
|
50969
|
+
this.#body += this.#decoder?.decode(chunk2, { stream: true }) ?? "";
|
|
50970
50970
|
}
|
|
50971
50971
|
onResponseEnd(controller, trailers) {
|
|
50972
50972
|
if (this.#statusCode >= 400) {
|
|
@@ -51073,8 +51073,8 @@ var require_dump = __commonJS({
|
|
|
51073
51073
|
onResponseError(controller, err) {
|
|
51074
51074
|
super.onResponseError(controller, this.aborted === true ? this.reason : err);
|
|
51075
51075
|
}
|
|
51076
|
-
onResponseData(controller,
|
|
51077
|
-
this.#size = this.#size +
|
|
51076
|
+
onResponseData(controller, chunk2) {
|
|
51077
|
+
this.#size = this.#size + chunk2.length;
|
|
51078
51078
|
if (this.#size > this.#maxSize) {
|
|
51079
51079
|
throw new RequestAbortedError(
|
|
51080
51080
|
`Response size (${this.#size}) larger than maxSize (${this.#maxSize})`
|
|
@@ -52784,9 +52784,9 @@ var require_cache_handler = __commonJS({
|
|
|
52784
52784
|
if (typeof cachedValue.body.values === "function") {
|
|
52785
52785
|
const bodyIterator = cachedValue.body.values();
|
|
52786
52786
|
const streamCachedBody = () => {
|
|
52787
|
-
for (const
|
|
52788
|
-
const full = this.#writeStream.write(
|
|
52789
|
-
this.#handler.onResponseData?.(controller,
|
|
52787
|
+
for (const chunk2 of bodyIterator) {
|
|
52788
|
+
const full = this.#writeStream.write(chunk2) === false;
|
|
52789
|
+
this.#handler.onResponseData?.(controller, chunk2);
|
|
52790
52790
|
if (full) {
|
|
52791
52791
|
break;
|
|
52792
52792
|
}
|
|
@@ -52804,9 +52804,9 @@ var require_cache_handler = __commonJS({
|
|
|
52804
52804
|
});
|
|
52805
52805
|
streamCachedBody();
|
|
52806
52806
|
} else if (typeof cachedValue.body.on === "function") {
|
|
52807
|
-
cachedValue.body.on("data", (
|
|
52808
|
-
this.#writeStream.write(
|
|
52809
|
-
this.#handler.onResponseData?.(controller,
|
|
52807
|
+
cachedValue.body.on("data", (chunk2) => {
|
|
52808
|
+
this.#writeStream.write(chunk2);
|
|
52809
|
+
this.#handler.onResponseData?.(controller, chunk2);
|
|
52810
52810
|
}).on("end", () => {
|
|
52811
52811
|
this.#writeStream.end();
|
|
52812
52812
|
}).on("error", () => {
|
|
@@ -52849,11 +52849,11 @@ var require_cache_handler = __commonJS({
|
|
|
52849
52849
|
downstreamOnHeaders();
|
|
52850
52850
|
}
|
|
52851
52851
|
}
|
|
52852
|
-
onResponseData(controller,
|
|
52853
|
-
if (this.#writeStream?.write(
|
|
52852
|
+
onResponseData(controller, chunk2) {
|
|
52853
|
+
if (this.#writeStream?.write(chunk2) === false) {
|
|
52854
52854
|
controller.pause();
|
|
52855
52855
|
}
|
|
52856
|
-
this.#handler.onResponseData?.(controller,
|
|
52856
|
+
this.#handler.onResponseData?.(controller, chunk2);
|
|
52857
52857
|
}
|
|
52858
52858
|
onResponseEnd(controller, trailers) {
|
|
52859
52859
|
this.#writeStream?.end();
|
|
@@ -53150,15 +53150,15 @@ var require_memory_cache_store = __commonJS({
|
|
|
53150
53150
|
const store = this;
|
|
53151
53151
|
const entry = { ...key, ...val, body: [], size: 0 };
|
|
53152
53152
|
return new Writable({
|
|
53153
|
-
write(
|
|
53154
|
-
if (typeof
|
|
53155
|
-
|
|
53153
|
+
write(chunk2, encoding, callback) {
|
|
53154
|
+
if (typeof chunk2 === "string") {
|
|
53155
|
+
chunk2 = Buffer.from(chunk2, encoding);
|
|
53156
53156
|
}
|
|
53157
|
-
entry.size +=
|
|
53157
|
+
entry.size += chunk2.byteLength;
|
|
53158
53158
|
if (entry.size >= store.#maxEntrySize) {
|
|
53159
53159
|
this.destroy();
|
|
53160
53160
|
} else {
|
|
53161
|
-
entry.body.push(
|
|
53161
|
+
entry.body.push(chunk2);
|
|
53162
53162
|
}
|
|
53163
53163
|
callback(null);
|
|
53164
53164
|
},
|
|
@@ -53319,11 +53319,11 @@ var require_cache_revalidation_handler = __commonJS({
|
|
|
53319
53319
|
statusMessage
|
|
53320
53320
|
);
|
|
53321
53321
|
}
|
|
53322
|
-
onResponseData(controller,
|
|
53322
|
+
onResponseData(controller, chunk2) {
|
|
53323
53323
|
if (this.#successful) {
|
|
53324
53324
|
return;
|
|
53325
53325
|
}
|
|
53326
|
-
return this.#handler.onResponseData?.(controller,
|
|
53326
|
+
return this.#handler.onResponseData?.(controller, chunk2);
|
|
53327
53327
|
}
|
|
53328
53328
|
onResponseEnd(controller, trailers) {
|
|
53329
53329
|
if (this.#successful) {
|
|
@@ -53572,8 +53572,8 @@ var require_cache2 = __commonJS({
|
|
|
53572
53572
|
if (opts.method === "HEAD") {
|
|
53573
53573
|
stream.destroy();
|
|
53574
53574
|
} else {
|
|
53575
|
-
stream.on("data", function(
|
|
53576
|
-
handler.onResponseData?.(controller,
|
|
53575
|
+
stream.on("data", function(chunk2) {
|
|
53576
|
+
handler.onResponseData?.(controller, chunk2);
|
|
53577
53577
|
});
|
|
53578
53578
|
}
|
|
53579
53579
|
}
|
|
@@ -53794,8 +53794,8 @@ var require_decompress = __commonJS({
|
|
|
53794
53794
|
function createMaxSizeLimiter(maxSize) {
|
|
53795
53795
|
let size = 0;
|
|
53796
53796
|
return new TransformStream2({
|
|
53797
|
-
transform(
|
|
53798
|
-
const decompressedSize = size +
|
|
53797
|
+
transform(chunk2, _encoding, callback) {
|
|
53798
|
+
const decompressedSize = size + chunk2.length;
|
|
53799
53799
|
if (decompressedSize > maxSize) {
|
|
53800
53800
|
callback(new ResponseExceededMaxSizeError(
|
|
53801
53801
|
`Decompressed response size (${decompressedSize}) exceeded maxSize (${maxSize})`
|
|
@@ -53803,7 +53803,7 @@ var require_decompress = __commonJS({
|
|
|
53803
53803
|
return;
|
|
53804
53804
|
}
|
|
53805
53805
|
size = decompressedSize;
|
|
53806
|
-
callback(null,
|
|
53806
|
+
callback(null, chunk2);
|
|
53807
53807
|
}
|
|
53808
53808
|
});
|
|
53809
53809
|
}
|
|
@@ -53911,9 +53911,9 @@ var require_decompress = __commonJS({
|
|
|
53911
53911
|
if (this.#terminated) {
|
|
53912
53912
|
return;
|
|
53913
53913
|
}
|
|
53914
|
-
let
|
|
53915
|
-
while ((
|
|
53916
|
-
const decompressedSize = this.#decompressedSize +
|
|
53914
|
+
let chunk2;
|
|
53915
|
+
while ((chunk2 = decompressor.read()) !== null) {
|
|
53916
|
+
const decompressedSize = this.#decompressedSize + chunk2.length;
|
|
53917
53917
|
if (decompressedSize > this.#maxSize) {
|
|
53918
53918
|
this.#fail(controller, new ResponseExceededMaxSizeError(
|
|
53919
53919
|
`Decompressed response size (${decompressedSize}) exceeded maxSize (${this.#maxSize})`
|
|
@@ -53921,7 +53921,7 @@ var require_decompress = __commonJS({
|
|
|
53921
53921
|
return;
|
|
53922
53922
|
}
|
|
53923
53923
|
this.#decompressedSize = decompressedSize;
|
|
53924
|
-
const result = super.onResponseData(controller,
|
|
53924
|
+
const result = super.onResponseData(controller, chunk2);
|
|
53925
53925
|
if (result === false) {
|
|
53926
53926
|
break;
|
|
53927
53927
|
}
|
|
@@ -54030,12 +54030,12 @@ var require_decompress = __commonJS({
|
|
|
54030
54030
|
* @param {Buffer} chunk
|
|
54031
54031
|
* @returns {void}
|
|
54032
54032
|
*/
|
|
54033
|
-
onResponseData(controller,
|
|
54033
|
+
onResponseData(controller, chunk2) {
|
|
54034
54034
|
if (this.#decompressors.length > 0) {
|
|
54035
|
-
this.#decompressors[0].write(
|
|
54035
|
+
this.#decompressors[0].write(chunk2);
|
|
54036
54036
|
return;
|
|
54037
54037
|
}
|
|
54038
|
-
super.onResponseData(controller,
|
|
54038
|
+
super.onResponseData(controller, chunk2);
|
|
54039
54039
|
}
|
|
54040
54040
|
/**
|
|
54041
54041
|
* @param {Controller} controller
|
|
@@ -54242,12 +54242,12 @@ var require_deduplication_handler = __commonJS({
|
|
|
54242
54242
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
|
|
54243
54243
|
* @param {Buffer} chunk
|
|
54244
54244
|
*/
|
|
54245
|
-
onResponseData(controller,
|
|
54245
|
+
onResponseData(controller, chunk2) {
|
|
54246
54246
|
if (this.#aborted || this.#completed) {
|
|
54247
54247
|
return;
|
|
54248
54248
|
}
|
|
54249
54249
|
this.#responseDataStarted = true;
|
|
54250
|
-
this.#primaryHandler.onResponseData?.(controller,
|
|
54250
|
+
this.#primaryHandler.onResponseData?.(controller, chunk2);
|
|
54251
54251
|
for (const waitingHandler of this.#waitingHandlers) {
|
|
54252
54252
|
const { handler, controller: waitingController } = waitingHandler;
|
|
54253
54253
|
if (waitingHandler.done || waitingController.aborted) {
|
|
@@ -54255,11 +54255,11 @@ var require_deduplication_handler = __commonJS({
|
|
|
54255
54255
|
continue;
|
|
54256
54256
|
}
|
|
54257
54257
|
if (waitingController.paused) {
|
|
54258
|
-
this.#bufferWaitingChunk(waitingHandler,
|
|
54258
|
+
this.#bufferWaitingChunk(waitingHandler, chunk2);
|
|
54259
54259
|
continue;
|
|
54260
54260
|
}
|
|
54261
54261
|
try {
|
|
54262
|
-
handler.onResponseData?.(waitingController,
|
|
54262
|
+
handler.onResponseData?.(waitingController, chunk2);
|
|
54263
54263
|
} catch {
|
|
54264
54264
|
}
|
|
54265
54265
|
if (waitingController.aborted) {
|
|
@@ -54384,14 +54384,14 @@ var require_deduplication_handler = __commonJS({
|
|
|
54384
54384
|
* @param {WaitingHandler} waitingHandler
|
|
54385
54385
|
* @param {Buffer} chunk
|
|
54386
54386
|
*/
|
|
54387
|
-
#bufferWaitingChunk(waitingHandler,
|
|
54387
|
+
#bufferWaitingChunk(waitingHandler, chunk2) {
|
|
54388
54388
|
if (waitingHandler.done || waitingHandler.controller.aborted) {
|
|
54389
54389
|
waitingHandler.done = true;
|
|
54390
54390
|
waitingHandler.bufferedChunks = [];
|
|
54391
54391
|
waitingHandler.bufferedBytes = 0;
|
|
54392
54392
|
return;
|
|
54393
54393
|
}
|
|
54394
|
-
const bufferedChunk = Buffer.from(
|
|
54394
|
+
const bufferedChunk = Buffer.from(chunk2);
|
|
54395
54395
|
waitingHandler.bufferedChunks.push(bufferedChunk);
|
|
54396
54396
|
waitingHandler.bufferedBytes += bufferedChunk.length;
|
|
54397
54397
|
if (waitingHandler.bufferedBytes > this.#maxBufferSize) {
|
|
@@ -54781,10 +54781,10 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
54781
54781
|
const store = this;
|
|
54782
54782
|
return new Writable({
|
|
54783
54783
|
decodeStrings: true,
|
|
54784
|
-
write(
|
|
54785
|
-
size +=
|
|
54784
|
+
write(chunk2, encoding, callback) {
|
|
54785
|
+
size += chunk2.byteLength;
|
|
54786
54786
|
if (size < store.#maxEntrySize) {
|
|
54787
|
-
body.push(
|
|
54787
|
+
body.push(chunk2);
|
|
54788
54788
|
} else {
|
|
54789
54789
|
this.destroy();
|
|
54790
54790
|
}
|
|
@@ -57731,11 +57731,11 @@ var require_fetch = __commonJS({
|
|
|
57731
57731
|
});
|
|
57732
57732
|
return true;
|
|
57733
57733
|
},
|
|
57734
|
-
onData(
|
|
57734
|
+
onData(chunk2) {
|
|
57735
57735
|
if (fetchParams.controller.dump) {
|
|
57736
57736
|
return;
|
|
57737
57737
|
}
|
|
57738
|
-
const bytes =
|
|
57738
|
+
const bytes = chunk2;
|
|
57739
57739
|
timingInfo.encodedBodySize += bytes.byteLength;
|
|
57740
57740
|
return this.body.push(bytes);
|
|
57741
57741
|
},
|
|
@@ -59789,7 +59789,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
59789
59789
|
* @param {boolean} fin Final fragment flag
|
|
59790
59790
|
* @param {Function} callback Callback function
|
|
59791
59791
|
*/
|
|
59792
|
-
decompress(
|
|
59792
|
+
decompress(chunk2, fin, callback) {
|
|
59793
59793
|
if (!this.#inflate) {
|
|
59794
59794
|
let windowBits = Z_DEFAULT_WINDOWBITS;
|
|
59795
59795
|
if (this.#options.serverMaxWindowBits) {
|
|
@@ -59823,7 +59823,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
59823
59823
|
callback(err);
|
|
59824
59824
|
});
|
|
59825
59825
|
}
|
|
59826
|
-
this.#inflate.write(
|
|
59826
|
+
this.#inflate.write(chunk2);
|
|
59827
59827
|
if (fin) {
|
|
59828
59828
|
this.#inflate.write(tail);
|
|
59829
59829
|
}
|
|
@@ -59897,9 +59897,9 @@ var require_receiver = __commonJS({
|
|
|
59897
59897
|
* @param {Buffer} chunk
|
|
59898
59898
|
* @param {() => void} callback
|
|
59899
59899
|
*/
|
|
59900
|
-
_write(
|
|
59901
|
-
this.#buffers.push(
|
|
59902
|
-
this.#byteOffset +=
|
|
59900
|
+
_write(chunk2, _, callback) {
|
|
59901
|
+
this.#buffers.push(chunk2);
|
|
59902
|
+
this.#byteOffset += chunk2.length;
|
|
59903
59903
|
this.#loop = true;
|
|
59904
59904
|
this.run(callback);
|
|
59905
59905
|
}
|
|
@@ -60343,8 +60343,8 @@ var require_websocket = __commonJS({
|
|
|
60343
60343
|
onMessage: (opcode, data) => this.#onMessage(opcode, data),
|
|
60344
60344
|
onParserError: (err) => failWebsocketConnection(this.#handler, null, err.message),
|
|
60345
60345
|
onParserDrain: () => this.#onParserDrain(),
|
|
60346
|
-
onSocketData: (
|
|
60347
|
-
if (!this.#parser.write(
|
|
60346
|
+
onSocketData: (chunk2) => {
|
|
60347
|
+
if (!this.#parser.write(chunk2)) {
|
|
60348
60348
|
this.#handler.socket.pause();
|
|
60349
60349
|
}
|
|
60350
60350
|
},
|
|
@@ -60902,8 +60902,8 @@ var require_websocketstream = __commonJS({
|
|
|
60902
60902
|
onMessage: (opcode, data) => this.#onMessage(opcode, data),
|
|
60903
60903
|
onParserError: (err) => failWebsocketConnection(this.#handler, null, err.message),
|
|
60904
60904
|
onParserDrain: () => this.#handler.socket.resume(),
|
|
60905
|
-
onSocketData: (
|
|
60906
|
-
if (!this.#parser.write(
|
|
60905
|
+
onSocketData: (chunk2) => {
|
|
60906
|
+
if (!this.#parser.write(chunk2)) {
|
|
60907
60907
|
this.#handler.socket.pause();
|
|
60908
60908
|
}
|
|
60909
60909
|
},
|
|
@@ -60998,18 +60998,18 @@ var require_websocketstream = __commonJS({
|
|
|
60998
60998
|
const reason = closeInfo.reason;
|
|
60999
60999
|
closeWebSocketConnection(this.#handler, code, reason, true);
|
|
61000
61000
|
}
|
|
61001
|
-
#write(
|
|
61002
|
-
|
|
61001
|
+
#write(chunk2) {
|
|
61002
|
+
chunk2 = webidl.converters.WebSocketStreamWrite(chunk2);
|
|
61003
61003
|
const promise2 = createDeferredPromise();
|
|
61004
61004
|
let data = null;
|
|
61005
61005
|
let opcode = null;
|
|
61006
|
-
if (webidl.is.BufferSource(
|
|
61007
|
-
data = new Uint8Array(ArrayBuffer.isView(
|
|
61006
|
+
if (webidl.is.BufferSource(chunk2)) {
|
|
61007
|
+
data = new Uint8Array(ArrayBuffer.isView(chunk2) ? new Uint8Array(chunk2.buffer, chunk2.byteOffset, chunk2.byteLength) : chunk2.slice());
|
|
61008
61008
|
opcode = opcodes.BINARY;
|
|
61009
61009
|
} else {
|
|
61010
61010
|
let string4;
|
|
61011
61011
|
try {
|
|
61012
|
-
string4 = webidl.converters.DOMString(
|
|
61012
|
+
string4 = webidl.converters.DOMString(chunk2);
|
|
61013
61013
|
} catch (e14) {
|
|
61014
61014
|
promise2.reject(e14);
|
|
61015
61015
|
return promise2.promise;
|
|
@@ -61050,7 +61050,7 @@ var require_websocketstream = __commonJS({
|
|
|
61050
61050
|
start: (controller) => {
|
|
61051
61051
|
this.#writableStreamController = controller;
|
|
61052
61052
|
},
|
|
61053
|
-
write: (
|
|
61053
|
+
write: (chunk2) => this.#write(chunk2),
|
|
61054
61054
|
close: () => closeWebSocketConnection(this.#handler, null, null),
|
|
61055
61055
|
abort: (reason) => this.#closeUsingReason(reason)
|
|
61056
61056
|
});
|
|
@@ -61067,18 +61067,18 @@ var require_websocketstream = __commonJS({
|
|
|
61067
61067
|
if (this.#handler.readyState !== states.OPEN) {
|
|
61068
61068
|
return;
|
|
61069
61069
|
}
|
|
61070
|
-
let
|
|
61070
|
+
let chunk2;
|
|
61071
61071
|
if (type2 === opcodes.TEXT) {
|
|
61072
61072
|
try {
|
|
61073
|
-
|
|
61073
|
+
chunk2 = utf8Decode(data);
|
|
61074
61074
|
} catch {
|
|
61075
61075
|
failWebsocketConnection(this.#handler, 1007, "Received invalid UTF-8 in text frame.");
|
|
61076
61076
|
return;
|
|
61077
61077
|
}
|
|
61078
61078
|
} else if (type2 === opcodes.BINARY) {
|
|
61079
|
-
|
|
61079
|
+
chunk2 = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
61080
61080
|
}
|
|
61081
|
-
this.#readableStreamController.enqueue(
|
|
61081
|
+
this.#readableStreamController.enqueue(chunk2);
|
|
61082
61082
|
}
|
|
61083
61083
|
/** @type {import('../websocket').Handler['onSocketClose']} */
|
|
61084
61084
|
#onSocketClose() {
|
|
@@ -61287,12 +61287,12 @@ var require_eventsource_stream = __commonJS({
|
|
|
61287
61287
|
* @param {Function} callback
|
|
61288
61288
|
* @returns {void}
|
|
61289
61289
|
*/
|
|
61290
|
-
_transform(
|
|
61291
|
-
if (
|
|
61290
|
+
_transform(chunk2, _encoding, callback) {
|
|
61291
|
+
if (chunk2.length === 0) {
|
|
61292
61292
|
callback();
|
|
61293
61293
|
return;
|
|
61294
61294
|
}
|
|
61295
|
-
this.chunks.push(
|
|
61295
|
+
this.chunks.push(chunk2);
|
|
61296
61296
|
if (this.checkBOM) {
|
|
61297
61297
|
if (this.handleBOM()) {
|
|
61298
61298
|
callback();
|
|
@@ -61460,10 +61460,10 @@ ${value2}`;
|
|
|
61460
61460
|
const chunks = [];
|
|
61461
61461
|
let length = 0;
|
|
61462
61462
|
for (let i10 = this.lineChunkIndex; i10 <= this.chunkIndex; i10++) {
|
|
61463
|
-
const
|
|
61463
|
+
const chunk2 = this.chunks[i10];
|
|
61464
61464
|
const start = i10 === this.lineChunkIndex ? this.linePos : 0;
|
|
61465
|
-
const end = i10 === this.chunkIndex ? this.pos :
|
|
61466
|
-
const slice =
|
|
61465
|
+
const end = i10 === this.chunkIndex ? this.pos : chunk2.length;
|
|
61466
|
+
const slice = chunk2.subarray(start, end);
|
|
61467
61467
|
length += slice.length;
|
|
61468
61468
|
chunks.push(slice);
|
|
61469
61469
|
}
|
|
@@ -61473,10 +61473,10 @@ ${value2}`;
|
|
|
61473
61473
|
let chunkIndex = this.lineChunkIndex;
|
|
61474
61474
|
let pos = this.linePos;
|
|
61475
61475
|
while (chunkIndex < this.chunks.length) {
|
|
61476
|
-
const
|
|
61477
|
-
const remaining =
|
|
61476
|
+
const chunk2 = this.chunks[chunkIndex];
|
|
61477
|
+
const remaining = chunk2.length - pos;
|
|
61478
61478
|
if (offset < remaining) {
|
|
61479
|
-
return
|
|
61479
|
+
return chunk2[pos + offset];
|
|
61480
61480
|
}
|
|
61481
61481
|
offset -= remaining;
|
|
61482
61482
|
chunkIndex++;
|
|
@@ -61485,8 +61485,8 @@ ${value2}`;
|
|
|
61485
61485
|
}
|
|
61486
61486
|
discardLeadingBytes(count) {
|
|
61487
61487
|
while (count > 0 && this.lineChunkIndex < this.chunks.length) {
|
|
61488
|
-
const
|
|
61489
|
-
const remaining =
|
|
61488
|
+
const chunk2 = this.chunks[this.lineChunkIndex];
|
|
61489
|
+
const remaining = chunk2.length - this.linePos;
|
|
61490
61490
|
if (count < remaining) {
|
|
61491
61491
|
this.linePos += count;
|
|
61492
61492
|
count = 0;
|
|
@@ -64247,8 +64247,8 @@ async function* callCloudAntigravity(params, fetchFn = fetch) {
|
|
|
64247
64247
|
let buffer2 = "";
|
|
64248
64248
|
const sseDataPrefix = "data:";
|
|
64249
64249
|
for await (const rawChunk of response.body) {
|
|
64250
|
-
const
|
|
64251
|
-
buffer2 += decoder.decode(
|
|
64250
|
+
const chunk2 = rawChunk instanceof Uint8Array ? rawChunk : Buffer.from(String(rawChunk));
|
|
64251
|
+
buffer2 += decoder.decode(chunk2, { stream: true });
|
|
64252
64252
|
const lines = buffer2.split("\n");
|
|
64253
64253
|
buffer2 = lines.pop() ?? "";
|
|
64254
64254
|
for (const line of lines) {
|
|
@@ -106082,15 +106082,15 @@ ${itemIndentStr}`);
|
|
|
106082
106082
|
}
|
|
106083
106083
|
let sumChunks = [chunks.shift()];
|
|
106084
106084
|
let sumWidth = this.displayWidth(sumChunks[0]);
|
|
106085
|
-
chunks.forEach((
|
|
106086
|
-
const visibleWidth = this.displayWidth(
|
|
106085
|
+
chunks.forEach((chunk2) => {
|
|
106086
|
+
const visibleWidth = this.displayWidth(chunk2);
|
|
106087
106087
|
if (sumWidth + visibleWidth <= width) {
|
|
106088
|
-
sumChunks.push(
|
|
106088
|
+
sumChunks.push(chunk2);
|
|
106089
106089
|
sumWidth += visibleWidth;
|
|
106090
106090
|
return;
|
|
106091
106091
|
}
|
|
106092
106092
|
wrappedLines.push(sumChunks.join(""));
|
|
106093
|
-
const nextChunk =
|
|
106093
|
+
const nextChunk = chunk2.trimStart();
|
|
106094
106094
|
sumChunks = [nextChunk];
|
|
106095
106095
|
sumWidth = this.displayWidth(nextChunk);
|
|
106096
106096
|
});
|
|
@@ -113873,8 +113873,8 @@ async function runChild(options) {
|
|
|
113873
113873
|
await new Promise((resolve2, reject) => {
|
|
113874
113874
|
const child = (0, import_node_child_process5.spawn)(invocation.command, [...invocation.args], { stdio: ["ignore", "ignore", "pipe"], env: { ...process.env, AGENT_SHIM_HOME: options.paths.root } });
|
|
113875
113875
|
let stderr = "";
|
|
113876
|
-
child.stderr.on("data", (
|
|
113877
|
-
stderr = `${stderr}${
|
|
113876
|
+
child.stderr.on("data", (chunk2) => {
|
|
113877
|
+
stderr = `${stderr}${chunk2.toString()}`.slice(-STDERR_TAIL_CHARS);
|
|
113878
113878
|
});
|
|
113879
113879
|
const killer = setTimeout(() => {
|
|
113880
113880
|
child.kill("SIGKILL");
|
|
@@ -114697,11 +114697,11 @@ function pumpTapSession(secure, openUpstream, tap, prefix = Buffer.alloc(0)) {
|
|
|
114697
114697
|
upstream.write(prefix);
|
|
114698
114698
|
}
|
|
114699
114699
|
if (tap !== void 0) {
|
|
114700
|
-
secure.on("data", (
|
|
114701
|
-
tap.onChunk("client-to-server",
|
|
114700
|
+
secure.on("data", (chunk2) => {
|
|
114701
|
+
tap.onChunk("client-to-server", chunk2);
|
|
114702
114702
|
});
|
|
114703
|
-
upstream.on("data", (
|
|
114704
|
-
tap.onChunk("server-to-client",
|
|
114703
|
+
upstream.on("data", (chunk2) => {
|
|
114704
|
+
tap.onChunk("server-to-client", chunk2);
|
|
114705
114705
|
});
|
|
114706
114706
|
}
|
|
114707
114707
|
secure.pipe(upstream);
|
|
@@ -115167,8 +115167,8 @@ function handleConnect(socket, context) {
|
|
|
115167
115167
|
});
|
|
115168
115168
|
context.ledger.accept(socket);
|
|
115169
115169
|
let buffer2 = Buffer.alloc(0);
|
|
115170
|
-
const onData = (
|
|
115171
|
-
buffer2 = Buffer.concat([buffer2,
|
|
115170
|
+
const onData = (chunk2) => {
|
|
115171
|
+
buffer2 = Buffer.concat([buffer2, chunk2]);
|
|
115172
115172
|
const headEnd = buffer2.indexOf(HEAD_TERMINATOR);
|
|
115173
115173
|
if (headEnd === -1 ? buffer2.length > MAX_CONNECT_HEAD_BYTES : headEnd > MAX_CONNECT_HEAD_BYTES) {
|
|
115174
115174
|
context.ledger.headReceived(socket);
|
|
@@ -115639,11 +115639,11 @@ function createRcSessionTracker(deps) {
|
|
|
115639
115639
|
onResponse: (status) => {
|
|
115640
115640
|
accepted2 = isSuccessful(status);
|
|
115641
115641
|
},
|
|
115642
|
-
onBodyChunk: (
|
|
115642
|
+
onBodyChunk: (chunk2) => {
|
|
115643
115643
|
if (!accepted2 || buffered2 >= RC_CREATE_RESPONSE_CAP_BYTES) {
|
|
115644
115644
|
return;
|
|
115645
115645
|
}
|
|
115646
|
-
const text2 = Buffer.from(
|
|
115646
|
+
const text2 = Buffer.from(chunk2).toString("utf8");
|
|
115647
115647
|
body = body + text2.slice(0, RC_CREATE_RESPONSE_CAP_BYTES - buffered2);
|
|
115648
115648
|
buffered2 = body.length;
|
|
115649
115649
|
},
|
|
@@ -115708,12 +115708,12 @@ function createRcSessionTracker(deps) {
|
|
|
115708
115708
|
const archiving = method === "POST" && rest === `${id2}/archive`;
|
|
115709
115709
|
return {
|
|
115710
115710
|
...bodyKind === void 0 ? {} : {
|
|
115711
|
-
onRequestChunk: (
|
|
115711
|
+
onRequestChunk: (chunk2) => {
|
|
115712
115712
|
if (oversized) {
|
|
115713
115713
|
return;
|
|
115714
115714
|
}
|
|
115715
|
-
chunks.push(Buffer.from(
|
|
115716
|
-
buffered +=
|
|
115715
|
+
chunks.push(Buffer.from(chunk2));
|
|
115716
|
+
buffered += chunk2.length;
|
|
115717
115717
|
if (buffered > RC_REQUEST_PARSE_CAP_BYTES) {
|
|
115718
115718
|
oversized = true;
|
|
115719
115719
|
chunks = [];
|
|
@@ -115821,8 +115821,8 @@ function observingRoutedRoute(route, tracker, hooks) {
|
|
|
115821
115821
|
serve: async (request7, response) => {
|
|
115822
115822
|
const observed = tracker.observeExchange({ method: request7.method, url: request7.url, headers: request7.headers });
|
|
115823
115823
|
if (observed?.onRequestChunk !== void 0) {
|
|
115824
|
-
request7.body.on("data", (
|
|
115825
|
-
observed.onRequestChunk?.(
|
|
115824
|
+
request7.body.on("data", (chunk2) => {
|
|
115825
|
+
observed.onRequestChunk?.(chunk2);
|
|
115826
115826
|
});
|
|
115827
115827
|
request7.body.on("end", () => {
|
|
115828
115828
|
observed.onRequestEnd?.();
|
|
@@ -115844,9 +115844,9 @@ function teeRoutedResponse(response, observer, onSettled) {
|
|
|
115844
115844
|
flush: () => {
|
|
115845
115845
|
response.flush();
|
|
115846
115846
|
},
|
|
115847
|
-
write: async (
|
|
115848
|
-
observer.onBodyChunk(typeof
|
|
115849
|
-
await response.write(
|
|
115847
|
+
write: async (chunk2) => {
|
|
115848
|
+
observer.onBodyChunk(typeof chunk2 === "string" ? Buffer.from(chunk2, "utf8") : chunk2);
|
|
115849
|
+
await response.write(chunk2);
|
|
115850
115850
|
},
|
|
115851
115851
|
end: () => {
|
|
115852
115852
|
response.end();
|
|
@@ -116191,14 +116191,14 @@ async function readBody(request7) {
|
|
|
116191
116191
|
return await new Promise((resolve2, reject) => {
|
|
116192
116192
|
const chunks = [];
|
|
116193
116193
|
let total = 0;
|
|
116194
|
-
request7.on("data", (
|
|
116195
|
-
total +=
|
|
116194
|
+
request7.on("data", (chunk2) => {
|
|
116195
|
+
total += chunk2.length;
|
|
116196
116196
|
if (total > CONTROL_BODY_CAP_BYTES) {
|
|
116197
116197
|
request7.destroy();
|
|
116198
116198
|
reject(new Error("too large"));
|
|
116199
116199
|
return;
|
|
116200
116200
|
}
|
|
116201
|
-
chunks.push(
|
|
116201
|
+
chunks.push(chunk2);
|
|
116202
116202
|
});
|
|
116203
116203
|
request7.on("end", () => {
|
|
116204
116204
|
resolve2(Buffer.concat(chunks).toString("utf8"));
|
|
@@ -116482,8 +116482,8 @@ function realRcControlTransport(port, ca2) {
|
|
|
116482
116482
|
},
|
|
116483
116483
|
(response) => {
|
|
116484
116484
|
const chunks = [];
|
|
116485
|
-
response.on("data", (
|
|
116486
|
-
chunks.push(
|
|
116485
|
+
response.on("data", (chunk2) => {
|
|
116486
|
+
chunks.push(chunk2);
|
|
116487
116487
|
});
|
|
116488
116488
|
response.on("end", () => {
|
|
116489
116489
|
resolve2({ status: response.statusCode ?? 0, body: Buffer.concat(chunks).toString("utf8") });
|
|
@@ -116847,13 +116847,13 @@ async function listenFrontDoor(server, options = {}) {
|
|
|
116847
116847
|
}
|
|
116848
116848
|
}
|
|
116849
116849
|
async function* upstreamChunks(stream) {
|
|
116850
|
-
for await (const
|
|
116851
|
-
if (typeof
|
|
116852
|
-
yield Buffer.from(
|
|
116850
|
+
for await (const chunk2 of stream) {
|
|
116851
|
+
if (typeof chunk2 === "string") {
|
|
116852
|
+
yield Buffer.from(chunk2, "utf8");
|
|
116853
116853
|
continue;
|
|
116854
116854
|
}
|
|
116855
|
-
if (
|
|
116856
|
-
yield
|
|
116855
|
+
if (chunk2 instanceof Uint8Array) {
|
|
116856
|
+
yield chunk2;
|
|
116857
116857
|
}
|
|
116858
116858
|
}
|
|
116859
116859
|
}
|
|
@@ -117011,8 +117011,8 @@ function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PO
|
|
|
117011
117011
|
}
|
|
117012
117012
|
const request7 = https3.request(options, (response) => {
|
|
117013
117013
|
const chunks = [];
|
|
117014
|
-
response.on("data", (
|
|
117015
|
-
chunks.push(
|
|
117014
|
+
response.on("data", (chunk2) => {
|
|
117015
|
+
chunks.push(chunk2);
|
|
117016
117016
|
});
|
|
117017
117017
|
response.on("end", () => {
|
|
117018
117018
|
resolve2({ status: response.statusCode ?? HTTP_BAD_GATEWAY, body: Buffer.concat(chunks).toString("utf8") });
|
|
@@ -117092,8 +117092,8 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
117092
117092
|
});
|
|
117093
117093
|
const readAll = async (response) => {
|
|
117094
117094
|
const chunks = [];
|
|
117095
|
-
for await (const
|
|
117096
|
-
chunks.push(Buffer.from(
|
|
117095
|
+
for await (const chunk2 of upstreamChunks(response)) {
|
|
117096
|
+
chunks.push(Buffer.from(chunk2));
|
|
117097
117097
|
}
|
|
117098
117098
|
return Buffer.concat(chunks).toString("utf8");
|
|
117099
117099
|
};
|
|
@@ -117284,8 +117284,8 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
|
|
|
117284
117284
|
response.writeHead(upstreamResponse.statusCode ?? HTTP_BAD_GATEWAY, forwardableHeaders(upstreamResponse.headers));
|
|
117285
117285
|
response.flushHeaders();
|
|
117286
117286
|
if (observer !== void 0) {
|
|
117287
|
-
upstreamResponse.on("data", (
|
|
117288
|
-
observer.onResponseChunk(
|
|
117287
|
+
upstreamResponse.on("data", (chunk2) => {
|
|
117288
|
+
observer.onResponseChunk(chunk2);
|
|
117289
117289
|
});
|
|
117290
117290
|
}
|
|
117291
117291
|
upstreamResponse.pipe(response);
|
|
@@ -117301,8 +117301,8 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
|
|
|
117301
117301
|
response.end(body);
|
|
117302
117302
|
});
|
|
117303
117303
|
if (observer !== void 0) {
|
|
117304
|
-
request7.on("data", (
|
|
117305
|
-
observer.onRequestChunk(
|
|
117304
|
+
request7.on("data", (chunk2) => {
|
|
117305
|
+
observer.onRequestChunk(chunk2);
|
|
117306
117306
|
});
|
|
117307
117307
|
if (observer.onRequestEnd !== void 0) {
|
|
117308
117308
|
request7.on("end", () => {
|
|
@@ -118987,25 +118987,25 @@ var EventStreamDecoder = class {
|
|
|
118987
118987
|
// Last MAX_DELIMITER_OVERLAP characters of the pending text, prefixed to the
|
|
118988
118988
|
// next chunk so a delimiter straddling the boundary is still found.
|
|
118989
118989
|
tail = "";
|
|
118990
|
-
feed(
|
|
118990
|
+
feed(chunk2) {
|
|
118991
118991
|
if (this.pending.length === 0) {
|
|
118992
|
-
const first =
|
|
118992
|
+
const first = chunk2.charCodeAt(0);
|
|
118993
118993
|
if (first === LF2 || first === CR2) {
|
|
118994
|
-
|
|
118994
|
+
chunk2 = chunk2.replace(LEADING_LINE_ENDINGS_REGEX, "");
|
|
118995
118995
|
}
|
|
118996
118996
|
}
|
|
118997
|
-
if (
|
|
118997
|
+
if (chunk2 === "") {
|
|
118998
118998
|
return;
|
|
118999
118999
|
}
|
|
119000
|
-
const scan = this.tail +
|
|
119001
|
-
this.pending.push(
|
|
119000
|
+
const scan = this.tail + chunk2;
|
|
119001
|
+
this.pending.push(chunk2);
|
|
119002
119002
|
MESSAGE_DELIMITER_REGEX.lastIndex = 0;
|
|
119003
119003
|
let match = MESSAGE_DELIMITER_REGEX.exec(scan);
|
|
119004
119004
|
if (match === null) {
|
|
119005
119005
|
this.tail = scan.slice(-2);
|
|
119006
119006
|
return;
|
|
119007
119007
|
}
|
|
119008
|
-
const buffered = this.pending.length === 1 ?
|
|
119008
|
+
const buffered = this.pending.length === 1 ? chunk2 : this.pending.join("");
|
|
119009
119009
|
const offset = buffered.length - scan.length;
|
|
119010
119010
|
const parts = [];
|
|
119011
119011
|
let start = 0;
|
|
@@ -119038,8 +119038,8 @@ var EventStreamDecoderStream = class {
|
|
|
119038
119038
|
controller.enqueue(event);
|
|
119039
119039
|
});
|
|
119040
119040
|
},
|
|
119041
|
-
transform(
|
|
119042
|
-
decoder.feed(
|
|
119041
|
+
transform(chunk2) {
|
|
119042
|
+
decoder.feed(chunk2);
|
|
119043
119043
|
},
|
|
119044
119044
|
flush() {
|
|
119045
119045
|
decoder.end();
|
|
@@ -124449,13 +124449,13 @@ var RequestLimitHandlerPlugin = class {
|
|
|
124449
124449
|
let currentBodySize = 0;
|
|
124450
124450
|
const limitedStream = stream.pipeThrough(
|
|
124451
124451
|
new TransformStream({
|
|
124452
|
-
transform(
|
|
124453
|
-
currentBodySize +=
|
|
124452
|
+
transform(chunk2, controller) {
|
|
124453
|
+
currentBodySize += chunk2.byteLength;
|
|
124454
124454
|
if (currentBodySize > maxBodySize) {
|
|
124455
124455
|
controller.error(new ORPCError("PAYLOAD_TOO_LARGE"));
|
|
124456
124456
|
return;
|
|
124457
124457
|
}
|
|
124458
|
-
controller.enqueue(
|
|
124458
|
+
controller.enqueue(chunk2);
|
|
124459
124459
|
}
|
|
124460
124460
|
})
|
|
124461
124461
|
);
|
|
@@ -124511,8 +124511,8 @@ function toWebReadableStream(stream) {
|
|
|
124511
124511
|
}
|
|
124512
124512
|
});
|
|
124513
124513
|
}
|
|
124514
|
-
function readableChunkToBytes(stream,
|
|
124515
|
-
return typeof
|
|
124514
|
+
function readableChunkToBytes(stream, chunk2) {
|
|
124515
|
+
return typeof chunk2 === "string" ? import_node_buffer.Buffer.from(chunk2, stream.readableEncoding ?? "utf8") : chunk2;
|
|
124516
124516
|
}
|
|
124517
124517
|
async function _drainIterator(iterator) {
|
|
124518
124518
|
while (!(await iterator.next()).done) {
|
|
@@ -124628,16 +124628,16 @@ function _streamToFormData(stream, contentType) {
|
|
|
124628
124628
|
async function _streamToString(stream) {
|
|
124629
124629
|
const decoder = new TextDecoder();
|
|
124630
124630
|
let string4 = "";
|
|
124631
|
-
for await (const
|
|
124632
|
-
string4 += decoder.decode(readableChunkToBytes(stream,
|
|
124631
|
+
for await (const chunk2 of stream) {
|
|
124632
|
+
string4 += decoder.decode(readableChunkToBytes(stream, chunk2), { stream: true });
|
|
124633
124633
|
}
|
|
124634
124634
|
string4 += decoder.decode();
|
|
124635
124635
|
return string4;
|
|
124636
124636
|
}
|
|
124637
124637
|
async function _streamToFile(stream, fileName, contentType) {
|
|
124638
124638
|
const chunks = [];
|
|
124639
|
-
for await (const
|
|
124640
|
-
chunks.push(readableChunkToBytes(stream,
|
|
124639
|
+
for await (const chunk2 of stream) {
|
|
124640
|
+
chunks.push(readableChunkToBytes(stream, chunk2));
|
|
124641
124641
|
}
|
|
124642
124642
|
return new File(chunks, fileName, { type: contentType });
|
|
124643
124643
|
}
|
|
@@ -127485,11 +127485,11 @@ async function collectBody(body) {
|
|
|
127485
127485
|
resolve2(result);
|
|
127486
127486
|
}
|
|
127487
127487
|
};
|
|
127488
|
-
body.on("data", (
|
|
127488
|
+
body.on("data", (chunk2) => {
|
|
127489
127489
|
if (settled) {
|
|
127490
127490
|
return;
|
|
127491
127491
|
}
|
|
127492
|
-
const piece = typeof
|
|
127492
|
+
const piece = typeof chunk2 === "string" ? Buffer.from(chunk2) : chunk2 instanceof Uint8Array ? Buffer.from(chunk2) : void 0;
|
|
127493
127493
|
if (piece === void 0) {
|
|
127494
127494
|
settle2({ kind: "failed" });
|
|
127495
127495
|
return;
|
|
@@ -127539,11 +127539,11 @@ async function hopOnce(request7, response, target, body, mayRetry) {
|
|
|
127539
127539
|
response.flush();
|
|
127540
127540
|
const stream = async () => {
|
|
127541
127541
|
try {
|
|
127542
|
-
for await (const
|
|
127542
|
+
for await (const chunk2 of upstreamChunks(upstreamResponse)) {
|
|
127543
127543
|
if (request7.signal.aborted) {
|
|
127544
127544
|
break;
|
|
127545
127545
|
}
|
|
127546
|
-
await response.write(
|
|
127546
|
+
await response.write(chunk2);
|
|
127547
127547
|
}
|
|
127548
127548
|
if (!request7.signal.aborted) {
|
|
127549
127549
|
response.end();
|
|
@@ -127677,13 +127677,13 @@ function createRoutedResponse(response, context) {
|
|
|
127677
127677
|
flush: () => {
|
|
127678
127678
|
response.flushHeaders();
|
|
127679
127679
|
},
|
|
127680
|
-
write: async (
|
|
127680
|
+
write: async (chunk2) => {
|
|
127681
127681
|
if (response.destroyed || response.writableEnded) {
|
|
127682
127682
|
return;
|
|
127683
127683
|
}
|
|
127684
|
-
const accepted = response.write(
|
|
127684
|
+
const accepted = response.write(chunk2);
|
|
127685
127685
|
if (bodyObservers.length > 0) {
|
|
127686
|
-
const bytes = typeof
|
|
127686
|
+
const bytes = typeof chunk2 === "string" ? Buffer.from(chunk2, "utf8") : chunk2;
|
|
127687
127687
|
observeBody((observer) => {
|
|
127688
127688
|
observer.chunk(bytes);
|
|
127689
127689
|
});
|
|
@@ -128653,8 +128653,8 @@ async function* parseSse(body) {
|
|
|
128653
128653
|
} catch {
|
|
128654
128654
|
}
|
|
128655
128655
|
};
|
|
128656
|
-
for await (const
|
|
128657
|
-
buffer2 += decoder.decode(
|
|
128656
|
+
for await (const chunk2 of body) {
|
|
128657
|
+
buffer2 += decoder.decode(chunk2, { stream: true });
|
|
128658
128658
|
let newline = buffer2.indexOf("\n");
|
|
128659
128659
|
while (newline !== -1) {
|
|
128660
128660
|
const line = buffer2.slice(0, newline).replace(/\r$/, "");
|
|
@@ -129109,15 +129109,15 @@ var BodyTooLargeError = class extends Error {
|
|
|
129109
129109
|
async function readBody2(request7) {
|
|
129110
129110
|
const chunks = [];
|
|
129111
129111
|
let size = 0;
|
|
129112
|
-
for await (const
|
|
129113
|
-
if (!Buffer.isBuffer(
|
|
129112
|
+
for await (const chunk2 of request7.body) {
|
|
129113
|
+
if (!Buffer.isBuffer(chunk2)) {
|
|
129114
129114
|
throw new TypeError("request body chunk was not a Buffer");
|
|
129115
129115
|
}
|
|
129116
|
-
size +=
|
|
129116
|
+
size += chunk2.length;
|
|
129117
129117
|
if (size > CODEX_MAX_BODY_BYTES) {
|
|
129118
129118
|
throw new BodyTooLargeError();
|
|
129119
129119
|
}
|
|
129120
|
-
chunks.push(
|
|
129120
|
+
chunks.push(chunk2);
|
|
129121
129121
|
}
|
|
129122
129122
|
return Buffer.concat(chunks).toString("utf8");
|
|
129123
129123
|
}
|
|
@@ -129128,11 +129128,11 @@ async function writeRouteResponse(routed, response, signal) {
|
|
|
129128
129128
|
response.end();
|
|
129129
129129
|
return;
|
|
129130
129130
|
}
|
|
129131
|
-
for await (const
|
|
129131
|
+
for await (const chunk2 of routed.body) {
|
|
129132
129132
|
if (signal.aborted) {
|
|
129133
129133
|
return;
|
|
129134
129134
|
}
|
|
129135
|
-
await response.write(
|
|
129135
|
+
await response.write(chunk2);
|
|
129136
129136
|
}
|
|
129137
129137
|
response.end();
|
|
129138
129138
|
}
|
|
@@ -129225,20 +129225,20 @@ function createAntigravityRelay(params) {
|
|
|
129225
129225
|
activeBlockType = void 0;
|
|
129226
129226
|
}
|
|
129227
129227
|
};
|
|
129228
|
-
const pushChunk = (
|
|
129228
|
+
const pushChunk = (chunk2) => {
|
|
129229
129229
|
frames.length = 0;
|
|
129230
129230
|
ensureStarted();
|
|
129231
|
-
if (
|
|
129232
|
-
const cached2 =
|
|
129233
|
-
const promptTotal =
|
|
129231
|
+
if (chunk2.usageMetadata !== void 0) {
|
|
129232
|
+
const cached2 = chunk2.usageMetadata.cachedContentTokenCount ?? 0;
|
|
129233
|
+
const promptTotal = chunk2.usageMetadata.promptTokenCount ?? usage.input_tokens + cached2;
|
|
129234
129234
|
usage = {
|
|
129235
129235
|
input_tokens: Math.max(0, promptTotal - cached2),
|
|
129236
129236
|
cache_creation_input_tokens: 0,
|
|
129237
129237
|
cache_read_input_tokens: cached2,
|
|
129238
|
-
output_tokens:
|
|
129238
|
+
output_tokens: chunk2.usageMetadata.candidatesTokenCount ?? usage.output_tokens
|
|
129239
129239
|
};
|
|
129240
129240
|
}
|
|
129241
|
-
const candidate =
|
|
129241
|
+
const candidate = chunk2.candidates?.[0];
|
|
129242
129242
|
if (candidate?.content?.parts !== void 0) {
|
|
129243
129243
|
for (const part of candidate.content.parts) {
|
|
129244
129244
|
if ("text" in part && typeof part.text === "string" && (part.thoughtSignature === void 0 || part.text.length > 0)) {
|
|
@@ -129724,15 +129724,15 @@ var BodyTooLargeError2 = class extends Error {
|
|
|
129724
129724
|
async function readBody3(request7) {
|
|
129725
129725
|
const chunks = [];
|
|
129726
129726
|
let size = 0;
|
|
129727
|
-
for await (const
|
|
129728
|
-
if (!Buffer.isBuffer(
|
|
129727
|
+
for await (const chunk2 of request7.body) {
|
|
129728
|
+
if (!Buffer.isBuffer(chunk2)) {
|
|
129729
129729
|
throw new TypeError("request body chunk was not a Buffer");
|
|
129730
129730
|
}
|
|
129731
|
-
size +=
|
|
129731
|
+
size += chunk2.length;
|
|
129732
129732
|
if (size > ANTIGRAVITY_MAX_BODY_BYTES) {
|
|
129733
129733
|
throw new BodyTooLargeError2();
|
|
129734
129734
|
}
|
|
129735
|
-
chunks.push(
|
|
129735
|
+
chunks.push(chunk2);
|
|
129736
129736
|
}
|
|
129737
129737
|
return Buffer.concat(chunks).toString("utf8");
|
|
129738
129738
|
}
|
|
@@ -129743,11 +129743,11 @@ async function writeRouteResponse2(routed, response, signal) {
|
|
|
129743
129743
|
response.end();
|
|
129744
129744
|
return;
|
|
129745
129745
|
}
|
|
129746
|
-
for await (const
|
|
129746
|
+
for await (const chunk2 of routed.body) {
|
|
129747
129747
|
if (signal.aborted) {
|
|
129748
129748
|
return;
|
|
129749
129749
|
}
|
|
129750
|
-
await response.write(
|
|
129750
|
+
await response.write(chunk2);
|
|
129751
129751
|
}
|
|
129752
129752
|
response.end();
|
|
129753
129753
|
}
|
|
@@ -129823,11 +129823,11 @@ function createPassthroughRoute(name, target) {
|
|
|
129823
129823
|
response.flush();
|
|
129824
129824
|
const stream = async () => {
|
|
129825
129825
|
try {
|
|
129826
|
-
for await (const
|
|
129826
|
+
for await (const chunk2 of upstreamChunks(upstreamResponse)) {
|
|
129827
129827
|
if (request7.signal.aborted) {
|
|
129828
129828
|
return;
|
|
129829
129829
|
}
|
|
129830
|
-
await response.write(
|
|
129830
|
+
await response.write(chunk2);
|
|
129831
129831
|
}
|
|
129832
129832
|
response.end();
|
|
129833
129833
|
} catch {
|
|
@@ -129886,8 +129886,8 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
129886
129886
|
const settle2 = () => {
|
|
129887
129887
|
const model = modelIn();
|
|
129888
129888
|
const hasImage = /"type"\s*:\s*"image"/.test(text2);
|
|
129889
|
-
for (const
|
|
129890
|
-
replay.write(
|
|
129889
|
+
for (const chunk2 of head) {
|
|
129890
|
+
replay.write(chunk2);
|
|
129891
129891
|
}
|
|
129892
129892
|
const maxTokens = /"max_tokens"\s*:\s*([0-9]+)/.exec(text2)?.[1];
|
|
129893
129893
|
resolve2({
|
|
@@ -129901,9 +129901,9 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
129901
129901
|
replayed: { ...request7, body: replay }
|
|
129902
129902
|
});
|
|
129903
129903
|
};
|
|
129904
|
-
body.on("data", (
|
|
129904
|
+
body.on("data", (chunk2) => {
|
|
129905
129905
|
if (decided) {
|
|
129906
|
-
if (!replay.write(
|
|
129906
|
+
if (!replay.write(chunk2)) {
|
|
129907
129907
|
body.pause();
|
|
129908
129908
|
replay.once("drain", () => {
|
|
129909
129909
|
body.resume();
|
|
@@ -129911,9 +129911,9 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
129911
129911
|
}
|
|
129912
129912
|
return;
|
|
129913
129913
|
}
|
|
129914
|
-
head.push(
|
|
129915
|
-
seen +=
|
|
129916
|
-
text2 +=
|
|
129914
|
+
head.push(chunk2);
|
|
129915
|
+
seen += chunk2.length;
|
|
129916
|
+
text2 += chunk2.toString("utf8");
|
|
129917
129917
|
if (!wholeBody && (modelIn() !== void 0 || seen >= REQUEST_SCAN_CAP_BYTES)) {
|
|
129918
129918
|
decided = true;
|
|
129919
129919
|
body.pause();
|
|
@@ -131796,12 +131796,12 @@ function readableContentType(contentType) {
|
|
|
131796
131796
|
async function readCapped(chunks) {
|
|
131797
131797
|
const collected = [];
|
|
131798
131798
|
let total = 0;
|
|
131799
|
-
for await (const
|
|
131800
|
-
total +=
|
|
131799
|
+
for await (const chunk2 of chunks) {
|
|
131800
|
+
total += chunk2.byteLength;
|
|
131801
131801
|
if (total > RC_WEB_FETCH_MAX_BYTES) {
|
|
131802
131802
|
return { tooLarge: true, text: "" };
|
|
131803
131803
|
}
|
|
131804
|
-
collected.push(Buffer.from(
|
|
131804
|
+
collected.push(Buffer.from(chunk2));
|
|
131805
131805
|
}
|
|
131806
131806
|
return { tooLarge: false, text: Buffer.concat(collected).toString("utf8") };
|
|
131807
131807
|
}
|
|
@@ -132011,14 +132011,14 @@ async function readBody4(request7, capBytes) {
|
|
|
132011
132011
|
return await new Promise((resolve2, reject) => {
|
|
132012
132012
|
const chunks = [];
|
|
132013
132013
|
let total = 0;
|
|
132014
|
-
request7.on("data", (
|
|
132015
|
-
total +=
|
|
132014
|
+
request7.on("data", (chunk2) => {
|
|
132015
|
+
total += chunk2.length;
|
|
132016
132016
|
if (total > capBytes) {
|
|
132017
132017
|
request7.destroy();
|
|
132018
132018
|
reject(new Error("body too large"));
|
|
132019
132019
|
return;
|
|
132020
132020
|
}
|
|
132021
|
-
chunks.push(
|
|
132021
|
+
chunks.push(chunk2);
|
|
132022
132022
|
});
|
|
132023
132023
|
request7.on("end", () => {
|
|
132024
132024
|
resolve2(Buffer.concat(chunks).toString("utf8"));
|
|
@@ -132786,10 +132786,10 @@ function createRcStreamHub(deps) {
|
|
|
132786
132786
|
}
|
|
132787
132787
|
deps.log?.(`rc stream ${attachment.sessionId}: attached as client ${attachment.clientId}${resume === void 0 ? ", reading from the stream's own head" : `, resuming after sequence number ${String(resume.fromSequenceNum)}`}`);
|
|
132788
132788
|
const parser = createSseParser();
|
|
132789
|
-
for await (const
|
|
132789
|
+
for await (const chunk2 of answer.chunks) {
|
|
132790
132790
|
attachment.controller.signal.throwIfAborted();
|
|
132791
132791
|
let lastEventId;
|
|
132792
|
-
for (const parsed of parser.write(Buffer.from(
|
|
132792
|
+
for (const parsed of parser.write(Buffer.from(chunk2).toString("utf8"))) {
|
|
132793
132793
|
const envelope = parseRcStreamEnvelope(parsed);
|
|
132794
132794
|
if (envelope === void 0) {
|
|
132795
132795
|
continue;
|
|
@@ -133688,8 +133688,8 @@ var realHeadroomGet = async (target, requestPath, timeoutMs) => {
|
|
|
133688
133688
|
return await new Promise((resolve2, reject) => {
|
|
133689
133689
|
const request7 = import_node_http4.default.request({ socketPath: target.socketPath, path: requestPath, method: "GET", headers: { accept: "application/json", host: "localhost" }, timeout: timeoutMs }, (response) => {
|
|
133690
133690
|
const chunks = [];
|
|
133691
|
-
response.on("data", (
|
|
133692
|
-
chunks.push(
|
|
133691
|
+
response.on("data", (chunk2) => {
|
|
133692
|
+
chunks.push(chunk2);
|
|
133693
133693
|
});
|
|
133694
133694
|
response.on("end", () => {
|
|
133695
133695
|
resolve2({ status: response.statusCode ?? 0, text: Buffer.concat(chunks).toString("utf8") });
|
|
@@ -133907,6 +133907,84 @@ function providerScopedState(snapshot, providerName, providerDisplayName) {
|
|
|
133907
133907
|
return void 0;
|
|
133908
133908
|
}
|
|
133909
133909
|
|
|
133910
|
+
// src/statusline/ansi.ts
|
|
133911
|
+
var ESCAPE_CHAR_CODE = 27;
|
|
133912
|
+
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
133913
|
+
var ANSI_REGEX = new RegExp(`${ESCAPE}\\[[0-9;]*[a-zA-Z]`, "g");
|
|
133914
|
+
function visibleLength(text2) {
|
|
133915
|
+
return text2.replace(ANSI_REGEX, "").length;
|
|
133916
|
+
}
|
|
133917
|
+
|
|
133918
|
+
// src/statusline/barGrid.ts
|
|
133919
|
+
var BRACKET_COLUMNS = 2;
|
|
133920
|
+
function chunk(items, size) {
|
|
133921
|
+
const chunks = [];
|
|
133922
|
+
for (let start = 0; start < items.length; start += size) {
|
|
133923
|
+
chunks.push(items.slice(start, start + size));
|
|
133924
|
+
}
|
|
133925
|
+
return chunks;
|
|
133926
|
+
}
|
|
133927
|
+
function lastColumnOf(index, rowLength, columns) {
|
|
133928
|
+
return index === rowLength - 1 ? columns - 1 : index;
|
|
133929
|
+
}
|
|
133930
|
+
function measureGrid(rows, separatorLength, baseBarCells) {
|
|
133931
|
+
const columns = Math.max(...rows.map((row) => row.length));
|
|
133932
|
+
const prefixWidths = Array.from({ length: columns }, () => 0);
|
|
133933
|
+
const suffixWidths = Array.from({ length: columns }, () => 0);
|
|
133934
|
+
for (const row of rows) {
|
|
133935
|
+
row.forEach((cell, index) => {
|
|
133936
|
+
const last = lastColumnOf(index, row.length, columns);
|
|
133937
|
+
prefixWidths[index] = Math.max(prefixWidths[index] ?? 0, visibleLength(cell.prefix));
|
|
133938
|
+
suffixWidths[last] = Math.max(suffixWidths[last] ?? 0, visibleLength(cell.suffix));
|
|
133939
|
+
});
|
|
133940
|
+
}
|
|
133941
|
+
const fixed = [...prefixWidths, ...suffixWidths].reduce((total, width) => total + width, 0) + columns * (baseBarCells + BRACKET_COLUMNS);
|
|
133942
|
+
return { rows, columns, prefixWidths, suffixWidths, baseWidth: fixed + separatorLength * (columns - 1) };
|
|
133943
|
+
}
|
|
133944
|
+
function padTo(text2, width) {
|
|
133945
|
+
return text2 + " ".repeat(Math.max(0, width - visibleLength(text2)));
|
|
133946
|
+
}
|
|
133947
|
+
function renderGrid(grid, maxWidth, separator, baseBarCells) {
|
|
133948
|
+
const separatorLength = visibleLength(separator);
|
|
133949
|
+
const spare = Math.max(0, maxWidth - grid.baseWidth);
|
|
133950
|
+
const barCells = Array.from({ length: grid.columns }, (_, column) => baseBarCells + Math.floor(spare / grid.columns) + (column < spare % grid.columns ? 1 : 0));
|
|
133951
|
+
const blockWidths = barCells.map((cells) => cells + BRACKET_COLUMNS);
|
|
133952
|
+
return grid.rows.map(
|
|
133953
|
+
(row) => row.map((cell, index) => {
|
|
133954
|
+
const last = lastColumnOf(index, row.length, grid.columns);
|
|
133955
|
+
let blockWidth = blockWidths[index] ?? 0;
|
|
133956
|
+
for (let column = index + 1; column <= last; column += 1) {
|
|
133957
|
+
blockWidth += separatorLength + (grid.suffixWidths[column - 1] ?? 0) + (grid.prefixWidths[column] ?? 0) + (blockWidths[column] ?? 0);
|
|
133958
|
+
}
|
|
133959
|
+
const prefix = padTo(cell.prefix, grid.prefixWidths[index] ?? 0);
|
|
133960
|
+
const bar = cell.draw(blockWidth - BRACKET_COLUMNS);
|
|
133961
|
+
const suffix = index === row.length - 1 ? cell.suffix : padTo(cell.suffix, grid.suffixWidths[last] ?? 0);
|
|
133962
|
+
return `${prefix}${bar}${suffix}`;
|
|
133963
|
+
}).join(separator)
|
|
133964
|
+
);
|
|
133965
|
+
}
|
|
133966
|
+
function layoutBarGrid(groups, maxWidth, separator, baseBarCells) {
|
|
133967
|
+
const nonEmpty = groups.filter((group) => group.length > 0);
|
|
133968
|
+
if (nonEmpty.length === 0) {
|
|
133969
|
+
return [];
|
|
133970
|
+
}
|
|
133971
|
+
const separatorLength = visibleLength(separator);
|
|
133972
|
+
const widest = Math.max(...nonEmpty.map((group) => group.length));
|
|
133973
|
+
const layoutFor = (perRow) => measureGrid(nonEmpty.flatMap((group) => chunk(group, perRow)), separatorLength, baseBarCells);
|
|
133974
|
+
const candidates = [measureGrid([nonEmpty.flat()], separatorLength, baseBarCells)];
|
|
133975
|
+
for (let perRow = widest; perRow > 1; perRow -= 1) {
|
|
133976
|
+
candidates.push(layoutFor(perRow));
|
|
133977
|
+
}
|
|
133978
|
+
const fitting = candidates.find((grid) => grid.baseWidth <= maxWidth);
|
|
133979
|
+
if (fitting !== void 0) {
|
|
133980
|
+
return renderGrid(fitting, maxWidth, separator, baseBarCells);
|
|
133981
|
+
}
|
|
133982
|
+
if (nonEmpty.length > 1) {
|
|
133983
|
+
return nonEmpty.flatMap((group) => layoutBarGrid([group], maxWidth, separator, baseBarCells));
|
|
133984
|
+
}
|
|
133985
|
+
return renderGrid(layoutFor(1), maxWidth, separator, baseBarCells);
|
|
133986
|
+
}
|
|
133987
|
+
|
|
133910
133988
|
// src/statusline/render.ts
|
|
133911
133989
|
var BAR_WIDTH = 10;
|
|
133912
133990
|
var SECONDS_PER_MINUTE2 = 60;
|
|
@@ -133922,17 +134000,11 @@ var FULL_PERCENT2 = 100;
|
|
|
133922
134000
|
var ONE_PERCENT = 1;
|
|
133923
134001
|
var USED_RED_AT = 0.9;
|
|
133924
134002
|
var USED_YELLOW_AT = 0.7;
|
|
133925
|
-
var ESCAPE_CHAR_CODE = 27;
|
|
133926
|
-
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
133927
134003
|
var RESET = `${ESCAPE}[0m`;
|
|
133928
134004
|
var DIM = `${ESCAPE}[90m`;
|
|
133929
134005
|
var GREEN = `${ESCAPE}[32m`;
|
|
133930
134006
|
var YELLOW = `${ESCAPE}[33m`;
|
|
133931
134007
|
var RED = `${ESCAPE}[31m`;
|
|
133932
|
-
var ANSI_REGEX = new RegExp(`${ESCAPE}\\[[0-9;]*[a-zA-Z]`, "g");
|
|
133933
|
-
function visibleLength(text2) {
|
|
133934
|
-
return text2.replace(ANSI_REGEX, "").length;
|
|
133935
|
-
}
|
|
133936
134008
|
function colorize() {
|
|
133937
134009
|
return process.env.NO_COLOR === void 0;
|
|
133938
134010
|
}
|
|
@@ -134059,69 +134131,30 @@ function secondsUntil(resetAt, nowMs) {
|
|
|
134059
134131
|
const resetMs = Date.parse(resetAt);
|
|
134060
134132
|
return Number.isNaN(resetMs) ? void 0 : Math.max(0, Math.round((resetMs - nowMs) / THOUSAND));
|
|
134061
134133
|
}
|
|
134062
|
-
|
|
134063
|
-
|
|
134064
|
-
|
|
134065
|
-
|
|
134066
|
-
|
|
134067
|
-
this.suffix = suffix;
|
|
134068
|
-
this.fraction = fraction;
|
|
134069
|
-
this.isUsed = isUsed;
|
|
134070
|
-
}
|
|
134071
|
-
kind;
|
|
134072
|
-
text;
|
|
134073
|
-
prefix;
|
|
134074
|
-
suffix;
|
|
134075
|
-
fraction;
|
|
134076
|
-
isUsed;
|
|
134077
|
-
baseLength(baseBarWidth) {
|
|
134078
|
-
if (this.kind === "static") {
|
|
134079
|
-
return visibleLength(this.text);
|
|
134080
|
-
}
|
|
134081
|
-
return visibleLength(this.prefix) + baseBarWidth + 2 + visibleLength(this.suffix);
|
|
134082
|
-
}
|
|
134083
|
-
render(barWidth) {
|
|
134084
|
-
if (this.kind === "static") {
|
|
134085
|
-
return this.text;
|
|
134086
|
-
}
|
|
134087
|
-
const clamped = Math.max(0, Math.min(1, this.fraction));
|
|
134088
|
-
const filled = Math.round(clamped * barWidth);
|
|
134089
|
-
const color = statusColor(clamped, this.isUsed);
|
|
134090
|
-
const bar = color === "" ? `[${"\u2588".repeat(filled)}${"\u2591".repeat(barWidth - filled)}]` : `[${color}${"\u2588".repeat(filled)}${DIM}${"\u2591".repeat(barWidth - filled)}${RESET}]`;
|
|
134091
|
-
return `${this.prefix}${bar}${this.suffix}`;
|
|
134092
|
-
}
|
|
134093
|
-
};
|
|
134094
|
-
function renderLineWithExtra(segments, maxWidth, separator, baseBarWidth) {
|
|
134095
|
-
const separatorLength = visibleLength(separator);
|
|
134096
|
-
const bars = segments.filter((segment) => segment.kind === "bar");
|
|
134097
|
-
const lineBase = segments.reduce((total, segment) => total + segment.baseLength(baseBarWidth), 0) + separatorLength * (segments.length - 1);
|
|
134098
|
-
const extra = Math.max(0, maxWidth - lineBase);
|
|
134099
|
-
const extraById = /* @__PURE__ */ new Map();
|
|
134100
|
-
if (bars.length > 0 && extra > 0) {
|
|
134101
|
-
const perBar = Math.floor(extra / bars.length);
|
|
134102
|
-
const remainder = extra % bars.length;
|
|
134103
|
-
bars.forEach((bar, index) => {
|
|
134104
|
-
extraById.set(bar, perBar + (index < remainder ? 1 : 0));
|
|
134105
|
-
});
|
|
134106
|
-
}
|
|
134107
|
-
return segments.map((segment) => segment.render(baseBarWidth + (extraById.get(segment) ?? 0))).join(separator);
|
|
134134
|
+
function drawBar(fraction, cells) {
|
|
134135
|
+
const clamped = Math.max(0, Math.min(1, fraction));
|
|
134136
|
+
const filled = Math.round(clamped * cells);
|
|
134137
|
+
const color = statusColor(clamped, true);
|
|
134138
|
+
return color === "" ? `[${"\u2588".repeat(filled)}${"\u2591".repeat(cells - filled)}]` : `[${color}${"\u2588".repeat(filled)}${DIM}${"\u2591".repeat(cells - filled)}${RESET}]`;
|
|
134108
134139
|
}
|
|
134109
|
-
function
|
|
134110
|
-
|
|
134111
|
-
|
|
134112
|
-
|
|
134140
|
+
function barCell(prefix, suffix, fraction) {
|
|
134141
|
+
return { prefix, suffix, draw: (cells) => drawBar(fraction, cells) };
|
|
134142
|
+
}
|
|
134143
|
+
function justify(texts, maxWidth, separator) {
|
|
134144
|
+
if (texts.length < 2) {
|
|
134145
|
+
return texts.join(separator);
|
|
134113
134146
|
}
|
|
134114
134147
|
const separatorLength = visibleLength(separator);
|
|
134115
|
-
const total =
|
|
134148
|
+
const total = texts.reduce((sum, text2) => sum + visibleLength(text2), 0) + separatorLength * (texts.length - 1);
|
|
134116
134149
|
const spare = maxWidth - total;
|
|
134117
134150
|
if (spare <= 0) {
|
|
134118
|
-
return
|
|
134151
|
+
return texts.join(separator);
|
|
134119
134152
|
}
|
|
134120
|
-
const gaps =
|
|
134153
|
+
const gaps = texts.length - 1;
|
|
134121
134154
|
const extraPerGap = Math.floor(spare / gaps);
|
|
134122
134155
|
let remainder = spare % gaps;
|
|
134123
134156
|
const parts = [];
|
|
134124
|
-
|
|
134157
|
+
texts.forEach((text2, index) => {
|
|
134125
134158
|
if (index > 0) {
|
|
134126
134159
|
const extra = extraPerGap + (remainder > 0 ? 1 : 0);
|
|
134127
134160
|
if (remainder > 0) {
|
|
@@ -134130,82 +134163,55 @@ function justifySegments(segments, maxWidth, separator, baseBarWidth) {
|
|
|
134130
134163
|
const left = Math.floor(extra / 2);
|
|
134131
134164
|
parts.push(`${" ".repeat(left + 1)}|${" ".repeat(extra - left + 1)}`);
|
|
134132
134165
|
}
|
|
134133
|
-
parts.push(
|
|
134166
|
+
parts.push(text2);
|
|
134134
134167
|
});
|
|
134135
134168
|
return parts.join("");
|
|
134136
134169
|
}
|
|
134137
|
-
function
|
|
134170
|
+
function layoutHeader(texts, maxWidth, separator) {
|
|
134138
134171
|
const separatorLength = visibleLength(separator);
|
|
134139
134172
|
const lines = [];
|
|
134140
134173
|
let current = [];
|
|
134141
134174
|
let currentWidth = 0;
|
|
134142
|
-
for (const
|
|
134143
|
-
const width =
|
|
134175
|
+
for (const text2 of texts) {
|
|
134176
|
+
const width = visibleLength(text2);
|
|
134144
134177
|
const added = current.length === 0 ? width : width + separatorLength;
|
|
134145
134178
|
if (current.length > 0 && currentWidth + added > maxWidth) {
|
|
134146
134179
|
lines.push(current);
|
|
134147
|
-
current = [
|
|
134180
|
+
current = [text2];
|
|
134148
134181
|
currentWidth = width;
|
|
134149
134182
|
} else {
|
|
134150
|
-
current.push(
|
|
134183
|
+
current.push(text2);
|
|
134151
134184
|
currentWidth += added;
|
|
134152
134185
|
}
|
|
134153
134186
|
}
|
|
134154
134187
|
if (current.length > 0) {
|
|
134155
134188
|
lines.push(current);
|
|
134156
134189
|
}
|
|
134157
|
-
return lines.map((line) =>
|
|
134158
|
-
}
|
|
134159
|
-
function layoutGrouped(group1, group2, maxWidth, fillMode, separator, baseBarWidth) {
|
|
134160
|
-
const separatorLength = visibleLength(separator);
|
|
134161
|
-
const allSegments = [...group1, ...group2];
|
|
134162
|
-
if (allSegments.length === 0) {
|
|
134163
|
-
return "";
|
|
134164
|
-
}
|
|
134165
|
-
const fillUnwrapped = fillMode === "always";
|
|
134166
|
-
const fillWrapped = fillMode === "always" || fillMode === "wrapped";
|
|
134167
|
-
const totalBase = allSegments.reduce((total, segment) => total + segment.baseLength(baseBarWidth), 0) + separatorLength * (allSegments.length - 1);
|
|
134168
|
-
if (totalBase <= maxWidth) {
|
|
134169
|
-
if (fillUnwrapped) {
|
|
134170
|
-
return renderLineWithExtra(allSegments, maxWidth, separator, baseBarWidth);
|
|
134171
|
-
}
|
|
134172
|
-
return justifySegments(allSegments, maxWidth, separator, baseBarWidth);
|
|
134173
|
-
}
|
|
134174
|
-
const lines = [group1, group2].map((group) => {
|
|
134175
|
-
if (group.length === 0) {
|
|
134176
|
-
return "";
|
|
134177
|
-
}
|
|
134178
|
-
const groupBase = group.reduce((total, segment) => total + segment.baseLength(baseBarWidth), 0) + separatorLength * (group.length - 1);
|
|
134179
|
-
if (groupBase <= maxWidth) {
|
|
134180
|
-
return fillWrapped ? renderLineWithExtra(group, maxWidth, separator, baseBarWidth) : group.map((segment) => segment.render(baseBarWidth)).join(separator);
|
|
134181
|
-
}
|
|
134182
|
-
return packSegments(group, maxWidth, separator, baseBarWidth, fillWrapped).join("\n");
|
|
134183
|
-
});
|
|
134184
|
-
return lines.filter((line) => line !== "").join("\n");
|
|
134190
|
+
return lines.map((line) => justify(line, maxWidth, separator)).join("\n");
|
|
134185
134191
|
}
|
|
134186
134192
|
function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
|
|
134187
134193
|
const header = [];
|
|
134188
134194
|
if (view.modelDisplayName !== void 0 && view.modelDisplayName !== "") {
|
|
134189
|
-
header.push(
|
|
134195
|
+
header.push(view.modelDisplayName);
|
|
134190
134196
|
}
|
|
134191
134197
|
if (summary.provider !== void 0) {
|
|
134192
134198
|
const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
|
|
134193
|
-
header.push(
|
|
134199
|
+
header.push(account.length > 0 ? `${summary.provider} \xB7 ${account.join(" \xB7 ")}` : summary.provider);
|
|
134194
134200
|
}
|
|
134195
134201
|
const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
|
|
134196
134202
|
const loginOrgName = summary.loginOrganizationType === "claude_team" || summary.loginOrganizationType === "claude_enterprise" ? summary.loginOrganizationName : void 0;
|
|
134197
134203
|
const loginParts = [summary.loginAccountEmail, loginOrgName, loginPlan].filter((part) => part !== void 0);
|
|
134198
134204
|
if (summary.loginAccountEmail !== void 0 && summary.loginAccountEmail !== summary.providerAccountEmail) {
|
|
134199
|
-
header.push(
|
|
134205
|
+
header.push(loginParts.join(" \xB7 "));
|
|
134200
134206
|
} else if (summary.provider === void 0 && loginParts.length > 0) {
|
|
134201
|
-
header.push(
|
|
134207
|
+
header.push(loginParts.join(" \xB7 "));
|
|
134202
134208
|
}
|
|
134203
134209
|
if (summary.identity !== void 0 && summary.provider !== void 0 && summary.identity !== summary.providerAccountEmail && summary.identity !== summary.loginAccountEmail) {
|
|
134204
|
-
header.push(
|
|
134210
|
+
header.push(summary.identity);
|
|
134205
134211
|
}
|
|
134206
134212
|
const savings = headroomText(summary.headroom);
|
|
134207
134213
|
if (savings !== void 0) {
|
|
134208
|
-
header.push(
|
|
134214
|
+
header.push(savings);
|
|
134209
134215
|
}
|
|
134210
134216
|
const contextGroup = [];
|
|
134211
134217
|
if (view.contextUsedPercentage !== void 0) {
|
|
@@ -134214,13 +134220,13 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
|
|
|
134214
134220
|
const percent2 = `${color}${view.contextUsedPercentage.toFixed(1)}%${RESET}`;
|
|
134215
134221
|
const tokens = view.contextTotalTokens !== void 0 && view.contextWindowTokens !== void 0 ? `${formatTokens(view.contextTotalTokens)}/${formatTokens(view.contextWindowTokens)} ` : "";
|
|
134216
134222
|
const cache = cacheShareText(view);
|
|
134217
|
-
contextGroup.push(
|
|
134223
|
+
contextGroup.push(barCell(`Ctx ${tokens}`, ` ${percent2}${cache}`, fraction));
|
|
134218
134224
|
}
|
|
134219
134225
|
const quotaGroup = [];
|
|
134220
134226
|
const drawWindow = (label, fraction, resetsAt) => {
|
|
134221
134227
|
const clamped = Math.max(0, Math.min(1, fraction));
|
|
134222
134228
|
const color = statusColor(clamped, true);
|
|
134223
|
-
quotaGroup.push(
|
|
134229
|
+
quotaGroup.push(barCell(`${label} `, ` ${color}${(fraction * FULL_PERCENT2).toFixed(1)}%${RESET} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped));
|
|
134224
134230
|
};
|
|
134225
134231
|
if (summary.quotaFamilies.length > 0) {
|
|
134226
134232
|
for (const window of summary.quotaFamilies) {
|
|
@@ -134242,12 +134248,9 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
|
|
|
134242
134248
|
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
134243
134249
|
const lines = [];
|
|
134244
134250
|
if (header.length > 0) {
|
|
134245
|
-
lines.push(
|
|
134246
|
-
}
|
|
134247
|
-
const body = layoutGrouped(contextGroup, quotaGroup, width, "always", SEPARATOR2, BAR_WIDTH);
|
|
134248
|
-
if (body !== "") {
|
|
134249
|
-
lines.push(body);
|
|
134251
|
+
lines.push(layoutHeader(header, width, SEPARATOR2));
|
|
134250
134252
|
}
|
|
134253
|
+
lines.push(...layoutBarGrid([contextGroup, quotaGroup], width, SEPARATOR2, BAR_WIDTH));
|
|
134251
134254
|
return lines.join("\n");
|
|
134252
134255
|
}
|
|
134253
134256
|
|
|
@@ -134289,8 +134292,8 @@ function payloadViewOf(payload) {
|
|
|
134289
134292
|
async function readAllStdin() {
|
|
134290
134293
|
return await new Promise((resolve2) => {
|
|
134291
134294
|
const chunks = [];
|
|
134292
|
-
process.stdin.on("data", (
|
|
134293
|
-
chunks.push(
|
|
134295
|
+
process.stdin.on("data", (chunk2) => {
|
|
134296
|
+
chunks.push(chunk2);
|
|
134294
134297
|
});
|
|
134295
134298
|
process.stdin.on("end", () => {
|
|
134296
134299
|
resolve2(Buffer.concat(chunks).toString("utf8"));
|
|
@@ -135910,13 +135913,13 @@ var ReadBuffer = class {
|
|
|
135910
135913
|
constructor(options) {
|
|
135911
135914
|
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
135912
135915
|
}
|
|
135913
|
-
append(
|
|
135914
|
-
const newSize = (this._buffer?.length ?? 0) +
|
|
135916
|
+
append(chunk2) {
|
|
135917
|
+
const newSize = (this._buffer?.length ?? 0) + chunk2.length;
|
|
135915
135918
|
if (newSize > this._maxBufferSize) {
|
|
135916
135919
|
this.clear();
|
|
135917
135920
|
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
135918
135921
|
}
|
|
135919
|
-
this._buffer = this._buffer ? Buffer.concat([this._buffer,
|
|
135922
|
+
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk2]) : chunk2;
|
|
135920
135923
|
}
|
|
135921
135924
|
readMessage() {
|
|
135922
135925
|
if (!this._buffer) {
|
|
@@ -135947,9 +135950,9 @@ var StdioServerTransport = class {
|
|
|
135947
135950
|
this._stdin = _stdin;
|
|
135948
135951
|
this._stdout = _stdout;
|
|
135949
135952
|
this._started = false;
|
|
135950
|
-
this._ondata = (
|
|
135953
|
+
this._ondata = (chunk2) => {
|
|
135951
135954
|
try {
|
|
135952
|
-
this._readBuffer.append(
|
|
135955
|
+
this._readBuffer.append(chunk2);
|
|
135953
135956
|
this.processReadBuffer();
|
|
135954
135957
|
} catch (error63) {
|
|
135955
135958
|
this.onerror?.(error63);
|
|
@@ -144489,8 +144492,8 @@ init_realPorts();
|
|
|
144489
144492
|
init_realCredentialCache();
|
|
144490
144493
|
async function readStandardInput() {
|
|
144491
144494
|
const chunks = [];
|
|
144492
|
-
for await (const
|
|
144493
|
-
chunks.push(Buffer.isBuffer(
|
|
144495
|
+
for await (const chunk2 of process.stdin) {
|
|
144496
|
+
chunks.push(Buffer.isBuffer(chunk2) ? chunk2 : Buffer.from(String(chunk2)));
|
|
144494
144497
|
}
|
|
144495
144498
|
return Buffer.concat(chunks).toString("utf8");
|
|
144496
144499
|
}
|