@scribed/cli 0.1.15 → 0.1.16
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 +919 -113
- package/dist/mcp/server.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -47519,6 +47519,831 @@ var require_content_type = __commonJS((exports) => {
|
|
|
47519
47519
|
}
|
|
47520
47520
|
});
|
|
47521
47521
|
|
|
47522
|
+
// ../packages/agent-integrations/vendor/smol-toml.cjs
|
|
47523
|
+
var require_smol_toml = __commonJS((exports) => {
|
|
47524
|
+
/*!
|
|
47525
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
47526
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
47527
|
+
*
|
|
47528
|
+
* Redistribution and use in source and binary forms, with or without
|
|
47529
|
+
* modification, are permitted provided that the following conditions are met:
|
|
47530
|
+
*
|
|
47531
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
47532
|
+
* list of conditions and the following disclaimer.
|
|
47533
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
47534
|
+
* this list of conditions and the following disclaimer in the
|
|
47535
|
+
* documentation and/or other materials provided with the distribution.
|
|
47536
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
47537
|
+
* may be used to endorse or promote products derived from this software without
|
|
47538
|
+
* specific prior written permission.
|
|
47539
|
+
*
|
|
47540
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
47541
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
47542
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
47543
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
47544
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
47545
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
47546
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
47547
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
47548
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
47549
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
47550
|
+
*/
|
|
47551
|
+
Object.defineProperties(exports, {
|
|
47552
|
+
__esModule: { value: true },
|
|
47553
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
47554
|
+
});
|
|
47555
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
47556
|
+
var TomlDate = class TomlDate2 extends Date {
|
|
47557
|
+
#hasDate = false;
|
|
47558
|
+
#hasTime = false;
|
|
47559
|
+
#offset = null;
|
|
47560
|
+
constructor(date8) {
|
|
47561
|
+
let hasDate = true;
|
|
47562
|
+
let hasTime = true;
|
|
47563
|
+
let offset = "Z";
|
|
47564
|
+
if (typeof date8 === "string") {
|
|
47565
|
+
let match = date8.match(DATE_TIME_RE);
|
|
47566
|
+
if (match) {
|
|
47567
|
+
if (!match[1]) {
|
|
47568
|
+
hasDate = false;
|
|
47569
|
+
date8 = `0000-01-01T${date8}`;
|
|
47570
|
+
}
|
|
47571
|
+
hasTime = !!match[2];
|
|
47572
|
+
hasTime && date8[10] === " " && (date8 = date8.replace(" ", "T"));
|
|
47573
|
+
if (match[2] && +match[2] > 23)
|
|
47574
|
+
date8 = "";
|
|
47575
|
+
else {
|
|
47576
|
+
offset = match[3] || null;
|
|
47577
|
+
date8 = date8.toUpperCase();
|
|
47578
|
+
if (!offset && hasTime)
|
|
47579
|
+
date8 += "Z";
|
|
47580
|
+
}
|
|
47581
|
+
} else
|
|
47582
|
+
date8 = "";
|
|
47583
|
+
}
|
|
47584
|
+
super(date8);
|
|
47585
|
+
if (!isNaN(this.getTime())) {
|
|
47586
|
+
this.#hasDate = hasDate;
|
|
47587
|
+
this.#hasTime = hasTime;
|
|
47588
|
+
this.#offset = offset;
|
|
47589
|
+
}
|
|
47590
|
+
}
|
|
47591
|
+
isDateTime() {
|
|
47592
|
+
return this.#hasDate && this.#hasTime;
|
|
47593
|
+
}
|
|
47594
|
+
isLocal() {
|
|
47595
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
47596
|
+
}
|
|
47597
|
+
isDate() {
|
|
47598
|
+
return this.#hasDate && !this.#hasTime;
|
|
47599
|
+
}
|
|
47600
|
+
isTime() {
|
|
47601
|
+
return this.#hasTime && !this.#hasDate;
|
|
47602
|
+
}
|
|
47603
|
+
isValid() {
|
|
47604
|
+
return this.#hasDate || this.#hasTime;
|
|
47605
|
+
}
|
|
47606
|
+
toISOString() {
|
|
47607
|
+
let iso = super.toISOString();
|
|
47608
|
+
if (this.isDate())
|
|
47609
|
+
return iso.slice(0, 10);
|
|
47610
|
+
if (this.isTime())
|
|
47611
|
+
return iso.slice(11, 23);
|
|
47612
|
+
if (this.#offset === null)
|
|
47613
|
+
return iso.slice(0, -1);
|
|
47614
|
+
if (this.#offset === "Z")
|
|
47615
|
+
return iso;
|
|
47616
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
47617
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
47618
|
+
return (/* @__PURE__ */ new Date(this.getTime() - offset * 60000)).toISOString().slice(0, -1) + this.#offset;
|
|
47619
|
+
}
|
|
47620
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
47621
|
+
let date8 = new TomlDate2(jsDate);
|
|
47622
|
+
date8.#offset = offset;
|
|
47623
|
+
return date8;
|
|
47624
|
+
}
|
|
47625
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
47626
|
+
let date8 = new TomlDate2(jsDate);
|
|
47627
|
+
date8.#offset = null;
|
|
47628
|
+
return date8;
|
|
47629
|
+
}
|
|
47630
|
+
static wrapAsLocalDate(jsDate) {
|
|
47631
|
+
let date8 = new TomlDate2(jsDate);
|
|
47632
|
+
date8.#hasTime = false;
|
|
47633
|
+
date8.#offset = null;
|
|
47634
|
+
return date8;
|
|
47635
|
+
}
|
|
47636
|
+
static wrapAsLocalTime(jsDate) {
|
|
47637
|
+
let date8 = new TomlDate2(jsDate);
|
|
47638
|
+
date8.#hasDate = false;
|
|
47639
|
+
date8.#offset = null;
|
|
47640
|
+
return date8;
|
|
47641
|
+
}
|
|
47642
|
+
};
|
|
47643
|
+
function getLineColFromPtr(string5, ptr) {
|
|
47644
|
+
let lines = string5.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
47645
|
+
return [lines.length, lines.pop().length + 1];
|
|
47646
|
+
}
|
|
47647
|
+
function makeCodeBlock(string5, line, column) {
|
|
47648
|
+
let lines = string5.split(/\r\n|\n|\r/g);
|
|
47649
|
+
let codeblock = "";
|
|
47650
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
47651
|
+
for (let i = line - 1;i <= line + 1; i++) {
|
|
47652
|
+
let l2 = lines[i - 1];
|
|
47653
|
+
if (!l2)
|
|
47654
|
+
continue;
|
|
47655
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
47656
|
+
codeblock += ": ";
|
|
47657
|
+
codeblock += l2;
|
|
47658
|
+
codeblock += `
|
|
47659
|
+
`;
|
|
47660
|
+
if (i === line) {
|
|
47661
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
47662
|
+
codeblock += `^
|
|
47663
|
+
`;
|
|
47664
|
+
}
|
|
47665
|
+
}
|
|
47666
|
+
return codeblock;
|
|
47667
|
+
}
|
|
47668
|
+
var TomlError = class extends Error {
|
|
47669
|
+
line;
|
|
47670
|
+
column;
|
|
47671
|
+
codeblock;
|
|
47672
|
+
constructor(message, options) {
|
|
47673
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
47674
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
47675
|
+
super(`Invalid TOML document: ${message}
|
|
47676
|
+
|
|
47677
|
+
${codeblock}`, options);
|
|
47678
|
+
this.line = line;
|
|
47679
|
+
this.column = column;
|
|
47680
|
+
this.codeblock = codeblock;
|
|
47681
|
+
}
|
|
47682
|
+
};
|
|
47683
|
+
function indexOfNewline(str, start = 0) {
|
|
47684
|
+
let idx = str.indexOf(`
|
|
47685
|
+
`, start);
|
|
47686
|
+
if (str.charCodeAt(idx - 1) === 13)
|
|
47687
|
+
idx--;
|
|
47688
|
+
return idx;
|
|
47689
|
+
}
|
|
47690
|
+
function skipComment(ctx) {
|
|
47691
|
+
for (;ctx.p < ctx.s.length; ctx.p++) {
|
|
47692
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
47693
|
+
if (c === 10)
|
|
47694
|
+
break;
|
|
47695
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
47696
|
+
ctx.p++;
|
|
47697
|
+
break;
|
|
47698
|
+
}
|
|
47699
|
+
if (c < 32 && c !== 9 || c === 127)
|
|
47700
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
47701
|
+
toml: ctx.s,
|
|
47702
|
+
ptr: ctx.p
|
|
47703
|
+
});
|
|
47704
|
+
}
|
|
47705
|
+
}
|
|
47706
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
47707
|
+
let c;
|
|
47708
|
+
while (true) {
|
|
47709
|
+
while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
47710
|
+
ctx.p++;
|
|
47711
|
+
if (banComments || c !== 35)
|
|
47712
|
+
break;
|
|
47713
|
+
skipComment(ctx);
|
|
47714
|
+
}
|
|
47715
|
+
}
|
|
47716
|
+
function skipUntil(ctx, sep, end) {
|
|
47717
|
+
let ptr = ctx.p;
|
|
47718
|
+
if (!end) {
|
|
47719
|
+
ptr = indexOfNewline(ctx.s, ptr);
|
|
47720
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
47721
|
+
return;
|
|
47722
|
+
}
|
|
47723
|
+
for (;ctx.p < ctx.s.length; ctx.p++) {
|
|
47724
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
47725
|
+
if (c === 35)
|
|
47726
|
+
skipComment(ctx);
|
|
47727
|
+
else if (c === end || c === sep)
|
|
47728
|
+
return;
|
|
47729
|
+
}
|
|
47730
|
+
throw new TomlError("cannot find end of structure", {
|
|
47731
|
+
toml: ctx.s,
|
|
47732
|
+
ptr
|
|
47733
|
+
});
|
|
47734
|
+
}
|
|
47735
|
+
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
47736
|
+
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
47737
|
+
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
47738
|
+
function parseString(ctx) {
|
|
47739
|
+
let start = ctx.p;
|
|
47740
|
+
let c = ctx.s.charCodeAt(ctx.p++);
|
|
47741
|
+
let first = c;
|
|
47742
|
+
let isLiteral = c === 39;
|
|
47743
|
+
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
47744
|
+
if (isMultiline) {
|
|
47745
|
+
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
47746
|
+
ctx.p++;
|
|
47747
|
+
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
47748
|
+
ctx.p += 2;
|
|
47749
|
+
}
|
|
47750
|
+
let parsed = "";
|
|
47751
|
+
let sliceStart = ctx.p;
|
|
47752
|
+
let state = 0;
|
|
47753
|
+
for (;ctx.p < ctx.s.length; ctx.p++) {
|
|
47754
|
+
c = ctx.s.charCodeAt(ctx.p);
|
|
47755
|
+
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
47756
|
+
state = state && 3;
|
|
47757
|
+
else if (c < 32 && c !== 9 || c === 127)
|
|
47758
|
+
throw new TomlError("control characters are not allowed in strings", {
|
|
47759
|
+
toml: ctx.s,
|
|
47760
|
+
ptr: ctx.p
|
|
47761
|
+
});
|
|
47762
|
+
else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
47763
|
+
if (isMultiline) {
|
|
47764
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
47765
|
+
ctx.p++;
|
|
47766
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
47767
|
+
ctx.p++;
|
|
47768
|
+
}
|
|
47769
|
+
if (!state)
|
|
47770
|
+
parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
47771
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
47772
|
+
return parsed;
|
|
47773
|
+
} else if (!state) {
|
|
47774
|
+
if (!isLiteral && c === 92) {
|
|
47775
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
47776
|
+
state = 1;
|
|
47777
|
+
}
|
|
47778
|
+
} else if (state === 1) {
|
|
47779
|
+
if (c === 120 || c === 117 || c === 85) {
|
|
47780
|
+
let value = 0;
|
|
47781
|
+
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
47782
|
+
for (let j = 0;j < len; j++, ctx.p++) {
|
|
47783
|
+
let hex3 = ctx.s.charCodeAt(ctx.p + 1);
|
|
47784
|
+
let digit = hex3 >= 48 && hex3 <= 57 ? hex3 - 48 : hex3 >= 65 && hex3 <= 70 ? hex3 - 65 + 10 : hex3 >= 97 && hex3 <= 102 ? hex3 - 97 + 10 : -1;
|
|
47785
|
+
if (digit < 0)
|
|
47786
|
+
throw new TomlError("invalid non-hex character in unicode escape", {
|
|
47787
|
+
toml: ctx.s,
|
|
47788
|
+
ptr: ctx.p + 1
|
|
47789
|
+
});
|
|
47790
|
+
value = value << 4 | digit;
|
|
47791
|
+
}
|
|
47792
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343)
|
|
47793
|
+
throw new TomlError("invalid unicode escape", {
|
|
47794
|
+
toml: ctx.s,
|
|
47795
|
+
ptr: ctx.p
|
|
47796
|
+
});
|
|
47797
|
+
parsed += String.fromCodePoint(value);
|
|
47798
|
+
sliceStart = ctx.p + 1;
|
|
47799
|
+
state = 0;
|
|
47800
|
+
} else if (c === 32 || c === 9)
|
|
47801
|
+
state = 2;
|
|
47802
|
+
else {
|
|
47803
|
+
if (c === 98)
|
|
47804
|
+
parsed += "\b";
|
|
47805
|
+
else if (c === 116)
|
|
47806
|
+
parsed += "\t";
|
|
47807
|
+
else if (c === 110)
|
|
47808
|
+
parsed += `
|
|
47809
|
+
`;
|
|
47810
|
+
else if (c === 102)
|
|
47811
|
+
parsed += "\f";
|
|
47812
|
+
else if (c === 114)
|
|
47813
|
+
parsed += "\r";
|
|
47814
|
+
else if (c === 101)
|
|
47815
|
+
parsed += "\x1B";
|
|
47816
|
+
else if (c === 34)
|
|
47817
|
+
parsed += '"';
|
|
47818
|
+
else if (c === 92)
|
|
47819
|
+
parsed += "\\";
|
|
47820
|
+
else
|
|
47821
|
+
throw new TomlError("unrecognized escape sequence", {
|
|
47822
|
+
toml: ctx.s,
|
|
47823
|
+
ptr: ctx.p
|
|
47824
|
+
});
|
|
47825
|
+
sliceStart = ctx.p + 1;
|
|
47826
|
+
state = 0;
|
|
47827
|
+
}
|
|
47828
|
+
} else if (c !== 32 && c !== 9) {
|
|
47829
|
+
if (state === 2)
|
|
47830
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
47831
|
+
toml: ctx.s,
|
|
47832
|
+
ptr: sliceStart
|
|
47833
|
+
});
|
|
47834
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
47835
|
+
sliceStart = ctx.p;
|
|
47836
|
+
}
|
|
47837
|
+
}
|
|
47838
|
+
throw new TomlError("unfinished string", {
|
|
47839
|
+
toml: ctx.s,
|
|
47840
|
+
ptr: start
|
|
47841
|
+
});
|
|
47842
|
+
}
|
|
47843
|
+
function sliceAndTrimEndOf(ctx, start, end) {
|
|
47844
|
+
let value = ctx.s.slice(start, end);
|
|
47845
|
+
let commentIdx = value.indexOf("#");
|
|
47846
|
+
if (commentIdx > 0) {
|
|
47847
|
+
skipComment({
|
|
47848
|
+
s: value,
|
|
47849
|
+
p: commentIdx,
|
|
47850
|
+
d: 0
|
|
47851
|
+
});
|
|
47852
|
+
value = value.slice(0, commentIdx);
|
|
47853
|
+
}
|
|
47854
|
+
return value.trimEnd();
|
|
47855
|
+
}
|
|
47856
|
+
function parseValue(ctx, integersAsBigInt, end) {
|
|
47857
|
+
let ptr = ctx.p;
|
|
47858
|
+
let err = {
|
|
47859
|
+
toml: ctx.s,
|
|
47860
|
+
ptr
|
|
47861
|
+
};
|
|
47862
|
+
skipUntil(ctx, 44, end);
|
|
47863
|
+
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
47864
|
+
if (!value)
|
|
47865
|
+
throw new TomlError("incomplete declaration: value expected", err);
|
|
47866
|
+
if (value === "-inf")
|
|
47867
|
+
return -Infinity;
|
|
47868
|
+
if (value === "inf" || value === "+inf")
|
|
47869
|
+
return Infinity;
|
|
47870
|
+
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
47871
|
+
return NaN;
|
|
47872
|
+
if (value === "-0")
|
|
47873
|
+
return integersAsBigInt ? 0n : 0;
|
|
47874
|
+
let isInt = INT_REGEX.test(value);
|
|
47875
|
+
if (isInt || FLOAT_REGEX.test(value)) {
|
|
47876
|
+
if (LEADING_ZERO.test(value))
|
|
47877
|
+
throw new TomlError("leading zeroes are not allowed", err);
|
|
47878
|
+
value = value.replace(/_/g, "");
|
|
47879
|
+
let numeric = +value;
|
|
47880
|
+
if (isNaN(numeric))
|
|
47881
|
+
throw new TomlError("invalid number", err);
|
|
47882
|
+
if (isInt) {
|
|
47883
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt)
|
|
47884
|
+
throw new TomlError("integer value cannot be represented losslessly", err);
|
|
47885
|
+
if (isInt || integersAsBigInt === true)
|
|
47886
|
+
numeric = BigInt(value);
|
|
47887
|
+
}
|
|
47888
|
+
return numeric;
|
|
47889
|
+
}
|
|
47890
|
+
const date8 = new TomlDate(value);
|
|
47891
|
+
if (!date8.isValid())
|
|
47892
|
+
throw new TomlError("invalid value", err);
|
|
47893
|
+
return date8;
|
|
47894
|
+
}
|
|
47895
|
+
function extractValue(ctx, end, integersAsBigInt) {
|
|
47896
|
+
let ptr = ctx.p;
|
|
47897
|
+
let c = ctx.s.charCodeAt(ptr);
|
|
47898
|
+
if (c === 91 || c === 123) {
|
|
47899
|
+
if (!ctx.d--)
|
|
47900
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
47901
|
+
toml: ctx.s,
|
|
47902
|
+
ptr
|
|
47903
|
+
});
|
|
47904
|
+
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
47905
|
+
ctx.d++;
|
|
47906
|
+
return value;
|
|
47907
|
+
}
|
|
47908
|
+
if (c === 34 || c === 39)
|
|
47909
|
+
return parseString(ctx);
|
|
47910
|
+
if (c === 116) {
|
|
47911
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
47912
|
+
throw new TomlError("invalid value", {
|
|
47913
|
+
toml: ctx.s,
|
|
47914
|
+
ptr
|
|
47915
|
+
});
|
|
47916
|
+
ctx.p++;
|
|
47917
|
+
return true;
|
|
47918
|
+
}
|
|
47919
|
+
if (c === 102) {
|
|
47920
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
47921
|
+
throw new TomlError("invalid value", {
|
|
47922
|
+
toml: ctx.s,
|
|
47923
|
+
ptr
|
|
47924
|
+
});
|
|
47925
|
+
ctx.p++;
|
|
47926
|
+
return false;
|
|
47927
|
+
}
|
|
47928
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
47929
|
+
}
|
|
47930
|
+
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
47931
|
+
function parseKey(ctx, end = "=") {
|
|
47932
|
+
let start = ctx.p;
|
|
47933
|
+
let dot = start - 1;
|
|
47934
|
+
let parsed = [];
|
|
47935
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
47936
|
+
if (endPtr < 0)
|
|
47937
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
47938
|
+
toml: ctx.s,
|
|
47939
|
+
ptr: start
|
|
47940
|
+
});
|
|
47941
|
+
do {
|
|
47942
|
+
let c = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
47943
|
+
if (c !== 32 && c !== 9) {
|
|
47944
|
+
if (c === 34 || c === 39) {
|
|
47945
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
|
|
47946
|
+
throw new TomlError("multiline strings are not allowed in keys", {
|
|
47947
|
+
toml: ctx.s,
|
|
47948
|
+
ptr: ctx.p
|
|
47949
|
+
});
|
|
47950
|
+
let part = parseString(ctx);
|
|
47951
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
47952
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
47953
|
+
let newLine = indexOfNewline(strEnd);
|
|
47954
|
+
if (newLine > -1)
|
|
47955
|
+
throw new TomlError("newlines are not allowed in keys", {
|
|
47956
|
+
toml: ctx.s,
|
|
47957
|
+
ptr: newLine
|
|
47958
|
+
});
|
|
47959
|
+
if (strEnd.trimStart())
|
|
47960
|
+
throw new TomlError("found extra tokens after the string part", {
|
|
47961
|
+
toml: ctx.s,
|
|
47962
|
+
ptr: ctx.p
|
|
47963
|
+
});
|
|
47964
|
+
if (endPtr < ctx.p) {
|
|
47965
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
47966
|
+
if (endPtr < 0)
|
|
47967
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
47968
|
+
toml: ctx.s,
|
|
47969
|
+
ptr: start
|
|
47970
|
+
});
|
|
47971
|
+
}
|
|
47972
|
+
parsed.push(part);
|
|
47973
|
+
} else {
|
|
47974
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
47975
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
47976
|
+
if (!KEY_PART_RE.test(part))
|
|
47977
|
+
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
47978
|
+
toml: ctx.s,
|
|
47979
|
+
ptr: ctx.p
|
|
47980
|
+
});
|
|
47981
|
+
parsed.push(part.trimEnd());
|
|
47982
|
+
}
|
|
47983
|
+
}
|
|
47984
|
+
} while (dot + 1 && dot < endPtr);
|
|
47985
|
+
ctx.p = endPtr + 1;
|
|
47986
|
+
skipVoid(ctx, true, true);
|
|
47987
|
+
return parsed;
|
|
47988
|
+
}
|
|
47989
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
47990
|
+
let res = {};
|
|
47991
|
+
let seen = /* @__PURE__ */ new Set;
|
|
47992
|
+
let c;
|
|
47993
|
+
ctx.p++;
|
|
47994
|
+
while (ctx.p < ctx.s.length) {
|
|
47995
|
+
skipVoid(ctx);
|
|
47996
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
47997
|
+
ctx.p++;
|
|
47998
|
+
return res;
|
|
47999
|
+
}
|
|
48000
|
+
let k;
|
|
48001
|
+
let t = res;
|
|
48002
|
+
let hasOwn = false;
|
|
48003
|
+
let p = ctx.p;
|
|
48004
|
+
let key = parseKey(ctx);
|
|
48005
|
+
for (let i = 0;i < key.length; i++) {
|
|
48006
|
+
if (i)
|
|
48007
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
48008
|
+
k = key[i];
|
|
48009
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k])))
|
|
48010
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
48011
|
+
toml: ctx.s,
|
|
48012
|
+
ptr: p
|
|
48013
|
+
});
|
|
48014
|
+
if (!hasOwn && k === "__proto__")
|
|
48015
|
+
Object.defineProperty(t, k, {
|
|
48016
|
+
enumerable: true,
|
|
48017
|
+
configurable: true,
|
|
48018
|
+
writable: true
|
|
48019
|
+
});
|
|
48020
|
+
}
|
|
48021
|
+
if (hasOwn)
|
|
48022
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
48023
|
+
toml: ctx.s,
|
|
48024
|
+
ptr: ctx.p
|
|
48025
|
+
});
|
|
48026
|
+
let value = extractValue(ctx, 125, integersAsBigInt);
|
|
48027
|
+
seen.add(t[k] = value);
|
|
48028
|
+
skipVoid(ctx);
|
|
48029
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125)
|
|
48030
|
+
return res;
|
|
48031
|
+
if (c !== 44)
|
|
48032
|
+
throw new TomlError("expected comma or end of structure", {
|
|
48033
|
+
toml: ctx.s,
|
|
48034
|
+
ptr: ctx.p - 1
|
|
48035
|
+
});
|
|
48036
|
+
}
|
|
48037
|
+
throw new TomlError("unfinished table encountered", {
|
|
48038
|
+
toml: ctx.s,
|
|
48039
|
+
ptr: ctx.p
|
|
48040
|
+
});
|
|
48041
|
+
}
|
|
48042
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
48043
|
+
let res = [];
|
|
48044
|
+
let c;
|
|
48045
|
+
ctx.p++;
|
|
48046
|
+
while (ctx.p < ctx.s.length) {
|
|
48047
|
+
skipVoid(ctx);
|
|
48048
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
48049
|
+
ctx.p++;
|
|
48050
|
+
return res;
|
|
48051
|
+
}
|
|
48052
|
+
res.push(extractValue(ctx, 93, integersAsBigInt));
|
|
48053
|
+
skipVoid(ctx);
|
|
48054
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93)
|
|
48055
|
+
return res;
|
|
48056
|
+
if (c !== 44)
|
|
48057
|
+
throw new TomlError("expected comma or end of structure", {
|
|
48058
|
+
toml: ctx.s,
|
|
48059
|
+
ptr: ctx.p - 1
|
|
48060
|
+
});
|
|
48061
|
+
}
|
|
48062
|
+
throw new TomlError("unfinished array encountered", {
|
|
48063
|
+
toml: ctx.s,
|
|
48064
|
+
ptr: ctx.p
|
|
48065
|
+
});
|
|
48066
|
+
}
|
|
48067
|
+
function peekTable(key, table, meta3, type) {
|
|
48068
|
+
let t = table;
|
|
48069
|
+
let m = meta3;
|
|
48070
|
+
let k;
|
|
48071
|
+
let hasOwn = false;
|
|
48072
|
+
let state;
|
|
48073
|
+
for (let i = 0;i < key.length; i++) {
|
|
48074
|
+
if (i) {
|
|
48075
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
48076
|
+
m = (state = m[k]).c;
|
|
48077
|
+
if (type === 0 && (state.t === 1 || state.t === 2))
|
|
48078
|
+
return null;
|
|
48079
|
+
if (state.t === 2) {
|
|
48080
|
+
let l2 = t.length - 1;
|
|
48081
|
+
t = t[l2];
|
|
48082
|
+
m = m[l2].c;
|
|
48083
|
+
}
|
|
48084
|
+
}
|
|
48085
|
+
k = key[i];
|
|
48086
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d)
|
|
48087
|
+
return null;
|
|
48088
|
+
if (!hasOwn) {
|
|
48089
|
+
if (k === "__proto__") {
|
|
48090
|
+
Object.defineProperty(t, k, {
|
|
48091
|
+
enumerable: true,
|
|
48092
|
+
configurable: true,
|
|
48093
|
+
writable: true
|
|
48094
|
+
});
|
|
48095
|
+
Object.defineProperty(m, k, {
|
|
48096
|
+
enumerable: true,
|
|
48097
|
+
configurable: true,
|
|
48098
|
+
writable: true
|
|
48099
|
+
});
|
|
48100
|
+
}
|
|
48101
|
+
m[k] = {
|
|
48102
|
+
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
48103
|
+
d: false,
|
|
48104
|
+
i: 0,
|
|
48105
|
+
c: {}
|
|
48106
|
+
};
|
|
48107
|
+
}
|
|
48108
|
+
}
|
|
48109
|
+
state = m[k];
|
|
48110
|
+
if (state.t !== type && !(type === 1 && state.t === 3))
|
|
48111
|
+
return null;
|
|
48112
|
+
if (type === 2) {
|
|
48113
|
+
if (!state.d) {
|
|
48114
|
+
state.d = true;
|
|
48115
|
+
t[k] = [];
|
|
48116
|
+
}
|
|
48117
|
+
t[k].push(t = {});
|
|
48118
|
+
state.c[state.i++] = state = {
|
|
48119
|
+
t: 1,
|
|
48120
|
+
d: false,
|
|
48121
|
+
i: 0,
|
|
48122
|
+
c: {}
|
|
48123
|
+
};
|
|
48124
|
+
}
|
|
48125
|
+
if (state.d)
|
|
48126
|
+
return null;
|
|
48127
|
+
state.d = true;
|
|
48128
|
+
if (type === 1)
|
|
48129
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
48130
|
+
else if (type === 0 && hasOwn)
|
|
48131
|
+
return null;
|
|
48132
|
+
return [
|
|
48133
|
+
k,
|
|
48134
|
+
t,
|
|
48135
|
+
state.c
|
|
48136
|
+
];
|
|
48137
|
+
}
|
|
48138
|
+
function parse6(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
|
|
48139
|
+
let ctx = {
|
|
48140
|
+
s: toml,
|
|
48141
|
+
p: 0,
|
|
48142
|
+
d: maxDepth
|
|
48143
|
+
};
|
|
48144
|
+
let res = {};
|
|
48145
|
+
let meta3 = {};
|
|
48146
|
+
let tmp;
|
|
48147
|
+
let tbl = res;
|
|
48148
|
+
let m = meta3;
|
|
48149
|
+
skipVoid(ctx);
|
|
48150
|
+
while (ctx.p < toml.length) {
|
|
48151
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
48152
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
48153
|
+
tmp = ctx.p += +isTableArray;
|
|
48154
|
+
let k = parseKey(ctx, "]");
|
|
48155
|
+
if (isTableArray) {
|
|
48156
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93)
|
|
48157
|
+
throw new TomlError("expected end of table declaration", {
|
|
48158
|
+
toml,
|
|
48159
|
+
ptr: ctx.p - 1
|
|
48160
|
+
});
|
|
48161
|
+
ctx.p++;
|
|
48162
|
+
}
|
|
48163
|
+
let p = peekTable(k, res, meta3, isTableArray ? 2 : 1);
|
|
48164
|
+
if (!p)
|
|
48165
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
48166
|
+
toml,
|
|
48167
|
+
ptr: tmp
|
|
48168
|
+
});
|
|
48169
|
+
m = p[2];
|
|
48170
|
+
tbl = p[1];
|
|
48171
|
+
} else {
|
|
48172
|
+
tmp = ctx.p;
|
|
48173
|
+
let p = peekTable(parseKey(ctx), tbl, m, 0);
|
|
48174
|
+
if (!p)
|
|
48175
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
48176
|
+
toml,
|
|
48177
|
+
ptr: tmp
|
|
48178
|
+
});
|
|
48179
|
+
p[1][p[0]] = extractValue(ctx, undefined, integersAsBigInt);
|
|
48180
|
+
}
|
|
48181
|
+
skipVoid(ctx, true);
|
|
48182
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13)
|
|
48183
|
+
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
48184
|
+
toml,
|
|
48185
|
+
ptr: ctx.p
|
|
48186
|
+
});
|
|
48187
|
+
skipVoid(ctx);
|
|
48188
|
+
}
|
|
48189
|
+
return res;
|
|
48190
|
+
}
|
|
48191
|
+
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
48192
|
+
function extendedTypeOf(obj) {
|
|
48193
|
+
let type = typeof obj;
|
|
48194
|
+
if (type === "object") {
|
|
48195
|
+
if (Array.isArray(obj))
|
|
48196
|
+
return "array";
|
|
48197
|
+
if (typeof obj?.getUTCDate === "function" && obj instanceof Date)
|
|
48198
|
+
return "date";
|
|
48199
|
+
if (globalThis.Temporal && typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime))
|
|
48200
|
+
return "temporal";
|
|
48201
|
+
}
|
|
48202
|
+
return type;
|
|
48203
|
+
}
|
|
48204
|
+
function isArrayOfTables(obj) {
|
|
48205
|
+
for (let i = 0;i < obj.length; i++)
|
|
48206
|
+
if (extendedTypeOf(obj[i]) !== "object")
|
|
48207
|
+
return false;
|
|
48208
|
+
return obj.length != 0;
|
|
48209
|
+
}
|
|
48210
|
+
function formatString(s) {
|
|
48211
|
+
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
48212
|
+
}
|
|
48213
|
+
function stringifyTemporal(temporal) {
|
|
48214
|
+
return temporal.toString({
|
|
48215
|
+
calendarName: "never",
|
|
48216
|
+
timeZoneName: "never"
|
|
48217
|
+
});
|
|
48218
|
+
}
|
|
48219
|
+
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
48220
|
+
if (depth === 0)
|
|
48221
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
48222
|
+
switch (type) {
|
|
48223
|
+
case "number":
|
|
48224
|
+
if (isNaN(val))
|
|
48225
|
+
return "nan";
|
|
48226
|
+
if (val === Infinity)
|
|
48227
|
+
return "inf";
|
|
48228
|
+
if (val === -Infinity)
|
|
48229
|
+
return "-inf";
|
|
48230
|
+
if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
|
|
48231
|
+
return val.toFixed(1);
|
|
48232
|
+
case "bigint":
|
|
48233
|
+
case "boolean":
|
|
48234
|
+
return val.toString();
|
|
48235
|
+
case "string":
|
|
48236
|
+
return formatString(val);
|
|
48237
|
+
case "date":
|
|
48238
|
+
if (isNaN(val.getTime()))
|
|
48239
|
+
throw new TypeError("cannot serialize invalid date");
|
|
48240
|
+
return val.toISOString();
|
|
48241
|
+
case "object":
|
|
48242
|
+
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
48243
|
+
case "array":
|
|
48244
|
+
return stringifyArray(val, depth, numberAsFloat);
|
|
48245
|
+
case "temporal":
|
|
48246
|
+
return stringifyTemporal(val);
|
|
48247
|
+
}
|
|
48248
|
+
}
|
|
48249
|
+
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
48250
|
+
let keys = Object.keys(obj);
|
|
48251
|
+
if (keys.length === 0)
|
|
48252
|
+
return "{}";
|
|
48253
|
+
let res = "{ ";
|
|
48254
|
+
for (let i = 0;i < keys.length; i++) {
|
|
48255
|
+
let k = keys[i];
|
|
48256
|
+
if (i)
|
|
48257
|
+
res += ", ";
|
|
48258
|
+
res += BARE_KEY.test(k) ? k : formatString(k);
|
|
48259
|
+
res += " = ";
|
|
48260
|
+
res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
|
|
48261
|
+
}
|
|
48262
|
+
return res + " }";
|
|
48263
|
+
}
|
|
48264
|
+
function stringifyArray(array3, depth, numberAsFloat) {
|
|
48265
|
+
if (array3.length === 0)
|
|
48266
|
+
return "[]";
|
|
48267
|
+
let res = "[ ";
|
|
48268
|
+
for (let i = 0;i < array3.length; i++) {
|
|
48269
|
+
if (i)
|
|
48270
|
+
res += ", ";
|
|
48271
|
+
if (array3[i] === null || array3[i] === undefined)
|
|
48272
|
+
throw new TypeError("arrays cannot contain null or undefined values");
|
|
48273
|
+
res += stringifyValue(array3[i], extendedTypeOf(array3[i]), depth - 1, numberAsFloat);
|
|
48274
|
+
}
|
|
48275
|
+
return res + " ]";
|
|
48276
|
+
}
|
|
48277
|
+
function stringifyArrayTable(array3, key, depth, numberAsFloat) {
|
|
48278
|
+
if (depth === 0)
|
|
48279
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
48280
|
+
let res = "";
|
|
48281
|
+
for (let i = 0;i < array3.length; i++) {
|
|
48282
|
+
res += `${res && `
|
|
48283
|
+
`}[[${key}]]
|
|
48284
|
+
`;
|
|
48285
|
+
res += stringifyTable(0, array3[i], key, depth, numberAsFloat);
|
|
48286
|
+
}
|
|
48287
|
+
return res;
|
|
48288
|
+
}
|
|
48289
|
+
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
48290
|
+
if (depth === 0)
|
|
48291
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
48292
|
+
let preamble = "";
|
|
48293
|
+
let tables = "";
|
|
48294
|
+
let keys = Object.keys(obj);
|
|
48295
|
+
for (let i = 0;i < keys.length; i++) {
|
|
48296
|
+
let k = keys[i];
|
|
48297
|
+
if (obj[k] !== null && obj[k] !== undefined) {
|
|
48298
|
+
let type = extendedTypeOf(obj[k]);
|
|
48299
|
+
if (type === "symbol" || type === "function")
|
|
48300
|
+
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
48301
|
+
let key = BARE_KEY.test(k) ? k : formatString(k);
|
|
48302
|
+
if (type === "array" && isArrayOfTables(obj[k]))
|
|
48303
|
+
tables += (tables && `
|
|
48304
|
+
`) + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
48305
|
+
else if (type === "object") {
|
|
48306
|
+
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
48307
|
+
tables += (tables && `
|
|
48308
|
+
`) + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
48309
|
+
} else {
|
|
48310
|
+
preamble += key;
|
|
48311
|
+
preamble += " = ";
|
|
48312
|
+
preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
|
|
48313
|
+
preamble += `
|
|
48314
|
+
`;
|
|
48315
|
+
}
|
|
48316
|
+
}
|
|
48317
|
+
}
|
|
48318
|
+
if (tableKey && (preamble || !tables))
|
|
48319
|
+
preamble = preamble ? `[${tableKey}]
|
|
48320
|
+
${preamble}` : `[${tableKey}]`;
|
|
48321
|
+
return preamble && tables ? `${preamble}
|
|
48322
|
+
${tables}` : preamble || tables;
|
|
48323
|
+
}
|
|
48324
|
+
function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
|
|
48325
|
+
if (extendedTypeOf(obj) !== "object")
|
|
48326
|
+
throw new TypeError("stringify can only be called with an object");
|
|
48327
|
+
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
|
|
48328
|
+
if (str[str.length - 1] !== `
|
|
48329
|
+
`)
|
|
48330
|
+
return str + `
|
|
48331
|
+
`;
|
|
48332
|
+
return str;
|
|
48333
|
+
}
|
|
48334
|
+
var src_default = {
|
|
48335
|
+
parse: parse6,
|
|
48336
|
+
stringify,
|
|
48337
|
+
TomlDate,
|
|
48338
|
+
TomlError
|
|
48339
|
+
};
|
|
48340
|
+
exports.TomlDate = TomlDate;
|
|
48341
|
+
exports.TomlError = TomlError;
|
|
48342
|
+
exports.default = src_default;
|
|
48343
|
+
exports.parse = parse6;
|
|
48344
|
+
exports.stringify = stringify;
|
|
48345
|
+
});
|
|
48346
|
+
|
|
47522
48347
|
// ../packages/agent-integrations/bundle.json
|
|
47523
48348
|
var require_bundle = __commonJS((exports, module) => {
|
|
47524
48349
|
module.exports = {
|
|
@@ -47582,6 +48407,8 @@ var require_agent_integrations = __commonJS((exports, module) => {
|
|
|
47582
48407
|
var path3 = __require("node:path");
|
|
47583
48408
|
var os = __require("node:os");
|
|
47584
48409
|
var { createHash: createHash4, randomUUID: randomUUID8 } = __require("node:crypto");
|
|
48410
|
+
var { isDeepStrictEqual } = __require("node:util");
|
|
48411
|
+
var { parse: parseToml } = require_smol_toml();
|
|
47585
48412
|
var defaultBundle = require_bundle();
|
|
47586
48413
|
var MCP_URL = "https://app.scribed.ai/mcp";
|
|
47587
48414
|
var PLATFORM_IDS = Object.freeze(["claude-code", "codex", "cursor"]);
|
|
@@ -47612,20 +48439,6 @@ url = "https://app.scribed.ai/mcp"
|
|
|
47612
48439
|
const args = value.args;
|
|
47613
48440
|
return args[0] === "-y" && /^@scribed\/cli@(?:latest|\d+\.\d+\.\d+)$/.test(args[1]) && args[2] === "mcp" && (args.length === 3 || args.length === 5 && args[3] === "--categories" && typeof args[4] === "string");
|
|
47614
48441
|
}
|
|
47615
|
-
function tomlTableParts(header) {
|
|
47616
|
-
const parts = [];
|
|
47617
|
-
const component = /\s*(?:"([^"\\]*)"|'([^']*)'|([A-Za-z0-9_-]+))\s*(\.|$)/gy;
|
|
47618
|
-
let position = 0;
|
|
47619
|
-
while (position < header.length) {
|
|
47620
|
-
component.lastIndex = position;
|
|
47621
|
-
const match = component.exec(header);
|
|
47622
|
-
if (!match || match.index !== position || match[4] === "." && component.lastIndex === header.length)
|
|
47623
|
-
throw new Error("Codex config has unsupported table names; manage it in Codex MCP settings.");
|
|
47624
|
-
parts.push(match[1] ?? match[2] ?? match[3]);
|
|
47625
|
-
position = component.lastIndex;
|
|
47626
|
-
}
|
|
47627
|
-
return parts;
|
|
47628
|
-
}
|
|
47629
48442
|
function versionCompare(a, b) {
|
|
47630
48443
|
const left = a.split(".").map(Number), right = b.split(".").map(Number);
|
|
47631
48444
|
for (let i = 0;i < 3; i++)
|
|
@@ -47727,94 +48540,59 @@ url = "https://app.scribed.ai/mcp"
|
|
|
47727
48540
|
}
|
|
47728
48541
|
function inspectCodex(file2) {
|
|
47729
48542
|
const text6 = read(file2), source = text6 || "";
|
|
47730
|
-
|
|
47731
|
-
|
|
47732
|
-
|
|
47733
|
-
|
|
47734
|
-
|
|
47735
|
-
|
|
47736
|
-
|
|
47737
|
-
|
|
47738
|
-
|
|
47739
|
-
}
|
|
47740
|
-
const
|
|
47741
|
-
|
|
47742
|
-
|
|
47743
|
-
|
|
47744
|
-
|
|
47745
|
-
|
|
47746
|
-
|
|
47747
|
-
|
|
47748
|
-
|
|
47749
|
-
|
|
47750
|
-
|
|
47751
|
-
|
|
47752
|
-
|
|
47753
|
-
|
|
47754
|
-
|
|
47755
|
-
|
|
47756
|
-
|
|
47757
|
-
|
|
47758
|
-
|
|
47759
|
-
|
|
47760
|
-
|
|
47761
|
-
|
|
47762
|
-
|
|
47763
|
-
|
|
47764
|
-
|
|
47765
|
-
|
|
47766
|
-
|
|
47767
|
-
|
|
47768
|
-
|
|
47769
|
-
|
|
47770
|
-
|
|
47771
|
-
|
|
47772
|
-
const headers4 = [...outside.matchAll(/^\s*\[([^\]\n]+)\]\s*(?:#[^\n]*)?$/gm)].map((header) => Object.assign(header, { parts: tomlTableParts(header[1]) }));
|
|
47773
|
-
const candidates = headers4.filter((match) => match.parts.length === 2 && match.parts[0] === "mcp_servers" && match.parts[1] === "scribed");
|
|
47774
|
-
const dotted = lines.some((line) => !line.startsWith("[") && /^(?:["']?mcp_servers["']?\s*[.=]|["']?scribed["']?\s*=)/.test(line));
|
|
47775
|
-
const nested2 = headers4.some((match) => match.parts.length > 2 && match.parts[0] === "mcp_servers" && match.parts[1] === "scribed");
|
|
47776
|
-
const duplicate = (outside.match(/https:\/\/app\.scribed\.ai\/mcp/g) || []).length > (candidates.length === 1 ? 1 : 0);
|
|
47777
|
-
const markerConflict = outside.includes("# BEGIN SCRIBED AGENT INTEGRATION") || outside.includes("# END SCRIBED AGENT INTEGRATION");
|
|
47778
|
-
if (headers4.some((header) => header[1].includes("\\")))
|
|
47779
|
-
throw new Error("Codex config contains escaped table names; manage this configuration in Codex MCP settings.");
|
|
47780
|
-
let existing = null, matches = managed, fingerprint = managed ? hash2(CODEX_BLOCK) : null;
|
|
47781
|
-
if (candidates.length === 1 && !managed) {
|
|
47782
|
-
const candidate = candidates[0];
|
|
47783
|
-
const end = headers4.find((header) => header.index > candidate.index)?.index ?? outside.length;
|
|
47784
|
-
existing = outside.slice(candidate.index, end);
|
|
47785
|
-
const body = existing.split(`
|
|
47786
|
-
`).slice(1).map((line) => line.replace(/#.*$/, "").trim()).filter(Boolean);
|
|
47787
|
-
const values = {};
|
|
47788
|
-
let simple = true;
|
|
47789
|
-
for (const line of body) {
|
|
47790
|
-
const match = /^([A-Za-z_]+)\s*=\s*(.+)$/.exec(line);
|
|
47791
|
-
if (!match || Object.hasOwn(values, match[1])) {
|
|
47792
|
-
simple = false;
|
|
47793
|
-
break;
|
|
47794
|
-
}
|
|
47795
|
-
const raw = match[2];
|
|
47796
|
-
try {
|
|
47797
|
-
values[match[1]] = raw.startsWith("'") && raw.endsWith("'") ? raw.slice(1, -1) : JSON.parse(raw);
|
|
47798
|
-
} catch {
|
|
47799
|
-
simple = false;
|
|
47800
|
-
break;
|
|
47801
|
-
}
|
|
48543
|
+
let config2;
|
|
48544
|
+
try {
|
|
48545
|
+
config2 = parseToml(source);
|
|
48546
|
+
} catch {
|
|
48547
|
+
throw new Error("Codex settings could not be read. Check the configuration in Codex MCP settings.");
|
|
48548
|
+
}
|
|
48549
|
+
if (config2.mcp_servers !== undefined && !object5(config2.mcp_servers)) {
|
|
48550
|
+
throw new Error("Codex MCP settings must contain a server table. Manage this configuration in Codex MCP settings.");
|
|
48551
|
+
}
|
|
48552
|
+
const servers = config2.mcp_servers || {};
|
|
48553
|
+
const compatible = (value) => object5(value) && (scribedStdio(value) || scribedUrl(value.url) && !value.command);
|
|
48554
|
+
const aliases = Object.entries(servers).filter(([key, value]) => key !== "scribed" && compatible(value));
|
|
48555
|
+
const entry = servers.scribed ?? (aliases.length === 1 ? aliases[0][1] : undefined);
|
|
48556
|
+
const duplicate = aliases.length > (servers.scribed === undefined ? 1 : 0);
|
|
48557
|
+
const nextSource = `${source}${source && !source.endsWith(`
|
|
48558
|
+
`) ? `
|
|
48559
|
+
` : ""}${source ? `
|
|
48560
|
+
` : ""}${CODEX_BLOCK}`;
|
|
48561
|
+
const withoutScribed = (value) => {
|
|
48562
|
+
const remaining = { ...value, mcp_servers: { ...value.mcp_servers } };
|
|
48563
|
+
delete remaining.mcp_servers.scribed;
|
|
48564
|
+
if (!Object.keys(remaining.mcp_servers).length)
|
|
48565
|
+
delete remaining.mcp_servers;
|
|
48566
|
+
return remaining;
|
|
48567
|
+
};
|
|
48568
|
+
let managed = false;
|
|
48569
|
+
if (source.includes(CODEX_BLOCK) && isDeepStrictEqual(servers.scribed, { url: MCP_URL })) {
|
|
48570
|
+
try {
|
|
48571
|
+
const remaining = parseToml(source.replace(CODEX_BLOCK, ""));
|
|
48572
|
+
if (object5(remaining.mcp_servers) && !Object.keys(remaining.mcp_servers).length)
|
|
48573
|
+
delete remaining.mcp_servers;
|
|
48574
|
+
managed = isDeepStrictEqual(remaining, withoutScribed(config2));
|
|
48575
|
+
} catch {}
|
|
48576
|
+
}
|
|
48577
|
+
const markerConflict = !managed && (source.includes("# BEGIN SCRIBED AGENT INTEGRATION") || source.includes("# END SCRIBED AGENT INTEGRATION"));
|
|
48578
|
+
const misleading = Object.hasOwn(config2, "mcp_servers.scribed");
|
|
48579
|
+
let cannotAppend = false;
|
|
48580
|
+
if (entry === undefined && !duplicate && !markerConflict && !misleading) {
|
|
48581
|
+
try {
|
|
48582
|
+
parseToml(nextSource);
|
|
48583
|
+
} catch {
|
|
48584
|
+
cannotAppend = true;
|
|
47802
48585
|
}
|
|
47803
|
-
matches = simple && (scribedUrl(values.url) && !values.command || scribedStdio(values));
|
|
47804
|
-
fingerprint = hash2(existing);
|
|
47805
48586
|
}
|
|
47806
|
-
const
|
|
48587
|
+
const conflict = duplicate ? "Scribed has more than one connection in Codex. Keep the one you use in Codex MCP settings." : markerConflict ? "The Scribed connection was edited. Review it in Codex MCP settings before changing this setup." : misleading || cannotAppend ? "This Codex configuration needs manual setup in Codex MCP settings." : null;
|
|
47807
48588
|
return {
|
|
47808
48589
|
text: text6,
|
|
47809
|
-
present:
|
|
47810
|
-
matches,
|
|
47811
|
-
fingerprint,
|
|
48590
|
+
present: entry !== undefined,
|
|
48591
|
+
matches: compatible(entry),
|
|
48592
|
+
fingerprint: managed ? hash2(CODEX_BLOCK) : null,
|
|
47812
48593
|
expectedHash: hash2(CODEX_BLOCK),
|
|
47813
|
-
conflict
|
|
47814
|
-
install: () =>
|
|
47815
|
-
`) ? `
|
|
47816
|
-
` : ""}${source ? `
|
|
47817
|
-
` : ""}${CODEX_BLOCK}`,
|
|
48594
|
+
conflict,
|
|
48595
|
+
install: () => nextSource,
|
|
47818
48596
|
remove: () => source.replace(CODEX_BLOCK, "")
|
|
47819
48597
|
};
|
|
47820
48598
|
}
|
|
@@ -47880,25 +48658,49 @@ url = "https://app.scribed.ai/mcp"
|
|
|
47880
48658
|
return { ...skill, file: file2, content, desiredHash: hash2(skill.content), owned: owned?.path === file2 ? owned : undefined };
|
|
47881
48659
|
});
|
|
47882
48660
|
}
|
|
48661
|
+
function newerBundleVersion(definition, state) {
|
|
48662
|
+
const paths = new Set(bundle.skills.map((skill) => path3.join(definition.skillsPath, skill.name, "SKILL.md")));
|
|
48663
|
+
let newest;
|
|
48664
|
+
for (const [id2, installed] of Object.entries(state.platforms)) {
|
|
48665
|
+
if (versionCompare(installed.version, bundle.version) <= 0)
|
|
48666
|
+
continue;
|
|
48667
|
+
if (id2 !== definition.id && !Object.values(installed.skills).some((skill) => paths.has(skill.path)))
|
|
48668
|
+
continue;
|
|
48669
|
+
if (!newest || versionCompare(installed.version, newest) > 0)
|
|
48670
|
+
newest = installed.version;
|
|
48671
|
+
}
|
|
48672
|
+
return newest;
|
|
48673
|
+
}
|
|
48674
|
+
function hasSharedOwnership(skill, state) {
|
|
48675
|
+
if (skill.content === null)
|
|
48676
|
+
return false;
|
|
48677
|
+
const currentHash = hash2(skill.content);
|
|
48678
|
+
return Object.values(state.platforms).some((other) => Object.values(other.skills).some((entry) => entry.path === skill.file && entry.hash === currentHash));
|
|
48679
|
+
}
|
|
47883
48680
|
function snapshot(state) {
|
|
47884
48681
|
return { version: bundle.version, platforms: definitions.map((definition) => {
|
|
47885
48682
|
const owned = state.platforms[definition.id];
|
|
47886
|
-
const
|
|
48683
|
+
const newerVersion = newerBundleVersion(definition, state);
|
|
48684
|
+
let base9 = { ...definition, managed: !!owned, authentication: "not-checked", ...owned ? { version: owned.version } : {}, ...newerVersion ? { newerVersion } : {} };
|
|
47887
48685
|
try {
|
|
47888
48686
|
const config2 = inspect(definition), skills = inspectSkills(definition, owned);
|
|
47889
|
-
|
|
47890
|
-
|
|
47891
|
-
|
|
48687
|
+
base9 = { ...base9, connectionInstalled: config2.present && config2.matches, skillsInstalled: skills.filter((skill) => skill.content !== null).length, skillsTotal: skills.length };
|
|
48688
|
+
const changedProfile = owned?.config && owned.config.path !== definition.configPath || skills.some((skill) => owned?.skills?.[skill.name] && owned.skills[skill.name].path !== skill.file);
|
|
48689
|
+
if (changedProfile)
|
|
48690
|
+
return { ...base9, state: "conflict", detail: "Your setup uses another profile. Manage the original Scribed integration from that profile before changing it here." };
|
|
48691
|
+
const modified = skills.some((skill) => skill.content !== null && hash2(skill.content) !== skill.desiredHash && (!skill.owned || hash2(skill.content) !== skill.owned.hash) && !hasSharedOwnership(skill, state));
|
|
47892
48692
|
if (config2.conflict || config2.present && !config2.matches || owned?.config?.path === definition.configPath && config2.present && owned.config.hash !== config2.fingerprint || modified)
|
|
47893
48693
|
return { ...base9, state: "conflict", detail: config2.conflict || "Existing Scribed configuration or skills differ. Your files were preserved." };
|
|
48694
|
+
if (!config2.present && !owned)
|
|
48695
|
+
return { ...base9, state: "not-installed", detail: "Add Scribed tools and skills to this platform." };
|
|
47894
48696
|
const missing = !config2.present || skills.some((skill) => skill.content === null);
|
|
47895
48697
|
if (missing)
|
|
47896
|
-
return { ...base9, state: "needs-repair", detail: "
|
|
47897
|
-
if (owned && versionCompare(owned.version, bundle.version) < 0)
|
|
48698
|
+
return { ...base9, state: "needs-repair", detail: config2.present ? "Your Scribed connection is already set up. Add the missing skills to finish." : "Restore the missing Scribed connection and skills." };
|
|
48699
|
+
if (owned && !newerVersion && versionCompare(owned.version, bundle.version) < 0)
|
|
47898
48700
|
return { ...base9, state: "update-available", detail: `Scribed skills ${bundle.version} are available.` };
|
|
47899
|
-
if (skills.some((skill) => hash2(skill.content) !== skill.desiredHash) && (!owned || versionCompare(owned.version, bundle.version) <= 0))
|
|
48701
|
+
if (!newerVersion && skills.some((skill) => hash2(skill.content) !== skill.desiredHash) && (!owned || versionCompare(owned.version, bundle.version) <= 0))
|
|
47900
48702
|
return { ...base9, state: "needs-repair", detail: "Repair to refresh the Scribed skills." };
|
|
47901
|
-
return { ...base9, state: "installed", detail: "
|
|
48703
|
+
return { ...base9, state: "installed", detail: newerVersion ? "A newer skills version is already installed. Update this Scribed app to manage it." : "Scribed tools and skills are already installed." };
|
|
47902
48704
|
} catch (error51) {
|
|
47903
48705
|
return { ...base9, state: "error", detail: message(error51) };
|
|
47904
48706
|
}
|
|
@@ -47944,8 +48746,9 @@ url = "https://app.scribed.ai/mcp"
|
|
|
47944
48746
|
throw new Error("Platform skills path changed; manage the old installation from its original profile.");
|
|
47945
48747
|
if (config2.conflict)
|
|
47946
48748
|
throw new Error(config2.conflict);
|
|
47947
|
-
|
|
47948
|
-
|
|
48749
|
+
const newerVersion = newerBundleVersion(definition, state);
|
|
48750
|
+
if (!removing && newerVersion) {
|
|
48751
|
+
throw new Error(`A newer Scribed skills bundle (${newerVersion}) is installed or shared by another platform. Update this Scribed app before changing this setup.`);
|
|
47949
48752
|
}
|
|
47950
48753
|
if (removing) {
|
|
47951
48754
|
if (installed.config && installed.config.path !== definition.configPath)
|
|
@@ -47979,13 +48782,13 @@ url = "https://app.scribed.ai/mcp"
|
|
|
47979
48782
|
if (installed?.config && config2.present && installed.config.hash !== config2.fingerprint)
|
|
47980
48783
|
throw new Error("The Scribed MCP entry was edited; it was preserved. Manage it in this platform before repairing.");
|
|
47981
48784
|
for (const skill of skills)
|
|
47982
|
-
if (skill.content !== null && hash2(skill.content) !== skill.desiredHash && (!skill.owned || hash2(skill.content) !== skill.owned.hash))
|
|
48785
|
+
if (skill.content !== null && hash2(skill.content) !== skill.desiredHash && (!skill.owned || hash2(skill.content) !== skill.owned.hash) && !hasSharedOwnership(skill, state))
|
|
47983
48786
|
throw new Error(`The ${skill.name} skill already exists with different contents; it was preserved.`);
|
|
47984
|
-
const next = { version: installed?.version || bundle.version, installedAt: installed?.installedAt || new Date().toISOString(), skills: { ...installed?.skills
|
|
48787
|
+
const next = { version: installed?.version || bundle.version, installedAt: installed?.installedAt || new Date().toISOString(), skills: { ...installed?.skills } };
|
|
47985
48788
|
if (!config2.present || installed?.config?.path === definition.configPath && installed.config.hash === config2.fingerprint)
|
|
47986
48789
|
next.config = { path: definition.configPath, hash: config2.expectedHash };
|
|
47987
48790
|
for (const skill of skills) {
|
|
47988
|
-
const sharedOwner =
|
|
48791
|
+
const sharedOwner = hasSharedOwnership(skill, state);
|
|
47989
48792
|
if (skill.content === null || skill.owned || sharedOwner)
|
|
47990
48793
|
next.skills[skill.name] = { path: skill.file, hash: skill.content === null ? skill.desiredHash : hash2(skill.content) };
|
|
47991
48794
|
}
|
|
@@ -48029,7 +48832,10 @@ url = "https://app.scribed.ai/mcp"
|
|
|
48029
48832
|
shouldOffer: () => {
|
|
48030
48833
|
try {
|
|
48031
48834
|
const state = receipt().value;
|
|
48032
|
-
|
|
48835
|
+
if (state.offerDismissed || Object.keys(state.platforms).length)
|
|
48836
|
+
return false;
|
|
48837
|
+
const platforms = snapshot(state).platforms;
|
|
48838
|
+
return !platforms.some((platform) => platform.state === "installed") && platforms.some((platform) => !["error", "conflict"].includes(platform.state));
|
|
48033
48839
|
} catch {
|
|
48034
48840
|
return false;
|
|
48035
48841
|
}
|
|
@@ -50090,7 +50896,7 @@ var program = new Command;
|
|
|
50090
50896
|
// package.json
|
|
50091
50897
|
var package_default = {
|
|
50092
50898
|
name: "@scribed/cli",
|
|
50093
|
-
version: "0.1.
|
|
50899
|
+
version: "0.1.16",
|
|
50094
50900
|
description: "Command-line client + MCP server for Scribed — CRM records, phone + texting, inbox, calendar + booking, transcriptions, HR, Vault, automations, Creative Studio, and Documents, derived from the scribed-agent tool catalog.",
|
|
50095
50901
|
type: "module",
|
|
50096
50902
|
license: "SEE LICENSE IN LICENSE",
|
|
@@ -75268,7 +76074,7 @@ class StreamableHTTPClientTransport {
|
|
|
75268
76074
|
// package.json
|
|
75269
76075
|
var package_default2 = {
|
|
75270
76076
|
name: "@scribed/cli",
|
|
75271
|
-
version: "0.1.
|
|
76077
|
+
version: "0.1.16",
|
|
75272
76078
|
description: "Command-line client + MCP server for Scribed — CRM records, phone + texting, inbox, calendar + booking, transcriptions, HR, Vault, automations, Creative Studio, and Documents, derived from the scribed-agent tool catalog.",
|
|
75273
76079
|
type: "module",
|
|
75274
76080
|
license: "SEE LICENSE IN LICENSE",
|
package/dist/mcp/server.js
CHANGED
|
@@ -70177,7 +70177,7 @@ class StdioServerTransport {
|
|
|
70177
70177
|
// package.json
|
|
70178
70178
|
var package_default = {
|
|
70179
70179
|
name: "@scribed/cli",
|
|
70180
|
-
version: "0.1.
|
|
70180
|
+
version: "0.1.16",
|
|
70181
70181
|
description: "Command-line client + MCP server for Scribed — CRM records, phone + texting, inbox, calendar + booking, transcriptions, HR, Vault, automations, Creative Studio, and Documents, derived from the scribed-agent tool catalog.",
|
|
70182
70182
|
type: "module",
|
|
70183
70183
|
license: "SEE LICENSE IN LICENSE",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scribed/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Command-line client + MCP server for Scribed — CRM records, phone + texting, inbox, calendar + booking, transcriptions, HR, Vault, automations, Creative Studio, and Documents, derived from the scribed-agent tool catalog.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"url": "git+https://github.com/q6th/scribed-web.git",
|
|
40
40
|
"directory": "scribed-cli"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "d9feac8991f321c3d3c4b66e5065727849029426",
|
|
43
43
|
"scribedRelease": {
|
|
44
44
|
"repository": "q6th/scribed-web",
|
|
45
|
-
"commit": "
|
|
45
|
+
"commit": "d9feac8991f321c3d3c4b66e5065727849029426"
|
|
46
46
|
}
|
|
47
47
|
}
|