@skillrecordings/cli 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1521 -686
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -424,8 +424,8 @@ var require_url_state_machine = __commonJS({
|
|
|
424
424
|
function countSymbols(str2) {
|
|
425
425
|
return punycode.ucs2.decode(str2).length;
|
|
426
426
|
}
|
|
427
|
-
function at(
|
|
428
|
-
const c =
|
|
427
|
+
function at(input3, idx) {
|
|
428
|
+
const c = input3[idx];
|
|
429
429
|
return isNaN(c) ? void 0 : String.fromCodePoint(c);
|
|
430
430
|
}
|
|
431
431
|
function isASCIIDigit(c) {
|
|
@@ -487,16 +487,16 @@ var require_url_state_machine = __commonJS({
|
|
|
487
487
|
return str2;
|
|
488
488
|
}
|
|
489
489
|
function utf8PercentDecode(str2) {
|
|
490
|
-
const
|
|
490
|
+
const input3 = new Buffer(str2);
|
|
491
491
|
const output = [];
|
|
492
|
-
for (let i = 0; i <
|
|
493
|
-
if (
|
|
494
|
-
output.push(
|
|
495
|
-
} else if (
|
|
496
|
-
output.push(parseInt(
|
|
492
|
+
for (let i = 0; i < input3.length; ++i) {
|
|
493
|
+
if (input3[i] !== 37) {
|
|
494
|
+
output.push(input3[i]);
|
|
495
|
+
} else if (input3[i] === 37 && isASCIIHex(input3[i + 1]) && isASCIIHex(input3[i + 2])) {
|
|
496
|
+
output.push(parseInt(input3.slice(i + 1, i + 3).toString(), 16));
|
|
497
497
|
i += 2;
|
|
498
498
|
} else {
|
|
499
|
-
output.push(
|
|
499
|
+
output.push(input3[i]);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
return new Buffer(output).toString();
|
|
@@ -519,42 +519,42 @@ var require_url_state_machine = __commonJS({
|
|
|
519
519
|
}
|
|
520
520
|
return cStr;
|
|
521
521
|
}
|
|
522
|
-
function parseIPv4Number(
|
|
522
|
+
function parseIPv4Number(input3) {
|
|
523
523
|
let R = 10;
|
|
524
|
-
if (
|
|
525
|
-
|
|
524
|
+
if (input3.length >= 2 && input3.charAt(0) === "0" && input3.charAt(1).toLowerCase() === "x") {
|
|
525
|
+
input3 = input3.substring(2);
|
|
526
526
|
R = 16;
|
|
527
|
-
} else if (
|
|
528
|
-
|
|
527
|
+
} else if (input3.length >= 2 && input3.charAt(0) === "0") {
|
|
528
|
+
input3 = input3.substring(1);
|
|
529
529
|
R = 8;
|
|
530
530
|
}
|
|
531
|
-
if (
|
|
531
|
+
if (input3 === "") {
|
|
532
532
|
return 0;
|
|
533
533
|
}
|
|
534
534
|
const regex = R === 10 ? /[^0-9]/ : R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/;
|
|
535
|
-
if (regex.test(
|
|
535
|
+
if (regex.test(input3)) {
|
|
536
536
|
return failure;
|
|
537
537
|
}
|
|
538
|
-
return parseInt(
|
|
538
|
+
return parseInt(input3, R);
|
|
539
539
|
}
|
|
540
|
-
function parseIPv4(
|
|
541
|
-
const parts =
|
|
540
|
+
function parseIPv4(input3) {
|
|
541
|
+
const parts = input3.split(".");
|
|
542
542
|
if (parts[parts.length - 1] === "") {
|
|
543
543
|
if (parts.length > 1) {
|
|
544
544
|
parts.pop();
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
if (parts.length > 4) {
|
|
548
|
-
return
|
|
548
|
+
return input3;
|
|
549
549
|
}
|
|
550
550
|
const numbers = [];
|
|
551
551
|
for (const part of parts) {
|
|
552
552
|
if (part === "") {
|
|
553
|
-
return
|
|
553
|
+
return input3;
|
|
554
554
|
}
|
|
555
555
|
const n = parseIPv4Number(part);
|
|
556
556
|
if (n === failure) {
|
|
557
|
-
return
|
|
557
|
+
return input3;
|
|
558
558
|
}
|
|
559
559
|
numbers.push(n);
|
|
560
560
|
}
|
|
@@ -586,25 +586,25 @@ var require_url_state_machine = __commonJS({
|
|
|
586
586
|
}
|
|
587
587
|
return output;
|
|
588
588
|
}
|
|
589
|
-
function parseIPv6(
|
|
589
|
+
function parseIPv6(input3) {
|
|
590
590
|
const address = [0, 0, 0, 0, 0, 0, 0, 0];
|
|
591
591
|
let pieceIndex = 0;
|
|
592
592
|
let compress = null;
|
|
593
593
|
let pointer = 0;
|
|
594
|
-
|
|
595
|
-
if (
|
|
596
|
-
if (
|
|
594
|
+
input3 = punycode.ucs2.decode(input3);
|
|
595
|
+
if (input3[pointer] === 58) {
|
|
596
|
+
if (input3[pointer + 1] !== 58) {
|
|
597
597
|
return failure;
|
|
598
598
|
}
|
|
599
599
|
pointer += 2;
|
|
600
600
|
++pieceIndex;
|
|
601
601
|
compress = pieceIndex;
|
|
602
602
|
}
|
|
603
|
-
while (pointer <
|
|
603
|
+
while (pointer < input3.length) {
|
|
604
604
|
if (pieceIndex === 8) {
|
|
605
605
|
return failure;
|
|
606
606
|
}
|
|
607
|
-
if (
|
|
607
|
+
if (input3[pointer] === 58) {
|
|
608
608
|
if (compress !== null) {
|
|
609
609
|
return failure;
|
|
610
610
|
}
|
|
@@ -615,12 +615,12 @@ var require_url_state_machine = __commonJS({
|
|
|
615
615
|
}
|
|
616
616
|
let value = 0;
|
|
617
617
|
let length = 0;
|
|
618
|
-
while (length < 4 && isASCIIHex(
|
|
619
|
-
value = value * 16 + parseInt(at(
|
|
618
|
+
while (length < 4 && isASCIIHex(input3[pointer])) {
|
|
619
|
+
value = value * 16 + parseInt(at(input3, pointer), 16);
|
|
620
620
|
++pointer;
|
|
621
621
|
++length;
|
|
622
622
|
}
|
|
623
|
-
if (
|
|
623
|
+
if (input3[pointer] === 46) {
|
|
624
624
|
if (length === 0) {
|
|
625
625
|
return failure;
|
|
626
626
|
}
|
|
@@ -629,20 +629,20 @@ var require_url_state_machine = __commonJS({
|
|
|
629
629
|
return failure;
|
|
630
630
|
}
|
|
631
631
|
let numbersSeen = 0;
|
|
632
|
-
while (
|
|
632
|
+
while (input3[pointer] !== void 0) {
|
|
633
633
|
let ipv4Piece = null;
|
|
634
634
|
if (numbersSeen > 0) {
|
|
635
|
-
if (
|
|
635
|
+
if (input3[pointer] === 46 && numbersSeen < 4) {
|
|
636
636
|
++pointer;
|
|
637
637
|
} else {
|
|
638
638
|
return failure;
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
-
if (!isASCIIDigit(
|
|
641
|
+
if (!isASCIIDigit(input3[pointer])) {
|
|
642
642
|
return failure;
|
|
643
643
|
}
|
|
644
|
-
while (isASCIIDigit(
|
|
645
|
-
const number = parseInt(at(
|
|
644
|
+
while (isASCIIDigit(input3[pointer])) {
|
|
645
|
+
const number = parseInt(at(input3, pointer));
|
|
646
646
|
if (ipv4Piece === null) {
|
|
647
647
|
ipv4Piece = number;
|
|
648
648
|
} else if (ipv4Piece === 0) {
|
|
@@ -665,12 +665,12 @@ var require_url_state_machine = __commonJS({
|
|
|
665
665
|
return failure;
|
|
666
666
|
}
|
|
667
667
|
break;
|
|
668
|
-
} else if (
|
|
668
|
+
} else if (input3[pointer] === 58) {
|
|
669
669
|
++pointer;
|
|
670
|
-
if (
|
|
670
|
+
if (input3[pointer] === void 0) {
|
|
671
671
|
return failure;
|
|
672
672
|
}
|
|
673
|
-
} else if (
|
|
673
|
+
} else if (input3[pointer] !== void 0) {
|
|
674
674
|
return failure;
|
|
675
675
|
}
|
|
676
676
|
address[pieceIndex] = value;
|
|
@@ -715,17 +715,17 @@ var require_url_state_machine = __commonJS({
|
|
|
715
715
|
}
|
|
716
716
|
return output;
|
|
717
717
|
}
|
|
718
|
-
function parseHost(
|
|
719
|
-
if (
|
|
720
|
-
if (
|
|
718
|
+
function parseHost(input3, isSpecialArg) {
|
|
719
|
+
if (input3[0] === "[") {
|
|
720
|
+
if (input3[input3.length - 1] !== "]") {
|
|
721
721
|
return failure;
|
|
722
722
|
}
|
|
723
|
-
return parseIPv6(
|
|
723
|
+
return parseIPv6(input3.substring(1, input3.length - 1));
|
|
724
724
|
}
|
|
725
725
|
if (!isSpecialArg) {
|
|
726
|
-
return parseOpaqueHost(
|
|
726
|
+
return parseOpaqueHost(input3);
|
|
727
727
|
}
|
|
728
|
-
const domain = utf8PercentDecode(
|
|
728
|
+
const domain = utf8PercentDecode(input3);
|
|
729
729
|
const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false);
|
|
730
730
|
if (asciiDomain === null) {
|
|
731
731
|
return failure;
|
|
@@ -739,12 +739,12 @@ var require_url_state_machine = __commonJS({
|
|
|
739
739
|
}
|
|
740
740
|
return asciiDomain;
|
|
741
741
|
}
|
|
742
|
-
function parseOpaqueHost(
|
|
743
|
-
if (containsForbiddenHostCodePointExcludingPercent(
|
|
742
|
+
function parseOpaqueHost(input3) {
|
|
743
|
+
if (containsForbiddenHostCodePointExcludingPercent(input3)) {
|
|
744
744
|
return failure;
|
|
745
745
|
}
|
|
746
746
|
let output = "";
|
|
747
|
-
const decoded = punycode.ucs2.decode(
|
|
747
|
+
const decoded = punycode.ucs2.decode(input3);
|
|
748
748
|
for (let i = 0; i < decoded.length; ++i) {
|
|
749
749
|
output += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
|
|
750
750
|
}
|
|
@@ -813,9 +813,9 @@ var require_url_state_machine = __commonJS({
|
|
|
813
813
|
function isNormalizedWindowsDriveLetter(string) {
|
|
814
814
|
return /^[A-Za-z]:$/.test(string);
|
|
815
815
|
}
|
|
816
|
-
function URLStateMachine(
|
|
816
|
+
function URLStateMachine(input3, base, encodingOverride, url, stateOverride) {
|
|
817
817
|
this.pointer = 0;
|
|
818
|
-
this.input =
|
|
818
|
+
this.input = input3;
|
|
819
819
|
this.base = base || null;
|
|
820
820
|
this.encodingOverride = encodingOverride || "utf-8";
|
|
821
821
|
this.stateOverride = stateOverride;
|
|
@@ -1439,11 +1439,11 @@ var require_url_state_machine = __commonJS({
|
|
|
1439
1439
|
return "null";
|
|
1440
1440
|
}
|
|
1441
1441
|
};
|
|
1442
|
-
module.exports.basicURLParse = function(
|
|
1442
|
+
module.exports.basicURLParse = function(input3, options) {
|
|
1443
1443
|
if (options === void 0) {
|
|
1444
1444
|
options = {};
|
|
1445
1445
|
}
|
|
1446
|
-
const usm = new URLStateMachine(
|
|
1446
|
+
const usm = new URLStateMachine(input3, options.baseURL, options.encodingOverride, options.url, options.stateOverride);
|
|
1447
1447
|
if (usm.failure) {
|
|
1448
1448
|
return "failure";
|
|
1449
1449
|
}
|
|
@@ -1456,9 +1456,9 @@ var require_url_state_machine = __commonJS({
|
|
|
1456
1456
|
url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode);
|
|
1457
1457
|
}
|
|
1458
1458
|
};
|
|
1459
|
-
module.exports.setThePassword = function(url,
|
|
1459
|
+
module.exports.setThePassword = function(url, password2) {
|
|
1460
1460
|
url.password = "";
|
|
1461
|
-
const decoded = punycode.ucs2.decode(
|
|
1461
|
+
const decoded = punycode.ucs2.decode(password2);
|
|
1462
1462
|
for (let i = 0; i < decoded.length; ++i) {
|
|
1463
1463
|
url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode);
|
|
1464
1464
|
}
|
|
@@ -1468,11 +1468,11 @@ var require_url_state_machine = __commonJS({
|
|
|
1468
1468
|
module.exports.serializeInteger = function(integer) {
|
|
1469
1469
|
return String(integer);
|
|
1470
1470
|
};
|
|
1471
|
-
module.exports.parseURL = function(
|
|
1471
|
+
module.exports.parseURL = function(input3, options) {
|
|
1472
1472
|
if (options === void 0) {
|
|
1473
1473
|
options = {};
|
|
1474
1474
|
}
|
|
1475
|
-
return module.exports.basicURLParse(
|
|
1475
|
+
return module.exports.basicURLParse(input3, { baseURL: options.baseURL, encodingOverride: options.encodingOverride });
|
|
1476
1476
|
};
|
|
1477
1477
|
}
|
|
1478
1478
|
});
|
|
@@ -1609,9 +1609,9 @@ var require_URL_impl = __commonJS({
|
|
|
1609
1609
|
url.query = null;
|
|
1610
1610
|
return;
|
|
1611
1611
|
}
|
|
1612
|
-
const
|
|
1612
|
+
const input3 = v[0] === "?" ? v.substring(1) : v;
|
|
1613
1613
|
url.query = "";
|
|
1614
|
-
usm.basicURLParse(
|
|
1614
|
+
usm.basicURLParse(input3, { url, stateOverride: "query" });
|
|
1615
1615
|
}
|
|
1616
1616
|
get hash() {
|
|
1617
1617
|
if (this._url.fragment === null || this._url.fragment === "") {
|
|
@@ -1624,9 +1624,9 @@ var require_URL_impl = __commonJS({
|
|
|
1624
1624
|
this._url.fragment = null;
|
|
1625
1625
|
return;
|
|
1626
1626
|
}
|
|
1627
|
-
const
|
|
1627
|
+
const input3 = v[0] === "#" ? v.substring(1) : v;
|
|
1628
1628
|
this._url.fragment = "";
|
|
1629
|
-
usm.basicURLParse(
|
|
1629
|
+
usm.basicURLParse(input3, { url: this._url, stateOverride: "fragment" });
|
|
1630
1630
|
}
|
|
1631
1631
|
toJSON() {
|
|
1632
1632
|
return this.href;
|
|
@@ -10860,23 +10860,23 @@ var require_infra = __commonJS({
|
|
|
10860
10860
|
init_esm_shims();
|
|
10861
10861
|
var assert = __require("assert");
|
|
10862
10862
|
var { utf8DecodeBytes } = require_encoding2();
|
|
10863
|
-
function collectASequenceOfCodePoints(condition,
|
|
10863
|
+
function collectASequenceOfCodePoints(condition, input3, position) {
|
|
10864
10864
|
let result = "";
|
|
10865
|
-
while (position.position <
|
|
10866
|
-
result +=
|
|
10865
|
+
while (position.position < input3.length && condition(input3[position.position])) {
|
|
10866
|
+
result += input3[position.position];
|
|
10867
10867
|
position.position++;
|
|
10868
10868
|
}
|
|
10869
10869
|
return result;
|
|
10870
10870
|
}
|
|
10871
|
-
function collectASequenceOfCodePointsFast(char,
|
|
10872
|
-
const idx =
|
|
10871
|
+
function collectASequenceOfCodePointsFast(char, input3, position) {
|
|
10872
|
+
const idx = input3.indexOf(char, position.position);
|
|
10873
10873
|
const start = position.position;
|
|
10874
10874
|
if (idx === -1) {
|
|
10875
|
-
position.position =
|
|
10876
|
-
return
|
|
10875
|
+
position.position = input3.length;
|
|
10876
|
+
return input3.slice(start);
|
|
10877
10877
|
}
|
|
10878
10878
|
position.position = idx;
|
|
10879
|
-
return
|
|
10879
|
+
return input3.slice(start, position.position);
|
|
10880
10880
|
}
|
|
10881
10881
|
var ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g;
|
|
10882
10882
|
function forgivingBase64(data2) {
|
|
@@ -10906,10 +10906,10 @@ var require_infra = __commonJS({
|
|
|
10906
10906
|
char === 13 || // \r
|
|
10907
10907
|
char === 32;
|
|
10908
10908
|
}
|
|
10909
|
-
function isomorphicDecode(
|
|
10910
|
-
const length =
|
|
10909
|
+
function isomorphicDecode(input3) {
|
|
10910
|
+
const length = input3.length;
|
|
10911
10911
|
if ((2 << 15) - 1 > length) {
|
|
10912
|
-
return String.fromCharCode.apply(null,
|
|
10912
|
+
return String.fromCharCode.apply(null, input3);
|
|
10913
10913
|
}
|
|
10914
10914
|
let result = "";
|
|
10915
10915
|
let i = 0;
|
|
@@ -10918,14 +10918,14 @@ var require_infra = __commonJS({
|
|
|
10918
10918
|
if (i + addition > length) {
|
|
10919
10919
|
addition = length - i;
|
|
10920
10920
|
}
|
|
10921
|
-
result += String.fromCharCode.apply(null,
|
|
10921
|
+
result += String.fromCharCode.apply(null, input3.subarray(i, i += addition));
|
|
10922
10922
|
}
|
|
10923
10923
|
return result;
|
|
10924
10924
|
}
|
|
10925
10925
|
var invalidIsomorphicEncodeValueRegex = /[^\x00-\xFF]/;
|
|
10926
|
-
function isomorphicEncode(
|
|
10927
|
-
assert(!invalidIsomorphicEncodeValueRegex.test(
|
|
10928
|
-
return
|
|
10926
|
+
function isomorphicEncode(input3) {
|
|
10927
|
+
assert(!invalidIsomorphicEncodeValueRegex.test(input3));
|
|
10928
|
+
return input3;
|
|
10929
10929
|
}
|
|
10930
10930
|
function parseJSONFromBytes(bytes) {
|
|
10931
10931
|
return JSON.parse(utf8DecodeBytes(bytes));
|
|
@@ -10980,21 +10980,21 @@ var require_data_url = __commonJS({
|
|
|
10980
10980
|
var HTTP_QUOTED_STRING_TOKENS = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/u;
|
|
10981
10981
|
function dataURLProcessor(dataURL) {
|
|
10982
10982
|
assert(dataURL.protocol === "data:");
|
|
10983
|
-
let
|
|
10984
|
-
|
|
10983
|
+
let input3 = URLSerializer(dataURL, true);
|
|
10984
|
+
input3 = input3.slice(5);
|
|
10985
10985
|
const position = { position: 0 };
|
|
10986
10986
|
let mimeType = collectASequenceOfCodePointsFast(
|
|
10987
10987
|
",",
|
|
10988
|
-
|
|
10988
|
+
input3,
|
|
10989
10989
|
position
|
|
10990
10990
|
);
|
|
10991
10991
|
const mimeTypeLength = mimeType.length;
|
|
10992
10992
|
mimeType = removeASCIIWhitespace(mimeType, true, true);
|
|
10993
|
-
if (position.position >=
|
|
10993
|
+
if (position.position >= input3.length) {
|
|
10994
10994
|
return "failure";
|
|
10995
10995
|
}
|
|
10996
10996
|
position.position++;
|
|
10997
|
-
const encodedBody =
|
|
10997
|
+
const encodedBody = input3.slice(mimeTypeLength + 1);
|
|
10998
10998
|
let body = stringPercentDecode(encodedBody);
|
|
10999
10999
|
if (/;(?:\u0020*)base64$/ui.test(mimeType)) {
|
|
11000
11000
|
const stringBody = isomorphicDecode(body);
|
|
@@ -11027,8 +11027,8 @@ var require_data_url = __commonJS({
|
|
|
11027
11027
|
}
|
|
11028
11028
|
return serialized;
|
|
11029
11029
|
}
|
|
11030
|
-
function stringPercentDecode(
|
|
11031
|
-
const bytes = encoder.encode(
|
|
11030
|
+
function stringPercentDecode(input3) {
|
|
11031
|
+
const bytes = encoder.encode(input3);
|
|
11032
11032
|
return percentDecode(bytes);
|
|
11033
11033
|
}
|
|
11034
11034
|
function isHexCharByte(byte) {
|
|
@@ -11040,43 +11040,43 @@ var require_data_url = __commonJS({
|
|
|
11040
11040
|
byte >= 48 && byte <= 57 ? byte - 48 : (byte & 223) - 55
|
|
11041
11041
|
);
|
|
11042
11042
|
}
|
|
11043
|
-
function percentDecode(
|
|
11044
|
-
const length =
|
|
11043
|
+
function percentDecode(input3) {
|
|
11044
|
+
const length = input3.length;
|
|
11045
11045
|
const output = new Uint8Array(length);
|
|
11046
11046
|
let j = 0;
|
|
11047
11047
|
let i = 0;
|
|
11048
11048
|
while (i < length) {
|
|
11049
|
-
const byte =
|
|
11049
|
+
const byte = input3[i];
|
|
11050
11050
|
if (byte !== 37) {
|
|
11051
11051
|
output[j++] = byte;
|
|
11052
|
-
} else if (byte === 37 && !(isHexCharByte(
|
|
11052
|
+
} else if (byte === 37 && !(isHexCharByte(input3[i + 1]) && isHexCharByte(input3[i + 2]))) {
|
|
11053
11053
|
output[j++] = 37;
|
|
11054
11054
|
} else {
|
|
11055
|
-
output[j++] = hexByteToNumber(
|
|
11055
|
+
output[j++] = hexByteToNumber(input3[i + 1]) << 4 | hexByteToNumber(input3[i + 2]);
|
|
11056
11056
|
i += 2;
|
|
11057
11057
|
}
|
|
11058
11058
|
++i;
|
|
11059
11059
|
}
|
|
11060
11060
|
return length === j ? output : output.subarray(0, j);
|
|
11061
11061
|
}
|
|
11062
|
-
function parseMIMEType(
|
|
11063
|
-
|
|
11062
|
+
function parseMIMEType(input3) {
|
|
11063
|
+
input3 = removeHTTPWhitespace(input3, true, true);
|
|
11064
11064
|
const position = { position: 0 };
|
|
11065
11065
|
const type = collectASequenceOfCodePointsFast(
|
|
11066
11066
|
"/",
|
|
11067
|
-
|
|
11067
|
+
input3,
|
|
11068
11068
|
position
|
|
11069
11069
|
);
|
|
11070
11070
|
if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) {
|
|
11071
11071
|
return "failure";
|
|
11072
11072
|
}
|
|
11073
|
-
if (position.position >=
|
|
11073
|
+
if (position.position >= input3.length) {
|
|
11074
11074
|
return "failure";
|
|
11075
11075
|
}
|
|
11076
11076
|
position.position++;
|
|
11077
11077
|
let subtype = collectASequenceOfCodePointsFast(
|
|
11078
11078
|
";",
|
|
11079
|
-
|
|
11079
|
+
input3,
|
|
11080
11080
|
position
|
|
11081
11081
|
);
|
|
11082
11082
|
subtype = removeHTTPWhitespace(subtype, false, true);
|
|
@@ -11093,41 +11093,41 @@ var require_data_url = __commonJS({
|
|
|
11093
11093
|
// https://mimesniff.spec.whatwg.org/#mime-type-essence
|
|
11094
11094
|
essence: `${typeLowercase}/${subtypeLowercase}`
|
|
11095
11095
|
};
|
|
11096
|
-
while (position.position <
|
|
11096
|
+
while (position.position < input3.length) {
|
|
11097
11097
|
position.position++;
|
|
11098
11098
|
collectASequenceOfCodePoints(
|
|
11099
11099
|
// https://fetch.spec.whatwg.org/#http-whitespace
|
|
11100
11100
|
(char) => HTTP_WHITESPACE_REGEX.test(char),
|
|
11101
|
-
|
|
11101
|
+
input3,
|
|
11102
11102
|
position
|
|
11103
11103
|
);
|
|
11104
11104
|
let parameterName = collectASequenceOfCodePoints(
|
|
11105
11105
|
(char) => char !== ";" && char !== "=",
|
|
11106
|
-
|
|
11106
|
+
input3,
|
|
11107
11107
|
position
|
|
11108
11108
|
);
|
|
11109
11109
|
parameterName = parameterName.toLowerCase();
|
|
11110
|
-
if (position.position <
|
|
11111
|
-
if (
|
|
11110
|
+
if (position.position < input3.length) {
|
|
11111
|
+
if (input3[position.position] === ";") {
|
|
11112
11112
|
continue;
|
|
11113
11113
|
}
|
|
11114
11114
|
position.position++;
|
|
11115
11115
|
}
|
|
11116
|
-
if (position.position >=
|
|
11116
|
+
if (position.position >= input3.length) {
|
|
11117
11117
|
break;
|
|
11118
11118
|
}
|
|
11119
11119
|
let parameterValue = null;
|
|
11120
|
-
if (
|
|
11121
|
-
parameterValue = collectAnHTTPQuotedString(
|
|
11120
|
+
if (input3[position.position] === '"') {
|
|
11121
|
+
parameterValue = collectAnHTTPQuotedString(input3, position, true);
|
|
11122
11122
|
collectASequenceOfCodePointsFast(
|
|
11123
11123
|
";",
|
|
11124
|
-
|
|
11124
|
+
input3,
|
|
11125
11125
|
position
|
|
11126
11126
|
);
|
|
11127
11127
|
} else {
|
|
11128
11128
|
parameterValue = collectASequenceOfCodePointsFast(
|
|
11129
11129
|
";",
|
|
11130
|
-
|
|
11130
|
+
input3,
|
|
11131
11131
|
position
|
|
11132
11132
|
);
|
|
11133
11133
|
parameterValue = removeHTTPWhitespace(parameterValue, false, true);
|
|
@@ -11141,28 +11141,28 @@ var require_data_url = __commonJS({
|
|
|
11141
11141
|
}
|
|
11142
11142
|
return mimeType;
|
|
11143
11143
|
}
|
|
11144
|
-
function collectAnHTTPQuotedString(
|
|
11144
|
+
function collectAnHTTPQuotedString(input3, position, extractValue = false) {
|
|
11145
11145
|
const positionStart = position.position;
|
|
11146
11146
|
let value = "";
|
|
11147
|
-
assert(
|
|
11147
|
+
assert(input3[position.position] === '"');
|
|
11148
11148
|
position.position++;
|
|
11149
11149
|
while (true) {
|
|
11150
11150
|
value += collectASequenceOfCodePoints(
|
|
11151
11151
|
(char) => char !== '"' && char !== "\\",
|
|
11152
|
-
|
|
11152
|
+
input3,
|
|
11153
11153
|
position
|
|
11154
11154
|
);
|
|
11155
|
-
if (position.position >=
|
|
11155
|
+
if (position.position >= input3.length) {
|
|
11156
11156
|
break;
|
|
11157
11157
|
}
|
|
11158
|
-
const quoteOrBackslash =
|
|
11158
|
+
const quoteOrBackslash = input3[position.position];
|
|
11159
11159
|
position.position++;
|
|
11160
11160
|
if (quoteOrBackslash === "\\") {
|
|
11161
|
-
if (position.position >=
|
|
11161
|
+
if (position.position >= input3.length) {
|
|
11162
11162
|
value += "\\";
|
|
11163
11163
|
break;
|
|
11164
11164
|
}
|
|
11165
|
-
value +=
|
|
11165
|
+
value += input3[position.position];
|
|
11166
11166
|
position.position++;
|
|
11167
11167
|
} else {
|
|
11168
11168
|
assert(quoteOrBackslash === '"');
|
|
@@ -11172,7 +11172,7 @@ var require_data_url = __commonJS({
|
|
|
11172
11172
|
if (extractValue) {
|
|
11173
11173
|
return value;
|
|
11174
11174
|
}
|
|
11175
|
-
return
|
|
11175
|
+
return input3.slice(positionStart, position.position);
|
|
11176
11176
|
}
|
|
11177
11177
|
function serializeAMimeType(mimeType) {
|
|
11178
11178
|
assert(mimeType !== "failure");
|
|
@@ -12609,27 +12609,27 @@ var require_util2 = __commonJS({
|
|
|
12609
12609
|
return mimeType;
|
|
12610
12610
|
}
|
|
12611
12611
|
function gettingDecodingSplitting(value) {
|
|
12612
|
-
const
|
|
12612
|
+
const input3 = value;
|
|
12613
12613
|
const position = { position: 0 };
|
|
12614
12614
|
const values = [];
|
|
12615
12615
|
let temporaryValue = "";
|
|
12616
|
-
while (position.position <
|
|
12616
|
+
while (position.position < input3.length) {
|
|
12617
12617
|
temporaryValue += collectASequenceOfCodePoints(
|
|
12618
12618
|
(char) => char !== '"' && char !== ",",
|
|
12619
|
-
|
|
12619
|
+
input3,
|
|
12620
12620
|
position
|
|
12621
12621
|
);
|
|
12622
|
-
if (position.position <
|
|
12623
|
-
if (
|
|
12622
|
+
if (position.position < input3.length) {
|
|
12623
|
+
if (input3.charCodeAt(position.position) === 34) {
|
|
12624
12624
|
temporaryValue += collectAnHTTPQuotedString(
|
|
12625
|
-
|
|
12625
|
+
input3,
|
|
12626
12626
|
position
|
|
12627
12627
|
);
|
|
12628
|
-
if (position.position <
|
|
12628
|
+
if (position.position < input3.length) {
|
|
12629
12629
|
continue;
|
|
12630
12630
|
}
|
|
12631
12631
|
} else {
|
|
12632
|
-
assert(
|
|
12632
|
+
assert(input3.charCodeAt(position.position) === 44);
|
|
12633
12633
|
position.position++;
|
|
12634
12634
|
}
|
|
12635
12635
|
}
|
|
@@ -12918,7 +12918,7 @@ var require_formdata_parser = __commonJS({
|
|
|
12918
12918
|
}
|
|
12919
12919
|
return true;
|
|
12920
12920
|
}
|
|
12921
|
-
function multipartFormDataParser(
|
|
12921
|
+
function multipartFormDataParser(input3, mimeType) {
|
|
12922
12922
|
assert(mimeType !== "failure" && mimeType.essence === "multipart/form-data");
|
|
12923
12923
|
const boundaryString = mimeType.parameters.get("boundary");
|
|
12924
12924
|
if (boundaryString === void 0) {
|
|
@@ -12927,40 +12927,40 @@ var require_formdata_parser = __commonJS({
|
|
|
12927
12927
|
const boundary = Buffer.from(`--${boundaryString}`, "utf8");
|
|
12928
12928
|
const entryList = [];
|
|
12929
12929
|
const position = { position: 0 };
|
|
12930
|
-
const firstBoundaryIndex =
|
|
12930
|
+
const firstBoundaryIndex = input3.indexOf(boundary);
|
|
12931
12931
|
if (firstBoundaryIndex === -1) {
|
|
12932
12932
|
throw parsingError("no boundary found in multipart body");
|
|
12933
12933
|
}
|
|
12934
12934
|
position.position = firstBoundaryIndex;
|
|
12935
12935
|
while (true) {
|
|
12936
|
-
if (
|
|
12936
|
+
if (input3.subarray(position.position, position.position + boundary.length).equals(boundary)) {
|
|
12937
12937
|
position.position += boundary.length;
|
|
12938
12938
|
} else {
|
|
12939
12939
|
throw parsingError("expected a value starting with -- and the boundary");
|
|
12940
12940
|
}
|
|
12941
|
-
if (bufferStartsWith(
|
|
12941
|
+
if (bufferStartsWith(input3, dd, position)) {
|
|
12942
12942
|
return entryList;
|
|
12943
12943
|
}
|
|
12944
|
-
if (
|
|
12944
|
+
if (input3[position.position] !== 13 || input3[position.position + 1] !== 10) {
|
|
12945
12945
|
throw parsingError("expected CRLF");
|
|
12946
12946
|
}
|
|
12947
12947
|
position.position += 2;
|
|
12948
|
-
const result = parseMultipartFormDataHeaders(
|
|
12948
|
+
const result = parseMultipartFormDataHeaders(input3, position);
|
|
12949
12949
|
let { name, filename, contentType, encoding } = result;
|
|
12950
12950
|
position.position += 2;
|
|
12951
12951
|
let body;
|
|
12952
12952
|
{
|
|
12953
|
-
const boundaryIndex =
|
|
12953
|
+
const boundaryIndex = input3.indexOf(boundary.subarray(2), position.position);
|
|
12954
12954
|
if (boundaryIndex === -1) {
|
|
12955
12955
|
throw parsingError("expected boundary after body");
|
|
12956
12956
|
}
|
|
12957
|
-
body =
|
|
12957
|
+
body = input3.subarray(position.position, boundaryIndex - 4);
|
|
12958
12958
|
position.position += body.length;
|
|
12959
12959
|
if (encoding === "base64") {
|
|
12960
12960
|
body = Buffer.from(body.toString(), "base64");
|
|
12961
12961
|
}
|
|
12962
12962
|
}
|
|
12963
|
-
if (
|
|
12963
|
+
if (input3[position.position] !== 13 || input3[position.position + 1] !== 10) {
|
|
12964
12964
|
throw parsingError("expected CRLF");
|
|
12965
12965
|
} else {
|
|
12966
12966
|
position.position += 2;
|
|
@@ -12980,36 +12980,36 @@ var require_formdata_parser = __commonJS({
|
|
|
12980
12980
|
entryList.push(makeEntry(name, value, filename));
|
|
12981
12981
|
}
|
|
12982
12982
|
}
|
|
12983
|
-
function parseContentDispositionAttribute(
|
|
12984
|
-
if (
|
|
12983
|
+
function parseContentDispositionAttribute(input3, position) {
|
|
12984
|
+
if (input3[position.position] === 59) {
|
|
12985
12985
|
position.position++;
|
|
12986
12986
|
}
|
|
12987
12987
|
collectASequenceOfBytes(
|
|
12988
12988
|
(char) => char === 32 || char === 9,
|
|
12989
|
-
|
|
12989
|
+
input3,
|
|
12990
12990
|
position
|
|
12991
12991
|
);
|
|
12992
12992
|
const attributeName = collectASequenceOfBytes(
|
|
12993
12993
|
(char) => isToken(char) && char !== 61 && char !== 42,
|
|
12994
12994
|
// not = or *
|
|
12995
|
-
|
|
12995
|
+
input3,
|
|
12996
12996
|
position
|
|
12997
12997
|
);
|
|
12998
12998
|
if (attributeName.length === 0) {
|
|
12999
12999
|
return null;
|
|
13000
13000
|
}
|
|
13001
13001
|
const attrNameStr = attributeName.toString("ascii").toLowerCase();
|
|
13002
|
-
const isExtended =
|
|
13002
|
+
const isExtended = input3[position.position] === 42;
|
|
13003
13003
|
if (isExtended) {
|
|
13004
13004
|
position.position++;
|
|
13005
13005
|
}
|
|
13006
|
-
if (
|
|
13006
|
+
if (input3[position.position] !== 61) {
|
|
13007
13007
|
return null;
|
|
13008
13008
|
}
|
|
13009
13009
|
position.position++;
|
|
13010
13010
|
collectASequenceOfBytes(
|
|
13011
13011
|
(char) => char === 32 || char === 9,
|
|
13012
|
-
|
|
13012
|
+
input3,
|
|
13013
13013
|
position
|
|
13014
13014
|
);
|
|
13015
13015
|
let value;
|
|
@@ -13017,7 +13017,7 @@ var require_formdata_parser = __commonJS({
|
|
|
13017
13017
|
const headerValue = collectASequenceOfBytes(
|
|
13018
13018
|
(char) => char !== 32 && char !== 13 && char !== 10 && char !== 59,
|
|
13019
13019
|
// not space, CRLF, or ;
|
|
13020
|
-
|
|
13020
|
+
input3,
|
|
13021
13021
|
position
|
|
13022
13022
|
);
|
|
13023
13023
|
if (headerValue[0] !== 117 && headerValue[0] !== 85 || // u or U
|
|
@@ -13028,15 +13028,15 @@ var require_formdata_parser = __commonJS({
|
|
|
13028
13028
|
throw parsingError("unknown encoding, expected utf-8''");
|
|
13029
13029
|
}
|
|
13030
13030
|
value = decodeURIComponent(decoder.decode(headerValue.subarray(7)));
|
|
13031
|
-
} else if (
|
|
13031
|
+
} else if (input3[position.position] === 34) {
|
|
13032
13032
|
position.position++;
|
|
13033
13033
|
const quotedValue = collectASequenceOfBytes(
|
|
13034
13034
|
(char) => char !== 10 && char !== 13 && char !== 34,
|
|
13035
13035
|
// not LF, CR, or "
|
|
13036
|
-
|
|
13036
|
+
input3,
|
|
13037
13037
|
position
|
|
13038
13038
|
);
|
|
13039
|
-
if (
|
|
13039
|
+
if (input3[position.position] !== 34) {
|
|
13040
13040
|
throw parsingError("Closing quote not found");
|
|
13041
13041
|
}
|
|
13042
13042
|
position.position++;
|
|
@@ -13045,20 +13045,20 @@ var require_formdata_parser = __commonJS({
|
|
|
13045
13045
|
const tokenValue = collectASequenceOfBytes(
|
|
13046
13046
|
(char) => isToken(char) && char !== 59,
|
|
13047
13047
|
// not ;
|
|
13048
|
-
|
|
13048
|
+
input3,
|
|
13049
13049
|
position
|
|
13050
13050
|
);
|
|
13051
13051
|
value = decoder.decode(tokenValue);
|
|
13052
13052
|
}
|
|
13053
13053
|
return { name: attrNameStr, value };
|
|
13054
13054
|
}
|
|
13055
|
-
function parseMultipartFormDataHeaders(
|
|
13055
|
+
function parseMultipartFormDataHeaders(input3, position) {
|
|
13056
13056
|
let name = null;
|
|
13057
13057
|
let filename = null;
|
|
13058
13058
|
let contentType = null;
|
|
13059
13059
|
let encoding = null;
|
|
13060
13060
|
while (true) {
|
|
13061
|
-
if (
|
|
13061
|
+
if (input3[position.position] === 13 && input3[position.position + 1] === 10) {
|
|
13062
13062
|
if (name === null) {
|
|
13063
13063
|
throw parsingError("header name is null");
|
|
13064
13064
|
}
|
|
@@ -13066,20 +13066,20 @@ var require_formdata_parser = __commonJS({
|
|
|
13066
13066
|
}
|
|
13067
13067
|
let headerName = collectASequenceOfBytes(
|
|
13068
13068
|
(char) => char !== 10 && char !== 13 && char !== 58,
|
|
13069
|
-
|
|
13069
|
+
input3,
|
|
13070
13070
|
position
|
|
13071
13071
|
);
|
|
13072
13072
|
headerName = removeChars(headerName, true, true, (char) => char === 9 || char === 32);
|
|
13073
13073
|
if (!HTTP_TOKEN_CODEPOINTS.test(headerName.toString())) {
|
|
13074
13074
|
throw parsingError("header name does not match the field-name token production");
|
|
13075
13075
|
}
|
|
13076
|
-
if (
|
|
13076
|
+
if (input3[position.position] !== 58) {
|
|
13077
13077
|
throw parsingError("expected :");
|
|
13078
13078
|
}
|
|
13079
13079
|
position.position++;
|
|
13080
13080
|
collectASequenceOfBytes(
|
|
13081
13081
|
(char) => char === 32 || char === 9,
|
|
13082
|
-
|
|
13082
|
+
input3,
|
|
13083
13083
|
position
|
|
13084
13084
|
);
|
|
13085
13085
|
switch (bufferToLowerCasedHeaderName(headerName)) {
|
|
@@ -13087,14 +13087,14 @@ var require_formdata_parser = __commonJS({
|
|
|
13087
13087
|
name = filename = null;
|
|
13088
13088
|
const dispositionType = collectASequenceOfBytes(
|
|
13089
13089
|
(char) => isToken(char),
|
|
13090
|
-
|
|
13090
|
+
input3,
|
|
13091
13091
|
position
|
|
13092
13092
|
);
|
|
13093
13093
|
if (dispositionType.toString("ascii").toLowerCase() !== "form-data") {
|
|
13094
13094
|
throw parsingError("expected form-data for content-disposition header");
|
|
13095
13095
|
}
|
|
13096
|
-
while (position.position <
|
|
13097
|
-
const attribute = parseContentDispositionAttribute(
|
|
13096
|
+
while (position.position < input3.length && input3[position.position] !== 13 && input3[position.position + 1] !== 10) {
|
|
13097
|
+
const attribute = parseContentDispositionAttribute(input3, position);
|
|
13098
13098
|
if (!attribute) {
|
|
13099
13099
|
break;
|
|
13100
13100
|
}
|
|
@@ -13112,7 +13112,7 @@ var require_formdata_parser = __commonJS({
|
|
|
13112
13112
|
case "content-type": {
|
|
13113
13113
|
let headerValue = collectASequenceOfBytes(
|
|
13114
13114
|
(char) => char !== 10 && char !== 13,
|
|
13115
|
-
|
|
13115
|
+
input3,
|
|
13116
13116
|
position
|
|
13117
13117
|
);
|
|
13118
13118
|
headerValue = removeChars(headerValue, false, true, (char) => char === 9 || char === 32);
|
|
@@ -13122,7 +13122,7 @@ var require_formdata_parser = __commonJS({
|
|
|
13122
13122
|
case "content-transfer-encoding": {
|
|
13123
13123
|
let headerValue = collectASequenceOfBytes(
|
|
13124
13124
|
(char) => char !== 10 && char !== 13,
|
|
13125
|
-
|
|
13125
|
+
input3,
|
|
13126
13126
|
position
|
|
13127
13127
|
);
|
|
13128
13128
|
headerValue = removeChars(headerValue, false, true, (char) => char === 9 || char === 32);
|
|
@@ -13132,24 +13132,24 @@ var require_formdata_parser = __commonJS({
|
|
|
13132
13132
|
default: {
|
|
13133
13133
|
collectASequenceOfBytes(
|
|
13134
13134
|
(char) => char !== 10 && char !== 13,
|
|
13135
|
-
|
|
13135
|
+
input3,
|
|
13136
13136
|
position
|
|
13137
13137
|
);
|
|
13138
13138
|
}
|
|
13139
13139
|
}
|
|
13140
|
-
if (
|
|
13140
|
+
if (input3[position.position] !== 13 && input3[position.position + 1] !== 10) {
|
|
13141
13141
|
throw parsingError("expected CRLF");
|
|
13142
13142
|
} else {
|
|
13143
13143
|
position.position += 2;
|
|
13144
13144
|
}
|
|
13145
13145
|
}
|
|
13146
13146
|
}
|
|
13147
|
-
function collectASequenceOfBytes(condition,
|
|
13147
|
+
function collectASequenceOfBytes(condition, input3, position) {
|
|
13148
13148
|
let start = position.position;
|
|
13149
|
-
while (start <
|
|
13149
|
+
while (start < input3.length && condition(input3[start])) {
|
|
13150
13150
|
++start;
|
|
13151
13151
|
}
|
|
13152
|
-
return
|
|
13152
|
+
return input3.subarray(position.position, position.position = start);
|
|
13153
13153
|
}
|
|
13154
13154
|
function removeChars(buf, leading, trailing, predicate) {
|
|
13155
13155
|
let lead = 0;
|
|
@@ -16713,7 +16713,7 @@ var require_proxy_agent = __commonJS({
|
|
|
16713
16713
|
const { proxyTunnel = true } = opts;
|
|
16714
16714
|
super();
|
|
16715
16715
|
const url = this.#getUrl(opts);
|
|
16716
|
-
const { href, origin, port, protocol, username, password, hostname: proxyHostname } = url;
|
|
16716
|
+
const { href, origin, port, protocol, username, password: password2, hostname: proxyHostname } = url;
|
|
16717
16717
|
this[kProxy] = { uri: href, protocol };
|
|
16718
16718
|
this[kRequestTls] = opts.requestTls;
|
|
16719
16719
|
this[kProxyTls] = opts.proxyTls;
|
|
@@ -16725,8 +16725,8 @@ var require_proxy_agent = __commonJS({
|
|
|
16725
16725
|
this[kProxyHeaders]["proxy-authorization"] = `Basic ${opts.auth}`;
|
|
16726
16726
|
} else if (opts.token) {
|
|
16727
16727
|
this[kProxyHeaders]["proxy-authorization"] = opts.token;
|
|
16728
|
-
} else if (username &&
|
|
16729
|
-
this[kProxyHeaders]["proxy-authorization"] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(
|
|
16728
|
+
} else if (username && password2) {
|
|
16729
|
+
this[kProxyHeaders]["proxy-authorization"] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password2)}`).toString("base64")}`;
|
|
16730
16730
|
}
|
|
16731
16731
|
const connect = buildConnector({ ...opts.proxyTls });
|
|
16732
16732
|
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls });
|
|
@@ -24851,39 +24851,39 @@ var require_request2 = __commonJS({
|
|
|
24851
24851
|
#headers;
|
|
24852
24852
|
#state;
|
|
24853
24853
|
// https://fetch.spec.whatwg.org/#dom-request
|
|
24854
|
-
constructor(
|
|
24854
|
+
constructor(input3, init3 = void 0) {
|
|
24855
24855
|
webidl.util.markAsUncloneable(this);
|
|
24856
|
-
if (
|
|
24856
|
+
if (input3 === kConstruct) {
|
|
24857
24857
|
return;
|
|
24858
24858
|
}
|
|
24859
24859
|
const prefix = "Request constructor";
|
|
24860
24860
|
webidl.argumentLengthCheck(arguments, 1, prefix);
|
|
24861
|
-
|
|
24861
|
+
input3 = webidl.converters.RequestInfo(input3);
|
|
24862
24862
|
init3 = webidl.converters.RequestInit(init3);
|
|
24863
24863
|
let request = null;
|
|
24864
24864
|
let fallbackMode = null;
|
|
24865
24865
|
const baseUrl = environmentSettingsObject.settingsObject.baseUrl;
|
|
24866
24866
|
let signal = null;
|
|
24867
|
-
if (typeof
|
|
24867
|
+
if (typeof input3 === "string") {
|
|
24868
24868
|
this.#dispatcher = init3.dispatcher;
|
|
24869
24869
|
let parsedURL;
|
|
24870
24870
|
try {
|
|
24871
|
-
parsedURL = new URL(
|
|
24871
|
+
parsedURL = new URL(input3, baseUrl);
|
|
24872
24872
|
} catch (err) {
|
|
24873
|
-
throw new TypeError("Failed to parse URL from " +
|
|
24873
|
+
throw new TypeError("Failed to parse URL from " + input3, { cause: err });
|
|
24874
24874
|
}
|
|
24875
24875
|
if (parsedURL.username || parsedURL.password) {
|
|
24876
24876
|
throw new TypeError(
|
|
24877
|
-
"Request cannot be constructed from a URL that includes credentials: " +
|
|
24877
|
+
"Request cannot be constructed from a URL that includes credentials: " + input3
|
|
24878
24878
|
);
|
|
24879
24879
|
}
|
|
24880
24880
|
request = makeRequest({ urlList: [parsedURL] });
|
|
24881
24881
|
fallbackMode = "cors";
|
|
24882
24882
|
} else {
|
|
24883
|
-
assert(webidl.is.Request(
|
|
24884
|
-
request =
|
|
24885
|
-
signal =
|
|
24886
|
-
this.#dispatcher = init3.dispatcher ||
|
|
24883
|
+
assert(webidl.is.Request(input3));
|
|
24884
|
+
request = input3.#state;
|
|
24885
|
+
signal = input3.#signal;
|
|
24886
|
+
this.#dispatcher = init3.dispatcher || input3.#dispatcher;
|
|
24887
24887
|
}
|
|
24888
24888
|
const origin = environmentSettingsObject.settingsObject.origin;
|
|
24889
24889
|
let window2 = "client";
|
|
@@ -25075,7 +25075,7 @@ var require_request2 = __commonJS({
|
|
|
25075
25075
|
fillHeaders(this.#headers, headers);
|
|
25076
25076
|
}
|
|
25077
25077
|
}
|
|
25078
|
-
const inputBody = webidl.is.Request(
|
|
25078
|
+
const inputBody = webidl.is.Request(input3) ? input3.#state.body : null;
|
|
25079
25079
|
if ((init3.body != null || inputBody != null) && (request.method === "GET" || request.method === "HEAD")) {
|
|
25080
25080
|
throw new TypeError("Request with GET/HEAD method cannot have body.");
|
|
25081
25081
|
}
|
|
@@ -25104,7 +25104,7 @@ var require_request2 = __commonJS({
|
|
|
25104
25104
|
}
|
|
25105
25105
|
let finalBody = inputOrInitBody;
|
|
25106
25106
|
if (initBody == null && inputBody != null) {
|
|
25107
|
-
if (bodyUnusable(
|
|
25107
|
+
if (bodyUnusable(input3.#state)) {
|
|
25108
25108
|
throw new TypeError(
|
|
25109
25109
|
"Cannot construct a Request with a Request object that has already been used."
|
|
25110
25110
|
);
|
|
@@ -25780,12 +25780,12 @@ var require_fetch = __commonJS({
|
|
|
25780
25780
|
function handleFetchDone(response) {
|
|
25781
25781
|
finalizeAndReportTiming(response, "fetch");
|
|
25782
25782
|
}
|
|
25783
|
-
function fetch5(
|
|
25783
|
+
function fetch5(input3, init3 = void 0) {
|
|
25784
25784
|
webidl.argumentLengthCheck(arguments, 1, "globalThis.fetch");
|
|
25785
25785
|
let p = createDeferredPromise();
|
|
25786
25786
|
let requestObject;
|
|
25787
25787
|
try {
|
|
25788
|
-
requestObject = new Request3(
|
|
25788
|
+
requestObject = new Request3(input3, init3);
|
|
25789
25789
|
} catch (e) {
|
|
25790
25790
|
p.reject(e);
|
|
25791
25791
|
return p.promise;
|
|
@@ -26383,8 +26383,8 @@ var require_fetch = __commonJS({
|
|
|
26383
26383
|
let authorizationValue = null;
|
|
26384
26384
|
if (hasAuthenticationEntry(httpRequest) && (httpRequest.useURLCredentials === void 0 || !includesCredentials(requestCurrentURL(httpRequest)))) {
|
|
26385
26385
|
} else if (includesCredentials(requestCurrentURL(httpRequest)) && isAuthenticationFetch) {
|
|
26386
|
-
const { username, password } = requestCurrentURL(httpRequest);
|
|
26387
|
-
authorizationValue = `Basic ${Buffer.from(`${username}:${
|
|
26386
|
+
const { username, password: password2 } = requestCurrentURL(httpRequest);
|
|
26387
|
+
authorizationValue = `Basic ${Buffer.from(`${username}:${password2}`).toString("base64")}`;
|
|
26388
26388
|
}
|
|
26389
26389
|
if (authorizationValue !== null) {
|
|
26390
26390
|
httpRequest.headersList.append("Authorization", authorizationValue, false);
|
|
@@ -30801,25 +30801,25 @@ var require_utils3 = __commonJS({
|
|
|
30801
30801
|
exports.asciiLowercase = (string) => {
|
|
30802
30802
|
return string.replace(/[A-Z]/ug, (l) => l.toLowerCase());
|
|
30803
30803
|
};
|
|
30804
|
-
exports.collectAnHTTPQuotedString = (
|
|
30804
|
+
exports.collectAnHTTPQuotedString = (input3, position) => {
|
|
30805
30805
|
let value = "";
|
|
30806
30806
|
position++;
|
|
30807
30807
|
while (true) {
|
|
30808
|
-
while (position <
|
|
30809
|
-
value +=
|
|
30808
|
+
while (position < input3.length && input3[position] !== '"' && input3[position] !== "\\") {
|
|
30809
|
+
value += input3[position];
|
|
30810
30810
|
++position;
|
|
30811
30811
|
}
|
|
30812
|
-
if (position >=
|
|
30812
|
+
if (position >= input3.length) {
|
|
30813
30813
|
break;
|
|
30814
30814
|
}
|
|
30815
|
-
const quoteOrBackslash =
|
|
30815
|
+
const quoteOrBackslash = input3[position];
|
|
30816
30816
|
++position;
|
|
30817
30817
|
if (quoteOrBackslash === "\\") {
|
|
30818
|
-
if (position >=
|
|
30818
|
+
if (position >= input3.length) {
|
|
30819
30819
|
value += "\\";
|
|
30820
30820
|
break;
|
|
30821
30821
|
}
|
|
30822
|
-
value +=
|
|
30822
|
+
value += input3[position];
|
|
30823
30823
|
++position;
|
|
30824
30824
|
} else {
|
|
30825
30825
|
break;
|
|
@@ -30906,24 +30906,24 @@ var require_parser = __commonJS({
|
|
|
30906
30906
|
asciiLowercase,
|
|
30907
30907
|
collectAnHTTPQuotedString
|
|
30908
30908
|
} = require_utils3();
|
|
30909
|
-
module.exports = (
|
|
30910
|
-
|
|
30909
|
+
module.exports = (input3) => {
|
|
30910
|
+
input3 = removeLeadingAndTrailingHTTPWhitespace(input3);
|
|
30911
30911
|
let position = 0;
|
|
30912
30912
|
let type = "";
|
|
30913
|
-
while (position <
|
|
30914
|
-
type +=
|
|
30913
|
+
while (position < input3.length && input3[position] !== "/") {
|
|
30914
|
+
type += input3[position];
|
|
30915
30915
|
++position;
|
|
30916
30916
|
}
|
|
30917
30917
|
if (type.length === 0 || !solelyContainsHTTPTokenCodePoints(type)) {
|
|
30918
30918
|
return null;
|
|
30919
30919
|
}
|
|
30920
|
-
if (position >=
|
|
30920
|
+
if (position >= input3.length) {
|
|
30921
30921
|
return null;
|
|
30922
30922
|
}
|
|
30923
30923
|
++position;
|
|
30924
30924
|
let subtype = "";
|
|
30925
|
-
while (position <
|
|
30926
|
-
subtype +=
|
|
30925
|
+
while (position < input3.length && input3[position] !== ";") {
|
|
30926
|
+
subtype += input3[position];
|
|
30927
30927
|
++position;
|
|
30928
30928
|
}
|
|
30929
30929
|
subtype = removeTrailingHTTPWhitespace(subtype);
|
|
@@ -30935,33 +30935,33 @@ var require_parser = __commonJS({
|
|
|
30935
30935
|
subtype: asciiLowercase(subtype),
|
|
30936
30936
|
parameters: /* @__PURE__ */ new Map()
|
|
30937
30937
|
};
|
|
30938
|
-
while (position <
|
|
30938
|
+
while (position < input3.length) {
|
|
30939
30939
|
++position;
|
|
30940
|
-
while (isHTTPWhitespaceChar(
|
|
30940
|
+
while (isHTTPWhitespaceChar(input3[position])) {
|
|
30941
30941
|
++position;
|
|
30942
30942
|
}
|
|
30943
30943
|
let parameterName = "";
|
|
30944
|
-
while (position <
|
|
30945
|
-
parameterName +=
|
|
30944
|
+
while (position < input3.length && input3[position] !== ";" && input3[position] !== "=") {
|
|
30945
|
+
parameterName += input3[position];
|
|
30946
30946
|
++position;
|
|
30947
30947
|
}
|
|
30948
30948
|
parameterName = asciiLowercase(parameterName);
|
|
30949
|
-
if (position <
|
|
30950
|
-
if (
|
|
30949
|
+
if (position < input3.length) {
|
|
30950
|
+
if (input3[position] === ";") {
|
|
30951
30951
|
continue;
|
|
30952
30952
|
}
|
|
30953
30953
|
++position;
|
|
30954
30954
|
}
|
|
30955
30955
|
let parameterValue = null;
|
|
30956
|
-
if (
|
|
30957
|
-
[parameterValue, position] = collectAnHTTPQuotedString(
|
|
30958
|
-
while (position <
|
|
30956
|
+
if (input3[position] === '"') {
|
|
30957
|
+
[parameterValue, position] = collectAnHTTPQuotedString(input3, position);
|
|
30958
|
+
while (position < input3.length && input3[position] !== ";") {
|
|
30959
30959
|
++position;
|
|
30960
30960
|
}
|
|
30961
30961
|
} else {
|
|
30962
30962
|
parameterValue = "";
|
|
30963
|
-
while (position <
|
|
30964
|
-
parameterValue +=
|
|
30963
|
+
while (position < input3.length && input3[position] !== ";") {
|
|
30964
|
+
parameterValue += input3[position];
|
|
30965
30965
|
++position;
|
|
30966
30966
|
}
|
|
30967
30967
|
parameterValue = removeTrailingHTTPWhitespace(parameterValue);
|
|
@@ -35488,9 +35488,9 @@ var require_lib3 = __commonJS({
|
|
|
35488
35488
|
return false;
|
|
35489
35489
|
}
|
|
35490
35490
|
}
|
|
35491
|
-
function hasNewLine(
|
|
35491
|
+
function hasNewLine(input3, start, end2) {
|
|
35492
35492
|
for (let i = start; i < end2; i++) {
|
|
35493
|
-
if (isNewLine(
|
|
35493
|
+
if (isNewLine(input3.charCodeAt(i))) {
|
|
35494
35494
|
return true;
|
|
35495
35495
|
}
|
|
35496
35496
|
}
|
|
@@ -36478,7 +36478,7 @@ var require_lib3 = __commonJS({
|
|
|
36478
36478
|
dec: (ch) => ch >= 48 && ch <= 57,
|
|
36479
36479
|
hex: (ch) => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
36480
36480
|
};
|
|
36481
|
-
function readStringContents(type,
|
|
36481
|
+
function readStringContents(type, input3, pos, lineStart, curLine, errors2) {
|
|
36482
36482
|
const initialPos = pos;
|
|
36483
36483
|
const initialLineStart = lineStart;
|
|
36484
36484
|
const initialCurLine = curLine;
|
|
@@ -36487,21 +36487,21 @@ var require_lib3 = __commonJS({
|
|
|
36487
36487
|
let chunkStart = pos;
|
|
36488
36488
|
const {
|
|
36489
36489
|
length
|
|
36490
|
-
} =
|
|
36490
|
+
} = input3;
|
|
36491
36491
|
for (; ; ) {
|
|
36492
36492
|
if (pos >= length) {
|
|
36493
36493
|
errors2.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
36494
|
-
out +=
|
|
36494
|
+
out += input3.slice(chunkStart, pos);
|
|
36495
36495
|
break;
|
|
36496
36496
|
}
|
|
36497
|
-
const ch =
|
|
36498
|
-
if (isStringEnd(type, ch,
|
|
36499
|
-
out +=
|
|
36497
|
+
const ch = input3.charCodeAt(pos);
|
|
36498
|
+
if (isStringEnd(type, ch, input3, pos)) {
|
|
36499
|
+
out += input3.slice(chunkStart, pos);
|
|
36500
36500
|
break;
|
|
36501
36501
|
}
|
|
36502
36502
|
if (ch === 92) {
|
|
36503
|
-
out +=
|
|
36504
|
-
const res = readEscapedChar(
|
|
36503
|
+
out += input3.slice(chunkStart, pos);
|
|
36504
|
+
const res = readEscapedChar(input3, pos, lineStart, curLine, type === "template", errors2);
|
|
36505
36505
|
if (res.ch === null && !firstInvalidLoc) {
|
|
36506
36506
|
firstInvalidLoc = {
|
|
36507
36507
|
pos,
|
|
@@ -36523,9 +36523,9 @@ var require_lib3 = __commonJS({
|
|
|
36523
36523
|
lineStart = pos;
|
|
36524
36524
|
} else if (ch === 10 || ch === 13) {
|
|
36525
36525
|
if (type === "template") {
|
|
36526
|
-
out +=
|
|
36526
|
+
out += input3.slice(chunkStart, pos) + "\n";
|
|
36527
36527
|
++pos;
|
|
36528
|
-
if (ch === 13 &&
|
|
36528
|
+
if (ch === 13 && input3.charCodeAt(pos) === 10) {
|
|
36529
36529
|
++pos;
|
|
36530
36530
|
}
|
|
36531
36531
|
++curLine;
|
|
@@ -36546,13 +36546,13 @@ var require_lib3 = __commonJS({
|
|
|
36546
36546
|
containsInvalid: !!firstInvalidLoc
|
|
36547
36547
|
};
|
|
36548
36548
|
}
|
|
36549
|
-
function isStringEnd(type, ch,
|
|
36549
|
+
function isStringEnd(type, ch, input3, pos) {
|
|
36550
36550
|
if (type === "template") {
|
|
36551
|
-
return ch === 96 || ch === 36 &&
|
|
36551
|
+
return ch === 96 || ch === 36 && input3.charCodeAt(pos + 1) === 123;
|
|
36552
36552
|
}
|
|
36553
36553
|
return ch === (type === "double" ? 34 : 39);
|
|
36554
36554
|
}
|
|
36555
|
-
function readEscapedChar(
|
|
36555
|
+
function readEscapedChar(input3, pos, lineStart, curLine, inTemplate, errors2) {
|
|
36556
36556
|
const throwOnInvalid = !inTemplate;
|
|
36557
36557
|
pos++;
|
|
36558
36558
|
const res = (ch2) => ({
|
|
@@ -36561,7 +36561,7 @@ var require_lib3 = __commonJS({
|
|
|
36561
36561
|
lineStart,
|
|
36562
36562
|
curLine
|
|
36563
36563
|
});
|
|
36564
|
-
const ch =
|
|
36564
|
+
const ch = input3.charCodeAt(pos++);
|
|
36565
36565
|
switch (ch) {
|
|
36566
36566
|
case 110:
|
|
36567
36567
|
return res("\n");
|
|
@@ -36572,7 +36572,7 @@ var require_lib3 = __commonJS({
|
|
|
36572
36572
|
({
|
|
36573
36573
|
code: code2,
|
|
36574
36574
|
pos
|
|
36575
|
-
} = readHexChar(
|
|
36575
|
+
} = readHexChar(input3, pos, lineStart, curLine, 2, false, throwOnInvalid, errors2));
|
|
36576
36576
|
return res(code2 === null ? null : String.fromCharCode(code2));
|
|
36577
36577
|
}
|
|
36578
36578
|
case 117: {
|
|
@@ -36580,7 +36580,7 @@ var require_lib3 = __commonJS({
|
|
|
36580
36580
|
({
|
|
36581
36581
|
code: code2,
|
|
36582
36582
|
pos
|
|
36583
|
-
} = readCodePoint(
|
|
36583
|
+
} = readCodePoint(input3, pos, lineStart, curLine, throwOnInvalid, errors2));
|
|
36584
36584
|
return res(code2 === null ? null : String.fromCodePoint(code2));
|
|
36585
36585
|
}
|
|
36586
36586
|
case 116:
|
|
@@ -36592,7 +36592,7 @@ var require_lib3 = __commonJS({
|
|
|
36592
36592
|
case 102:
|
|
36593
36593
|
return res("\f");
|
|
36594
36594
|
case 13:
|
|
36595
|
-
if (
|
|
36595
|
+
if (input3.charCodeAt(pos) === 10) {
|
|
36596
36596
|
++pos;
|
|
36597
36597
|
}
|
|
36598
36598
|
case 10:
|
|
@@ -36611,7 +36611,7 @@ var require_lib3 = __commonJS({
|
|
|
36611
36611
|
default:
|
|
36612
36612
|
if (ch >= 48 && ch <= 55) {
|
|
36613
36613
|
const startPos = pos - 1;
|
|
36614
|
-
const match = /^[0-7]+/.exec(
|
|
36614
|
+
const match = /^[0-7]+/.exec(input3.slice(startPos, pos + 2));
|
|
36615
36615
|
let octalStr = match[0];
|
|
36616
36616
|
let octal = parseInt(octalStr, 8);
|
|
36617
36617
|
if (octal > 255) {
|
|
@@ -36619,7 +36619,7 @@ var require_lib3 = __commonJS({
|
|
|
36619
36619
|
octal = parseInt(octalStr, 8);
|
|
36620
36620
|
}
|
|
36621
36621
|
pos += octalStr.length - 1;
|
|
36622
|
-
const next2 =
|
|
36622
|
+
const next2 = input3.charCodeAt(pos);
|
|
36623
36623
|
if (octalStr !== "0" || next2 === 56 || next2 === 57) {
|
|
36624
36624
|
if (inTemplate) {
|
|
36625
36625
|
return res(null);
|
|
@@ -36632,13 +36632,13 @@ var require_lib3 = __commonJS({
|
|
|
36632
36632
|
return res(String.fromCharCode(ch));
|
|
36633
36633
|
}
|
|
36634
36634
|
}
|
|
36635
|
-
function readHexChar(
|
|
36635
|
+
function readHexChar(input3, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors2) {
|
|
36636
36636
|
const initialPos = pos;
|
|
36637
36637
|
let n;
|
|
36638
36638
|
({
|
|
36639
36639
|
n,
|
|
36640
36640
|
pos
|
|
36641
|
-
} = readInt(
|
|
36641
|
+
} = readInt(input3, pos, lineStart, curLine, 16, len, forceLen, false, errors2, !throwOnInvalid));
|
|
36642
36642
|
if (n === null) {
|
|
36643
36643
|
if (throwOnInvalid) {
|
|
36644
36644
|
errors2.invalidEscapeSequence(initialPos, lineStart, curLine);
|
|
@@ -36651,18 +36651,18 @@ var require_lib3 = __commonJS({
|
|
|
36651
36651
|
pos
|
|
36652
36652
|
};
|
|
36653
36653
|
}
|
|
36654
|
-
function readInt(
|
|
36654
|
+
function readInt(input3, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors2, bailOnError) {
|
|
36655
36655
|
const start = pos;
|
|
36656
36656
|
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
|
|
36657
36657
|
const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
|
|
36658
36658
|
let invalid = false;
|
|
36659
36659
|
let total = 0;
|
|
36660
36660
|
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
|
36661
|
-
const code2 =
|
|
36661
|
+
const code2 = input3.charCodeAt(pos);
|
|
36662
36662
|
let val2;
|
|
36663
36663
|
if (code2 === 95 && allowNumSeparator !== "bail") {
|
|
36664
|
-
const prev2 =
|
|
36665
|
-
const next2 =
|
|
36664
|
+
const prev2 = input3.charCodeAt(pos - 1);
|
|
36665
|
+
const next2 = input3.charCodeAt(pos + 1);
|
|
36666
36666
|
if (!allowNumSeparator) {
|
|
36667
36667
|
if (bailOnError) return {
|
|
36668
36668
|
n: null,
|
|
@@ -36717,15 +36717,15 @@ var require_lib3 = __commonJS({
|
|
|
36717
36717
|
pos
|
|
36718
36718
|
};
|
|
36719
36719
|
}
|
|
36720
|
-
function readCodePoint(
|
|
36721
|
-
const ch =
|
|
36720
|
+
function readCodePoint(input3, pos, lineStart, curLine, throwOnInvalid, errors2) {
|
|
36721
|
+
const ch = input3.charCodeAt(pos);
|
|
36722
36722
|
let code2;
|
|
36723
36723
|
if (ch === 123) {
|
|
36724
36724
|
++pos;
|
|
36725
36725
|
({
|
|
36726
36726
|
code: code2,
|
|
36727
36727
|
pos
|
|
36728
|
-
} = readHexChar(
|
|
36728
|
+
} = readHexChar(input3, pos, lineStart, curLine, input3.indexOf("}", pos) - pos, true, throwOnInvalid, errors2));
|
|
36729
36729
|
++pos;
|
|
36730
36730
|
if (code2 !== null && code2 > 1114111) {
|
|
36731
36731
|
if (throwOnInvalid) {
|
|
@@ -36741,7 +36741,7 @@ var require_lib3 = __commonJS({
|
|
|
36741
36741
|
({
|
|
36742
36742
|
code: code2,
|
|
36743
36743
|
pos
|
|
36744
|
-
} = readHexChar(
|
|
36744
|
+
} = readHexChar(input3, pos, lineStart, curLine, 4, false, throwOnInvalid, errors2));
|
|
36745
36745
|
}
|
|
36746
36746
|
return {
|
|
36747
36747
|
code: code2,
|
|
@@ -36763,7 +36763,7 @@ var require_lib3 = __commonJS({
|
|
|
36763
36763
|
}
|
|
36764
36764
|
};
|
|
36765
36765
|
var Tokenizer3 = class extends CommentsParser {
|
|
36766
|
-
constructor(options,
|
|
36766
|
+
constructor(options, input3) {
|
|
36767
36767
|
super();
|
|
36768
36768
|
this.isLookahead = void 0;
|
|
36769
36769
|
this.tokens = [];
|
|
@@ -36798,8 +36798,8 @@ var require_lib3 = __commonJS({
|
|
|
36798
36798
|
});
|
|
36799
36799
|
this.state = new State4();
|
|
36800
36800
|
this.state.init(options);
|
|
36801
|
-
this.input =
|
|
36802
|
-
this.length =
|
|
36801
|
+
this.input = input3;
|
|
36802
|
+
this.length = input3.length;
|
|
36803
36803
|
this.comments = [];
|
|
36804
36804
|
this.isLookahead = false;
|
|
36805
36805
|
}
|
|
@@ -43602,7 +43602,7 @@ var require_lib3 = __commonJS({
|
|
|
43602
43602
|
};
|
|
43603
43603
|
var loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
43604
43604
|
var keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
43605
|
-
function babel7CompatTokens(tokens,
|
|
43605
|
+
function babel7CompatTokens(tokens, input3, startIndex) {
|
|
43606
43606
|
for (let i = 0; i < tokens.length; i++) {
|
|
43607
43607
|
const token = tokens[i];
|
|
43608
43608
|
const {
|
|
@@ -43646,7 +43646,7 @@ var require_lib3 = __commonJS({
|
|
|
43646
43646
|
const backquoteEnd = start + 1;
|
|
43647
43647
|
const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1);
|
|
43648
43648
|
let startToken;
|
|
43649
|
-
if (
|
|
43649
|
+
if (input3.charCodeAt(start - startIndex) === 96) {
|
|
43650
43650
|
startToken = new Token({
|
|
43651
43651
|
type: getExportedToken(22),
|
|
43652
43652
|
value: "`",
|
|
@@ -45518,9 +45518,9 @@ var require_lib3 = __commonJS({
|
|
|
45518
45518
|
}
|
|
45519
45519
|
};
|
|
45520
45520
|
var Parser3 = class extends StatementParser {
|
|
45521
|
-
constructor(options,
|
|
45521
|
+
constructor(options, input3, pluginsMap) {
|
|
45522
45522
|
const normalizedOptions = getOptions(options);
|
|
45523
|
-
super(normalizedOptions,
|
|
45523
|
+
super(normalizedOptions, input3);
|
|
45524
45524
|
this.options = normalizedOptions;
|
|
45525
45525
|
this.initializeScopes();
|
|
45526
45526
|
this.plugins = pluginsMap;
|
|
@@ -45586,13 +45586,13 @@ var require_lib3 = __commonJS({
|
|
|
45586
45586
|
return result;
|
|
45587
45587
|
}
|
|
45588
45588
|
};
|
|
45589
|
-
function parse7(
|
|
45589
|
+
function parse7(input3, options) {
|
|
45590
45590
|
var _options;
|
|
45591
45591
|
if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
|
|
45592
45592
|
options = Object.assign({}, options);
|
|
45593
45593
|
try {
|
|
45594
45594
|
options.sourceType = "module";
|
|
45595
|
-
const parser2 = getParser(options,
|
|
45595
|
+
const parser2 = getParser(options, input3);
|
|
45596
45596
|
const ast = parser2.parse();
|
|
45597
45597
|
if (parser2.sawUnambiguousESM) {
|
|
45598
45598
|
return ast;
|
|
@@ -45600,7 +45600,7 @@ var require_lib3 = __commonJS({
|
|
|
45600
45600
|
if (parser2.ambiguousScriptDifferentAst) {
|
|
45601
45601
|
try {
|
|
45602
45602
|
options.sourceType = "script";
|
|
45603
|
-
return getParser(options,
|
|
45603
|
+
return getParser(options, input3).parse();
|
|
45604
45604
|
} catch (_unused) {
|
|
45605
45605
|
}
|
|
45606
45606
|
} else {
|
|
@@ -45610,17 +45610,17 @@ var require_lib3 = __commonJS({
|
|
|
45610
45610
|
} catch (moduleError) {
|
|
45611
45611
|
try {
|
|
45612
45612
|
options.sourceType = "script";
|
|
45613
|
-
return getParser(options,
|
|
45613
|
+
return getParser(options, input3).parse();
|
|
45614
45614
|
} catch (_unused2) {
|
|
45615
45615
|
}
|
|
45616
45616
|
throw moduleError;
|
|
45617
45617
|
}
|
|
45618
45618
|
} else {
|
|
45619
|
-
return getParser(options,
|
|
45619
|
+
return getParser(options, input3).parse();
|
|
45620
45620
|
}
|
|
45621
45621
|
}
|
|
45622
|
-
function parseExpression(
|
|
45623
|
-
const parser2 = getParser(options,
|
|
45622
|
+
function parseExpression(input3, options) {
|
|
45623
|
+
const parser2 = getParser(options, input3);
|
|
45624
45624
|
if (parser2.options.strictMode) {
|
|
45625
45625
|
parser2.state.strict = true;
|
|
45626
45626
|
}
|
|
@@ -45634,7 +45634,7 @@ var require_lib3 = __commonJS({
|
|
|
45634
45634
|
return tokenTypes2;
|
|
45635
45635
|
}
|
|
45636
45636
|
var tokTypes = generateExportedTokenTypes(tt);
|
|
45637
|
-
function getParser(options,
|
|
45637
|
+
function getParser(options, input3) {
|
|
45638
45638
|
let cls = Parser3;
|
|
45639
45639
|
const pluginsMap = /* @__PURE__ */ new Map();
|
|
45640
45640
|
if (options != null && options.plugins) {
|
|
@@ -45652,7 +45652,7 @@ var require_lib3 = __commonJS({
|
|
|
45652
45652
|
validatePlugins(pluginsMap);
|
|
45653
45653
|
cls = getParserClass(pluginsMap);
|
|
45654
45654
|
}
|
|
45655
|
-
return new cls(options,
|
|
45655
|
+
return new cls(options, input3, pluginsMap);
|
|
45656
45656
|
}
|
|
45657
45657
|
var parserClassCache = /* @__PURE__ */ new Map();
|
|
45658
45658
|
function getParserClass(pluginsMap) {
|
|
@@ -49623,7 +49623,7 @@ var require_lib5 = __commonJS({
|
|
|
49623
49623
|
dec: (ch) => ch >= 48 && ch <= 57,
|
|
49624
49624
|
hex: (ch) => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
|
|
49625
49625
|
};
|
|
49626
|
-
function readStringContents(type,
|
|
49626
|
+
function readStringContents(type, input3, pos, lineStart, curLine, errors2) {
|
|
49627
49627
|
const initialPos = pos;
|
|
49628
49628
|
const initialLineStart = lineStart;
|
|
49629
49629
|
const initialCurLine = curLine;
|
|
@@ -49632,21 +49632,21 @@ var require_lib5 = __commonJS({
|
|
|
49632
49632
|
let chunkStart = pos;
|
|
49633
49633
|
const {
|
|
49634
49634
|
length
|
|
49635
|
-
} =
|
|
49635
|
+
} = input3;
|
|
49636
49636
|
for (; ; ) {
|
|
49637
49637
|
if (pos >= length) {
|
|
49638
49638
|
errors2.unterminated(initialPos, initialLineStart, initialCurLine);
|
|
49639
|
-
out +=
|
|
49639
|
+
out += input3.slice(chunkStart, pos);
|
|
49640
49640
|
break;
|
|
49641
49641
|
}
|
|
49642
|
-
const ch =
|
|
49643
|
-
if (isStringEnd(type, ch,
|
|
49644
|
-
out +=
|
|
49642
|
+
const ch = input3.charCodeAt(pos);
|
|
49643
|
+
if (isStringEnd(type, ch, input3, pos)) {
|
|
49644
|
+
out += input3.slice(chunkStart, pos);
|
|
49645
49645
|
break;
|
|
49646
49646
|
}
|
|
49647
49647
|
if (ch === 92) {
|
|
49648
|
-
out +=
|
|
49649
|
-
const res = readEscapedChar(
|
|
49648
|
+
out += input3.slice(chunkStart, pos);
|
|
49649
|
+
const res = readEscapedChar(input3, pos, lineStart, curLine, type === "template", errors2);
|
|
49650
49650
|
if (res.ch === null && !firstInvalidLoc) {
|
|
49651
49651
|
firstInvalidLoc = {
|
|
49652
49652
|
pos,
|
|
@@ -49668,9 +49668,9 @@ var require_lib5 = __commonJS({
|
|
|
49668
49668
|
lineStart = pos;
|
|
49669
49669
|
} else if (ch === 10 || ch === 13) {
|
|
49670
49670
|
if (type === "template") {
|
|
49671
|
-
out +=
|
|
49671
|
+
out += input3.slice(chunkStart, pos) + "\n";
|
|
49672
49672
|
++pos;
|
|
49673
|
-
if (ch === 13 &&
|
|
49673
|
+
if (ch === 13 && input3.charCodeAt(pos) === 10) {
|
|
49674
49674
|
++pos;
|
|
49675
49675
|
}
|
|
49676
49676
|
++curLine;
|
|
@@ -49691,13 +49691,13 @@ var require_lib5 = __commonJS({
|
|
|
49691
49691
|
containsInvalid: !!firstInvalidLoc
|
|
49692
49692
|
};
|
|
49693
49693
|
}
|
|
49694
|
-
function isStringEnd(type, ch,
|
|
49694
|
+
function isStringEnd(type, ch, input3, pos) {
|
|
49695
49695
|
if (type === "template") {
|
|
49696
|
-
return ch === 96 || ch === 36 &&
|
|
49696
|
+
return ch === 96 || ch === 36 && input3.charCodeAt(pos + 1) === 123;
|
|
49697
49697
|
}
|
|
49698
49698
|
return ch === (type === "double" ? 34 : 39);
|
|
49699
49699
|
}
|
|
49700
|
-
function readEscapedChar(
|
|
49700
|
+
function readEscapedChar(input3, pos, lineStart, curLine, inTemplate, errors2) {
|
|
49701
49701
|
const throwOnInvalid = !inTemplate;
|
|
49702
49702
|
pos++;
|
|
49703
49703
|
const res = (ch2) => ({
|
|
@@ -49706,7 +49706,7 @@ var require_lib5 = __commonJS({
|
|
|
49706
49706
|
lineStart,
|
|
49707
49707
|
curLine
|
|
49708
49708
|
});
|
|
49709
|
-
const ch =
|
|
49709
|
+
const ch = input3.charCodeAt(pos++);
|
|
49710
49710
|
switch (ch) {
|
|
49711
49711
|
case 110:
|
|
49712
49712
|
return res("\n");
|
|
@@ -49717,7 +49717,7 @@ var require_lib5 = __commonJS({
|
|
|
49717
49717
|
({
|
|
49718
49718
|
code,
|
|
49719
49719
|
pos
|
|
49720
|
-
} = readHexChar(
|
|
49720
|
+
} = readHexChar(input3, pos, lineStart, curLine, 2, false, throwOnInvalid, errors2));
|
|
49721
49721
|
return res(code === null ? null : String.fromCharCode(code));
|
|
49722
49722
|
}
|
|
49723
49723
|
case 117: {
|
|
@@ -49725,7 +49725,7 @@ var require_lib5 = __commonJS({
|
|
|
49725
49725
|
({
|
|
49726
49726
|
code,
|
|
49727
49727
|
pos
|
|
49728
|
-
} = readCodePoint(
|
|
49728
|
+
} = readCodePoint(input3, pos, lineStart, curLine, throwOnInvalid, errors2));
|
|
49729
49729
|
return res(code === null ? null : String.fromCodePoint(code));
|
|
49730
49730
|
}
|
|
49731
49731
|
case 116:
|
|
@@ -49737,7 +49737,7 @@ var require_lib5 = __commonJS({
|
|
|
49737
49737
|
case 102:
|
|
49738
49738
|
return res("\f");
|
|
49739
49739
|
case 13:
|
|
49740
|
-
if (
|
|
49740
|
+
if (input3.charCodeAt(pos) === 10) {
|
|
49741
49741
|
++pos;
|
|
49742
49742
|
}
|
|
49743
49743
|
case 10:
|
|
@@ -49756,7 +49756,7 @@ var require_lib5 = __commonJS({
|
|
|
49756
49756
|
default:
|
|
49757
49757
|
if (ch >= 48 && ch <= 55) {
|
|
49758
49758
|
const startPos = pos - 1;
|
|
49759
|
-
const match = /^[0-7]+/.exec(
|
|
49759
|
+
const match = /^[0-7]+/.exec(input3.slice(startPos, pos + 2));
|
|
49760
49760
|
let octalStr = match[0];
|
|
49761
49761
|
let octal = parseInt(octalStr, 8);
|
|
49762
49762
|
if (octal > 255) {
|
|
@@ -49764,7 +49764,7 @@ var require_lib5 = __commonJS({
|
|
|
49764
49764
|
octal = parseInt(octalStr, 8);
|
|
49765
49765
|
}
|
|
49766
49766
|
pos += octalStr.length - 1;
|
|
49767
|
-
const next2 =
|
|
49767
|
+
const next2 = input3.charCodeAt(pos);
|
|
49768
49768
|
if (octalStr !== "0" || next2 === 56 || next2 === 57) {
|
|
49769
49769
|
if (inTemplate) {
|
|
49770
49770
|
return res(null);
|
|
@@ -49777,13 +49777,13 @@ var require_lib5 = __commonJS({
|
|
|
49777
49777
|
return res(String.fromCharCode(ch));
|
|
49778
49778
|
}
|
|
49779
49779
|
}
|
|
49780
|
-
function readHexChar(
|
|
49780
|
+
function readHexChar(input3, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors2) {
|
|
49781
49781
|
const initialPos = pos;
|
|
49782
49782
|
let n;
|
|
49783
49783
|
({
|
|
49784
49784
|
n,
|
|
49785
49785
|
pos
|
|
49786
|
-
} = readInt(
|
|
49786
|
+
} = readInt(input3, pos, lineStart, curLine, 16, len, forceLen, false, errors2, !throwOnInvalid));
|
|
49787
49787
|
if (n === null) {
|
|
49788
49788
|
if (throwOnInvalid) {
|
|
49789
49789
|
errors2.invalidEscapeSequence(initialPos, lineStart, curLine);
|
|
@@ -49796,18 +49796,18 @@ var require_lib5 = __commonJS({
|
|
|
49796
49796
|
pos
|
|
49797
49797
|
};
|
|
49798
49798
|
}
|
|
49799
|
-
function readInt(
|
|
49799
|
+
function readInt(input3, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors2, bailOnError) {
|
|
49800
49800
|
const start = pos;
|
|
49801
49801
|
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
|
|
49802
49802
|
const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
|
|
49803
49803
|
let invalid = false;
|
|
49804
49804
|
let total = 0;
|
|
49805
49805
|
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
|
|
49806
|
-
const code =
|
|
49806
|
+
const code = input3.charCodeAt(pos);
|
|
49807
49807
|
let val2;
|
|
49808
49808
|
if (code === 95 && allowNumSeparator !== "bail") {
|
|
49809
|
-
const prev2 =
|
|
49810
|
-
const next2 =
|
|
49809
|
+
const prev2 = input3.charCodeAt(pos - 1);
|
|
49810
|
+
const next2 = input3.charCodeAt(pos + 1);
|
|
49811
49811
|
if (!allowNumSeparator) {
|
|
49812
49812
|
if (bailOnError) return {
|
|
49813
49813
|
n: null,
|
|
@@ -49862,15 +49862,15 @@ var require_lib5 = __commonJS({
|
|
|
49862
49862
|
pos
|
|
49863
49863
|
};
|
|
49864
49864
|
}
|
|
49865
|
-
function readCodePoint(
|
|
49866
|
-
const ch =
|
|
49865
|
+
function readCodePoint(input3, pos, lineStart, curLine, throwOnInvalid, errors2) {
|
|
49866
|
+
const ch = input3.charCodeAt(pos);
|
|
49867
49867
|
let code;
|
|
49868
49868
|
if (ch === 123) {
|
|
49869
49869
|
++pos;
|
|
49870
49870
|
({
|
|
49871
49871
|
code,
|
|
49872
49872
|
pos
|
|
49873
|
-
} = readHexChar(
|
|
49873
|
+
} = readHexChar(input3, pos, lineStart, curLine, input3.indexOf("}", pos) - pos, true, throwOnInvalid, errors2));
|
|
49874
49874
|
++pos;
|
|
49875
49875
|
if (code !== null && code > 1114111) {
|
|
49876
49876
|
if (throwOnInvalid) {
|
|
@@ -49886,7 +49886,7 @@ var require_lib5 = __commonJS({
|
|
|
49886
49886
|
({
|
|
49887
49887
|
code,
|
|
49888
49888
|
pos
|
|
49889
|
-
} = readHexChar(
|
|
49889
|
+
} = readHexChar(input3, pos, lineStart, curLine, 4, false, throwOnInvalid, errors2));
|
|
49890
49890
|
}
|
|
49891
49891
|
return {
|
|
49892
49892
|
code,
|
|
@@ -58792,10 +58792,10 @@ var require_toIdentifier = __commonJS({
|
|
|
58792
58792
|
exports.default = toIdentifier;
|
|
58793
58793
|
var _isValidIdentifier = require_isValidIdentifier();
|
|
58794
58794
|
var _helperValidatorIdentifier = require_lib4();
|
|
58795
|
-
function toIdentifier(
|
|
58796
|
-
|
|
58795
|
+
function toIdentifier(input3) {
|
|
58796
|
+
input3 = input3 + "";
|
|
58797
58797
|
let name = "";
|
|
58798
|
-
for (const c of
|
|
58798
|
+
for (const c of input3) {
|
|
58799
58799
|
name += (0, _helperValidatorIdentifier.isIdentifierChar)(c.codePointAt(0)) ? c : "-";
|
|
58800
58800
|
}
|
|
58801
58801
|
name = name.replace(/^[-0-9]+/, "");
|
|
@@ -62524,9 +62524,9 @@ var require_sourcemap_codec_umd = __commonJS({
|
|
|
62524
62524
|
}
|
|
62525
62525
|
};
|
|
62526
62526
|
var EMPTY = [];
|
|
62527
|
-
function decodeOriginalScopes(
|
|
62528
|
-
const { length } =
|
|
62529
|
-
const reader = new StringReader(
|
|
62527
|
+
function decodeOriginalScopes(input3) {
|
|
62528
|
+
const { length } = input3;
|
|
62529
|
+
const reader = new StringReader(input3);
|
|
62530
62530
|
const scopes = [];
|
|
62531
62531
|
const stack = [];
|
|
62532
62532
|
let line = 0;
|
|
@@ -62590,9 +62590,9 @@ var require_sourcemap_codec_umd = __commonJS({
|
|
|
62590
62590
|
encodeInteger(writer, endColumn, 0);
|
|
62591
62591
|
return index2;
|
|
62592
62592
|
}
|
|
62593
|
-
function decodeGeneratedRanges(
|
|
62594
|
-
const { length } =
|
|
62595
|
-
const reader = new StringReader(
|
|
62593
|
+
function decodeGeneratedRanges(input3) {
|
|
62594
|
+
const { length } = input3;
|
|
62595
|
+
const reader = new StringReader(input3);
|
|
62596
62596
|
const ranges = [];
|
|
62597
62597
|
const stack = [];
|
|
62598
62598
|
let genLine = 0;
|
|
@@ -62853,27 +62853,27 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
62853
62853
|
const schemeRegex = /^[\w+.-]+:\/\//;
|
|
62854
62854
|
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
62855
62855
|
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
62856
|
-
function isAbsoluteUrl(
|
|
62857
|
-
return schemeRegex.test(
|
|
62856
|
+
function isAbsoluteUrl(input3) {
|
|
62857
|
+
return schemeRegex.test(input3);
|
|
62858
62858
|
}
|
|
62859
|
-
function isSchemeRelativeUrl(
|
|
62860
|
-
return
|
|
62859
|
+
function isSchemeRelativeUrl(input3) {
|
|
62860
|
+
return input3.startsWith("//");
|
|
62861
62861
|
}
|
|
62862
|
-
function isAbsolutePath(
|
|
62863
|
-
return
|
|
62862
|
+
function isAbsolutePath(input3) {
|
|
62863
|
+
return input3.startsWith("/");
|
|
62864
62864
|
}
|
|
62865
|
-
function isFileUrl(
|
|
62866
|
-
return
|
|
62865
|
+
function isFileUrl(input3) {
|
|
62866
|
+
return input3.startsWith("file:");
|
|
62867
62867
|
}
|
|
62868
|
-
function isRelative(
|
|
62869
|
-
return /^[.?#]/.test(
|
|
62868
|
+
function isRelative(input3) {
|
|
62869
|
+
return /^[.?#]/.test(input3);
|
|
62870
62870
|
}
|
|
62871
|
-
function parseAbsoluteUrl(
|
|
62872
|
-
const match = urlRegex.exec(
|
|
62871
|
+
function parseAbsoluteUrl(input3) {
|
|
62872
|
+
const match = urlRegex.exec(input3);
|
|
62873
62873
|
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
62874
62874
|
}
|
|
62875
|
-
function parseFileUrl(
|
|
62876
|
-
const match = fileRegex.exec(
|
|
62875
|
+
function parseFileUrl(input3) {
|
|
62876
|
+
const match = fileRegex.exec(input3);
|
|
62877
62877
|
const path2 = match[2];
|
|
62878
62878
|
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path2) ? path2 : "/" + path2, match[3] || "", match[4] || "");
|
|
62879
62879
|
}
|
|
@@ -62889,28 +62889,28 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
62889
62889
|
type: 7
|
|
62890
62890
|
};
|
|
62891
62891
|
}
|
|
62892
|
-
function parseUrl(
|
|
62893
|
-
if (isSchemeRelativeUrl(
|
|
62894
|
-
const url2 = parseAbsoluteUrl("http:" +
|
|
62892
|
+
function parseUrl(input3) {
|
|
62893
|
+
if (isSchemeRelativeUrl(input3)) {
|
|
62894
|
+
const url2 = parseAbsoluteUrl("http:" + input3);
|
|
62895
62895
|
url2.scheme = "";
|
|
62896
62896
|
url2.type = 6;
|
|
62897
62897
|
return url2;
|
|
62898
62898
|
}
|
|
62899
|
-
if (isAbsolutePath(
|
|
62900
|
-
const url2 = parseAbsoluteUrl("http://foo.com" +
|
|
62899
|
+
if (isAbsolutePath(input3)) {
|
|
62900
|
+
const url2 = parseAbsoluteUrl("http://foo.com" + input3);
|
|
62901
62901
|
url2.scheme = "";
|
|
62902
62902
|
url2.host = "";
|
|
62903
62903
|
url2.type = 5;
|
|
62904
62904
|
return url2;
|
|
62905
62905
|
}
|
|
62906
|
-
if (isFileUrl(
|
|
62907
|
-
return parseFileUrl(
|
|
62908
|
-
if (isAbsoluteUrl(
|
|
62909
|
-
return parseAbsoluteUrl(
|
|
62910
|
-
const url = parseAbsoluteUrl("http://foo.com/" +
|
|
62906
|
+
if (isFileUrl(input3))
|
|
62907
|
+
return parseFileUrl(input3);
|
|
62908
|
+
if (isAbsoluteUrl(input3))
|
|
62909
|
+
return parseAbsoluteUrl(input3);
|
|
62910
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input3);
|
|
62911
62911
|
url.scheme = "";
|
|
62912
62912
|
url.host = "";
|
|
62913
|
-
url.type =
|
|
62913
|
+
url.type = input3 ? input3.startsWith("?") ? 3 : input3.startsWith("#") ? 2 : 4 : 1;
|
|
62914
62914
|
return url;
|
|
62915
62915
|
}
|
|
62916
62916
|
function stripPathFilename(path2) {
|
|
@@ -62964,10 +62964,10 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
62964
62964
|
}
|
|
62965
62965
|
url.path = path2;
|
|
62966
62966
|
}
|
|
62967
|
-
function resolve4(
|
|
62968
|
-
if (!
|
|
62967
|
+
function resolve4(input3, base) {
|
|
62968
|
+
if (!input3 && !base)
|
|
62969
62969
|
return "";
|
|
62970
|
-
const url = parseUrl(
|
|
62970
|
+
const url = parseUrl(input3);
|
|
62971
62971
|
let inputType = url.type;
|
|
62972
62972
|
if (base && inputType !== 7) {
|
|
62973
62973
|
const baseUrl = parseUrl(base);
|
|
@@ -63006,7 +63006,7 @@ var require_resolve_uri_umd = __commonJS({
|
|
|
63006
63006
|
const path2 = url.path.slice(1);
|
|
63007
63007
|
if (!path2)
|
|
63008
63008
|
return queryHash || ".";
|
|
63009
|
-
if (isRelative(base ||
|
|
63009
|
+
if (isRelative(base || input3) && !isRelative(path2)) {
|
|
63010
63010
|
return "./" + path2 + queryHash;
|
|
63011
63011
|
}
|
|
63012
63012
|
return path2 + queryHash;
|
|
@@ -63274,8 +63274,8 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
63274
63274
|
};
|
|
63275
63275
|
return presortedDecodedMap(joined);
|
|
63276
63276
|
};
|
|
63277
|
-
function recurse(
|
|
63278
|
-
const { sections } =
|
|
63277
|
+
function recurse(input3, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
|
|
63278
|
+
const { sections } = input3;
|
|
63279
63279
|
for (let i = 0; i < sections.length; i++) {
|
|
63280
63280
|
const { map: map2, offset } = sections[i];
|
|
63281
63281
|
let sl = stopLine;
|
|
@@ -63304,8 +63304,8 @@ var require_trace_mapping_umd = __commonJS({
|
|
|
63304
63304
|
);
|
|
63305
63305
|
}
|
|
63306
63306
|
}
|
|
63307
|
-
function addSection(
|
|
63308
|
-
const parsed = parse7(
|
|
63307
|
+
function addSection(input3, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
|
|
63308
|
+
const parsed = parse7(input3);
|
|
63309
63309
|
if ("sections" in parsed) return recurse(...arguments);
|
|
63310
63310
|
const map2 = new TraceMap(parsed, mapUrl);
|
|
63311
63311
|
const sourcesOffset = sources.length;
|
|
@@ -63782,8 +63782,8 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
63782
63782
|
mappings: (0, import_sourcemap_codec.encode)(decoded.mappings)
|
|
63783
63783
|
});
|
|
63784
63784
|
}
|
|
63785
|
-
function fromMap(
|
|
63786
|
-
const map2 = new import_trace_mapping.TraceMap(
|
|
63785
|
+
function fromMap(input3) {
|
|
63786
|
+
const map2 = new import_trace_mapping.TraceMap(input3);
|
|
63787
63787
|
const gen = new GenMapping({ file: map2.file, sourceRoot: map2.sourceRoot });
|
|
63788
63788
|
putAll(cast2(gen)._names, map2.names);
|
|
63789
63789
|
putAll(cast2(gen)._sources, map2.sources);
|
|
@@ -70131,8 +70131,8 @@ var require_picocolors = __commonJS({
|
|
|
70131
70131
|
var argv = p.argv || [];
|
|
70132
70132
|
var env = p.env || {};
|
|
70133
70133
|
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
70134
|
-
var formatter = (open, close, replace = open) => (
|
|
70135
|
-
let string = "" +
|
|
70134
|
+
var formatter = (open, close, replace = open) => (input3) => {
|
|
70135
|
+
let string = "" + input3, index2 = string.indexOf(close, open.length);
|
|
70136
70136
|
return ~index2 ? open + replaceClose(string, close, replace, index2) + close : open + string + close;
|
|
70137
70137
|
};
|
|
70138
70138
|
var replaceClose = (string, close, replace, index2) => {
|
|
@@ -74524,19 +74524,412 @@ import { Command as Command4 } from "commander";
|
|
|
74524
74524
|
// src/commands/auth/index.ts
|
|
74525
74525
|
init_esm_shims();
|
|
74526
74526
|
|
|
74527
|
-
// src/commands/auth/
|
|
74527
|
+
// src/commands/auth/setup.ts
|
|
74528
74528
|
init_esm_shims();
|
|
74529
|
-
import
|
|
74530
|
-
import
|
|
74529
|
+
import { execSync as execSync3 } from "child_process";
|
|
74530
|
+
import { appendFileSync, existsSync as existsSync2 } from "fs";
|
|
74531
|
+
import { confirm, input, password, select } from "@inquirer/prompts";
|
|
74532
|
+
|
|
74533
|
+
// src/lib/keychain.ts
|
|
74534
|
+
init_esm_shims();
|
|
74535
|
+
import { execSync } from "child_process";
|
|
74536
|
+
import { existsSync, readFileSync } from "fs";
|
|
74537
|
+
import { homedir } from "os";
|
|
74538
|
+
import { join } from "path";
|
|
74539
|
+
function detectPlatform() {
|
|
74540
|
+
switch (process.platform) {
|
|
74541
|
+
case "darwin":
|
|
74542
|
+
return "macos";
|
|
74543
|
+
case "linux":
|
|
74544
|
+
return "linux";
|
|
74545
|
+
default:
|
|
74546
|
+
return "unsupported";
|
|
74547
|
+
}
|
|
74548
|
+
}
|
|
74549
|
+
function isKeychainAvailable() {
|
|
74550
|
+
const platform = detectPlatform();
|
|
74551
|
+
try {
|
|
74552
|
+
if (platform === "macos") {
|
|
74553
|
+
execSync("which security", { stdio: "pipe" });
|
|
74554
|
+
return true;
|
|
74555
|
+
}
|
|
74556
|
+
if (platform === "linux") {
|
|
74557
|
+
execSync("which secret-tool", { stdio: "pipe" });
|
|
74558
|
+
return true;
|
|
74559
|
+
}
|
|
74560
|
+
return false;
|
|
74561
|
+
} catch {
|
|
74562
|
+
return false;
|
|
74563
|
+
}
|
|
74564
|
+
}
|
|
74565
|
+
function storeInKeychain(key, value) {
|
|
74566
|
+
const platform = detectPlatform();
|
|
74567
|
+
if (platform === "macos") {
|
|
74568
|
+
execSync(
|
|
74569
|
+
`security add-generic-password -a "$USER" -s ${JSON.stringify(key)} -w ${JSON.stringify(value)} -U`,
|
|
74570
|
+
{ stdio: "pipe" }
|
|
74571
|
+
);
|
|
74572
|
+
return;
|
|
74573
|
+
}
|
|
74574
|
+
if (platform === "linux") {
|
|
74575
|
+
execSync(
|
|
74576
|
+
`echo -n ${JSON.stringify(value)} | secret-tool store --label ${JSON.stringify(key)} service skill-cli key ${JSON.stringify(key)}`,
|
|
74577
|
+
{ stdio: "pipe" }
|
|
74578
|
+
);
|
|
74579
|
+
return;
|
|
74580
|
+
}
|
|
74581
|
+
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
74582
|
+
}
|
|
74583
|
+
function readFromKeychain(key) {
|
|
74584
|
+
const platform = detectPlatform();
|
|
74585
|
+
try {
|
|
74586
|
+
if (platform === "macos") {
|
|
74587
|
+
return execSync(
|
|
74588
|
+
`security find-generic-password -a "$USER" -s ${JSON.stringify(key)} -w`,
|
|
74589
|
+
{ stdio: "pipe" }
|
|
74590
|
+
).toString().trim();
|
|
74591
|
+
}
|
|
74592
|
+
if (platform === "linux") {
|
|
74593
|
+
return execSync(
|
|
74594
|
+
`secret-tool lookup service skill-cli key ${JSON.stringify(key)}`,
|
|
74595
|
+
{ stdio: "pipe" }
|
|
74596
|
+
).toString().trim();
|
|
74597
|
+
}
|
|
74598
|
+
return null;
|
|
74599
|
+
} catch {
|
|
74600
|
+
return null;
|
|
74601
|
+
}
|
|
74602
|
+
}
|
|
74603
|
+
function getShellProfileExportLine(key) {
|
|
74604
|
+
const platform = detectPlatform();
|
|
74605
|
+
if (platform === "macos") {
|
|
74606
|
+
return `export ${key}=$(security find-generic-password -a "$USER" -s "${key}" -w 2>/dev/null)`;
|
|
74607
|
+
}
|
|
74608
|
+
if (platform === "linux") {
|
|
74609
|
+
return `export ${key}=$(secret-tool lookup service skill-cli key "${key}" 2>/dev/null)`;
|
|
74610
|
+
}
|
|
74611
|
+
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
74612
|
+
}
|
|
74613
|
+
function detectShellProfile() {
|
|
74614
|
+
const shell = process.env.SHELL || "";
|
|
74615
|
+
const home = homedir();
|
|
74616
|
+
if (shell.includes("zsh")) {
|
|
74617
|
+
return join(home, ".zshrc");
|
|
74618
|
+
}
|
|
74619
|
+
if (shell.includes("bash")) {
|
|
74620
|
+
const bashrc = join(home, ".bashrc");
|
|
74621
|
+
const bashProfile = join(home, ".bash_profile");
|
|
74622
|
+
if (existsSync(bashrc)) return bashrc;
|
|
74623
|
+
if (existsSync(bashProfile)) return bashProfile;
|
|
74624
|
+
return bashrc;
|
|
74625
|
+
}
|
|
74626
|
+
return null;
|
|
74627
|
+
}
|
|
74628
|
+
function shellProfileHasExport(profilePath, key) {
|
|
74629
|
+
try {
|
|
74630
|
+
const content = readFileSync(profilePath, "utf-8");
|
|
74631
|
+
return content.includes(`export ${key}=`);
|
|
74632
|
+
} catch {
|
|
74633
|
+
return false;
|
|
74634
|
+
}
|
|
74635
|
+
}
|
|
74531
74636
|
|
|
74532
74637
|
// src/lib/onepassword.ts
|
|
74533
74638
|
init_esm_shims();
|
|
74534
|
-
import { execSync, spawn } from "child_process";
|
|
74639
|
+
import { execSync as execSync2, spawn } from "child_process";
|
|
74640
|
+
var OP_ACCOUNT = "egghead.1password.com";
|
|
74641
|
+
var OP_VAULT_ID = "u3ujzar6l3nahlahsuzfvg7vcq";
|
|
74642
|
+
var OP_AGE_KEY_ITEM_ID = "lxndka3exn475vqdiqq5heg2wm";
|
|
74643
|
+
var OP_AGE_KEY_LINK = `https://start.1password.com/open/i?a=GCTJE4MRGFHKRAYXCEXKZKCEFU&v=${OP_VAULT_ID}&i=${OP_AGE_KEY_ITEM_ID}&h=${OP_ACCOUNT}`;
|
|
74644
|
+
function isOpCliAvailable() {
|
|
74645
|
+
try {
|
|
74646
|
+
execSync2("which op", { stdio: "pipe" });
|
|
74647
|
+
return true;
|
|
74648
|
+
} catch {
|
|
74649
|
+
return false;
|
|
74650
|
+
}
|
|
74651
|
+
}
|
|
74652
|
+
function isOpSignedIn() {
|
|
74653
|
+
try {
|
|
74654
|
+
execSync2(`op account get --account ${OP_ACCOUNT}`, {
|
|
74655
|
+
stdio: "pipe",
|
|
74656
|
+
timeout: 5e3
|
|
74657
|
+
});
|
|
74658
|
+
return true;
|
|
74659
|
+
} catch {
|
|
74660
|
+
return false;
|
|
74661
|
+
}
|
|
74662
|
+
}
|
|
74663
|
+
function fetchFromOp(itemId, field) {
|
|
74664
|
+
try {
|
|
74665
|
+
const result = execSync2(
|
|
74666
|
+
`op item get ${itemId} --vault ${OP_VAULT_ID} --account ${OP_ACCOUNT} --fields ${field} --reveal`,
|
|
74667
|
+
{ stdio: "pipe", timeout: 15e3 }
|
|
74668
|
+
);
|
|
74669
|
+
const value = result.toString().trim();
|
|
74670
|
+
return value || null;
|
|
74671
|
+
} catch {
|
|
74672
|
+
return null;
|
|
74673
|
+
}
|
|
74674
|
+
}
|
|
74675
|
+
function getOpInstallInstructions() {
|
|
74676
|
+
switch (process.platform) {
|
|
74677
|
+
case "darwin":
|
|
74678
|
+
return "brew install 1password-cli";
|
|
74679
|
+
case "linux":
|
|
74680
|
+
return "https://developer.1password.com/docs/cli/get-started/#install";
|
|
74681
|
+
default:
|
|
74682
|
+
return "https://developer.1password.com/docs/cli/get-started/#install";
|
|
74683
|
+
}
|
|
74684
|
+
}
|
|
74535
74685
|
function isServiceAccountConfigured() {
|
|
74536
74686
|
return Boolean(process.env.OP_SERVICE_ACCOUNT_TOKEN);
|
|
74537
74687
|
}
|
|
74538
74688
|
|
|
74689
|
+
// src/commands/auth/setup.ts
|
|
74690
|
+
var KEY_NAME = "AGE_SECRET_KEY";
|
|
74691
|
+
var KEY_PREFIX = "AGE-SECRET-KEY-1";
|
|
74692
|
+
function validateAgeKey(value) {
|
|
74693
|
+
const trimmed = value.trim();
|
|
74694
|
+
if (!trimmed) return "Key cannot be empty";
|
|
74695
|
+
if (!trimmed.startsWith(KEY_PREFIX)) {
|
|
74696
|
+
return `Invalid format \u2014 must start with ${KEY_PREFIX}`;
|
|
74697
|
+
}
|
|
74698
|
+
return true;
|
|
74699
|
+
}
|
|
74700
|
+
function registerSetupCommand(auth) {
|
|
74701
|
+
auth.command("setup").description("Store AGE_SECRET_KEY in OS keychain and configure shell").option("--json", "Output result as JSON").action(async (options) => {
|
|
74702
|
+
try {
|
|
74703
|
+
await runSetup(options);
|
|
74704
|
+
} catch (error) {
|
|
74705
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
74706
|
+
if (options.json) {
|
|
74707
|
+
console.error(JSON.stringify({ success: false, error: message }));
|
|
74708
|
+
} else {
|
|
74709
|
+
console.error(`Error: ${message}`);
|
|
74710
|
+
}
|
|
74711
|
+
process.exit(1);
|
|
74712
|
+
}
|
|
74713
|
+
});
|
|
74714
|
+
}
|
|
74715
|
+
async function runSetup(options) {
|
|
74716
|
+
const platform = detectPlatform();
|
|
74717
|
+
if (platform === "unsupported") {
|
|
74718
|
+
throw new Error(
|
|
74719
|
+
`Unsupported platform: ${process.platform}. Only macOS and Linux are supported.`
|
|
74720
|
+
);
|
|
74721
|
+
}
|
|
74722
|
+
if (!isKeychainAvailable()) {
|
|
74723
|
+
const tool5 = platform === "macos" ? "security" : "secret-tool";
|
|
74724
|
+
throw new Error(
|
|
74725
|
+
`Keychain CLI not found: ${tool5}. Install it before running setup.`
|
|
74726
|
+
);
|
|
74727
|
+
}
|
|
74728
|
+
if (!process.stdin.isTTY && !options.json) {
|
|
74729
|
+
throw new Error(
|
|
74730
|
+
"Setup requires an interactive terminal. Use --json for non-interactive mode."
|
|
74731
|
+
);
|
|
74732
|
+
}
|
|
74733
|
+
if (!options.json) {
|
|
74734
|
+
console.log("\nSkill Recordings CLI \u2014 Auth Setup\n");
|
|
74735
|
+
}
|
|
74736
|
+
const existingEnv = process.env[KEY_NAME];
|
|
74737
|
+
const existingKeychain = readFromKeychain(KEY_NAME);
|
|
74738
|
+
if (existingEnv || existingKeychain) {
|
|
74739
|
+
if (!options.json) {
|
|
74740
|
+
if (existingEnv) {
|
|
74741
|
+
console.log(` ${KEY_NAME} is already set in your environment.`);
|
|
74742
|
+
}
|
|
74743
|
+
if (existingKeychain) {
|
|
74744
|
+
console.log(` ${KEY_NAME} is already stored in the keychain.`);
|
|
74745
|
+
}
|
|
74746
|
+
}
|
|
74747
|
+
const overwrite = await confirm({
|
|
74748
|
+
message: "Overwrite existing key?",
|
|
74749
|
+
default: false
|
|
74750
|
+
});
|
|
74751
|
+
if (!overwrite) {
|
|
74752
|
+
if (options.json) {
|
|
74753
|
+
console.log(JSON.stringify({ success: true, skipped: true }));
|
|
74754
|
+
} else {
|
|
74755
|
+
console.log("\nSetup cancelled.");
|
|
74756
|
+
}
|
|
74757
|
+
return;
|
|
74758
|
+
}
|
|
74759
|
+
}
|
|
74760
|
+
const trimmedKey = await obtainKey(options);
|
|
74761
|
+
if (!options.json) {
|
|
74762
|
+
console.log(` \u2713 Valid age key format`);
|
|
74763
|
+
}
|
|
74764
|
+
storeInKeychain(KEY_NAME, trimmedKey);
|
|
74765
|
+
const stored = readFromKeychain(KEY_NAME);
|
|
74766
|
+
if (stored !== trimmedKey) {
|
|
74767
|
+
throw new Error(
|
|
74768
|
+
"Keychain verification failed \u2014 stored value does not match"
|
|
74769
|
+
);
|
|
74770
|
+
}
|
|
74771
|
+
const keychainLabel = platform === "macos" ? "macOS Keychain" : "Linux secret-tool";
|
|
74772
|
+
if (!options.json) {
|
|
74773
|
+
console.log(` \u2713 Stored in ${keychainLabel}`);
|
|
74774
|
+
}
|
|
74775
|
+
let profilePath = detectShellProfile();
|
|
74776
|
+
let profileUpdated = false;
|
|
74777
|
+
if (!profilePath) {
|
|
74778
|
+
if (!options.json) {
|
|
74779
|
+
console.log(
|
|
74780
|
+
`
|
|
74781
|
+
Could not detect shell profile from $SHELL (${process.env.SHELL || "unset"}).`
|
|
74782
|
+
);
|
|
74783
|
+
}
|
|
74784
|
+
profilePath = await input({
|
|
74785
|
+
message: "Path to your shell profile (e.g., ~/.zshrc):",
|
|
74786
|
+
validate: (v) => v.trim().length > 0 || "Path is required"
|
|
74787
|
+
});
|
|
74788
|
+
profilePath = profilePath.replace(/^~/, process.env.HOME || "");
|
|
74789
|
+
}
|
|
74790
|
+
if (profilePath && !shellProfileHasExport(profilePath, KEY_NAME)) {
|
|
74791
|
+
const exportLine = getShellProfileExportLine(KEY_NAME);
|
|
74792
|
+
const comment = platform === "macos" ? "# age encryption key (stored in macOS Keychain)" : "# age encryption key (stored in Linux secret-tool)";
|
|
74793
|
+
appendFileSync(profilePath, `
|
|
74794
|
+
${comment}
|
|
74795
|
+
${exportLine}
|
|
74796
|
+
`);
|
|
74797
|
+
profileUpdated = true;
|
|
74798
|
+
if (!options.json) {
|
|
74799
|
+
console.log(` \u2713 Added export line to ${profilePath}`);
|
|
74800
|
+
}
|
|
74801
|
+
} else if (profilePath) {
|
|
74802
|
+
if (!options.json) {
|
|
74803
|
+
console.log(` \u2713 Export line already in ${profilePath}`);
|
|
74804
|
+
}
|
|
74805
|
+
}
|
|
74806
|
+
let decryptOk = null;
|
|
74807
|
+
const cliDir = findCliDir();
|
|
74808
|
+
if (cliDir) {
|
|
74809
|
+
const encryptedPath = `${cliDir}/.env.encrypted`;
|
|
74810
|
+
if (existsSync2(encryptedPath)) {
|
|
74811
|
+
try {
|
|
74812
|
+
process.env[KEY_NAME] = trimmedKey;
|
|
74813
|
+
execSync3(`rage -d -i - ${JSON.stringify(encryptedPath)}`, {
|
|
74814
|
+
input: trimmedKey,
|
|
74815
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
74816
|
+
});
|
|
74817
|
+
decryptOk = true;
|
|
74818
|
+
if (!options.json) {
|
|
74819
|
+
console.log(` \u2713 Decryption test passed (.env.encrypted)`);
|
|
74820
|
+
}
|
|
74821
|
+
} catch {
|
|
74822
|
+
decryptOk = false;
|
|
74823
|
+
if (!options.json) {
|
|
74824
|
+
console.log(
|
|
74825
|
+
` \u26A0 Decryption test failed \u2014 key may not match .env.encrypted`
|
|
74826
|
+
);
|
|
74827
|
+
}
|
|
74828
|
+
}
|
|
74829
|
+
}
|
|
74830
|
+
}
|
|
74831
|
+
if (options.json) {
|
|
74832
|
+
console.log(
|
|
74833
|
+
JSON.stringify({
|
|
74834
|
+
success: true,
|
|
74835
|
+
keychain: keychainLabel,
|
|
74836
|
+
profilePath,
|
|
74837
|
+
profileUpdated,
|
|
74838
|
+
decryptOk
|
|
74839
|
+
})
|
|
74840
|
+
);
|
|
74841
|
+
} else {
|
|
74842
|
+
console.log(`
|
|
74843
|
+
Done! Restart your shell or run:`);
|
|
74844
|
+
console.log(` source ${profilePath}`);
|
|
74845
|
+
console.log(`
|
|
74846
|
+
Then verify with:`);
|
|
74847
|
+
console.log(` skill auth status
|
|
74848
|
+
`);
|
|
74849
|
+
}
|
|
74850
|
+
}
|
|
74851
|
+
async function obtainKey(options) {
|
|
74852
|
+
const hasOp = isOpCliAvailable();
|
|
74853
|
+
if (hasOp) {
|
|
74854
|
+
if (!options.json) {
|
|
74855
|
+
console.log(" Checking 1Password CLI...");
|
|
74856
|
+
}
|
|
74857
|
+
const signedIn = isOpSignedIn();
|
|
74858
|
+
if (signedIn) {
|
|
74859
|
+
const method = await select({
|
|
74860
|
+
message: "How do you want to provide the key?",
|
|
74861
|
+
choices: [
|
|
74862
|
+
{
|
|
74863
|
+
name: "Fetch from 1Password automatically",
|
|
74864
|
+
value: "auto"
|
|
74865
|
+
},
|
|
74866
|
+
{ name: "Paste manually", value: "manual" }
|
|
74867
|
+
]
|
|
74868
|
+
});
|
|
74869
|
+
if (method === "auto") {
|
|
74870
|
+
if (!options.json) {
|
|
74871
|
+
console.log(" Fetching AGE_SECRET_KEY from 1Password...");
|
|
74872
|
+
}
|
|
74873
|
+
const value = fetchFromOp(OP_AGE_KEY_ITEM_ID, "password");
|
|
74874
|
+
if (value && validateAgeKey(value) === true) {
|
|
74875
|
+
if (!options.json) {
|
|
74876
|
+
console.log(" \u2713 Retrieved from 1Password");
|
|
74877
|
+
}
|
|
74878
|
+
return value;
|
|
74879
|
+
}
|
|
74880
|
+
const alt = fetchFromOp(OP_AGE_KEY_ITEM_ID, "credential");
|
|
74881
|
+
if (alt && validateAgeKey(alt) === true) {
|
|
74882
|
+
if (!options.json) {
|
|
74883
|
+
console.log(" \u2713 Retrieved from 1Password");
|
|
74884
|
+
}
|
|
74885
|
+
return alt;
|
|
74886
|
+
}
|
|
74887
|
+
if (!options.json) {
|
|
74888
|
+
console.log(
|
|
74889
|
+
" \u26A0 Could not auto-fetch key. Falling back to manual paste."
|
|
74890
|
+
);
|
|
74891
|
+
}
|
|
74892
|
+
}
|
|
74893
|
+
} else if (!options.json) {
|
|
74894
|
+
console.log(" 1Password CLI found but not signed in to egghead account.");
|
|
74895
|
+
console.log(" Sign in with: op signin --account egghead.1password.com");
|
|
74896
|
+
console.log("");
|
|
74897
|
+
}
|
|
74898
|
+
} else if (!options.json) {
|
|
74899
|
+
console.log(" 1Password CLI not installed.");
|
|
74900
|
+
console.log(` Install it: ${getOpInstallInstructions()}`);
|
|
74901
|
+
console.log(" (optional \u2014 you can paste the key manually below)\n");
|
|
74902
|
+
}
|
|
74903
|
+
if (!options.json) {
|
|
74904
|
+
console.log(` Get the key from 1Password:`);
|
|
74905
|
+
console.log(` ${OP_AGE_KEY_LINK}
|
|
74906
|
+
`);
|
|
74907
|
+
}
|
|
74908
|
+
const key = await password({
|
|
74909
|
+
message: `Paste your ${KEY_NAME}:`,
|
|
74910
|
+
mask: "*",
|
|
74911
|
+
validate: validateAgeKey
|
|
74912
|
+
});
|
|
74913
|
+
return key.trim();
|
|
74914
|
+
}
|
|
74915
|
+
function findCliDir() {
|
|
74916
|
+
const candidates = [
|
|
74917
|
+
process.cwd(),
|
|
74918
|
+
new URL("../../..", import.meta.url).pathname
|
|
74919
|
+
];
|
|
74920
|
+
for (const dir of candidates) {
|
|
74921
|
+
if (existsSync2(`${dir}/.env.encrypted`)) {
|
|
74922
|
+
return dir;
|
|
74923
|
+
}
|
|
74924
|
+
}
|
|
74925
|
+
return null;
|
|
74926
|
+
}
|
|
74927
|
+
|
|
74539
74928
|
// src/commands/auth/status.ts
|
|
74929
|
+
init_esm_shims();
|
|
74930
|
+
import fs from "fs/promises";
|
|
74931
|
+
import path from "path";
|
|
74932
|
+
var KEY_NAME2 = "AGE_SECRET_KEY";
|
|
74540
74933
|
async function fileExists(filePath) {
|
|
74541
74934
|
try {
|
|
74542
74935
|
await fs.access(filePath);
|
|
@@ -74554,86 +74947,128 @@ function maskAgeKey(key) {
|
|
|
74554
74947
|
return `${prefix}...${suffix}`;
|
|
74555
74948
|
}
|
|
74556
74949
|
function determineEnvSource(localExists, encryptedExists, ageKeyConfigured) {
|
|
74557
|
-
if (localExists)
|
|
74558
|
-
|
|
74559
|
-
}
|
|
74560
|
-
if (encryptedExists && ageKeyConfigured) {
|
|
74561
|
-
return "encrypted";
|
|
74562
|
-
}
|
|
74950
|
+
if (localExists) return "local";
|
|
74951
|
+
if (encryptedExists && ageKeyConfigured) return "encrypted";
|
|
74563
74952
|
return "none";
|
|
74564
74953
|
}
|
|
74565
|
-
|
|
74954
|
+
function registerStatusCommand(auth) {
|
|
74955
|
+
auth.command("status").description("Show auth configuration status").option("--json", "Output as JSON").action(async (options) => {
|
|
74956
|
+
const status = await getAuthStatus();
|
|
74957
|
+
if (options.json) {
|
|
74958
|
+
console.log(JSON.stringify(status, null, 2));
|
|
74959
|
+
return;
|
|
74960
|
+
}
|
|
74961
|
+
printStatus(status);
|
|
74962
|
+
});
|
|
74963
|
+
}
|
|
74964
|
+
async function getAuthStatus() {
|
|
74965
|
+
const platform = detectPlatform();
|
|
74566
74966
|
const cliDir = path.resolve(import.meta.dirname, "../../..");
|
|
74567
74967
|
const envLocalPath = path.join(cliDir, ".env.local");
|
|
74568
74968
|
const envLocalExists = await fileExists(envLocalPath);
|
|
74569
74969
|
const envEncryptedPath = path.join(cliDir, ".env.encrypted");
|
|
74570
74970
|
const envEncryptedExists = await fileExists(envEncryptedPath);
|
|
74571
|
-
const ageSecretKey = process.env
|
|
74971
|
+
const ageSecretKey = process.env[KEY_NAME2];
|
|
74572
74972
|
const ageKeyConfigured = Boolean(ageSecretKey);
|
|
74573
|
-
const
|
|
74973
|
+
const keychainAvailable = isKeychainAvailable();
|
|
74974
|
+
const keychainValue = keychainAvailable ? readFromKeychain(KEY_NAME2) : null;
|
|
74975
|
+
const opInstalled = isOpCliAvailable();
|
|
74976
|
+
const profilePath = detectShellProfile();
|
|
74574
74977
|
const envSource = determineEnvSource(
|
|
74575
74978
|
envLocalExists,
|
|
74576
74979
|
envEncryptedExists,
|
|
74577
74980
|
ageKeyConfigured
|
|
74578
74981
|
);
|
|
74579
|
-
|
|
74580
|
-
envLocal: {
|
|
74581
|
-
|
|
74582
|
-
path: envLocalPath
|
|
74583
|
-
},
|
|
74584
|
-
envEncrypted: {
|
|
74585
|
-
exists: envEncryptedExists,
|
|
74586
|
-
path: envEncryptedPath
|
|
74587
|
-
},
|
|
74982
|
+
return {
|
|
74983
|
+
envLocal: { exists: envLocalExists, path: envLocalPath },
|
|
74984
|
+
envEncrypted: { exists: envEncryptedExists, path: envEncryptedPath },
|
|
74588
74985
|
ageSecretKey: {
|
|
74589
74986
|
configured: ageKeyConfigured,
|
|
74590
74987
|
masked: ageKeyConfigured && ageSecretKey ? maskAgeKey(ageSecretKey) : void 0
|
|
74591
74988
|
},
|
|
74592
|
-
|
|
74593
|
-
|
|
74989
|
+
keychain: {
|
|
74990
|
+
available: keychainAvailable,
|
|
74991
|
+
platform: platform === "macos" ? "macOS Keychain" : platform === "linux" ? "Linux secret-tool" : "unsupported",
|
|
74992
|
+
stored: !!keychainValue
|
|
74993
|
+
},
|
|
74994
|
+
onepassword: {
|
|
74995
|
+
cliInstalled: opInstalled,
|
|
74996
|
+
signedIn: opInstalled ? isOpSignedIn() : false,
|
|
74997
|
+
serviceAccountConfigured: isServiceAccountConfigured()
|
|
74998
|
+
},
|
|
74999
|
+
shellProfile: {
|
|
75000
|
+
path: profilePath,
|
|
75001
|
+
hasExport: profilePath ? shellProfileHasExport(profilePath, KEY_NAME2) : false
|
|
74594
75002
|
},
|
|
74595
75003
|
envSource
|
|
74596
75004
|
};
|
|
74597
|
-
|
|
74598
|
-
|
|
74599
|
-
|
|
74600
|
-
|
|
74601
|
-
console.log("Auth Configuration Status\n");
|
|
74602
|
-
console.log("Environment Files:");
|
|
75005
|
+
}
|
|
75006
|
+
function printStatus(status) {
|
|
75007
|
+
console.log("\nAuth Status:\n");
|
|
75008
|
+
console.log(" Environment Files:");
|
|
74603
75009
|
console.log(
|
|
74604
|
-
`
|
|
75010
|
+
` .env.local: ${status.envLocal.exists ? "\u2713 (exists)" : "\u2717 (not found)"}`
|
|
74605
75011
|
);
|
|
74606
|
-
console.log(` Path: ${envLocalPath}`);
|
|
74607
75012
|
console.log(
|
|
74608
|
-
`
|
|
75013
|
+
` .env.encrypted: ${status.envEncrypted.exists ? "\u2713 (exists)" : "\u2717 (not found)"}`
|
|
74609
75014
|
);
|
|
74610
|
-
console.log(
|
|
74611
|
-
|
|
75015
|
+
console.log("\n AGE_SECRET_KEY:");
|
|
75016
|
+
const envIcon = status.ageSecretKey.configured ? "\u2713" : "\u2717";
|
|
74612
75017
|
console.log(
|
|
74613
|
-
`
|
|
75018
|
+
` env: ${envIcon} ${status.ageSecretKey.configured ? `(${status.ageSecretKey.masked})` : "not set"}`
|
|
74614
75019
|
);
|
|
75020
|
+
console.log(`
|
|
75021
|
+
Keychain (${status.keychain.platform}):`);
|
|
75022
|
+
if (!status.keychain.available) {
|
|
75023
|
+
console.log(` ${KEY_NAME2}: \u2717 (keychain CLI not available)`);
|
|
75024
|
+
} else {
|
|
75025
|
+
const kcIcon = status.keychain.stored ? "\u2713" : "\u2717";
|
|
75026
|
+
console.log(
|
|
75027
|
+
` ${KEY_NAME2}: ${kcIcon} ${status.keychain.stored ? "(stored)" : "not found"}`
|
|
75028
|
+
);
|
|
75029
|
+
}
|
|
75030
|
+
console.log("\n 1Password:");
|
|
75031
|
+
if (!status.onepassword.cliInstalled) {
|
|
75032
|
+
console.log(` op CLI: \u2717 not installed (${getOpInstallInstructions()})`);
|
|
75033
|
+
} else {
|
|
75034
|
+
const signedInIcon = status.onepassword.signedIn ? "\u2713" : "\u2717";
|
|
75035
|
+
console.log(
|
|
75036
|
+
` op CLI: \u2713 installed, ${signedInIcon} ${status.onepassword.signedIn ? "signed in" : "not signed in"}`
|
|
75037
|
+
);
|
|
75038
|
+
}
|
|
74615
75039
|
console.log(
|
|
74616
|
-
`
|
|
75040
|
+
` service account: ${status.onepassword.serviceAccountConfigured ? "\u2713 configured" : "\u2717 not set"}`
|
|
74617
75041
|
);
|
|
74618
|
-
console.log("\
|
|
74619
|
-
if (
|
|
74620
|
-
|
|
74621
|
-
|
|
74622
|
-
|
|
75042
|
+
console.log("\n Shell Profile:");
|
|
75043
|
+
if (status.shellProfile.path) {
|
|
75044
|
+
const spIcon = status.shellProfile.hasExport ? "\u2713" : "\u2717";
|
|
75045
|
+
console.log(
|
|
75046
|
+
` ${status.shellProfile.path}: ${spIcon} ${status.shellProfile.hasExport ? "export configured" : "no export line"}`
|
|
75047
|
+
);
|
|
75048
|
+
} else {
|
|
75049
|
+
console.log(" Could not detect shell profile");
|
|
75050
|
+
}
|
|
75051
|
+
console.log("\n Env Source:");
|
|
75052
|
+
if (status.envSource === "local") {
|
|
75053
|
+
console.log(" \u2192 Using .env.local");
|
|
75054
|
+
} else if (status.envSource === "encrypted") {
|
|
75055
|
+
console.log(" \u2192 Using .env.encrypted");
|
|
74623
75056
|
} else {
|
|
74624
|
-
console.log("
|
|
74625
|
-
|
|
74626
|
-
|
|
74627
|
-
|
|
74628
|
-
console.log("
|
|
74629
|
-
|
|
75057
|
+
console.log(" \u2192 No env source available");
|
|
75058
|
+
}
|
|
75059
|
+
const allGood = status.ageSecretKey.configured && status.keychain.stored && status.shellProfile.hasExport;
|
|
75060
|
+
if (allGood) {
|
|
75061
|
+
console.log("\n Everything looks good.\n");
|
|
75062
|
+
} else if (!status.keychain.stored) {
|
|
75063
|
+
console.log("\n Run 'skill auth setup' to configure.\n");
|
|
74630
75064
|
}
|
|
74631
75065
|
}
|
|
74632
75066
|
|
|
74633
75067
|
// src/commands/auth/index.ts
|
|
74634
75068
|
function registerAuthCommands(program3) {
|
|
74635
|
-
const auth = program3.command("auth").description("
|
|
74636
|
-
auth
|
|
75069
|
+
const auth = program3.command("auth").description("Auth and secret management");
|
|
75070
|
+
registerSetupCommand(auth);
|
|
75071
|
+
registerStatusCommand(auth);
|
|
74637
75072
|
}
|
|
74638
75073
|
|
|
74639
75074
|
// src/commands/axiom/index.ts
|
|
@@ -75819,9 +76254,9 @@ Saved to ${options.output}`);
|
|
|
75819
76254
|
}
|
|
75820
76255
|
}
|
|
75821
76256
|
async function toEvalite(options) {
|
|
75822
|
-
const { readFileSync:
|
|
76257
|
+
const { readFileSync: readFileSync9 } = await import("fs");
|
|
75823
76258
|
const data2 = JSON.parse(
|
|
75824
|
-
|
|
76259
|
+
readFileSync9(options.input, "utf-8")
|
|
75825
76260
|
);
|
|
75826
76261
|
const evaliteData = data2.map((d) => ({
|
|
75827
76262
|
input: d.triggerMessage.body,
|
|
@@ -75880,7 +76315,7 @@ var registerDbStatusCommand = (prog) => {
|
|
|
75880
76315
|
|
|
75881
76316
|
// src/commands/deploys.ts
|
|
75882
76317
|
init_esm_shims();
|
|
75883
|
-
import { execSync as
|
|
76318
|
+
import { execSync as execSync4 } from "child_process";
|
|
75884
76319
|
import "commander";
|
|
75885
76320
|
var VERCEL_SCOPE = "skillrecordings";
|
|
75886
76321
|
var APPS = {
|
|
@@ -75898,7 +76333,7 @@ function stripAnsi(str2) {
|
|
|
75898
76333
|
}
|
|
75899
76334
|
function runVercel(args) {
|
|
75900
76335
|
try {
|
|
75901
|
-
const raw =
|
|
76336
|
+
const raw = execSync4(`vercel ${args} --scope ${VERCEL_SCOPE} --yes 2>&1`, {
|
|
75902
76337
|
encoding: "utf-8",
|
|
75903
76338
|
timeout: 3e4,
|
|
75904
76339
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -75980,7 +76415,7 @@ async function deploysLogs(appName, options) {
|
|
|
75980
76415
|
console.log(` Deployment: ${url}
|
|
75981
76416
|
`);
|
|
75982
76417
|
try {
|
|
75983
|
-
const logsOutput =
|
|
76418
|
+
const logsOutput = execSync4(
|
|
75984
76419
|
`vercel logs ${url} --scope ${VERCEL_SCOPE} --output short 2>&1 | tail -${options.lines || "30"}`,
|
|
75985
76420
|
{ encoding: "utf-8", timeout: 3e4 }
|
|
75986
76421
|
);
|
|
@@ -77500,7 +77935,7 @@ async function runScenario(scenario, systemPrompt, model, verbose, useRealTools)
|
|
|
77500
77935
|
const startTime = Date.now();
|
|
77501
77936
|
const failureReasons = [];
|
|
77502
77937
|
const trigger = scenario.trigger || scenario.triggerMessage || { subject: "", body: "" };
|
|
77503
|
-
const
|
|
77938
|
+
const input3 = `Subject: ${trigger.subject}
|
|
77504
77939
|
|
|
77505
77940
|
${trigger.body}`;
|
|
77506
77941
|
const name = scenario.name || trigger.subject || scenario.id;
|
|
@@ -77544,7 +77979,7 @@ App: ${scenario.appId || "total-typescript"}`;
|
|
|
77544
77979
|
const result = await generateText({
|
|
77545
77980
|
model,
|
|
77546
77981
|
system: evalSystemPrompt,
|
|
77547
|
-
messages: [{ role: "user", content:
|
|
77982
|
+
messages: [{ role: "user", content: input3 }],
|
|
77548
77983
|
tools,
|
|
77549
77984
|
stopWhen: stepCountIs(10)
|
|
77550
77985
|
// Match production - use stopWhen for multi-step
|
|
@@ -77955,12 +78390,12 @@ async function scoreProduction(options) {
|
|
|
77955
78390
|
|
|
77956
78391
|
// src/commands/eval-local/seed.ts
|
|
77957
78392
|
init_esm_shims();
|
|
77958
|
-
import { join as
|
|
78393
|
+
import { join as join3 } from "path";
|
|
77959
78394
|
import { glob as glob3 } from "glob";
|
|
77960
78395
|
|
|
77961
78396
|
// src/lib/eval-seed.ts
|
|
77962
78397
|
init_esm_shims();
|
|
77963
|
-
import { join } from "path";
|
|
78398
|
+
import { join as join2 } from "path";
|
|
77964
78399
|
import { readFile as readFile4, readdir } from "fs/promises";
|
|
77965
78400
|
import { glob as glob2 } from "glob";
|
|
77966
78401
|
import matter from "gray-matter";
|
|
@@ -77996,7 +78431,7 @@ async function loadJsonFiles(dirPath) {
|
|
|
77996
78431
|
const jsonFiles = files.filter((f) => f.endsWith(".json"));
|
|
77997
78432
|
const items = await Promise.all(
|
|
77998
78433
|
jsonFiles.map(async (file) => {
|
|
77999
|
-
const content = await readFile4(
|
|
78434
|
+
const content = await readFile4(join2(dirPath, file), "utf-8");
|
|
78000
78435
|
return JSON.parse(content);
|
|
78001
78436
|
})
|
|
78002
78437
|
);
|
|
@@ -78006,7 +78441,7 @@ async function loadJsonFiles(dirPath) {
|
|
|
78006
78441
|
}
|
|
78007
78442
|
}
|
|
78008
78443
|
async function loadKnowledgeFiles(basePath) {
|
|
78009
|
-
const files = await glob2(
|
|
78444
|
+
const files = await glob2(join2(basePath, "**/*.md"));
|
|
78010
78445
|
const docs = [];
|
|
78011
78446
|
for (const filePath of files) {
|
|
78012
78447
|
const content = await readFile4(filePath, "utf-8");
|
|
@@ -78201,16 +78636,16 @@ async function seed(options) {
|
|
|
78201
78636
|
}
|
|
78202
78637
|
}
|
|
78203
78638
|
if (!options.json) console.log("\u{1F4E6} Seeding apps...");
|
|
78204
|
-
const apps = await loadJsonFiles(
|
|
78639
|
+
const apps = await loadJsonFiles(join3(fixturesPath, "apps"));
|
|
78205
78640
|
result.apps = await seedApps(connection, apps);
|
|
78206
78641
|
if (!options.json) console.log("\u{1F465} Loading customer fixtures...");
|
|
78207
|
-
const customers = await loadJsonFiles(
|
|
78642
|
+
const customers = await loadJsonFiles(join3(fixturesPath, "customers"));
|
|
78208
78643
|
result.customers = customers.length;
|
|
78209
78644
|
if (!options.json) console.log("\u{1F4DA} Seeding knowledge base...");
|
|
78210
|
-
const knowledge = await loadKnowledgeFiles(
|
|
78645
|
+
const knowledge = await loadKnowledgeFiles(join3(fixturesPath, "knowledge"));
|
|
78211
78646
|
result.knowledge = knowledge.length;
|
|
78212
78647
|
result.embeddings = await seedKnowledgeBase(knowledge, !options.json);
|
|
78213
|
-
const scenarioFiles = await glob3(
|
|
78648
|
+
const scenarioFiles = await glob3(join3(fixturesPath, "scenarios/**/*.json"));
|
|
78214
78649
|
result.scenarios = scenarioFiles.length;
|
|
78215
78650
|
await connection.end();
|
|
78216
78651
|
if (options.json) {
|
|
@@ -78263,8 +78698,8 @@ init_esm_shims();
|
|
|
78263
78698
|
// src/commands/eval-pipeline/run.ts
|
|
78264
78699
|
init_esm_shims();
|
|
78265
78700
|
import { createHash } from "crypto";
|
|
78266
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
78267
|
-
import { join as
|
|
78701
|
+
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
78702
|
+
import { join as join4 } from "path";
|
|
78268
78703
|
import { readFile as readFile5 } from "fs/promises";
|
|
78269
78704
|
import { glob as glob4 } from "glob";
|
|
78270
78705
|
|
|
@@ -78670,12 +79105,12 @@ function getCacheKey(scenarioId, classifySourceHash) {
|
|
|
78670
79105
|
function getClassifySourceHash() {
|
|
78671
79106
|
try {
|
|
78672
79107
|
const possiblePaths = [
|
|
78673
|
-
|
|
78674
|
-
|
|
79108
|
+
join4(process.cwd(), "packages/core/src/pipeline/classify.ts"),
|
|
79109
|
+
join4(process.cwd(), "../core/src/pipeline/classify.ts")
|
|
78675
79110
|
];
|
|
78676
79111
|
for (const path2 of possiblePaths) {
|
|
78677
|
-
if (
|
|
78678
|
-
const content =
|
|
79112
|
+
if (existsSync3(path2)) {
|
|
79113
|
+
const content = readFileSync2(path2, "utf-8");
|
|
78679
79114
|
return createHash("md5").update(content).digest("hex");
|
|
78680
79115
|
}
|
|
78681
79116
|
}
|
|
@@ -78684,10 +79119,10 @@ function getClassifySourceHash() {
|
|
|
78684
79119
|
return createHash("md5").update(Math.floor(Date.now() / 3e5).toString()).digest("hex");
|
|
78685
79120
|
}
|
|
78686
79121
|
function loadCachedClassify(cacheKey) {
|
|
78687
|
-
const cachePath =
|
|
79122
|
+
const cachePath = join4(CACHE_DIR, `${cacheKey}.json`);
|
|
78688
79123
|
try {
|
|
78689
|
-
if (
|
|
78690
|
-
return JSON.parse(
|
|
79124
|
+
if (existsSync3(cachePath)) {
|
|
79125
|
+
return JSON.parse(readFileSync2(cachePath, "utf-8"));
|
|
78691
79126
|
}
|
|
78692
79127
|
} catch {
|
|
78693
79128
|
}
|
|
@@ -78695,17 +79130,17 @@ function loadCachedClassify(cacheKey) {
|
|
|
78695
79130
|
}
|
|
78696
79131
|
function saveCachedClassify(cacheKey, result) {
|
|
78697
79132
|
try {
|
|
78698
|
-
if (!
|
|
79133
|
+
if (!existsSync3(CACHE_DIR)) {
|
|
78699
79134
|
mkdirSync(CACHE_DIR, { recursive: true });
|
|
78700
79135
|
}
|
|
78701
|
-
const cachePath =
|
|
79136
|
+
const cachePath = join4(CACHE_DIR, `${cacheKey}.json`);
|
|
78702
79137
|
writeFileSync2(cachePath, JSON.stringify(result));
|
|
78703
79138
|
} catch {
|
|
78704
79139
|
}
|
|
78705
79140
|
}
|
|
78706
79141
|
function clearClassifyCache() {
|
|
78707
79142
|
try {
|
|
78708
|
-
if (
|
|
79143
|
+
if (existsSync3(CACHE_DIR)) {
|
|
78709
79144
|
rmSync(CACHE_DIR, { recursive: true, force: true });
|
|
78710
79145
|
}
|
|
78711
79146
|
} catch {
|
|
@@ -78921,7 +79356,7 @@ async function runClassifyEval(scenarios, options) {
|
|
|
78921
79356
|
durationMs: 0
|
|
78922
79357
|
};
|
|
78923
79358
|
}
|
|
78924
|
-
const
|
|
79359
|
+
const input3 = {
|
|
78925
79360
|
subject: trigger.subject,
|
|
78926
79361
|
body: trigger.body,
|
|
78927
79362
|
appId: scenario.appId
|
|
@@ -78935,14 +79370,14 @@ async function runClassifyEval(scenarios, options) {
|
|
|
78935
79370
|
if (cached) {
|
|
78936
79371
|
result = cached;
|
|
78937
79372
|
} else {
|
|
78938
|
-
result = await classify(
|
|
79373
|
+
result = await classify(input3, {
|
|
78939
79374
|
forceLLM: options.forceLlm,
|
|
78940
79375
|
model: options.model
|
|
78941
79376
|
});
|
|
78942
79377
|
saveCachedClassify(cacheKey, result);
|
|
78943
79378
|
}
|
|
78944
79379
|
} else {
|
|
78945
|
-
result = await classify(
|
|
79380
|
+
result = await classify(input3, {
|
|
78946
79381
|
forceLLM: options.forceLlm,
|
|
78947
79382
|
model: options.model
|
|
78948
79383
|
});
|
|
@@ -79011,7 +79446,7 @@ async function runRouteEval(scenarios, options) {
|
|
|
79011
79446
|
durationMs: 0
|
|
79012
79447
|
};
|
|
79013
79448
|
}
|
|
79014
|
-
const
|
|
79449
|
+
const input3 = {
|
|
79015
79450
|
subject: trigger.subject,
|
|
79016
79451
|
body: trigger.body,
|
|
79017
79452
|
appId: scenario.appId
|
|
@@ -79025,20 +79460,20 @@ async function runRouteEval(scenarios, options) {
|
|
|
79025
79460
|
if (cached) {
|
|
79026
79461
|
classification = cached;
|
|
79027
79462
|
} else {
|
|
79028
|
-
classification = await classify(
|
|
79463
|
+
classification = await classify(input3, {
|
|
79029
79464
|
forceLLM: options.forceLlm,
|
|
79030
79465
|
model: options.model
|
|
79031
79466
|
});
|
|
79032
79467
|
saveCachedClassify(cacheKey, classification);
|
|
79033
79468
|
}
|
|
79034
79469
|
} else {
|
|
79035
|
-
classification = await classify(
|
|
79470
|
+
classification = await classify(input3, {
|
|
79036
79471
|
forceLLM: options.forceLlm,
|
|
79037
79472
|
model: options.model
|
|
79038
79473
|
});
|
|
79039
79474
|
}
|
|
79040
79475
|
const routeResult = route({
|
|
79041
|
-
message:
|
|
79476
|
+
message: input3,
|
|
79042
79477
|
classification,
|
|
79043
79478
|
appConfig: {
|
|
79044
79479
|
appId: scenario.appId || "eval",
|
|
@@ -79556,7 +79991,7 @@ Latency: ${avgLatency.toFixed(0)}ms avg`);
|
|
|
79556
79991
|
|
|
79557
79992
|
// src/commands/eval-pipeline/seed.ts
|
|
79558
79993
|
init_esm_shims();
|
|
79559
|
-
import { join as
|
|
79994
|
+
import { join as join5 } from "path";
|
|
79560
79995
|
import { glob as glob5 } from "glob";
|
|
79561
79996
|
async function seed2(options) {
|
|
79562
79997
|
const fixturesPath = options.fixtures || "fixtures";
|
|
@@ -79586,20 +80021,20 @@ async function seed2(options) {
|
|
|
79586
80021
|
await cleanQdrant();
|
|
79587
80022
|
}
|
|
79588
80023
|
if (!options.json) console.log("\u{1F4E6} Seeding apps...");
|
|
79589
|
-
const apps = await loadJsonFiles(
|
|
80024
|
+
const apps = await loadJsonFiles(join5(fixturesPath, "apps"));
|
|
79590
80025
|
result.apps = await seedApps(connection, apps);
|
|
79591
80026
|
const [trustRows] = await connection.execute(
|
|
79592
80027
|
"SELECT COUNT(*) as count FROM SUPPORT_trust_scores"
|
|
79593
80028
|
);
|
|
79594
80029
|
result.trustScores = trustRows[0].count;
|
|
79595
80030
|
if (!options.json) console.log("\u{1F465} Loading customer fixtures...");
|
|
79596
|
-
const customers = await loadJsonFiles(
|
|
80031
|
+
const customers = await loadJsonFiles(join5(fixturesPath, "customers"));
|
|
79597
80032
|
result.customers = customers.length;
|
|
79598
80033
|
if (!options.json) console.log("\u{1F4DA} Seeding knowledge base...");
|
|
79599
|
-
const knowledge = await loadKnowledgeFiles(
|
|
80034
|
+
const knowledge = await loadKnowledgeFiles(join5(fixturesPath, "knowledge"));
|
|
79600
80035
|
result.knowledge = knowledge.length;
|
|
79601
80036
|
result.embeddings = await seedKnowledgeBase(knowledge, !options.json);
|
|
79602
|
-
const scenarioFiles = await glob5(
|
|
80037
|
+
const scenarioFiles = await glob5(join5(fixturesPath, "scenarios/**/*.json"));
|
|
79603
80038
|
result.scenarios = scenarioFiles.length;
|
|
79604
80039
|
await connection.end();
|
|
79605
80040
|
if (options.json) {
|
|
@@ -79656,7 +80091,7 @@ function registerEvalPipelineCommands(program3) {
|
|
|
79656
80091
|
|
|
79657
80092
|
// src/commands/eval-prompt.ts
|
|
79658
80093
|
init_esm_shims();
|
|
79659
|
-
import { readFileSync as
|
|
80094
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync4 } from "fs";
|
|
79660
80095
|
import { generateText as generateText2, stepCountIs as stepCountIs2, tool as tool4 } from "ai";
|
|
79661
80096
|
import { z as z5 } from "zod";
|
|
79662
80097
|
var leakPatterns = [
|
|
@@ -79789,14 +80224,14 @@ var mockTools = {
|
|
|
79789
80224
|
};
|
|
79790
80225
|
async function runSingleEval(prompt, sample, model) {
|
|
79791
80226
|
const startTime = Date.now();
|
|
79792
|
-
const
|
|
80227
|
+
const input3 = `Subject: ${sample.triggerMessage.subject}
|
|
79793
80228
|
|
|
79794
80229
|
${sample.triggerMessage.body}`;
|
|
79795
80230
|
try {
|
|
79796
80231
|
const result = await generateText2({
|
|
79797
80232
|
model,
|
|
79798
80233
|
system: prompt + "\n\nApp: total-typescript",
|
|
79799
|
-
messages: [{ role: "user", content:
|
|
80234
|
+
messages: [{ role: "user", content: input3 }],
|
|
79800
80235
|
tools: mockTools,
|
|
79801
80236
|
stopWhen: stepCountIs2(10)
|
|
79802
80237
|
});
|
|
@@ -79805,7 +80240,7 @@ ${sample.triggerMessage.body}`;
|
|
|
79805
80240
|
const output = draftCall ? draftCall.input.body : "";
|
|
79806
80241
|
return {
|
|
79807
80242
|
id: sample.id.slice(0, 8),
|
|
79808
|
-
input:
|
|
80243
|
+
input: input3.slice(0, 100),
|
|
79809
80244
|
output,
|
|
79810
80245
|
score: scoreResponse(output),
|
|
79811
80246
|
durationMs: Date.now() - startTime,
|
|
@@ -79815,7 +80250,7 @@ ${sample.triggerMessage.body}`;
|
|
|
79815
80250
|
} catch (error) {
|
|
79816
80251
|
return {
|
|
79817
80252
|
id: sample.id.slice(0, 8),
|
|
79818
|
-
input:
|
|
80253
|
+
input: input3.slice(0, 100),
|
|
79819
80254
|
output: `ERROR: ${error instanceof Error ? error.message : "Unknown"}`,
|
|
79820
80255
|
score: { leaks: [], meta: [], banned: [], passed: false },
|
|
79821
80256
|
durationMs: Date.now() - startTime,
|
|
@@ -79836,20 +80271,20 @@ async function runEval2(options) {
|
|
|
79836
80271
|
} = options;
|
|
79837
80272
|
let prompt = SUPPORT_AGENT_PROMPT;
|
|
79838
80273
|
if (promptPath) {
|
|
79839
|
-
if (!
|
|
80274
|
+
if (!existsSync4(promptPath)) {
|
|
79840
80275
|
console.error(`Prompt file not found: ${promptPath}`);
|
|
79841
80276
|
process.exit(1);
|
|
79842
80277
|
}
|
|
79843
|
-
prompt =
|
|
80278
|
+
prompt = readFileSync3(promptPath, "utf-8");
|
|
79844
80279
|
console.log(`Using prompt from: ${promptPath}`);
|
|
79845
80280
|
} else {
|
|
79846
80281
|
console.log("Using production prompt");
|
|
79847
80282
|
}
|
|
79848
|
-
if (!
|
|
80283
|
+
if (!existsSync4(datasetPath)) {
|
|
79849
80284
|
console.error(`Dataset not found: ${datasetPath}`);
|
|
79850
80285
|
process.exit(1);
|
|
79851
80286
|
}
|
|
79852
|
-
const dataset = JSON.parse(
|
|
80287
|
+
const dataset = JSON.parse(readFileSync3(datasetPath, "utf-8"));
|
|
79853
80288
|
const samples = dataset.slice(0, limit2);
|
|
79854
80289
|
console.log(`
|
|
79855
80290
|
\u{1F9EA} Running eval on ${samples.length} samples (model: ${model})
|
|
@@ -79921,9 +80356,9 @@ async function comparePrompts(options) {
|
|
|
79921
80356
|
limit: limit2 = 10,
|
|
79922
80357
|
model = "anthropic/claude-haiku-4-5"
|
|
79923
80358
|
} = options;
|
|
79924
|
-
const baselinePrompt = baseline ?
|
|
79925
|
-
const candidatePrompt =
|
|
79926
|
-
const dataset = JSON.parse(
|
|
80359
|
+
const baselinePrompt = baseline ? readFileSync3(baseline, "utf-8") : SUPPORT_AGENT_PROMPT;
|
|
80360
|
+
const candidatePrompt = readFileSync3(candidate, "utf-8");
|
|
80361
|
+
const dataset = JSON.parse(readFileSync3(datasetPath, "utf-8"));
|
|
79927
80362
|
const samples = dataset.slice(0, limit2);
|
|
79928
80363
|
console.log(`
|
|
79929
80364
|
\u{1F52C} Comparing prompts on ${samples.length} samples
|
|
@@ -79985,20 +80420,20 @@ init_esm_shims();
|
|
|
79985
80420
|
|
|
79986
80421
|
// src/commands/faq/classify.ts
|
|
79987
80422
|
init_esm_shims();
|
|
79988
|
-
import { appendFileSync, existsSync as
|
|
79989
|
-
import { dirname as dirname2, join as
|
|
80423
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync4 } from "fs";
|
|
80424
|
+
import { dirname as dirname2, join as join6, resolve } from "path";
|
|
79990
80425
|
import { generateObject } from "ai";
|
|
79991
80426
|
import { z as z6 } from "zod";
|
|
79992
80427
|
var PROJECT_ROOT = resolve(__dirname, "../../../..");
|
|
79993
|
-
var DEFAULT_PARQUET_PATH =
|
|
80428
|
+
var DEFAULT_PARQUET_PATH = join6(
|
|
79994
80429
|
PROJECT_ROOT,
|
|
79995
80430
|
"artifacts/phase-0/embeddings/v2/conversations.parquet"
|
|
79996
80431
|
);
|
|
79997
|
-
var DEFAULT_TAXONOMY_PATH =
|
|
80432
|
+
var DEFAULT_TAXONOMY_PATH = join6(
|
|
79998
80433
|
PROJECT_ROOT,
|
|
79999
80434
|
"artifacts/phase-1/llm-topics/taxonomy.json"
|
|
80000
80435
|
);
|
|
80001
|
-
var DEFAULT_OUTPUT_PATH =
|
|
80436
|
+
var DEFAULT_OUTPUT_PATH = join6(
|
|
80002
80437
|
PROJECT_ROOT,
|
|
80003
80438
|
"artifacts/phase-1/llm-topics/classifications.jsonl"
|
|
80004
80439
|
);
|
|
@@ -80007,7 +80442,7 @@ var CONCURRENT_LIMIT = 10;
|
|
|
80007
80442
|
var DELAY_BETWEEN_BATCHES_MS = 100;
|
|
80008
80443
|
var MODEL = "anthropic/claude-haiku-4-5";
|
|
80009
80444
|
async function loadConversationsFromParquet(parquetPath) {
|
|
80010
|
-
const { execSync:
|
|
80445
|
+
const { execSync: execSync5 } = await import("child_process");
|
|
80011
80446
|
const query = `
|
|
80012
80447
|
SELECT
|
|
80013
80448
|
conversation_id,
|
|
@@ -80018,7 +80453,7 @@ async function loadConversationsFromParquet(parquetPath) {
|
|
|
80018
80453
|
WHERE first_message IS NOT NULL
|
|
80019
80454
|
ORDER BY conversation_id
|
|
80020
80455
|
`;
|
|
80021
|
-
const result =
|
|
80456
|
+
const result = execSync5(`duckdb -json -c "${query.replace(/"/g, '\\"')}"`, {
|
|
80022
80457
|
encoding: "utf-8",
|
|
80023
80458
|
maxBuffer: 100 * 1024 * 1024
|
|
80024
80459
|
// 100MB buffer for large datasets
|
|
@@ -80028,10 +80463,10 @@ async function loadConversationsFromParquet(parquetPath) {
|
|
|
80028
80463
|
}
|
|
80029
80464
|
function loadExistingClassifications(outputPath) {
|
|
80030
80465
|
const classifiedIds = /* @__PURE__ */ new Set();
|
|
80031
|
-
if (!
|
|
80466
|
+
if (!existsSync5(outputPath)) {
|
|
80032
80467
|
return classifiedIds;
|
|
80033
80468
|
}
|
|
80034
|
-
const content =
|
|
80469
|
+
const content = readFileSync4(outputPath, "utf-8");
|
|
80035
80470
|
const lines = content.split("\n").filter((line) => line.trim());
|
|
80036
80471
|
for (const line of lines) {
|
|
80037
80472
|
try {
|
|
@@ -80043,7 +80478,7 @@ function loadExistingClassifications(outputPath) {
|
|
|
80043
80478
|
return classifiedIds;
|
|
80044
80479
|
}
|
|
80045
80480
|
function appendClassification(outputPath, classification) {
|
|
80046
|
-
|
|
80481
|
+
appendFileSync2(outputPath, JSON.stringify(classification) + "\n");
|
|
80047
80482
|
}
|
|
80048
80483
|
var classifySchema = z6.object({
|
|
80049
80484
|
topicId: z6.string(),
|
|
@@ -80172,20 +80607,20 @@ async function faqClassify(options) {
|
|
|
80172
80607
|
console.log(` Concurrency: ${CONCURRENT_LIMIT}`);
|
|
80173
80608
|
console.log(` Dry run: ${options.dryRun ?? false}`);
|
|
80174
80609
|
console.log("");
|
|
80175
|
-
if (!
|
|
80610
|
+
if (!existsSync5(parquetPath)) {
|
|
80176
80611
|
console.error(`\u274C Parquet file not found: ${parquetPath}`);
|
|
80177
80612
|
process.exit(1);
|
|
80178
80613
|
}
|
|
80179
|
-
if (!
|
|
80614
|
+
if (!existsSync5(taxonomyPath)) {
|
|
80180
80615
|
console.error(`\u274C Taxonomy file not found: ${taxonomyPath}`);
|
|
80181
80616
|
process.exit(1);
|
|
80182
80617
|
}
|
|
80183
80618
|
const outputDir = dirname2(outputPath);
|
|
80184
|
-
if (!
|
|
80619
|
+
if (!existsSync5(outputDir)) {
|
|
80185
80620
|
mkdirSync2(outputDir, { recursive: true });
|
|
80186
80621
|
}
|
|
80187
80622
|
console.log("\u{1F4DA} Loading taxonomy...");
|
|
80188
|
-
const taxonomy = JSON.parse(
|
|
80623
|
+
const taxonomy = JSON.parse(readFileSync4(taxonomyPath, "utf-8"));
|
|
80189
80624
|
const validTopicIds = new Set(taxonomy.topics.map((t2) => t2.id));
|
|
80190
80625
|
validTopicIds.add("unknown");
|
|
80191
80626
|
console.log(` Found ${taxonomy.topics.length} topics`);
|
|
@@ -80278,51 +80713,51 @@ function registerFaqClassifyCommands(program3) {
|
|
|
80278
80713
|
|
|
80279
80714
|
// src/commands/faq/cluster.ts
|
|
80280
80715
|
init_esm_shims();
|
|
80281
|
-
import { existsSync as
|
|
80282
|
-
import { join as
|
|
80716
|
+
import { existsSync as existsSync7 } from "fs";
|
|
80717
|
+
import { join as join8, resolve as resolve2 } from "path";
|
|
80283
80718
|
|
|
80284
80719
|
// ../core/src/faq/production-clusterer.ts
|
|
80285
80720
|
init_esm_shims();
|
|
80286
|
-
import { existsSync as
|
|
80287
|
-
import { join as
|
|
80721
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
80722
|
+
import { join as join7 } from "path";
|
|
80288
80723
|
function readPhase0Assignments(phase0Path) {
|
|
80289
|
-
const assignmentsPath =
|
|
80290
|
-
if (!
|
|
80291
|
-
const latestPath =
|
|
80292
|
-
if (!
|
|
80724
|
+
const assignmentsPath = join7(phase0Path, "clusters/v1/assignments.json");
|
|
80725
|
+
if (!existsSync6(assignmentsPath)) {
|
|
80726
|
+
const latestPath = join7(phase0Path, "clusters/latest/assignments.json");
|
|
80727
|
+
if (!existsSync6(latestPath)) {
|
|
80293
80728
|
throw new Error(`Phase 0 assignments not found at ${assignmentsPath}`);
|
|
80294
80729
|
}
|
|
80295
|
-
const content2 =
|
|
80730
|
+
const content2 = readFileSync5(latestPath, "utf-8");
|
|
80296
80731
|
return JSON.parse(content2);
|
|
80297
80732
|
}
|
|
80298
|
-
const content =
|
|
80733
|
+
const content = readFileSync5(assignmentsPath, "utf-8");
|
|
80299
80734
|
return JSON.parse(content);
|
|
80300
80735
|
}
|
|
80301
80736
|
function readPhase0Labels(phase0Path) {
|
|
80302
|
-
const labelsPath =
|
|
80303
|
-
if (!
|
|
80304
|
-
const latestPath =
|
|
80305
|
-
if (!
|
|
80737
|
+
const labelsPath = join7(phase0Path, "clusters/v1/labels.json");
|
|
80738
|
+
if (!existsSync6(labelsPath)) {
|
|
80739
|
+
const latestPath = join7(phase0Path, "clusters/latest/labels.json");
|
|
80740
|
+
if (!existsSync6(latestPath)) {
|
|
80306
80741
|
throw new Error(`Phase 0 labels not found at ${labelsPath}`);
|
|
80307
80742
|
}
|
|
80308
|
-
const content2 =
|
|
80743
|
+
const content2 = readFileSync5(latestPath, "utf-8");
|
|
80309
80744
|
const parsed2 = JSON.parse(content2);
|
|
80310
80745
|
return parsed2.clusters || [];
|
|
80311
80746
|
}
|
|
80312
|
-
const content =
|
|
80747
|
+
const content = readFileSync5(labelsPath, "utf-8");
|
|
80313
80748
|
const parsed = JSON.parse(content);
|
|
80314
80749
|
return parsed.clusters || [];
|
|
80315
80750
|
}
|
|
80316
80751
|
function readPhase0Metrics(phase0Path) {
|
|
80317
|
-
const metricsPath =
|
|
80318
|
-
if (!
|
|
80319
|
-
const latestPath =
|
|
80320
|
-
if (!
|
|
80752
|
+
const metricsPath = join7(phase0Path, "clusters/v1/metrics.json");
|
|
80753
|
+
if (!existsSync6(metricsPath)) {
|
|
80754
|
+
const latestPath = join7(phase0Path, "clusters/latest/metrics.json");
|
|
80755
|
+
if (!existsSync6(latestPath)) {
|
|
80321
80756
|
throw new Error(`Phase 0 metrics not found at ${metricsPath}`);
|
|
80322
80757
|
}
|
|
80323
|
-
return JSON.parse(
|
|
80758
|
+
return JSON.parse(readFileSync5(latestPath, "utf-8"));
|
|
80324
80759
|
}
|
|
80325
|
-
return JSON.parse(
|
|
80760
|
+
return JSON.parse(readFileSync5(metricsPath, "utf-8"));
|
|
80326
80761
|
}
|
|
80327
80762
|
function calculateConfidence2(distance) {
|
|
80328
80763
|
if (distance === null) return 0;
|
|
@@ -80437,17 +80872,17 @@ async function generateProductionClustering(options) {
|
|
|
80437
80872
|
return result;
|
|
80438
80873
|
}
|
|
80439
80874
|
function writeProductionArtifacts(result, outputPath) {
|
|
80440
|
-
const versionPath =
|
|
80441
|
-
if (!
|
|
80875
|
+
const versionPath = join7(outputPath, result.version);
|
|
80876
|
+
if (!existsSync6(versionPath)) {
|
|
80442
80877
|
mkdirSync3(versionPath, { recursive: true });
|
|
80443
80878
|
}
|
|
80444
|
-
const resultPath =
|
|
80879
|
+
const resultPath = join7(versionPath, "clustering-result.json");
|
|
80445
80880
|
writeFileSync4(resultPath, JSON.stringify(result, null, 2));
|
|
80446
80881
|
console.log(`\u2705 Written: ${resultPath}`);
|
|
80447
|
-
const assignmentsPath =
|
|
80882
|
+
const assignmentsPath = join7(versionPath, "assignments.json");
|
|
80448
80883
|
writeFileSync4(assignmentsPath, JSON.stringify(result.assignments, null, 2));
|
|
80449
80884
|
console.log(`\u2705 Written: ${assignmentsPath}`);
|
|
80450
|
-
const clustersPath =
|
|
80885
|
+
const clustersPath = join7(versionPath, "clusters.json");
|
|
80451
80886
|
writeFileSync4(
|
|
80452
80887
|
clustersPath,
|
|
80453
80888
|
JSON.stringify(
|
|
@@ -80462,7 +80897,7 @@ function writeProductionArtifacts(result, outputPath) {
|
|
|
80462
80897
|
)
|
|
80463
80898
|
);
|
|
80464
80899
|
console.log(`\u2705 Written: ${clustersPath}`);
|
|
80465
|
-
const summaryPath =
|
|
80900
|
+
const summaryPath = join7(versionPath, "summary.json");
|
|
80466
80901
|
const summary = {
|
|
80467
80902
|
version: result.version,
|
|
80468
80903
|
generatedAt: result.generatedAt,
|
|
@@ -80476,8 +80911,8 @@ function writeProductionArtifacts(result, outputPath) {
|
|
|
80476
80911
|
};
|
|
80477
80912
|
writeFileSync4(summaryPath, JSON.stringify(summary, null, 2));
|
|
80478
80913
|
console.log(`\u2705 Written: ${summaryPath}`);
|
|
80479
|
-
const latestPath =
|
|
80480
|
-
if (
|
|
80914
|
+
const latestPath = join7(outputPath, "latest");
|
|
80915
|
+
if (existsSync6(latestPath)) {
|
|
80481
80916
|
const { rmSync: rmSync2 } = __require("fs");
|
|
80482
80917
|
rmSync2(latestPath, { recursive: true, force: true });
|
|
80483
80918
|
}
|
|
@@ -80488,9 +80923,9 @@ function writeProductionArtifacts(result, outputPath) {
|
|
|
80488
80923
|
"clusters.json",
|
|
80489
80924
|
"summary.json"
|
|
80490
80925
|
]) {
|
|
80491
|
-
const src =
|
|
80492
|
-
const dst =
|
|
80493
|
-
writeFileSync4(dst,
|
|
80926
|
+
const src = join7(versionPath, file);
|
|
80927
|
+
const dst = join7(latestPath, file);
|
|
80928
|
+
writeFileSync4(dst, readFileSync5(src));
|
|
80494
80929
|
}
|
|
80495
80930
|
console.log(`\u2705 Updated: ${latestPath}`);
|
|
80496
80931
|
}
|
|
@@ -80542,22 +80977,22 @@ function displayClusteringSummary(result) {
|
|
|
80542
80977
|
|
|
80543
80978
|
// src/commands/faq/cluster.ts
|
|
80544
80979
|
var PROJECT_ROOT2 = resolve2(__dirname, "../../../..");
|
|
80545
|
-
var DEFAULT_PHASE0_PATH =
|
|
80546
|
-
var DEFAULT_OUTPUT_PATH2 =
|
|
80980
|
+
var DEFAULT_PHASE0_PATH = join8(PROJECT_ROOT2, "artifacts/phase-0");
|
|
80981
|
+
var DEFAULT_OUTPUT_PATH2 = join8(PROJECT_ROOT2, "artifacts/phase-1/clustering");
|
|
80547
80982
|
function validatePaths(phase0Path) {
|
|
80548
|
-
const assignmentsPath =
|
|
80549
|
-
const labelsPath =
|
|
80550
|
-
const metricsPath =
|
|
80551
|
-
if (!
|
|
80983
|
+
const assignmentsPath = join8(phase0Path, "clusters/v1/assignments.json");
|
|
80984
|
+
const labelsPath = join8(phase0Path, "clusters/v1/labels.json");
|
|
80985
|
+
const metricsPath = join8(phase0Path, "clusters/v1/metrics.json");
|
|
80986
|
+
if (!existsSync7(assignmentsPath)) {
|
|
80552
80987
|
throw new Error(
|
|
80553
80988
|
`Phase 0 assignments not found at ${assignmentsPath}
|
|
80554
80989
|
Run Phase 0 clustering first or specify correct --phase0-path`
|
|
80555
80990
|
);
|
|
80556
80991
|
}
|
|
80557
|
-
if (!
|
|
80992
|
+
if (!existsSync7(labelsPath)) {
|
|
80558
80993
|
throw new Error(`Phase 0 labels not found at ${labelsPath}`);
|
|
80559
80994
|
}
|
|
80560
|
-
if (!
|
|
80995
|
+
if (!existsSync7(metricsPath)) {
|
|
80561
80996
|
throw new Error(`Phase 0 metrics not found at ${metricsPath}`);
|
|
80562
80997
|
}
|
|
80563
80998
|
}
|
|
@@ -80586,7 +81021,7 @@ async function faqCluster(options) {
|
|
|
80586
81021
|
console.log("\n\u{1F4DD} Writing artifacts...");
|
|
80587
81022
|
writeProductionArtifacts(result, outputPath);
|
|
80588
81023
|
console.log("\n\u2705 Production clustering complete!");
|
|
80589
|
-
console.log(` Artifacts written to: ${
|
|
81024
|
+
console.log(` Artifacts written to: ${join8(outputPath, version)}`);
|
|
80590
81025
|
} else {
|
|
80591
81026
|
console.log("\n\u{1F9EA} Dry run - no artifacts written");
|
|
80592
81027
|
}
|
|
@@ -80620,8 +81055,8 @@ function registerFaqClusterCommands(program3) {
|
|
|
80620
81055
|
|
|
80621
81056
|
// src/commands/faq/extract.ts
|
|
80622
81057
|
init_esm_shims();
|
|
80623
|
-
import { existsSync as
|
|
80624
|
-
import { join as
|
|
81058
|
+
import { existsSync as existsSync9 } from "fs";
|
|
81059
|
+
import { join as join10, resolve as resolve3 } from "path";
|
|
80625
81060
|
|
|
80626
81061
|
// ../core/src/faq/duckdb-source.ts
|
|
80627
81062
|
init_esm_shims();
|
|
@@ -81149,8 +81584,8 @@ async function createDuckDBSource(config) {
|
|
|
81149
81584
|
|
|
81150
81585
|
// ../core/src/faq/extractor.ts
|
|
81151
81586
|
init_esm_shims();
|
|
81152
|
-
import { existsSync as
|
|
81153
|
-
import { join as
|
|
81587
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
81588
|
+
import { join as join9 } from "path";
|
|
81154
81589
|
|
|
81155
81590
|
// ../core/src/faq/review.ts
|
|
81156
81591
|
init_esm_shims();
|
|
@@ -81175,39 +81610,39 @@ function getKnowledgeRedisKey(id, namespace) {
|
|
|
81175
81610
|
}
|
|
81176
81611
|
|
|
81177
81612
|
// ../core/src/knowledge/search.ts
|
|
81178
|
-
async function storeKnowledgeArticle(
|
|
81613
|
+
async function storeKnowledgeArticle(input3) {
|
|
81179
81614
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
81180
81615
|
const id = randomUUID();
|
|
81181
|
-
const namespace =
|
|
81616
|
+
const namespace = input3.shared ? KNOWLEDGE_NAMESPACE.SHARED : getKnowledgeNamespace(input3.appId);
|
|
81182
81617
|
const article = {
|
|
81183
81618
|
id,
|
|
81184
|
-
title:
|
|
81185
|
-
question:
|
|
81186
|
-
answer:
|
|
81187
|
-
appId:
|
|
81619
|
+
title: input3.title,
|
|
81620
|
+
question: input3.question,
|
|
81621
|
+
answer: input3.answer,
|
|
81622
|
+
appId: input3.appId,
|
|
81188
81623
|
metadata: {
|
|
81189
|
-
source:
|
|
81190
|
-
category:
|
|
81624
|
+
source: input3.source,
|
|
81625
|
+
category: input3.category,
|
|
81191
81626
|
created_at: now,
|
|
81192
81627
|
updated_at: now,
|
|
81193
|
-
tags:
|
|
81194
|
-
trust_score:
|
|
81628
|
+
tags: input3.tags ?? [],
|
|
81629
|
+
trust_score: input3.trust_score ?? 1,
|
|
81195
81630
|
usage_count: 0
|
|
81196
81631
|
}
|
|
81197
81632
|
};
|
|
81198
|
-
const searchableText = `${
|
|
81633
|
+
const searchableText = `${input3.title}
|
|
81199
81634
|
|
|
81200
|
-
${
|
|
81635
|
+
${input3.question}`;
|
|
81201
81636
|
await upsertVector({
|
|
81202
81637
|
id,
|
|
81203
81638
|
data: searchableText,
|
|
81204
81639
|
metadata: {
|
|
81205
81640
|
type: "knowledge",
|
|
81206
|
-
appId:
|
|
81641
|
+
appId: input3.shared ? "shared" : input3.appId,
|
|
81207
81642
|
// Map knowledge categories to vector categories where possible
|
|
81208
|
-
category:
|
|
81209
|
-
source:
|
|
81210
|
-
trustScore:
|
|
81643
|
+
category: input3.category,
|
|
81644
|
+
source: input3.source,
|
|
81645
|
+
trustScore: input3.trust_score ?? 1
|
|
81211
81646
|
}
|
|
81212
81647
|
});
|
|
81213
81648
|
const redis = getRedis();
|
|
@@ -81532,12 +81967,12 @@ function deduplicateCandidates(candidates, threshold) {
|
|
|
81532
81967
|
};
|
|
81533
81968
|
}
|
|
81534
81969
|
function readClusteringResult(path2) {
|
|
81535
|
-
const content =
|
|
81970
|
+
const content = readFileSync6(path2, "utf-8");
|
|
81536
81971
|
return JSON.parse(content);
|
|
81537
81972
|
}
|
|
81538
81973
|
function readGoldenResponses(path2) {
|
|
81539
81974
|
try {
|
|
81540
|
-
const content =
|
|
81975
|
+
const content = readFileSync6(path2, "utf-8");
|
|
81541
81976
|
const parsed = JSON.parse(content);
|
|
81542
81977
|
return parsed.responses || parsed;
|
|
81543
81978
|
} catch {
|
|
@@ -81764,14 +82199,14 @@ async function extractFaqCandidates(options) {
|
|
|
81764
82199
|
return result;
|
|
81765
82200
|
}
|
|
81766
82201
|
function writeExtractionArtifacts(result, outputPath) {
|
|
81767
|
-
const versionPath =
|
|
81768
|
-
if (!
|
|
82202
|
+
const versionPath = join9(outputPath, result.version);
|
|
82203
|
+
if (!existsSync8(versionPath)) {
|
|
81769
82204
|
mkdirSync4(versionPath, { recursive: true });
|
|
81770
82205
|
}
|
|
81771
|
-
const resultPath =
|
|
82206
|
+
const resultPath = join9(versionPath, "extraction-result.json");
|
|
81772
82207
|
writeFileSync5(resultPath, JSON.stringify(result, null, 2));
|
|
81773
82208
|
console.log(`\u2705 Written: ${resultPath}`);
|
|
81774
|
-
const candidatesPath =
|
|
82209
|
+
const candidatesPath = join9(versionPath, "candidates.json");
|
|
81775
82210
|
const candidatesData = {
|
|
81776
82211
|
version: result.version,
|
|
81777
82212
|
extractedAt: result.extractedAt,
|
|
@@ -81791,7 +82226,7 @@ function writeExtractionArtifacts(result, outputPath) {
|
|
|
81791
82226
|
};
|
|
81792
82227
|
writeFileSync5(candidatesPath, JSON.stringify(candidatesData, null, 2));
|
|
81793
82228
|
console.log(`\u2705 Written: ${candidatesPath}`);
|
|
81794
|
-
const statsPath =
|
|
82229
|
+
const statsPath = join9(versionPath, "stats.json");
|
|
81795
82230
|
writeFileSync5(
|
|
81796
82231
|
statsPath,
|
|
81797
82232
|
JSON.stringify(
|
|
@@ -81805,8 +82240,8 @@ function writeExtractionArtifacts(result, outputPath) {
|
|
|
81805
82240
|
)
|
|
81806
82241
|
);
|
|
81807
82242
|
console.log(`\u2705 Written: ${statsPath}`);
|
|
81808
|
-
const latestPath =
|
|
81809
|
-
if (
|
|
82243
|
+
const latestPath = join9(outputPath, "latest");
|
|
82244
|
+
if (existsSync8(latestPath)) {
|
|
81810
82245
|
const { rmSync: rmSync2 } = __require("fs");
|
|
81811
82246
|
rmSync2(latestPath, { recursive: true, force: true });
|
|
81812
82247
|
}
|
|
@@ -81816,10 +82251,10 @@ function writeExtractionArtifacts(result, outputPath) {
|
|
|
81816
82251
|
"candidates.json",
|
|
81817
82252
|
"stats.json"
|
|
81818
82253
|
]) {
|
|
81819
|
-
const src =
|
|
81820
|
-
const dst =
|
|
81821
|
-
if (
|
|
81822
|
-
writeFileSync5(dst,
|
|
82254
|
+
const src = join9(versionPath, file);
|
|
82255
|
+
const dst = join9(latestPath, file);
|
|
82256
|
+
if (existsSync8(src)) {
|
|
82257
|
+
writeFileSync5(dst, readFileSync6(src));
|
|
81823
82258
|
}
|
|
81824
82259
|
}
|
|
81825
82260
|
console.log(`\u2705 Updated: ${latestPath}`);
|
|
@@ -81872,24 +82307,24 @@ ${i + 1}. [${confPct}%]${golden} ${candidate.suggestedCategory}`
|
|
|
81872
82307
|
|
|
81873
82308
|
// src/commands/faq/extract.ts
|
|
81874
82309
|
var PROJECT_ROOT3 = resolve3(__dirname, "../../../..");
|
|
81875
|
-
var DEFAULT_CLUSTERING_PATH =
|
|
82310
|
+
var DEFAULT_CLUSTERING_PATH = join10(
|
|
81876
82311
|
PROJECT_ROOT3,
|
|
81877
82312
|
"artifacts/phase-1/clustering/v1/clustering-result.json"
|
|
81878
82313
|
);
|
|
81879
|
-
var DEFAULT_GOLDEN_PATH =
|
|
82314
|
+
var DEFAULT_GOLDEN_PATH = join10(
|
|
81880
82315
|
PROJECT_ROOT3,
|
|
81881
82316
|
"artifacts/phase-0/golden/latest/responses.json"
|
|
81882
82317
|
);
|
|
81883
|
-
var DEFAULT_OUTPUT_PATH3 =
|
|
82318
|
+
var DEFAULT_OUTPUT_PATH3 = join10(PROJECT_ROOT3, "artifacts/phase-1/extraction");
|
|
81884
82319
|
var DEFAULT_CACHE_PATH = `${process.env.HOME}/skill/data/front-cache.db`;
|
|
81885
82320
|
function validatePaths2(clusteringPath, goldenPath) {
|
|
81886
|
-
if (!
|
|
82321
|
+
if (!existsSync9(clusteringPath)) {
|
|
81887
82322
|
throw new Error(
|
|
81888
82323
|
`Clustering result not found at ${clusteringPath}
|
|
81889
82324
|
Run \`bun src/index.ts faq cluster\` first to generate clustering.`
|
|
81890
82325
|
);
|
|
81891
82326
|
}
|
|
81892
|
-
if (goldenPath && !
|
|
82327
|
+
if (goldenPath && !existsSync9(goldenPath)) {
|
|
81893
82328
|
console.warn(`\u26A0\uFE0F Golden responses not found at ${goldenPath}`);
|
|
81894
82329
|
console.warn(" Golden matching will be disabled.");
|
|
81895
82330
|
}
|
|
@@ -81913,7 +82348,7 @@ async function faqExtract(options) {
|
|
|
81913
82348
|
console.log(` Dry run: ${options.dryRun ?? false}`);
|
|
81914
82349
|
console.log("");
|
|
81915
82350
|
validatePaths2(clusteringPath, goldenPath);
|
|
81916
|
-
if (!
|
|
82351
|
+
if (!existsSync9(cachePath)) {
|
|
81917
82352
|
throw new Error(
|
|
81918
82353
|
`DuckDB cache not found at ${cachePath}
|
|
81919
82354
|
Run \`bun src/index.ts front-cache sync\` first to populate cache.`
|
|
@@ -81931,7 +82366,7 @@ Run \`bun src/index.ts front-cache sync\` first to populate cache.`
|
|
|
81931
82366
|
}
|
|
81932
82367
|
const extractionOptions = {
|
|
81933
82368
|
clusteringPath,
|
|
81934
|
-
goldenPath:
|
|
82369
|
+
goldenPath: existsSync9(goldenPath) ? goldenPath : void 0,
|
|
81935
82370
|
source,
|
|
81936
82371
|
outputPath,
|
|
81937
82372
|
version,
|
|
@@ -81972,7 +82407,7 @@ Run \`bun src/index.ts front-cache sync\` first to populate cache.`
|
|
|
81972
82407
|
if (!options.dryRun) {
|
|
81973
82408
|
console.log(`
|
|
81974
82409
|
\u2705 Extraction complete!`);
|
|
81975
|
-
console.log(` Artifacts written to: ${
|
|
82410
|
+
console.log(` Artifacts written to: ${join10(outputPath, version)}`);
|
|
81976
82411
|
if (options.pushRedis && options.app) {
|
|
81977
82412
|
console.log(
|
|
81978
82413
|
` Candidates pushed to Redis queue: faq:pending:${options.app}`
|
|
@@ -83323,60 +83758,60 @@ function parseURL(urlStr) {
|
|
|
83323
83758
|
return parse_url(urlStr);
|
|
83324
83759
|
}
|
|
83325
83760
|
var streamDestructionSupported = "destroy" in Stream.Readable.prototype;
|
|
83326
|
-
function isRequest(
|
|
83327
|
-
return typeof
|
|
83761
|
+
function isRequest(input3) {
|
|
83762
|
+
return typeof input3 === "object" && typeof input3[INTERNALS$2] === "object";
|
|
83328
83763
|
}
|
|
83329
83764
|
function isAbortSignal(signal) {
|
|
83330
83765
|
const proto = signal && typeof signal === "object" && Object.getPrototypeOf(signal);
|
|
83331
83766
|
return !!(proto && proto.constructor.name === "AbortSignal");
|
|
83332
83767
|
}
|
|
83333
83768
|
var Request2 = class _Request {
|
|
83334
|
-
constructor(
|
|
83769
|
+
constructor(input3) {
|
|
83335
83770
|
let init3 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
83336
83771
|
let parsedURL;
|
|
83337
|
-
if (!isRequest(
|
|
83338
|
-
if (
|
|
83339
|
-
parsedURL = parseURL(
|
|
83772
|
+
if (!isRequest(input3)) {
|
|
83773
|
+
if (input3 && input3.href) {
|
|
83774
|
+
parsedURL = parseURL(input3.href);
|
|
83340
83775
|
} else {
|
|
83341
|
-
parsedURL = parseURL(`${
|
|
83776
|
+
parsedURL = parseURL(`${input3}`);
|
|
83342
83777
|
}
|
|
83343
|
-
|
|
83778
|
+
input3 = {};
|
|
83344
83779
|
} else {
|
|
83345
|
-
parsedURL = parseURL(
|
|
83780
|
+
parsedURL = parseURL(input3.url);
|
|
83346
83781
|
}
|
|
83347
|
-
let method = init3.method ||
|
|
83782
|
+
let method = init3.method || input3.method || "GET";
|
|
83348
83783
|
method = method.toUpperCase();
|
|
83349
|
-
if ((init3.body != null || isRequest(
|
|
83784
|
+
if ((init3.body != null || isRequest(input3) && input3.body !== null) && (method === "GET" || method === "HEAD")) {
|
|
83350
83785
|
throw new TypeError("Request with GET/HEAD method cannot have body");
|
|
83351
83786
|
}
|
|
83352
|
-
let inputBody = init3.body != null ? init3.body : isRequest(
|
|
83787
|
+
let inputBody = init3.body != null ? init3.body : isRequest(input3) && input3.body !== null ? clone(input3) : null;
|
|
83353
83788
|
Body.call(this, inputBody, {
|
|
83354
|
-
timeout: init3.timeout ||
|
|
83355
|
-
size: init3.size ||
|
|
83789
|
+
timeout: init3.timeout || input3.timeout || 0,
|
|
83790
|
+
size: init3.size || input3.size || 0
|
|
83356
83791
|
});
|
|
83357
|
-
const headers = new Headers2(init3.headers ||
|
|
83792
|
+
const headers = new Headers2(init3.headers || input3.headers || {});
|
|
83358
83793
|
if (inputBody != null && !headers.has("Content-Type")) {
|
|
83359
83794
|
const contentType = extractContentType(inputBody);
|
|
83360
83795
|
if (contentType) {
|
|
83361
83796
|
headers.append("Content-Type", contentType);
|
|
83362
83797
|
}
|
|
83363
83798
|
}
|
|
83364
|
-
let signal = isRequest(
|
|
83799
|
+
let signal = isRequest(input3) ? input3.signal : null;
|
|
83365
83800
|
if ("signal" in init3) signal = init3.signal;
|
|
83366
83801
|
if (signal != null && !isAbortSignal(signal)) {
|
|
83367
83802
|
throw new TypeError("Expected signal to be an instanceof AbortSignal");
|
|
83368
83803
|
}
|
|
83369
83804
|
this[INTERNALS$2] = {
|
|
83370
83805
|
method,
|
|
83371
|
-
redirect: init3.redirect ||
|
|
83806
|
+
redirect: init3.redirect || input3.redirect || "follow",
|
|
83372
83807
|
headers,
|
|
83373
83808
|
parsedURL,
|
|
83374
83809
|
signal
|
|
83375
83810
|
};
|
|
83376
|
-
this.follow = init3.follow !== void 0 ? init3.follow :
|
|
83377
|
-
this.compress = init3.compress !== void 0 ? init3.compress :
|
|
83378
|
-
this.counter = init3.counter ||
|
|
83379
|
-
this.agent = init3.agent ||
|
|
83811
|
+
this.follow = init3.follow !== void 0 ? init3.follow : input3.follow !== void 0 ? input3.follow : 20;
|
|
83812
|
+
this.compress = init3.compress !== void 0 ? init3.compress : input3.compress !== void 0 ? input3.compress : true;
|
|
83813
|
+
this.counter = init3.counter || input3.counter || 0;
|
|
83814
|
+
this.agent = init3.agent || input3.agent;
|
|
83380
83815
|
}
|
|
83381
83816
|
get method() {
|
|
83382
83817
|
return this[INTERNALS$2].method;
|
|
@@ -87306,7 +87741,7 @@ var _parseJSON = (jsonString, allow) => {
|
|
|
87306
87741
|
};
|
|
87307
87742
|
return parseAny();
|
|
87308
87743
|
};
|
|
87309
|
-
var partialParse = (
|
|
87744
|
+
var partialParse = (input3) => parseJSON(input3, Allow.ALL ^ Allow.NUM);
|
|
87310
87745
|
|
|
87311
87746
|
// ../../node_modules/.bun/openai@4.104.0+c05f8f6c4f18bd47/node_modules/openai/lib/ChatCompletionStream.mjs
|
|
87312
87747
|
var __classPrivateFieldSet6 = function(receiver, state, value, kind2, f) {
|
|
@@ -90924,10 +91359,10 @@ function registerFaqMineCommands(program3) {
|
|
|
90924
91359
|
// src/commands/faq/review.ts
|
|
90925
91360
|
init_esm_shims();
|
|
90926
91361
|
import { spawnSync } from "child_process";
|
|
90927
|
-
import { existsSync as
|
|
91362
|
+
import { existsSync as existsSync10, readFileSync as readFileSync7, unlinkSync, writeFileSync as writeFileSync7 } from "fs";
|
|
90928
91363
|
import { tmpdir } from "os";
|
|
90929
|
-
import { join as
|
|
90930
|
-
import { confirm, select } from "@inquirer/prompts";
|
|
91364
|
+
import { join as join11 } from "path";
|
|
91365
|
+
import { confirm as confirm2, select as select2 } from "@inquirer/prompts";
|
|
90931
91366
|
var COLORS2 = {
|
|
90932
91367
|
reset: "\x1B[0m",
|
|
90933
91368
|
green: "\x1B[32m",
|
|
@@ -90987,7 +91422,7 @@ function getEditor() {
|
|
|
90987
91422
|
}
|
|
90988
91423
|
function editInEditor(question, answer) {
|
|
90989
91424
|
const editor = getEditor();
|
|
90990
|
-
const tmpFile =
|
|
91425
|
+
const tmpFile = join11(tmpdir(), `faq-edit-${Date.now()}.md`);
|
|
90991
91426
|
const content = `# FAQ Edit
|
|
90992
91427
|
|
|
90993
91428
|
## Question
|
|
@@ -91012,7 +91447,7 @@ The sections are separated by "## Question" and "## Answer" headers.
|
|
|
91012
91447
|
console.log(`${COLORS2.red}Editor exited with error${COLORS2.reset}`);
|
|
91013
91448
|
return null;
|
|
91014
91449
|
}
|
|
91015
|
-
const edited =
|
|
91450
|
+
const edited = readFileSync7(tmpFile, "utf-8");
|
|
91016
91451
|
const questionMatch = edited.match(
|
|
91017
91452
|
/## Question\s*\n([\s\S]*?)(?=\n## Answer|$)/
|
|
91018
91453
|
);
|
|
@@ -91030,7 +91465,7 @@ The sections are separated by "## Question" and "## Answer" headers.
|
|
|
91030
91465
|
answer: editedAnswer
|
|
91031
91466
|
};
|
|
91032
91467
|
} finally {
|
|
91033
|
-
if (
|
|
91468
|
+
if (existsSync10(tmpFile)) {
|
|
91034
91469
|
unlinkSync(tmpFile);
|
|
91035
91470
|
}
|
|
91036
91471
|
}
|
|
@@ -91060,7 +91495,7 @@ ${COLORS2.bold}\u{1F4CB} FAQ Review Session${COLORS2.reset}`);
|
|
|
91060
91495
|
for (let i = 0; i < candidates.length; i++) {
|
|
91061
91496
|
const candidate = candidates[i];
|
|
91062
91497
|
displayCandidate(candidate, i, candidates.length);
|
|
91063
|
-
const action = await
|
|
91498
|
+
const action = await select2({
|
|
91064
91499
|
message: "Action:",
|
|
91065
91500
|
choices: [
|
|
91066
91501
|
{
|
|
@@ -91132,7 +91567,7 @@ ${COLORS2.bold}New Question:${COLORS2.reset}`);
|
|
|
91132
91567
|
console.log(`
|
|
91133
91568
|
${COLORS2.bold}New Answer:${COLORS2.reset}`);
|
|
91134
91569
|
console.log(wordWrap(finalAnswer, 68));
|
|
91135
|
-
const confirmPublish = await
|
|
91570
|
+
const confirmPublish = await confirm2({
|
|
91136
91571
|
message: "Publish edited FAQ?",
|
|
91137
91572
|
default: true
|
|
91138
91573
|
});
|
|
@@ -91235,6 +91670,77 @@ function registerFaqCommands(program3) {
|
|
|
91235
91670
|
// src/commands/front/index.ts
|
|
91236
91671
|
init_esm_shims();
|
|
91237
91672
|
|
|
91673
|
+
// src/commands/front/api.ts
|
|
91674
|
+
init_esm_shims();
|
|
91675
|
+
function getFrontClient() {
|
|
91676
|
+
const apiToken = process.env.FRONT_API_TOKEN;
|
|
91677
|
+
if (!apiToken) {
|
|
91678
|
+
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
91679
|
+
}
|
|
91680
|
+
return createInstrumentedFrontClient({ apiToken });
|
|
91681
|
+
}
|
|
91682
|
+
async function apiPassthrough(method, endpoint, options) {
|
|
91683
|
+
const front = getFrontClient();
|
|
91684
|
+
const httpMethod = method.toUpperCase();
|
|
91685
|
+
let body = void 0;
|
|
91686
|
+
if (options.data) {
|
|
91687
|
+
try {
|
|
91688
|
+
body = JSON.parse(options.data);
|
|
91689
|
+
} catch {
|
|
91690
|
+
throw new Error("Invalid JSON in --data");
|
|
91691
|
+
}
|
|
91692
|
+
}
|
|
91693
|
+
const normalizedEndpoint = endpoint.startsWith("/") ? endpoint : `/${endpoint}`;
|
|
91694
|
+
let result;
|
|
91695
|
+
switch (httpMethod) {
|
|
91696
|
+
case "GET":
|
|
91697
|
+
result = await front.raw.get(normalizedEndpoint);
|
|
91698
|
+
break;
|
|
91699
|
+
case "POST":
|
|
91700
|
+
result = await front.raw.post(normalizedEndpoint, body);
|
|
91701
|
+
break;
|
|
91702
|
+
case "PATCH":
|
|
91703
|
+
result = await front.raw.patch(normalizedEndpoint, body);
|
|
91704
|
+
break;
|
|
91705
|
+
case "PUT":
|
|
91706
|
+
result = await front.raw.put(normalizedEndpoint, body);
|
|
91707
|
+
break;
|
|
91708
|
+
case "DELETE":
|
|
91709
|
+
result = await front.raw.delete(normalizedEndpoint);
|
|
91710
|
+
break;
|
|
91711
|
+
default:
|
|
91712
|
+
throw new Error(
|
|
91713
|
+
`Unsupported method: ${method}. Use GET, POST, PATCH, PUT, or DELETE.`
|
|
91714
|
+
);
|
|
91715
|
+
}
|
|
91716
|
+
console.log(JSON.stringify(result, null, 2));
|
|
91717
|
+
}
|
|
91718
|
+
function registerApiCommand(frontCommand) {
|
|
91719
|
+
frontCommand.command("api").description("Raw Front API request (escape hatch)").argument("<method>", "HTTP method (GET, POST, PATCH, PUT, DELETE)").argument(
|
|
91720
|
+
"<endpoint>",
|
|
91721
|
+
"API endpoint path (e.g., /me, /conversations/cnv_xxx)"
|
|
91722
|
+
).option("--data <json>", "Request body as JSON string").action(
|
|
91723
|
+
async (method, endpoint, options) => {
|
|
91724
|
+
try {
|
|
91725
|
+
await apiPassthrough(method, endpoint, options);
|
|
91726
|
+
} catch (error) {
|
|
91727
|
+
console.error(
|
|
91728
|
+
JSON.stringify(
|
|
91729
|
+
{
|
|
91730
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
91731
|
+
method: method.toUpperCase(),
|
|
91732
|
+
endpoint
|
|
91733
|
+
},
|
|
91734
|
+
null,
|
|
91735
|
+
2
|
|
91736
|
+
)
|
|
91737
|
+
);
|
|
91738
|
+
process.exit(1);
|
|
91739
|
+
}
|
|
91740
|
+
}
|
|
91741
|
+
);
|
|
91742
|
+
}
|
|
91743
|
+
|
|
91238
91744
|
// src/commands/front/archive.ts
|
|
91239
91745
|
init_esm_shims();
|
|
91240
91746
|
|
|
@@ -91286,6 +91792,31 @@ function conversationActions(convId) {
|
|
|
91286
91792
|
description: "Archive this conversation",
|
|
91287
91793
|
destructive: true
|
|
91288
91794
|
},
|
|
91795
|
+
{
|
|
91796
|
+
action: "assign",
|
|
91797
|
+
command: `skill front assign ${convId} <teammate-id> --json`,
|
|
91798
|
+
description: "Assign to a teammate"
|
|
91799
|
+
},
|
|
91800
|
+
{
|
|
91801
|
+
action: "unassign",
|
|
91802
|
+
command: `skill front assign ${convId} --unassign --json`,
|
|
91803
|
+
description: "Remove assignee"
|
|
91804
|
+
},
|
|
91805
|
+
{
|
|
91806
|
+
action: "tag",
|
|
91807
|
+
command: `skill front tag ${convId} <tag-name-or-id> --json`,
|
|
91808
|
+
description: "Add a tag"
|
|
91809
|
+
},
|
|
91810
|
+
{
|
|
91811
|
+
action: "untag",
|
|
91812
|
+
command: `skill front untag ${convId} <tag-name-or-id> --json`,
|
|
91813
|
+
description: "Remove a tag"
|
|
91814
|
+
},
|
|
91815
|
+
{
|
|
91816
|
+
action: "reply",
|
|
91817
|
+
command: `skill front reply ${convId} --body "<text>" --json`,
|
|
91818
|
+
description: "Create a draft reply"
|
|
91819
|
+
},
|
|
91289
91820
|
{
|
|
91290
91821
|
action: "tags",
|
|
91291
91822
|
command: `skill front tags list --json`,
|
|
@@ -91322,6 +91853,11 @@ function conversationListActions(inboxId) {
|
|
|
91322
91853
|
action: "triage",
|
|
91323
91854
|
command: `skill front triage --inbox ${inboxId} --json`,
|
|
91324
91855
|
description: "Triage conversations"
|
|
91856
|
+
},
|
|
91857
|
+
{
|
|
91858
|
+
action: "report",
|
|
91859
|
+
command: `skill front report --inbox ${inboxId} --json`,
|
|
91860
|
+
description: "Generate inbox report"
|
|
91325
91861
|
}
|
|
91326
91862
|
);
|
|
91327
91863
|
}
|
|
@@ -91426,7 +91962,7 @@ function teammateListLinks(teammates) {
|
|
|
91426
91962
|
}
|
|
91427
91963
|
|
|
91428
91964
|
// src/commands/front/archive.ts
|
|
91429
|
-
function
|
|
91965
|
+
function getFrontClient2() {
|
|
91430
91966
|
const apiToken = process.env.FRONT_API_TOKEN;
|
|
91431
91967
|
if (!apiToken) {
|
|
91432
91968
|
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
@@ -91450,7 +91986,7 @@ async function archiveConversation(front, convId) {
|
|
|
91450
91986
|
}
|
|
91451
91987
|
async function archiveConversations(convId, additionalIds, options) {
|
|
91452
91988
|
try {
|
|
91453
|
-
const front =
|
|
91989
|
+
const front = getFrontClient2();
|
|
91454
91990
|
const allIds = [convId, ...additionalIds];
|
|
91455
91991
|
if (options.json) {
|
|
91456
91992
|
const results2 = await Promise.all(
|
|
@@ -91525,6 +92061,75 @@ function registerArchiveCommand(frontCommand) {
|
|
|
91525
92061
|
frontCommand.command("archive").description("Archive one or more conversations by ID").argument("<id>", "Conversation ID (e.g., cnv_xxx)").argument("[ids...]", "Additional conversation IDs to archive").option("--json", "Output as JSON").action(archiveConversations);
|
|
91526
92062
|
}
|
|
91527
92063
|
|
|
92064
|
+
// src/commands/front/assign.ts
|
|
92065
|
+
init_esm_shims();
|
|
92066
|
+
function getFrontClient3() {
|
|
92067
|
+
const apiToken = process.env.FRONT_API_TOKEN;
|
|
92068
|
+
if (!apiToken) {
|
|
92069
|
+
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
92070
|
+
}
|
|
92071
|
+
return createInstrumentedFrontClient({ apiToken });
|
|
92072
|
+
}
|
|
92073
|
+
function normalizeId2(idOrUrl) {
|
|
92074
|
+
return idOrUrl.startsWith("http") ? idOrUrl.split("/").pop() : idOrUrl;
|
|
92075
|
+
}
|
|
92076
|
+
async function assignConversation(conversationId, teammateId, options) {
|
|
92077
|
+
try {
|
|
92078
|
+
const front = getFrontClient3();
|
|
92079
|
+
const convId = normalizeId2(conversationId);
|
|
92080
|
+
if (!teammateId && !options.unassign) {
|
|
92081
|
+
throw new Error(
|
|
92082
|
+
"Provide a teammate ID or use --unassign to remove assignment"
|
|
92083
|
+
);
|
|
92084
|
+
}
|
|
92085
|
+
if (teammateId && options.unassign) {
|
|
92086
|
+
throw new Error("Cannot provide both teammate ID and --unassign");
|
|
92087
|
+
}
|
|
92088
|
+
const assigneeId = options.unassign ? "" : normalizeId2(teammateId);
|
|
92089
|
+
await front.conversations.updateAssignee(convId, assigneeId);
|
|
92090
|
+
if (options.json) {
|
|
92091
|
+
console.log(
|
|
92092
|
+
JSON.stringify(
|
|
92093
|
+
hateoasWrap({
|
|
92094
|
+
type: "assign-result",
|
|
92095
|
+
command: options.unassign ? `skill front assign ${convId} --unassign --json` : `skill front assign ${convId} ${assigneeId} --json`,
|
|
92096
|
+
data: {
|
|
92097
|
+
id: convId,
|
|
92098
|
+
assignee: options.unassign ? null : assigneeId,
|
|
92099
|
+
success: true
|
|
92100
|
+
}
|
|
92101
|
+
}),
|
|
92102
|
+
null,
|
|
92103
|
+
2
|
|
92104
|
+
)
|
|
92105
|
+
);
|
|
92106
|
+
} else {
|
|
92107
|
+
if (options.unassign) {
|
|
92108
|
+
console.log(`\u2705 Unassigned ${convId}`);
|
|
92109
|
+
} else {
|
|
92110
|
+
console.log(`\u2705 Assigned ${convId} to ${assigneeId}`);
|
|
92111
|
+
}
|
|
92112
|
+
}
|
|
92113
|
+
} catch (error) {
|
|
92114
|
+
if (options.json) {
|
|
92115
|
+
console.error(
|
|
92116
|
+
JSON.stringify({
|
|
92117
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
92118
|
+
})
|
|
92119
|
+
);
|
|
92120
|
+
} else {
|
|
92121
|
+
console.error(
|
|
92122
|
+
"Error:",
|
|
92123
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
92124
|
+
);
|
|
92125
|
+
}
|
|
92126
|
+
process.exit(1);
|
|
92127
|
+
}
|
|
92128
|
+
}
|
|
92129
|
+
function registerAssignCommand(frontCommand) {
|
|
92130
|
+
frontCommand.command("assign").description("Assign a conversation to a teammate").argument("<conversation-id>", "Conversation ID (cnv_xxx)").argument("[teammate-id]", "Teammate ID (tea_xxx) - omit with --unassign").option("--unassign", "Remove assignee").option("--json", "Output as JSON").action(assignConversation);
|
|
92131
|
+
}
|
|
92132
|
+
|
|
91528
92133
|
// src/commands/front/bulk-archive.ts
|
|
91529
92134
|
init_esm_shims();
|
|
91530
92135
|
function parseDuration(duration) {
|
|
@@ -91812,9 +92417,133 @@ function registerBulkArchiveCommand(parent2) {
|
|
|
91812
92417
|
).option("--dry-run", "Preview without archiving").option("--json", "JSON output").action(bulkArchiveConversations);
|
|
91813
92418
|
}
|
|
91814
92419
|
|
|
92420
|
+
// src/commands/front/conversation-tag.ts
|
|
92421
|
+
init_esm_shims();
|
|
92422
|
+
function getFrontClient4() {
|
|
92423
|
+
const apiToken = process.env.FRONT_API_TOKEN;
|
|
92424
|
+
if (!apiToken) {
|
|
92425
|
+
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
92426
|
+
}
|
|
92427
|
+
return createInstrumentedFrontClient({ apiToken });
|
|
92428
|
+
}
|
|
92429
|
+
function normalizeId3(idOrUrl) {
|
|
92430
|
+
return idOrUrl.startsWith("http") ? idOrUrl.split("/").pop() : idOrUrl;
|
|
92431
|
+
}
|
|
92432
|
+
async function resolveTag(front, tagNameOrId) {
|
|
92433
|
+
const normalized = normalizeId3(tagNameOrId);
|
|
92434
|
+
const data2 = await front.raw.get("/tags");
|
|
92435
|
+
const tags = data2._results ?? [];
|
|
92436
|
+
if (normalized.startsWith("tag_")) {
|
|
92437
|
+
const match2 = tags.find((t2) => t2.id === normalized);
|
|
92438
|
+
return { id: normalized, name: match2?.name ?? normalized };
|
|
92439
|
+
}
|
|
92440
|
+
const needle = tagNameOrId.trim().toLowerCase();
|
|
92441
|
+
const match = tags.find((t2) => t2.name.toLowerCase() === needle);
|
|
92442
|
+
if (!match) {
|
|
92443
|
+
throw new Error(
|
|
92444
|
+
`Tag not found: "${tagNameOrId}". Use \`skill front tags list\` to see available tags.`
|
|
92445
|
+
);
|
|
92446
|
+
}
|
|
92447
|
+
return { id: match.id, name: match.name };
|
|
92448
|
+
}
|
|
92449
|
+
async function tagConversation(convId, tagNameOrId, options) {
|
|
92450
|
+
try {
|
|
92451
|
+
const front = getFrontClient4();
|
|
92452
|
+
const normalizedConvId = normalizeId3(convId);
|
|
92453
|
+
const tag = await resolveTag(front, tagNameOrId);
|
|
92454
|
+
await front.conversations.addTag(normalizedConvId, tag.id);
|
|
92455
|
+
if (options.json) {
|
|
92456
|
+
console.log(
|
|
92457
|
+
JSON.stringify(
|
|
92458
|
+
hateoasWrap({
|
|
92459
|
+
type: "tag-result",
|
|
92460
|
+
command: `skill front tag ${normalizedConvId} ${tagNameOrId} --json`,
|
|
92461
|
+
data: {
|
|
92462
|
+
conversationId: normalizedConvId,
|
|
92463
|
+
tagId: tag.id,
|
|
92464
|
+
tagName: tag.name,
|
|
92465
|
+
action: "added"
|
|
92466
|
+
}
|
|
92467
|
+
}),
|
|
92468
|
+
null,
|
|
92469
|
+
2
|
|
92470
|
+
)
|
|
92471
|
+
);
|
|
92472
|
+
return;
|
|
92473
|
+
}
|
|
92474
|
+
console.log(
|
|
92475
|
+
`
|
|
92476
|
+
\u2705 Tagged ${normalizedConvId} with "${tag.name}" (${tag.id})
|
|
92477
|
+
`
|
|
92478
|
+
);
|
|
92479
|
+
} catch (error) {
|
|
92480
|
+
if (options.json) {
|
|
92481
|
+
console.error(
|
|
92482
|
+
JSON.stringify({
|
|
92483
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
92484
|
+
})
|
|
92485
|
+
);
|
|
92486
|
+
} else {
|
|
92487
|
+
console.error(
|
|
92488
|
+
"Error:",
|
|
92489
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
92490
|
+
);
|
|
92491
|
+
}
|
|
92492
|
+
process.exit(1);
|
|
92493
|
+
}
|
|
92494
|
+
}
|
|
92495
|
+
async function untagConversation(convId, tagNameOrId, options) {
|
|
92496
|
+
try {
|
|
92497
|
+
const front = getFrontClient4();
|
|
92498
|
+
const normalizedConvId = normalizeId3(convId);
|
|
92499
|
+
const tag = await resolveTag(front, tagNameOrId);
|
|
92500
|
+
await front.conversations.removeTag(normalizedConvId, tag.id);
|
|
92501
|
+
if (options.json) {
|
|
92502
|
+
console.log(
|
|
92503
|
+
JSON.stringify(
|
|
92504
|
+
hateoasWrap({
|
|
92505
|
+
type: "untag-result",
|
|
92506
|
+
command: `skill front untag ${normalizedConvId} ${tagNameOrId} --json`,
|
|
92507
|
+
data: {
|
|
92508
|
+
conversationId: normalizedConvId,
|
|
92509
|
+
tagId: tag.id,
|
|
92510
|
+
tagName: tag.name,
|
|
92511
|
+
action: "removed"
|
|
92512
|
+
}
|
|
92513
|
+
}),
|
|
92514
|
+
null,
|
|
92515
|
+
2
|
|
92516
|
+
)
|
|
92517
|
+
);
|
|
92518
|
+
return;
|
|
92519
|
+
}
|
|
92520
|
+
console.log(`
|
|
92521
|
+
\u2705 Removed tag "${tag.name}" from ${normalizedConvId}
|
|
92522
|
+
`);
|
|
92523
|
+
} catch (error) {
|
|
92524
|
+
if (options.json) {
|
|
92525
|
+
console.error(
|
|
92526
|
+
JSON.stringify({
|
|
92527
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
92528
|
+
})
|
|
92529
|
+
);
|
|
92530
|
+
} else {
|
|
92531
|
+
console.error(
|
|
92532
|
+
"Error:",
|
|
92533
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
92534
|
+
);
|
|
92535
|
+
}
|
|
92536
|
+
process.exit(1);
|
|
92537
|
+
}
|
|
92538
|
+
}
|
|
92539
|
+
function registerConversationTagCommands(frontCommand) {
|
|
92540
|
+
frontCommand.command("tag").description("Add a tag to a conversation").argument("<conversation-id>", "Conversation ID (cnv_xxx)").argument("<tag-name-or-id>", "Tag name or ID (tag_xxx)").option("--json", "Output as JSON").action(tagConversation);
|
|
92541
|
+
frontCommand.command("untag").description("Remove a tag from a conversation").argument("<conversation-id>", "Conversation ID (cnv_xxx)").argument("<tag-name-or-id>", "Tag name or ID (tag_xxx)").option("--json", "Output as JSON").action(untagConversation);
|
|
92542
|
+
}
|
|
92543
|
+
|
|
91815
92544
|
// src/commands/front/inbox.ts
|
|
91816
92545
|
init_esm_shims();
|
|
91817
|
-
function
|
|
92546
|
+
function getFrontClient5() {
|
|
91818
92547
|
const apiToken = process.env.FRONT_API_TOKEN;
|
|
91819
92548
|
if (!apiToken) {
|
|
91820
92549
|
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
@@ -91829,12 +92558,12 @@ function formatTimestamp(ts) {
|
|
|
91829
92558
|
minute: "2-digit"
|
|
91830
92559
|
});
|
|
91831
92560
|
}
|
|
91832
|
-
function
|
|
92561
|
+
function normalizeId4(idOrUrl) {
|
|
91833
92562
|
return idOrUrl.startsWith("http") ? idOrUrl.split("/").pop() : idOrUrl;
|
|
91834
92563
|
}
|
|
91835
92564
|
async function findInbox(nameOrId) {
|
|
91836
|
-
const front =
|
|
91837
|
-
const normalizedId =
|
|
92565
|
+
const front = getFrontClient5();
|
|
92566
|
+
const normalizedId = normalizeId4(nameOrId);
|
|
91838
92567
|
if (normalizedId.startsWith("inb_")) {
|
|
91839
92568
|
try {
|
|
91840
92569
|
const inbox = await front.inboxes.get(normalizedId);
|
|
@@ -91851,7 +92580,7 @@ async function findInbox(nameOrId) {
|
|
|
91851
92580
|
}
|
|
91852
92581
|
async function listInboxes(options) {
|
|
91853
92582
|
try {
|
|
91854
|
-
const front =
|
|
92583
|
+
const front = getFrontClient5();
|
|
91855
92584
|
const inboxList = await front.inboxes.list();
|
|
91856
92585
|
const inboxes = inboxList._results ?? [];
|
|
91857
92586
|
if (options.json) {
|
|
@@ -91902,35 +92631,59 @@ async function listInboxes(options) {
|
|
|
91902
92631
|
}
|
|
91903
92632
|
async function listConversations(inboxNameOrId, options) {
|
|
91904
92633
|
try {
|
|
91905
|
-
const front =
|
|
92634
|
+
const front = getFrontClient5();
|
|
91906
92635
|
const inbox = await findInbox(inboxNameOrId);
|
|
91907
92636
|
if (!inbox) {
|
|
91908
92637
|
throw new Error(`Inbox not found: ${inboxNameOrId}`);
|
|
91909
92638
|
}
|
|
92639
|
+
const totalLimit = parseInt(String(options.limit ?? "50"), 10);
|
|
92640
|
+
const resolvedLimit = Number.isFinite(totalLimit) && totalLimit > 0 ? totalLimit : void 0;
|
|
91910
92641
|
const filters2 = [];
|
|
91911
92642
|
if (options.status) {
|
|
91912
|
-
filters2.push(`status
|
|
92643
|
+
filters2.push(`status: ${options.status}`);
|
|
91913
92644
|
}
|
|
91914
92645
|
if (options.tag) {
|
|
91915
|
-
filters2.push(`tag:"${options.tag}"`);
|
|
92646
|
+
filters2.push(`tag: "${options.tag}"`);
|
|
91916
92647
|
}
|
|
91917
|
-
const queryParts = [];
|
|
91918
|
-
if (
|
|
91919
|
-
queryParts.push(`q=${encodeURIComponent(
|
|
92648
|
+
const queryParts = ["limit=50"];
|
|
92649
|
+
if (options.status) {
|
|
92650
|
+
queryParts.push(`q[statuses][]=${encodeURIComponent(options.status)}`);
|
|
92651
|
+
}
|
|
92652
|
+
if (options.tag) {
|
|
92653
|
+
queryParts.push(`q=${encodeURIComponent(`tag:"${options.tag}"`)}`);
|
|
92654
|
+
}
|
|
92655
|
+
const queryString = `?${queryParts.join("&")}`;
|
|
92656
|
+
const conversations = [];
|
|
92657
|
+
let nextUrl = `/inboxes/${inbox.id}/conversations${queryString}`;
|
|
92658
|
+
while (nextUrl) {
|
|
92659
|
+
const response = await front.raw.get(nextUrl);
|
|
92660
|
+
conversations.push(...response._results ?? []);
|
|
92661
|
+
if (!options.json) {
|
|
92662
|
+
process.stdout.write(
|
|
92663
|
+
`\r Fetched ${conversations.length} conversations...`
|
|
92664
|
+
);
|
|
92665
|
+
}
|
|
92666
|
+
nextUrl = response._pagination?.next || null;
|
|
92667
|
+
if (resolvedLimit && conversations.length >= resolvedLimit) {
|
|
92668
|
+
conversations.splice(resolvedLimit);
|
|
92669
|
+
break;
|
|
92670
|
+
}
|
|
91920
92671
|
}
|
|
91921
|
-
if (options.
|
|
91922
|
-
|
|
92672
|
+
if (!options.json) {
|
|
92673
|
+
console.log(`
|
|
92674
|
+
Total: ${conversations.length} conversations
|
|
92675
|
+
`);
|
|
91923
92676
|
}
|
|
91924
|
-
const queryString = queryParts.length > 0 ? `?${queryParts.join("&")}` : "";
|
|
91925
|
-
const response = await front.raw.get(`/inboxes/${inbox.id}/conversations${queryString}`);
|
|
91926
|
-
const conversations = response._results ?? [];
|
|
91927
92677
|
if (options.json) {
|
|
91928
92678
|
console.log(
|
|
91929
92679
|
JSON.stringify(
|
|
91930
92680
|
hateoasWrap({
|
|
91931
92681
|
type: "conversation-list",
|
|
91932
92682
|
command: `skill front inbox ${inbox.id} --json`,
|
|
91933
|
-
data:
|
|
92683
|
+
data: {
|
|
92684
|
+
total: conversations.length,
|
|
92685
|
+
conversations
|
|
92686
|
+
},
|
|
91934
92687
|
links: conversationListLinks(
|
|
91935
92688
|
conversations.map((c) => ({ id: c.id, subject: c.subject })),
|
|
91936
92689
|
inbox.id
|
|
@@ -91970,12 +92723,6 @@ async function listConversations(inboxNameOrId, options) {
|
|
|
91970
92723
|
console.log(` Created: ${time}`);
|
|
91971
92724
|
}
|
|
91972
92725
|
console.log("");
|
|
91973
|
-
if (response._pagination?.next) {
|
|
91974
|
-
console.log(
|
|
91975
|
-
` \u{1F4A1} More conversations available. Use --limit to adjust results.`
|
|
91976
|
-
);
|
|
91977
|
-
console.log("");
|
|
91978
|
-
}
|
|
91979
92726
|
} catch (error) {
|
|
91980
92727
|
if (options.json) {
|
|
91981
92728
|
console.error(
|
|
@@ -92158,6 +92905,74 @@ function registerPullCommand(parent2) {
|
|
|
92158
92905
|
parent2.command("pull").description("Export conversations to JSON for eval datasets").option("-i, --inbox <id>", "Inbox ID to pull from").option("-l, --limit <n>", "Max conversations to pull", parseInt).option("-o, --output <file>", "Output file path").option("-f, --filter <term>", "Filter by subject/tag containing term").option("--json", "JSON output").action(pullConversations);
|
|
92159
92906
|
}
|
|
92160
92907
|
|
|
92908
|
+
// src/commands/front/reply.ts
|
|
92909
|
+
init_esm_shims();
|
|
92910
|
+
function getFrontClient6() {
|
|
92911
|
+
const apiToken = process.env.FRONT_API_TOKEN;
|
|
92912
|
+
if (!apiToken) {
|
|
92913
|
+
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
92914
|
+
}
|
|
92915
|
+
return createInstrumentedFrontClient({ apiToken });
|
|
92916
|
+
}
|
|
92917
|
+
function normalizeId5(idOrUrl) {
|
|
92918
|
+
return idOrUrl.startsWith("http") ? idOrUrl.split("/").pop() : idOrUrl;
|
|
92919
|
+
}
|
|
92920
|
+
async function replyToConversation(conversationId, options) {
|
|
92921
|
+
try {
|
|
92922
|
+
const front = getFrontClient6();
|
|
92923
|
+
const normalizedId = normalizeId5(conversationId);
|
|
92924
|
+
const draft = await front.raw.post(
|
|
92925
|
+
`/conversations/${normalizedId}/drafts`,
|
|
92926
|
+
{
|
|
92927
|
+
body: options.body,
|
|
92928
|
+
...options.author ? { author_id: options.author } : {}
|
|
92929
|
+
}
|
|
92930
|
+
);
|
|
92931
|
+
if (options.json) {
|
|
92932
|
+
console.log(
|
|
92933
|
+
JSON.stringify(
|
|
92934
|
+
hateoasWrap({
|
|
92935
|
+
type: "draft-reply",
|
|
92936
|
+
command: `skill front reply ${normalizedId} --body ${JSON.stringify(options.body)}${options.author ? ` --author ${options.author}` : ""} --json`,
|
|
92937
|
+
data: draft
|
|
92938
|
+
}),
|
|
92939
|
+
null,
|
|
92940
|
+
2
|
|
92941
|
+
)
|
|
92942
|
+
);
|
|
92943
|
+
return;
|
|
92944
|
+
}
|
|
92945
|
+
const draftId = draft.id;
|
|
92946
|
+
const bodyPreview = options.body.length > 100 ? options.body.slice(0, 100) + "..." : options.body;
|
|
92947
|
+
console.log("");
|
|
92948
|
+
console.log(`\u{1F4DD} Draft reply created on ${normalizedId}`);
|
|
92949
|
+
if (draftId) {
|
|
92950
|
+
console.log(` Draft ID: ${draftId}`);
|
|
92951
|
+
}
|
|
92952
|
+
console.log(` Body preview: ${bodyPreview}`);
|
|
92953
|
+
console.log("");
|
|
92954
|
+
console.log(` \u{1F4A1} Review and send from Front.`);
|
|
92955
|
+
console.log("");
|
|
92956
|
+
} catch (error) {
|
|
92957
|
+
if (options.json) {
|
|
92958
|
+
console.error(
|
|
92959
|
+
JSON.stringify({
|
|
92960
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
92961
|
+
})
|
|
92962
|
+
);
|
|
92963
|
+
} else {
|
|
92964
|
+
console.error(
|
|
92965
|
+
"Error:",
|
|
92966
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
92967
|
+
);
|
|
92968
|
+
}
|
|
92969
|
+
process.exit(1);
|
|
92970
|
+
}
|
|
92971
|
+
}
|
|
92972
|
+
function registerReplyCommand(frontCommand) {
|
|
92973
|
+
frontCommand.command("reply").description("Create a draft reply on a conversation").argument("<conversation-id>", "Conversation ID (cnv_xxx)").requiredOption("--body <text>", "Reply body text").option("--author <teammate-id>", "Author teammate ID").option("--json", "Output as JSON").action(replyToConversation);
|
|
92974
|
+
}
|
|
92975
|
+
|
|
92161
92976
|
// src/commands/front/report.ts
|
|
92162
92977
|
init_esm_shims();
|
|
92163
92978
|
function formatDate2(timestamp) {
|
|
@@ -92365,7 +93180,7 @@ function registerReportCommand(front) {
|
|
|
92365
93180
|
|
|
92366
93181
|
// src/commands/front/tags.ts
|
|
92367
93182
|
init_esm_shims();
|
|
92368
|
-
import { confirm as
|
|
93183
|
+
import { confirm as confirm3 } from "@inquirer/prompts";
|
|
92369
93184
|
|
|
92370
93185
|
// ../core/src/tags/audit.ts
|
|
92371
93186
|
init_esm_shims();
|
|
@@ -92577,7 +93392,7 @@ async function deleteTag(id, options) {
|
|
|
92577
93392
|
" Deleting it will remove the tag from those conversations."
|
|
92578
93393
|
);
|
|
92579
93394
|
}
|
|
92580
|
-
const confirmed = await
|
|
93395
|
+
const confirmed = await confirm3({
|
|
92581
93396
|
message: `Are you sure you want to delete tag "${tag.name}"?`,
|
|
92582
93397
|
default: false
|
|
92583
93398
|
});
|
|
@@ -92885,7 +93700,7 @@ async function cleanupTags(options) {
|
|
|
92885
93700
|
return;
|
|
92886
93701
|
}
|
|
92887
93702
|
console.log("");
|
|
92888
|
-
const confirmed = await
|
|
93703
|
+
const confirmed = await confirm3({
|
|
92889
93704
|
message: `Apply ${totalChanges} change(s)?`,
|
|
92890
93705
|
default: false
|
|
92891
93706
|
});
|
|
@@ -92920,7 +93735,7 @@ function registerTagCommands(frontCommand) {
|
|
|
92920
93735
|
|
|
92921
93736
|
// src/commands/front/triage.ts
|
|
92922
93737
|
init_esm_shims();
|
|
92923
|
-
function
|
|
93738
|
+
function getFrontClient7() {
|
|
92924
93739
|
const apiToken = process.env.FRONT_API_TOKEN;
|
|
92925
93740
|
if (!apiToken) {
|
|
92926
93741
|
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
@@ -92975,7 +93790,7 @@ async function triageConversations(options) {
|
|
|
92975
93790
|
json = false
|
|
92976
93791
|
} = options;
|
|
92977
93792
|
try {
|
|
92978
|
-
const front =
|
|
93793
|
+
const front = getFrontClient7();
|
|
92979
93794
|
if (!json) {
|
|
92980
93795
|
console.log(`
|
|
92981
93796
|
Fetching ${status} conversations from inbox ${inbox}...`);
|
|
@@ -93142,7 +93957,7 @@ function registerTriageCommand(front) {
|
|
|
93142
93957
|
}
|
|
93143
93958
|
|
|
93144
93959
|
// src/commands/front/index.ts
|
|
93145
|
-
function
|
|
93960
|
+
function getFrontClient8() {
|
|
93146
93961
|
const apiToken = process.env.FRONT_API_TOKEN;
|
|
93147
93962
|
if (!apiToken) {
|
|
93148
93963
|
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
@@ -93168,19 +93983,19 @@ function truncate3(str2, len) {
|
|
|
93168
93983
|
if (str2.length <= len) return str2;
|
|
93169
93984
|
return str2.slice(0, len - 3) + "...";
|
|
93170
93985
|
}
|
|
93171
|
-
function
|
|
93986
|
+
function normalizeId6(idOrUrl) {
|
|
93172
93987
|
return idOrUrl.startsWith("http") ? idOrUrl.split("/").pop() : idOrUrl;
|
|
93173
93988
|
}
|
|
93174
93989
|
async function getMessage(id, options) {
|
|
93175
93990
|
try {
|
|
93176
|
-
const front =
|
|
93177
|
-
const message = await front.messages.get(
|
|
93991
|
+
const front = getFrontClient8();
|
|
93992
|
+
const message = await front.messages.get(normalizeId6(id));
|
|
93178
93993
|
if (options.json) {
|
|
93179
93994
|
console.log(
|
|
93180
93995
|
JSON.stringify(
|
|
93181
93996
|
hateoasWrap({
|
|
93182
93997
|
type: "message",
|
|
93183
|
-
command: `skill front message ${
|
|
93998
|
+
command: `skill front message ${normalizeId6(id)} --json`,
|
|
93184
93999
|
data: message,
|
|
93185
94000
|
links: messageLinks(message.id)
|
|
93186
94001
|
}),
|
|
@@ -93234,17 +94049,17 @@ async function getMessage(id, options) {
|
|
|
93234
94049
|
}
|
|
93235
94050
|
async function getConversation2(id, options) {
|
|
93236
94051
|
try {
|
|
93237
|
-
const front =
|
|
93238
|
-
const conversation = await front.conversations.get(
|
|
94052
|
+
const front = getFrontClient8();
|
|
94053
|
+
const conversation = await front.conversations.get(normalizeId6(id));
|
|
93239
94054
|
let messages;
|
|
93240
94055
|
if (options.messages) {
|
|
93241
94056
|
const messageList = await front.conversations.listMessages(
|
|
93242
|
-
|
|
94057
|
+
normalizeId6(id)
|
|
93243
94058
|
);
|
|
93244
94059
|
messages = messageList._results ?? [];
|
|
93245
94060
|
}
|
|
93246
94061
|
if (options.json) {
|
|
93247
|
-
const convId =
|
|
94062
|
+
const convId = normalizeId6(id);
|
|
93248
94063
|
console.log(
|
|
93249
94064
|
JSON.stringify(
|
|
93250
94065
|
hateoasWrap({
|
|
@@ -93347,10 +94162,18 @@ async function listTeammates(options) {
|
|
|
93347
94162
|
console.log("");
|
|
93348
94163
|
}
|
|
93349
94164
|
} catch (error) {
|
|
93350
|
-
|
|
93351
|
-
|
|
93352
|
-
|
|
93353
|
-
|
|
94165
|
+
if (options.json) {
|
|
94166
|
+
console.error(
|
|
94167
|
+
JSON.stringify({
|
|
94168
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
94169
|
+
})
|
|
94170
|
+
);
|
|
94171
|
+
} else {
|
|
94172
|
+
console.error(
|
|
94173
|
+
"Error:",
|
|
94174
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
94175
|
+
);
|
|
94176
|
+
}
|
|
93354
94177
|
process.exit(1);
|
|
93355
94178
|
}
|
|
93356
94179
|
}
|
|
@@ -93387,10 +94210,18 @@ async function getTeammate(id, options) {
|
|
|
93387
94210
|
console.log(` Available: ${teammate.is_available ? "Yes" : "No"}`);
|
|
93388
94211
|
console.log("");
|
|
93389
94212
|
} catch (error) {
|
|
93390
|
-
|
|
93391
|
-
|
|
93392
|
-
|
|
93393
|
-
|
|
94213
|
+
if (options.json) {
|
|
94214
|
+
console.error(
|
|
94215
|
+
JSON.stringify({
|
|
94216
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
94217
|
+
})
|
|
94218
|
+
);
|
|
94219
|
+
} else {
|
|
94220
|
+
console.error(
|
|
94221
|
+
"Error:",
|
|
94222
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
94223
|
+
);
|
|
94224
|
+
}
|
|
93394
94225
|
process.exit(1);
|
|
93395
94226
|
}
|
|
93396
94227
|
}
|
|
@@ -93407,6 +94238,10 @@ function registerFrontCommands(program3) {
|
|
|
93407
94238
|
registerTriageCommand(front);
|
|
93408
94239
|
registerPullCommand(front);
|
|
93409
94240
|
registerTagCommands(front);
|
|
94241
|
+
registerAssignCommand(front);
|
|
94242
|
+
registerConversationTagCommands(front);
|
|
94243
|
+
registerReplyCommand(front);
|
|
94244
|
+
registerApiCommand(front);
|
|
93410
94245
|
}
|
|
93411
94246
|
|
|
93412
94247
|
// src/commands/health.ts
|
|
@@ -93761,8 +94596,8 @@ var EventResponseSchema = z7.object({
|
|
|
93761
94596
|
var EventRunsResponseSchema = z7.object({
|
|
93762
94597
|
data: z7.array(RunSchema).nullable()
|
|
93763
94598
|
});
|
|
93764
|
-
function parseTimeArg(
|
|
93765
|
-
const match =
|
|
94599
|
+
function parseTimeArg(input3) {
|
|
94600
|
+
const match = input3.match(/^(\d+)([hmd])$/);
|
|
93766
94601
|
if (match) {
|
|
93767
94602
|
const [, num, unit] = match;
|
|
93768
94603
|
const msPerUnit = {
|
|
@@ -93772,11 +94607,11 @@ function parseTimeArg(input2) {
|
|
|
93772
94607
|
};
|
|
93773
94608
|
const ms = unit ? msPerUnit[unit] : void 0;
|
|
93774
94609
|
if (!ms || !num) {
|
|
93775
|
-
return
|
|
94610
|
+
return input3;
|
|
93776
94611
|
}
|
|
93777
94612
|
return new Date(Date.now() - parseInt(num) * ms).toISOString();
|
|
93778
94613
|
}
|
|
93779
|
-
return
|
|
94614
|
+
return input3;
|
|
93780
94615
|
}
|
|
93781
94616
|
async function detectDevServer() {
|
|
93782
94617
|
try {
|
|
@@ -94350,7 +95185,7 @@ function registerInvestigateCommands(inngest) {
|
|
|
94350
95185
|
|
|
94351
95186
|
// src/commands/inngest/runs.ts
|
|
94352
95187
|
init_esm_shims();
|
|
94353
|
-
import { confirm as
|
|
95188
|
+
import { confirm as confirm4 } from "@inquirer/prompts";
|
|
94354
95189
|
import "commander";
|
|
94355
95190
|
function formatRun(run3) {
|
|
94356
95191
|
const startedAt = new Date(run3.run_started_at).toLocaleString();
|
|
@@ -94396,7 +95231,7 @@ async function cancelCommand(id, options) {
|
|
|
94396
95231
|
try {
|
|
94397
95232
|
const isDev = options.dev ?? await detectDevServer();
|
|
94398
95233
|
if (!options.force) {
|
|
94399
|
-
const confirmed = await
|
|
95234
|
+
const confirmed = await confirm4({
|
|
94400
95235
|
message: `Cancel run ${id}?`,
|
|
94401
95236
|
default: false
|
|
94402
95237
|
});
|
|
@@ -94422,14 +95257,14 @@ function registerRunsCommands(inngest) {
|
|
|
94422
95257
|
|
|
94423
95258
|
// src/commands/inngest/signal.ts
|
|
94424
95259
|
init_esm_shims();
|
|
94425
|
-
import { readFileSync as
|
|
95260
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
94426
95261
|
import "commander";
|
|
94427
95262
|
async function signalCommand(signal, options) {
|
|
94428
95263
|
const { data: dataString, dataFile, dev = false, json = false } = options;
|
|
94429
95264
|
let data2 = null;
|
|
94430
95265
|
if (dataFile) {
|
|
94431
95266
|
try {
|
|
94432
|
-
const fileContent =
|
|
95267
|
+
const fileContent = readFileSync8(dataFile, "utf-8");
|
|
94433
95268
|
data2 = JSON.parse(fileContent);
|
|
94434
95269
|
} catch (err) {
|
|
94435
95270
|
const error = {
|
|
@@ -96585,22 +97420,22 @@ init_esm_shims();
|
|
|
96585
97420
|
|
|
96586
97421
|
// ../../node_modules/.bun/entities@7.0.1/node_modules/entities/dist/esm/internal/decode-shared.js
|
|
96587
97422
|
init_esm_shims();
|
|
96588
|
-
function decodeBase64(
|
|
97423
|
+
function decodeBase64(input3) {
|
|
96589
97424
|
const binary = (
|
|
96590
97425
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
96591
97426
|
typeof atob === "function" ? (
|
|
96592
97427
|
// Browser (and Node >=16)
|
|
96593
97428
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
96594
|
-
atob(
|
|
97429
|
+
atob(input3)
|
|
96595
97430
|
) : (
|
|
96596
97431
|
// Older Node versions (<16)
|
|
96597
97432
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
96598
97433
|
typeof Buffer.from === "function" ? (
|
|
96599
97434
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
96600
|
-
Buffer.from(
|
|
97435
|
+
Buffer.from(input3, "base64").toString("binary")
|
|
96601
97436
|
) : (
|
|
96602
97437
|
// eslint-disable-next-line unicorn/no-new-buffer, n/no-deprecated-api
|
|
96603
|
-
new Buffer(
|
|
97438
|
+
new Buffer(input3, "base64").toString("binary")
|
|
96604
97439
|
)
|
|
96605
97440
|
)
|
|
96606
97441
|
);
|
|
@@ -96708,28 +97543,28 @@ var EntityDecoder2 = class {
|
|
|
96708
97543
|
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
|
|
96709
97544
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
96710
97545
|
*/
|
|
96711
|
-
write(
|
|
97546
|
+
write(input3, offset) {
|
|
96712
97547
|
switch (this.state) {
|
|
96713
97548
|
case EntityDecoderState2.EntityStart: {
|
|
96714
|
-
if (
|
|
97549
|
+
if (input3.charCodeAt(offset) === CharCodes2.NUM) {
|
|
96715
97550
|
this.state = EntityDecoderState2.NumericStart;
|
|
96716
97551
|
this.consumed += 1;
|
|
96717
|
-
return this.stateNumericStart(
|
|
97552
|
+
return this.stateNumericStart(input3, offset + 1);
|
|
96718
97553
|
}
|
|
96719
97554
|
this.state = EntityDecoderState2.NamedEntity;
|
|
96720
|
-
return this.stateNamedEntity(
|
|
97555
|
+
return this.stateNamedEntity(input3, offset);
|
|
96721
97556
|
}
|
|
96722
97557
|
case EntityDecoderState2.NumericStart: {
|
|
96723
|
-
return this.stateNumericStart(
|
|
97558
|
+
return this.stateNumericStart(input3, offset);
|
|
96724
97559
|
}
|
|
96725
97560
|
case EntityDecoderState2.NumericDecimal: {
|
|
96726
|
-
return this.stateNumericDecimal(
|
|
97561
|
+
return this.stateNumericDecimal(input3, offset);
|
|
96727
97562
|
}
|
|
96728
97563
|
case EntityDecoderState2.NumericHex: {
|
|
96729
|
-
return this.stateNumericHex(
|
|
97564
|
+
return this.stateNumericHex(input3, offset);
|
|
96730
97565
|
}
|
|
96731
97566
|
case EntityDecoderState2.NamedEntity: {
|
|
96732
|
-
return this.stateNamedEntity(
|
|
97567
|
+
return this.stateNamedEntity(input3, offset);
|
|
96733
97568
|
}
|
|
96734
97569
|
}
|
|
96735
97570
|
}
|
|
@@ -96742,17 +97577,17 @@ var EntityDecoder2 = class {
|
|
|
96742
97577
|
* @param offset The current offset.
|
|
96743
97578
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
96744
97579
|
*/
|
|
96745
|
-
stateNumericStart(
|
|
96746
|
-
if (offset >=
|
|
97580
|
+
stateNumericStart(input3, offset) {
|
|
97581
|
+
if (offset >= input3.length) {
|
|
96747
97582
|
return -1;
|
|
96748
97583
|
}
|
|
96749
|
-
if ((
|
|
97584
|
+
if ((input3.charCodeAt(offset) | TO_LOWER_BIT2) === CharCodes2.LOWER_X) {
|
|
96750
97585
|
this.state = EntityDecoderState2.NumericHex;
|
|
96751
97586
|
this.consumed += 1;
|
|
96752
|
-
return this.stateNumericHex(
|
|
97587
|
+
return this.stateNumericHex(input3, offset + 1);
|
|
96753
97588
|
}
|
|
96754
97589
|
this.state = EntityDecoderState2.NumericDecimal;
|
|
96755
|
-
return this.stateNumericDecimal(
|
|
97590
|
+
return this.stateNumericDecimal(input3, offset);
|
|
96756
97591
|
}
|
|
96757
97592
|
/**
|
|
96758
97593
|
* Parses a hexadecimal numeric entity.
|
|
@@ -96763,9 +97598,9 @@ var EntityDecoder2 = class {
|
|
|
96763
97598
|
* @param offset The current offset.
|
|
96764
97599
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
96765
97600
|
*/
|
|
96766
|
-
stateNumericHex(
|
|
96767
|
-
while (offset <
|
|
96768
|
-
const char =
|
|
97601
|
+
stateNumericHex(input3, offset) {
|
|
97602
|
+
while (offset < input3.length) {
|
|
97603
|
+
const char = input3.charCodeAt(offset);
|
|
96769
97604
|
if (isNumber2(char) || isHexadecimalCharacter2(char)) {
|
|
96770
97605
|
const digit = char <= CharCodes2.NINE ? char - CharCodes2.ZERO : (char | TO_LOWER_BIT2) - CharCodes2.LOWER_A + 10;
|
|
96771
97606
|
this.result = this.result * 16 + digit;
|
|
@@ -96786,9 +97621,9 @@ var EntityDecoder2 = class {
|
|
|
96786
97621
|
* @param offset The current offset.
|
|
96787
97622
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
96788
97623
|
*/
|
|
96789
|
-
stateNumericDecimal(
|
|
96790
|
-
while (offset <
|
|
96791
|
-
const char =
|
|
97624
|
+
stateNumericDecimal(input3, offset) {
|
|
97625
|
+
while (offset < input3.length) {
|
|
97626
|
+
const char = input3.charCodeAt(offset);
|
|
96792
97627
|
if (isNumber2(char)) {
|
|
96793
97628
|
this.result = this.result * 10 + (char - CharCodes2.ZERO);
|
|
96794
97629
|
this.consumed++;
|
|
@@ -96841,16 +97676,16 @@ var EntityDecoder2 = class {
|
|
|
96841
97676
|
* @param offset The current offset.
|
|
96842
97677
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
96843
97678
|
*/
|
|
96844
|
-
stateNamedEntity(
|
|
97679
|
+
stateNamedEntity(input3, offset) {
|
|
96845
97680
|
const { decodeTree } = this;
|
|
96846
97681
|
let current = decodeTree[this.treeIndex];
|
|
96847
97682
|
let valueLength = (current & BinTrieFlags2.VALUE_LENGTH) >> 14;
|
|
96848
|
-
while (offset <
|
|
97683
|
+
while (offset < input3.length) {
|
|
96849
97684
|
if (valueLength === 0 && (current & BinTrieFlags2.FLAG13) !== 0) {
|
|
96850
97685
|
const runLength = (current & BinTrieFlags2.BRANCH_LENGTH) >> 7;
|
|
96851
97686
|
if (this.runConsumed === 0) {
|
|
96852
97687
|
const firstChar = current & BinTrieFlags2.JUMP_TABLE;
|
|
96853
|
-
if (
|
|
97688
|
+
if (input3.charCodeAt(offset) !== firstChar) {
|
|
96854
97689
|
return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity();
|
|
96855
97690
|
}
|
|
96856
97691
|
offset++;
|
|
@@ -96858,13 +97693,13 @@ var EntityDecoder2 = class {
|
|
|
96858
97693
|
this.runConsumed++;
|
|
96859
97694
|
}
|
|
96860
97695
|
while (this.runConsumed < runLength) {
|
|
96861
|
-
if (offset >=
|
|
97696
|
+
if (offset >= input3.length) {
|
|
96862
97697
|
return -1;
|
|
96863
97698
|
}
|
|
96864
97699
|
const charIndexInPacked = this.runConsumed - 1;
|
|
96865
97700
|
const packedWord = decodeTree[this.treeIndex + 1 + (charIndexInPacked >> 1)];
|
|
96866
97701
|
const expectedChar = charIndexInPacked % 2 === 0 ? packedWord & 255 : packedWord >> 8 & 255;
|
|
96867
|
-
if (
|
|
97702
|
+
if (input3.charCodeAt(offset) !== expectedChar) {
|
|
96868
97703
|
this.runConsumed = 0;
|
|
96869
97704
|
return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity();
|
|
96870
97705
|
}
|
|
@@ -96877,9 +97712,9 @@ var EntityDecoder2 = class {
|
|
|
96877
97712
|
current = decodeTree[this.treeIndex];
|
|
96878
97713
|
valueLength = (current & BinTrieFlags2.VALUE_LENGTH) >> 14;
|
|
96879
97714
|
}
|
|
96880
|
-
if (offset >=
|
|
97715
|
+
if (offset >= input3.length)
|
|
96881
97716
|
break;
|
|
96882
|
-
const char =
|
|
97717
|
+
const char = input3.charCodeAt(offset);
|
|
96883
97718
|
if (char === CharCodes2.SEMI && valueLength !== 0 && (current & BinTrieFlags2.FLAG13) !== 0) {
|
|
96884
97719
|
return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
|
|
96885
97720
|
}
|
|
@@ -99886,7 +100721,7 @@ var compile3 = wrapCompile(compile2);
|
|
|
99886
100721
|
var _compileUnsafe = wrapCompile(compileUnsafe);
|
|
99887
100722
|
var _compileToken = wrapCompile(compileToken);
|
|
99888
100723
|
function getSelectorFunc(searchFunc) {
|
|
99889
|
-
return function
|
|
100724
|
+
return function select5(query, elements, options) {
|
|
99890
100725
|
const opts = convertOptionFormats(options);
|
|
99891
100726
|
if (typeof query !== "function") {
|
|
99892
100727
|
query = compileUnsafe(query, opts, elements);
|
|
@@ -100073,7 +100908,7 @@ function filterBySelector(selector, elements, options) {
|
|
|
100073
100908
|
}
|
|
100074
100909
|
return findFilterElements(elements, selector, options, false, elements.length);
|
|
100075
100910
|
}
|
|
100076
|
-
function
|
|
100911
|
+
function select3(selector, root2, options = {}, limit2 = Infinity) {
|
|
100077
100912
|
if (typeof selector === "function") {
|
|
100078
100913
|
return find3(root2, selector);
|
|
100079
100914
|
}
|
|
@@ -100178,7 +101013,7 @@ function _findBySelector(selector, limit2) {
|
|
|
100178
101013
|
pseudos: this.options.pseudos,
|
|
100179
101014
|
quirksMode: this.options.quirksMode
|
|
100180
101015
|
};
|
|
100181
|
-
return this._make(
|
|
101016
|
+
return this._make(select3(selector, elems, options, limit2));
|
|
100182
101017
|
}
|
|
100183
101018
|
function _getMatcher(matchMap) {
|
|
100184
101019
|
return function(fn, ...postFns) {
|
|
@@ -101603,28 +102438,28 @@ var EntityDecoder3 = class {
|
|
|
101603
102438
|
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
|
|
101604
102439
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
101605
102440
|
*/
|
|
101606
|
-
write(
|
|
102441
|
+
write(input3, offset) {
|
|
101607
102442
|
switch (this.state) {
|
|
101608
102443
|
case EntityDecoderState3.EntityStart: {
|
|
101609
|
-
if (
|
|
102444
|
+
if (input3.charCodeAt(offset) === CharCodes4.NUM) {
|
|
101610
102445
|
this.state = EntityDecoderState3.NumericStart;
|
|
101611
102446
|
this.consumed += 1;
|
|
101612
|
-
return this.stateNumericStart(
|
|
102447
|
+
return this.stateNumericStart(input3, offset + 1);
|
|
101613
102448
|
}
|
|
101614
102449
|
this.state = EntityDecoderState3.NamedEntity;
|
|
101615
|
-
return this.stateNamedEntity(
|
|
102450
|
+
return this.stateNamedEntity(input3, offset);
|
|
101616
102451
|
}
|
|
101617
102452
|
case EntityDecoderState3.NumericStart: {
|
|
101618
|
-
return this.stateNumericStart(
|
|
102453
|
+
return this.stateNumericStart(input3, offset);
|
|
101619
102454
|
}
|
|
101620
102455
|
case EntityDecoderState3.NumericDecimal: {
|
|
101621
|
-
return this.stateNumericDecimal(
|
|
102456
|
+
return this.stateNumericDecimal(input3, offset);
|
|
101622
102457
|
}
|
|
101623
102458
|
case EntityDecoderState3.NumericHex: {
|
|
101624
|
-
return this.stateNumericHex(
|
|
102459
|
+
return this.stateNumericHex(input3, offset);
|
|
101625
102460
|
}
|
|
101626
102461
|
case EntityDecoderState3.NamedEntity: {
|
|
101627
|
-
return this.stateNamedEntity(
|
|
102462
|
+
return this.stateNamedEntity(input3, offset);
|
|
101628
102463
|
}
|
|
101629
102464
|
}
|
|
101630
102465
|
}
|
|
@@ -101637,22 +102472,22 @@ var EntityDecoder3 = class {
|
|
|
101637
102472
|
* @param offset The current offset.
|
|
101638
102473
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
101639
102474
|
*/
|
|
101640
|
-
stateNumericStart(
|
|
101641
|
-
if (offset >=
|
|
102475
|
+
stateNumericStart(input3, offset) {
|
|
102476
|
+
if (offset >= input3.length) {
|
|
101642
102477
|
return -1;
|
|
101643
102478
|
}
|
|
101644
|
-
if ((
|
|
102479
|
+
if ((input3.charCodeAt(offset) | TO_LOWER_BIT3) === CharCodes4.LOWER_X) {
|
|
101645
102480
|
this.state = EntityDecoderState3.NumericHex;
|
|
101646
102481
|
this.consumed += 1;
|
|
101647
|
-
return this.stateNumericHex(
|
|
102482
|
+
return this.stateNumericHex(input3, offset + 1);
|
|
101648
102483
|
}
|
|
101649
102484
|
this.state = EntityDecoderState3.NumericDecimal;
|
|
101650
|
-
return this.stateNumericDecimal(
|
|
102485
|
+
return this.stateNumericDecimal(input3, offset);
|
|
101651
102486
|
}
|
|
101652
|
-
addToNumericResult(
|
|
102487
|
+
addToNumericResult(input3, start, end2, base) {
|
|
101653
102488
|
if (start !== end2) {
|
|
101654
102489
|
const digitCount = end2 - start;
|
|
101655
|
-
this.result = this.result * Math.pow(base, digitCount) + Number.parseInt(
|
|
102490
|
+
this.result = this.result * Math.pow(base, digitCount) + Number.parseInt(input3.substr(start, digitCount), base);
|
|
101656
102491
|
this.consumed += digitCount;
|
|
101657
102492
|
}
|
|
101658
102493
|
}
|
|
@@ -101665,18 +102500,18 @@ var EntityDecoder3 = class {
|
|
|
101665
102500
|
* @param offset The current offset.
|
|
101666
102501
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
101667
102502
|
*/
|
|
101668
|
-
stateNumericHex(
|
|
102503
|
+
stateNumericHex(input3, offset) {
|
|
101669
102504
|
const startIndex = offset;
|
|
101670
|
-
while (offset <
|
|
101671
|
-
const char =
|
|
102505
|
+
while (offset < input3.length) {
|
|
102506
|
+
const char = input3.charCodeAt(offset);
|
|
101672
102507
|
if (isNumber3(char) || isHexadecimalCharacter3(char)) {
|
|
101673
102508
|
offset += 1;
|
|
101674
102509
|
} else {
|
|
101675
|
-
this.addToNumericResult(
|
|
102510
|
+
this.addToNumericResult(input3, startIndex, offset, 16);
|
|
101676
102511
|
return this.emitNumericEntity(char, 3);
|
|
101677
102512
|
}
|
|
101678
102513
|
}
|
|
101679
|
-
this.addToNumericResult(
|
|
102514
|
+
this.addToNumericResult(input3, startIndex, offset, 16);
|
|
101680
102515
|
return -1;
|
|
101681
102516
|
}
|
|
101682
102517
|
/**
|
|
@@ -101688,18 +102523,18 @@ var EntityDecoder3 = class {
|
|
|
101688
102523
|
* @param offset The current offset.
|
|
101689
102524
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
101690
102525
|
*/
|
|
101691
|
-
stateNumericDecimal(
|
|
102526
|
+
stateNumericDecimal(input3, offset) {
|
|
101692
102527
|
const startIndex = offset;
|
|
101693
|
-
while (offset <
|
|
101694
|
-
const char =
|
|
102528
|
+
while (offset < input3.length) {
|
|
102529
|
+
const char = input3.charCodeAt(offset);
|
|
101695
102530
|
if (isNumber3(char)) {
|
|
101696
102531
|
offset += 1;
|
|
101697
102532
|
} else {
|
|
101698
|
-
this.addToNumericResult(
|
|
102533
|
+
this.addToNumericResult(input3, startIndex, offset, 10);
|
|
101699
102534
|
return this.emitNumericEntity(char, 2);
|
|
101700
102535
|
}
|
|
101701
102536
|
}
|
|
101702
|
-
this.addToNumericResult(
|
|
102537
|
+
this.addToNumericResult(input3, startIndex, offset, 10);
|
|
101703
102538
|
return -1;
|
|
101704
102539
|
}
|
|
101705
102540
|
/**
|
|
@@ -101744,12 +102579,12 @@ var EntityDecoder3 = class {
|
|
|
101744
102579
|
* @param offset The current offset.
|
|
101745
102580
|
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
101746
102581
|
*/
|
|
101747
|
-
stateNamedEntity(
|
|
102582
|
+
stateNamedEntity(input3, offset) {
|
|
101748
102583
|
const { decodeTree } = this;
|
|
101749
102584
|
let current = decodeTree[this.treeIndex];
|
|
101750
102585
|
let valueLength = (current & BinTrieFlags3.VALUE_LENGTH) >> 14;
|
|
101751
|
-
for (; offset <
|
|
101752
|
-
const char =
|
|
102586
|
+
for (; offset < input3.length; offset++, this.excess++) {
|
|
102587
|
+
const char = input3.charCodeAt(offset);
|
|
101753
102588
|
this.treeIndex = determineBranch3(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
|
|
101754
102589
|
if (this.treeIndex < 0) {
|
|
101755
102590
|
return this.result === 0 || // If we are parsing an attribute
|
|
@@ -108963,7 +109798,7 @@ var getCodePoint2 = (
|
|
|
108963
109798
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
108964
109799
|
String.prototype.codePointAt == null ? (c, index2) => (c.charCodeAt(index2) & 64512) === 55296 ? (c.charCodeAt(index2) - 55296) * 1024 + c.charCodeAt(index2 + 1) - 56320 + 65536 : c.charCodeAt(index2) : (
|
|
108965
109800
|
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
108966
|
-
(
|
|
109801
|
+
(input3, index2) => input3.codePointAt(index2)
|
|
108967
109802
|
)
|
|
108968
109803
|
);
|
|
108969
109804
|
function getEscaper2(regex, map2) {
|
|
@@ -110149,19 +110984,19 @@ async function ingest(options) {
|
|
|
110149
110984
|
}
|
|
110150
110985
|
case "database": {
|
|
110151
110986
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
110152
|
-
articles = inputArticles.map((
|
|
110153
|
-
id: `kb-${appId}-db-${index2}-${slugify4(
|
|
110154
|
-
title:
|
|
110155
|
-
question:
|
|
110156
|
-
answer:
|
|
110987
|
+
articles = inputArticles.map((input3, index2) => ({
|
|
110988
|
+
id: `kb-${appId}-db-${index2}-${slugify4(input3.title)}`,
|
|
110989
|
+
title: input3.title,
|
|
110990
|
+
question: input3.question,
|
|
110991
|
+
answer: input3.answer,
|
|
110157
110992
|
appId,
|
|
110158
110993
|
metadata: {
|
|
110159
110994
|
source: defaultSource,
|
|
110160
|
-
category:
|
|
110995
|
+
category: input3.category || defaultCategory,
|
|
110161
110996
|
created_at: now,
|
|
110162
110997
|
updated_at: now,
|
|
110163
|
-
tags:
|
|
110164
|
-
trust_score:
|
|
110998
|
+
tags: input3.tags || [],
|
|
110999
|
+
trust_score: input3.trust_score ?? 1
|
|
110165
111000
|
}
|
|
110166
111001
|
}));
|
|
110167
111002
|
break;
|
|
@@ -112295,7 +113130,7 @@ function registerToolsCommands(program3) {
|
|
|
112295
113130
|
// src/commands/wizard.ts
|
|
112296
113131
|
init_esm_shims();
|
|
112297
113132
|
import { randomBytes as randomBytes2, randomUUID as randomUUID3 } from "crypto";
|
|
112298
|
-
import { checkbox, confirm as
|
|
113133
|
+
import { checkbox, confirm as confirm5, input as input2 } from "@inquirer/prompts";
|
|
112299
113134
|
var ALL_CAPABILITIES = [
|
|
112300
113135
|
{
|
|
112301
113136
|
value: "lookupUser",
|
|
@@ -112359,21 +113194,21 @@ async function wizard(options = {}) {
|
|
|
112359
113194
|
console.log(
|
|
112360
113195
|
"This will walk you through setting up a new app in the support platform.\n"
|
|
112361
113196
|
);
|
|
112362
|
-
const name = await
|
|
113197
|
+
const name = await input2({
|
|
112363
113198
|
message: 'App name (e.g., "Total TypeScript"):',
|
|
112364
113199
|
validate: (v) => v.trim().length > 0 || "Name is required"
|
|
112365
113200
|
});
|
|
112366
113201
|
const suggestedSlug = slugify5(name);
|
|
112367
|
-
const slug = await
|
|
113202
|
+
const slug = await input2({
|
|
112368
113203
|
message: "URL slug:",
|
|
112369
113204
|
default: suggestedSlug,
|
|
112370
113205
|
validate: (v) => /^[a-z0-9-]+$/.test(v) || "Slug must be lowercase alphanumeric with dashes"
|
|
112371
113206
|
});
|
|
112372
|
-
const frontInboxId = await
|
|
113207
|
+
const frontInboxId = await input2({
|
|
112373
113208
|
message: 'Front inbox ID (e.g., "inb_abc123"):',
|
|
112374
113209
|
validate: (v) => v.startsWith("inb_") || "Must be a valid Front inbox ID (starts with inb_)"
|
|
112375
113210
|
});
|
|
112376
|
-
const integrationBaseUrl = await
|
|
113211
|
+
const integrationBaseUrl = await input2({
|
|
112377
113212
|
message: "Integration base URL (where SDK endpoints live):",
|
|
112378
113213
|
default: `https://${slug}.com`,
|
|
112379
113214
|
validate: (v) => {
|
|
@@ -112393,42 +113228,42 @@ async function wizard(options = {}) {
|
|
|
112393
113228
|
checked: c.checked
|
|
112394
113229
|
}))
|
|
112395
113230
|
});
|
|
112396
|
-
const useStripe = await
|
|
113231
|
+
const useStripe = await confirm5({
|
|
112397
113232
|
message: "Enable Stripe Connect for refund processing?",
|
|
112398
113233
|
default: true
|
|
112399
113234
|
});
|
|
112400
113235
|
let stripeAccountId;
|
|
112401
113236
|
if (useStripe) {
|
|
112402
|
-
stripeAccountId = await
|
|
113237
|
+
stripeAccountId = await input2({
|
|
112403
113238
|
message: 'Stripe Connect account ID (e.g., "acct_xxx") or leave blank to connect later:',
|
|
112404
113239
|
default: ""
|
|
112405
113240
|
}) || void 0;
|
|
112406
113241
|
}
|
|
112407
|
-
const useSlackEscalation = await
|
|
113242
|
+
const useSlackEscalation = await confirm5({
|
|
112408
113243
|
message: "Configure Slack escalation channel?",
|
|
112409
113244
|
default: false
|
|
112410
113245
|
});
|
|
112411
113246
|
let escalationSlackChannel;
|
|
112412
113247
|
if (useSlackEscalation) {
|
|
112413
|
-
escalationSlackChannel = await
|
|
113248
|
+
escalationSlackChannel = await input2({
|
|
112414
113249
|
message: 'Slack channel ID for escalations (e.g., "C0123456789"):',
|
|
112415
113250
|
validate: (v) => v.startsWith("C") || "Must be a valid Slack channel ID"
|
|
112416
113251
|
});
|
|
112417
113252
|
}
|
|
112418
|
-
const configureAutoApproval = await
|
|
113253
|
+
const configureAutoApproval = await confirm5({
|
|
112419
113254
|
message: "Configure auto-approval thresholds? (default: 30 days refund, 14 days transfer)",
|
|
112420
113255
|
default: false
|
|
112421
113256
|
});
|
|
112422
113257
|
let autoApproveRefundDays = 30;
|
|
112423
113258
|
let autoApproveTransferDays = 14;
|
|
112424
113259
|
if (configureAutoApproval) {
|
|
112425
|
-
const refundDaysStr = await
|
|
113260
|
+
const refundDaysStr = await input2({
|
|
112426
113261
|
message: "Auto-approve refunds within X days of purchase:",
|
|
112427
113262
|
default: "30",
|
|
112428
113263
|
validate: (v) => !isNaN(parseInt(v)) && parseInt(v) >= 0 || "Must be a non-negative number"
|
|
112429
113264
|
});
|
|
112430
113265
|
autoApproveRefundDays = parseInt(refundDaysStr);
|
|
112431
|
-
const transferDaysStr = await
|
|
113266
|
+
const transferDaysStr = await input2({
|
|
112432
113267
|
message: "Auto-approve transfers within X days of purchase:",
|
|
112433
113268
|
default: "14",
|
|
112434
113269
|
validate: (v) => !isNaN(parseInt(v)) && parseInt(v) >= 0 || "Must be a non-negative number"
|