claude-use 11.20.1 → 11.21.1
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 +397 -392
- 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.1",
|
|
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);
|
|
@@ -114729,11 +114729,12 @@ function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
|
|
|
114729
114729
|
return siblingExists(sibling) ? sibling : resolvedOwnExecutablePath;
|
|
114730
114730
|
}
|
|
114731
114731
|
var AWAIT_PID_POLL_MS = 50;
|
|
114732
|
-
async function awaitPidExit(pid,
|
|
114733
|
-
const
|
|
114734
|
-
while (ports.isRunning(pid)
|
|
114732
|
+
async function awaitPidExit(pid, ports) {
|
|
114733
|
+
const startedAt = ports.now();
|
|
114734
|
+
while (ports.isRunning(pid)) {
|
|
114735
114735
|
await ports.sleep(AWAIT_PID_POLL_MS);
|
|
114736
114736
|
}
|
|
114737
|
+
return ports.now() - startedAt;
|
|
114737
114738
|
}
|
|
114738
114739
|
var FRONTDOOR_SUPERVISOR_STILL_RUNNING = -1;
|
|
114739
114740
|
var FRONTDOOR_POLL_MS = 1e3;
|
|
@@ -115167,8 +115168,8 @@ function handleConnect(socket, context) {
|
|
|
115167
115168
|
});
|
|
115168
115169
|
context.ledger.accept(socket);
|
|
115169
115170
|
let buffer2 = Buffer.alloc(0);
|
|
115170
|
-
const onData = (
|
|
115171
|
-
buffer2 = Buffer.concat([buffer2,
|
|
115171
|
+
const onData = (chunk2) => {
|
|
115172
|
+
buffer2 = Buffer.concat([buffer2, chunk2]);
|
|
115172
115173
|
const headEnd = buffer2.indexOf(HEAD_TERMINATOR);
|
|
115173
115174
|
if (headEnd === -1 ? buffer2.length > MAX_CONNECT_HEAD_BYTES : headEnd > MAX_CONNECT_HEAD_BYTES) {
|
|
115174
115175
|
context.ledger.headReceived(socket);
|
|
@@ -115639,11 +115640,11 @@ function createRcSessionTracker(deps) {
|
|
|
115639
115640
|
onResponse: (status) => {
|
|
115640
115641
|
accepted2 = isSuccessful(status);
|
|
115641
115642
|
},
|
|
115642
|
-
onBodyChunk: (
|
|
115643
|
+
onBodyChunk: (chunk2) => {
|
|
115643
115644
|
if (!accepted2 || buffered2 >= RC_CREATE_RESPONSE_CAP_BYTES) {
|
|
115644
115645
|
return;
|
|
115645
115646
|
}
|
|
115646
|
-
const text2 = Buffer.from(
|
|
115647
|
+
const text2 = Buffer.from(chunk2).toString("utf8");
|
|
115647
115648
|
body = body + text2.slice(0, RC_CREATE_RESPONSE_CAP_BYTES - buffered2);
|
|
115648
115649
|
buffered2 = body.length;
|
|
115649
115650
|
},
|
|
@@ -115708,12 +115709,12 @@ function createRcSessionTracker(deps) {
|
|
|
115708
115709
|
const archiving = method === "POST" && rest === `${id2}/archive`;
|
|
115709
115710
|
return {
|
|
115710
115711
|
...bodyKind === void 0 ? {} : {
|
|
115711
|
-
onRequestChunk: (
|
|
115712
|
+
onRequestChunk: (chunk2) => {
|
|
115712
115713
|
if (oversized) {
|
|
115713
115714
|
return;
|
|
115714
115715
|
}
|
|
115715
|
-
chunks.push(Buffer.from(
|
|
115716
|
-
buffered +=
|
|
115716
|
+
chunks.push(Buffer.from(chunk2));
|
|
115717
|
+
buffered += chunk2.length;
|
|
115717
115718
|
if (buffered > RC_REQUEST_PARSE_CAP_BYTES) {
|
|
115718
115719
|
oversized = true;
|
|
115719
115720
|
chunks = [];
|
|
@@ -115821,8 +115822,8 @@ function observingRoutedRoute(route, tracker, hooks) {
|
|
|
115821
115822
|
serve: async (request7, response) => {
|
|
115822
115823
|
const observed = tracker.observeExchange({ method: request7.method, url: request7.url, headers: request7.headers });
|
|
115823
115824
|
if (observed?.onRequestChunk !== void 0) {
|
|
115824
|
-
request7.body.on("data", (
|
|
115825
|
-
observed.onRequestChunk?.(
|
|
115825
|
+
request7.body.on("data", (chunk2) => {
|
|
115826
|
+
observed.onRequestChunk?.(chunk2);
|
|
115826
115827
|
});
|
|
115827
115828
|
request7.body.on("end", () => {
|
|
115828
115829
|
observed.onRequestEnd?.();
|
|
@@ -115844,9 +115845,9 @@ function teeRoutedResponse(response, observer, onSettled) {
|
|
|
115844
115845
|
flush: () => {
|
|
115845
115846
|
response.flush();
|
|
115846
115847
|
},
|
|
115847
|
-
write: async (
|
|
115848
|
-
observer.onBodyChunk(typeof
|
|
115849
|
-
await response.write(
|
|
115848
|
+
write: async (chunk2) => {
|
|
115849
|
+
observer.onBodyChunk(typeof chunk2 === "string" ? Buffer.from(chunk2, "utf8") : chunk2);
|
|
115850
|
+
await response.write(chunk2);
|
|
115850
115851
|
},
|
|
115851
115852
|
end: () => {
|
|
115852
115853
|
response.end();
|
|
@@ -116191,14 +116192,14 @@ async function readBody(request7) {
|
|
|
116191
116192
|
return await new Promise((resolve2, reject) => {
|
|
116192
116193
|
const chunks = [];
|
|
116193
116194
|
let total = 0;
|
|
116194
|
-
request7.on("data", (
|
|
116195
|
-
total +=
|
|
116195
|
+
request7.on("data", (chunk2) => {
|
|
116196
|
+
total += chunk2.length;
|
|
116196
116197
|
if (total > CONTROL_BODY_CAP_BYTES) {
|
|
116197
116198
|
request7.destroy();
|
|
116198
116199
|
reject(new Error("too large"));
|
|
116199
116200
|
return;
|
|
116200
116201
|
}
|
|
116201
|
-
chunks.push(
|
|
116202
|
+
chunks.push(chunk2);
|
|
116202
116203
|
});
|
|
116203
116204
|
request7.on("end", () => {
|
|
116204
116205
|
resolve2(Buffer.concat(chunks).toString("utf8"));
|
|
@@ -116482,8 +116483,8 @@ function realRcControlTransport(port, ca2) {
|
|
|
116482
116483
|
},
|
|
116483
116484
|
(response) => {
|
|
116484
116485
|
const chunks = [];
|
|
116485
|
-
response.on("data", (
|
|
116486
|
-
chunks.push(
|
|
116486
|
+
response.on("data", (chunk2) => {
|
|
116487
|
+
chunks.push(chunk2);
|
|
116487
116488
|
});
|
|
116488
116489
|
response.on("end", () => {
|
|
116489
116490
|
resolve2({ status: response.statusCode ?? 0, body: Buffer.concat(chunks).toString("utf8") });
|
|
@@ -116847,13 +116848,13 @@ async function listenFrontDoor(server, options = {}) {
|
|
|
116847
116848
|
}
|
|
116848
116849
|
}
|
|
116849
116850
|
async function* upstreamChunks(stream) {
|
|
116850
|
-
for await (const
|
|
116851
|
-
if (typeof
|
|
116852
|
-
yield Buffer.from(
|
|
116851
|
+
for await (const chunk2 of stream) {
|
|
116852
|
+
if (typeof chunk2 === "string") {
|
|
116853
|
+
yield Buffer.from(chunk2, "utf8");
|
|
116853
116854
|
continue;
|
|
116854
116855
|
}
|
|
116855
|
-
if (
|
|
116856
|
-
yield
|
|
116856
|
+
if (chunk2 instanceof Uint8Array) {
|
|
116857
|
+
yield chunk2;
|
|
116857
116858
|
}
|
|
116858
116859
|
}
|
|
116859
116860
|
}
|
|
@@ -117011,8 +117012,8 @@ function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PO
|
|
|
117011
117012
|
}
|
|
117012
117013
|
const request7 = https3.request(options, (response) => {
|
|
117013
117014
|
const chunks = [];
|
|
117014
|
-
response.on("data", (
|
|
117015
|
-
chunks.push(
|
|
117015
|
+
response.on("data", (chunk2) => {
|
|
117016
|
+
chunks.push(chunk2);
|
|
117016
117017
|
});
|
|
117017
117018
|
response.on("end", () => {
|
|
117018
117019
|
resolve2({ status: response.statusCode ?? HTTP_BAD_GATEWAY, body: Buffer.concat(chunks).toString("utf8") });
|
|
@@ -117092,8 +117093,8 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
117092
117093
|
});
|
|
117093
117094
|
const readAll = async (response) => {
|
|
117094
117095
|
const chunks = [];
|
|
117095
|
-
for await (const
|
|
117096
|
-
chunks.push(Buffer.from(
|
|
117096
|
+
for await (const chunk2 of upstreamChunks(response)) {
|
|
117097
|
+
chunks.push(Buffer.from(chunk2));
|
|
117097
117098
|
}
|
|
117098
117099
|
return Buffer.concat(chunks).toString("utf8");
|
|
117099
117100
|
};
|
|
@@ -117284,8 +117285,8 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
|
|
|
117284
117285
|
response.writeHead(upstreamResponse.statusCode ?? HTTP_BAD_GATEWAY, forwardableHeaders(upstreamResponse.headers));
|
|
117285
117286
|
response.flushHeaders();
|
|
117286
117287
|
if (observer !== void 0) {
|
|
117287
|
-
upstreamResponse.on("data", (
|
|
117288
|
-
observer.onResponseChunk(
|
|
117288
|
+
upstreamResponse.on("data", (chunk2) => {
|
|
117289
|
+
observer.onResponseChunk(chunk2);
|
|
117289
117290
|
});
|
|
117290
117291
|
}
|
|
117291
117292
|
upstreamResponse.pipe(response);
|
|
@@ -117301,8 +117302,8 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
|
|
|
117301
117302
|
response.end(body);
|
|
117302
117303
|
});
|
|
117303
117304
|
if (observer !== void 0) {
|
|
117304
|
-
request7.on("data", (
|
|
117305
|
-
observer.onRequestChunk(
|
|
117305
|
+
request7.on("data", (chunk2) => {
|
|
117306
|
+
observer.onRequestChunk(chunk2);
|
|
117306
117307
|
});
|
|
117307
117308
|
if (observer.onRequestEnd !== void 0) {
|
|
117308
117309
|
request7.on("end", () => {
|
|
@@ -118987,25 +118988,25 @@ var EventStreamDecoder = class {
|
|
|
118987
118988
|
// Last MAX_DELIMITER_OVERLAP characters of the pending text, prefixed to the
|
|
118988
118989
|
// next chunk so a delimiter straddling the boundary is still found.
|
|
118989
118990
|
tail = "";
|
|
118990
|
-
feed(
|
|
118991
|
+
feed(chunk2) {
|
|
118991
118992
|
if (this.pending.length === 0) {
|
|
118992
|
-
const first =
|
|
118993
|
+
const first = chunk2.charCodeAt(0);
|
|
118993
118994
|
if (first === LF2 || first === CR2) {
|
|
118994
|
-
|
|
118995
|
+
chunk2 = chunk2.replace(LEADING_LINE_ENDINGS_REGEX, "");
|
|
118995
118996
|
}
|
|
118996
118997
|
}
|
|
118997
|
-
if (
|
|
118998
|
+
if (chunk2 === "") {
|
|
118998
118999
|
return;
|
|
118999
119000
|
}
|
|
119000
|
-
const scan = this.tail +
|
|
119001
|
-
this.pending.push(
|
|
119001
|
+
const scan = this.tail + chunk2;
|
|
119002
|
+
this.pending.push(chunk2);
|
|
119002
119003
|
MESSAGE_DELIMITER_REGEX.lastIndex = 0;
|
|
119003
119004
|
let match = MESSAGE_DELIMITER_REGEX.exec(scan);
|
|
119004
119005
|
if (match === null) {
|
|
119005
119006
|
this.tail = scan.slice(-2);
|
|
119006
119007
|
return;
|
|
119007
119008
|
}
|
|
119008
|
-
const buffered = this.pending.length === 1 ?
|
|
119009
|
+
const buffered = this.pending.length === 1 ? chunk2 : this.pending.join("");
|
|
119009
119010
|
const offset = buffered.length - scan.length;
|
|
119010
119011
|
const parts = [];
|
|
119011
119012
|
let start = 0;
|
|
@@ -119038,8 +119039,8 @@ var EventStreamDecoderStream = class {
|
|
|
119038
119039
|
controller.enqueue(event);
|
|
119039
119040
|
});
|
|
119040
119041
|
},
|
|
119041
|
-
transform(
|
|
119042
|
-
decoder.feed(
|
|
119042
|
+
transform(chunk2) {
|
|
119043
|
+
decoder.feed(chunk2);
|
|
119043
119044
|
},
|
|
119044
119045
|
flush() {
|
|
119045
119046
|
decoder.end();
|
|
@@ -124449,13 +124450,13 @@ var RequestLimitHandlerPlugin = class {
|
|
|
124449
124450
|
let currentBodySize = 0;
|
|
124450
124451
|
const limitedStream = stream.pipeThrough(
|
|
124451
124452
|
new TransformStream({
|
|
124452
|
-
transform(
|
|
124453
|
-
currentBodySize +=
|
|
124453
|
+
transform(chunk2, controller) {
|
|
124454
|
+
currentBodySize += chunk2.byteLength;
|
|
124454
124455
|
if (currentBodySize > maxBodySize) {
|
|
124455
124456
|
controller.error(new ORPCError("PAYLOAD_TOO_LARGE"));
|
|
124456
124457
|
return;
|
|
124457
124458
|
}
|
|
124458
|
-
controller.enqueue(
|
|
124459
|
+
controller.enqueue(chunk2);
|
|
124459
124460
|
}
|
|
124460
124461
|
})
|
|
124461
124462
|
);
|
|
@@ -124511,8 +124512,8 @@ function toWebReadableStream(stream) {
|
|
|
124511
124512
|
}
|
|
124512
124513
|
});
|
|
124513
124514
|
}
|
|
124514
|
-
function readableChunkToBytes(stream,
|
|
124515
|
-
return typeof
|
|
124515
|
+
function readableChunkToBytes(stream, chunk2) {
|
|
124516
|
+
return typeof chunk2 === "string" ? import_node_buffer.Buffer.from(chunk2, stream.readableEncoding ?? "utf8") : chunk2;
|
|
124516
124517
|
}
|
|
124517
124518
|
async function _drainIterator(iterator) {
|
|
124518
124519
|
while (!(await iterator.next()).done) {
|
|
@@ -124628,16 +124629,16 @@ function _streamToFormData(stream, contentType) {
|
|
|
124628
124629
|
async function _streamToString(stream) {
|
|
124629
124630
|
const decoder = new TextDecoder();
|
|
124630
124631
|
let string4 = "";
|
|
124631
|
-
for await (const
|
|
124632
|
-
string4 += decoder.decode(readableChunkToBytes(stream,
|
|
124632
|
+
for await (const chunk2 of stream) {
|
|
124633
|
+
string4 += decoder.decode(readableChunkToBytes(stream, chunk2), { stream: true });
|
|
124633
124634
|
}
|
|
124634
124635
|
string4 += decoder.decode();
|
|
124635
124636
|
return string4;
|
|
124636
124637
|
}
|
|
124637
124638
|
async function _streamToFile(stream, fileName, contentType) {
|
|
124638
124639
|
const chunks = [];
|
|
124639
|
-
for await (const
|
|
124640
|
-
chunks.push(readableChunkToBytes(stream,
|
|
124640
|
+
for await (const chunk2 of stream) {
|
|
124641
|
+
chunks.push(readableChunkToBytes(stream, chunk2));
|
|
124641
124642
|
}
|
|
124642
124643
|
return new File(chunks, fileName, { type: contentType });
|
|
124643
124644
|
}
|
|
@@ -127485,11 +127486,11 @@ async function collectBody(body) {
|
|
|
127485
127486
|
resolve2(result);
|
|
127486
127487
|
}
|
|
127487
127488
|
};
|
|
127488
|
-
body.on("data", (
|
|
127489
|
+
body.on("data", (chunk2) => {
|
|
127489
127490
|
if (settled) {
|
|
127490
127491
|
return;
|
|
127491
127492
|
}
|
|
127492
|
-
const piece = typeof
|
|
127493
|
+
const piece = typeof chunk2 === "string" ? Buffer.from(chunk2) : chunk2 instanceof Uint8Array ? Buffer.from(chunk2) : void 0;
|
|
127493
127494
|
if (piece === void 0) {
|
|
127494
127495
|
settle2({ kind: "failed" });
|
|
127495
127496
|
return;
|
|
@@ -127539,11 +127540,11 @@ async function hopOnce(request7, response, target, body, mayRetry) {
|
|
|
127539
127540
|
response.flush();
|
|
127540
127541
|
const stream = async () => {
|
|
127541
127542
|
try {
|
|
127542
|
-
for await (const
|
|
127543
|
+
for await (const chunk2 of upstreamChunks(upstreamResponse)) {
|
|
127543
127544
|
if (request7.signal.aborted) {
|
|
127544
127545
|
break;
|
|
127545
127546
|
}
|
|
127546
|
-
await response.write(
|
|
127547
|
+
await response.write(chunk2);
|
|
127547
127548
|
}
|
|
127548
127549
|
if (!request7.signal.aborted) {
|
|
127549
127550
|
response.end();
|
|
@@ -127677,13 +127678,13 @@ function createRoutedResponse(response, context) {
|
|
|
127677
127678
|
flush: () => {
|
|
127678
127679
|
response.flushHeaders();
|
|
127679
127680
|
},
|
|
127680
|
-
write: async (
|
|
127681
|
+
write: async (chunk2) => {
|
|
127681
127682
|
if (response.destroyed || response.writableEnded) {
|
|
127682
127683
|
return;
|
|
127683
127684
|
}
|
|
127684
|
-
const accepted = response.write(
|
|
127685
|
+
const accepted = response.write(chunk2);
|
|
127685
127686
|
if (bodyObservers.length > 0) {
|
|
127686
|
-
const bytes = typeof
|
|
127687
|
+
const bytes = typeof chunk2 === "string" ? Buffer.from(chunk2, "utf8") : chunk2;
|
|
127687
127688
|
observeBody((observer) => {
|
|
127688
127689
|
observer.chunk(bytes);
|
|
127689
127690
|
});
|
|
@@ -128653,8 +128654,8 @@ async function* parseSse(body) {
|
|
|
128653
128654
|
} catch {
|
|
128654
128655
|
}
|
|
128655
128656
|
};
|
|
128656
|
-
for await (const
|
|
128657
|
-
buffer2 += decoder.decode(
|
|
128657
|
+
for await (const chunk2 of body) {
|
|
128658
|
+
buffer2 += decoder.decode(chunk2, { stream: true });
|
|
128658
128659
|
let newline = buffer2.indexOf("\n");
|
|
128659
128660
|
while (newline !== -1) {
|
|
128660
128661
|
const line = buffer2.slice(0, newline).replace(/\r$/, "");
|
|
@@ -129109,15 +129110,15 @@ var BodyTooLargeError = class extends Error {
|
|
|
129109
129110
|
async function readBody2(request7) {
|
|
129110
129111
|
const chunks = [];
|
|
129111
129112
|
let size = 0;
|
|
129112
|
-
for await (const
|
|
129113
|
-
if (!Buffer.isBuffer(
|
|
129113
|
+
for await (const chunk2 of request7.body) {
|
|
129114
|
+
if (!Buffer.isBuffer(chunk2)) {
|
|
129114
129115
|
throw new TypeError("request body chunk was not a Buffer");
|
|
129115
129116
|
}
|
|
129116
|
-
size +=
|
|
129117
|
+
size += chunk2.length;
|
|
129117
129118
|
if (size > CODEX_MAX_BODY_BYTES) {
|
|
129118
129119
|
throw new BodyTooLargeError();
|
|
129119
129120
|
}
|
|
129120
|
-
chunks.push(
|
|
129121
|
+
chunks.push(chunk2);
|
|
129121
129122
|
}
|
|
129122
129123
|
return Buffer.concat(chunks).toString("utf8");
|
|
129123
129124
|
}
|
|
@@ -129128,11 +129129,11 @@ async function writeRouteResponse(routed, response, signal) {
|
|
|
129128
129129
|
response.end();
|
|
129129
129130
|
return;
|
|
129130
129131
|
}
|
|
129131
|
-
for await (const
|
|
129132
|
+
for await (const chunk2 of routed.body) {
|
|
129132
129133
|
if (signal.aborted) {
|
|
129133
129134
|
return;
|
|
129134
129135
|
}
|
|
129135
|
-
await response.write(
|
|
129136
|
+
await response.write(chunk2);
|
|
129136
129137
|
}
|
|
129137
129138
|
response.end();
|
|
129138
129139
|
}
|
|
@@ -129225,20 +129226,20 @@ function createAntigravityRelay(params) {
|
|
|
129225
129226
|
activeBlockType = void 0;
|
|
129226
129227
|
}
|
|
129227
129228
|
};
|
|
129228
|
-
const pushChunk = (
|
|
129229
|
+
const pushChunk = (chunk2) => {
|
|
129229
129230
|
frames.length = 0;
|
|
129230
129231
|
ensureStarted();
|
|
129231
|
-
if (
|
|
129232
|
-
const cached2 =
|
|
129233
|
-
const promptTotal =
|
|
129232
|
+
if (chunk2.usageMetadata !== void 0) {
|
|
129233
|
+
const cached2 = chunk2.usageMetadata.cachedContentTokenCount ?? 0;
|
|
129234
|
+
const promptTotal = chunk2.usageMetadata.promptTokenCount ?? usage.input_tokens + cached2;
|
|
129234
129235
|
usage = {
|
|
129235
129236
|
input_tokens: Math.max(0, promptTotal - cached2),
|
|
129236
129237
|
cache_creation_input_tokens: 0,
|
|
129237
129238
|
cache_read_input_tokens: cached2,
|
|
129238
|
-
output_tokens:
|
|
129239
|
+
output_tokens: chunk2.usageMetadata.candidatesTokenCount ?? usage.output_tokens
|
|
129239
129240
|
};
|
|
129240
129241
|
}
|
|
129241
|
-
const candidate =
|
|
129242
|
+
const candidate = chunk2.candidates?.[0];
|
|
129242
129243
|
if (candidate?.content?.parts !== void 0) {
|
|
129243
129244
|
for (const part of candidate.content.parts) {
|
|
129244
129245
|
if ("text" in part && typeof part.text === "string" && (part.thoughtSignature === void 0 || part.text.length > 0)) {
|
|
@@ -129724,15 +129725,15 @@ var BodyTooLargeError2 = class extends Error {
|
|
|
129724
129725
|
async function readBody3(request7) {
|
|
129725
129726
|
const chunks = [];
|
|
129726
129727
|
let size = 0;
|
|
129727
|
-
for await (const
|
|
129728
|
-
if (!Buffer.isBuffer(
|
|
129728
|
+
for await (const chunk2 of request7.body) {
|
|
129729
|
+
if (!Buffer.isBuffer(chunk2)) {
|
|
129729
129730
|
throw new TypeError("request body chunk was not a Buffer");
|
|
129730
129731
|
}
|
|
129731
|
-
size +=
|
|
129732
|
+
size += chunk2.length;
|
|
129732
129733
|
if (size > ANTIGRAVITY_MAX_BODY_BYTES) {
|
|
129733
129734
|
throw new BodyTooLargeError2();
|
|
129734
129735
|
}
|
|
129735
|
-
chunks.push(
|
|
129736
|
+
chunks.push(chunk2);
|
|
129736
129737
|
}
|
|
129737
129738
|
return Buffer.concat(chunks).toString("utf8");
|
|
129738
129739
|
}
|
|
@@ -129743,11 +129744,11 @@ async function writeRouteResponse2(routed, response, signal) {
|
|
|
129743
129744
|
response.end();
|
|
129744
129745
|
return;
|
|
129745
129746
|
}
|
|
129746
|
-
for await (const
|
|
129747
|
+
for await (const chunk2 of routed.body) {
|
|
129747
129748
|
if (signal.aborted) {
|
|
129748
129749
|
return;
|
|
129749
129750
|
}
|
|
129750
|
-
await response.write(
|
|
129751
|
+
await response.write(chunk2);
|
|
129751
129752
|
}
|
|
129752
129753
|
response.end();
|
|
129753
129754
|
}
|
|
@@ -129823,11 +129824,11 @@ function createPassthroughRoute(name, target) {
|
|
|
129823
129824
|
response.flush();
|
|
129824
129825
|
const stream = async () => {
|
|
129825
129826
|
try {
|
|
129826
|
-
for await (const
|
|
129827
|
+
for await (const chunk2 of upstreamChunks(upstreamResponse)) {
|
|
129827
129828
|
if (request7.signal.aborted) {
|
|
129828
129829
|
return;
|
|
129829
129830
|
}
|
|
129830
|
-
await response.write(
|
|
129831
|
+
await response.write(chunk2);
|
|
129831
129832
|
}
|
|
129832
129833
|
response.end();
|
|
129833
129834
|
} catch {
|
|
@@ -129886,8 +129887,8 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
129886
129887
|
const settle2 = () => {
|
|
129887
129888
|
const model = modelIn();
|
|
129888
129889
|
const hasImage = /"type"\s*:\s*"image"/.test(text2);
|
|
129889
|
-
for (const
|
|
129890
|
-
replay.write(
|
|
129890
|
+
for (const chunk2 of head) {
|
|
129891
|
+
replay.write(chunk2);
|
|
129891
129892
|
}
|
|
129892
129893
|
const maxTokens = /"max_tokens"\s*:\s*([0-9]+)/.exec(text2)?.[1];
|
|
129893
129894
|
resolve2({
|
|
@@ -129901,9 +129902,9 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
129901
129902
|
replayed: { ...request7, body: replay }
|
|
129902
129903
|
});
|
|
129903
129904
|
};
|
|
129904
|
-
body.on("data", (
|
|
129905
|
+
body.on("data", (chunk2) => {
|
|
129905
129906
|
if (decided) {
|
|
129906
|
-
if (!replay.write(
|
|
129907
|
+
if (!replay.write(chunk2)) {
|
|
129907
129908
|
body.pause();
|
|
129908
129909
|
replay.once("drain", () => {
|
|
129909
129910
|
body.resume();
|
|
@@ -129911,9 +129912,9 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
129911
129912
|
}
|
|
129912
129913
|
return;
|
|
129913
129914
|
}
|
|
129914
|
-
head.push(
|
|
129915
|
-
seen +=
|
|
129916
|
-
text2 +=
|
|
129915
|
+
head.push(chunk2);
|
|
129916
|
+
seen += chunk2.length;
|
|
129917
|
+
text2 += chunk2.toString("utf8");
|
|
129917
129918
|
if (!wholeBody && (modelIn() !== void 0 || seen >= REQUEST_SCAN_CAP_BYTES)) {
|
|
129918
129919
|
decided = true;
|
|
129919
129920
|
body.pause();
|
|
@@ -131796,12 +131797,12 @@ function readableContentType(contentType) {
|
|
|
131796
131797
|
async function readCapped(chunks) {
|
|
131797
131798
|
const collected = [];
|
|
131798
131799
|
let total = 0;
|
|
131799
|
-
for await (const
|
|
131800
|
-
total +=
|
|
131800
|
+
for await (const chunk2 of chunks) {
|
|
131801
|
+
total += chunk2.byteLength;
|
|
131801
131802
|
if (total > RC_WEB_FETCH_MAX_BYTES) {
|
|
131802
131803
|
return { tooLarge: true, text: "" };
|
|
131803
131804
|
}
|
|
131804
|
-
collected.push(Buffer.from(
|
|
131805
|
+
collected.push(Buffer.from(chunk2));
|
|
131805
131806
|
}
|
|
131806
131807
|
return { tooLarge: false, text: Buffer.concat(collected).toString("utf8") };
|
|
131807
131808
|
}
|
|
@@ -132011,14 +132012,14 @@ async function readBody4(request7, capBytes) {
|
|
|
132011
132012
|
return await new Promise((resolve2, reject) => {
|
|
132012
132013
|
const chunks = [];
|
|
132013
132014
|
let total = 0;
|
|
132014
|
-
request7.on("data", (
|
|
132015
|
-
total +=
|
|
132015
|
+
request7.on("data", (chunk2) => {
|
|
132016
|
+
total += chunk2.length;
|
|
132016
132017
|
if (total > capBytes) {
|
|
132017
132018
|
request7.destroy();
|
|
132018
132019
|
reject(new Error("body too large"));
|
|
132019
132020
|
return;
|
|
132020
132021
|
}
|
|
132021
|
-
chunks.push(
|
|
132022
|
+
chunks.push(chunk2);
|
|
132022
132023
|
});
|
|
132023
132024
|
request7.on("end", () => {
|
|
132024
132025
|
resolve2(Buffer.concat(chunks).toString("utf8"));
|
|
@@ -132786,10 +132787,10 @@ function createRcStreamHub(deps) {
|
|
|
132786
132787
|
}
|
|
132787
132788
|
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
132789
|
const parser = createSseParser();
|
|
132789
|
-
for await (const
|
|
132790
|
+
for await (const chunk2 of answer.chunks) {
|
|
132790
132791
|
attachment.controller.signal.throwIfAborted();
|
|
132791
132792
|
let lastEventId;
|
|
132792
|
-
for (const parsed of parser.write(Buffer.from(
|
|
132793
|
+
for (const parsed of parser.write(Buffer.from(chunk2).toString("utf8"))) {
|
|
132793
132794
|
const envelope = parseRcStreamEnvelope(parsed);
|
|
132794
132795
|
if (envelope === void 0) {
|
|
132795
132796
|
continue;
|
|
@@ -133592,7 +133593,8 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
133592
133593
|
const awaited = Number(process.env[DOOR_AWAIT_PID_ENV]);
|
|
133593
133594
|
Reflect.deleteProperty(process.env, DOOR_AWAIT_PID_ENV);
|
|
133594
133595
|
if (Number.isInteger(awaited) && awaited > 0) {
|
|
133595
|
-
await awaitPidExit(awaited,
|
|
133596
|
+
const waitedMs = await awaitPidExit(awaited, supervisorPorts);
|
|
133597
|
+
supervisorPorts.log(`frontdoor ${String(ownPid)}: stalled door ${String(awaited)} released the sticky ports after ${String(waitedMs)}ms`);
|
|
133596
133598
|
}
|
|
133597
133599
|
declareThisProcessTheFrontDoor();
|
|
133598
133600
|
deps.exit(await runFrontDoorSupervisor(idleShutdownMinutes, supervisorPorts));
|
|
@@ -133688,8 +133690,8 @@ var realHeadroomGet = async (target, requestPath, timeoutMs) => {
|
|
|
133688
133690
|
return await new Promise((resolve2, reject) => {
|
|
133689
133691
|
const request7 = import_node_http4.default.request({ socketPath: target.socketPath, path: requestPath, method: "GET", headers: { accept: "application/json", host: "localhost" }, timeout: timeoutMs }, (response) => {
|
|
133690
133692
|
const chunks = [];
|
|
133691
|
-
response.on("data", (
|
|
133692
|
-
chunks.push(
|
|
133693
|
+
response.on("data", (chunk2) => {
|
|
133694
|
+
chunks.push(chunk2);
|
|
133693
133695
|
});
|
|
133694
133696
|
response.on("end", () => {
|
|
133695
133697
|
resolve2({ status: response.statusCode ?? 0, text: Buffer.concat(chunks).toString("utf8") });
|
|
@@ -133907,6 +133909,84 @@ function providerScopedState(snapshot, providerName, providerDisplayName) {
|
|
|
133907
133909
|
return void 0;
|
|
133908
133910
|
}
|
|
133909
133911
|
|
|
133912
|
+
// src/statusline/ansi.ts
|
|
133913
|
+
var ESCAPE_CHAR_CODE = 27;
|
|
133914
|
+
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
133915
|
+
var ANSI_REGEX = new RegExp(`${ESCAPE}\\[[0-9;]*[a-zA-Z]`, "g");
|
|
133916
|
+
function visibleLength(text2) {
|
|
133917
|
+
return text2.replace(ANSI_REGEX, "").length;
|
|
133918
|
+
}
|
|
133919
|
+
|
|
133920
|
+
// src/statusline/barGrid.ts
|
|
133921
|
+
var BRACKET_COLUMNS = 2;
|
|
133922
|
+
function chunk(items, size) {
|
|
133923
|
+
const chunks = [];
|
|
133924
|
+
for (let start = 0; start < items.length; start += size) {
|
|
133925
|
+
chunks.push(items.slice(start, start + size));
|
|
133926
|
+
}
|
|
133927
|
+
return chunks;
|
|
133928
|
+
}
|
|
133929
|
+
function lastColumnOf(index, rowLength, columns) {
|
|
133930
|
+
return index === rowLength - 1 ? columns - 1 : index;
|
|
133931
|
+
}
|
|
133932
|
+
function measureGrid(rows, separatorLength, baseBarCells) {
|
|
133933
|
+
const columns = Math.max(...rows.map((row) => row.length));
|
|
133934
|
+
const prefixWidths = Array.from({ length: columns }, () => 0);
|
|
133935
|
+
const suffixWidths = Array.from({ length: columns }, () => 0);
|
|
133936
|
+
for (const row of rows) {
|
|
133937
|
+
row.forEach((cell, index) => {
|
|
133938
|
+
const last = lastColumnOf(index, row.length, columns);
|
|
133939
|
+
prefixWidths[index] = Math.max(prefixWidths[index] ?? 0, visibleLength(cell.prefix));
|
|
133940
|
+
suffixWidths[last] = Math.max(suffixWidths[last] ?? 0, visibleLength(cell.suffix));
|
|
133941
|
+
});
|
|
133942
|
+
}
|
|
133943
|
+
const fixed = [...prefixWidths, ...suffixWidths].reduce((total, width) => total + width, 0) + columns * (baseBarCells + BRACKET_COLUMNS);
|
|
133944
|
+
return { rows, columns, prefixWidths, suffixWidths, baseWidth: fixed + separatorLength * (columns - 1) };
|
|
133945
|
+
}
|
|
133946
|
+
function padTo(text2, width) {
|
|
133947
|
+
return text2 + " ".repeat(Math.max(0, width - visibleLength(text2)));
|
|
133948
|
+
}
|
|
133949
|
+
function renderGrid(grid, maxWidth, separator, baseBarCells) {
|
|
133950
|
+
const separatorLength = visibleLength(separator);
|
|
133951
|
+
const spare = Math.max(0, maxWidth - grid.baseWidth);
|
|
133952
|
+
const barCells = Array.from({ length: grid.columns }, (_, column) => baseBarCells + Math.floor(spare / grid.columns) + (column < spare % grid.columns ? 1 : 0));
|
|
133953
|
+
const blockWidths = barCells.map((cells) => cells + BRACKET_COLUMNS);
|
|
133954
|
+
return grid.rows.map(
|
|
133955
|
+
(row) => row.map((cell, index) => {
|
|
133956
|
+
const last = lastColumnOf(index, row.length, grid.columns);
|
|
133957
|
+
let blockWidth = blockWidths[index] ?? 0;
|
|
133958
|
+
for (let column = index + 1; column <= last; column += 1) {
|
|
133959
|
+
blockWidth += separatorLength + (grid.suffixWidths[column - 1] ?? 0) + (grid.prefixWidths[column] ?? 0) + (blockWidths[column] ?? 0);
|
|
133960
|
+
}
|
|
133961
|
+
const prefix = padTo(cell.prefix, grid.prefixWidths[index] ?? 0);
|
|
133962
|
+
const bar = cell.draw(blockWidth - BRACKET_COLUMNS);
|
|
133963
|
+
const suffix = index === row.length - 1 ? cell.suffix : padTo(cell.suffix, grid.suffixWidths[last] ?? 0);
|
|
133964
|
+
return `${prefix}${bar}${suffix}`;
|
|
133965
|
+
}).join(separator)
|
|
133966
|
+
);
|
|
133967
|
+
}
|
|
133968
|
+
function layoutBarGrid(groups, maxWidth, separator, baseBarCells) {
|
|
133969
|
+
const nonEmpty = groups.filter((group) => group.length > 0);
|
|
133970
|
+
if (nonEmpty.length === 0) {
|
|
133971
|
+
return [];
|
|
133972
|
+
}
|
|
133973
|
+
const separatorLength = visibleLength(separator);
|
|
133974
|
+
const widest = Math.max(...nonEmpty.map((group) => group.length));
|
|
133975
|
+
const layoutFor = (perRow) => measureGrid(nonEmpty.flatMap((group) => chunk(group, perRow)), separatorLength, baseBarCells);
|
|
133976
|
+
const candidates = [measureGrid([nonEmpty.flat()], separatorLength, baseBarCells)];
|
|
133977
|
+
for (let perRow = widest; perRow > 1; perRow -= 1) {
|
|
133978
|
+
candidates.push(layoutFor(perRow));
|
|
133979
|
+
}
|
|
133980
|
+
const fitting = candidates.find((grid) => grid.baseWidth <= maxWidth);
|
|
133981
|
+
if (fitting !== void 0) {
|
|
133982
|
+
return renderGrid(fitting, maxWidth, separator, baseBarCells);
|
|
133983
|
+
}
|
|
133984
|
+
if (nonEmpty.length > 1) {
|
|
133985
|
+
return nonEmpty.flatMap((group) => layoutBarGrid([group], maxWidth, separator, baseBarCells));
|
|
133986
|
+
}
|
|
133987
|
+
return renderGrid(layoutFor(1), maxWidth, separator, baseBarCells);
|
|
133988
|
+
}
|
|
133989
|
+
|
|
133910
133990
|
// src/statusline/render.ts
|
|
133911
133991
|
var BAR_WIDTH = 10;
|
|
133912
133992
|
var SECONDS_PER_MINUTE2 = 60;
|
|
@@ -133922,17 +134002,11 @@ var FULL_PERCENT2 = 100;
|
|
|
133922
134002
|
var ONE_PERCENT = 1;
|
|
133923
134003
|
var USED_RED_AT = 0.9;
|
|
133924
134004
|
var USED_YELLOW_AT = 0.7;
|
|
133925
|
-
var ESCAPE_CHAR_CODE = 27;
|
|
133926
|
-
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
133927
134005
|
var RESET = `${ESCAPE}[0m`;
|
|
133928
134006
|
var DIM = `${ESCAPE}[90m`;
|
|
133929
134007
|
var GREEN = `${ESCAPE}[32m`;
|
|
133930
134008
|
var YELLOW = `${ESCAPE}[33m`;
|
|
133931
134009
|
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
134010
|
function colorize() {
|
|
133937
134011
|
return process.env.NO_COLOR === void 0;
|
|
133938
134012
|
}
|
|
@@ -134059,69 +134133,30 @@ function secondsUntil(resetAt, nowMs) {
|
|
|
134059
134133
|
const resetMs = Date.parse(resetAt);
|
|
134060
134134
|
return Number.isNaN(resetMs) ? void 0 : Math.max(0, Math.round((resetMs - nowMs) / THOUSAND));
|
|
134061
134135
|
}
|
|
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);
|
|
134136
|
+
function drawBar(fraction, cells) {
|
|
134137
|
+
const clamped = Math.max(0, Math.min(1, fraction));
|
|
134138
|
+
const filled = Math.round(clamped * cells);
|
|
134139
|
+
const color = statusColor(clamped, true);
|
|
134140
|
+
return color === "" ? `[${"\u2588".repeat(filled)}${"\u2591".repeat(cells - filled)}]` : `[${color}${"\u2588".repeat(filled)}${DIM}${"\u2591".repeat(cells - filled)}${RESET}]`;
|
|
134108
134141
|
}
|
|
134109
|
-
function
|
|
134110
|
-
|
|
134111
|
-
|
|
134112
|
-
|
|
134142
|
+
function barCell(prefix, suffix, fraction) {
|
|
134143
|
+
return { prefix, suffix, draw: (cells) => drawBar(fraction, cells) };
|
|
134144
|
+
}
|
|
134145
|
+
function justify(texts, maxWidth, separator) {
|
|
134146
|
+
if (texts.length < 2) {
|
|
134147
|
+
return texts.join(separator);
|
|
134113
134148
|
}
|
|
134114
134149
|
const separatorLength = visibleLength(separator);
|
|
134115
|
-
const total =
|
|
134150
|
+
const total = texts.reduce((sum, text2) => sum + visibleLength(text2), 0) + separatorLength * (texts.length - 1);
|
|
134116
134151
|
const spare = maxWidth - total;
|
|
134117
134152
|
if (spare <= 0) {
|
|
134118
|
-
return
|
|
134153
|
+
return texts.join(separator);
|
|
134119
134154
|
}
|
|
134120
|
-
const gaps =
|
|
134155
|
+
const gaps = texts.length - 1;
|
|
134121
134156
|
const extraPerGap = Math.floor(spare / gaps);
|
|
134122
134157
|
let remainder = spare % gaps;
|
|
134123
134158
|
const parts = [];
|
|
134124
|
-
|
|
134159
|
+
texts.forEach((text2, index) => {
|
|
134125
134160
|
if (index > 0) {
|
|
134126
134161
|
const extra = extraPerGap + (remainder > 0 ? 1 : 0);
|
|
134127
134162
|
if (remainder > 0) {
|
|
@@ -134130,82 +134165,55 @@ function justifySegments(segments, maxWidth, separator, baseBarWidth) {
|
|
|
134130
134165
|
const left = Math.floor(extra / 2);
|
|
134131
134166
|
parts.push(`${" ".repeat(left + 1)}|${" ".repeat(extra - left + 1)}`);
|
|
134132
134167
|
}
|
|
134133
|
-
parts.push(
|
|
134168
|
+
parts.push(text2);
|
|
134134
134169
|
});
|
|
134135
134170
|
return parts.join("");
|
|
134136
134171
|
}
|
|
134137
|
-
function
|
|
134172
|
+
function layoutHeader(texts, maxWidth, separator) {
|
|
134138
134173
|
const separatorLength = visibleLength(separator);
|
|
134139
134174
|
const lines = [];
|
|
134140
134175
|
let current = [];
|
|
134141
134176
|
let currentWidth = 0;
|
|
134142
|
-
for (const
|
|
134143
|
-
const width =
|
|
134177
|
+
for (const text2 of texts) {
|
|
134178
|
+
const width = visibleLength(text2);
|
|
134144
134179
|
const added = current.length === 0 ? width : width + separatorLength;
|
|
134145
134180
|
if (current.length > 0 && currentWidth + added > maxWidth) {
|
|
134146
134181
|
lines.push(current);
|
|
134147
|
-
current = [
|
|
134182
|
+
current = [text2];
|
|
134148
134183
|
currentWidth = width;
|
|
134149
134184
|
} else {
|
|
134150
|
-
current.push(
|
|
134185
|
+
current.push(text2);
|
|
134151
134186
|
currentWidth += added;
|
|
134152
134187
|
}
|
|
134153
134188
|
}
|
|
134154
134189
|
if (current.length > 0) {
|
|
134155
134190
|
lines.push(current);
|
|
134156
134191
|
}
|
|
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");
|
|
134192
|
+
return lines.map((line) => justify(line, maxWidth, separator)).join("\n");
|
|
134185
134193
|
}
|
|
134186
134194
|
function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
|
|
134187
134195
|
const header = [];
|
|
134188
134196
|
if (view.modelDisplayName !== void 0 && view.modelDisplayName !== "") {
|
|
134189
|
-
header.push(
|
|
134197
|
+
header.push(view.modelDisplayName);
|
|
134190
134198
|
}
|
|
134191
134199
|
if (summary.provider !== void 0) {
|
|
134192
134200
|
const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
|
|
134193
|
-
header.push(
|
|
134201
|
+
header.push(account.length > 0 ? `${summary.provider} \xB7 ${account.join(" \xB7 ")}` : summary.provider);
|
|
134194
134202
|
}
|
|
134195
134203
|
const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
|
|
134196
134204
|
const loginOrgName = summary.loginOrganizationType === "claude_team" || summary.loginOrganizationType === "claude_enterprise" ? summary.loginOrganizationName : void 0;
|
|
134197
134205
|
const loginParts = [summary.loginAccountEmail, loginOrgName, loginPlan].filter((part) => part !== void 0);
|
|
134198
134206
|
if (summary.loginAccountEmail !== void 0 && summary.loginAccountEmail !== summary.providerAccountEmail) {
|
|
134199
|
-
header.push(
|
|
134207
|
+
header.push(loginParts.join(" \xB7 "));
|
|
134200
134208
|
} else if (summary.provider === void 0 && loginParts.length > 0) {
|
|
134201
|
-
header.push(
|
|
134209
|
+
header.push(loginParts.join(" \xB7 "));
|
|
134202
134210
|
}
|
|
134203
134211
|
if (summary.identity !== void 0 && summary.provider !== void 0 && summary.identity !== summary.providerAccountEmail && summary.identity !== summary.loginAccountEmail) {
|
|
134204
|
-
header.push(
|
|
134212
|
+
header.push(summary.identity);
|
|
134205
134213
|
}
|
|
134206
134214
|
const savings = headroomText(summary.headroom);
|
|
134207
134215
|
if (savings !== void 0) {
|
|
134208
|
-
header.push(
|
|
134216
|
+
header.push(savings);
|
|
134209
134217
|
}
|
|
134210
134218
|
const contextGroup = [];
|
|
134211
134219
|
if (view.contextUsedPercentage !== void 0) {
|
|
@@ -134214,13 +134222,13 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
|
|
|
134214
134222
|
const percent2 = `${color}${view.contextUsedPercentage.toFixed(1)}%${RESET}`;
|
|
134215
134223
|
const tokens = view.contextTotalTokens !== void 0 && view.contextWindowTokens !== void 0 ? `${formatTokens(view.contextTotalTokens)}/${formatTokens(view.contextWindowTokens)} ` : "";
|
|
134216
134224
|
const cache = cacheShareText(view);
|
|
134217
|
-
contextGroup.push(
|
|
134225
|
+
contextGroup.push(barCell(`Ctx ${tokens}`, ` ${percent2}${cache}`, fraction));
|
|
134218
134226
|
}
|
|
134219
134227
|
const quotaGroup = [];
|
|
134220
134228
|
const drawWindow = (label, fraction, resetsAt) => {
|
|
134221
134229
|
const clamped = Math.max(0, Math.min(1, fraction));
|
|
134222
134230
|
const color = statusColor(clamped, true);
|
|
134223
|
-
quotaGroup.push(
|
|
134231
|
+
quotaGroup.push(barCell(`${label} `, ` ${color}${(fraction * FULL_PERCENT2).toFixed(1)}%${RESET} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped));
|
|
134224
134232
|
};
|
|
134225
134233
|
if (summary.quotaFamilies.length > 0) {
|
|
134226
134234
|
for (const window of summary.quotaFamilies) {
|
|
@@ -134242,12 +134250,9 @@ function renderStatuslineBlock(summary, view, terminalWidth, nowMs) {
|
|
|
134242
134250
|
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
134243
134251
|
const lines = [];
|
|
134244
134252
|
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);
|
|
134253
|
+
lines.push(layoutHeader(header, width, SEPARATOR2));
|
|
134250
134254
|
}
|
|
134255
|
+
lines.push(...layoutBarGrid([contextGroup, quotaGroup], width, SEPARATOR2, BAR_WIDTH));
|
|
134251
134256
|
return lines.join("\n");
|
|
134252
134257
|
}
|
|
134253
134258
|
|
|
@@ -134289,8 +134294,8 @@ function payloadViewOf(payload) {
|
|
|
134289
134294
|
async function readAllStdin() {
|
|
134290
134295
|
return await new Promise((resolve2) => {
|
|
134291
134296
|
const chunks = [];
|
|
134292
|
-
process.stdin.on("data", (
|
|
134293
|
-
chunks.push(
|
|
134297
|
+
process.stdin.on("data", (chunk2) => {
|
|
134298
|
+
chunks.push(chunk2);
|
|
134294
134299
|
});
|
|
134295
134300
|
process.stdin.on("end", () => {
|
|
134296
134301
|
resolve2(Buffer.concat(chunks).toString("utf8"));
|
|
@@ -135910,13 +135915,13 @@ var ReadBuffer = class {
|
|
|
135910
135915
|
constructor(options) {
|
|
135911
135916
|
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
135912
135917
|
}
|
|
135913
|
-
append(
|
|
135914
|
-
const newSize = (this._buffer?.length ?? 0) +
|
|
135918
|
+
append(chunk2) {
|
|
135919
|
+
const newSize = (this._buffer?.length ?? 0) + chunk2.length;
|
|
135915
135920
|
if (newSize > this._maxBufferSize) {
|
|
135916
135921
|
this.clear();
|
|
135917
135922
|
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
135918
135923
|
}
|
|
135919
|
-
this._buffer = this._buffer ? Buffer.concat([this._buffer,
|
|
135924
|
+
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk2]) : chunk2;
|
|
135920
135925
|
}
|
|
135921
135926
|
readMessage() {
|
|
135922
135927
|
if (!this._buffer) {
|
|
@@ -135947,9 +135952,9 @@ var StdioServerTransport = class {
|
|
|
135947
135952
|
this._stdin = _stdin;
|
|
135948
135953
|
this._stdout = _stdout;
|
|
135949
135954
|
this._started = false;
|
|
135950
|
-
this._ondata = (
|
|
135955
|
+
this._ondata = (chunk2) => {
|
|
135951
135956
|
try {
|
|
135952
|
-
this._readBuffer.append(
|
|
135957
|
+
this._readBuffer.append(chunk2);
|
|
135953
135958
|
this.processReadBuffer();
|
|
135954
135959
|
} catch (error63) {
|
|
135955
135960
|
this.onerror?.(error63);
|
|
@@ -144489,8 +144494,8 @@ init_realPorts();
|
|
|
144489
144494
|
init_realCredentialCache();
|
|
144490
144495
|
async function readStandardInput() {
|
|
144491
144496
|
const chunks = [];
|
|
144492
|
-
for await (const
|
|
144493
|
-
chunks.push(Buffer.isBuffer(
|
|
144497
|
+
for await (const chunk2 of process.stdin) {
|
|
144498
|
+
chunks.push(Buffer.isBuffer(chunk2) ? chunk2 : Buffer.from(String(chunk2)));
|
|
144494
144499
|
}
|
|
144495
144500
|
return Buffer.concat(chunks).toString("utf8");
|
|
144496
144501
|
}
|