@vibedeckx/linux-x64 0.3.5 → 0.3.6
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/bin.js +1106 -976
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -16572,44 +16572,44 @@ var require_base64 = __commonJS({
|
|
|
16572
16572
|
s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
|
|
16573
16573
|
var i;
|
|
16574
16574
|
base643.encode = function encode3(buffer, start, end) {
|
|
16575
|
-
var parts = null,
|
|
16575
|
+
var parts = null, chunk2 = [];
|
|
16576
16576
|
var i2 = 0, j = 0, t;
|
|
16577
16577
|
while (start < end) {
|
|
16578
16578
|
var b2 = buffer[start++];
|
|
16579
16579
|
switch (j) {
|
|
16580
16580
|
case 0:
|
|
16581
|
-
|
|
16581
|
+
chunk2[i2++] = b64[b2 >> 2];
|
|
16582
16582
|
t = (b2 & 3) << 4;
|
|
16583
16583
|
j = 1;
|
|
16584
16584
|
break;
|
|
16585
16585
|
case 1:
|
|
16586
|
-
|
|
16586
|
+
chunk2[i2++] = b64[t | b2 >> 4];
|
|
16587
16587
|
t = (b2 & 15) << 2;
|
|
16588
16588
|
j = 2;
|
|
16589
16589
|
break;
|
|
16590
16590
|
case 2:
|
|
16591
|
-
|
|
16592
|
-
|
|
16591
|
+
chunk2[i2++] = b64[t | b2 >> 6];
|
|
16592
|
+
chunk2[i2++] = b64[b2 & 63];
|
|
16593
16593
|
j = 0;
|
|
16594
16594
|
break;
|
|
16595
16595
|
}
|
|
16596
16596
|
if (i2 > 8191) {
|
|
16597
|
-
(parts || (parts = [])).push(String.fromCharCode.apply(String,
|
|
16597
|
+
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk2));
|
|
16598
16598
|
i2 = 0;
|
|
16599
16599
|
}
|
|
16600
16600
|
}
|
|
16601
16601
|
if (j) {
|
|
16602
|
-
|
|
16603
|
-
|
|
16602
|
+
chunk2[i2++] = b64[t];
|
|
16603
|
+
chunk2[i2++] = 61;
|
|
16604
16604
|
if (j === 1)
|
|
16605
|
-
|
|
16605
|
+
chunk2[i2++] = 61;
|
|
16606
16606
|
}
|
|
16607
16607
|
if (parts) {
|
|
16608
16608
|
if (i2)
|
|
16609
|
-
parts.push(String.fromCharCode.apply(String,
|
|
16609
|
+
parts.push(String.fromCharCode.apply(String, chunk2.slice(0, i2)));
|
|
16610
16610
|
return parts.join("");
|
|
16611
16611
|
}
|
|
16612
|
-
return String.fromCharCode.apply(String,
|
|
16612
|
+
return String.fromCharCode.apply(String, chunk2.slice(0, i2));
|
|
16613
16613
|
};
|
|
16614
16614
|
var invalidEncoding = "invalid encoding";
|
|
16615
16615
|
base643.decode = function decode3(string4, buffer, offset) {
|
|
@@ -25600,15 +25600,15 @@ function sendWithHttp(request, url2, headers, compression, userAgent, agent, dat
|
|
|
25600
25600
|
const req = request(options, (res) => {
|
|
25601
25601
|
const responseData = [];
|
|
25602
25602
|
let responseSize = 0;
|
|
25603
|
-
res.on("data", (
|
|
25604
|
-
responseSize +=
|
|
25603
|
+
res.on("data", (chunk2) => {
|
|
25604
|
+
responseSize += chunk2.length;
|
|
25605
25605
|
if (responseSize > MAX_RESPONSE_BODY_SIZE) {
|
|
25606
25606
|
const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
|
|
25607
25607
|
resolve3({ status: "failure", error: sizeError });
|
|
25608
25608
|
res.destroy();
|
|
25609
25609
|
return;
|
|
25610
25610
|
}
|
|
25611
|
-
responseData.push(
|
|
25611
|
+
responseData.push(chunk2);
|
|
25612
25612
|
});
|
|
25613
25613
|
res.on("end", () => {
|
|
25614
25614
|
if (res.statusCode && res.statusCode <= 299) {
|
|
@@ -29501,7 +29501,7 @@ ${callerStack}`;
|
|
|
29501
29501
|
var _a26, _b18;
|
|
29502
29502
|
return (_b18 = (_a26 = this.call) === null || _a26 === void 0 ? void 0 : _a26.getAuthContext()) !== null && _b18 !== void 0 ? _b18 : null;
|
|
29503
29503
|
}
|
|
29504
|
-
_write(
|
|
29504
|
+
_write(chunk2, encoding, cb) {
|
|
29505
29505
|
var _a26;
|
|
29506
29506
|
const context2 = {
|
|
29507
29507
|
callback: cb
|
|
@@ -29510,7 +29510,7 @@ ${callerStack}`;
|
|
|
29510
29510
|
if (!Number.isNaN(flags)) {
|
|
29511
29511
|
context2.flags = flags;
|
|
29512
29512
|
}
|
|
29513
|
-
(_a26 = this.call) === null || _a26 === void 0 ? void 0 : _a26.sendMessageWithContext(context2,
|
|
29513
|
+
(_a26 = this.call) === null || _a26 === void 0 ? void 0 : _a26.sendMessageWithContext(context2, chunk2);
|
|
29514
29514
|
}
|
|
29515
29515
|
_final(cb) {
|
|
29516
29516
|
var _a26;
|
|
@@ -29541,7 +29541,7 @@ ${callerStack}`;
|
|
|
29541
29541
|
var _a26;
|
|
29542
29542
|
(_a26 = this.call) === null || _a26 === void 0 ? void 0 : _a26.startRead();
|
|
29543
29543
|
}
|
|
29544
|
-
_write(
|
|
29544
|
+
_write(chunk2, encoding, cb) {
|
|
29545
29545
|
var _a26;
|
|
29546
29546
|
const context2 = {
|
|
29547
29547
|
callback: cb
|
|
@@ -29550,7 +29550,7 @@ ${callerStack}`;
|
|
|
29550
29550
|
if (!Number.isNaN(flags)) {
|
|
29551
29551
|
context2.flags = flags;
|
|
29552
29552
|
}
|
|
29553
|
-
(_a26 = this.call) === null || _a26 === void 0 ? void 0 : _a26.sendMessageWithContext(context2,
|
|
29553
|
+
(_a26 = this.call) === null || _a26 === void 0 ? void 0 : _a26.sendMessageWithContext(context2, chunk2);
|
|
29554
29554
|
}
|
|
29555
29555
|
_final(cb) {
|
|
29556
29556
|
var _a26;
|
|
@@ -40112,9 +40112,9 @@ var require_compression_filter = __commonJS({
|
|
|
40112
40112
|
let totalLength = 0;
|
|
40113
40113
|
const messageParts = [];
|
|
40114
40114
|
const decompresser = zlib2.createInflate();
|
|
40115
|
-
decompresser.on("data", (
|
|
40116
|
-
messageParts.push(
|
|
40117
|
-
totalLength +=
|
|
40115
|
+
decompresser.on("data", (chunk2) => {
|
|
40116
|
+
messageParts.push(chunk2);
|
|
40117
|
+
totalLength += chunk2.byteLength;
|
|
40118
40118
|
if (this.maxRecvMessageLength !== -1 && totalLength > this.maxRecvMessageLength) {
|
|
40119
40119
|
decompresser.destroy();
|
|
40120
40120
|
reject({
|
|
@@ -40152,9 +40152,9 @@ var require_compression_filter = __commonJS({
|
|
|
40152
40152
|
let totalLength = 0;
|
|
40153
40153
|
const messageParts = [];
|
|
40154
40154
|
const decompresser = zlib2.createGunzip();
|
|
40155
|
-
decompresser.on("data", (
|
|
40156
|
-
messageParts.push(
|
|
40157
|
-
totalLength +=
|
|
40155
|
+
decompresser.on("data", (chunk2) => {
|
|
40156
|
+
messageParts.push(chunk2);
|
|
40157
|
+
totalLength += chunk2.byteLength;
|
|
40158
40158
|
if (this.maxRecvMessageLength !== -1 && totalLength > this.maxRecvMessageLength) {
|
|
40159
40159
|
decompresser.destroy();
|
|
40160
40160
|
reject({
|
|
@@ -44598,8 +44598,8 @@ var require_server_call = __commonJS({
|
|
|
44598
44598
|
getMetricsRecorder() {
|
|
44599
44599
|
return this.call.getMetricsRecorder();
|
|
44600
44600
|
}
|
|
44601
|
-
_write(
|
|
44602
|
-
this.call.sendMessage(
|
|
44601
|
+
_write(chunk2, encoding, callback) {
|
|
44602
|
+
this.call.sendMessage(chunk2, callback);
|
|
44603
44603
|
}
|
|
44604
44604
|
_final(callback) {
|
|
44605
44605
|
var _a26;
|
|
@@ -44656,8 +44656,8 @@ var require_server_call = __commonJS({
|
|
|
44656
44656
|
_read(size) {
|
|
44657
44657
|
this.call.startRead();
|
|
44658
44658
|
}
|
|
44659
|
-
_write(
|
|
44660
|
-
this.call.sendMessage(
|
|
44659
|
+
_write(chunk2, encoding, callback) {
|
|
44660
|
+
this.call.sendMessage(chunk2, callback);
|
|
44661
44661
|
}
|
|
44662
44662
|
_final(callback) {
|
|
44663
44663
|
var _a26;
|
|
@@ -45810,9 +45810,9 @@ var require_server_interceptors = __commonJS({
|
|
|
45810
45810
|
return new Promise((resolve3, reject) => {
|
|
45811
45811
|
let totalLength = 0;
|
|
45812
45812
|
const messageParts = [];
|
|
45813
|
-
decompresser.on("data", (
|
|
45814
|
-
messageParts.push(
|
|
45815
|
-
totalLength +=
|
|
45813
|
+
decompresser.on("data", (chunk2) => {
|
|
45814
|
+
messageParts.push(chunk2);
|
|
45815
|
+
totalLength += chunk2.byteLength;
|
|
45816
45816
|
if (this.maxReceiveMessageSize !== -1 && totalLength > this.maxReceiveMessageSize) {
|
|
45817
45817
|
decompresser.destroy();
|
|
45818
45818
|
reject({
|
|
@@ -50761,8 +50761,8 @@ var require_util4 = __commonJS({
|
|
|
50761
50761
|
const { request } = url2.protocol === "http:" ? http : https;
|
|
50762
50762
|
const req = request(url2, reqOpts, (res) => {
|
|
50763
50763
|
let rawData = "";
|
|
50764
|
-
res.on("data", (
|
|
50765
|
-
rawData +=
|
|
50764
|
+
res.on("data", (chunk2) => {
|
|
50765
|
+
rawData += chunk2;
|
|
50766
50766
|
});
|
|
50767
50767
|
res.on("end", () => {
|
|
50768
50768
|
const statusCode = res.statusCode || 0;
|
|
@@ -74262,8 +74262,8 @@ var require_content_type_parser = __commonJS({
|
|
|
74262
74262
|
payload.on("end", onEnd);
|
|
74263
74263
|
payload.on("error", onEnd);
|
|
74264
74264
|
payload.resume();
|
|
74265
|
-
function onData(
|
|
74266
|
-
receivedLength += asString ? Buffer.byteLength(
|
|
74265
|
+
function onData(chunk2) {
|
|
74266
|
+
receivedLength += asString ? Buffer.byteLength(chunk2) : chunk2.length;
|
|
74267
74267
|
const { receivedEncodedLength = 0 } = payload;
|
|
74268
74268
|
if (receivedLength > limit || receivedEncodedLength > limit) {
|
|
74269
74269
|
payload.removeListener("data", onData);
|
|
@@ -74273,9 +74273,9 @@ var require_content_type_parser = __commonJS({
|
|
|
74273
74273
|
return;
|
|
74274
74274
|
}
|
|
74275
74275
|
if (asString) {
|
|
74276
|
-
body +=
|
|
74276
|
+
body += chunk2;
|
|
74277
74277
|
} else {
|
|
74278
|
-
body.push(
|
|
74278
|
+
body.push(chunk2);
|
|
74279
74279
|
}
|
|
74280
74280
|
}
|
|
74281
74281
|
function onEnd(err) {
|
|
@@ -78513,8 +78513,8 @@ var require_core = __commonJS({
|
|
|
78513
78513
|
return this;
|
|
78514
78514
|
}
|
|
78515
78515
|
case "object": {
|
|
78516
|
-
const
|
|
78517
|
-
this._cache.delete(
|
|
78516
|
+
const cacheKey2 = schemaKeyRef;
|
|
78517
|
+
this._cache.delete(cacheKey2);
|
|
78518
78518
|
let id = schemaKeyRef[this.opts.schemaId];
|
|
78519
78519
|
if (id) {
|
|
78520
78520
|
id = (0, resolve_1.normalizeId)(id);
|
|
@@ -93993,10 +93993,10 @@ var require_request2 = __commonJS({
|
|
|
93993
93993
|
const payload = this._lightMyRequest.payload;
|
|
93994
93994
|
let more = true;
|
|
93995
93995
|
let pushed = false;
|
|
93996
|
-
let
|
|
93997
|
-
while (more && (
|
|
93996
|
+
let chunk2;
|
|
93997
|
+
while (more && (chunk2 = payload.read())) {
|
|
93998
93998
|
pushed = true;
|
|
93999
|
-
more = this.push(
|
|
93999
|
+
more = this.push(chunk2);
|
|
94000
94000
|
}
|
|
94001
94001
|
if (more && !pushed) {
|
|
94002
94002
|
this._lightMyRequest.payload.once("readable", this._read.bind(this));
|
|
@@ -95275,7 +95275,7 @@ var require_light_my_request = __commonJS({
|
|
|
95275
95275
|
return next();
|
|
95276
95276
|
}
|
|
95277
95277
|
const chunks = [];
|
|
95278
|
-
payload.on("data", (
|
|
95278
|
+
payload.on("data", (chunk2) => chunks.push(Buffer.from(chunk2)));
|
|
95279
95279
|
payload.on("end", () => {
|
|
95280
95280
|
const payload2 = Buffer.concat(chunks);
|
|
95281
95281
|
req.headers["content-length"] = req.headers["content-length"] || "" + payload2.length;
|
|
@@ -99527,7 +99527,7 @@ var require_commonjs5 = __commonJS({
|
|
|
99527
99527
|
*/
|
|
99528
99528
|
set aborted(_3) {
|
|
99529
99529
|
}
|
|
99530
|
-
write(
|
|
99530
|
+
write(chunk2, encoding, cb) {
|
|
99531
99531
|
if (this[ABORTED2])
|
|
99532
99532
|
return false;
|
|
99533
99533
|
if (this[EOF])
|
|
@@ -99543,12 +99543,12 @@ var require_commonjs5 = __commonJS({
|
|
|
99543
99543
|
if (!encoding)
|
|
99544
99544
|
encoding = "utf8";
|
|
99545
99545
|
const fn = this[ASYNC] ? defer : nodefer;
|
|
99546
|
-
if (!this[OBJECTMODE] && !Buffer.isBuffer(
|
|
99547
|
-
if (isArrayBufferView(
|
|
99548
|
-
|
|
99549
|
-
} else if (isArrayBufferLike(
|
|
99550
|
-
|
|
99551
|
-
} else if (typeof
|
|
99546
|
+
if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk2)) {
|
|
99547
|
+
if (isArrayBufferView(chunk2)) {
|
|
99548
|
+
chunk2 = Buffer.from(chunk2.buffer, chunk2.byteOffset, chunk2.byteLength);
|
|
99549
|
+
} else if (isArrayBufferLike(chunk2)) {
|
|
99550
|
+
chunk2 = Buffer.from(chunk2);
|
|
99551
|
+
} else if (typeof chunk2 !== "string") {
|
|
99552
99552
|
throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
99553
99553
|
}
|
|
99554
99554
|
}
|
|
@@ -99556,35 +99556,35 @@ var require_commonjs5 = __commonJS({
|
|
|
99556
99556
|
if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
|
|
99557
99557
|
this[FLUSH](true);
|
|
99558
99558
|
if (this[FLOWING])
|
|
99559
|
-
this.emit("data",
|
|
99559
|
+
this.emit("data", chunk2);
|
|
99560
99560
|
else
|
|
99561
|
-
this[BUFFERPUSH](
|
|
99561
|
+
this[BUFFERPUSH](chunk2);
|
|
99562
99562
|
if (this[BUFFERLENGTH] !== 0)
|
|
99563
99563
|
this.emit("readable");
|
|
99564
99564
|
if (cb)
|
|
99565
99565
|
fn(cb);
|
|
99566
99566
|
return this[FLOWING];
|
|
99567
99567
|
}
|
|
99568
|
-
if (!
|
|
99568
|
+
if (!chunk2.length) {
|
|
99569
99569
|
if (this[BUFFERLENGTH] !== 0)
|
|
99570
99570
|
this.emit("readable");
|
|
99571
99571
|
if (cb)
|
|
99572
99572
|
fn(cb);
|
|
99573
99573
|
return this[FLOWING];
|
|
99574
99574
|
}
|
|
99575
|
-
if (typeof
|
|
99575
|
+
if (typeof chunk2 === "string" && // unless it is a string already ready for us to use
|
|
99576
99576
|
!(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) {
|
|
99577
|
-
|
|
99577
|
+
chunk2 = Buffer.from(chunk2, encoding);
|
|
99578
99578
|
}
|
|
99579
|
-
if (Buffer.isBuffer(
|
|
99580
|
-
|
|
99579
|
+
if (Buffer.isBuffer(chunk2) && this[ENCODING]) {
|
|
99580
|
+
chunk2 = this[DECODER].write(chunk2);
|
|
99581
99581
|
}
|
|
99582
99582
|
if (this[FLOWING] && this[BUFFERLENGTH] !== 0)
|
|
99583
99583
|
this[FLUSH](true);
|
|
99584
99584
|
if (this[FLOWING])
|
|
99585
|
-
this.emit("data",
|
|
99585
|
+
this.emit("data", chunk2);
|
|
99586
99586
|
else
|
|
99587
|
-
this[BUFFERPUSH](
|
|
99587
|
+
this[BUFFERPUSH](chunk2);
|
|
99588
99588
|
if (this[BUFFERLENGTH] !== 0)
|
|
99589
99589
|
this.emit("readable");
|
|
99590
99590
|
if (cb)
|
|
@@ -99623,39 +99623,39 @@ var require_commonjs5 = __commonJS({
|
|
|
99623
99623
|
this[MAYBE_EMIT_END]();
|
|
99624
99624
|
return ret;
|
|
99625
99625
|
}
|
|
99626
|
-
[READ](n,
|
|
99626
|
+
[READ](n, chunk2) {
|
|
99627
99627
|
if (this[OBJECTMODE])
|
|
99628
99628
|
this[BUFFERSHIFT]();
|
|
99629
99629
|
else {
|
|
99630
|
-
const c =
|
|
99630
|
+
const c = chunk2;
|
|
99631
99631
|
if (n === c.length || n === null)
|
|
99632
99632
|
this[BUFFERSHIFT]();
|
|
99633
99633
|
else if (typeof c === "string") {
|
|
99634
99634
|
this[BUFFER][0] = c.slice(n);
|
|
99635
|
-
|
|
99635
|
+
chunk2 = c.slice(0, n);
|
|
99636
99636
|
this[BUFFERLENGTH] -= n;
|
|
99637
99637
|
} else {
|
|
99638
99638
|
this[BUFFER][0] = c.subarray(n);
|
|
99639
|
-
|
|
99639
|
+
chunk2 = c.subarray(0, n);
|
|
99640
99640
|
this[BUFFERLENGTH] -= n;
|
|
99641
99641
|
}
|
|
99642
99642
|
}
|
|
99643
|
-
this.emit("data",
|
|
99643
|
+
this.emit("data", chunk2);
|
|
99644
99644
|
if (!this[BUFFER].length && !this[EOF])
|
|
99645
99645
|
this.emit("drain");
|
|
99646
|
-
return
|
|
99646
|
+
return chunk2;
|
|
99647
99647
|
}
|
|
99648
|
-
end(
|
|
99649
|
-
if (typeof
|
|
99650
|
-
cb =
|
|
99651
|
-
|
|
99648
|
+
end(chunk2, encoding, cb) {
|
|
99649
|
+
if (typeof chunk2 === "function") {
|
|
99650
|
+
cb = chunk2;
|
|
99651
|
+
chunk2 = void 0;
|
|
99652
99652
|
}
|
|
99653
99653
|
if (typeof encoding === "function") {
|
|
99654
99654
|
cb = encoding;
|
|
99655
99655
|
encoding = "utf8";
|
|
99656
99656
|
}
|
|
99657
|
-
if (
|
|
99658
|
-
this.write(
|
|
99657
|
+
if (chunk2 !== void 0)
|
|
99658
|
+
this.write(chunk2, encoding);
|
|
99659
99659
|
if (cb)
|
|
99660
99660
|
this.once("end", cb);
|
|
99661
99661
|
this[EOF] = true;
|
|
@@ -99720,12 +99720,12 @@ var require_commonjs5 = __commonJS({
|
|
|
99720
99720
|
get paused() {
|
|
99721
99721
|
return this[PAUSED];
|
|
99722
99722
|
}
|
|
99723
|
-
[BUFFERPUSH](
|
|
99723
|
+
[BUFFERPUSH](chunk2) {
|
|
99724
99724
|
if (this[OBJECTMODE])
|
|
99725
99725
|
this[BUFFERLENGTH] += 1;
|
|
99726
99726
|
else
|
|
99727
|
-
this[BUFFERLENGTH] +=
|
|
99728
|
-
this[BUFFER].push(
|
|
99727
|
+
this[BUFFERLENGTH] += chunk2.length;
|
|
99728
|
+
this[BUFFER].push(chunk2);
|
|
99729
99729
|
}
|
|
99730
99730
|
[BUFFERSHIFT]() {
|
|
99731
99731
|
if (this[OBJECTMODE])
|
|
@@ -99740,8 +99740,8 @@ var require_commonjs5 = __commonJS({
|
|
|
99740
99740
|
if (!noDrain && !this[BUFFER].length && !this[EOF])
|
|
99741
99741
|
this.emit("drain");
|
|
99742
99742
|
}
|
|
99743
|
-
[FLUSHCHUNK](
|
|
99744
|
-
this.emit("data",
|
|
99743
|
+
[FLUSHCHUNK](chunk2) {
|
|
99744
|
+
this.emit("data", chunk2);
|
|
99745
99745
|
return this[FLOWING];
|
|
99746
99746
|
}
|
|
99747
99747
|
/**
|
|
@@ -106259,14 +106259,14 @@ var require_permessage_deflate = __commonJS({
|
|
|
106259
106259
|
}
|
|
106260
106260
|
};
|
|
106261
106261
|
module.exports = PerMessageDeflate;
|
|
106262
|
-
function deflateOnData(
|
|
106263
|
-
this[kBuffers].push(
|
|
106264
|
-
this[kTotalLength] +=
|
|
106262
|
+
function deflateOnData(chunk2) {
|
|
106263
|
+
this[kBuffers].push(chunk2);
|
|
106264
|
+
this[kTotalLength] += chunk2.length;
|
|
106265
106265
|
}
|
|
106266
|
-
function inflateOnData(
|
|
106267
|
-
this[kTotalLength] +=
|
|
106266
|
+
function inflateOnData(chunk2) {
|
|
106267
|
+
this[kTotalLength] += chunk2.length;
|
|
106268
106268
|
if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
|
|
106269
|
-
this[kBuffers].push(
|
|
106269
|
+
this[kBuffers].push(chunk2);
|
|
106270
106270
|
return;
|
|
106271
106271
|
}
|
|
106272
106272
|
this[kError] = new RangeError("Max payload size exceeded");
|
|
@@ -106560,10 +106560,10 @@ var require_receiver = __commonJS({
|
|
|
106560
106560
|
* @param {Function} cb Callback
|
|
106561
106561
|
* @private
|
|
106562
106562
|
*/
|
|
106563
|
-
_write(
|
|
106563
|
+
_write(chunk2, encoding, cb) {
|
|
106564
106564
|
if (this._opcode === 8 && this._state == GET_INFO) return cb();
|
|
106565
|
-
this._bufferedBytes +=
|
|
106566
|
-
this._buffers.push(
|
|
106565
|
+
this._bufferedBytes += chunk2.length;
|
|
106566
|
+
this._buffers.push(chunk2);
|
|
106567
106567
|
this.startLoop(cb);
|
|
106568
106568
|
}
|
|
106569
106569
|
/**
|
|
@@ -107959,7 +107959,7 @@ var require_websocket = __commonJS({
|
|
|
107959
107959
|
var http = __require("http");
|
|
107960
107960
|
var net2 = __require("net");
|
|
107961
107961
|
var tls = __require("tls");
|
|
107962
|
-
var { randomBytes: randomBytes3, createHash:
|
|
107962
|
+
var { randomBytes: randomBytes3, createHash: createHash9 } = __require("crypto");
|
|
107963
107963
|
var { Duplex, Readable: Readable4 } = __require("stream");
|
|
107964
107964
|
var { URL: URL2 } = __require("url");
|
|
107965
107965
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -108619,7 +108619,7 @@ var require_websocket = __commonJS({
|
|
|
108619
108619
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
108620
108620
|
return;
|
|
108621
108621
|
}
|
|
108622
|
-
const digest =
|
|
108622
|
+
const digest = createHash9("sha1").update(key + GUID).digest("base64");
|
|
108623
108623
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
108624
108624
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
108625
108625
|
return;
|
|
@@ -108800,8 +108800,8 @@ var require_websocket = __commonJS({
|
|
|
108800
108800
|
this.removeListener("end", socketOnEnd);
|
|
108801
108801
|
websocket._readyState = WebSocket2.CLOSING;
|
|
108802
108802
|
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
108803
|
-
const
|
|
108804
|
-
websocket._receiver.write(
|
|
108803
|
+
const chunk2 = this.read(this._readableState.length);
|
|
108804
|
+
websocket._receiver.write(chunk2);
|
|
108805
108805
|
}
|
|
108806
108806
|
websocket._receiver.end();
|
|
108807
108807
|
this[kWebSocket] = void 0;
|
|
@@ -108813,8 +108813,8 @@ var require_websocket = __commonJS({
|
|
|
108813
108813
|
websocket._receiver.on("finish", receiverOnFinish);
|
|
108814
108814
|
}
|
|
108815
108815
|
}
|
|
108816
|
-
function socketOnData(
|
|
108817
|
-
if (!this[kWebSocket]._receiver.write(
|
|
108816
|
+
function socketOnData(chunk2) {
|
|
108817
|
+
if (!this[kWebSocket]._receiver.write(chunk2)) {
|
|
108818
108818
|
this.pause();
|
|
108819
108819
|
}
|
|
108820
108820
|
}
|
|
@@ -108917,14 +108917,14 @@ var require_stream = __commonJS({
|
|
|
108917
108917
|
duplex._read = function() {
|
|
108918
108918
|
if (ws.isPaused) ws.resume();
|
|
108919
108919
|
};
|
|
108920
|
-
duplex._write = function(
|
|
108920
|
+
duplex._write = function(chunk2, encoding, callback) {
|
|
108921
108921
|
if (ws.readyState === ws.CONNECTING) {
|
|
108922
108922
|
ws.once("open", function open4() {
|
|
108923
|
-
duplex._write(
|
|
108923
|
+
duplex._write(chunk2, encoding, callback);
|
|
108924
108924
|
});
|
|
108925
108925
|
return;
|
|
108926
108926
|
}
|
|
108927
|
-
ws.send(
|
|
108927
|
+
ws.send(chunk2, callback);
|
|
108928
108928
|
};
|
|
108929
108929
|
duplex.on("end", duplexOnEnd);
|
|
108930
108930
|
duplex.on("error", duplexOnError);
|
|
@@ -108986,7 +108986,7 @@ var require_websocket_server = __commonJS({
|
|
|
108986
108986
|
var EventEmitter3 = __require("events");
|
|
108987
108987
|
var http = __require("http");
|
|
108988
108988
|
var { Duplex } = __require("stream");
|
|
108989
|
-
var { createHash:
|
|
108989
|
+
var { createHash: createHash9 } = __require("crypto");
|
|
108990
108990
|
var extension = require_extension();
|
|
108991
108991
|
var PerMessageDeflate = require_permessage_deflate();
|
|
108992
108992
|
var subprotocol = require_subprotocol();
|
|
@@ -109287,7 +109287,7 @@ var require_websocket_server = __commonJS({
|
|
|
109287
109287
|
);
|
|
109288
109288
|
}
|
|
109289
109289
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
109290
|
-
const digest =
|
|
109290
|
+
const digest = createHash9("sha1").update(key + GUID).digest("base64");
|
|
109291
109291
|
const headers = [
|
|
109292
109292
|
"HTTP/1.1 101 Switching Protocols",
|
|
109293
109293
|
"Upgrade: websocket",
|
|
@@ -109879,8 +109879,8 @@ var require_stream_writable = __commonJS({
|
|
|
109879
109879
|
var Buffer3 = __require("buffer").Buffer;
|
|
109880
109880
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
109881
109881
|
};
|
|
109882
|
-
function _uint8ArrayToBuffer(
|
|
109883
|
-
return Buffer3.from(
|
|
109882
|
+
function _uint8ArrayToBuffer(chunk2) {
|
|
109883
|
+
return Buffer3.from(chunk2);
|
|
109884
109884
|
}
|
|
109885
109885
|
function _isUint8Array(obj) {
|
|
109886
109886
|
return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
@@ -109993,12 +109993,12 @@ var require_stream_writable = __commonJS({
|
|
|
109993
109993
|
errorOrDestroy(stream, er);
|
|
109994
109994
|
process.nextTick(cb, er);
|
|
109995
109995
|
}
|
|
109996
|
-
function validChunk(stream, state,
|
|
109996
|
+
function validChunk(stream, state, chunk2, cb) {
|
|
109997
109997
|
var er;
|
|
109998
|
-
if (
|
|
109998
|
+
if (chunk2 === null) {
|
|
109999
109999
|
er = new ERR_STREAM_NULL_VALUES();
|
|
110000
|
-
} else if (typeof
|
|
110001
|
-
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"],
|
|
110000
|
+
} else if (typeof chunk2 !== "string" && !state.objectMode) {
|
|
110001
|
+
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk2);
|
|
110002
110002
|
}
|
|
110003
110003
|
if (er) {
|
|
110004
110004
|
errorOrDestroy(stream, er);
|
|
@@ -110007,12 +110007,12 @@ var require_stream_writable = __commonJS({
|
|
|
110007
110007
|
}
|
|
110008
110008
|
return true;
|
|
110009
110009
|
}
|
|
110010
|
-
Writable2.prototype.write = function(
|
|
110010
|
+
Writable2.prototype.write = function(chunk2, encoding, cb) {
|
|
110011
110011
|
var state = this._writableState;
|
|
110012
110012
|
var ret = false;
|
|
110013
|
-
var isBuf = !state.objectMode && _isUint8Array(
|
|
110014
|
-
if (isBuf && !Buffer3.isBuffer(
|
|
110015
|
-
|
|
110013
|
+
var isBuf = !state.objectMode && _isUint8Array(chunk2);
|
|
110014
|
+
if (isBuf && !Buffer3.isBuffer(chunk2)) {
|
|
110015
|
+
chunk2 = _uint8ArrayToBuffer(chunk2);
|
|
110016
110016
|
}
|
|
110017
110017
|
if (typeof encoding === "function") {
|
|
110018
110018
|
cb = encoding;
|
|
@@ -110022,9 +110022,9 @@ var require_stream_writable = __commonJS({
|
|
|
110022
110022
|
else if (!encoding) encoding = state.defaultEncoding;
|
|
110023
110023
|
if (typeof cb !== "function") cb = nop;
|
|
110024
110024
|
if (state.ending) writeAfterEnd(this, cb);
|
|
110025
|
-
else if (isBuf || validChunk(this, state,
|
|
110025
|
+
else if (isBuf || validChunk(this, state, chunk2, cb)) {
|
|
110026
110026
|
state.pendingcb++;
|
|
110027
|
-
ret = writeOrBuffer(this, state, isBuf,
|
|
110027
|
+
ret = writeOrBuffer(this, state, isBuf, chunk2, encoding, cb);
|
|
110028
110028
|
}
|
|
110029
110029
|
return ret;
|
|
110030
110030
|
};
|
|
@@ -110053,11 +110053,11 @@ var require_stream_writable = __commonJS({
|
|
|
110053
110053
|
return this._writableState && this._writableState.getBuffer();
|
|
110054
110054
|
}
|
|
110055
110055
|
});
|
|
110056
|
-
function decodeChunk(state,
|
|
110057
|
-
if (!state.objectMode && state.decodeStrings !== false && typeof
|
|
110058
|
-
|
|
110056
|
+
function decodeChunk(state, chunk2, encoding) {
|
|
110057
|
+
if (!state.objectMode && state.decodeStrings !== false && typeof chunk2 === "string") {
|
|
110058
|
+
chunk2 = Buffer3.from(chunk2, encoding);
|
|
110059
110059
|
}
|
|
110060
|
-
return
|
|
110060
|
+
return chunk2;
|
|
110061
110061
|
}
|
|
110062
110062
|
Object.defineProperty(Writable2.prototype, "writableHighWaterMark", {
|
|
110063
110063
|
// making it explicit this property is not enumerable
|
|
@@ -110068,23 +110068,23 @@ var require_stream_writable = __commonJS({
|
|
|
110068
110068
|
return this._writableState.highWaterMark;
|
|
110069
110069
|
}
|
|
110070
110070
|
});
|
|
110071
|
-
function writeOrBuffer(stream, state, isBuf,
|
|
110071
|
+
function writeOrBuffer(stream, state, isBuf, chunk2, encoding, cb) {
|
|
110072
110072
|
if (!isBuf) {
|
|
110073
|
-
var newChunk = decodeChunk(state,
|
|
110074
|
-
if (
|
|
110073
|
+
var newChunk = decodeChunk(state, chunk2, encoding);
|
|
110074
|
+
if (chunk2 !== newChunk) {
|
|
110075
110075
|
isBuf = true;
|
|
110076
110076
|
encoding = "buffer";
|
|
110077
|
-
|
|
110077
|
+
chunk2 = newChunk;
|
|
110078
110078
|
}
|
|
110079
110079
|
}
|
|
110080
|
-
var len = state.objectMode ? 1 :
|
|
110080
|
+
var len = state.objectMode ? 1 : chunk2.length;
|
|
110081
110081
|
state.length += len;
|
|
110082
110082
|
var ret = state.length < state.highWaterMark;
|
|
110083
110083
|
if (!ret) state.needDrain = true;
|
|
110084
110084
|
if (state.writing || state.corked) {
|
|
110085
110085
|
var last = state.lastBufferedRequest;
|
|
110086
110086
|
state.lastBufferedRequest = {
|
|
110087
|
-
chunk,
|
|
110087
|
+
chunk: chunk2,
|
|
110088
110088
|
encoding,
|
|
110089
110089
|
isBuf,
|
|
110090
110090
|
callback: cb,
|
|
@@ -110097,18 +110097,18 @@ var require_stream_writable = __commonJS({
|
|
|
110097
110097
|
}
|
|
110098
110098
|
state.bufferedRequestCount += 1;
|
|
110099
110099
|
} else {
|
|
110100
|
-
doWrite(stream, state, false, len,
|
|
110100
|
+
doWrite(stream, state, false, len, chunk2, encoding, cb);
|
|
110101
110101
|
}
|
|
110102
110102
|
return ret;
|
|
110103
110103
|
}
|
|
110104
|
-
function doWrite(stream, state, writev, len,
|
|
110104
|
+
function doWrite(stream, state, writev, len, chunk2, encoding, cb) {
|
|
110105
110105
|
state.writelen = len;
|
|
110106
110106
|
state.writecb = cb;
|
|
110107
110107
|
state.writing = true;
|
|
110108
110108
|
state.sync = true;
|
|
110109
110109
|
if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED("write"));
|
|
110110
|
-
else if (writev) stream._writev(
|
|
110111
|
-
else stream._write(
|
|
110110
|
+
else if (writev) stream._writev(chunk2, state.onwrite);
|
|
110111
|
+
else stream._write(chunk2, encoding, state.onwrite);
|
|
110112
110112
|
state.sync = false;
|
|
110113
110113
|
}
|
|
110114
110114
|
function onwriteError(stream, state, sync, er, cb) {
|
|
@@ -110191,11 +110191,11 @@ var require_stream_writable = __commonJS({
|
|
|
110191
110191
|
state.bufferedRequestCount = 0;
|
|
110192
110192
|
} else {
|
|
110193
110193
|
while (entry) {
|
|
110194
|
-
var
|
|
110194
|
+
var chunk2 = entry.chunk;
|
|
110195
110195
|
var encoding = entry.encoding;
|
|
110196
110196
|
var cb = entry.callback;
|
|
110197
|
-
var len = state.objectMode ? 1 :
|
|
110198
|
-
doWrite(stream, state, false, len,
|
|
110197
|
+
var len = state.objectMode ? 1 : chunk2.length;
|
|
110198
|
+
doWrite(stream, state, false, len, chunk2, encoding, cb);
|
|
110199
110199
|
entry = entry.next;
|
|
110200
110200
|
state.bufferedRequestCount--;
|
|
110201
110201
|
if (state.writing) {
|
|
@@ -110207,21 +110207,21 @@ var require_stream_writable = __commonJS({
|
|
|
110207
110207
|
state.bufferedRequest = entry;
|
|
110208
110208
|
state.bufferProcessing = false;
|
|
110209
110209
|
}
|
|
110210
|
-
Writable2.prototype._write = function(
|
|
110210
|
+
Writable2.prototype._write = function(chunk2, encoding, cb) {
|
|
110211
110211
|
cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
|
|
110212
110212
|
};
|
|
110213
110213
|
Writable2.prototype._writev = null;
|
|
110214
|
-
Writable2.prototype.end = function(
|
|
110214
|
+
Writable2.prototype.end = function(chunk2, encoding, cb) {
|
|
110215
110215
|
var state = this._writableState;
|
|
110216
|
-
if (typeof
|
|
110217
|
-
cb =
|
|
110218
|
-
|
|
110216
|
+
if (typeof chunk2 === "function") {
|
|
110217
|
+
cb = chunk2;
|
|
110218
|
+
chunk2 = null;
|
|
110219
110219
|
encoding = null;
|
|
110220
110220
|
} else if (typeof encoding === "function") {
|
|
110221
110221
|
cb = encoding;
|
|
110222
110222
|
encoding = null;
|
|
110223
110223
|
}
|
|
110224
|
-
if (
|
|
110224
|
+
if (chunk2 !== null && chunk2 !== void 0) this.write(chunk2, encoding);
|
|
110225
110225
|
if (state.corked) {
|
|
110226
110226
|
state.corked = 1;
|
|
110227
110227
|
this.uncork();
|
|
@@ -111067,8 +111067,8 @@ var require_stream_readable = __commonJS({
|
|
|
111067
111067
|
var Buffer3 = __require("buffer").Buffer;
|
|
111068
111068
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
111069
111069
|
};
|
|
111070
|
-
function _uint8ArrayToBuffer(
|
|
111071
|
-
return Buffer3.from(
|
|
111070
|
+
function _uint8ArrayToBuffer(chunk2) {
|
|
111071
|
+
return Buffer3.from(chunk2);
|
|
111072
111072
|
}
|
|
111073
111073
|
function _isUint8Array(obj) {
|
|
111074
111074
|
return Buffer3.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
@@ -111172,14 +111172,14 @@ var require_stream_readable = __commonJS({
|
|
|
111172
111172
|
Readable4.prototype._destroy = function(err, cb) {
|
|
111173
111173
|
cb(err);
|
|
111174
111174
|
};
|
|
111175
|
-
Readable4.prototype.push = function(
|
|
111175
|
+
Readable4.prototype.push = function(chunk2, encoding) {
|
|
111176
111176
|
var state = this._readableState;
|
|
111177
111177
|
var skipChunkCheck;
|
|
111178
111178
|
if (!state.objectMode) {
|
|
111179
|
-
if (typeof
|
|
111179
|
+
if (typeof chunk2 === "string") {
|
|
111180
111180
|
encoding = encoding || state.defaultEncoding;
|
|
111181
111181
|
if (encoding !== state.encoding) {
|
|
111182
|
-
|
|
111182
|
+
chunk2 = Buffer3.from(chunk2, encoding);
|
|
111183
111183
|
encoding = "";
|
|
111184
111184
|
}
|
|
111185
111185
|
skipChunkCheck = true;
|
|
@@ -111187,29 +111187,29 @@ var require_stream_readable = __commonJS({
|
|
|
111187
111187
|
} else {
|
|
111188
111188
|
skipChunkCheck = true;
|
|
111189
111189
|
}
|
|
111190
|
-
return readableAddChunk(this,
|
|
111190
|
+
return readableAddChunk(this, chunk2, encoding, false, skipChunkCheck);
|
|
111191
111191
|
};
|
|
111192
|
-
Readable4.prototype.unshift = function(
|
|
111193
|
-
return readableAddChunk(this,
|
|
111192
|
+
Readable4.prototype.unshift = function(chunk2) {
|
|
111193
|
+
return readableAddChunk(this, chunk2, null, true, false);
|
|
111194
111194
|
};
|
|
111195
|
-
function readableAddChunk(stream,
|
|
111196
|
-
debug("readableAddChunk",
|
|
111195
|
+
function readableAddChunk(stream, chunk2, encoding, addToFront, skipChunkCheck) {
|
|
111196
|
+
debug("readableAddChunk", chunk2);
|
|
111197
111197
|
var state = stream._readableState;
|
|
111198
|
-
if (
|
|
111198
|
+
if (chunk2 === null) {
|
|
111199
111199
|
state.reading = false;
|
|
111200
111200
|
onEofChunk(stream, state);
|
|
111201
111201
|
} else {
|
|
111202
111202
|
var er;
|
|
111203
|
-
if (!skipChunkCheck) er = chunkInvalid(state,
|
|
111203
|
+
if (!skipChunkCheck) er = chunkInvalid(state, chunk2);
|
|
111204
111204
|
if (er) {
|
|
111205
111205
|
errorOrDestroy(stream, er);
|
|
111206
|
-
} else if (state.objectMode ||
|
|
111207
|
-
if (typeof
|
|
111208
|
-
|
|
111206
|
+
} else if (state.objectMode || chunk2 && chunk2.length > 0) {
|
|
111207
|
+
if (typeof chunk2 !== "string" && !state.objectMode && Object.getPrototypeOf(chunk2) !== Buffer3.prototype) {
|
|
111208
|
+
chunk2 = _uint8ArrayToBuffer(chunk2);
|
|
111209
111209
|
}
|
|
111210
111210
|
if (addToFront) {
|
|
111211
111211
|
if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
|
|
111212
|
-
else addChunk(stream, state,
|
|
111212
|
+
else addChunk(stream, state, chunk2, true);
|
|
111213
111213
|
} else if (state.ended) {
|
|
111214
111214
|
errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
|
|
111215
111215
|
} else if (state.destroyed) {
|
|
@@ -111217,11 +111217,11 @@ var require_stream_readable = __commonJS({
|
|
|
111217
111217
|
} else {
|
|
111218
111218
|
state.reading = false;
|
|
111219
111219
|
if (state.decoder && !encoding) {
|
|
111220
|
-
|
|
111221
|
-
if (state.objectMode ||
|
|
111220
|
+
chunk2 = state.decoder.write(chunk2);
|
|
111221
|
+
if (state.objectMode || chunk2.length !== 0) addChunk(stream, state, chunk2, false);
|
|
111222
111222
|
else maybeReadMore(stream, state);
|
|
111223
111223
|
} else {
|
|
111224
|
-
addChunk(stream, state,
|
|
111224
|
+
addChunk(stream, state, chunk2, false);
|
|
111225
111225
|
}
|
|
111226
111226
|
}
|
|
111227
111227
|
} else if (!addToFront) {
|
|
@@ -111231,22 +111231,22 @@ var require_stream_readable = __commonJS({
|
|
|
111231
111231
|
}
|
|
111232
111232
|
return !state.ended && (state.length < state.highWaterMark || state.length === 0);
|
|
111233
111233
|
}
|
|
111234
|
-
function addChunk(stream, state,
|
|
111234
|
+
function addChunk(stream, state, chunk2, addToFront) {
|
|
111235
111235
|
if (state.flowing && state.length === 0 && !state.sync) {
|
|
111236
111236
|
state.awaitDrain = 0;
|
|
111237
|
-
stream.emit("data",
|
|
111237
|
+
stream.emit("data", chunk2);
|
|
111238
111238
|
} else {
|
|
111239
|
-
state.length += state.objectMode ? 1 :
|
|
111240
|
-
if (addToFront) state.buffer.unshift(
|
|
111241
|
-
else state.buffer.push(
|
|
111239
|
+
state.length += state.objectMode ? 1 : chunk2.length;
|
|
111240
|
+
if (addToFront) state.buffer.unshift(chunk2);
|
|
111241
|
+
else state.buffer.push(chunk2);
|
|
111242
111242
|
if (state.needReadable) emitReadable(stream);
|
|
111243
111243
|
}
|
|
111244
111244
|
maybeReadMore(stream, state);
|
|
111245
111245
|
}
|
|
111246
|
-
function chunkInvalid(state,
|
|
111246
|
+
function chunkInvalid(state, chunk2) {
|
|
111247
111247
|
var er;
|
|
111248
|
-
if (!_isUint8Array(
|
|
111249
|
-
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"],
|
|
111248
|
+
if (!_isUint8Array(chunk2) && typeof chunk2 !== "string" && chunk2 !== void 0 && !state.objectMode) {
|
|
111249
|
+
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk2);
|
|
111250
111250
|
}
|
|
111251
111251
|
return er;
|
|
111252
111252
|
}
|
|
@@ -111355,10 +111355,10 @@ var require_stream_readable = __commonJS({
|
|
|
111355
111355
|
debug("onEofChunk");
|
|
111356
111356
|
if (state.ended) return;
|
|
111357
111357
|
if (state.decoder) {
|
|
111358
|
-
var
|
|
111359
|
-
if (
|
|
111360
|
-
state.buffer.push(
|
|
111361
|
-
state.length += state.objectMode ? 1 :
|
|
111358
|
+
var chunk2 = state.decoder.end();
|
|
111359
|
+
if (chunk2 && chunk2.length) {
|
|
111360
|
+
state.buffer.push(chunk2);
|
|
111361
|
+
state.length += state.objectMode ? 1 : chunk2.length;
|
|
111362
111362
|
}
|
|
111363
111363
|
}
|
|
111364
111364
|
state.ended = true;
|
|
@@ -111462,9 +111462,9 @@ var require_stream_readable = __commonJS({
|
|
|
111462
111462
|
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
|
111463
111463
|
}
|
|
111464
111464
|
src.on("data", ondata);
|
|
111465
|
-
function ondata(
|
|
111465
|
+
function ondata(chunk2) {
|
|
111466
111466
|
debug("ondata");
|
|
111467
|
-
var ret = dest.write(
|
|
111467
|
+
var ret = dest.write(chunk2);
|
|
111468
111468
|
debug("dest.write", ret);
|
|
111469
111469
|
if (ret === false) {
|
|
111470
111470
|
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
|
@@ -111645,17 +111645,17 @@ var require_stream_readable = __commonJS({
|
|
|
111645
111645
|
stream.on("end", function() {
|
|
111646
111646
|
debug("wrapped end");
|
|
111647
111647
|
if (state.decoder && !state.ended) {
|
|
111648
|
-
var
|
|
111649
|
-
if (
|
|
111648
|
+
var chunk2 = state.decoder.end();
|
|
111649
|
+
if (chunk2 && chunk2.length) _this.push(chunk2);
|
|
111650
111650
|
}
|
|
111651
111651
|
_this.push(null);
|
|
111652
111652
|
});
|
|
111653
|
-
stream.on("data", function(
|
|
111653
|
+
stream.on("data", function(chunk2) {
|
|
111654
111654
|
debug("wrapped data");
|
|
111655
|
-
if (state.decoder)
|
|
111656
|
-
if (state.objectMode && (
|
|
111657
|
-
else if (!state.objectMode && (!
|
|
111658
|
-
var ret = _this.push(
|
|
111655
|
+
if (state.decoder) chunk2 = state.decoder.write(chunk2);
|
|
111656
|
+
if (state.objectMode && (chunk2 === null || chunk2 === void 0)) return;
|
|
111657
|
+
else if (!state.objectMode && (!chunk2 || !chunk2.length)) return;
|
|
111658
|
+
var ret = _this.push(chunk2);
|
|
111659
111659
|
if (!ret) {
|
|
111660
111660
|
paused = true;
|
|
111661
111661
|
stream.pause();
|
|
@@ -111844,17 +111844,17 @@ var require_stream_transform = __commonJS({
|
|
|
111844
111844
|
done(this, null, null);
|
|
111845
111845
|
}
|
|
111846
111846
|
}
|
|
111847
|
-
Transform.prototype.push = function(
|
|
111847
|
+
Transform.prototype.push = function(chunk2, encoding) {
|
|
111848
111848
|
this._transformState.needTransform = false;
|
|
111849
|
-
return Duplex.prototype.push.call(this,
|
|
111849
|
+
return Duplex.prototype.push.call(this, chunk2, encoding);
|
|
111850
111850
|
};
|
|
111851
|
-
Transform.prototype._transform = function(
|
|
111851
|
+
Transform.prototype._transform = function(chunk2, encoding, cb) {
|
|
111852
111852
|
cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
|
|
111853
111853
|
};
|
|
111854
|
-
Transform.prototype._write = function(
|
|
111854
|
+
Transform.prototype._write = function(chunk2, encoding, cb) {
|
|
111855
111855
|
var ts = this._transformState;
|
|
111856
111856
|
ts.writecb = cb;
|
|
111857
|
-
ts.writechunk =
|
|
111857
|
+
ts.writechunk = chunk2;
|
|
111858
111858
|
ts.writeencoding = encoding;
|
|
111859
111859
|
if (!ts.transforming) {
|
|
111860
111860
|
var rs = this._readableState;
|
|
@@ -111897,8 +111897,8 @@ var require_stream_passthrough = __commonJS({
|
|
|
111897
111897
|
if (!(this instanceof PassThrough)) return new PassThrough(options);
|
|
111898
111898
|
Transform.call(this, options);
|
|
111899
111899
|
}
|
|
111900
|
-
PassThrough.prototype._transform = function(
|
|
111901
|
-
cb(null,
|
|
111900
|
+
PassThrough.prototype._transform = function(chunk2, encoding, cb) {
|
|
111901
|
+
cb(null, chunk2);
|
|
111902
111902
|
};
|
|
111903
111903
|
}
|
|
111904
111904
|
});
|
|
@@ -112441,13 +112441,13 @@ var require_websocket2 = __commonJS({
|
|
|
112441
112441
|
clientStream.removeListener("data", onData);
|
|
112442
112442
|
resolve3(ws);
|
|
112443
112443
|
});
|
|
112444
|
-
const onData = (
|
|
112445
|
-
if (
|
|
112444
|
+
const onData = (chunk2) => {
|
|
112445
|
+
if (chunk2.toString().includes("HTTP/1.1 101 Switching Protocols")) {
|
|
112446
112446
|
ws._isServer = false;
|
|
112447
112447
|
ws.setSocket(clientStream, head, { maxPayload: 0 });
|
|
112448
112448
|
} else {
|
|
112449
112449
|
clientStream.removeListener("data", onData);
|
|
112450
|
-
const statusCode = Number(statusCodeReg.exec(
|
|
112450
|
+
const statusCode = Number(statusCodeReg.exec(chunk2.toString())[1]);
|
|
112451
112451
|
reject(new Error("Unexpected server response: " + statusCode));
|
|
112452
112452
|
}
|
|
112453
112453
|
};
|
|
@@ -112623,15 +112623,15 @@ var require_sbmh = __commonJS({
|
|
|
112623
112623
|
this.matches = 0;
|
|
112624
112624
|
this._bufpos = 0;
|
|
112625
112625
|
};
|
|
112626
|
-
SBMH.prototype.push = function(
|
|
112627
|
-
if (!Buffer.isBuffer(
|
|
112628
|
-
|
|
112626
|
+
SBMH.prototype.push = function(chunk2, pos) {
|
|
112627
|
+
if (!Buffer.isBuffer(chunk2)) {
|
|
112628
|
+
chunk2 = Buffer.from(chunk2, "binary");
|
|
112629
112629
|
}
|
|
112630
|
-
const chlen =
|
|
112630
|
+
const chlen = chunk2.length;
|
|
112631
112631
|
this._bufpos = pos || 0;
|
|
112632
112632
|
let r;
|
|
112633
112633
|
while (r !== chlen && this.matches < this.maxMatches) {
|
|
112634
|
-
r = this._sbmh_feed(
|
|
112634
|
+
r = this._sbmh_feed(chunk2);
|
|
112635
112635
|
}
|
|
112636
112636
|
return r;
|
|
112637
112637
|
};
|
|
@@ -114067,8 +114067,8 @@ var require_multipart = __commonJS({
|
|
|
114067
114067
|
checkFinished();
|
|
114068
114068
|
});
|
|
114069
114069
|
}
|
|
114070
|
-
Multipart.prototype.write = function(
|
|
114071
|
-
const r = this.parser.write(
|
|
114070
|
+
Multipart.prototype.write = function(chunk2, cb) {
|
|
114071
|
+
const r = this.parser.write(chunk2);
|
|
114072
114072
|
if (r && !this._pause) {
|
|
114073
114073
|
cb();
|
|
114074
114074
|
} else {
|
|
@@ -114565,8 +114565,8 @@ var require_main = __commonJS({
|
|
|
114565
114565
|
}
|
|
114566
114566
|
throw new Error("Unsupported Content-Type.");
|
|
114567
114567
|
};
|
|
114568
|
-
Busboy.prototype._write = function(
|
|
114569
|
-
this._parser.write(
|
|
114568
|
+
Busboy.prototype._write = function(chunk2, encoding, cb) {
|
|
114569
|
+
this._parser.write(chunk2, cb);
|
|
114570
114570
|
};
|
|
114571
114571
|
module.exports = Busboy;
|
|
114572
114572
|
module.exports.default = Busboy;
|
|
@@ -115308,8 +115308,8 @@ var require_multipart2 = __commonJS({
|
|
|
115308
115308
|
}
|
|
115309
115309
|
const fileChunks = [];
|
|
115310
115310
|
let err;
|
|
115311
|
-
for await (const
|
|
115312
|
-
fileChunks.push(
|
|
115311
|
+
for await (const chunk2 of this.file) {
|
|
115312
|
+
fileChunks.push(chunk2);
|
|
115313
115313
|
if (throwFileSizeLimit && this.file.truncated) {
|
|
115314
115314
|
err = new RequestFileTooLargeError();
|
|
115315
115315
|
err.part = this;
|
|
@@ -118335,13 +118335,13 @@ var require_request3 = __commonJS({
|
|
|
118335
118335
|
channels.create.publish({ request: this });
|
|
118336
118336
|
}
|
|
118337
118337
|
}
|
|
118338
|
-
onBodySent(
|
|
118338
|
+
onBodySent(chunk2) {
|
|
118339
118339
|
if (channels.bodyChunkSent.hasSubscribers) {
|
|
118340
|
-
channels.bodyChunkSent.publish({ request: this, chunk });
|
|
118340
|
+
channels.bodyChunkSent.publish({ request: this, chunk: chunk2 });
|
|
118341
118341
|
}
|
|
118342
118342
|
if (this[kHandler].onBodySent) {
|
|
118343
118343
|
try {
|
|
118344
|
-
return this[kHandler].onBodySent(
|
|
118344
|
+
return this[kHandler].onBodySent(chunk2);
|
|
118345
118345
|
} catch (err) {
|
|
118346
118346
|
this.abort(err);
|
|
118347
118347
|
}
|
|
@@ -118384,14 +118384,14 @@ var require_request3 = __commonJS({
|
|
|
118384
118384
|
this.abort(err);
|
|
118385
118385
|
}
|
|
118386
118386
|
}
|
|
118387
|
-
onData(
|
|
118387
|
+
onData(chunk2) {
|
|
118388
118388
|
assert2(!this.aborted);
|
|
118389
118389
|
assert2(!this.completed);
|
|
118390
118390
|
if (channels.bodyChunkReceived.hasSubscribers) {
|
|
118391
|
-
channels.bodyChunkReceived.publish({ request: this, chunk });
|
|
118391
|
+
channels.bodyChunkReceived.publish({ request: this, chunk: chunk2 });
|
|
118392
118392
|
}
|
|
118393
118393
|
try {
|
|
118394
|
-
return this[kHandler].onData(
|
|
118394
|
+
return this[kHandler].onData(chunk2);
|
|
118395
118395
|
} catch (err) {
|
|
118396
118396
|
this.abort(err);
|
|
118397
118397
|
return false;
|
|
@@ -121490,17 +121490,17 @@ var require_util8 = __commonJS({
|
|
|
121490
121490
|
const bytes = [];
|
|
121491
121491
|
let byteLength = 0;
|
|
121492
121492
|
do {
|
|
121493
|
-
const { done, value:
|
|
121493
|
+
const { done, value: chunk2 } = await reader.read();
|
|
121494
121494
|
if (done) {
|
|
121495
121495
|
successSteps(Buffer.concat(bytes, byteLength));
|
|
121496
121496
|
return;
|
|
121497
121497
|
}
|
|
121498
|
-
if (!isUint8Array(
|
|
121498
|
+
if (!isUint8Array(chunk2)) {
|
|
121499
121499
|
failureSteps(new TypeError("Received non-Uint8Array chunk"));
|
|
121500
121500
|
return;
|
|
121501
121501
|
}
|
|
121502
|
-
bytes.push(
|
|
121503
|
-
byteLength +=
|
|
121502
|
+
bytes.push(chunk2);
|
|
121503
|
+
byteLength += chunk2.length;
|
|
121504
121504
|
} while (true);
|
|
121505
121505
|
} catch (e) {
|
|
121506
121506
|
failureSteps(e);
|
|
@@ -121606,18 +121606,18 @@ var require_util8 = __commonJS({
|
|
|
121606
121606
|
super();
|
|
121607
121607
|
this.#zlibOptions = zlibOptions;
|
|
121608
121608
|
}
|
|
121609
|
-
_transform(
|
|
121609
|
+
_transform(chunk2, encoding, callback) {
|
|
121610
121610
|
if (!this._inflateStream) {
|
|
121611
|
-
if (
|
|
121611
|
+
if (chunk2.length === 0) {
|
|
121612
121612
|
callback();
|
|
121613
121613
|
return;
|
|
121614
121614
|
}
|
|
121615
|
-
this._inflateStream = (
|
|
121615
|
+
this._inflateStream = (chunk2[0] & 15) === 8 ? zlib2.createInflate(this.#zlibOptions) : zlib2.createInflateRaw(this.#zlibOptions);
|
|
121616
121616
|
this._inflateStream.on("data", this.push.bind(this));
|
|
121617
121617
|
this._inflateStream.on("end", () => this.push(null));
|
|
121618
121618
|
this._inflateStream.on("error", (err) => this.destroy(err));
|
|
121619
121619
|
}
|
|
121620
|
-
this._inflateStream.write(
|
|
121620
|
+
this._inflateStream.write(chunk2, encoding, callback);
|
|
121621
121621
|
}
|
|
121622
121622
|
_final(callback) {
|
|
121623
121623
|
if (this._inflateStream) {
|
|
@@ -122352,29 +122352,29 @@ Content-Disposition: form-data`;
|
|
|
122352
122352
|
let hasUnknownSizeValue = false;
|
|
122353
122353
|
for (const [name25, value] of object3) {
|
|
122354
122354
|
if (typeof value === "string") {
|
|
122355
|
-
const
|
|
122355
|
+
const chunk3 = textEncoder.encode(prefix + `; name="${formdataEscape(normalizeLinefeeds(name25))}"\r
|
|
122356
122356
|
\r
|
|
122357
122357
|
${normalizeLinefeeds(value)}\r
|
|
122358
122358
|
`);
|
|
122359
|
-
blobParts.push(
|
|
122360
|
-
length +=
|
|
122359
|
+
blobParts.push(chunk3);
|
|
122360
|
+
length += chunk3.byteLength;
|
|
122361
122361
|
} else {
|
|
122362
|
-
const
|
|
122362
|
+
const chunk3 = textEncoder.encode(`${prefix}; name="${formdataEscape(normalizeLinefeeds(name25))}"` + (value.name ? `; filename="${formdataEscape(value.name)}"` : "") + `\r
|
|
122363
122363
|
Content-Type: ${value.type || "application/octet-stream"}\r
|
|
122364
122364
|
\r
|
|
122365
122365
|
`);
|
|
122366
|
-
blobParts.push(
|
|
122366
|
+
blobParts.push(chunk3, value, rn);
|
|
122367
122367
|
if (typeof value.size === "number") {
|
|
122368
|
-
length +=
|
|
122368
|
+
length += chunk3.byteLength + value.size + rn.byteLength;
|
|
122369
122369
|
} else {
|
|
122370
122370
|
hasUnknownSizeValue = true;
|
|
122371
122371
|
}
|
|
122372
122372
|
}
|
|
122373
122373
|
}
|
|
122374
|
-
const
|
|
122374
|
+
const chunk2 = textEncoder.encode(`--${boundary}--\r
|
|
122375
122375
|
`);
|
|
122376
|
-
blobParts.push(
|
|
122377
|
-
length +=
|
|
122376
|
+
blobParts.push(chunk2);
|
|
122377
|
+
length += chunk2.byteLength;
|
|
122378
122378
|
if (hasUnknownSizeValue) {
|
|
122379
122379
|
length = null;
|
|
122380
122380
|
}
|
|
@@ -122801,41 +122801,41 @@ var require_client_h1 = __commonJS({
|
|
|
122801
122801
|
}
|
|
122802
122802
|
readMore() {
|
|
122803
122803
|
while (!this.paused && this.ptr) {
|
|
122804
|
-
const
|
|
122805
|
-
if (
|
|
122804
|
+
const chunk2 = this.socket.read();
|
|
122805
|
+
if (chunk2 === null) {
|
|
122806
122806
|
break;
|
|
122807
122807
|
}
|
|
122808
|
-
this.execute(
|
|
122808
|
+
this.execute(chunk2);
|
|
122809
122809
|
}
|
|
122810
122810
|
}
|
|
122811
122811
|
/**
|
|
122812
122812
|
* @param {Buffer} chunk
|
|
122813
122813
|
*/
|
|
122814
|
-
execute(
|
|
122814
|
+
execute(chunk2) {
|
|
122815
122815
|
assert2(currentParser === null);
|
|
122816
122816
|
assert2(this.ptr != null);
|
|
122817
122817
|
assert2(!this.paused);
|
|
122818
122818
|
const { socket, llhttp } = this;
|
|
122819
|
-
if (
|
|
122819
|
+
if (chunk2.length > currentBufferSize) {
|
|
122820
122820
|
if (currentBufferPtr) {
|
|
122821
122821
|
llhttp.free(currentBufferPtr);
|
|
122822
122822
|
}
|
|
122823
|
-
currentBufferSize = Math.ceil(
|
|
122823
|
+
currentBufferSize = Math.ceil(chunk2.length / 4096) * 4096;
|
|
122824
122824
|
currentBufferPtr = llhttp.malloc(currentBufferSize);
|
|
122825
122825
|
}
|
|
122826
|
-
new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(
|
|
122826
|
+
new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(chunk2);
|
|
122827
122827
|
try {
|
|
122828
122828
|
let ret;
|
|
122829
122829
|
try {
|
|
122830
|
-
currentBufferRef =
|
|
122830
|
+
currentBufferRef = chunk2;
|
|
122831
122831
|
currentParser = this;
|
|
122832
|
-
ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr,
|
|
122832
|
+
ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, chunk2.length);
|
|
122833
122833
|
} finally {
|
|
122834
122834
|
currentParser = null;
|
|
122835
122835
|
currentBufferRef = null;
|
|
122836
122836
|
}
|
|
122837
122837
|
if (ret !== constants3.ERROR.OK) {
|
|
122838
|
-
const data =
|
|
122838
|
+
const data = chunk2.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
|
|
122839
122839
|
if (ret === constants3.ERROR.PAUSED_UPGRADE) {
|
|
122840
122840
|
this.onUpgrade(data);
|
|
122841
122841
|
} else if (ret === constants3.ERROR.PAUSED) {
|
|
@@ -123434,12 +123434,12 @@ upgrade: ${upgrade}\r
|
|
|
123434
123434
|
assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
|
123435
123435
|
let finished = false;
|
|
123436
123436
|
const writer = new AsyncWriter({ abort, socket, request, contentLength, client, expectsPayload, header });
|
|
123437
|
-
const onData = function(
|
|
123437
|
+
const onData = function(chunk2) {
|
|
123438
123438
|
if (finished) {
|
|
123439
123439
|
return;
|
|
123440
123440
|
}
|
|
123441
123441
|
try {
|
|
123442
|
-
if (!writer.write(
|
|
123442
|
+
if (!writer.write(chunk2) && this.pause) {
|
|
123443
123443
|
this.pause();
|
|
123444
123444
|
}
|
|
123445
123445
|
} catch (err) {
|
|
@@ -123574,11 +123574,11 @@ upgrade: ${upgrade}\r
|
|
|
123574
123574
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
123575
123575
|
const writer = new AsyncWriter({ abort, socket, request, contentLength, client, expectsPayload, header });
|
|
123576
123576
|
try {
|
|
123577
|
-
for await (const
|
|
123577
|
+
for await (const chunk2 of body) {
|
|
123578
123578
|
if (socket[kError]) {
|
|
123579
123579
|
throw socket[kError];
|
|
123580
123580
|
}
|
|
123581
|
-
if (!writer.write(
|
|
123581
|
+
if (!writer.write(chunk2)) {
|
|
123582
123582
|
await waitForDrain();
|
|
123583
123583
|
}
|
|
123584
123584
|
}
|
|
@@ -123616,7 +123616,7 @@ upgrade: ${upgrade}\r
|
|
|
123616
123616
|
* @param {Buffer} chunk
|
|
123617
123617
|
* @returns
|
|
123618
123618
|
*/
|
|
123619
|
-
write(
|
|
123619
|
+
write(chunk2) {
|
|
123620
123620
|
const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this;
|
|
123621
123621
|
if (socket[kError]) {
|
|
123622
123622
|
throw socket[kError];
|
|
@@ -123624,7 +123624,7 @@ upgrade: ${upgrade}\r
|
|
|
123624
123624
|
if (socket.destroyed) {
|
|
123625
123625
|
return false;
|
|
123626
123626
|
}
|
|
123627
|
-
const len = Buffer.byteLength(
|
|
123627
|
+
const len = Buffer.byteLength(chunk2);
|
|
123628
123628
|
if (!len) {
|
|
123629
123629
|
return true;
|
|
123630
123630
|
}
|
|
@@ -123654,9 +123654,9 @@ ${len.toString(16)}\r
|
|
|
123654
123654
|
`, "latin1");
|
|
123655
123655
|
}
|
|
123656
123656
|
this.bytesWritten += len;
|
|
123657
|
-
const ret = socket.write(
|
|
123657
|
+
const ret = socket.write(chunk2);
|
|
123658
123658
|
socket.uncork();
|
|
123659
|
-
request.onBodySent(
|
|
123659
|
+
request.onBodySent(chunk2);
|
|
123660
123660
|
if (!ret) {
|
|
123661
123661
|
if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
|
|
123662
123662
|
if (socket[kParser].timeout.refresh) {
|
|
@@ -124207,8 +124207,8 @@ var require_client_h2 = __commonJS({
|
|
|
124207
124207
|
stream.pause();
|
|
124208
124208
|
}
|
|
124209
124209
|
});
|
|
124210
|
-
stream.on("data", (
|
|
124211
|
-
if (request.onData(
|
|
124210
|
+
stream.on("data", (chunk2) => {
|
|
124211
|
+
if (request.onData(chunk2) === false) {
|
|
124212
124212
|
stream.pause();
|
|
124213
124213
|
}
|
|
124214
124214
|
});
|
|
@@ -124374,8 +124374,8 @@ var require_client_h2 = __commonJS({
|
|
|
124374
124374
|
}
|
|
124375
124375
|
);
|
|
124376
124376
|
util2.addListener(pipe2, "data", onPipeData);
|
|
124377
|
-
function onPipeData(
|
|
124378
|
-
request.onBodySent(
|
|
124377
|
+
function onPipeData(chunk2) {
|
|
124378
|
+
request.onBodySent(chunk2);
|
|
124379
124379
|
}
|
|
124380
124380
|
}
|
|
124381
124381
|
async function writeBlob(abort, h2stream, body, client, request, socket, contentLength, expectsPayload) {
|
|
@@ -124419,12 +124419,12 @@ var require_client_h2 = __commonJS({
|
|
|
124419
124419
|
});
|
|
124420
124420
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
124421
124421
|
try {
|
|
124422
|
-
for await (const
|
|
124422
|
+
for await (const chunk2 of body) {
|
|
124423
124423
|
if (socket[kError]) {
|
|
124424
124424
|
throw socket[kError];
|
|
124425
124425
|
}
|
|
124426
|
-
const res = h2stream.write(
|
|
124427
|
-
request.onBodySent(
|
|
124426
|
+
const res = h2stream.write(chunk2);
|
|
124427
|
+
request.onBodySent(chunk2);
|
|
124428
124428
|
if (!res) {
|
|
124429
124429
|
await waitForDrain();
|
|
124430
124430
|
}
|
|
@@ -126300,12 +126300,12 @@ var require_retry_handler = __commonJS({
|
|
|
126300
126300
|
});
|
|
126301
126301
|
}
|
|
126302
126302
|
}
|
|
126303
|
-
onResponseData(controller,
|
|
126303
|
+
onResponseData(controller, chunk2) {
|
|
126304
126304
|
if (this.error) {
|
|
126305
126305
|
return;
|
|
126306
126306
|
}
|
|
126307
|
-
this.start +=
|
|
126308
|
-
this.handler.onResponseData?.(controller,
|
|
126307
|
+
this.start += chunk2.length;
|
|
126308
|
+
this.handler.onResponseData?.(controller, chunk2);
|
|
126309
126309
|
}
|
|
126310
126310
|
onResponseEnd(controller, trailers) {
|
|
126311
126311
|
if (this.error && this.retryOpts.throwOnError) {
|
|
@@ -126560,15 +126560,15 @@ var require_readable2 = __commonJS({
|
|
|
126560
126560
|
* @param {Buffer|null} chunk
|
|
126561
126561
|
* @returns {boolean}
|
|
126562
126562
|
*/
|
|
126563
|
-
push(
|
|
126564
|
-
if (
|
|
126565
|
-
this[kBytesRead] +=
|
|
126563
|
+
push(chunk2) {
|
|
126564
|
+
if (chunk2) {
|
|
126565
|
+
this[kBytesRead] += chunk2.length;
|
|
126566
126566
|
if (this[kConsume]) {
|
|
126567
|
-
consumePush(this[kConsume],
|
|
126568
|
-
return this[kReading] ? super.push(
|
|
126567
|
+
consumePush(this[kConsume], chunk2);
|
|
126568
|
+
return this[kReading] ? super.push(chunk2) : true;
|
|
126569
126569
|
}
|
|
126570
126570
|
}
|
|
126571
|
-
return super.push(
|
|
126571
|
+
return super.push(chunk2);
|
|
126572
126572
|
}
|
|
126573
126573
|
/**
|
|
126574
126574
|
* Consumes and returns the body as a string.
|
|
@@ -126759,8 +126759,8 @@ var require_readable2 = __commonJS({
|
|
|
126759
126759
|
consumePush(consume2, state.buffer[n]);
|
|
126760
126760
|
}
|
|
126761
126761
|
} else {
|
|
126762
|
-
for (const
|
|
126763
|
-
consumePush(consume2,
|
|
126762
|
+
for (const chunk2 of state.buffer) {
|
|
126763
|
+
consumePush(consume2, chunk2);
|
|
126764
126764
|
}
|
|
126765
126765
|
}
|
|
126766
126766
|
if (state.endEmitted) {
|
|
@@ -126797,9 +126797,9 @@ var require_readable2 = __commonJS({
|
|
|
126797
126797
|
const buffer = new Uint8Array(Buffer.allocUnsafeSlow(length).buffer);
|
|
126798
126798
|
let offset = 0;
|
|
126799
126799
|
for (let i = 0; i < chunks.length; ++i) {
|
|
126800
|
-
const
|
|
126801
|
-
buffer.set(
|
|
126802
|
-
offset +=
|
|
126800
|
+
const chunk2 = chunks[i];
|
|
126801
|
+
buffer.set(chunk2, offset);
|
|
126802
|
+
offset += chunk2.length;
|
|
126803
126803
|
}
|
|
126804
126804
|
return buffer;
|
|
126805
126805
|
}
|
|
@@ -126822,9 +126822,9 @@ var require_readable2 = __commonJS({
|
|
|
126822
126822
|
stream.destroy(err);
|
|
126823
126823
|
}
|
|
126824
126824
|
}
|
|
126825
|
-
function consumePush(consume2,
|
|
126826
|
-
consume2.length +=
|
|
126827
|
-
consume2.body.push(
|
|
126825
|
+
function consumePush(consume2, chunk2) {
|
|
126826
|
+
consume2.length += chunk2.length;
|
|
126827
|
+
consume2.body.push(chunk2);
|
|
126828
126828
|
}
|
|
126829
126829
|
function consumeFinish(consume2, err) {
|
|
126830
126830
|
if (consume2.body === null) {
|
|
@@ -126969,8 +126969,8 @@ var require_api_request = __commonJS({
|
|
|
126969
126969
|
}
|
|
126970
126970
|
}
|
|
126971
126971
|
}
|
|
126972
|
-
onData(
|
|
126973
|
-
return this.res.push(
|
|
126972
|
+
onData(chunk2) {
|
|
126973
|
+
return this.res.push(chunk2);
|
|
126974
126974
|
}
|
|
126975
126975
|
onComplete(trailers) {
|
|
126976
126976
|
util2.parseHeaders(trailers, this.trailers);
|
|
@@ -127185,9 +127185,9 @@ var require_api_stream = __commonJS({
|
|
|
127185
127185
|
const needDrain = res.writableNeedDrain !== void 0 ? res.writableNeedDrain : res._writableState?.needDrain;
|
|
127186
127186
|
return needDrain !== true;
|
|
127187
127187
|
}
|
|
127188
|
-
onData(
|
|
127188
|
+
onData(chunk2) {
|
|
127189
127189
|
const { res } = this;
|
|
127190
|
-
return res ? res.write(
|
|
127190
|
+
return res ? res.write(chunk2) : true;
|
|
127191
127191
|
}
|
|
127192
127192
|
onComplete(trailers) {
|
|
127193
127193
|
const { res } = this;
|
|
@@ -127328,9 +127328,9 @@ var require_api_pipeline = __commonJS({
|
|
|
127328
127328
|
body.resume();
|
|
127329
127329
|
}
|
|
127330
127330
|
},
|
|
127331
|
-
write: (
|
|
127331
|
+
write: (chunk2, encoding, callback) => {
|
|
127332
127332
|
const { req } = this;
|
|
127333
|
-
if (req.push(
|
|
127333
|
+
if (req.push(chunk2, encoding) || req._readableState.destroyed) {
|
|
127334
127334
|
callback();
|
|
127335
127335
|
} else {
|
|
127336
127336
|
req[kResume] = callback;
|
|
@@ -127395,9 +127395,9 @@ var require_api_pipeline = __commonJS({
|
|
|
127395
127395
|
if (!body || typeof body.on !== "function") {
|
|
127396
127396
|
throw new InvalidReturnValueError("expected Readable");
|
|
127397
127397
|
}
|
|
127398
|
-
body.on("data", (
|
|
127398
|
+
body.on("data", (chunk2) => {
|
|
127399
127399
|
const { ret, body: body2 } = this;
|
|
127400
|
-
if (!ret.push(
|
|
127400
|
+
if (!ret.push(chunk2) && body2.pause) {
|
|
127401
127401
|
body2.pause();
|
|
127402
127402
|
}
|
|
127403
127403
|
}).on("error", (err) => {
|
|
@@ -127414,9 +127414,9 @@ var require_api_pipeline = __commonJS({
|
|
|
127414
127414
|
});
|
|
127415
127415
|
this.body = body;
|
|
127416
127416
|
}
|
|
127417
|
-
onData(
|
|
127417
|
+
onData(chunk2) {
|
|
127418
127418
|
const { res } = this;
|
|
127419
|
-
return res.push(
|
|
127419
|
+
return res.push(chunk2);
|
|
127420
127420
|
}
|
|
127421
127421
|
onComplete(trailers) {
|
|
127422
127422
|
const { res } = this;
|
|
@@ -128569,8 +128569,8 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
128569
128569
|
module.exports = class PendingInterceptorsFormatter {
|
|
128570
128570
|
constructor({ disableColors } = {}) {
|
|
128571
128571
|
this.transform = new Transform({
|
|
128572
|
-
transform(
|
|
128573
|
-
cb(null,
|
|
128572
|
+
transform(chunk2, _enc, cb) {
|
|
128573
|
+
cb(null, chunk2);
|
|
128574
128574
|
}
|
|
128575
128575
|
});
|
|
128576
128576
|
this.logger = new Console({
|
|
@@ -129364,9 +129364,9 @@ var require_snapshot_agent = __commonJS({
|
|
|
129364
129364
|
responseData.headers = headers;
|
|
129365
129365
|
return handler.onResponseStart(controller, statusCode, headers, statusMessage);
|
|
129366
129366
|
},
|
|
129367
|
-
onResponseData(controller,
|
|
129368
|
-
responseData.body.push(
|
|
129369
|
-
return handler.onResponseData(controller,
|
|
129367
|
+
onResponseData(controller, chunk2) {
|
|
129368
|
+
responseData.body.push(chunk2);
|
|
129369
|
+
return handler.onResponseData(controller, chunk2);
|
|
129370
129370
|
},
|
|
129371
129371
|
onResponseEnd(controller, trailers) {
|
|
129372
129372
|
responseData.trailers = trailers;
|
|
@@ -129741,10 +129741,10 @@ var require_redirect_handler = __commonJS({
|
|
|
129741
129741
|
this.opts.origin = origin;
|
|
129742
129742
|
this.opts.query = null;
|
|
129743
129743
|
}
|
|
129744
|
-
onResponseData(controller,
|
|
129744
|
+
onResponseData(controller, chunk2) {
|
|
129745
129745
|
if (this.location) {
|
|
129746
129746
|
} else {
|
|
129747
|
-
this.handler.onResponseData?.(controller,
|
|
129747
|
+
this.handler.onResponseData?.(controller, chunk2);
|
|
129748
129748
|
}
|
|
129749
129749
|
}
|
|
129750
129750
|
onResponseEnd(controller, trailers) {
|
|
@@ -129854,11 +129854,11 @@ var require_response_error = __commonJS({
|
|
|
129854
129854
|
this.#decoder = new TextDecoder("utf-8");
|
|
129855
129855
|
}
|
|
129856
129856
|
}
|
|
129857
|
-
onResponseData(controller,
|
|
129857
|
+
onResponseData(controller, chunk2) {
|
|
129858
129858
|
if (this.#statusCode < 400) {
|
|
129859
|
-
return super.onResponseData(controller,
|
|
129859
|
+
return super.onResponseData(controller, chunk2);
|
|
129860
129860
|
}
|
|
129861
|
-
this.#body += this.#decoder?.decode(
|
|
129861
|
+
this.#body += this.#decoder?.decode(chunk2, { stream: true }) ?? "";
|
|
129862
129862
|
}
|
|
129863
129863
|
onResponseEnd(controller, trailers) {
|
|
129864
129864
|
if (this.#statusCode >= 400) {
|
|
@@ -129971,8 +129971,8 @@ var require_dump = __commonJS({
|
|
|
129971
129971
|
err = this.#controller?.reason ?? err;
|
|
129972
129972
|
super.onResponseError(controller, err);
|
|
129973
129973
|
}
|
|
129974
|
-
onResponseData(controller,
|
|
129975
|
-
this.#size = this.#size +
|
|
129974
|
+
onResponseData(controller, chunk2) {
|
|
129975
|
+
this.#size = this.#size + chunk2.length;
|
|
129976
129976
|
if (this.#size >= this.#maxSize) {
|
|
129977
129977
|
this.#dumped = true;
|
|
129978
129978
|
if (this.aborted === true) {
|
|
@@ -130610,15 +130610,15 @@ var require_cache = __commonJS({
|
|
|
130610
130610
|
}
|
|
130611
130611
|
}
|
|
130612
130612
|
}
|
|
130613
|
-
function makeDeduplicationKey(
|
|
130614
|
-
let key = `${
|
|
130615
|
-
if (
|
|
130616
|
-
const sortedHeaders = Object.keys(
|
|
130613
|
+
function makeDeduplicationKey(cacheKey2, excludeHeaders) {
|
|
130614
|
+
let key = `${cacheKey2.origin}:${cacheKey2.method}:${cacheKey2.path}`;
|
|
130615
|
+
if (cacheKey2.headers) {
|
|
130616
|
+
const sortedHeaders = Object.keys(cacheKey2.headers).sort();
|
|
130617
130617
|
for (const header of sortedHeaders) {
|
|
130618
130618
|
if (excludeHeaders?.has(header.toLowerCase())) {
|
|
130619
130619
|
continue;
|
|
130620
130620
|
}
|
|
130621
|
-
const value =
|
|
130621
|
+
const value = cacheKey2.headers[header];
|
|
130622
130622
|
key += `:${header}=${Array.isArray(value) ? value.join(",") : value}`;
|
|
130623
130623
|
}
|
|
130624
130624
|
}
|
|
@@ -131196,11 +131196,11 @@ var require_cache_handler = __commonJS({
|
|
|
131196
131196
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
131197
131197
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandler} handler
|
|
131198
131198
|
*/
|
|
131199
|
-
constructor({ store, type, cacheByDefault },
|
|
131199
|
+
constructor({ store, type, cacheByDefault }, cacheKey2, handler) {
|
|
131200
131200
|
this.#store = store;
|
|
131201
131201
|
this.#cacheType = type;
|
|
131202
131202
|
this.#cacheByDefault = cacheByDefault;
|
|
131203
|
-
this.#cacheKey =
|
|
131203
|
+
this.#cacheKey = cacheKey2;
|
|
131204
131204
|
this.#handler = handler;
|
|
131205
131205
|
}
|
|
131206
131206
|
onRequestStart(controller, context2) {
|
|
@@ -131292,9 +131292,9 @@ var require_cache_handler = __commonJS({
|
|
|
131292
131292
|
if (typeof cachedValue.body.values === "function") {
|
|
131293
131293
|
const bodyIterator = cachedValue.body.values();
|
|
131294
131294
|
const streamCachedBody = () => {
|
|
131295
|
-
for (const
|
|
131296
|
-
const full = this.#writeStream.write(
|
|
131297
|
-
this.#handler.onResponseData?.(controller,
|
|
131295
|
+
for (const chunk2 of bodyIterator) {
|
|
131296
|
+
const full = this.#writeStream.write(chunk2) === false;
|
|
131297
|
+
this.#handler.onResponseData?.(controller, chunk2);
|
|
131298
131298
|
if (full) {
|
|
131299
131299
|
break;
|
|
131300
131300
|
}
|
|
@@ -131312,9 +131312,9 @@ var require_cache_handler = __commonJS({
|
|
|
131312
131312
|
});
|
|
131313
131313
|
streamCachedBody();
|
|
131314
131314
|
} else if (typeof cachedValue.body.on === "function") {
|
|
131315
|
-
cachedValue.body.on("data", (
|
|
131316
|
-
this.#writeStream.write(
|
|
131317
|
-
this.#handler.onResponseData?.(controller,
|
|
131315
|
+
cachedValue.body.on("data", (chunk2) => {
|
|
131316
|
+
this.#writeStream.write(chunk2);
|
|
131317
|
+
this.#handler.onResponseData?.(controller, chunk2);
|
|
131318
131318
|
}).on("end", () => {
|
|
131319
131319
|
this.#writeStream.end();
|
|
131320
131320
|
}).on("error", () => {
|
|
@@ -131357,11 +131357,11 @@ var require_cache_handler = __commonJS({
|
|
|
131357
131357
|
downstreamOnHeaders();
|
|
131358
131358
|
}
|
|
131359
131359
|
}
|
|
131360
|
-
onResponseData(controller,
|
|
131361
|
-
if (this.#writeStream?.write(
|
|
131360
|
+
onResponseData(controller, chunk2) {
|
|
131361
|
+
if (this.#writeStream?.write(chunk2) === false) {
|
|
131362
131362
|
controller.pause();
|
|
131363
131363
|
}
|
|
131364
|
-
this.#handler.onResponseData?.(controller,
|
|
131364
|
+
this.#handler.onResponseData?.(controller, chunk2);
|
|
131365
131365
|
}
|
|
131366
131366
|
onResponseEnd(controller, trailers) {
|
|
131367
131367
|
this.#writeStream?.end();
|
|
@@ -131602,15 +131602,15 @@ var require_memory_cache_store = __commonJS({
|
|
|
131602
131602
|
const store = this;
|
|
131603
131603
|
const entry = { ...key, ...val, body: [], size: 0 };
|
|
131604
131604
|
return new Writable2({
|
|
131605
|
-
write(
|
|
131606
|
-
if (typeof
|
|
131607
|
-
|
|
131605
|
+
write(chunk2, encoding, callback) {
|
|
131606
|
+
if (typeof chunk2 === "string") {
|
|
131607
|
+
chunk2 = Buffer.from(chunk2, encoding);
|
|
131608
131608
|
}
|
|
131609
|
-
entry.size +=
|
|
131609
|
+
entry.size += chunk2.byteLength;
|
|
131610
131610
|
if (entry.size >= store.#maxEntrySize) {
|
|
131611
131611
|
this.destroy();
|
|
131612
131612
|
} else {
|
|
131613
|
-
entry.body.push(
|
|
131613
|
+
entry.body.push(chunk2);
|
|
131614
131614
|
}
|
|
131615
131615
|
callback(null);
|
|
131616
131616
|
},
|
|
@@ -131740,11 +131740,11 @@ var require_cache_revalidation_handler = __commonJS({
|
|
|
131740
131740
|
statusMessage
|
|
131741
131741
|
);
|
|
131742
131742
|
}
|
|
131743
|
-
onResponseData(controller,
|
|
131743
|
+
onResponseData(controller, chunk2) {
|
|
131744
131744
|
if (this.#successful) {
|
|
131745
131745
|
return;
|
|
131746
131746
|
}
|
|
131747
|
-
return this.#handler.onResponseData?.(controller,
|
|
131747
|
+
return this.#handler.onResponseData?.(controller, chunk2);
|
|
131748
131748
|
}
|
|
131749
131749
|
onResponseEnd(controller, trailers) {
|
|
131750
131750
|
if (this.#successful) {
|
|
@@ -131834,7 +131834,7 @@ var require_cache2 = __commonJS({
|
|
|
131834
131834
|
const staleWhileRevalidateExpiry = result.staleAt + staleWhileRevalidate * 1e3;
|
|
131835
131835
|
return now3 <= staleWhileRevalidateExpiry;
|
|
131836
131836
|
}
|
|
131837
|
-
function handleUncachedResponse(dispatch, globalOpts,
|
|
131837
|
+
function handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl) {
|
|
131838
131838
|
if (reqCacheControl?.["only-if-cached"]) {
|
|
131839
131839
|
let aborted2 = false;
|
|
131840
131840
|
try {
|
|
@@ -131862,7 +131862,7 @@ var require_cache2 = __commonJS({
|
|
|
131862
131862
|
}
|
|
131863
131863
|
return true;
|
|
131864
131864
|
}
|
|
131865
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
131865
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
131866
131866
|
}
|
|
131867
131867
|
function sendCachedValue(handler, opts, result, age, context2, isStale2) {
|
|
131868
131868
|
const stream = util2.isStream(result.body) ? result.body : Readable4.from(result.body ?? []);
|
|
@@ -131913,18 +131913,18 @@ var require_cache2 = __commonJS({
|
|
|
131913
131913
|
if (opts.method === "HEAD") {
|
|
131914
131914
|
stream.destroy();
|
|
131915
131915
|
} else {
|
|
131916
|
-
stream.on("data", function(
|
|
131917
|
-
handler.onResponseData?.(controller,
|
|
131916
|
+
stream.on("data", function(chunk2) {
|
|
131917
|
+
handler.onResponseData?.(controller, chunk2);
|
|
131918
131918
|
});
|
|
131919
131919
|
}
|
|
131920
131920
|
}
|
|
131921
|
-
function handleResult2(dispatch, globalOpts,
|
|
131921
|
+
function handleResult2(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl, result) {
|
|
131922
131922
|
if (!result) {
|
|
131923
|
-
return handleUncachedResponse(dispatch, globalOpts,
|
|
131923
|
+
return handleUncachedResponse(dispatch, globalOpts, cacheKey2, handler, opts, reqCacheControl);
|
|
131924
131924
|
}
|
|
131925
131925
|
const now3 = Date.now();
|
|
131926
131926
|
if (now3 > result.deleteAt) {
|
|
131927
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
131927
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
131928
131928
|
}
|
|
131929
131929
|
const age = Math.round((now3 - result.cachedAt) / 1e3);
|
|
131930
131930
|
if (reqCacheControl?.["max-age"] && age >= reqCacheControl["max-age"]) {
|
|
@@ -131934,7 +131934,7 @@ var require_cache2 = __commonJS({
|
|
|
131934
131934
|
const revalidate = needsRevalidation(result, reqCacheControl, opts);
|
|
131935
131935
|
if (stale || revalidate) {
|
|
131936
131936
|
if (util2.isStream(opts.body) && util2.bodyLength(opts.body) !== 0) {
|
|
131937
|
-
return dispatch(opts, new CacheHandler(globalOpts,
|
|
131937
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey2, handler));
|
|
131938
131938
|
}
|
|
131939
131939
|
if (!revalidate && withinStaleWhileRevalidateWindow(result)) {
|
|
131940
131940
|
sendCachedValue(handler, opts, result, age, null, true);
|
|
@@ -131958,7 +131958,7 @@ var require_cache2 = __commonJS({
|
|
|
131958
131958
|
...opts,
|
|
131959
131959
|
headers: headers2
|
|
131960
131960
|
},
|
|
131961
|
-
new CacheHandler(globalOpts,
|
|
131961
|
+
new CacheHandler(globalOpts, cacheKey2, {
|
|
131962
131962
|
// Silent handler that just updates the cache
|
|
131963
131963
|
onRequestStart() {
|
|
131964
131964
|
},
|
|
@@ -132009,7 +132009,7 @@ var require_cache2 = __commonJS({
|
|
|
132009
132009
|
result.body.on("error", nop).destroy();
|
|
132010
132010
|
}
|
|
132011
132011
|
},
|
|
132012
|
-
new CacheHandler(globalOpts,
|
|
132012
|
+
new CacheHandler(globalOpts, cacheKey2, handler),
|
|
132013
132013
|
withinStaleIfErrorThreshold
|
|
132014
132014
|
)
|
|
132015
132015
|
);
|
|
@@ -132078,13 +132078,13 @@ var require_cache2 = __commonJS({
|
|
|
132078
132078
|
if (reqCacheControl?.["no-store"]) {
|
|
132079
132079
|
return dispatch(opts2, handler);
|
|
132080
132080
|
}
|
|
132081
|
-
const
|
|
132082
|
-
const result = store.get(
|
|
132081
|
+
const cacheKey2 = makeCacheKey(opts2);
|
|
132082
|
+
const result = store.get(cacheKey2);
|
|
132083
132083
|
if (result && typeof result.then === "function") {
|
|
132084
132084
|
return result.then((result2) => handleResult2(
|
|
132085
132085
|
dispatch,
|
|
132086
132086
|
globalOpts,
|
|
132087
|
-
|
|
132087
|
+
cacheKey2,
|
|
132088
132088
|
handler,
|
|
132089
132089
|
opts2,
|
|
132090
132090
|
reqCacheControl,
|
|
@@ -132094,7 +132094,7 @@ var require_cache2 = __commonJS({
|
|
|
132094
132094
|
return handleResult2(
|
|
132095
132095
|
dispatch,
|
|
132096
132096
|
globalOpts,
|
|
132097
|
-
|
|
132097
|
+
cacheKey2,
|
|
132098
132098
|
handler,
|
|
132099
132099
|
opts2,
|
|
132100
132100
|
reqCacheControl,
|
|
@@ -132189,9 +132189,9 @@ var require_decompress = __commonJS({
|
|
|
132189
132189
|
*/
|
|
132190
132190
|
#setupDecompressorEvents(decompressor, controller) {
|
|
132191
132191
|
decompressor.on("readable", () => {
|
|
132192
|
-
let
|
|
132193
|
-
while ((
|
|
132194
|
-
const result = super.onResponseData(controller,
|
|
132192
|
+
let chunk2;
|
|
132193
|
+
while ((chunk2 = decompressor.read()) !== null) {
|
|
132194
|
+
const result = super.onResponseData(controller, chunk2);
|
|
132195
132195
|
if (result === false) {
|
|
132196
132196
|
break;
|
|
132197
132197
|
}
|
|
@@ -132267,12 +132267,12 @@ var require_decompress = __commonJS({
|
|
|
132267
132267
|
* @param {Buffer} chunk
|
|
132268
132268
|
* @returns {void}
|
|
132269
132269
|
*/
|
|
132270
|
-
onResponseData(controller,
|
|
132270
|
+
onResponseData(controller, chunk2) {
|
|
132271
132271
|
if (this.#decompressors.length > 0) {
|
|
132272
|
-
this.#decompressors[0].write(
|
|
132272
|
+
this.#decompressors[0].write(chunk2);
|
|
132273
132273
|
return;
|
|
132274
132274
|
}
|
|
132275
|
-
super.onResponseData(controller,
|
|
132275
|
+
super.onResponseData(controller, chunk2);
|
|
132276
132276
|
}
|
|
132277
132277
|
/**
|
|
132278
132278
|
* @param {Controller} controller
|
|
@@ -132410,9 +132410,9 @@ var require_deduplication_handler = __commonJS({
|
|
|
132410
132410
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
|
|
132411
132411
|
* @param {Buffer} chunk
|
|
132412
132412
|
*/
|
|
132413
|
-
onResponseData(controller,
|
|
132414
|
-
this.#chunks.push(Buffer.from(
|
|
132415
|
-
this.#primaryHandler.onResponseData?.(controller,
|
|
132413
|
+
onResponseData(controller, chunk2) {
|
|
132414
|
+
this.#chunks.push(Buffer.from(chunk2));
|
|
132415
|
+
this.#primaryHandler.onResponseData?.(controller, chunk2);
|
|
132416
132416
|
}
|
|
132417
132417
|
/**
|
|
132418
132418
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
|
|
@@ -132568,8 +132568,8 @@ var require_deduplicate = __commonJS({
|
|
|
132568
132568
|
}
|
|
132569
132569
|
}
|
|
132570
132570
|
}
|
|
132571
|
-
const
|
|
132572
|
-
const dedupeKey = makeDeduplicationKey(
|
|
132571
|
+
const cacheKey2 = makeCacheKey(opts2);
|
|
132572
|
+
const dedupeKey = makeDeduplicationKey(cacheKey2, excludeHeaderNamesSet);
|
|
132573
132573
|
const pendingHandler = pendingRequests.get(dedupeKey);
|
|
132574
132574
|
if (pendingHandler) {
|
|
132575
132575
|
pendingHandler.addWaitingHandler(handler);
|
|
@@ -132845,10 +132845,10 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
132845
132845
|
const store = this;
|
|
132846
132846
|
return new Writable2({
|
|
132847
132847
|
decodeStrings: true,
|
|
132848
|
-
write(
|
|
132849
|
-
size +=
|
|
132848
|
+
write(chunk2, encoding, callback) {
|
|
132849
|
+
size += chunk2.byteLength;
|
|
132850
132850
|
if (size < store.#maxEntrySize) {
|
|
132851
|
-
body.push(
|
|
132851
|
+
body.push(chunk2);
|
|
132852
132852
|
} else {
|
|
132853
132853
|
this.destroy();
|
|
132854
132854
|
}
|
|
@@ -135773,11 +135773,11 @@ var require_fetch2 = __commonJS({
|
|
|
135773
135773
|
});
|
|
135774
135774
|
return true;
|
|
135775
135775
|
},
|
|
135776
|
-
onData(
|
|
135776
|
+
onData(chunk2) {
|
|
135777
135777
|
if (fetchParams.controller.dump) {
|
|
135778
135778
|
return;
|
|
135779
135779
|
}
|
|
135780
|
-
const bytes =
|
|
135780
|
+
const bytes = chunk2;
|
|
135781
135781
|
timingInfo.encodedBodySize += bytes.byteLength;
|
|
135782
135782
|
return this.body.push(bytes);
|
|
135783
135783
|
},
|
|
@@ -137774,7 +137774,7 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
137774
137774
|
this.#options.serverNoContextTakeover = extensions.has("server_no_context_takeover");
|
|
137775
137775
|
this.#options.serverMaxWindowBits = extensions.get("server_max_window_bits");
|
|
137776
137776
|
}
|
|
137777
|
-
decompress(
|
|
137777
|
+
decompress(chunk2, fin, callback) {
|
|
137778
137778
|
if (!this.#inflate) {
|
|
137779
137779
|
let windowBits = Z_DEFAULT_WINDOWBITS;
|
|
137780
137780
|
if (this.#options.serverMaxWindowBits) {
|
|
@@ -137796,7 +137796,7 @@ var require_permessage_deflate2 = __commonJS({
|
|
|
137796
137796
|
callback(err);
|
|
137797
137797
|
});
|
|
137798
137798
|
}
|
|
137799
|
-
this.#inflate.write(
|
|
137799
|
+
this.#inflate.write(chunk2);
|
|
137800
137800
|
if (fin) {
|
|
137801
137801
|
this.#inflate.write(tail);
|
|
137802
137802
|
}
|
|
@@ -137855,9 +137855,9 @@ var require_receiver2 = __commonJS({
|
|
|
137855
137855
|
* @param {Buffer} chunk
|
|
137856
137856
|
* @param {() => void} callback
|
|
137857
137857
|
*/
|
|
137858
|
-
_write(
|
|
137859
|
-
this.#buffers.push(
|
|
137860
|
-
this.#byteOffset +=
|
|
137858
|
+
_write(chunk2, _3, callback) {
|
|
137859
|
+
this.#buffers.push(chunk2);
|
|
137860
|
+
this.#byteOffset += chunk2.length;
|
|
137861
137861
|
this.#loop = true;
|
|
137862
137862
|
this.run(callback);
|
|
137863
137863
|
}
|
|
@@ -138257,8 +138257,8 @@ var require_websocket3 = __commonJS({
|
|
|
138257
138257
|
onMessage: (opcode, data) => this.#onMessage(opcode, data),
|
|
138258
138258
|
onParserError: (err) => failWebsocketConnection(this.#handler, null, err.message),
|
|
138259
138259
|
onParserDrain: () => this.#onParserDrain(),
|
|
138260
|
-
onSocketData: (
|
|
138261
|
-
if (!this.#parser.write(
|
|
138260
|
+
onSocketData: (chunk2) => {
|
|
138261
|
+
if (!this.#parser.write(chunk2)) {
|
|
138262
138262
|
this.#handler.socket.pause();
|
|
138263
138263
|
}
|
|
138264
138264
|
},
|
|
@@ -138810,8 +138810,8 @@ var require_websocketstream = __commonJS({
|
|
|
138810
138810
|
onMessage: (opcode, data) => this.#onMessage(opcode, data),
|
|
138811
138811
|
onParserError: (err) => failWebsocketConnection(this.#handler, null, err.message),
|
|
138812
138812
|
onParserDrain: () => this.#handler.socket.resume(),
|
|
138813
|
-
onSocketData: (
|
|
138814
|
-
if (!this.#parser.write(
|
|
138813
|
+
onSocketData: (chunk2) => {
|
|
138814
|
+
if (!this.#parser.write(chunk2)) {
|
|
138815
138815
|
this.#handler.socket.pause();
|
|
138816
138816
|
}
|
|
138817
138817
|
},
|
|
@@ -138906,18 +138906,18 @@ var require_websocketstream = __commonJS({
|
|
|
138906
138906
|
const reason = closeInfo.reason;
|
|
138907
138907
|
closeWebSocketConnection(this.#handler, code, reason, true);
|
|
138908
138908
|
}
|
|
138909
|
-
#write(
|
|
138910
|
-
|
|
138909
|
+
#write(chunk2) {
|
|
138910
|
+
chunk2 = webidl.converters.WebSocketStreamWrite(chunk2);
|
|
138911
138911
|
const promise2 = createDeferredPromise();
|
|
138912
138912
|
let data = null;
|
|
138913
138913
|
let opcode = null;
|
|
138914
|
-
if (webidl.is.BufferSource(
|
|
138915
|
-
data = new Uint8Array(ArrayBuffer.isView(
|
|
138914
|
+
if (webidl.is.BufferSource(chunk2)) {
|
|
138915
|
+
data = new Uint8Array(ArrayBuffer.isView(chunk2) ? new Uint8Array(chunk2.buffer, chunk2.byteOffset, chunk2.byteLength) : chunk2.slice());
|
|
138916
138916
|
opcode = opcodes.BINARY;
|
|
138917
138917
|
} else {
|
|
138918
138918
|
let string4;
|
|
138919
138919
|
try {
|
|
138920
|
-
string4 = webidl.converters.DOMString(
|
|
138920
|
+
string4 = webidl.converters.DOMString(chunk2);
|
|
138921
138921
|
} catch (e) {
|
|
138922
138922
|
promise2.reject(e);
|
|
138923
138923
|
return promise2.promise;
|
|
@@ -138948,15 +138948,15 @@ var require_websocketstream = __commonJS({
|
|
|
138948
138948
|
this.#readableStreamController = controller;
|
|
138949
138949
|
},
|
|
138950
138950
|
pull(controller) {
|
|
138951
|
-
let
|
|
138952
|
-
while (controller.desiredSize > 0 && (
|
|
138953
|
-
controller.enqueue(
|
|
138951
|
+
let chunk2;
|
|
138952
|
+
while (controller.desiredSize > 0 && (chunk2 = response.socket.read()) !== null) {
|
|
138953
|
+
controller.enqueue(chunk2);
|
|
138954
138954
|
}
|
|
138955
138955
|
},
|
|
138956
138956
|
cancel: (reason) => this.#cancel(reason)
|
|
138957
138957
|
});
|
|
138958
138958
|
const writable = new WritableStream({
|
|
138959
|
-
write: (
|
|
138959
|
+
write: (chunk2) => this.#write(chunk2),
|
|
138960
138960
|
close: () => closeWebSocketConnection(this.#handler, null, null),
|
|
138961
138961
|
abort: (reason) => this.#closeUsingReason(reason)
|
|
138962
138962
|
});
|
|
@@ -138974,18 +138974,18 @@ var require_websocketstream = __commonJS({
|
|
|
138974
138974
|
if (this.#handler.readyState !== states.OPEN) {
|
|
138975
138975
|
return;
|
|
138976
138976
|
}
|
|
138977
|
-
let
|
|
138977
|
+
let chunk2;
|
|
138978
138978
|
if (type === opcodes.TEXT) {
|
|
138979
138979
|
try {
|
|
138980
|
-
|
|
138980
|
+
chunk2 = utf8Decode(data);
|
|
138981
138981
|
} catch {
|
|
138982
138982
|
failWebsocketConnection(this.#handler, "Received invalid UTF-8 in text frame.");
|
|
138983
138983
|
return;
|
|
138984
138984
|
}
|
|
138985
138985
|
} else if (type === opcodes.BINARY) {
|
|
138986
|
-
|
|
138986
|
+
chunk2 = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
138987
138987
|
}
|
|
138988
|
-
this.#readableStreamController.enqueue(
|
|
138988
|
+
this.#readableStreamController.enqueue(chunk2);
|
|
138989
138989
|
}
|
|
138990
138990
|
/** @type {import('../websocket').Handler['onSocketClose']} */
|
|
138991
138991
|
#onSocketClose() {
|
|
@@ -139159,15 +139159,15 @@ var require_eventsource_stream = __commonJS({
|
|
|
139159
139159
|
* @param {Function} callback
|
|
139160
139160
|
* @returns {void}
|
|
139161
139161
|
*/
|
|
139162
|
-
_transform(
|
|
139163
|
-
if (
|
|
139162
|
+
_transform(chunk2, _encoding, callback) {
|
|
139163
|
+
if (chunk2.length === 0) {
|
|
139164
139164
|
callback();
|
|
139165
139165
|
return;
|
|
139166
139166
|
}
|
|
139167
139167
|
if (this.buffer) {
|
|
139168
|
-
this.buffer = Buffer.concat([this.buffer,
|
|
139168
|
+
this.buffer = Buffer.concat([this.buffer, chunk2]);
|
|
139169
139169
|
} else {
|
|
139170
|
-
this.buffer =
|
|
139170
|
+
this.buffer = chunk2;
|
|
139171
139171
|
}
|
|
139172
139172
|
if (this.checkBOM) {
|
|
139173
139173
|
switch (this.buffer.length) {
|
|
@@ -139878,9 +139878,9 @@ var require_helpers = __commonJS({
|
|
|
139878
139878
|
async function toBuffer(stream) {
|
|
139879
139879
|
let length = 0;
|
|
139880
139880
|
const chunks = [];
|
|
139881
|
-
for await (const
|
|
139882
|
-
length +=
|
|
139883
|
-
chunks.push(
|
|
139881
|
+
for await (const chunk2 of stream) {
|
|
139882
|
+
length += chunk2.length;
|
|
139883
|
+
chunks.push(chunk2);
|
|
139884
139884
|
}
|
|
139885
139885
|
return Buffer.concat(chunks, length);
|
|
139886
139886
|
}
|
|
@@ -145878,8 +145878,8 @@ function getFromCache(kid) {
|
|
|
145878
145878
|
function getCacheValues() {
|
|
145879
145879
|
return Object.values(cache);
|
|
145880
145880
|
}
|
|
145881
|
-
function setInCache(
|
|
145882
|
-
cache[
|
|
145881
|
+
function setInCache(cacheKey2, jwk, shouldExpire = true) {
|
|
145882
|
+
cache[cacheKey2] = jwk;
|
|
145883
145883
|
lastUpdatedAt = shouldExpire ? Date.now() : -1;
|
|
145884
145884
|
}
|
|
145885
145885
|
function loadClerkJwkFromPem(params) {
|
|
@@ -152317,16 +152317,16 @@ var require_split2 = __commonJS({
|
|
|
152317
152317
|
var { StringDecoder } = __require("string_decoder");
|
|
152318
152318
|
var kLast = /* @__PURE__ */ Symbol("last");
|
|
152319
152319
|
var kDecoder = /* @__PURE__ */ Symbol("decoder");
|
|
152320
|
-
function transform2(
|
|
152320
|
+
function transform2(chunk2, enc, cb) {
|
|
152321
152321
|
let list;
|
|
152322
152322
|
if (this.overflow) {
|
|
152323
|
-
const buf = this[kDecoder].write(
|
|
152323
|
+
const buf = this[kDecoder].write(chunk2);
|
|
152324
152324
|
list = buf.split(this.matcher);
|
|
152325
152325
|
if (list.length === 1) return cb();
|
|
152326
152326
|
list.shift();
|
|
152327
152327
|
this.overflow = false;
|
|
152328
152328
|
} else {
|
|
152329
|
-
this[kLast] += this[kDecoder].write(
|
|
152329
|
+
this[kLast] += this[kDecoder].write(chunk2);
|
|
152330
152330
|
list = this[kLast].split(this.matcher);
|
|
152331
152331
|
}
|
|
152332
152332
|
this[kLast] = list.pop();
|
|
@@ -154326,8 +154326,8 @@ var require_pino_pretty = __commonJS({
|
|
|
154326
154326
|
const stream = new Transform({
|
|
154327
154327
|
objectMode: true,
|
|
154328
154328
|
autoDestroy: true,
|
|
154329
|
-
transform(
|
|
154330
|
-
const line = pretty3(
|
|
154329
|
+
transform(chunk2, enc, cb) {
|
|
154330
|
+
const line = pretty3(chunk2);
|
|
154331
154331
|
cb(null, line);
|
|
154332
154332
|
}
|
|
154333
154333
|
});
|
|
@@ -210412,7 +210412,7 @@ function createParser(callbacks) {
|
|
|
210412
210412
|
const { onEvent = noop2, onError = noop2, onRetry = noop2, onComment } = callbacks;
|
|
210413
210413
|
let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
|
|
210414
210414
|
function feed(newChunk) {
|
|
210415
|
-
const
|
|
210415
|
+
const chunk2 = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk2}`);
|
|
210416
210416
|
for (const line of complete)
|
|
210417
210417
|
parseLine(line);
|
|
210418
210418
|
incompleteLine = incomplete, isFirstChunk = false;
|
|
@@ -210480,19 +210480,19 @@ function createParser(callbacks) {
|
|
|
210480
210480
|
}
|
|
210481
210481
|
return { feed, reset };
|
|
210482
210482
|
}
|
|
210483
|
-
function splitLines(
|
|
210483
|
+
function splitLines(chunk2) {
|
|
210484
210484
|
const lines = [];
|
|
210485
210485
|
let incompleteLine = "", searchIndex = 0;
|
|
210486
|
-
for (; searchIndex <
|
|
210487
|
-
const crIndex =
|
|
210486
|
+
for (; searchIndex < chunk2.length; ) {
|
|
210487
|
+
const crIndex = chunk2.indexOf("\r", searchIndex), lfIndex = chunk2.indexOf(`
|
|
210488
210488
|
`, searchIndex);
|
|
210489
210489
|
let lineEnd = -1;
|
|
210490
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex ===
|
|
210491
|
-
incompleteLine =
|
|
210490
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk2.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
210491
|
+
incompleteLine = chunk2.slice(searchIndex);
|
|
210492
210492
|
break;
|
|
210493
210493
|
} else {
|
|
210494
|
-
const line =
|
|
210495
|
-
lines.push(line), searchIndex = lineEnd + 1,
|
|
210494
|
+
const line = chunk2.slice(searchIndex, lineEnd);
|
|
210495
|
+
lines.push(line), searchIndex = lineEnd + 1, chunk2[searchIndex - 1] === "\r" && chunk2[searchIndex] === `
|
|
210496
210496
|
` && searchIndex++;
|
|
210497
210497
|
}
|
|
210498
210498
|
}
|
|
@@ -210516,8 +210516,8 @@ var EventSourceParserStream = class extends TransformStream {
|
|
|
210516
210516
|
onComment
|
|
210517
210517
|
});
|
|
210518
210518
|
},
|
|
210519
|
-
transform(
|
|
210520
|
-
parser.feed(
|
|
210519
|
+
transform(chunk2) {
|
|
210520
|
+
parser.feed(chunk2);
|
|
210521
210521
|
}
|
|
210522
210522
|
});
|
|
210523
210523
|
}
|
|
@@ -210692,9 +210692,9 @@ async function readResponseWithSizeLimit({
|
|
|
210692
210692
|
}
|
|
210693
210693
|
const result = new Uint8Array(totalBytes);
|
|
210694
210694
|
let offset = 0;
|
|
210695
|
-
for (const
|
|
210696
|
-
result.set(
|
|
210697
|
-
offset +=
|
|
210695
|
+
for (const chunk2 of chunks) {
|
|
210696
|
+
result.set(chunk2, offset);
|
|
210697
|
+
offset += chunk2.length;
|
|
210698
210698
|
}
|
|
210699
210699
|
return result;
|
|
210700
210700
|
}
|
|
@@ -213196,9 +213196,9 @@ var GatewayLanguageModel = class {
|
|
|
213196
213196
|
controller.enqueue({ type: "stream-start", warnings });
|
|
213197
213197
|
}
|
|
213198
213198
|
},
|
|
213199
|
-
transform(
|
|
213200
|
-
if (
|
|
213201
|
-
const streamPart =
|
|
213199
|
+
transform(chunk2, controller) {
|
|
213200
|
+
if (chunk2.success) {
|
|
213201
|
+
const streamPart = chunk2.value;
|
|
213202
213202
|
if (streamPart.type === "raw" && !options.includeRawChunks) {
|
|
213203
213203
|
return;
|
|
213204
213204
|
}
|
|
@@ -213208,7 +213208,7 @@ var GatewayLanguageModel = class {
|
|
|
213208
213208
|
controller.enqueue(streamPart);
|
|
213209
213209
|
} else {
|
|
213210
213210
|
controller.error(
|
|
213211
|
-
|
|
213211
|
+
chunk2.error
|
|
213212
213212
|
);
|
|
213213
213213
|
}
|
|
213214
213214
|
}
|
|
@@ -214415,17 +214415,17 @@ function asLanguageModelV3(model) {
|
|
|
214415
214415
|
function convertV2StreamToV3(stream) {
|
|
214416
214416
|
return stream.pipeThrough(
|
|
214417
214417
|
new TransformStream({
|
|
214418
|
-
transform(
|
|
214419
|
-
switch (
|
|
214418
|
+
transform(chunk2, controller) {
|
|
214419
|
+
switch (chunk2.type) {
|
|
214420
214420
|
case "finish":
|
|
214421
214421
|
controller.enqueue({
|
|
214422
|
-
...
|
|
214423
|
-
finishReason: convertV2FinishReasonToV3(
|
|
214424
|
-
usage: convertV2UsageToV3(
|
|
214422
|
+
...chunk2,
|
|
214423
|
+
finishReason: convertV2FinishReasonToV3(chunk2.finishReason),
|
|
214424
|
+
usage: convertV2UsageToV3(chunk2.usage)
|
|
214425
214425
|
});
|
|
214426
214426
|
break;
|
|
214427
214427
|
default:
|
|
214428
|
-
controller.enqueue(
|
|
214428
|
+
controller.enqueue(chunk2);
|
|
214429
214429
|
break;
|
|
214430
214430
|
}
|
|
214431
214431
|
}
|
|
@@ -218371,8 +218371,8 @@ var uiMessageChunkSchema = lazySchema(
|
|
|
218371
218371
|
])
|
|
218372
218372
|
)
|
|
218373
218373
|
);
|
|
218374
|
-
function isDataUIMessageChunk(
|
|
218375
|
-
return
|
|
218374
|
+
function isDataUIMessageChunk(chunk2) {
|
|
218375
|
+
return chunk2.type.startsWith("data-");
|
|
218376
218376
|
}
|
|
218377
218377
|
function isStaticToolUIPart(part) {
|
|
218378
218378
|
return part.type.startsWith("tool-");
|
|
@@ -218413,7 +218413,7 @@ function processUIMessageStream({
|
|
|
218413
218413
|
}) {
|
|
218414
218414
|
return stream.pipeThrough(
|
|
218415
218415
|
new TransformStream({
|
|
218416
|
-
async transform(
|
|
218416
|
+
async transform(chunk2, controller) {
|
|
218417
218417
|
await runUpdateMessageJob(async ({ state, write }) => {
|
|
218418
218418
|
var _a212, _b18, _c, _d;
|
|
218419
218419
|
function getToolInvocation(toolCallId) {
|
|
@@ -218521,45 +218521,45 @@ function processUIMessageStream({
|
|
|
218521
218521
|
state.message.metadata = mergedMetadata;
|
|
218522
218522
|
}
|
|
218523
218523
|
}
|
|
218524
|
-
switch (
|
|
218524
|
+
switch (chunk2.type) {
|
|
218525
218525
|
case "text-start": {
|
|
218526
218526
|
const textPart = {
|
|
218527
218527
|
type: "text",
|
|
218528
218528
|
text: "",
|
|
218529
|
-
providerMetadata:
|
|
218529
|
+
providerMetadata: chunk2.providerMetadata,
|
|
218530
218530
|
state: "streaming"
|
|
218531
218531
|
};
|
|
218532
|
-
state.activeTextParts[
|
|
218532
|
+
state.activeTextParts[chunk2.id] = textPart;
|
|
218533
218533
|
state.message.parts.push(textPart);
|
|
218534
218534
|
write();
|
|
218535
218535
|
break;
|
|
218536
218536
|
}
|
|
218537
218537
|
case "text-delta": {
|
|
218538
|
-
const textPart = state.activeTextParts[
|
|
218538
|
+
const textPart = state.activeTextParts[chunk2.id];
|
|
218539
218539
|
if (textPart == null) {
|
|
218540
218540
|
throw new UIMessageStreamError({
|
|
218541
218541
|
chunkType: "text-delta",
|
|
218542
|
-
chunkId:
|
|
218543
|
-
message: `Received text-delta for missing text part with ID "${
|
|
218542
|
+
chunkId: chunk2.id,
|
|
218543
|
+
message: `Received text-delta for missing text part with ID "${chunk2.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`
|
|
218544
218544
|
});
|
|
218545
218545
|
}
|
|
218546
|
-
textPart.text +=
|
|
218547
|
-
textPart.providerMetadata = (_a212 =
|
|
218546
|
+
textPart.text += chunk2.delta;
|
|
218547
|
+
textPart.providerMetadata = (_a212 = chunk2.providerMetadata) != null ? _a212 : textPart.providerMetadata;
|
|
218548
218548
|
write();
|
|
218549
218549
|
break;
|
|
218550
218550
|
}
|
|
218551
218551
|
case "text-end": {
|
|
218552
|
-
const textPart = state.activeTextParts[
|
|
218552
|
+
const textPart = state.activeTextParts[chunk2.id];
|
|
218553
218553
|
if (textPart == null) {
|
|
218554
218554
|
throw new UIMessageStreamError({
|
|
218555
218555
|
chunkType: "text-end",
|
|
218556
|
-
chunkId:
|
|
218557
|
-
message: `Received text-end for missing text part with ID "${
|
|
218556
|
+
chunkId: chunk2.id,
|
|
218557
|
+
message: `Received text-end for missing text part with ID "${chunk2.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`
|
|
218558
218558
|
});
|
|
218559
218559
|
}
|
|
218560
218560
|
textPart.state = "done";
|
|
218561
|
-
textPart.providerMetadata = (_b18 =
|
|
218562
|
-
delete state.activeTextParts[
|
|
218561
|
+
textPart.providerMetadata = (_b18 = chunk2.providerMetadata) != null ? _b18 : textPart.providerMetadata;
|
|
218562
|
+
delete state.activeTextParts[chunk2.id];
|
|
218563
218563
|
write();
|
|
218564
218564
|
break;
|
|
218565
218565
|
}
|
|
@@ -218567,48 +218567,48 @@ function processUIMessageStream({
|
|
|
218567
218567
|
const reasoningPart = {
|
|
218568
218568
|
type: "reasoning",
|
|
218569
218569
|
text: "",
|
|
218570
|
-
providerMetadata:
|
|
218570
|
+
providerMetadata: chunk2.providerMetadata,
|
|
218571
218571
|
state: "streaming"
|
|
218572
218572
|
};
|
|
218573
|
-
state.activeReasoningParts[
|
|
218573
|
+
state.activeReasoningParts[chunk2.id] = reasoningPart;
|
|
218574
218574
|
state.message.parts.push(reasoningPart);
|
|
218575
218575
|
write();
|
|
218576
218576
|
break;
|
|
218577
218577
|
}
|
|
218578
218578
|
case "reasoning-delta": {
|
|
218579
|
-
const reasoningPart = state.activeReasoningParts[
|
|
218579
|
+
const reasoningPart = state.activeReasoningParts[chunk2.id];
|
|
218580
218580
|
if (reasoningPart == null) {
|
|
218581
218581
|
throw new UIMessageStreamError({
|
|
218582
218582
|
chunkType: "reasoning-delta",
|
|
218583
|
-
chunkId:
|
|
218584
|
-
message: `Received reasoning-delta for missing reasoning part with ID "${
|
|
218583
|
+
chunkId: chunk2.id,
|
|
218584
|
+
message: `Received reasoning-delta for missing reasoning part with ID "${chunk2.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`
|
|
218585
218585
|
});
|
|
218586
218586
|
}
|
|
218587
|
-
reasoningPart.text +=
|
|
218588
|
-
reasoningPart.providerMetadata = (_c =
|
|
218587
|
+
reasoningPart.text += chunk2.delta;
|
|
218588
|
+
reasoningPart.providerMetadata = (_c = chunk2.providerMetadata) != null ? _c : reasoningPart.providerMetadata;
|
|
218589
218589
|
write();
|
|
218590
218590
|
break;
|
|
218591
218591
|
}
|
|
218592
218592
|
case "reasoning-end": {
|
|
218593
|
-
const reasoningPart = state.activeReasoningParts[
|
|
218593
|
+
const reasoningPart = state.activeReasoningParts[chunk2.id];
|
|
218594
218594
|
if (reasoningPart == null) {
|
|
218595
218595
|
throw new UIMessageStreamError({
|
|
218596
218596
|
chunkType: "reasoning-end",
|
|
218597
|
-
chunkId:
|
|
218598
|
-
message: `Received reasoning-end for missing reasoning part with ID "${
|
|
218597
|
+
chunkId: chunk2.id,
|
|
218598
|
+
message: `Received reasoning-end for missing reasoning part with ID "${chunk2.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`
|
|
218599
218599
|
});
|
|
218600
218600
|
}
|
|
218601
|
-
reasoningPart.providerMetadata = (_d =
|
|
218601
|
+
reasoningPart.providerMetadata = (_d = chunk2.providerMetadata) != null ? _d : reasoningPart.providerMetadata;
|
|
218602
218602
|
reasoningPart.state = "done";
|
|
218603
|
-
delete state.activeReasoningParts[
|
|
218603
|
+
delete state.activeReasoningParts[chunk2.id];
|
|
218604
218604
|
write();
|
|
218605
218605
|
break;
|
|
218606
218606
|
}
|
|
218607
218607
|
case "file": {
|
|
218608
218608
|
state.message.parts.push({
|
|
218609
218609
|
type: "file",
|
|
218610
|
-
mediaType:
|
|
218611
|
-
url:
|
|
218610
|
+
mediaType: chunk2.mediaType,
|
|
218611
|
+
url: chunk2.url
|
|
218612
218612
|
});
|
|
218613
218613
|
write();
|
|
218614
218614
|
break;
|
|
@@ -218616,10 +218616,10 @@ function processUIMessageStream({
|
|
|
218616
218616
|
case "source-url": {
|
|
218617
218617
|
state.message.parts.push({
|
|
218618
218618
|
type: "source-url",
|
|
218619
|
-
sourceId:
|
|
218620
|
-
url:
|
|
218621
|
-
title:
|
|
218622
|
-
providerMetadata:
|
|
218619
|
+
sourceId: chunk2.sourceId,
|
|
218620
|
+
url: chunk2.url,
|
|
218621
|
+
title: chunk2.title,
|
|
218622
|
+
providerMetadata: chunk2.providerMetadata
|
|
218623
218623
|
});
|
|
218624
218624
|
write();
|
|
218625
218625
|
break;
|
|
@@ -218627,64 +218627,64 @@ function processUIMessageStream({
|
|
|
218627
218627
|
case "source-document": {
|
|
218628
218628
|
state.message.parts.push({
|
|
218629
218629
|
type: "source-document",
|
|
218630
|
-
sourceId:
|
|
218631
|
-
mediaType:
|
|
218632
|
-
title:
|
|
218633
|
-
filename:
|
|
218634
|
-
providerMetadata:
|
|
218630
|
+
sourceId: chunk2.sourceId,
|
|
218631
|
+
mediaType: chunk2.mediaType,
|
|
218632
|
+
title: chunk2.title,
|
|
218633
|
+
filename: chunk2.filename,
|
|
218634
|
+
providerMetadata: chunk2.providerMetadata
|
|
218635
218635
|
});
|
|
218636
218636
|
write();
|
|
218637
218637
|
break;
|
|
218638
218638
|
}
|
|
218639
218639
|
case "tool-input-start": {
|
|
218640
218640
|
const toolInvocations = state.message.parts.filter(isStaticToolUIPart);
|
|
218641
|
-
state.partialToolCalls[
|
|
218641
|
+
state.partialToolCalls[chunk2.toolCallId] = {
|
|
218642
218642
|
text: "",
|
|
218643
|
-
toolName:
|
|
218643
|
+
toolName: chunk2.toolName,
|
|
218644
218644
|
index: toolInvocations.length,
|
|
218645
|
-
dynamic:
|
|
218646
|
-
title:
|
|
218645
|
+
dynamic: chunk2.dynamic,
|
|
218646
|
+
title: chunk2.title
|
|
218647
218647
|
};
|
|
218648
|
-
if (
|
|
218648
|
+
if (chunk2.dynamic) {
|
|
218649
218649
|
updateDynamicToolPart({
|
|
218650
|
-
toolCallId:
|
|
218651
|
-
toolName:
|
|
218650
|
+
toolCallId: chunk2.toolCallId,
|
|
218651
|
+
toolName: chunk2.toolName,
|
|
218652
218652
|
state: "input-streaming",
|
|
218653
218653
|
input: void 0,
|
|
218654
|
-
providerExecuted:
|
|
218655
|
-
title:
|
|
218656
|
-
providerMetadata:
|
|
218654
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218655
|
+
title: chunk2.title,
|
|
218656
|
+
providerMetadata: chunk2.providerMetadata
|
|
218657
218657
|
});
|
|
218658
218658
|
} else {
|
|
218659
218659
|
updateToolPart({
|
|
218660
|
-
toolCallId:
|
|
218661
|
-
toolName:
|
|
218660
|
+
toolCallId: chunk2.toolCallId,
|
|
218661
|
+
toolName: chunk2.toolName,
|
|
218662
218662
|
state: "input-streaming",
|
|
218663
218663
|
input: void 0,
|
|
218664
|
-
providerExecuted:
|
|
218665
|
-
title:
|
|
218666
|
-
providerMetadata:
|
|
218664
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218665
|
+
title: chunk2.title,
|
|
218666
|
+
providerMetadata: chunk2.providerMetadata
|
|
218667
218667
|
});
|
|
218668
218668
|
}
|
|
218669
218669
|
write();
|
|
218670
218670
|
break;
|
|
218671
218671
|
}
|
|
218672
218672
|
case "tool-input-delta": {
|
|
218673
|
-
const partialToolCall = state.partialToolCalls[
|
|
218673
|
+
const partialToolCall = state.partialToolCalls[chunk2.toolCallId];
|
|
218674
218674
|
if (partialToolCall == null) {
|
|
218675
218675
|
throw new UIMessageStreamError({
|
|
218676
218676
|
chunkType: "tool-input-delta",
|
|
218677
|
-
chunkId:
|
|
218678
|
-
message: `Received tool-input-delta for missing tool call with ID "${
|
|
218677
|
+
chunkId: chunk2.toolCallId,
|
|
218678
|
+
message: `Received tool-input-delta for missing tool call with ID "${chunk2.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
|
|
218679
218679
|
});
|
|
218680
218680
|
}
|
|
218681
|
-
partialToolCall.text +=
|
|
218681
|
+
partialToolCall.text += chunk2.inputTextDelta;
|
|
218682
218682
|
const { value: partialArgs } = await parsePartialJson(
|
|
218683
218683
|
partialToolCall.text
|
|
218684
218684
|
);
|
|
218685
218685
|
if (partialToolCall.dynamic) {
|
|
218686
218686
|
updateDynamicToolPart({
|
|
218687
|
-
toolCallId:
|
|
218687
|
+
toolCallId: chunk2.toolCallId,
|
|
218688
218688
|
toolName: partialToolCall.toolName,
|
|
218689
218689
|
state: "input-streaming",
|
|
218690
218690
|
input: partialArgs,
|
|
@@ -218692,7 +218692,7 @@ function processUIMessageStream({
|
|
|
218692
218692
|
});
|
|
218693
218693
|
} else {
|
|
218694
218694
|
updateToolPart({
|
|
218695
|
-
toolCallId:
|
|
218695
|
+
toolCallId: chunk2.toolCallId,
|
|
218696
218696
|
toolName: partialToolCall.toolName,
|
|
218697
218697
|
state: "input-streaming",
|
|
218698
218698
|
input: partialArgs,
|
|
@@ -218703,96 +218703,96 @@ function processUIMessageStream({
|
|
|
218703
218703
|
break;
|
|
218704
218704
|
}
|
|
218705
218705
|
case "tool-input-available": {
|
|
218706
|
-
if (
|
|
218706
|
+
if (chunk2.dynamic) {
|
|
218707
218707
|
updateDynamicToolPart({
|
|
218708
|
-
toolCallId:
|
|
218709
|
-
toolName:
|
|
218708
|
+
toolCallId: chunk2.toolCallId,
|
|
218709
|
+
toolName: chunk2.toolName,
|
|
218710
218710
|
state: "input-available",
|
|
218711
|
-
input:
|
|
218712
|
-
providerExecuted:
|
|
218713
|
-
providerMetadata:
|
|
218714
|
-
title:
|
|
218711
|
+
input: chunk2.input,
|
|
218712
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218713
|
+
providerMetadata: chunk2.providerMetadata,
|
|
218714
|
+
title: chunk2.title
|
|
218715
218715
|
});
|
|
218716
218716
|
} else {
|
|
218717
218717
|
updateToolPart({
|
|
218718
|
-
toolCallId:
|
|
218719
|
-
toolName:
|
|
218718
|
+
toolCallId: chunk2.toolCallId,
|
|
218719
|
+
toolName: chunk2.toolName,
|
|
218720
218720
|
state: "input-available",
|
|
218721
|
-
input:
|
|
218722
|
-
providerExecuted:
|
|
218723
|
-
providerMetadata:
|
|
218724
|
-
title:
|
|
218721
|
+
input: chunk2.input,
|
|
218722
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218723
|
+
providerMetadata: chunk2.providerMetadata,
|
|
218724
|
+
title: chunk2.title
|
|
218725
218725
|
});
|
|
218726
218726
|
}
|
|
218727
218727
|
write();
|
|
218728
|
-
if (onToolCall && !
|
|
218728
|
+
if (onToolCall && !chunk2.providerExecuted) {
|
|
218729
218729
|
await onToolCall({
|
|
218730
|
-
toolCall:
|
|
218730
|
+
toolCall: chunk2
|
|
218731
218731
|
});
|
|
218732
218732
|
}
|
|
218733
218733
|
break;
|
|
218734
218734
|
}
|
|
218735
218735
|
case "tool-input-error": {
|
|
218736
|
-
if (
|
|
218736
|
+
if (chunk2.dynamic) {
|
|
218737
218737
|
updateDynamicToolPart({
|
|
218738
|
-
toolCallId:
|
|
218739
|
-
toolName:
|
|
218738
|
+
toolCallId: chunk2.toolCallId,
|
|
218739
|
+
toolName: chunk2.toolName,
|
|
218740
218740
|
state: "output-error",
|
|
218741
|
-
input:
|
|
218742
|
-
errorText:
|
|
218743
|
-
providerExecuted:
|
|
218744
|
-
providerMetadata:
|
|
218741
|
+
input: chunk2.input,
|
|
218742
|
+
errorText: chunk2.errorText,
|
|
218743
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218744
|
+
providerMetadata: chunk2.providerMetadata
|
|
218745
218745
|
});
|
|
218746
218746
|
} else {
|
|
218747
218747
|
updateToolPart({
|
|
218748
|
-
toolCallId:
|
|
218749
|
-
toolName:
|
|
218748
|
+
toolCallId: chunk2.toolCallId,
|
|
218749
|
+
toolName: chunk2.toolName,
|
|
218750
218750
|
state: "output-error",
|
|
218751
218751
|
input: void 0,
|
|
218752
|
-
rawInput:
|
|
218753
|
-
errorText:
|
|
218754
|
-
providerExecuted:
|
|
218755
|
-
providerMetadata:
|
|
218752
|
+
rawInput: chunk2.input,
|
|
218753
|
+
errorText: chunk2.errorText,
|
|
218754
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218755
|
+
providerMetadata: chunk2.providerMetadata
|
|
218756
218756
|
});
|
|
218757
218757
|
}
|
|
218758
218758
|
write();
|
|
218759
218759
|
break;
|
|
218760
218760
|
}
|
|
218761
218761
|
case "tool-approval-request": {
|
|
218762
|
-
const toolInvocation = getToolInvocation(
|
|
218762
|
+
const toolInvocation = getToolInvocation(chunk2.toolCallId);
|
|
218763
218763
|
toolInvocation.state = "approval-requested";
|
|
218764
|
-
toolInvocation.approval = { id:
|
|
218764
|
+
toolInvocation.approval = { id: chunk2.approvalId };
|
|
218765
218765
|
write();
|
|
218766
218766
|
break;
|
|
218767
218767
|
}
|
|
218768
218768
|
case "tool-output-denied": {
|
|
218769
|
-
const toolInvocation = getToolInvocation(
|
|
218769
|
+
const toolInvocation = getToolInvocation(chunk2.toolCallId);
|
|
218770
218770
|
toolInvocation.state = "output-denied";
|
|
218771
218771
|
write();
|
|
218772
218772
|
break;
|
|
218773
218773
|
}
|
|
218774
218774
|
case "tool-output-available": {
|
|
218775
|
-
const toolInvocation = getToolInvocation(
|
|
218775
|
+
const toolInvocation = getToolInvocation(chunk2.toolCallId);
|
|
218776
218776
|
if (toolInvocation.type === "dynamic-tool") {
|
|
218777
218777
|
updateDynamicToolPart({
|
|
218778
|
-
toolCallId:
|
|
218778
|
+
toolCallId: chunk2.toolCallId,
|
|
218779
218779
|
toolName: toolInvocation.toolName,
|
|
218780
218780
|
state: "output-available",
|
|
218781
218781
|
input: toolInvocation.input,
|
|
218782
|
-
output:
|
|
218783
|
-
preliminary:
|
|
218784
|
-
providerExecuted:
|
|
218782
|
+
output: chunk2.output,
|
|
218783
|
+
preliminary: chunk2.preliminary,
|
|
218784
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218785
218785
|
title: toolInvocation.title
|
|
218786
218786
|
});
|
|
218787
218787
|
} else {
|
|
218788
218788
|
updateToolPart({
|
|
218789
|
-
toolCallId:
|
|
218789
|
+
toolCallId: chunk2.toolCallId,
|
|
218790
218790
|
toolName: getStaticToolName(toolInvocation),
|
|
218791
218791
|
state: "output-available",
|
|
218792
218792
|
input: toolInvocation.input,
|
|
218793
|
-
output:
|
|
218794
|
-
providerExecuted:
|
|
218795
|
-
preliminary:
|
|
218793
|
+
output: chunk2.output,
|
|
218794
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218795
|
+
preliminary: chunk2.preliminary,
|
|
218796
218796
|
title: toolInvocation.title
|
|
218797
218797
|
});
|
|
218798
218798
|
}
|
|
@@ -218800,26 +218800,26 @@ function processUIMessageStream({
|
|
|
218800
218800
|
break;
|
|
218801
218801
|
}
|
|
218802
218802
|
case "tool-output-error": {
|
|
218803
|
-
const toolInvocation = getToolInvocation(
|
|
218803
|
+
const toolInvocation = getToolInvocation(chunk2.toolCallId);
|
|
218804
218804
|
if (toolInvocation.type === "dynamic-tool") {
|
|
218805
218805
|
updateDynamicToolPart({
|
|
218806
|
-
toolCallId:
|
|
218806
|
+
toolCallId: chunk2.toolCallId,
|
|
218807
218807
|
toolName: toolInvocation.toolName,
|
|
218808
218808
|
state: "output-error",
|
|
218809
218809
|
input: toolInvocation.input,
|
|
218810
|
-
errorText:
|
|
218811
|
-
providerExecuted:
|
|
218810
|
+
errorText: chunk2.errorText,
|
|
218811
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218812
218812
|
title: toolInvocation.title
|
|
218813
218813
|
});
|
|
218814
218814
|
} else {
|
|
218815
218815
|
updateToolPart({
|
|
218816
|
-
toolCallId:
|
|
218816
|
+
toolCallId: chunk2.toolCallId,
|
|
218817
218817
|
toolName: getStaticToolName(toolInvocation),
|
|
218818
218818
|
state: "output-error",
|
|
218819
218819
|
input: toolInvocation.input,
|
|
218820
218820
|
rawInput: toolInvocation.rawInput,
|
|
218821
|
-
errorText:
|
|
218822
|
-
providerExecuted:
|
|
218821
|
+
errorText: chunk2.errorText,
|
|
218822
|
+
providerExecuted: chunk2.providerExecuted,
|
|
218823
218823
|
title: toolInvocation.title
|
|
218824
218824
|
});
|
|
218825
218825
|
}
|
|
@@ -218836,54 +218836,54 @@ function processUIMessageStream({
|
|
|
218836
218836
|
break;
|
|
218837
218837
|
}
|
|
218838
218838
|
case "start": {
|
|
218839
|
-
if (
|
|
218840
|
-
state.message.id =
|
|
218839
|
+
if (chunk2.messageId != null) {
|
|
218840
|
+
state.message.id = chunk2.messageId;
|
|
218841
218841
|
}
|
|
218842
|
-
await updateMessageMetadata(
|
|
218843
|
-
if (
|
|
218842
|
+
await updateMessageMetadata(chunk2.messageMetadata);
|
|
218843
|
+
if (chunk2.messageId != null || chunk2.messageMetadata != null) {
|
|
218844
218844
|
write();
|
|
218845
218845
|
}
|
|
218846
218846
|
break;
|
|
218847
218847
|
}
|
|
218848
218848
|
case "finish": {
|
|
218849
|
-
if (
|
|
218850
|
-
state.finishReason =
|
|
218849
|
+
if (chunk2.finishReason != null) {
|
|
218850
|
+
state.finishReason = chunk2.finishReason;
|
|
218851
218851
|
}
|
|
218852
|
-
await updateMessageMetadata(
|
|
218853
|
-
if (
|
|
218852
|
+
await updateMessageMetadata(chunk2.messageMetadata);
|
|
218853
|
+
if (chunk2.messageMetadata != null) {
|
|
218854
218854
|
write();
|
|
218855
218855
|
}
|
|
218856
218856
|
break;
|
|
218857
218857
|
}
|
|
218858
218858
|
case "message-metadata": {
|
|
218859
|
-
await updateMessageMetadata(
|
|
218860
|
-
if (
|
|
218859
|
+
await updateMessageMetadata(chunk2.messageMetadata);
|
|
218860
|
+
if (chunk2.messageMetadata != null) {
|
|
218861
218861
|
write();
|
|
218862
218862
|
}
|
|
218863
218863
|
break;
|
|
218864
218864
|
}
|
|
218865
218865
|
case "error": {
|
|
218866
|
-
onError == null ? void 0 : onError(new Error(
|
|
218866
|
+
onError == null ? void 0 : onError(new Error(chunk2.errorText));
|
|
218867
218867
|
break;
|
|
218868
218868
|
}
|
|
218869
218869
|
default: {
|
|
218870
|
-
if (isDataUIMessageChunk(
|
|
218871
|
-
if ((dataPartSchemas == null ? void 0 : dataPartSchemas[
|
|
218870
|
+
if (isDataUIMessageChunk(chunk2)) {
|
|
218871
|
+
if ((dataPartSchemas == null ? void 0 : dataPartSchemas[chunk2.type]) != null) {
|
|
218872
218872
|
const partIdx = state.message.parts.findIndex(
|
|
218873
|
-
(p2) => "id" in p2 && "data" in p2 && p2.id ===
|
|
218873
|
+
(p2) => "id" in p2 && "data" in p2 && p2.id === chunk2.id && p2.type === chunk2.type
|
|
218874
218874
|
);
|
|
218875
218875
|
const actualPartIdx = partIdx >= 0 ? partIdx : state.message.parts.length;
|
|
218876
218876
|
await validateTypes({
|
|
218877
|
-
value:
|
|
218878
|
-
schema: dataPartSchemas[
|
|
218877
|
+
value: chunk2.data,
|
|
218878
|
+
schema: dataPartSchemas[chunk2.type],
|
|
218879
218879
|
context: {
|
|
218880
218880
|
field: `message.parts[${actualPartIdx}].data`,
|
|
218881
|
-
entityName:
|
|
218882
|
-
entityId:
|
|
218881
|
+
entityName: chunk2.type,
|
|
218882
|
+
entityId: chunk2.id
|
|
218883
218883
|
}
|
|
218884
218884
|
});
|
|
218885
218885
|
}
|
|
218886
|
-
const dataChunk =
|
|
218886
|
+
const dataChunk = chunk2;
|
|
218887
218887
|
if (dataChunk.transient) {
|
|
218888
218888
|
onData == null ? void 0 : onData(dataChunk);
|
|
218889
218889
|
break;
|
|
@@ -218901,7 +218901,7 @@ function processUIMessageStream({
|
|
|
218901
218901
|
}
|
|
218902
218902
|
}
|
|
218903
218903
|
}
|
|
218904
|
-
controller.enqueue(
|
|
218904
|
+
controller.enqueue(chunk2);
|
|
218905
218905
|
});
|
|
218906
218906
|
}
|
|
218907
218907
|
})
|
|
@@ -218924,17 +218924,17 @@ function handleUIMessageStreamFinish({
|
|
|
218924
218924
|
let isAborted2 = false;
|
|
218925
218925
|
const idInjectedStream = stream.pipeThrough(
|
|
218926
218926
|
new TransformStream({
|
|
218927
|
-
transform(
|
|
218928
|
-
if (
|
|
218929
|
-
const startChunk =
|
|
218927
|
+
transform(chunk2, controller) {
|
|
218928
|
+
if (chunk2.type === "start") {
|
|
218929
|
+
const startChunk = chunk2;
|
|
218930
218930
|
if (startChunk.messageId == null && messageId != null) {
|
|
218931
218931
|
startChunk.messageId = messageId;
|
|
218932
218932
|
}
|
|
218933
218933
|
}
|
|
218934
|
-
if (
|
|
218934
|
+
if (chunk2.type === "abort") {
|
|
218935
218935
|
isAborted2 = true;
|
|
218936
218936
|
}
|
|
218937
|
-
controller.enqueue(
|
|
218937
|
+
controller.enqueue(chunk2);
|
|
218938
218938
|
}
|
|
218939
218939
|
})
|
|
218940
218940
|
);
|
|
@@ -218992,11 +218992,11 @@ function handleUIMessageStreamFinish({
|
|
|
218992
218992
|
onError
|
|
218993
218993
|
}).pipeThrough(
|
|
218994
218994
|
new TransformStream({
|
|
218995
|
-
async transform(
|
|
218996
|
-
if (
|
|
218995
|
+
async transform(chunk2, controller) {
|
|
218996
|
+
if (chunk2.type === "finish-step") {
|
|
218997
218997
|
await callOnStepFinish();
|
|
218998
218998
|
}
|
|
218999
|
-
controller.enqueue(
|
|
218999
|
+
controller.enqueue(chunk2);
|
|
219000
219000
|
},
|
|
219001
219001
|
// @ts-expect-error cancel is still new and missing from types https://developer.mozilla.org/en-US/docs/Web/API/TransformStream#browser_compatibility
|
|
219002
219002
|
async cancel() {
|
|
@@ -219237,8 +219237,8 @@ function runToolsTransformation({
|
|
|
219237
219237
|
}
|
|
219238
219238
|
}
|
|
219239
219239
|
const forwardStream = new TransformStream({
|
|
219240
|
-
async transform(
|
|
219241
|
-
const chunkType =
|
|
219240
|
+
async transform(chunk2, controller) {
|
|
219241
|
+
const chunkType = chunk2.type;
|
|
219242
219242
|
switch (chunkType) {
|
|
219243
219243
|
case "stream-start":
|
|
219244
219244
|
case "text-start":
|
|
@@ -219254,15 +219254,15 @@ function runToolsTransformation({
|
|
|
219254
219254
|
case "response-metadata":
|
|
219255
219255
|
case "error":
|
|
219256
219256
|
case "raw": {
|
|
219257
|
-
controller.enqueue(
|
|
219257
|
+
controller.enqueue(chunk2);
|
|
219258
219258
|
break;
|
|
219259
219259
|
}
|
|
219260
219260
|
case "file": {
|
|
219261
219261
|
controller.enqueue({
|
|
219262
219262
|
type: "file",
|
|
219263
219263
|
file: new DefaultGeneratedFileWithType({
|
|
219264
|
-
data:
|
|
219265
|
-
mediaType:
|
|
219264
|
+
data: chunk2.data,
|
|
219265
|
+
mediaType: chunk2.mediaType
|
|
219266
219266
|
})
|
|
219267
219267
|
});
|
|
219268
219268
|
break;
|
|
@@ -219270,28 +219270,28 @@ function runToolsTransformation({
|
|
|
219270
219270
|
case "finish": {
|
|
219271
219271
|
finishChunk = {
|
|
219272
219272
|
type: "finish",
|
|
219273
|
-
finishReason:
|
|
219274
|
-
rawFinishReason:
|
|
219275
|
-
usage: asLanguageModelUsage(
|
|
219276
|
-
providerMetadata:
|
|
219273
|
+
finishReason: chunk2.finishReason.unified,
|
|
219274
|
+
rawFinishReason: chunk2.finishReason.raw,
|
|
219275
|
+
usage: asLanguageModelUsage(chunk2.usage),
|
|
219276
|
+
providerMetadata: chunk2.providerMetadata
|
|
219277
219277
|
};
|
|
219278
219278
|
break;
|
|
219279
219279
|
}
|
|
219280
219280
|
case "tool-approval-request": {
|
|
219281
|
-
const toolCall = toolCallsByToolCallId.get(
|
|
219281
|
+
const toolCall = toolCallsByToolCallId.get(chunk2.toolCallId);
|
|
219282
219282
|
if (toolCall == null) {
|
|
219283
219283
|
toolResultsStreamController.enqueue({
|
|
219284
219284
|
type: "error",
|
|
219285
219285
|
error: new ToolCallNotFoundForApprovalError({
|
|
219286
|
-
toolCallId:
|
|
219287
|
-
approvalId:
|
|
219286
|
+
toolCallId: chunk2.toolCallId,
|
|
219287
|
+
approvalId: chunk2.approvalId
|
|
219288
219288
|
})
|
|
219289
219289
|
});
|
|
219290
219290
|
break;
|
|
219291
219291
|
}
|
|
219292
219292
|
controller.enqueue({
|
|
219293
219293
|
type: "tool-approval-request",
|
|
219294
|
-
approvalId:
|
|
219294
|
+
approvalId: chunk2.approvalId,
|
|
219295
219295
|
toolCall
|
|
219296
219296
|
});
|
|
219297
219297
|
break;
|
|
@@ -219299,7 +219299,7 @@ function runToolsTransformation({
|
|
|
219299
219299
|
case "tool-call": {
|
|
219300
219300
|
try {
|
|
219301
219301
|
const toolCall = await parseToolCall({
|
|
219302
|
-
toolCall:
|
|
219302
|
+
toolCall: chunk2,
|
|
219303
219303
|
tools,
|
|
219304
219304
|
repairToolCall,
|
|
219305
219305
|
system,
|
|
@@ -219382,26 +219382,26 @@ function runToolsTransformation({
|
|
|
219382
219382
|
break;
|
|
219383
219383
|
}
|
|
219384
219384
|
case "tool-result": {
|
|
219385
|
-
const toolName =
|
|
219386
|
-
if (
|
|
219385
|
+
const toolName = chunk2.toolName;
|
|
219386
|
+
if (chunk2.isError) {
|
|
219387
219387
|
toolResultsStreamController.enqueue({
|
|
219388
219388
|
type: "tool-error",
|
|
219389
|
-
toolCallId:
|
|
219389
|
+
toolCallId: chunk2.toolCallId,
|
|
219390
219390
|
toolName,
|
|
219391
|
-
input: toolInputs.get(
|
|
219391
|
+
input: toolInputs.get(chunk2.toolCallId),
|
|
219392
219392
|
providerExecuted: true,
|
|
219393
|
-
error:
|
|
219394
|
-
dynamic:
|
|
219393
|
+
error: chunk2.result,
|
|
219394
|
+
dynamic: chunk2.dynamic
|
|
219395
219395
|
});
|
|
219396
219396
|
} else {
|
|
219397
219397
|
controller.enqueue({
|
|
219398
219398
|
type: "tool-result",
|
|
219399
|
-
toolCallId:
|
|
219399
|
+
toolCallId: chunk2.toolCallId,
|
|
219400
219400
|
toolName,
|
|
219401
|
-
input: toolInputs.get(
|
|
219402
|
-
output:
|
|
219401
|
+
input: toolInputs.get(chunk2.toolCallId),
|
|
219402
|
+
output: chunk2.result,
|
|
219403
219403
|
providerExecuted: true,
|
|
219404
|
-
dynamic:
|
|
219404
|
+
dynamic: chunk2.dynamic
|
|
219405
219405
|
});
|
|
219406
219406
|
}
|
|
219407
219407
|
break;
|
|
@@ -219422,8 +219422,8 @@ function runToolsTransformation({
|
|
|
219422
219422
|
return Promise.all([
|
|
219423
219423
|
generatorStream.pipeThrough(forwardStream).pipeTo(
|
|
219424
219424
|
new WritableStream({
|
|
219425
|
-
write(
|
|
219426
|
-
controller.enqueue(
|
|
219425
|
+
write(chunk2) {
|
|
219426
|
+
controller.enqueue(chunk2);
|
|
219427
219427
|
},
|
|
219428
219428
|
close() {
|
|
219429
219429
|
}
|
|
@@ -219431,8 +219431,8 @@ function runToolsTransformation({
|
|
|
219431
219431
|
),
|
|
219432
219432
|
toolResultsStream.pipeTo(
|
|
219433
219433
|
new WritableStream({
|
|
219434
|
-
write(
|
|
219435
|
-
controller.enqueue(
|
|
219434
|
+
write(chunk2) {
|
|
219435
|
+
controller.enqueue(chunk2);
|
|
219436
219436
|
},
|
|
219437
219437
|
close() {
|
|
219438
219438
|
controller.close();
|
|
@@ -219561,35 +219561,35 @@ function createOutputTransformStream(output) {
|
|
|
219561
219561
|
textChunk = "";
|
|
219562
219562
|
}
|
|
219563
219563
|
return new TransformStream({
|
|
219564
|
-
async transform(
|
|
219564
|
+
async transform(chunk2, controller) {
|
|
219565
219565
|
var _a212;
|
|
219566
|
-
if (
|
|
219566
|
+
if (chunk2.type === "finish-step" && textChunk.length > 0) {
|
|
219567
219567
|
publishTextChunk({ controller });
|
|
219568
219568
|
}
|
|
219569
|
-
if (
|
|
219570
|
-
controller.enqueue({ part:
|
|
219569
|
+
if (chunk2.type !== "text-delta" && chunk2.type !== "text-start" && chunk2.type !== "text-end") {
|
|
219570
|
+
controller.enqueue({ part: chunk2, partialOutput: void 0 });
|
|
219571
219571
|
return;
|
|
219572
219572
|
}
|
|
219573
219573
|
if (firstTextChunkId == null) {
|
|
219574
|
-
firstTextChunkId =
|
|
219575
|
-
} else if (
|
|
219576
|
-
controller.enqueue({ part:
|
|
219574
|
+
firstTextChunkId = chunk2.id;
|
|
219575
|
+
} else if (chunk2.id !== firstTextChunkId) {
|
|
219576
|
+
controller.enqueue({ part: chunk2, partialOutput: void 0 });
|
|
219577
219577
|
return;
|
|
219578
219578
|
}
|
|
219579
|
-
if (
|
|
219580
|
-
controller.enqueue({ part:
|
|
219579
|
+
if (chunk2.type === "text-start") {
|
|
219580
|
+
controller.enqueue({ part: chunk2, partialOutput: void 0 });
|
|
219581
219581
|
return;
|
|
219582
219582
|
}
|
|
219583
|
-
if (
|
|
219583
|
+
if (chunk2.type === "text-end") {
|
|
219584
219584
|
if (textChunk.length > 0) {
|
|
219585
219585
|
publishTextChunk({ controller });
|
|
219586
219586
|
}
|
|
219587
|
-
controller.enqueue({ part:
|
|
219587
|
+
controller.enqueue({ part: chunk2, partialOutput: void 0 });
|
|
219588
219588
|
return;
|
|
219589
219589
|
}
|
|
219590
|
-
text2 +=
|
|
219591
|
-
textChunk +=
|
|
219592
|
-
textProviderMetadata = (_a212 =
|
|
219590
|
+
text2 += chunk2.text;
|
|
219591
|
+
textChunk += chunk2.text;
|
|
219592
|
+
textProviderMetadata = (_a212 = chunk2.providerMetadata) != null ? _a212 : textProviderMetadata;
|
|
219593
219593
|
const result = await output.parsePartialOutput({ text: text2 });
|
|
219594
219594
|
if (result !== void 0) {
|
|
219595
219595
|
const currentJson = JSON.stringify(result.partial);
|
|
@@ -219665,10 +219665,10 @@ var DefaultStreamTextResult = class {
|
|
|
219665
219665
|
let activeTextContent = {};
|
|
219666
219666
|
let activeReasoningContent = {};
|
|
219667
219667
|
const eventProcessor = new TransformStream({
|
|
219668
|
-
async transform(
|
|
219668
|
+
async transform(chunk2, controller) {
|
|
219669
219669
|
var _a212, _b18, _c, _d;
|
|
219670
|
-
controller.enqueue(
|
|
219671
|
-
const { part } =
|
|
219670
|
+
controller.enqueue(chunk2);
|
|
219671
|
+
const { part } = chunk2;
|
|
219672
219672
|
if (part.type === "text-delta" || part.type === "reasoning-delta" || part.type === "source" || part.type === "tool-call" || part.type === "tool-result" || part.type === "tool-input-start" || part.type === "tool-input-delta" || part.type === "raw") {
|
|
219673
219673
|
await (onChunk == null ? void 0 : onChunk({ chunk: part }));
|
|
219674
219674
|
}
|
|
@@ -220316,11 +220316,11 @@ var DefaultStreamTextResult = class {
|
|
|
220316
220316
|
self2.addStream(
|
|
220317
220317
|
streamWithToolResults.pipeThrough(
|
|
220318
220318
|
new TransformStream({
|
|
220319
|
-
async transform(
|
|
220319
|
+
async transform(chunk2, controller) {
|
|
220320
220320
|
var _a222, _b24, _c2, _d2, _e2;
|
|
220321
220321
|
resetChunkTimeout();
|
|
220322
|
-
if (
|
|
220323
|
-
warnings =
|
|
220322
|
+
if (chunk2.type === "stream-start") {
|
|
220323
|
+
warnings = chunk2.warnings;
|
|
220324
220324
|
return;
|
|
220325
220325
|
}
|
|
220326
220326
|
if (stepFirstChunk) {
|
|
@@ -220338,70 +220338,70 @@ var DefaultStreamTextResult = class {
|
|
|
220338
220338
|
warnings: warnings != null ? warnings : []
|
|
220339
220339
|
});
|
|
220340
220340
|
}
|
|
220341
|
-
const chunkType =
|
|
220341
|
+
const chunkType = chunk2.type;
|
|
220342
220342
|
switch (chunkType) {
|
|
220343
220343
|
case "tool-approval-request":
|
|
220344
220344
|
case "text-start":
|
|
220345
220345
|
case "text-end": {
|
|
220346
|
-
controller.enqueue(
|
|
220346
|
+
controller.enqueue(chunk2);
|
|
220347
220347
|
break;
|
|
220348
220348
|
}
|
|
220349
220349
|
case "text-delta": {
|
|
220350
|
-
if (
|
|
220350
|
+
if (chunk2.delta.length > 0) {
|
|
220351
220351
|
controller.enqueue({
|
|
220352
220352
|
type: "text-delta",
|
|
220353
|
-
id:
|
|
220354
|
-
text:
|
|
220355
|
-
providerMetadata:
|
|
220353
|
+
id: chunk2.id,
|
|
220354
|
+
text: chunk2.delta,
|
|
220355
|
+
providerMetadata: chunk2.providerMetadata
|
|
220356
220356
|
});
|
|
220357
|
-
activeText +=
|
|
220357
|
+
activeText += chunk2.delta;
|
|
220358
220358
|
}
|
|
220359
220359
|
break;
|
|
220360
220360
|
}
|
|
220361
220361
|
case "reasoning-start":
|
|
220362
220362
|
case "reasoning-end": {
|
|
220363
|
-
controller.enqueue(
|
|
220363
|
+
controller.enqueue(chunk2);
|
|
220364
220364
|
break;
|
|
220365
220365
|
}
|
|
220366
220366
|
case "reasoning-delta": {
|
|
220367
220367
|
controller.enqueue({
|
|
220368
220368
|
type: "reasoning-delta",
|
|
220369
|
-
id:
|
|
220370
|
-
text:
|
|
220371
|
-
providerMetadata:
|
|
220369
|
+
id: chunk2.id,
|
|
220370
|
+
text: chunk2.delta,
|
|
220371
|
+
providerMetadata: chunk2.providerMetadata
|
|
220372
220372
|
});
|
|
220373
220373
|
break;
|
|
220374
220374
|
}
|
|
220375
220375
|
case "tool-call": {
|
|
220376
|
-
controller.enqueue(
|
|
220377
|
-
stepToolCalls.push(
|
|
220376
|
+
controller.enqueue(chunk2);
|
|
220377
|
+
stepToolCalls.push(chunk2);
|
|
220378
220378
|
break;
|
|
220379
220379
|
}
|
|
220380
220380
|
case "tool-result": {
|
|
220381
|
-
controller.enqueue(
|
|
220382
|
-
if (!
|
|
220383
|
-
stepToolOutputs.push(
|
|
220381
|
+
controller.enqueue(chunk2);
|
|
220382
|
+
if (!chunk2.preliminary) {
|
|
220383
|
+
stepToolOutputs.push(chunk2);
|
|
220384
220384
|
}
|
|
220385
220385
|
break;
|
|
220386
220386
|
}
|
|
220387
220387
|
case "tool-error": {
|
|
220388
|
-
controller.enqueue(
|
|
220389
|
-
stepToolOutputs.push(
|
|
220388
|
+
controller.enqueue(chunk2);
|
|
220389
|
+
stepToolOutputs.push(chunk2);
|
|
220390
220390
|
break;
|
|
220391
220391
|
}
|
|
220392
220392
|
case "response-metadata": {
|
|
220393
220393
|
stepResponse = {
|
|
220394
|
-
id: (_a222 =
|
|
220395
|
-
timestamp: (_b24 =
|
|
220396
|
-
modelId: (_c2 =
|
|
220394
|
+
id: (_a222 = chunk2.id) != null ? _a222 : stepResponse.id,
|
|
220395
|
+
timestamp: (_b24 = chunk2.timestamp) != null ? _b24 : stepResponse.timestamp,
|
|
220396
|
+
modelId: (_c2 = chunk2.modelId) != null ? _c2 : stepResponse.modelId
|
|
220397
220397
|
};
|
|
220398
220398
|
break;
|
|
220399
220399
|
}
|
|
220400
220400
|
case "finish": {
|
|
220401
|
-
stepUsage =
|
|
220402
|
-
stepFinishReason =
|
|
220403
|
-
stepRawFinishReason =
|
|
220404
|
-
stepProviderMetadata =
|
|
220401
|
+
stepUsage = chunk2.usage;
|
|
220402
|
+
stepFinishReason = chunk2.finishReason;
|
|
220403
|
+
stepRawFinishReason = chunk2.rawFinishReason;
|
|
220404
|
+
stepProviderMetadata = chunk2.providerMetadata;
|
|
220405
220405
|
const msToFinish = now22() - startTimestampMs;
|
|
220406
220406
|
doStreamSpan.addEvent("ai.stream.finish");
|
|
220407
220407
|
doStreamSpan.setAttributes({
|
|
@@ -220411,59 +220411,59 @@ var DefaultStreamTextResult = class {
|
|
|
220411
220411
|
break;
|
|
220412
220412
|
}
|
|
220413
220413
|
case "file": {
|
|
220414
|
-
controller.enqueue(
|
|
220414
|
+
controller.enqueue(chunk2);
|
|
220415
220415
|
break;
|
|
220416
220416
|
}
|
|
220417
220417
|
case "source": {
|
|
220418
|
-
controller.enqueue(
|
|
220418
|
+
controller.enqueue(chunk2);
|
|
220419
220419
|
break;
|
|
220420
220420
|
}
|
|
220421
220421
|
case "tool-input-start": {
|
|
220422
|
-
activeToolCallToolNames[
|
|
220423
|
-
const tool2 = tools == null ? void 0 : tools[
|
|
220422
|
+
activeToolCallToolNames[chunk2.id] = chunk2.toolName;
|
|
220423
|
+
const tool2 = tools == null ? void 0 : tools[chunk2.toolName];
|
|
220424
220424
|
if ((tool2 == null ? void 0 : tool2.onInputStart) != null) {
|
|
220425
220425
|
await tool2.onInputStart({
|
|
220426
|
-
toolCallId:
|
|
220426
|
+
toolCallId: chunk2.id,
|
|
220427
220427
|
messages: stepInputMessages,
|
|
220428
220428
|
abortSignal,
|
|
220429
220429
|
experimental_context
|
|
220430
220430
|
});
|
|
220431
220431
|
}
|
|
220432
220432
|
controller.enqueue({
|
|
220433
|
-
...
|
|
220434
|
-
dynamic: (_e2 =
|
|
220433
|
+
...chunk2,
|
|
220434
|
+
dynamic: (_e2 = chunk2.dynamic) != null ? _e2 : (tool2 == null ? void 0 : tool2.type) === "dynamic",
|
|
220435
220435
|
title: tool2 == null ? void 0 : tool2.title
|
|
220436
220436
|
});
|
|
220437
220437
|
break;
|
|
220438
220438
|
}
|
|
220439
220439
|
case "tool-input-end": {
|
|
220440
|
-
delete activeToolCallToolNames[
|
|
220441
|
-
controller.enqueue(
|
|
220440
|
+
delete activeToolCallToolNames[chunk2.id];
|
|
220441
|
+
controller.enqueue(chunk2);
|
|
220442
220442
|
break;
|
|
220443
220443
|
}
|
|
220444
220444
|
case "tool-input-delta": {
|
|
220445
|
-
const toolName = activeToolCallToolNames[
|
|
220445
|
+
const toolName = activeToolCallToolNames[chunk2.id];
|
|
220446
220446
|
const tool2 = tools == null ? void 0 : tools[toolName];
|
|
220447
220447
|
if ((tool2 == null ? void 0 : tool2.onInputDelta) != null) {
|
|
220448
220448
|
await tool2.onInputDelta({
|
|
220449
|
-
inputTextDelta:
|
|
220450
|
-
toolCallId:
|
|
220449
|
+
inputTextDelta: chunk2.delta,
|
|
220450
|
+
toolCallId: chunk2.id,
|
|
220451
220451
|
messages: stepInputMessages,
|
|
220452
220452
|
abortSignal,
|
|
220453
220453
|
experimental_context
|
|
220454
220454
|
});
|
|
220455
220455
|
}
|
|
220456
|
-
controller.enqueue(
|
|
220456
|
+
controller.enqueue(chunk2);
|
|
220457
220457
|
break;
|
|
220458
220458
|
}
|
|
220459
220459
|
case "error": {
|
|
220460
|
-
controller.enqueue(
|
|
220460
|
+
controller.enqueue(chunk2);
|
|
220461
220461
|
stepFinishReason = "error";
|
|
220462
220462
|
break;
|
|
220463
220463
|
}
|
|
220464
220464
|
case "raw": {
|
|
220465
220465
|
if (includeRawChunks2) {
|
|
220466
|
-
controller.enqueue(
|
|
220466
|
+
controller.enqueue(chunk2);
|
|
220467
220467
|
}
|
|
220468
220468
|
break;
|
|
220469
220469
|
}
|
|
@@ -221930,17 +221930,17 @@ var DeepSeekChatLanguageModel = class {
|
|
|
221930
221930
|
start(controller) {
|
|
221931
221931
|
controller.enqueue({ type: "stream-start", warnings });
|
|
221932
221932
|
},
|
|
221933
|
-
transform(
|
|
221933
|
+
transform(chunk2, controller) {
|
|
221934
221934
|
var _a26, _b18, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
221935
221935
|
if (options.includeRawChunks) {
|
|
221936
|
-
controller.enqueue({ type: "raw", rawValue:
|
|
221936
|
+
controller.enqueue({ type: "raw", rawValue: chunk2.rawValue });
|
|
221937
221937
|
}
|
|
221938
|
-
if (!
|
|
221938
|
+
if (!chunk2.success) {
|
|
221939
221939
|
finishReason = { unified: "error", raw: void 0 };
|
|
221940
|
-
controller.enqueue({ type: "error", error:
|
|
221940
|
+
controller.enqueue({ type: "error", error: chunk2.error });
|
|
221941
221941
|
return;
|
|
221942
221942
|
}
|
|
221943
|
-
const value =
|
|
221943
|
+
const value = chunk2.value;
|
|
221944
221944
|
if ("error" in value) {
|
|
221945
221945
|
finishReason = { unified: "error", raw: void 0 };
|
|
221946
221946
|
controller.enqueue({ type: "error", error: value.error.message });
|
|
@@ -222541,7 +222541,7 @@ function createParser2(callbacks) {
|
|
|
222541
222541
|
const { onEvent = noop3, onError = noop3, onRetry = noop3, onComment } = callbacks;
|
|
222542
222542
|
let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
|
|
222543
222543
|
function feed(newChunk) {
|
|
222544
|
-
const
|
|
222544
|
+
const chunk2 = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines2(`${incompleteLine}${chunk2}`);
|
|
222545
222545
|
for (const line of complete)
|
|
222546
222546
|
parseLine(line);
|
|
222547
222547
|
incompleteLine = incomplete, isFirstChunk = false;
|
|
@@ -222609,19 +222609,19 @@ function createParser2(callbacks) {
|
|
|
222609
222609
|
}
|
|
222610
222610
|
return { feed, reset };
|
|
222611
222611
|
}
|
|
222612
|
-
function splitLines2(
|
|
222612
|
+
function splitLines2(chunk2) {
|
|
222613
222613
|
const lines = [];
|
|
222614
222614
|
let incompleteLine = "", searchIndex = 0;
|
|
222615
|
-
for (; searchIndex <
|
|
222616
|
-
const crIndex =
|
|
222615
|
+
for (; searchIndex < chunk2.length; ) {
|
|
222616
|
+
const crIndex = chunk2.indexOf("\r", searchIndex), lfIndex = chunk2.indexOf(`
|
|
222617
222617
|
`, searchIndex);
|
|
222618
222618
|
let lineEnd = -1;
|
|
222619
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex ===
|
|
222620
|
-
incompleteLine =
|
|
222619
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk2.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
222620
|
+
incompleteLine = chunk2.slice(searchIndex);
|
|
222621
222621
|
break;
|
|
222622
222622
|
} else {
|
|
222623
|
-
const line =
|
|
222624
|
-
lines.push(line), searchIndex = lineEnd + 1,
|
|
222623
|
+
const line = chunk2.slice(searchIndex, lineEnd);
|
|
222624
|
+
lines.push(line), searchIndex = lineEnd + 1, chunk2[searchIndex - 1] === "\r" && chunk2[searchIndex] === `
|
|
222625
222625
|
` && searchIndex++;
|
|
222626
222626
|
}
|
|
222627
222627
|
}
|
|
@@ -222643,8 +222643,8 @@ var EventSourceParserStream2 = class extends TransformStream {
|
|
|
222643
222643
|
onComment
|
|
222644
222644
|
});
|
|
222645
222645
|
},
|
|
222646
|
-
transform(
|
|
222647
|
-
parser.feed(
|
|
222646
|
+
transform(chunk2) {
|
|
222647
|
+
parser.feed(chunk2);
|
|
222648
222648
|
}
|
|
222649
222649
|
});
|
|
222650
222650
|
}
|
|
@@ -225725,17 +225725,17 @@ var OpenRouterChatLanguageModel = class {
|
|
|
225725
225725
|
return {
|
|
225726
225726
|
stream: safeResponse.pipeThrough(
|
|
225727
225727
|
new TransformStream({
|
|
225728
|
-
transform(
|
|
225728
|
+
transform(chunk2, controller) {
|
|
225729
225729
|
var _a173, _b172, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
225730
225730
|
if (options.includeRawChunks) {
|
|
225731
|
-
controller.enqueue({ type: "raw", rawValue:
|
|
225731
|
+
controller.enqueue({ type: "raw", rawValue: chunk2.rawValue });
|
|
225732
225732
|
}
|
|
225733
|
-
if (!
|
|
225733
|
+
if (!chunk2.success) {
|
|
225734
225734
|
finishReason = createFinishReason("error");
|
|
225735
|
-
controller.enqueue({ type: "error", error:
|
|
225735
|
+
controller.enqueue({ type: "error", error: chunk2.error });
|
|
225736
225736
|
return;
|
|
225737
225737
|
}
|
|
225738
|
-
const value =
|
|
225738
|
+
const value = chunk2.value;
|
|
225739
225739
|
if ("error" in value) {
|
|
225740
225740
|
finishReason = createFinishReason("error");
|
|
225741
225741
|
controller.enqueue({ type: "error", error: value.error });
|
|
@@ -226487,17 +226487,17 @@ var OpenRouterCompletionLanguageModel = class {
|
|
|
226487
226487
|
return {
|
|
226488
226488
|
stream: safeResponse.pipeThrough(
|
|
226489
226489
|
new TransformStream({
|
|
226490
|
-
transform(
|
|
226490
|
+
transform(chunk2, controller) {
|
|
226491
226491
|
var _a163, _b162, _c, _d, _e;
|
|
226492
226492
|
if (options.includeRawChunks) {
|
|
226493
|
-
controller.enqueue({ type: "raw", rawValue:
|
|
226493
|
+
controller.enqueue({ type: "raw", rawValue: chunk2.rawValue });
|
|
226494
226494
|
}
|
|
226495
|
-
if (!
|
|
226495
|
+
if (!chunk2.success) {
|
|
226496
226496
|
finishReason = createFinishReason("error");
|
|
226497
|
-
controller.enqueue({ type: "error", error:
|
|
226497
|
+
controller.enqueue({ type: "error", error: chunk2.error });
|
|
226498
226498
|
return;
|
|
226499
226499
|
}
|
|
226500
|
-
const value =
|
|
226500
|
+
const value = chunk2.value;
|
|
226501
226501
|
if ("error" in value) {
|
|
226502
226502
|
finishReason = createFinishReason("error");
|
|
226503
226503
|
controller.enqueue({ type: "error", error: value.error });
|
|
@@ -227090,14 +227090,38 @@ async function generateSessionTitle(storage, userMessage, userId) {
|
|
|
227090
227090
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
227091
227091
|
var MAX_BUFFER = 10 * 1024 * 1024;
|
|
227092
227092
|
var ABSENT = "absent";
|
|
227093
|
-
function git(cwd, args) {
|
|
227093
|
+
function git(cwd, args, input) {
|
|
227094
227094
|
return execFileSync2("git", args, {
|
|
227095
227095
|
cwd,
|
|
227096
227096
|
encoding: "utf-8",
|
|
227097
227097
|
maxBuffer: MAX_BUFFER,
|
|
227098
|
+
input,
|
|
227098
227099
|
stdio: ["pipe", "pipe", "pipe"]
|
|
227099
227100
|
});
|
|
227100
227101
|
}
|
|
227102
|
+
var PATHS_PER_BATCH = 200;
|
|
227103
|
+
function chunk(items, size) {
|
|
227104
|
+
const out = [];
|
|
227105
|
+
for (let i = 0; i < items.length; i += size) out.push(items.slice(i, i + size));
|
|
227106
|
+
return out;
|
|
227107
|
+
}
|
|
227108
|
+
function hashObjects(worktreePath, paths) {
|
|
227109
|
+
const hashes = /* @__PURE__ */ new Map();
|
|
227110
|
+
for (const batch of chunk(paths, PATHS_PER_BATCH)) {
|
|
227111
|
+
let shas = [];
|
|
227112
|
+
try {
|
|
227113
|
+
shas = git(worktreePath, ["hash-object", "--", ...batch]).split("\n").map((l) => l.trim()).filter(Boolean);
|
|
227114
|
+
} catch {
|
|
227115
|
+
shas = [];
|
|
227116
|
+
}
|
|
227117
|
+
if (shas.length !== batch.length) {
|
|
227118
|
+
for (const p2 of batch) hashes.set(p2, git(worktreePath, ["hash-object", "--", p2]).trim());
|
|
227119
|
+
continue;
|
|
227120
|
+
}
|
|
227121
|
+
batch.forEach((p2, i) => hashes.set(p2, shas[i]));
|
|
227122
|
+
}
|
|
227123
|
+
return hashes;
|
|
227124
|
+
}
|
|
227101
227125
|
function captureSnapshot(worktreePath) {
|
|
227102
227126
|
try {
|
|
227103
227127
|
const head = git(worktreePath, ["rev-parse", "HEAD"]).trim();
|
|
@@ -227110,13 +227134,15 @@ function captureSnapshot(worktreePath) {
|
|
|
227110
227134
|
"--name-status",
|
|
227111
227135
|
"--no-renames"
|
|
227112
227136
|
]);
|
|
227137
|
+
const toHash = [];
|
|
227113
227138
|
for (const line of nameStatus.split("\n")) {
|
|
227114
227139
|
if (!line.trim()) continue;
|
|
227115
227140
|
const tab = line.indexOf(" ");
|
|
227116
227141
|
if (tab < 0) continue;
|
|
227117
227142
|
const status = line.slice(0, tab).trim();
|
|
227118
227143
|
const p2 = line.slice(tab + 1).trim();
|
|
227119
|
-
|
|
227144
|
+
if (status.startsWith("D")) dirty[p2] = ABSENT;
|
|
227145
|
+
else toHash.push(p2);
|
|
227120
227146
|
}
|
|
227121
227147
|
const untracked = git(worktreePath, [
|
|
227122
227148
|
"-c",
|
|
@@ -227127,8 +227153,9 @@ function captureSnapshot(worktreePath) {
|
|
|
227127
227153
|
]);
|
|
227128
227154
|
for (const p2 of untracked.split("\n")) {
|
|
227129
227155
|
const t = p2.trim();
|
|
227130
|
-
if (t)
|
|
227156
|
+
if (t) toHash.push(t);
|
|
227131
227157
|
}
|
|
227158
|
+
for (const [p2, sha] of hashObjects(worktreePath, toHash)) dirty[p2] = sha;
|
|
227132
227159
|
return { head, dirty };
|
|
227133
227160
|
} catch {
|
|
227134
227161
|
return null;
|
|
@@ -227141,6 +227168,33 @@ function blobShaOrAbsent(worktreePath, head, filePath) {
|
|
|
227141
227168
|
return ABSENT;
|
|
227142
227169
|
}
|
|
227143
227170
|
}
|
|
227171
|
+
var BATCH_CHECK_FOUND = /^([0-9a-f]{40,64}) [a-z]+ \d+$/;
|
|
227172
|
+
function blobShasAt(worktreePath, head, paths) {
|
|
227173
|
+
const out = /* @__PURE__ */ new Map();
|
|
227174
|
+
const batchable = [];
|
|
227175
|
+
for (const p2 of paths) {
|
|
227176
|
+
if (p2.includes("\n")) out.set(p2, blobShaOrAbsent(worktreePath, head, p2));
|
|
227177
|
+
else batchable.push(p2);
|
|
227178
|
+
}
|
|
227179
|
+
for (const batch of chunk(batchable, PATHS_PER_BATCH)) {
|
|
227180
|
+
let lines = [];
|
|
227181
|
+
try {
|
|
227182
|
+
const stdin = batch.map((p2) => `${head}:${p2}`).join("\n") + "\n";
|
|
227183
|
+
lines = git(worktreePath, ["cat-file", "--batch-check"], stdin).split("\n").filter((l) => l.length > 0);
|
|
227184
|
+
} catch {
|
|
227185
|
+
lines = [];
|
|
227186
|
+
}
|
|
227187
|
+
if (lines.length !== batch.length) {
|
|
227188
|
+
for (const p2 of batch) out.set(p2, blobShaOrAbsent(worktreePath, head, p2));
|
|
227189
|
+
continue;
|
|
227190
|
+
}
|
|
227191
|
+
batch.forEach((p2, i) => {
|
|
227192
|
+
const found = BATCH_CHECK_FOUND.exec(lines[i]);
|
|
227193
|
+
out.set(p2, found ? found[1] : ABSENT);
|
|
227194
|
+
});
|
|
227195
|
+
}
|
|
227196
|
+
return out;
|
|
227197
|
+
}
|
|
227144
227198
|
function computeScope(start, end, worktreePath) {
|
|
227145
227199
|
const candidates = /* @__PURE__ */ new Set();
|
|
227146
227200
|
if (start.head !== end.head) {
|
|
@@ -227160,18 +227214,29 @@ function computeScope(start, end, worktreePath) {
|
|
|
227160
227214
|
}
|
|
227161
227215
|
for (const p2 of Object.keys(start.dirty)) candidates.add(p2);
|
|
227162
227216
|
for (const p2 of Object.keys(end.dirty)) candidates.add(p2);
|
|
227217
|
+
const candidateList = [...candidates];
|
|
227218
|
+
const startShas = blobShasAt(
|
|
227219
|
+
worktreePath,
|
|
227220
|
+
start.head,
|
|
227221
|
+
candidateList.filter((f2) => start.dirty[f2] === void 0)
|
|
227222
|
+
);
|
|
227223
|
+
const endShas = blobShasAt(
|
|
227224
|
+
worktreePath,
|
|
227225
|
+
end.head,
|
|
227226
|
+
candidateList.filter((f2) => end.dirty[f2] === void 0)
|
|
227227
|
+
);
|
|
227163
227228
|
const changed = [];
|
|
227164
|
-
for (const f2 of
|
|
227165
|
-
const startSha = start.dirty[f2] ??
|
|
227166
|
-
const endSha = end.dirty[f2] ??
|
|
227229
|
+
for (const f2 of candidateList) {
|
|
227230
|
+
const startSha = start.dirty[f2] ?? startShas.get(f2) ?? ABSENT;
|
|
227231
|
+
const endSha = end.dirty[f2] ?? endShas.get(f2) ?? ABSENT;
|
|
227167
227232
|
if (startSha !== endSha) changed.push(f2);
|
|
227168
227233
|
}
|
|
227169
227234
|
changed.sort();
|
|
227170
227235
|
return { changedFiles: changed, startHead: start.head };
|
|
227171
227236
|
}
|
|
227172
|
-
async function recordTurnSnapshot(storage, sessionId, turnEndIndex, worktreePath) {
|
|
227237
|
+
async function recordTurnSnapshot(storage, sessionId, turnEndIndex, worktreePath, captured) {
|
|
227173
227238
|
try {
|
|
227174
|
-
const snap = captureSnapshot(worktreePath);
|
|
227239
|
+
const snap = captured ?? captureSnapshot(worktreePath);
|
|
227175
227240
|
if (!snap) return;
|
|
227176
227241
|
await storage.turnSnapshots.create({
|
|
227177
227242
|
session_id: sessionId,
|
|
@@ -227809,7 +227874,7 @@ var AgentSessionManager = class {
|
|
|
227809
227874
|
});
|
|
227810
227875
|
}
|
|
227811
227876
|
if (!skipDb && !stored) {
|
|
227812
|
-
await recordTurnSnapshot(this.storage, sessionId, -1, absoluteWorktreePath);
|
|
227877
|
+
await recordTurnSnapshot(this.storage, sessionId, -1, absoluteWorktreePath, opts.startSnapshot);
|
|
227813
227878
|
}
|
|
227814
227879
|
const storedEntries = stored ? await this.storage.agentSessions.getEntries(sessionId) : [];
|
|
227815
227880
|
const store = storedEntries.length > 0 ? this.rebuildStoreFromRows(storedEntries, sessionId) : (() => {
|
|
@@ -230003,19 +230068,19 @@ var RemoteNotificationSync = class {
|
|
|
230003
230068
|
}
|
|
230004
230069
|
async syncMappings(remoteServerId, mappings) {
|
|
230005
230070
|
for (let i = 0; i < mappings.length; i += MAX_SESSIONS_PER_REQUEST) {
|
|
230006
|
-
const
|
|
230007
|
-
await this.syncChunk(remoteServerId,
|
|
230071
|
+
const chunk2 = mappings.slice(i, i + MAX_SESSIONS_PER_REQUEST);
|
|
230072
|
+
await this.syncChunk(remoteServerId, chunk2).catch(
|
|
230008
230073
|
(err) => console.warn(`[RemoteNotifications] chunk sync for ${remoteServerId} failed:`, err)
|
|
230009
230074
|
);
|
|
230010
230075
|
}
|
|
230011
230076
|
}
|
|
230012
|
-
async syncChunk(remoteServerId,
|
|
230013
|
-
const target = await this.resolveTarget(
|
|
230077
|
+
async syncChunk(remoteServerId, chunk2) {
|
|
230078
|
+
const target = await this.resolveTarget(chunk2[0]);
|
|
230014
230079
|
if (!target) {
|
|
230015
|
-
console.warn(`[RemoteNotifications] no remote link for server ${remoteServerId}; skipping ${
|
|
230080
|
+
console.warn(`[RemoteNotifications] no remote link for server ${remoteServerId}; skipping ${chunk2.length} mapping(s)`);
|
|
230016
230081
|
return;
|
|
230017
230082
|
}
|
|
230018
|
-
let pending = new Map(
|
|
230083
|
+
let pending = new Map(chunk2.map((m2) => [m2.remote_session_id, m2]));
|
|
230019
230084
|
for (let page = 0; page < MAX_PAGES_PER_SYNC && pending.size > 0; page++) {
|
|
230020
230085
|
const cursors = await this.storage.notificationSyncCursors.getMany(
|
|
230021
230086
|
remoteServerId,
|
|
@@ -234316,19 +234381,19 @@ function boundedRecentMessagesKeeping(messages, pinned, limit, maxUtf8Bytes) {
|
|
|
234316
234381
|
function splitUtf8Content(content, maxUtf8Bytes) {
|
|
234317
234382
|
if (Buffer.byteLength(content, "utf8") <= maxUtf8Bytes) return [content];
|
|
234318
234383
|
const chunks = [];
|
|
234319
|
-
let
|
|
234384
|
+
let chunk2 = "";
|
|
234320
234385
|
let bytes = 0;
|
|
234321
234386
|
for (const character of content) {
|
|
234322
234387
|
const characterBytes = Buffer.byteLength(character, "utf8");
|
|
234323
|
-
if (bytes + characterBytes > maxUtf8Bytes &&
|
|
234324
|
-
chunks.push(
|
|
234325
|
-
|
|
234388
|
+
if (bytes + characterBytes > maxUtf8Bytes && chunk2) {
|
|
234389
|
+
chunks.push(chunk2);
|
|
234390
|
+
chunk2 = "";
|
|
234326
234391
|
bytes = 0;
|
|
234327
234392
|
}
|
|
234328
|
-
|
|
234393
|
+
chunk2 += character;
|
|
234329
234394
|
bytes += characterBytes;
|
|
234330
234395
|
}
|
|
234331
|
-
if (
|
|
234396
|
+
if (chunk2) chunks.push(chunk2);
|
|
234332
234397
|
return chunks;
|
|
234333
234398
|
}
|
|
234334
234399
|
var ProjectChatNotFoundError = class extends Error {
|
|
@@ -236541,8 +236606,9 @@ var WorkflowEngine = class {
|
|
|
236541
236606
|
return run2;
|
|
236542
236607
|
}
|
|
236543
236608
|
let scope = null;
|
|
236609
|
+
let endSnap = null;
|
|
236544
236610
|
try {
|
|
236545
|
-
|
|
236611
|
+
endSnap = captureSnapshot(worktreePath);
|
|
236546
236612
|
const startSnap = await resolveStartSnapshot(
|
|
236547
236613
|
this.storage,
|
|
236548
236614
|
opts.sourceSessionId,
|
|
@@ -236561,7 +236627,9 @@ var WorkflowEngine = class {
|
|
|
236561
236627
|
false,
|
|
236562
236628
|
"plan",
|
|
236563
236629
|
opts.reviewerAgentType ?? "claude-code",
|
|
236564
|
-
true
|
|
236630
|
+
true,
|
|
236631
|
+
false,
|
|
236632
|
+
{ startSnapshot: endSnap }
|
|
236565
236633
|
);
|
|
236566
236634
|
const taskContext = extractTaskContextBefore(entries, turnEndIndex);
|
|
236567
236635
|
await this.agentOps.setFinalSessionTitle(
|
|
@@ -240425,8 +240493,8 @@ function computeBranchMergeStatus(repoPath, branch, target) {
|
|
|
240425
240493
|
const missing = !branchTip ? branch : target;
|
|
240426
240494
|
throw Object.assign(new Error(`Branch not found: ${missing}`), { statusCode: 400 });
|
|
240427
240495
|
}
|
|
240428
|
-
const
|
|
240429
|
-
const cached2 = statusCache.get(
|
|
240496
|
+
const cacheKey2 = `${repoPath}\0${branch}\0${target}`;
|
|
240497
|
+
const cached2 = statusCache.get(cacheKey2);
|
|
240430
240498
|
if (cached2 && cached2.branchTip === branchTip && cached2.targetTip === targetTip) {
|
|
240431
240499
|
return { status: cached2.status, unmergedCount: cached2.unmergedCount };
|
|
240432
240500
|
}
|
|
@@ -240448,7 +240516,7 @@ function computeBranchMergeStatus(repoPath, branch, target) {
|
|
|
240448
240516
|
unmergedCount = 0;
|
|
240449
240517
|
}
|
|
240450
240518
|
}
|
|
240451
|
-
statusCache.set(
|
|
240519
|
+
statusCache.set(cacheKey2, { branchTip, targetTip, status, unmergedCount });
|
|
240452
240520
|
return { status, unmergedCount };
|
|
240453
240521
|
}
|
|
240454
240522
|
function isDirty2(worktreePath) {
|
|
@@ -241592,8 +241660,355 @@ async function writePasteToTempFile(content) {
|
|
|
241592
241660
|
return { path: filePath, size: Buffer.byteLength(content, "utf8") };
|
|
241593
241661
|
}
|
|
241594
241662
|
|
|
241663
|
+
// src/utils/review-brief.ts
|
|
241664
|
+
import { createHash as createHash5 } from "crypto";
|
|
241665
|
+
var BASE_TIMEOUT_MS = 15e3;
|
|
241666
|
+
var JUDGMENT_TIMEOUT_MS = 9e4;
|
|
241667
|
+
var TIMEOUT_MS_PER_1K_CHARS = 120;
|
|
241668
|
+
var MAX_TIMEOUT_MS = 6e4;
|
|
241669
|
+
var PER_MESSAGE_MAX_CHARS = 6e3;
|
|
241670
|
+
var COMPACT_TRIGGER_CHARS = 12e4;
|
|
241671
|
+
var COMPACT_SLICE_BUDGETS = [96e3, 24e3, 6e3];
|
|
241672
|
+
var RECENT_VERBATIM_RATIO = 0.3;
|
|
241673
|
+
var MIN_RECENT_VERBATIM_CHARS = 2e3;
|
|
241674
|
+
var MAX_FOLD_CALLS = 8;
|
|
241675
|
+
var COMPACT_SUMMARY_MAX_CHARS = 6e3;
|
|
241676
|
+
var COMPACT_SUMMARY_MAX_TOKENS = 3e3;
|
|
241677
|
+
var REVERSALS_MAX_CHARS = 2e3;
|
|
241678
|
+
var REVERSALS_MAX_TOKENS = 2e3;
|
|
241679
|
+
var BRIEF_MAX_CHARS = 4e3;
|
|
241680
|
+
var BRIEF_MAX_TOKENS = 3e3;
|
|
241681
|
+
var REVERSAL_MIN_CHARS = 6e3;
|
|
241682
|
+
var SEP = "\n\n";
|
|
241683
|
+
var COMPACTION_NOTE = "_Note: the source conversation was compressed before distillation \u2014 older turns were summarized rather than read verbatim._";
|
|
241684
|
+
var BRIEF_TRUNCATION_NOTE = "\n\n_[brief truncated at the length limit \u2014 treat it as incomplete]_";
|
|
241685
|
+
var SYSTEM_PROMPT2 = [
|
|
241686
|
+
"You distill a coding-agent conversation into an intent brief for an independent code reviewer.",
|
|
241687
|
+
"The reviewer will NOT see the conversation \u2014 only your brief plus the actual code, so capture what the code alone cannot show:",
|
|
241688
|
+
"0. Dominant question \u2014 1 or 2 sentences: the single question the reviewer must answer to judge this work (what must actually work, toward what goal). Derive it from the conversation's own emphasis \u2014 what the user repeated, finally decided, or reversed course over \u2014 never from your own engineering judgment. If the conversation does not clearly support one, write 'unclear' instead of inventing one.",
|
|
241689
|
+
"1. The original request and its goal.",
|
|
241690
|
+
"2. Hard constraints \u2014 requirements whose violation the user would treat as failure regardless of everything else (security, data loss, an explicit compatibility or behaviour promise). Only list ones the user actually stated; an empty section is fine.",
|
|
241691
|
+
"3. Constraints and decisions, including approaches that were rejected and why. A rejection counts whether the user made it or the agent made it under a principle the user set.",
|
|
241692
|
+
"4. Non-goals, trade-offs and limitations that were acknowledged and accepted.",
|
|
241693
|
+
"5. Behaviour established by actually running something \u2014 observed output, exit codes, error text, which stream an error arrived on. Report what was observed; that is evidence the reviewer cannot recover by reading code.",
|
|
241694
|
+
"Tag every item under headings 3 and 4 with exactly [settled] or [tentative] \u2014 the bare tag; keep any justification to a few words or omit it, always after the tag, never inside the brackets. Settled ONLY when the user explicitly confirmed it, instructed it, or reversed course to it; an agent proposal the user never answered is tentative \u2014 silence is never settled.",
|
|
241695
|
+
"Within each heading, order items by how much they matter to the dominant question, not by when they were said.",
|
|
241696
|
+
"Later statements supersede earlier ones on the same topic. An option explored at length early is often rejected later in a single sentence, and the rejection wins. Where the conversation ends in a decision table or summary, that is authoritative wherever it conflicts with earlier prose.",
|
|
241697
|
+
"The input may arrive as numbered compressed slices followed by verbatim recent turns. Slice numbers are chronological: a later slice overrules an earlier one.",
|
|
241698
|
+
"Decisions the agent made that the user did not contradict are worth reporting, but user silence only ever yields tentative status.",
|
|
241699
|
+
"Do NOT include the agent's self-assessment or any claim that the work is correct or complete \u2014 the reviewer must judge that independently.",
|
|
241700
|
+
"Every statement must trace to something in the conversation. If a heading has nothing real to report, say so rather than inventing plausible-sounding content.",
|
|
241701
|
+
"Write concise markdown bullets under those numbered headings, under 500 words total, in the same language as the conversation. Reply with the brief only."
|
|
241702
|
+
].join("\n");
|
|
241703
|
+
var REVERSAL_SYSTEM_PROMPT = [
|
|
241704
|
+
"You read a coding-agent conversation and report ONLY the conclusions that were later reversed, dropped, or replaced.",
|
|
241705
|
+
"A design conversation converges by killing its own hypotheses: an option explored in depth early is often rejected later in one sentence, so weigh finality over how much was written.",
|
|
241706
|
+
"A reversal counts whether the user or the agent made it. Ignore rewording that leaves the decision intact.",
|
|
241707
|
+
"Output one line per reversal: SUPERSEDED: <what was concluded earlier> -> <what replaced it> (<why>)",
|
|
241708
|
+
"Report the most decisive reversals first and stay under 200 words \u2014 a list that runs long will be discarded whole, so prioritise rather than pad.",
|
|
241709
|
+
"If nothing was reversed, reply with exactly: NONE"
|
|
241710
|
+
].join("\n");
|
|
241711
|
+
var COMPACT_SYSTEM_PROMPT = [
|
|
241712
|
+
"You compress one slice of a coding-agent conversation. A later pass will distill the whole thing into an intent brief for a code reviewer.",
|
|
241713
|
+
"You are told which slice of how many this is. Other slices are compressed separately and you cannot see them, so never present a conclusion here as final \u2014 a later slice may overturn it.",
|
|
241714
|
+
"Preserve, in this order of priority:",
|
|
241715
|
+
"1. Reversals and corrections \u2014 any conclusion that was dropped, replaced, or corrected. Quote the deciding sentence verbatim.",
|
|
241716
|
+
"2. Constraints and decisions the user stated, and approaches that were rejected, with the reason. Preserve who made each decision \u2014 an explicit user confirmation must stay distinguishable from an agent proposal the user never answered; quote the user's deciding sentence when there is one.",
|
|
241717
|
+
"3. Behaviour established by actually running something: observed output, exit codes, error text, which stream an error arrived on.",
|
|
241718
|
+
"4. Trade-offs that were acknowledged and accepted.",
|
|
241719
|
+
"Drop: exploration narrative, restated background, tool mechanics, and anything a reviewer could recover by reading the code.",
|
|
241720
|
+
"Stay under 800 words. An over-long slice is discarded whole rather than cut short, so drop lower-priority material instead of running over.",
|
|
241721
|
+
"Keep the conversation's own language. Reply with the compressed slice only, no preamble."
|
|
241722
|
+
].join("\n");
|
|
241723
|
+
function timeoutForInput(chars) {
|
|
241724
|
+
return Math.min(MAX_TIMEOUT_MS, BASE_TIMEOUT_MS + Math.floor(chars / 1e3) * TIMEOUT_MS_PER_1K_CHARS);
|
|
241725
|
+
}
|
|
241726
|
+
function isSizeRelatedFailure(error48) {
|
|
241727
|
+
const err = error48;
|
|
241728
|
+
if (err?.name === "AbortError" || err?.name === "TimeoutError") return true;
|
|
241729
|
+
const message = err?.message ?? "";
|
|
241730
|
+
return /context[ _-]?length|maximum context|too many tokens|token limit|prompt is too long|request too large|timed? ?out/i.test(
|
|
241731
|
+
message
|
|
241732
|
+
);
|
|
241733
|
+
}
|
|
241734
|
+
function withinLimit(text2, max, label) {
|
|
241735
|
+
if (text2.length <= max) return true;
|
|
241736
|
+
console.warn(`[ReviewBrief] ${label} ran to ${text2.length} chars (limit ${max}) \u2014 discarding rather than truncating`);
|
|
241737
|
+
return false;
|
|
241738
|
+
}
|
|
241739
|
+
function capMessage(text2) {
|
|
241740
|
+
return text2.length > PER_MESSAGE_MAX_CHARS ? text2.slice(0, PER_MESSAGE_MAX_CHARS) + "\u2026" : text2;
|
|
241741
|
+
}
|
|
241742
|
+
function toEntries(messages) {
|
|
241743
|
+
const entries = [];
|
|
241744
|
+
for (const msg of messages) {
|
|
241745
|
+
if (!msg) continue;
|
|
241746
|
+
if (msg.type === "user" && !msg.event) {
|
|
241747
|
+
const text2 = extractUserText(msg.content).trim();
|
|
241748
|
+
if (text2) entries.push({ role: "User", text: capMessage(text2) });
|
|
241749
|
+
} else if (msg.type === "assistant" && typeof msg.content === "string") {
|
|
241750
|
+
const text2 = msg.content.trim();
|
|
241751
|
+
if (text2) entries.push({ role: "Agent", text: capMessage(text2) });
|
|
241752
|
+
}
|
|
241753
|
+
}
|
|
241754
|
+
return entries;
|
|
241755
|
+
}
|
|
241756
|
+
function render(entry) {
|
|
241757
|
+
return `${entry.role}: ${entry.text}`;
|
|
241758
|
+
}
|
|
241759
|
+
function renderAll(entries) {
|
|
241760
|
+
return entries.map(render).join(SEP);
|
|
241761
|
+
}
|
|
241762
|
+
function serializeConversationForBrief(messages) {
|
|
241763
|
+
return renderAll(toEntries(messages));
|
|
241764
|
+
}
|
|
241765
|
+
function projectMessagesForBrief(messages) {
|
|
241766
|
+
return toEntries(messages).map(
|
|
241767
|
+
(entry) => entry.role === "User" ? { type: "user", content: entry.text, timestamp: 0 } : { type: "assistant", content: entry.text, timestamp: 0 }
|
|
241768
|
+
);
|
|
241769
|
+
}
|
|
241770
|
+
function splitRecent(entries, maxChars) {
|
|
241771
|
+
let size = 0;
|
|
241772
|
+
let i = entries.length;
|
|
241773
|
+
while (i > 0) {
|
|
241774
|
+
const len = render(entries[i - 1]).length + SEP.length;
|
|
241775
|
+
if (size + len > maxChars) break;
|
|
241776
|
+
size += len;
|
|
241777
|
+
i--;
|
|
241778
|
+
}
|
|
241779
|
+
return { older: entries.slice(0, i), recent: entries.slice(i) };
|
|
241780
|
+
}
|
|
241781
|
+
function chunkEntries(entries, maxChars) {
|
|
241782
|
+
const chunks = [];
|
|
241783
|
+
let current = [];
|
|
241784
|
+
let size = 0;
|
|
241785
|
+
for (const entry of entries) {
|
|
241786
|
+
const len = render(entry).length + SEP.length;
|
|
241787
|
+
if (current.length > 0 && size + len > maxChars) {
|
|
241788
|
+
chunks.push(current);
|
|
241789
|
+
current = [];
|
|
241790
|
+
size = 0;
|
|
241791
|
+
}
|
|
241792
|
+
current.push(entry);
|
|
241793
|
+
size += len;
|
|
241794
|
+
}
|
|
241795
|
+
if (current.length > 0) chunks.push(current);
|
|
241796
|
+
return chunks;
|
|
241797
|
+
}
|
|
241798
|
+
function telemetryFor(functionId, userId) {
|
|
241799
|
+
return userId ? {
|
|
241800
|
+
isEnabled: true,
|
|
241801
|
+
functionId,
|
|
241802
|
+
metadata: { userId, tags: ["vibedeckx", functionId] }
|
|
241803
|
+
} : void 0;
|
|
241804
|
+
}
|
|
241805
|
+
async function compactChunk(model, chunk2, part, total, userId) {
|
|
241806
|
+
try {
|
|
241807
|
+
const result = await generateText({
|
|
241808
|
+
model,
|
|
241809
|
+
system: COMPACT_SYSTEM_PROMPT,
|
|
241810
|
+
prompt: `Slice ${part} of ${total}.
|
|
241811
|
+
|
|
241812
|
+
${chunk2}`,
|
|
241813
|
+
timeout: timeoutForInput(chunk2.length),
|
|
241814
|
+
maxOutputTokens: COMPACT_SUMMARY_MAX_TOKENS,
|
|
241815
|
+
experimental_telemetry: telemetryFor("review-intent-brief-compact", userId)
|
|
241816
|
+
});
|
|
241817
|
+
const { text: rawText, finishReason } = result;
|
|
241818
|
+
if (finishReason === "length") {
|
|
241819
|
+
console.warn(`[ReviewBrief] slice ${part}/${total} summary hit the token cap \u2014 discarding`);
|
|
241820
|
+
return null;
|
|
241821
|
+
}
|
|
241822
|
+
const text2 = (rawText ?? "").trim();
|
|
241823
|
+
if (text2.length === 0) {
|
|
241824
|
+
console.warn(`[ReviewBrief] slice ${part}/${total} came back empty (finishReason: ${finishReason ?? "unknown"})`);
|
|
241825
|
+
return null;
|
|
241826
|
+
}
|
|
241827
|
+
return withinLimit(text2, COMPACT_SUMMARY_MAX_CHARS, `slice ${part}/${total} summary`) ? text2 : null;
|
|
241828
|
+
} catch (error48) {
|
|
241829
|
+
if (isSizeRelatedFailure(error48)) throw error48;
|
|
241830
|
+
console.warn(`[ReviewBrief] compaction of slice ${part}/${total} failed:`, error48.message);
|
|
241831
|
+
return null;
|
|
241832
|
+
}
|
|
241833
|
+
}
|
|
241834
|
+
async function compactConversation(model, messages, options = {}) {
|
|
241835
|
+
const sliceChars = options.sliceChars ?? COMPACT_SLICE_BUDGETS[0];
|
|
241836
|
+
const recentChars = Math.max(MIN_RECENT_VERBATIM_CHARS, Math.floor(sliceChars * RECENT_VERBATIM_RATIO));
|
|
241837
|
+
const entries = toEntries(messages);
|
|
241838
|
+
if (entries.length === 0) return null;
|
|
241839
|
+
const { older, recent } = splitRecent(entries, recentChars);
|
|
241840
|
+
if (older.length === 0) return null;
|
|
241841
|
+
const chunks = chunkEntries(older, sliceChars);
|
|
241842
|
+
if (chunks.length > MAX_FOLD_CALLS) {
|
|
241843
|
+
console.warn(
|
|
241844
|
+
`[ReviewBrief] conversation needs ${chunks.length} slices of ${sliceChars} chars (max ${MAX_FOLD_CALLS}) \u2014 falling back to tier 2`
|
|
241845
|
+
);
|
|
241846
|
+
return null;
|
|
241847
|
+
}
|
|
241848
|
+
const settled = await Promise.allSettled(
|
|
241849
|
+
chunks.map((chunk2, i) => compactChunk(model, renderAll(chunk2), i + 1, chunks.length, options.userId))
|
|
241850
|
+
);
|
|
241851
|
+
const sizeRejection = settled.find((r) => r.status === "rejected" && isSizeRelatedFailure(r.reason));
|
|
241852
|
+
if (sizeRejection) throw sizeRejection.reason;
|
|
241853
|
+
if (settled.some((r) => r.status === "rejected" || r.value === null)) return null;
|
|
241854
|
+
const parts = settled.map(
|
|
241855
|
+
(r, i) => `[Compressed slice ${i + 1} of ${chunks.length}]
|
|
241856
|
+
${r.value}`
|
|
241857
|
+
);
|
|
241858
|
+
if (recent.length > 0) parts.push(`[Recent turns, verbatim]
|
|
241859
|
+
${renderAll(recent)}`);
|
|
241860
|
+
return parts.join(SEP);
|
|
241861
|
+
}
|
|
241862
|
+
function buildBriefPrompt(conversation, reversals) {
|
|
241863
|
+
const preamble = reversals ? "Conclusions this conversation reversed. The right-hand side is the current state \u2014 never report the left-hand side as what was decided:\n" + reversals + SEP : "";
|
|
241864
|
+
return `${preamble}Distill this conversation into an intent brief:
|
|
241865
|
+
|
|
241866
|
+
${conversation}`;
|
|
241867
|
+
}
|
|
241868
|
+
function appendCompactionNote(brief, compacted) {
|
|
241869
|
+
return compacted ? `${brief}${SEP}${COMPACTION_NOTE}` : brief;
|
|
241870
|
+
}
|
|
241871
|
+
async function extractReversalsWithModel(model, conversation, options = {}) {
|
|
241872
|
+
if (conversation.trim().length < REVERSAL_MIN_CHARS) return null;
|
|
241873
|
+
try {
|
|
241874
|
+
const result = await generateText({
|
|
241875
|
+
model,
|
|
241876
|
+
system: REVERSAL_SYSTEM_PROMPT,
|
|
241877
|
+
prompt: `Report the reversals in this conversation:
|
|
241878
|
+
|
|
241879
|
+
${conversation}`,
|
|
241880
|
+
timeout: JUDGMENT_TIMEOUT_MS,
|
|
241881
|
+
maxOutputTokens: REVERSALS_MAX_TOKENS,
|
|
241882
|
+
experimental_telemetry: telemetryFor("review-intent-brief-reversals", options.userId)
|
|
241883
|
+
});
|
|
241884
|
+
const { text: rawText, finishReason } = result;
|
|
241885
|
+
if (finishReason === "length") {
|
|
241886
|
+
console.warn("[ReviewBrief] reversal list hit the token cap \u2014 discarding");
|
|
241887
|
+
return null;
|
|
241888
|
+
}
|
|
241889
|
+
const text2 = (rawText ?? "").trim();
|
|
241890
|
+
if (text2.length === 0 || /^none\b/i.test(text2)) return null;
|
|
241891
|
+
return withinLimit(text2, REVERSALS_MAX_CHARS, "reversal list") ? text2 : null;
|
|
241892
|
+
} catch (error48) {
|
|
241893
|
+
if (!isSizeRelatedFailure(error48)) throw error48;
|
|
241894
|
+
console.warn("[ReviewBrief] reversal pass hit a size limit \u2014 skipping it:", error48.message);
|
|
241895
|
+
return null;
|
|
241896
|
+
}
|
|
241897
|
+
}
|
|
241898
|
+
async function generateIntentBriefWithModel(model, conversation, options = {}) {
|
|
241899
|
+
if (conversation.trim().length === 0) return null;
|
|
241900
|
+
try {
|
|
241901
|
+
const result = await generateText({
|
|
241902
|
+
model,
|
|
241903
|
+
system: SYSTEM_PROMPT2,
|
|
241904
|
+
prompt: buildBriefPrompt(conversation, options.reversals ?? null),
|
|
241905
|
+
timeout: JUDGMENT_TIMEOUT_MS,
|
|
241906
|
+
maxOutputTokens: BRIEF_MAX_TOKENS,
|
|
241907
|
+
experimental_telemetry: telemetryFor("review-intent-brief", options.userId)
|
|
241908
|
+
});
|
|
241909
|
+
const { text: rawText, finishReason } = result;
|
|
241910
|
+
const text2 = (rawText ?? "").trim();
|
|
241911
|
+
if (text2.length === 0) {
|
|
241912
|
+
console.warn(`[ReviewBrief] model returned empty text (finishReason: ${finishReason ?? "unknown"})`);
|
|
241913
|
+
return null;
|
|
241914
|
+
}
|
|
241915
|
+
if (finishReason === "length") return text2.slice(0, BRIEF_MAX_CHARS) + BRIEF_TRUNCATION_NOTE;
|
|
241916
|
+
return text2.length <= BRIEF_MAX_CHARS ? text2 : text2.slice(0, BRIEF_MAX_CHARS) + BRIEF_TRUNCATION_NOTE;
|
|
241917
|
+
} catch (error48) {
|
|
241918
|
+
if (options.rethrowSizeFailures && isSizeRelatedFailure(error48)) throw error48;
|
|
241919
|
+
console.warn("[ReviewBrief] AI generation failed:", error48.message);
|
|
241920
|
+
return null;
|
|
241921
|
+
}
|
|
241922
|
+
}
|
|
241923
|
+
async function distill(model, conversation, userId, rethrowSizeFailures) {
|
|
241924
|
+
const reversals = await extractReversalsWithModel(model, conversation, { userId });
|
|
241925
|
+
return generateIntentBriefWithModel(model, conversation, { userId, reversals, rethrowSizeFailures });
|
|
241926
|
+
}
|
|
241927
|
+
var BRIEF_CACHE_TTL_MS = 30 * 6e4;
|
|
241928
|
+
var BRIEF_CACHE_MAX_ENTRIES = 50;
|
|
241929
|
+
var briefCache = /* @__PURE__ */ new Map();
|
|
241930
|
+
var briefInFlight = /* @__PURE__ */ new Map();
|
|
241931
|
+
function cacheKey(userId, conversation) {
|
|
241932
|
+
return createHash5("sha256").update(userId).update("\0").update(conversation).digest("hex");
|
|
241933
|
+
}
|
|
241934
|
+
function readBriefCache(key) {
|
|
241935
|
+
const hit = briefCache.get(key);
|
|
241936
|
+
if (!hit) return null;
|
|
241937
|
+
if (Date.now() - hit.at > BRIEF_CACHE_TTL_MS) {
|
|
241938
|
+
briefCache.delete(key);
|
|
241939
|
+
return null;
|
|
241940
|
+
}
|
|
241941
|
+
return hit.brief;
|
|
241942
|
+
}
|
|
241943
|
+
function writeBriefCache(key, brief) {
|
|
241944
|
+
briefCache.set(key, { brief, at: Date.now() });
|
|
241945
|
+
while (briefCache.size > BRIEF_CACHE_MAX_ENTRIES) {
|
|
241946
|
+
const oldest = briefCache.keys().next();
|
|
241947
|
+
if (oldest.done) break;
|
|
241948
|
+
briefCache.delete(oldest.value);
|
|
241949
|
+
}
|
|
241950
|
+
}
|
|
241951
|
+
async function generateIntentBrief(storage, userId, messages) {
|
|
241952
|
+
let conversation;
|
|
241953
|
+
let mainOk;
|
|
241954
|
+
let fastOk;
|
|
241955
|
+
try {
|
|
241956
|
+
const config2 = await getChatProviderConfig(storage, userId);
|
|
241957
|
+
mainOk = isModelConfigured(config2, config2.main);
|
|
241958
|
+
fastOk = isModelConfigured(config2, config2.fast);
|
|
241959
|
+
if (!mainOk && !fastOk) return null;
|
|
241960
|
+
conversation = serializeConversationForBrief(messages);
|
|
241961
|
+
if (!conversation) return null;
|
|
241962
|
+
} catch (error48) {
|
|
241963
|
+
console.warn("[ReviewBrief] generation failed:", error48.message);
|
|
241964
|
+
return null;
|
|
241965
|
+
}
|
|
241966
|
+
const key = cacheKey(userId, conversation);
|
|
241967
|
+
const cached2 = readBriefCache(key);
|
|
241968
|
+
if (cached2 !== null) return cached2;
|
|
241969
|
+
const pending = briefInFlight.get(key);
|
|
241970
|
+
if (pending) return pending;
|
|
241971
|
+
const run2 = distillConversation(storage, userId, messages, conversation, mainOk, fastOk).then((brief) => {
|
|
241972
|
+
if (brief !== null) writeBriefCache(key, brief);
|
|
241973
|
+
return brief;
|
|
241974
|
+
}).finally(() => briefInFlight.delete(key));
|
|
241975
|
+
briefInFlight.set(key, run2);
|
|
241976
|
+
return run2;
|
|
241977
|
+
}
|
|
241978
|
+
async function distillConversation(storage, userId, messages, conversation, mainOk, fastOk) {
|
|
241979
|
+
try {
|
|
241980
|
+
const distillModel = mainOk ? await resolveChatModel(storage, userId) : await resolveFastChatModel(storage, userId);
|
|
241981
|
+
const compactModel = fastOk ? await resolveFastChatModel(storage, userId) : distillModel;
|
|
241982
|
+
if (conversation.length <= COMPACT_TRIGGER_CHARS) {
|
|
241983
|
+
try {
|
|
241984
|
+
const brief = await distill(distillModel, conversation, userId, true);
|
|
241985
|
+
return brief === null ? null : appendCompactionNote(brief, false);
|
|
241986
|
+
} catch (error48) {
|
|
241987
|
+
if (!isSizeRelatedFailure(error48)) throw error48;
|
|
241988
|
+
console.warn("[ReviewBrief] full conversation rejected as too large \u2014 compacting and retrying");
|
|
241989
|
+
}
|
|
241990
|
+
}
|
|
241991
|
+
for (const sliceChars of COMPACT_SLICE_BUDGETS) {
|
|
241992
|
+
try {
|
|
241993
|
+
const compacted = await compactConversation(compactModel, messages, { userId, sliceChars });
|
|
241994
|
+
if (compacted === null) return null;
|
|
241995
|
+
const brief = await distill(distillModel, compacted, userId, true);
|
|
241996
|
+
return brief === null ? null : appendCompactionNote(brief, true);
|
|
241997
|
+
} catch (error48) {
|
|
241998
|
+
if (!isSizeRelatedFailure(error48)) throw error48;
|
|
241999
|
+
console.warn(`[ReviewBrief] ${sliceChars}-char slices still too large \u2014 retrying smaller`);
|
|
242000
|
+
}
|
|
242001
|
+
}
|
|
242002
|
+
console.warn("[ReviewBrief] could not compact the conversation small enough \u2014 falling back to tier 2");
|
|
242003
|
+
return null;
|
|
242004
|
+
} catch (error48) {
|
|
242005
|
+
console.warn("[ReviewBrief] generation failed:", error48.message);
|
|
242006
|
+
return null;
|
|
242007
|
+
}
|
|
242008
|
+
}
|
|
242009
|
+
|
|
241595
242010
|
// src/routes/agent-session-routes.ts
|
|
241596
|
-
import { createHash as
|
|
242011
|
+
import { createHash as createHash6, randomUUID as randomUUID15 } from "crypto";
|
|
241597
242012
|
|
|
241598
242013
|
// src/protocol/model-suggestions.ts
|
|
241599
242014
|
var MODEL_SUGGESTIONS = {
|
|
@@ -241639,7 +242054,7 @@ var routes12 = async (fastify2) => {
|
|
|
241639
242054
|
}
|
|
241640
242055
|
function instructionContentHash(content) {
|
|
241641
242056
|
const canonical = typeof content === "string" ? JSON.stringify({ type: "string", content }) : JSON.stringify(content.map((part) => part.type === "text" ? { type: "text", text: part.text } : { type: "image", mediaType: part.mediaType, data: part.data }));
|
|
241642
|
-
return
|
|
242057
|
+
return createHash6("sha256").update(canonical).digest("hex");
|
|
241643
242058
|
}
|
|
241644
242059
|
function proxyAuto(remoteServerId, method, apiPath, body) {
|
|
241645
242060
|
return proxyToRemoteAuto(remoteServerId, method, apiPath, body, {
|
|
@@ -242269,6 +242684,16 @@ var routes12 = async (fastify2) => {
|
|
|
242269
242684
|
});
|
|
242270
242685
|
}
|
|
242271
242686
|
);
|
|
242687
|
+
fastify2.get(
|
|
242688
|
+
"/api/agent-sessions/:sessionId/brief-source",
|
|
242689
|
+
async (req, reply) => {
|
|
242690
|
+
const session = fastify2.agentSessionManager.getSession(req.params.sessionId);
|
|
242691
|
+
if (!session) return reply.code(404).send({ error: "Session not found" });
|
|
242692
|
+
return reply.code(200).send({
|
|
242693
|
+
messages: projectMessagesForBrief(fastify2.agentSessionManager.getMessages(req.params.sessionId))
|
|
242694
|
+
});
|
|
242695
|
+
}
|
|
242696
|
+
);
|
|
242272
242697
|
fastify2.post("/api/agent-sessions/:sessionId/message", { bodyLimit: 10 * 1024 * 1024 }, async (req, reply) => {
|
|
242273
242698
|
const authResult = requireUserFacingUserId(req, reply);
|
|
242274
242699
|
if (authResult === null) return;
|
|
@@ -243407,7 +243832,7 @@ var chat_session_routes_default = (0, import_fastify_plugin16.default)(routes15,
|
|
|
243407
243832
|
|
|
243408
243833
|
// src/routes/project-chat-routes.ts
|
|
243409
243834
|
var import_fastify_plugin17 = __toESM(require_plugin2(), 1);
|
|
243410
|
-
import { createHash as
|
|
243835
|
+
import { createHash as createHash7, randomUUID as randomUUID16 } from "crypto";
|
|
243411
243836
|
var MAX_TITLE_LENGTH = 200;
|
|
243412
243837
|
var MAX_MESSAGE_LENGTH = 1e5;
|
|
243413
243838
|
var THREAD_PAGE_LIMIT = 50;
|
|
@@ -243576,7 +244001,7 @@ var routes16 = async (fastify2) => {
|
|
|
243576
244001
|
const body = parseCreateBody(req.body);
|
|
243577
244002
|
if (!body) return reply.code(400).send({ error: "Body must contain only an optional non-empty message" });
|
|
243578
244003
|
const createRequestId = body.createRequestId ?? randomUUID16();
|
|
243579
|
-
const createPayloadHash =
|
|
244004
|
+
const createPayloadHash = createHash7("sha256").update(JSON.stringify({ message: body.message ?? null })).digest("hex");
|
|
243580
244005
|
let accepted;
|
|
243581
244006
|
try {
|
|
243582
244007
|
accepted = await fastify2.storage.projectChatThreads.createIdempotent({
|
|
@@ -244209,304 +244634,6 @@ var command_routes_default = (0, import_fastify_plugin21.default)(routes20, { na
|
|
|
244209
244634
|
|
|
244210
244635
|
// src/routes/workflow-run-routes.ts
|
|
244211
244636
|
var import_fastify_plugin22 = __toESM(require_plugin2(), 1);
|
|
244212
|
-
|
|
244213
|
-
// src/utils/review-brief.ts
|
|
244214
|
-
var BASE_TIMEOUT_MS = 15e3;
|
|
244215
|
-
var JUDGMENT_TIMEOUT_MS = 9e4;
|
|
244216
|
-
var TIMEOUT_MS_PER_1K_CHARS = 120;
|
|
244217
|
-
var MAX_TIMEOUT_MS = 6e4;
|
|
244218
|
-
var PER_MESSAGE_MAX_CHARS = 6e3;
|
|
244219
|
-
var COMPACT_TRIGGER_CHARS = 12e4;
|
|
244220
|
-
var COMPACT_SLICE_BUDGETS = [96e3, 24e3, 6e3];
|
|
244221
|
-
var RECENT_VERBATIM_RATIO = 0.3;
|
|
244222
|
-
var MIN_RECENT_VERBATIM_CHARS = 2e3;
|
|
244223
|
-
var MAX_FOLD_CALLS = 8;
|
|
244224
|
-
var COMPACT_SUMMARY_MAX_CHARS = 6e3;
|
|
244225
|
-
var COMPACT_SUMMARY_MAX_TOKENS = 3e3;
|
|
244226
|
-
var REVERSALS_MAX_CHARS = 2e3;
|
|
244227
|
-
var REVERSALS_MAX_TOKENS = 2e3;
|
|
244228
|
-
var BRIEF_MAX_CHARS = 4e3;
|
|
244229
|
-
var BRIEF_MAX_TOKENS = 3e3;
|
|
244230
|
-
var REVERSAL_MIN_CHARS = 6e3;
|
|
244231
|
-
var SEP = "\n\n";
|
|
244232
|
-
var COMPACTION_NOTE = "_Note: the source conversation was compressed before distillation \u2014 older turns were summarized rather than read verbatim._";
|
|
244233
|
-
var BRIEF_TRUNCATION_NOTE = "\n\n_[brief truncated at the length limit \u2014 treat it as incomplete]_";
|
|
244234
|
-
var SYSTEM_PROMPT2 = [
|
|
244235
|
-
"You distill a coding-agent conversation into an intent brief for an independent code reviewer.",
|
|
244236
|
-
"The reviewer will NOT see the conversation \u2014 only your brief plus the actual code, so capture what the code alone cannot show:",
|
|
244237
|
-
"0. Dominant question \u2014 1 or 2 sentences: the single question the reviewer must answer to judge this work (what must actually work, toward what goal). Derive it from the conversation's own emphasis \u2014 what the user repeated, finally decided, or reversed course over \u2014 never from your own engineering judgment. If the conversation does not clearly support one, write 'unclear' instead of inventing one.",
|
|
244238
|
-
"1. The original request and its goal.",
|
|
244239
|
-
"2. Hard constraints \u2014 requirements whose violation the user would treat as failure regardless of everything else (security, data loss, an explicit compatibility or behaviour promise). Only list ones the user actually stated; an empty section is fine.",
|
|
244240
|
-
"3. Constraints and decisions, including approaches that were rejected and why. A rejection counts whether the user made it or the agent made it under a principle the user set.",
|
|
244241
|
-
"4. Non-goals, trade-offs and limitations that were acknowledged and accepted.",
|
|
244242
|
-
"5. Behaviour established by actually running something \u2014 observed output, exit codes, error text, which stream an error arrived on. Report what was observed; that is evidence the reviewer cannot recover by reading code.",
|
|
244243
|
-
"Tag every item under headings 3 and 4 with exactly [settled] or [tentative] \u2014 the bare tag; keep any justification to a few words or omit it, always after the tag, never inside the brackets. Settled ONLY when the user explicitly confirmed it, instructed it, or reversed course to it; an agent proposal the user never answered is tentative \u2014 silence is never settled.",
|
|
244244
|
-
"Within each heading, order items by how much they matter to the dominant question, not by when they were said.",
|
|
244245
|
-
"Later statements supersede earlier ones on the same topic. An option explored at length early is often rejected later in a single sentence, and the rejection wins. Where the conversation ends in a decision table or summary, that is authoritative wherever it conflicts with earlier prose.",
|
|
244246
|
-
"The input may arrive as numbered compressed slices followed by verbatim recent turns. Slice numbers are chronological: a later slice overrules an earlier one.",
|
|
244247
|
-
"Decisions the agent made that the user did not contradict are worth reporting, but user silence only ever yields tentative status.",
|
|
244248
|
-
"Do NOT include the agent's self-assessment or any claim that the work is correct or complete \u2014 the reviewer must judge that independently.",
|
|
244249
|
-
"Every statement must trace to something in the conversation. If a heading has nothing real to report, say so rather than inventing plausible-sounding content.",
|
|
244250
|
-
"Write concise markdown bullets under those numbered headings, under 500 words total, in the same language as the conversation. Reply with the brief only."
|
|
244251
|
-
].join("\n");
|
|
244252
|
-
var REVERSAL_SYSTEM_PROMPT = [
|
|
244253
|
-
"You read a coding-agent conversation and report ONLY the conclusions that were later reversed, dropped, or replaced.",
|
|
244254
|
-
"A design conversation converges by killing its own hypotheses: an option explored in depth early is often rejected later in one sentence, so weigh finality over how much was written.",
|
|
244255
|
-
"A reversal counts whether the user or the agent made it. Ignore rewording that leaves the decision intact.",
|
|
244256
|
-
"Output one line per reversal: SUPERSEDED: <what was concluded earlier> -> <what replaced it> (<why>)",
|
|
244257
|
-
"Report the most decisive reversals first and stay under 200 words \u2014 a list that runs long will be discarded whole, so prioritise rather than pad.",
|
|
244258
|
-
"If nothing was reversed, reply with exactly: NONE"
|
|
244259
|
-
].join("\n");
|
|
244260
|
-
var COMPACT_SYSTEM_PROMPT = [
|
|
244261
|
-
"You compress one slice of a coding-agent conversation. A later pass will distill the whole thing into an intent brief for a code reviewer.",
|
|
244262
|
-
"You are told which slice of how many this is. Other slices are compressed separately and you cannot see them, so never present a conclusion here as final \u2014 a later slice may overturn it.",
|
|
244263
|
-
"Preserve, in this order of priority:",
|
|
244264
|
-
"1. Reversals and corrections \u2014 any conclusion that was dropped, replaced, or corrected. Quote the deciding sentence verbatim.",
|
|
244265
|
-
"2. Constraints and decisions the user stated, and approaches that were rejected, with the reason. Preserve who made each decision \u2014 an explicit user confirmation must stay distinguishable from an agent proposal the user never answered; quote the user's deciding sentence when there is one.",
|
|
244266
|
-
"3. Behaviour established by actually running something: observed output, exit codes, error text, which stream an error arrived on.",
|
|
244267
|
-
"4. Trade-offs that were acknowledged and accepted.",
|
|
244268
|
-
"Drop: exploration narrative, restated background, tool mechanics, and anything a reviewer could recover by reading the code.",
|
|
244269
|
-
"Stay under 800 words. An over-long slice is discarded whole rather than cut short, so drop lower-priority material instead of running over.",
|
|
244270
|
-
"Keep the conversation's own language. Reply with the compressed slice only, no preamble."
|
|
244271
|
-
].join("\n");
|
|
244272
|
-
function timeoutForInput(chars) {
|
|
244273
|
-
return Math.min(MAX_TIMEOUT_MS, BASE_TIMEOUT_MS + Math.floor(chars / 1e3) * TIMEOUT_MS_PER_1K_CHARS);
|
|
244274
|
-
}
|
|
244275
|
-
function isSizeRelatedFailure(error48) {
|
|
244276
|
-
const err = error48;
|
|
244277
|
-
if (err?.name === "AbortError" || err?.name === "TimeoutError") return true;
|
|
244278
|
-
const message = err?.message ?? "";
|
|
244279
|
-
return /context[ _-]?length|maximum context|too many tokens|token limit|prompt is too long|request too large|timed? ?out/i.test(
|
|
244280
|
-
message
|
|
244281
|
-
);
|
|
244282
|
-
}
|
|
244283
|
-
function withinLimit(text2, max, label) {
|
|
244284
|
-
if (text2.length <= max) return true;
|
|
244285
|
-
console.warn(`[ReviewBrief] ${label} ran to ${text2.length} chars (limit ${max}) \u2014 discarding rather than truncating`);
|
|
244286
|
-
return false;
|
|
244287
|
-
}
|
|
244288
|
-
function capMessage(text2) {
|
|
244289
|
-
return text2.length > PER_MESSAGE_MAX_CHARS ? text2.slice(0, PER_MESSAGE_MAX_CHARS) + "\u2026" : text2;
|
|
244290
|
-
}
|
|
244291
|
-
function toEntries(messages) {
|
|
244292
|
-
const entries = [];
|
|
244293
|
-
for (const msg of messages) {
|
|
244294
|
-
if (!msg) continue;
|
|
244295
|
-
if (msg.type === "user" && !msg.event) {
|
|
244296
|
-
const text2 = extractUserText(msg.content).trim();
|
|
244297
|
-
if (text2) entries.push({ role: "User", text: capMessage(text2) });
|
|
244298
|
-
} else if (msg.type === "assistant" && typeof msg.content === "string") {
|
|
244299
|
-
const text2 = msg.content.trim();
|
|
244300
|
-
if (text2) entries.push({ role: "Agent", text: capMessage(text2) });
|
|
244301
|
-
}
|
|
244302
|
-
}
|
|
244303
|
-
return entries;
|
|
244304
|
-
}
|
|
244305
|
-
function render(entry) {
|
|
244306
|
-
return `${entry.role}: ${entry.text}`;
|
|
244307
|
-
}
|
|
244308
|
-
function renderAll(entries) {
|
|
244309
|
-
return entries.map(render).join(SEP);
|
|
244310
|
-
}
|
|
244311
|
-
function serializeConversationForBrief(messages) {
|
|
244312
|
-
return renderAll(toEntries(messages));
|
|
244313
|
-
}
|
|
244314
|
-
function splitRecent(entries, maxChars) {
|
|
244315
|
-
let size = 0;
|
|
244316
|
-
let i = entries.length;
|
|
244317
|
-
while (i > 0) {
|
|
244318
|
-
const len = render(entries[i - 1]).length + SEP.length;
|
|
244319
|
-
if (size + len > maxChars) break;
|
|
244320
|
-
size += len;
|
|
244321
|
-
i--;
|
|
244322
|
-
}
|
|
244323
|
-
return { older: entries.slice(0, i), recent: entries.slice(i) };
|
|
244324
|
-
}
|
|
244325
|
-
function chunkEntries(entries, maxChars) {
|
|
244326
|
-
const chunks = [];
|
|
244327
|
-
let current = [];
|
|
244328
|
-
let size = 0;
|
|
244329
|
-
for (const entry of entries) {
|
|
244330
|
-
const len = render(entry).length + SEP.length;
|
|
244331
|
-
if (current.length > 0 && size + len > maxChars) {
|
|
244332
|
-
chunks.push(current);
|
|
244333
|
-
current = [];
|
|
244334
|
-
size = 0;
|
|
244335
|
-
}
|
|
244336
|
-
current.push(entry);
|
|
244337
|
-
size += len;
|
|
244338
|
-
}
|
|
244339
|
-
if (current.length > 0) chunks.push(current);
|
|
244340
|
-
return chunks;
|
|
244341
|
-
}
|
|
244342
|
-
function telemetryFor(functionId, userId) {
|
|
244343
|
-
return userId ? {
|
|
244344
|
-
isEnabled: true,
|
|
244345
|
-
functionId,
|
|
244346
|
-
metadata: { userId, tags: ["vibedeckx", functionId] }
|
|
244347
|
-
} : void 0;
|
|
244348
|
-
}
|
|
244349
|
-
async function compactChunk(model, chunk, part, total, userId) {
|
|
244350
|
-
try {
|
|
244351
|
-
const result = await generateText({
|
|
244352
|
-
model,
|
|
244353
|
-
system: COMPACT_SYSTEM_PROMPT,
|
|
244354
|
-
prompt: `Slice ${part} of ${total}.
|
|
244355
|
-
|
|
244356
|
-
${chunk}`,
|
|
244357
|
-
timeout: timeoutForInput(chunk.length),
|
|
244358
|
-
maxOutputTokens: COMPACT_SUMMARY_MAX_TOKENS,
|
|
244359
|
-
experimental_telemetry: telemetryFor("review-intent-brief-compact", userId)
|
|
244360
|
-
});
|
|
244361
|
-
const { text: rawText, finishReason } = result;
|
|
244362
|
-
if (finishReason === "length") {
|
|
244363
|
-
console.warn(`[ReviewBrief] slice ${part}/${total} summary hit the token cap \u2014 discarding`);
|
|
244364
|
-
return null;
|
|
244365
|
-
}
|
|
244366
|
-
const text2 = (rawText ?? "").trim();
|
|
244367
|
-
if (text2.length === 0) {
|
|
244368
|
-
console.warn(`[ReviewBrief] slice ${part}/${total} came back empty (finishReason: ${finishReason ?? "unknown"})`);
|
|
244369
|
-
return null;
|
|
244370
|
-
}
|
|
244371
|
-
return withinLimit(text2, COMPACT_SUMMARY_MAX_CHARS, `slice ${part}/${total} summary`) ? text2 : null;
|
|
244372
|
-
} catch (error48) {
|
|
244373
|
-
if (isSizeRelatedFailure(error48)) throw error48;
|
|
244374
|
-
console.warn(`[ReviewBrief] compaction of slice ${part}/${total} failed:`, error48.message);
|
|
244375
|
-
return null;
|
|
244376
|
-
}
|
|
244377
|
-
}
|
|
244378
|
-
async function compactConversation(model, messages, options = {}) {
|
|
244379
|
-
const sliceChars = options.sliceChars ?? COMPACT_SLICE_BUDGETS[0];
|
|
244380
|
-
const recentChars = Math.max(MIN_RECENT_VERBATIM_CHARS, Math.floor(sliceChars * RECENT_VERBATIM_RATIO));
|
|
244381
|
-
const entries = toEntries(messages);
|
|
244382
|
-
if (entries.length === 0) return null;
|
|
244383
|
-
const { older, recent } = splitRecent(entries, recentChars);
|
|
244384
|
-
if (older.length === 0) return null;
|
|
244385
|
-
const chunks = chunkEntries(older, sliceChars);
|
|
244386
|
-
if (chunks.length > MAX_FOLD_CALLS) {
|
|
244387
|
-
console.warn(
|
|
244388
|
-
`[ReviewBrief] conversation needs ${chunks.length} slices of ${sliceChars} chars (max ${MAX_FOLD_CALLS}) \u2014 falling back to tier 2`
|
|
244389
|
-
);
|
|
244390
|
-
return null;
|
|
244391
|
-
}
|
|
244392
|
-
const settled = await Promise.allSettled(
|
|
244393
|
-
chunks.map((chunk, i) => compactChunk(model, renderAll(chunk), i + 1, chunks.length, options.userId))
|
|
244394
|
-
);
|
|
244395
|
-
const sizeRejection = settled.find((r) => r.status === "rejected" && isSizeRelatedFailure(r.reason));
|
|
244396
|
-
if (sizeRejection) throw sizeRejection.reason;
|
|
244397
|
-
if (settled.some((r) => r.status === "rejected" || r.value === null)) return null;
|
|
244398
|
-
const parts = settled.map(
|
|
244399
|
-
(r, i) => `[Compressed slice ${i + 1} of ${chunks.length}]
|
|
244400
|
-
${r.value}`
|
|
244401
|
-
);
|
|
244402
|
-
if (recent.length > 0) parts.push(`[Recent turns, verbatim]
|
|
244403
|
-
${renderAll(recent)}`);
|
|
244404
|
-
return parts.join(SEP);
|
|
244405
|
-
}
|
|
244406
|
-
function buildBriefPrompt(conversation, reversals) {
|
|
244407
|
-
const preamble = reversals ? "Conclusions this conversation reversed. The right-hand side is the current state \u2014 never report the left-hand side as what was decided:\n" + reversals + SEP : "";
|
|
244408
|
-
return `${preamble}Distill this conversation into an intent brief:
|
|
244409
|
-
|
|
244410
|
-
${conversation}`;
|
|
244411
|
-
}
|
|
244412
|
-
function appendCompactionNote(brief, compacted) {
|
|
244413
|
-
return compacted ? `${brief}${SEP}${COMPACTION_NOTE}` : brief;
|
|
244414
|
-
}
|
|
244415
|
-
async function extractReversalsWithModel(model, conversation, options = {}) {
|
|
244416
|
-
if (conversation.trim().length < REVERSAL_MIN_CHARS) return null;
|
|
244417
|
-
try {
|
|
244418
|
-
const result = await generateText({
|
|
244419
|
-
model,
|
|
244420
|
-
system: REVERSAL_SYSTEM_PROMPT,
|
|
244421
|
-
prompt: `Report the reversals in this conversation:
|
|
244422
|
-
|
|
244423
|
-
${conversation}`,
|
|
244424
|
-
timeout: JUDGMENT_TIMEOUT_MS,
|
|
244425
|
-
maxOutputTokens: REVERSALS_MAX_TOKENS,
|
|
244426
|
-
experimental_telemetry: telemetryFor("review-intent-brief-reversals", options.userId)
|
|
244427
|
-
});
|
|
244428
|
-
const { text: rawText, finishReason } = result;
|
|
244429
|
-
if (finishReason === "length") {
|
|
244430
|
-
console.warn("[ReviewBrief] reversal list hit the token cap \u2014 discarding");
|
|
244431
|
-
return null;
|
|
244432
|
-
}
|
|
244433
|
-
const text2 = (rawText ?? "").trim();
|
|
244434
|
-
if (text2.length === 0 || /^none\b/i.test(text2)) return null;
|
|
244435
|
-
return withinLimit(text2, REVERSALS_MAX_CHARS, "reversal list") ? text2 : null;
|
|
244436
|
-
} catch (error48) {
|
|
244437
|
-
if (!isSizeRelatedFailure(error48)) throw error48;
|
|
244438
|
-
console.warn("[ReviewBrief] reversal pass hit a size limit \u2014 skipping it:", error48.message);
|
|
244439
|
-
return null;
|
|
244440
|
-
}
|
|
244441
|
-
}
|
|
244442
|
-
async function generateIntentBriefWithModel(model, conversation, options = {}) {
|
|
244443
|
-
if (conversation.trim().length === 0) return null;
|
|
244444
|
-
try {
|
|
244445
|
-
const result = await generateText({
|
|
244446
|
-
model,
|
|
244447
|
-
system: SYSTEM_PROMPT2,
|
|
244448
|
-
prompt: buildBriefPrompt(conversation, options.reversals ?? null),
|
|
244449
|
-
timeout: JUDGMENT_TIMEOUT_MS,
|
|
244450
|
-
maxOutputTokens: BRIEF_MAX_TOKENS,
|
|
244451
|
-
experimental_telemetry: telemetryFor("review-intent-brief", options.userId)
|
|
244452
|
-
});
|
|
244453
|
-
const { text: rawText, finishReason } = result;
|
|
244454
|
-
const text2 = (rawText ?? "").trim();
|
|
244455
|
-
if (text2.length === 0) {
|
|
244456
|
-
console.warn(`[ReviewBrief] model returned empty text (finishReason: ${finishReason ?? "unknown"})`);
|
|
244457
|
-
return null;
|
|
244458
|
-
}
|
|
244459
|
-
if (finishReason === "length") return text2.slice(0, BRIEF_MAX_CHARS) + BRIEF_TRUNCATION_NOTE;
|
|
244460
|
-
return text2.length <= BRIEF_MAX_CHARS ? text2 : text2.slice(0, BRIEF_MAX_CHARS) + BRIEF_TRUNCATION_NOTE;
|
|
244461
|
-
} catch (error48) {
|
|
244462
|
-
if (options.rethrowSizeFailures && isSizeRelatedFailure(error48)) throw error48;
|
|
244463
|
-
console.warn("[ReviewBrief] AI generation failed:", error48.message);
|
|
244464
|
-
return null;
|
|
244465
|
-
}
|
|
244466
|
-
}
|
|
244467
|
-
async function distill(model, conversation, userId, rethrowSizeFailures) {
|
|
244468
|
-
const reversals = await extractReversalsWithModel(model, conversation, { userId });
|
|
244469
|
-
return generateIntentBriefWithModel(model, conversation, { userId, reversals, rethrowSizeFailures });
|
|
244470
|
-
}
|
|
244471
|
-
async function generateIntentBrief(storage, userId, messages) {
|
|
244472
|
-
try {
|
|
244473
|
-
const config2 = await getChatProviderConfig(storage, userId);
|
|
244474
|
-
const mainOk = isModelConfigured(config2, config2.main);
|
|
244475
|
-
const fastOk = isModelConfigured(config2, config2.fast);
|
|
244476
|
-
if (!mainOk && !fastOk) return null;
|
|
244477
|
-
const conversation = serializeConversationForBrief(messages);
|
|
244478
|
-
if (!conversation) return null;
|
|
244479
|
-
const distillModel = mainOk ? await resolveChatModel(storage, userId) : await resolveFastChatModel(storage, userId);
|
|
244480
|
-
const compactModel = fastOk ? await resolveFastChatModel(storage, userId) : distillModel;
|
|
244481
|
-
if (conversation.length <= COMPACT_TRIGGER_CHARS) {
|
|
244482
|
-
try {
|
|
244483
|
-
const brief = await distill(distillModel, conversation, userId, true);
|
|
244484
|
-
return brief === null ? null : appendCompactionNote(brief, false);
|
|
244485
|
-
} catch (error48) {
|
|
244486
|
-
if (!isSizeRelatedFailure(error48)) throw error48;
|
|
244487
|
-
console.warn("[ReviewBrief] full conversation rejected as too large \u2014 compacting and retrying");
|
|
244488
|
-
}
|
|
244489
|
-
}
|
|
244490
|
-
for (const sliceChars of COMPACT_SLICE_BUDGETS) {
|
|
244491
|
-
try {
|
|
244492
|
-
const compacted = await compactConversation(compactModel, messages, { userId, sliceChars });
|
|
244493
|
-
if (compacted === null) return null;
|
|
244494
|
-
const brief = await distill(distillModel, compacted, userId, true);
|
|
244495
|
-
return brief === null ? null : appendCompactionNote(brief, true);
|
|
244496
|
-
} catch (error48) {
|
|
244497
|
-
if (!isSizeRelatedFailure(error48)) throw error48;
|
|
244498
|
-
console.warn(`[ReviewBrief] ${sliceChars}-char slices still too large \u2014 retrying smaller`);
|
|
244499
|
-
}
|
|
244500
|
-
}
|
|
244501
|
-
console.warn("[ReviewBrief] could not compact the conversation small enough \u2014 falling back to tier 2");
|
|
244502
|
-
return null;
|
|
244503
|
-
} catch (error48) {
|
|
244504
|
-
console.warn("[ReviewBrief] generation failed:", error48.message);
|
|
244505
|
-
return null;
|
|
244506
|
-
}
|
|
244507
|
-
}
|
|
244508
|
-
|
|
244509
|
-
// src/routes/workflow-run-routes.ts
|
|
244510
244637
|
function parseReviewerAgentType(raw) {
|
|
244511
244638
|
if (raw === void 0) return void 0;
|
|
244512
244639
|
return typeof raw === "string" && REVIEWER_AGENT_TYPES.has(raw) ? raw : null;
|
|
@@ -244569,7 +244696,7 @@ async function routes21(fastify2) {
|
|
|
244569
244696
|
const historyResult = await proxyAuto(
|
|
244570
244697
|
remoteInfo,
|
|
244571
244698
|
"GET",
|
|
244572
|
-
`/api/agent-sessions/${remoteInfo.remoteSessionId}`
|
|
244699
|
+
`/api/agent-sessions/${remoteInfo.remoteSessionId}/brief-source`
|
|
244573
244700
|
);
|
|
244574
244701
|
if (!historyResult.ok) return void 0;
|
|
244575
244702
|
messages = historyResult.data.messages ?? [];
|
|
@@ -246140,7 +246267,7 @@ var websocket_routes_default = (0, import_fastify_plugin25.default)(routes24, {
|
|
|
246140
246267
|
|
|
246141
246268
|
// src/routes/reverse-connect-routes.ts
|
|
246142
246269
|
var import_fastify_plugin26 = __toESM(require_plugin2(), 1);
|
|
246143
|
-
import { randomBytes as randomBytes2, createHash as
|
|
246270
|
+
import { randomBytes as randomBytes2, createHash as createHash8, verify as cryptoVerify } from "crypto";
|
|
246144
246271
|
|
|
246145
246272
|
// src/utils/rate-limited-warn.ts
|
|
246146
246273
|
function createRateLimitedWarn(windowMs, maxKeys) {
|
|
@@ -246290,7 +246417,7 @@ var routes25 = async (fastify2) => {
|
|
|
246290
246417
|
socket.close(4003, "Bad machine signature");
|
|
246291
246418
|
return;
|
|
246292
246419
|
}
|
|
246293
|
-
const fingerprint =
|
|
246420
|
+
const fingerprint = createHash8("sha256").update(publicKey).digest("hex");
|
|
246294
246421
|
const { owned, created } = await fastify2.storage.machineIdentity.claimOrVerify(fingerprint, publicKey, ownerId);
|
|
246295
246422
|
if (!owned) {
|
|
246296
246423
|
console.warn(`[ReverseConnect] Machine ${fingerprint.slice(0, 12)} owner mismatch \u2014 rejecting ${serverId}`);
|
|
@@ -248786,8 +248913,8 @@ var RotatingFileStream = class extends Writable {
|
|
|
248786
248913
|
_final(callback) {
|
|
248787
248914
|
this.refinal(void 0, callback);
|
|
248788
248915
|
}
|
|
248789
|
-
_write(
|
|
248790
|
-
this.rewrite([{ chunk, encoding }], 0, callback);
|
|
248916
|
+
_write(chunk2, encoding, callback) {
|
|
248917
|
+
this.rewrite([{ chunk: chunk2, encoding }], 0, callback);
|
|
248791
248918
|
}
|
|
248792
248919
|
_writev(chunks, callback) {
|
|
248793
248920
|
this.rewrite(chunks, 0, callback);
|
|
@@ -248811,13 +248938,13 @@ var RotatingFileStream = class extends Writable {
|
|
|
248811
248938
|
if (this.initPromise)
|
|
248812
248939
|
await this.initPromise;
|
|
248813
248940
|
for (let i = 0; i < chunks.length; ++i) {
|
|
248814
|
-
const { chunk } = chunks[i];
|
|
248815
|
-
this.size +=
|
|
248941
|
+
const { chunk: chunk2 } = chunks[i];
|
|
248942
|
+
this.size += chunk2.length;
|
|
248816
248943
|
if (this.timeoutPromise)
|
|
248817
248944
|
await this.timeoutPromise;
|
|
248818
|
-
await this.file.write(
|
|
248945
|
+
await this.file.write(chunk2);
|
|
248819
248946
|
if (teeToStdout && !this.stdout.destroyed)
|
|
248820
|
-
this.stdout.write(
|
|
248947
|
+
this.stdout.write(chunk2);
|
|
248821
248948
|
if (size && this.size >= size)
|
|
248822
248949
|
await this.rotate();
|
|
248823
248950
|
}
|
|
@@ -249838,6 +249965,9 @@ var WORKER_CAPABILITIES = {
|
|
|
249838
249965
|
"http:POST /api/path/agent-sessions": { since: "0.2.0", summary: "\u521B\u5EFA\u4F1A\u8BDD" },
|
|
249839
249966
|
"http:POST /api/path/agent-sessions/new": { since: "0.2.0", summary: "\u521B\u5EFA\u4F1A\u8BDD(\u6307\u5B9A ID)" },
|
|
249840
249967
|
"http:GET /api/agent-sessions/:param": { since: "0.2.0", summary: "\u8BFB\u4F1A\u8BDD\u8BE6\u60C5/\u5BF9\u8BDD" },
|
|
249968
|
+
// Additive: a worker below 0.3.6 404s it and the hub's intent-brief
|
|
249969
|
+
// distillation degrades to the deterministic excerpt (tier 2).
|
|
249970
|
+
"http:GET /api/agent-sessions/:param/brief-source": { since: "0.3.6", summary: "\u8BFB\u4F1A\u8BDD\u5BF9\u8BDD(\u4EC5\u84B8\u998F\u7528\u6587\u672C)" },
|
|
249841
249971
|
"http:POST /api/agent-sessions/:param/message": { since: "0.2.0", summary: "\u53D1\u6D88\u606F\u7ED9\u4F1A\u8BDD" },
|
|
249842
249972
|
"http:POST /api/agent-sessions/:param/paste": { since: "0.2.0", summary: "\u7C98\u8D34\u56FE\u7247/\u957F\u6587\u672C" },
|
|
249843
249973
|
"http:POST /api/agent-sessions/:param/stop": { since: "0.2.0", summary: "\u505C\u6B62\u4F1A\u8BDD turn" },
|