@runtypelabs/cli 2.31.6 → 2.32.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 +335 -277
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
5
|
-
get: (a,
|
|
5
|
+
get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
|
|
6
6
|
}) : x2)(function(x2) {
|
|
7
7
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
8
|
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
@@ -1238,9 +1238,9 @@ function $constructor(name, initializer3, params) {
|
|
|
1238
1238
|
const proto = _2.prototype;
|
|
1239
1239
|
const keys = Object.keys(proto);
|
|
1240
1240
|
for (let i = 0; i < keys.length; i++) {
|
|
1241
|
-
const
|
|
1242
|
-
if (!(
|
|
1243
|
-
inst[
|
|
1241
|
+
const k2 = keys[i];
|
|
1242
|
+
if (!(k2 in inst)) {
|
|
1243
|
+
inst[k2] = proto[k2].bind(inst);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
@@ -1371,7 +1371,7 @@ function assert(_2) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
function getEnumValues(entries) {
|
|
1373
1373
|
const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
|
|
1374
|
-
const values = Object.entries(entries).filter(([
|
|
1374
|
+
const values = Object.entries(entries).filter(([k2, _2]) => numericValues.indexOf(+k2) === -1).map(([_2, v2]) => v2);
|
|
1375
1375
|
return values;
|
|
1376
1376
|
}
|
|
1377
1377
|
function joinValues(array2, separator = "|") {
|
|
@@ -1499,8 +1499,8 @@ var allowsEval = /* @__PURE__ */ cached(() => {
|
|
|
1499
1499
|
return false;
|
|
1500
1500
|
}
|
|
1501
1501
|
try {
|
|
1502
|
-
const
|
|
1503
|
-
new
|
|
1502
|
+
const F2 = Function;
|
|
1503
|
+
new F2("");
|
|
1504
1504
|
return true;
|
|
1505
1505
|
} catch (_2) {
|
|
1506
1506
|
return false;
|
|
@@ -1661,8 +1661,8 @@ function stringifyPrimitive(value) {
|
|
|
1661
1661
|
return `${value}`;
|
|
1662
1662
|
}
|
|
1663
1663
|
function optionalKeys(shape) {
|
|
1664
|
-
return Object.keys(shape).filter((
|
|
1665
|
-
return shape[
|
|
1664
|
+
return Object.keys(shape).filter((k2) => {
|
|
1665
|
+
return shape[k2]._zod.optin === "optional" && shape[k2]._zod.optout === "optional";
|
|
1666
1666
|
});
|
|
1667
1667
|
}
|
|
1668
1668
|
var NUMBER_FORMAT_RANGES = {
|
|
@@ -1762,20 +1762,20 @@ function safeExtend(schema, shape) {
|
|
|
1762
1762
|
});
|
|
1763
1763
|
return clone(schema, def);
|
|
1764
1764
|
}
|
|
1765
|
-
function merge(a,
|
|
1765
|
+
function merge(a, b2) {
|
|
1766
1766
|
if (a._zod.def.checks?.length) {
|
|
1767
1767
|
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
1768
1768
|
}
|
|
1769
1769
|
const def = mergeDefs(a._zod.def, {
|
|
1770
1770
|
get shape() {
|
|
1771
|
-
const _shape = { ...a._zod.def.shape, ...
|
|
1771
|
+
const _shape = { ...a._zod.def.shape, ...b2._zod.def.shape };
|
|
1772
1772
|
assignProp(this, "shape", _shape);
|
|
1773
1773
|
return _shape;
|
|
1774
1774
|
},
|
|
1775
1775
|
get catchall() {
|
|
1776
|
-
return
|
|
1776
|
+
return b2._zod.def.catchall;
|
|
1777
1777
|
},
|
|
1778
|
-
checks:
|
|
1778
|
+
checks: b2._zod.def.checks ?? []
|
|
1779
1779
|
});
|
|
1780
1780
|
return clone(a, def);
|
|
1781
1781
|
}
|
|
@@ -1939,8 +1939,8 @@ function issue(...args) {
|
|
|
1939
1939
|
return { ...iss };
|
|
1940
1940
|
}
|
|
1941
1941
|
function cleanEnum(obj) {
|
|
1942
|
-
return Object.entries(obj).filter(([
|
|
1943
|
-
return Number.isNaN(Number.parseInt(
|
|
1942
|
+
return Object.entries(obj).filter(([k2, _2]) => {
|
|
1943
|
+
return Number.isNaN(Number.parseInt(k2, 10));
|
|
1944
1944
|
}).map((el) => el[1]);
|
|
1945
1945
|
}
|
|
1946
1946
|
function base64ToUint8Array(base643) {
|
|
@@ -1978,7 +1978,7 @@ function hexToUint8Array(hex3) {
|
|
|
1978
1978
|
return bytes;
|
|
1979
1979
|
}
|
|
1980
1980
|
function uint8ArrayToHex(bytes) {
|
|
1981
|
-
return Array.from(bytes).map((
|
|
1981
|
+
return Array.from(bytes).map((b2) => b2.toString(16).padStart(2, "0")).join("");
|
|
1982
1982
|
}
|
|
1983
1983
|
var Class = class {
|
|
1984
1984
|
constructor(..._args) {
|
|
@@ -2115,7 +2115,7 @@ function toDotPath(_path) {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
function prettifyError(error51) {
|
|
2117
2117
|
const lines = [];
|
|
2118
|
-
const issues = [...error51.issues].sort((a,
|
|
2118
|
+
const issues = [...error51.issues].sort((a, b2) => (a.path ?? []).length - (b2.path ?? []).length);
|
|
2119
2119
|
for (const issue2 of issues) {
|
|
2120
2120
|
lines.push(`\u2716 ${issue2.message}`);
|
|
2121
2121
|
if (issue2.path?.length)
|
|
@@ -2947,11 +2947,11 @@ var Doc = class {
|
|
|
2947
2947
|
}
|
|
2948
2948
|
}
|
|
2949
2949
|
compile() {
|
|
2950
|
-
const
|
|
2950
|
+
const F2 = Function;
|
|
2951
2951
|
const args = this?.args;
|
|
2952
2952
|
const content = this?.content ?? [``];
|
|
2953
2953
|
const lines = [...content.map((x2) => ` ${x2}`)];
|
|
2954
|
-
return new
|
|
2954
|
+
return new F2(...args, lines.join("\n"));
|
|
2955
2955
|
}
|
|
2956
2956
|
};
|
|
2957
2957
|
|
|
@@ -3648,9 +3648,9 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
3648
3648
|
}
|
|
3649
3649
|
function normalizeDef(def) {
|
|
3650
3650
|
const keys = Object.keys(def.shape);
|
|
3651
|
-
for (const
|
|
3652
|
-
if (!def.shape?.[
|
|
3653
|
-
throw new Error(`Invalid element at key "${
|
|
3651
|
+
for (const k2 of keys) {
|
|
3652
|
+
if (!def.shape?.[k2]?._zod?.traits?.has("$ZodType")) {
|
|
3653
|
+
throw new Error(`Invalid element at key "${k2}": expected a Zod schema`);
|
|
3654
3654
|
}
|
|
3655
3655
|
}
|
|
3656
3656
|
const okeys = optionalKeys(def.shape);
|
|
@@ -3771,8 +3771,8 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3771
3771
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
3772
3772
|
const normalized = _normalized.value;
|
|
3773
3773
|
const parseStr = (key) => {
|
|
3774
|
-
const
|
|
3775
|
-
return `shape[${
|
|
3774
|
+
const k2 = esc(key);
|
|
3775
|
+
return `shape[${k2}]._zod.run({ value: input[${k2}], issues: [] }, ctx)`;
|
|
3776
3776
|
};
|
|
3777
3777
|
doc.write(`const input = payload.value;`);
|
|
3778
3778
|
const ids = /* @__PURE__ */ Object.create(null);
|
|
@@ -3783,7 +3783,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3783
3783
|
doc.write(`const newResult = {};`);
|
|
3784
3784
|
for (const key of normalized.keys) {
|
|
3785
3785
|
const id = ids[key];
|
|
3786
|
-
const
|
|
3786
|
+
const k2 = esc(key);
|
|
3787
3787
|
const schema = shape[key];
|
|
3788
3788
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3789
3789
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
@@ -3791,30 +3791,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3791
3791
|
if (isOptionalIn && isOptionalOut) {
|
|
3792
3792
|
doc.write(`
|
|
3793
3793
|
if (${id}.issues.length) {
|
|
3794
|
-
if (${
|
|
3794
|
+
if (${k2} in input) {
|
|
3795
3795
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3796
3796
|
...iss,
|
|
3797
|
-
path: iss.path ? [${
|
|
3797
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3798
3798
|
})));
|
|
3799
3799
|
}
|
|
3800
3800
|
}
|
|
3801
3801
|
|
|
3802
3802
|
if (${id}.value === undefined) {
|
|
3803
|
-
if (${
|
|
3804
|
-
newResult[${
|
|
3803
|
+
if (${k2} in input) {
|
|
3804
|
+
newResult[${k2}] = undefined;
|
|
3805
3805
|
}
|
|
3806
3806
|
} else {
|
|
3807
|
-
newResult[${
|
|
3807
|
+
newResult[${k2}] = ${id}.value;
|
|
3808
3808
|
}
|
|
3809
3809
|
|
|
3810
3810
|
`);
|
|
3811
3811
|
} else if (!isOptionalIn) {
|
|
3812
3812
|
doc.write(`
|
|
3813
|
-
const ${id}_present = ${
|
|
3813
|
+
const ${id}_present = ${k2} in input;
|
|
3814
3814
|
if (${id}.issues.length) {
|
|
3815
3815
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3816
3816
|
...iss,
|
|
3817
|
-
path: iss.path ? [${
|
|
3817
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3818
3818
|
})));
|
|
3819
3819
|
}
|
|
3820
3820
|
if (!${id}_present && !${id}.issues.length) {
|
|
@@ -3822,15 +3822,15 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3822
3822
|
code: "invalid_type",
|
|
3823
3823
|
expected: "nonoptional",
|
|
3824
3824
|
input: undefined,
|
|
3825
|
-
path: [${
|
|
3825
|
+
path: [${k2}]
|
|
3826
3826
|
});
|
|
3827
3827
|
}
|
|
3828
3828
|
|
|
3829
3829
|
if (${id}_present) {
|
|
3830
3830
|
if (${id}.value === undefined) {
|
|
3831
|
-
newResult[${
|
|
3831
|
+
newResult[${k2}] = undefined;
|
|
3832
3832
|
} else {
|
|
3833
|
-
newResult[${
|
|
3833
|
+
newResult[${k2}] = ${id}.value;
|
|
3834
3834
|
}
|
|
3835
3835
|
}
|
|
3836
3836
|
|
|
@@ -3840,16 +3840,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3840
3840
|
if (${id}.issues.length) {
|
|
3841
3841
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3842
3842
|
...iss,
|
|
3843
|
-
path: iss.path ? [${
|
|
3843
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3844
3844
|
})));
|
|
3845
3845
|
}
|
|
3846
3846
|
|
|
3847
3847
|
if (${id}.value === undefined) {
|
|
3848
|
-
if (${
|
|
3849
|
-
newResult[${
|
|
3848
|
+
if (${k2} in input) {
|
|
3849
|
+
newResult[${k2}] = undefined;
|
|
3850
3850
|
}
|
|
3851
3851
|
} else {
|
|
3852
|
-
newResult[${
|
|
3852
|
+
newResult[${k2}] = ${id}.value;
|
|
3853
3853
|
}
|
|
3854
3854
|
|
|
3855
3855
|
`);
|
|
@@ -4018,11 +4018,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
4018
4018
|
const pv = option._zod.propValues;
|
|
4019
4019
|
if (!pv || Object.keys(pv).length === 0)
|
|
4020
4020
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
4021
|
-
for (const [
|
|
4022
|
-
if (!propValues[
|
|
4023
|
-
propValues[
|
|
4021
|
+
for (const [k2, v2] of Object.entries(pv)) {
|
|
4022
|
+
if (!propValues[k2])
|
|
4023
|
+
propValues[k2] = /* @__PURE__ */ new Set();
|
|
4024
4024
|
for (const val of v2) {
|
|
4025
|
-
propValues[
|
|
4025
|
+
propValues[k2].add(val);
|
|
4026
4026
|
}
|
|
4027
4027
|
}
|
|
4028
4028
|
}
|
|
@@ -4090,19 +4090,19 @@ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, d
|
|
|
4090
4090
|
return handleIntersectionResults(payload, left, right);
|
|
4091
4091
|
};
|
|
4092
4092
|
});
|
|
4093
|
-
function mergeValues(a,
|
|
4094
|
-
if (a ===
|
|
4093
|
+
function mergeValues(a, b2) {
|
|
4094
|
+
if (a === b2) {
|
|
4095
4095
|
return { valid: true, data: a };
|
|
4096
4096
|
}
|
|
4097
|
-
if (a instanceof Date &&
|
|
4097
|
+
if (a instanceof Date && b2 instanceof Date && +a === +b2) {
|
|
4098
4098
|
return { valid: true, data: a };
|
|
4099
4099
|
}
|
|
4100
|
-
if (isPlainObject(a) && isPlainObject(
|
|
4101
|
-
const bKeys = Object.keys(
|
|
4100
|
+
if (isPlainObject(a) && isPlainObject(b2)) {
|
|
4101
|
+
const bKeys = Object.keys(b2);
|
|
4102
4102
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
4103
|
-
const newObj = { ...a, ...
|
|
4103
|
+
const newObj = { ...a, ...b2 };
|
|
4104
4104
|
for (const key of sharedKeys) {
|
|
4105
|
-
const sharedValue = mergeValues(a[key],
|
|
4105
|
+
const sharedValue = mergeValues(a[key], b2[key]);
|
|
4106
4106
|
if (!sharedValue.valid) {
|
|
4107
4107
|
return {
|
|
4108
4108
|
valid: false,
|
|
@@ -4113,14 +4113,14 @@ function mergeValues(a, b) {
|
|
|
4113
4113
|
}
|
|
4114
4114
|
return { valid: true, data: newObj };
|
|
4115
4115
|
}
|
|
4116
|
-
if (Array.isArray(a) && Array.isArray(
|
|
4117
|
-
if (a.length !==
|
|
4116
|
+
if (Array.isArray(a) && Array.isArray(b2)) {
|
|
4117
|
+
if (a.length !== b2.length) {
|
|
4118
4118
|
return { valid: false, mergeErrorPath: [] };
|
|
4119
4119
|
}
|
|
4120
4120
|
const newArray = [];
|
|
4121
4121
|
for (let index = 0; index < a.length; index++) {
|
|
4122
4122
|
const itemA = a[index];
|
|
4123
|
-
const itemB =
|
|
4123
|
+
const itemB = b2[index];
|
|
4124
4124
|
const sharedValue = mergeValues(itemA, itemB);
|
|
4125
4125
|
if (!sharedValue.valid) {
|
|
4126
4126
|
return {
|
|
@@ -4140,10 +4140,10 @@ function handleIntersectionResults(result, left, right) {
|
|
|
4140
4140
|
for (const iss of left.issues) {
|
|
4141
4141
|
if (iss.code === "unrecognized_keys") {
|
|
4142
4142
|
unrecIssue ?? (unrecIssue = iss);
|
|
4143
|
-
for (const
|
|
4144
|
-
if (!unrecKeys.has(
|
|
4145
|
-
unrecKeys.set(
|
|
4146
|
-
unrecKeys.get(
|
|
4143
|
+
for (const k2 of iss.keys) {
|
|
4144
|
+
if (!unrecKeys.has(k2))
|
|
4145
|
+
unrecKeys.set(k2, {});
|
|
4146
|
+
unrecKeys.get(k2).l = true;
|
|
4147
4147
|
}
|
|
4148
4148
|
} else {
|
|
4149
4149
|
result.issues.push(iss);
|
|
@@ -4151,16 +4151,16 @@ function handleIntersectionResults(result, left, right) {
|
|
|
4151
4151
|
}
|
|
4152
4152
|
for (const iss of right.issues) {
|
|
4153
4153
|
if (iss.code === "unrecognized_keys") {
|
|
4154
|
-
for (const
|
|
4155
|
-
if (!unrecKeys.has(
|
|
4156
|
-
unrecKeys.set(
|
|
4157
|
-
unrecKeys.get(
|
|
4154
|
+
for (const k2 of iss.keys) {
|
|
4155
|
+
if (!unrecKeys.has(k2))
|
|
4156
|
+
unrecKeys.set(k2, {});
|
|
4157
|
+
unrecKeys.get(k2).r = true;
|
|
4158
4158
|
}
|
|
4159
4159
|
} else {
|
|
4160
4160
|
result.issues.push(iss);
|
|
4161
4161
|
}
|
|
4162
4162
|
}
|
|
4163
|
-
const bothKeys = [...unrecKeys].filter(([, f2]) => f2.l && f2.r).map(([
|
|
4163
|
+
const bothKeys = [...unrecKeys].filter(([, f2]) => f2.l && f2.r).map(([k2]) => k2);
|
|
4164
4164
|
if (bothKeys.length && unrecIssue) {
|
|
4165
4165
|
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
4166
4166
|
}
|
|
@@ -4504,7 +4504,7 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
4504
4504
|
const values = getEnumValues(def.entries);
|
|
4505
4505
|
const valuesSet = new Set(values);
|
|
4506
4506
|
inst._zod.values = valuesSet;
|
|
4507
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((
|
|
4507
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k2) => propertyKeyTypes.has(typeof k2)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
4508
4508
|
inst._zod.parse = (payload, _ctx) => {
|
|
4509
4509
|
const input = payload.value;
|
|
4510
4510
|
if (valuesSet.has(input)) {
|
|
@@ -4970,9 +4970,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
4970
4970
|
return payload;
|
|
4971
4971
|
};
|
|
4972
4972
|
inst.input = (...args) => {
|
|
4973
|
-
const
|
|
4973
|
+
const F2 = inst.constructor;
|
|
4974
4974
|
if (Array.isArray(args[0])) {
|
|
4975
|
-
return new
|
|
4975
|
+
return new F2({
|
|
4976
4976
|
type: "function",
|
|
4977
4977
|
input: new $ZodTuple({
|
|
4978
4978
|
type: "tuple",
|
|
@@ -4982,15 +4982,15 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
4982
4982
|
output: inst._def.output
|
|
4983
4983
|
});
|
|
4984
4984
|
}
|
|
4985
|
-
return new
|
|
4985
|
+
return new F2({
|
|
4986
4986
|
type: "function",
|
|
4987
4987
|
input: args[0],
|
|
4988
4988
|
output: inst._def.output
|
|
4989
4989
|
});
|
|
4990
4990
|
};
|
|
4991
4991
|
inst.output = (output) => {
|
|
4992
|
-
const
|
|
4993
|
-
return new
|
|
4992
|
+
const F2 = inst.constructor;
|
|
4993
|
+
return new F2({
|
|
4994
4994
|
type: "function",
|
|
4995
4995
|
input: inst._def.input,
|
|
4996
4996
|
output
|
|
@@ -12759,14 +12759,14 @@ var intersectionProcessor = (schema, ctx, json2, params) => {
|
|
|
12759
12759
|
...params,
|
|
12760
12760
|
path: [...params.path, "allOf", 0]
|
|
12761
12761
|
});
|
|
12762
|
-
const
|
|
12762
|
+
const b2 = process2(def.right, ctx, {
|
|
12763
12763
|
...params,
|
|
12764
12764
|
path: [...params.path, "allOf", 1]
|
|
12765
12765
|
});
|
|
12766
12766
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
12767
12767
|
const allOf = [
|
|
12768
12768
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
12769
|
-
...isSimpleIntersection(
|
|
12769
|
+
...isSimpleIntersection(b2) ? b2.allOf : [b2]
|
|
12770
12770
|
];
|
|
12771
12771
|
json2.allOf = allOf;
|
|
12772
12772
|
};
|
|
@@ -14208,11 +14208,11 @@ function record(keyType, valueType, params) {
|
|
|
14208
14208
|
});
|
|
14209
14209
|
}
|
|
14210
14210
|
function partialRecord(keyType, valueType, params) {
|
|
14211
|
-
const
|
|
14212
|
-
|
|
14211
|
+
const k2 = clone(keyType);
|
|
14212
|
+
k2._zod.values = void 0;
|
|
14213
14213
|
return new ZodRecord({
|
|
14214
14214
|
type: "record",
|
|
14215
|
-
keyType:
|
|
14215
|
+
keyType: k2,
|
|
14216
14216
|
valueType,
|
|
14217
14217
|
...util_exports.normalizeParams(params)
|
|
14218
14218
|
});
|
|
@@ -17242,9 +17242,17 @@ var productConfigurationSummarySchema = external_exports.object({
|
|
|
17242
17242
|
configurationUrl: external_exports.string(),
|
|
17243
17243
|
handoff: secretHandoffSchema.optional()
|
|
17244
17244
|
});
|
|
17245
|
-
var ORGANIZATION_INTEGRATION_PROVIDERS = ["slack", "telegram", "discord", "linear", "github", "granola"];
|
|
17245
|
+
var ORGANIZATION_INTEGRATION_PROVIDERS = ["slack", "telegram", "discord", "linear", "github", "granola", "google"];
|
|
17246
17246
|
var integrationProviderSchema = external_exports.enum(ORGANIZATION_INTEGRATION_PROVIDERS);
|
|
17247
17247
|
var integrationStatusSchema = external_exports.enum(["active", "revoked", "pending"]);
|
|
17248
|
+
var GOOGLE_SCOPE_BUNDLES = {
|
|
17249
|
+
gmail: ["https://www.googleapis.com/auth/gmail.modify"],
|
|
17250
|
+
calendar: ["https://www.googleapis.com/auth/calendar"],
|
|
17251
|
+
docs: ["https://www.googleapis.com/auth/documents"],
|
|
17252
|
+
sheets: ["https://www.googleapis.com/auth/spreadsheets"],
|
|
17253
|
+
drive: ["https://www.googleapis.com/auth/drive.file"]
|
|
17254
|
+
};
|
|
17255
|
+
var GOOGLE_SCOPE_FEATURES = Object.keys(GOOGLE_SCOPE_BUNDLES);
|
|
17248
17256
|
var FILTER_OPERATORS = [
|
|
17249
17257
|
"eq",
|
|
17250
17258
|
"neq",
|
|
@@ -20677,28 +20685,28 @@ function formatPath(path20) {
|
|
|
20677
20685
|
return acc ? `${acc}.${key}` : key;
|
|
20678
20686
|
}, "");
|
|
20679
20687
|
}
|
|
20680
|
-
function compareIssuePath(a,
|
|
20681
|
-
if (!a && !
|
|
20688
|
+
function compareIssuePath(a, b2) {
|
|
20689
|
+
if (!a && !b2) return 0;
|
|
20682
20690
|
if (!a) return 1;
|
|
20683
|
-
if (!
|
|
20684
|
-
return a.localeCompare(
|
|
20691
|
+
if (!b2) return -1;
|
|
20692
|
+
return a.localeCompare(b2);
|
|
20685
20693
|
}
|
|
20686
20694
|
function sortIssues(issues) {
|
|
20687
|
-
return [...issues].sort((a,
|
|
20695
|
+
return [...issues].sort((a, b2) => {
|
|
20688
20696
|
const aStepIndex = a.step?.index ?? Number.MAX_SAFE_INTEGER;
|
|
20689
|
-
const bStepIndex =
|
|
20697
|
+
const bStepIndex = b2.step?.index ?? Number.MAX_SAFE_INTEGER;
|
|
20690
20698
|
if (aStepIndex !== bStepIndex) {
|
|
20691
20699
|
return aStepIndex - bStepIndex;
|
|
20692
20700
|
}
|
|
20693
|
-
const pathCompare = compareIssuePath(a.path,
|
|
20701
|
+
const pathCompare = compareIssuePath(a.path, b2.path);
|
|
20694
20702
|
if (pathCompare !== 0) {
|
|
20695
20703
|
return pathCompare;
|
|
20696
20704
|
}
|
|
20697
|
-
const codeCompare = a.code.localeCompare(
|
|
20705
|
+
const codeCompare = a.code.localeCompare(b2.code);
|
|
20698
20706
|
if (codeCompare !== 0) {
|
|
20699
20707
|
return codeCompare;
|
|
20700
20708
|
}
|
|
20701
|
-
return a.message.localeCompare(
|
|
20709
|
+
return a.message.localeCompare(b2.message);
|
|
20702
20710
|
});
|
|
20703
20711
|
}
|
|
20704
20712
|
function addIssue(level, issue2, buckets) {
|
|
@@ -35447,7 +35455,7 @@ var CORE_BUILTIN_TOOLS_REGISTRY = [
|
|
|
35447
35455
|
{
|
|
35448
35456
|
id: "publish_page",
|
|
35449
35457
|
name: "Publish Page",
|
|
35450
|
-
description: "Publish an HTML page on Runtype's CDN and get back a shareable URL that renders the page inline in the browser. Two source modes: (1) pass `url` to download an HTML file from an HTTP(S) URL, or (2) pass base64-encoded `content` (defaults to `contentType: text/html`) to upload inline HTML directly \u2014 useful when running inside a sandboxed code-execution environment with restricted outbound network. Exactly one of `url` or `content` must be provided. Served inline from a `/preview/` path under a locked-down CSP
|
|
35458
|
+
description: "Publish an HTML page on Runtype's CDN and get back a shareable URL that renders the page inline in the browser. Two source modes: (1) pass `url` to download an HTML file from an HTTP(S) URL, or (2) pass base64-encoded `content` (defaults to `contentType: text/html`) to upload inline HTML directly \u2014 useful when running inside a sandboxed code-execution environment with restricted outbound network. Exactly one of `url` or `content` must be provided. Served inline from a `/preview/` path under a locked-down CSP: no inline scripts, no same-origin scripts, no form submissions, and no network requests except to the Runtype API. The one executable seam is Runtype's own CDN (`https://cdn.runtype.com`), so a Persona chat widget can be embedded using the script-installer form (a `<script src=\u2026>` tag with `data-*` attributes); an inline `<script type=\"module\">` will not run. Any other JavaScript, third-party CDN, or outbound call is blocked. Page URLs are public and expire based on the account's plan (7 days on the default plan; longer or permanent on higher tiers \u2014 check `expiresAt` in the result). Pass `expiresInSeconds` to choose a shorter lifetime; the plan TTL is a hard ceiling. A page can be re-upped to the current plan TTL at the same URL via `POST /v1/assets/:assetId/extend`. Accepts only HTML content. 25 MB max. To host a non-HTML file, or HTML as a permanent downloadable file, use `store_asset` instead.",
|
|
35451
35459
|
category: BuiltInToolCategory.FILE_OPERATIONS,
|
|
35452
35460
|
toolGroup: BuiltInToolGroup.FILE_OUTPUTS,
|
|
35453
35461
|
providers: [BuiltInToolProvider.MULTI],
|
|
@@ -37492,8 +37500,9 @@ var GOOGLE_INTEGRATION = {
|
|
|
37492
37500
|
transport: "http",
|
|
37493
37501
|
url: "",
|
|
37494
37502
|
// Direct API calls - no external proxy needed
|
|
37503
|
+
// Supplied by the token broker at call time from the `provider: 'google'`
|
|
37504
|
+
// organization integration, not pasted by the user. Refresh is automatic.
|
|
37495
37505
|
requiredCredentials: ["googleAccessToken"],
|
|
37496
|
-
// googleRefreshToken is optional but recommended for long-lived access
|
|
37497
37506
|
category: MCPServerCategory.PRODUCTIVITY,
|
|
37498
37507
|
documentationUrl: "https://developers.google.com/workspace",
|
|
37499
37508
|
icon: "google",
|
|
@@ -39029,6 +39038,11 @@ var userProfileFeaturesSchema = external_exports.object({
|
|
|
39029
39038
|
// rule enables it). When false the dashboard renders byte-identical to today
|
|
39030
39039
|
// (personal sentinel, personal/team chooser, personal Schematic identify).
|
|
39031
39040
|
enableWorkspaceModel: external_exports.boolean(),
|
|
39041
|
+
// Gates the "OAuth apps" settings tab in the dashboard (self-serve OAuth
|
|
39042
|
+
// client registration). Driven by the `enable-self-serve-oauth-clients`
|
|
39043
|
+
// boolean flag (fail-closed in production until a rule enables it; non-prod
|
|
39044
|
+
// defaults on). The whole /v1/oauth-clients surface 404s when this is off.
|
|
39045
|
+
enableSelfServeOauthClients: external_exports.boolean(),
|
|
39032
39046
|
// Durable server-side workspace migration state. `workspaceModelReady`
|
|
39033
39047
|
// means the user's workspace pointer is set. `workspaceModelEligible` means
|
|
39034
39048
|
// the user belongs to the new-signup auto-provision cohort; when true while
|
|
@@ -39078,9 +39092,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39078
39092
|
"anthropic": "claude-opus-4-7",
|
|
39079
39093
|
"vercel": "anthropic/claude-opus-4.7"
|
|
39080
39094
|
},
|
|
39081
|
-
"claude-opus-4-7-fast": {
|
|
39082
|
-
"vercel": "anthropic/claude-opus-4.7-fast"
|
|
39083
|
-
},
|
|
39084
39095
|
"claude-opus-4-8": {
|
|
39085
39096
|
"anthropic": "claude-opus-4-8",
|
|
39086
39097
|
"vercel": "anthropic/claude-opus-4.8"
|
|
@@ -39100,9 +39111,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39100
39111
|
"claude-opus-4.7": {
|
|
39101
39112
|
"vercel": "anthropic/claude-opus-4.7"
|
|
39102
39113
|
},
|
|
39103
|
-
"claude-opus-4.7-fast": {
|
|
39104
|
-
"vercel": "anthropic/claude-opus-4.7-fast"
|
|
39105
|
-
},
|
|
39106
39114
|
"claude-opus-4.8": {
|
|
39107
39115
|
"vercel": "anthropic/claude-opus-4.8"
|
|
39108
39116
|
},
|
|
@@ -39706,8 +39714,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39706
39714
|
"vercel": "moonshotai/kimi-k2.7-code-highspeed"
|
|
39707
39715
|
},
|
|
39708
39716
|
"kimi-k3": {
|
|
39717
|
+
"togetherai": "togetherai/moonshotai/Kimi-K3",
|
|
39709
39718
|
"vercel": "moonshotai/kimi-k3"
|
|
39710
39719
|
},
|
|
39720
|
+
"kimi-k3-fast": {
|
|
39721
|
+
"vercel": "moonshotai/kimi-k3-fast"
|
|
39722
|
+
},
|
|
39711
39723
|
"laguna-s-2-1": {
|
|
39712
39724
|
"vercel": "poolside/laguna-s-2.1"
|
|
39713
39725
|
},
|
|
@@ -39847,6 +39859,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39847
39859
|
"moonshotai/Kimi-K2.7-Code": {
|
|
39848
39860
|
"togetherai": "togetherai/moonshotai/Kimi-K2.7-Code"
|
|
39849
39861
|
},
|
|
39862
|
+
"moonshotai/Kimi-K3": {
|
|
39863
|
+
"togetherai": "togetherai/moonshotai/Kimi-K3"
|
|
39864
|
+
},
|
|
39850
39865
|
"morph-v3-fast": {
|
|
39851
39866
|
"vercel": "morph/morph-v3-fast"
|
|
39852
39867
|
},
|
|
@@ -40183,7 +40198,7 @@ var PLATFORM_KEY_PROVIDER_MAP = {
|
|
|
40183
40198
|
"mock": false
|
|
40184
40199
|
};
|
|
40185
40200
|
var PLATFORM_KEY_PROVIDERS = new Set(
|
|
40186
|
-
Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v2]) => v2).map(([
|
|
40201
|
+
Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v2]) => v2).map(([k2]) => k2)
|
|
40187
40202
|
);
|
|
40188
40203
|
var MANUAL_PROVIDER_MAP_OVERRIDES = {
|
|
40189
40204
|
// Bedrock uses different model ID format
|
|
@@ -44325,7 +44340,7 @@ var TOOL_CATALOG_FOR_FLOW_GENERATION = (() => {
|
|
|
44325
44340
|
const toolName = tool.id.replace(`orthogonal:${slug}:`, "");
|
|
44326
44341
|
vendorGroups.get(slug).push(toolName);
|
|
44327
44342
|
}
|
|
44328
|
-
const orthogonalLines = Array.from(vendorGroups.entries()).sort(([a], [
|
|
44343
|
+
const orthogonalLines = Array.from(vendorGroups.entries()).sort(([a], [b2]) => a.localeCompare(b2)).map(([slug, tools]) => {
|
|
44329
44344
|
const vendorName = ORTHOGONAL_API_NAMES[slug] ?? slug;
|
|
44330
44345
|
return `- **${vendorName}** (\`platform:orthogonal:${slug}:<tool>\`): ${tools.join(", ")}`;
|
|
44331
44346
|
});
|
|
@@ -44364,7 +44379,7 @@ ${orthogonalLines.join("\n")}
|
|
|
44364
44379
|
- **Create Linear issue** \u2192 \`builtin:linear:create_issue\`
|
|
44365
44380
|
- **Create GitHub PR** \u2192 \`builtin:github:create_pull_request\`
|
|
44366
44381
|
- **Host a file (public CDN URL or signed private URL)** \u2192 \`builtin:store_asset\` \u2014 pass \`url\` to rehost, or base64 \`content\` + \`contentType\` to upload inline bytes (useful from sandboxed code-execution environments). Served as attachment.
|
|
44367
|
-
- **Publish an HTML page that renders in the browser** \u2192 \`builtin:publish_page\` \u2014 returns a shareable \`/preview/\` URL (public, 7-day TTL, locked-down CSP: no
|
|
44382
|
+
- **Publish an HTML page that renders in the browser** \u2192 \`builtin:publish_page\` \u2014 returns a shareable \`/preview/\` URL (public, 7-day TTL, locked-down CSP: no form-submit, and no scripts or network calls beyond a Persona widget from \`cdn.runtype.com\` calling the Runtype API). Accepts \`url\` or inline base64 HTML. Prefer this over \`store_asset\` whenever you want inline browser rendering.
|
|
44368
44383
|
- **Semantic vector search** \u2192 \`builtin:vector-search\`
|
|
44369
44384
|
- **Text-to-speech** \u2192 \`builtin:elevenlabs-tts\`
|
|
44370
44385
|
- **Speech-to-text** \u2192 \`builtin:elevenlabs-stt\`
|
|
@@ -45183,14 +45198,43 @@ var MOCK_INVENTORY_LEVELS = MOCK_PRODUCTS.flatMap(
|
|
|
45183
45198
|
}))
|
|
45184
45199
|
);
|
|
45185
45200
|
var LOCAL_INFERENCE_PROTOCOL_VERSION = 1;
|
|
45201
|
+
var LocalInferenceSurfaceSchema = external_exports.enum(["playground", "flows", "agents"]);
|
|
45186
45202
|
var LocalInferenceSelectionSchema = external_exports.object({
|
|
45187
45203
|
sessionId: external_exports.string().uuid(),
|
|
45188
45204
|
model: external_exports.string().trim().min(1).max(256),
|
|
45189
|
-
backend: external_exports.literal("ollama")
|
|
45205
|
+
backend: external_exports.literal("ollama"),
|
|
45206
|
+
/**
|
|
45207
|
+
* Dashboard surface that created the session. Optional during the rolling
|
|
45208
|
+
* upgrade from protocol v1 clients; new clients always send it.
|
|
45209
|
+
*/
|
|
45210
|
+
surface: LocalInferenceSurfaceSchema.optional()
|
|
45190
45211
|
});
|
|
45191
|
-
var
|
|
45192
|
-
|
|
45193
|
-
|
|
45212
|
+
var LocalInferenceToolCallSchema = external_exports.object({
|
|
45213
|
+
id: external_exports.string().min(1).max(512),
|
|
45214
|
+
name: external_exports.string().min(1).max(256),
|
|
45215
|
+
arguments: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
45216
|
+
});
|
|
45217
|
+
var LocalInferenceMessageSchema = external_exports.discriminatedUnion("role", [
|
|
45218
|
+
external_exports.object({
|
|
45219
|
+
role: external_exports.enum(["system", "user"]),
|
|
45220
|
+
content: external_exports.string().max(1e6)
|
|
45221
|
+
}),
|
|
45222
|
+
external_exports.object({
|
|
45223
|
+
role: external_exports.literal("assistant"),
|
|
45224
|
+
content: external_exports.string().max(1e6),
|
|
45225
|
+
toolCalls: external_exports.array(LocalInferenceToolCallSchema).max(100).optional()
|
|
45226
|
+
}),
|
|
45227
|
+
external_exports.object({
|
|
45228
|
+
role: external_exports.literal("tool"),
|
|
45229
|
+
content: external_exports.string().max(1e6),
|
|
45230
|
+
toolCallId: external_exports.string().min(1).max(512),
|
|
45231
|
+
name: external_exports.string().min(1).max(256)
|
|
45232
|
+
})
|
|
45233
|
+
]);
|
|
45234
|
+
var LocalInferenceToolSchema = external_exports.object({
|
|
45235
|
+
name: external_exports.string().min(1).max(256),
|
|
45236
|
+
description: external_exports.string().max(8e3),
|
|
45237
|
+
parametersSchema: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
45194
45238
|
});
|
|
45195
45239
|
var LocalInferenceInvokeSchema = external_exports.object({
|
|
45196
45240
|
type: external_exports.literal("inference.invoke"),
|
|
@@ -45198,6 +45242,8 @@ var LocalInferenceInvokeSchema = external_exports.object({
|
|
|
45198
45242
|
invocationId: external_exports.string().uuid(),
|
|
45199
45243
|
model: external_exports.string().trim().min(1).max(256),
|
|
45200
45244
|
messages: external_exports.array(LocalInferenceMessageSchema).min(1).max(500),
|
|
45245
|
+
tools: external_exports.array(LocalInferenceToolSchema).min(1).max(50).optional(),
|
|
45246
|
+
toolChoice: external_exports.enum(["auto", "required", "none"]).optional(),
|
|
45201
45247
|
temperature: external_exports.number().finite().min(0).max(2).optional(),
|
|
45202
45248
|
maxTokens: external_exports.number().int().positive().max(131072).optional()
|
|
45203
45249
|
});
|
|
@@ -45226,6 +45272,13 @@ var LocalInferenceClientFrameSchema = external_exports.discriminatedUnion("type"
|
|
|
45226
45272
|
sequence: external_exports.number().int().nonnegative(),
|
|
45227
45273
|
text: external_exports.string().max(256e3)
|
|
45228
45274
|
}),
|
|
45275
|
+
external_exports.object({
|
|
45276
|
+
type: external_exports.literal("inference.tool-call"),
|
|
45277
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
45278
|
+
invocationId: external_exports.string().uuid(),
|
|
45279
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
45280
|
+
toolCall: LocalInferenceToolCallSchema
|
|
45281
|
+
}),
|
|
45229
45282
|
external_exports.object({
|
|
45230
45283
|
type: external_exports.literal("inference.complete"),
|
|
45231
45284
|
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
@@ -49881,18 +49934,18 @@ batchCommand.command("summary").description("Show a summary of active and recent
|
|
|
49881
49934
|
console.log(` Recently completed: ${data.recentlyCompleted}`);
|
|
49882
49935
|
if (data.batches.length > 0) {
|
|
49883
49936
|
console.log(chalk9.cyan("\nActive Batches:"));
|
|
49884
|
-
for (const
|
|
49937
|
+
for (const b2 of data.batches) {
|
|
49885
49938
|
console.log(
|
|
49886
|
-
` ${chalk9.green(
|
|
49939
|
+
` ${chalk9.green(b2.id)} ${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords}, ${b2.progress}%)`
|
|
49887
49940
|
);
|
|
49888
49941
|
}
|
|
49889
49942
|
}
|
|
49890
49943
|
if (data.recent.length > 0) {
|
|
49891
49944
|
console.log(chalk9.cyan("\nRecently Completed:"));
|
|
49892
|
-
for (const
|
|
49893
|
-
const statusColor =
|
|
49945
|
+
for (const b2 of data.recent) {
|
|
49946
|
+
const statusColor = b2.status === "completed" ? chalk9.green(b2.status) : chalk9.red(b2.status);
|
|
49894
49947
|
console.log(
|
|
49895
|
-
` ${chalk9.green(
|
|
49948
|
+
` ${chalk9.green(b2.id)} ${b2.flowName ?? ""} \u2014 ${statusColor} (${b2.processedRecords}/${b2.totalRecords})`
|
|
49896
49949
|
);
|
|
49897
49950
|
}
|
|
49898
49951
|
}
|
|
@@ -49921,18 +49974,18 @@ batchCommand.command("summary").description("Show a summary of active and recent
|
|
|
49921
49974
|
{ label: "Active", value: data.activeBatches, color: "green" },
|
|
49922
49975
|
{ label: "Recently completed", value: data.recentlyCompleted }
|
|
49923
49976
|
];
|
|
49924
|
-
for (const
|
|
49977
|
+
for (const b2 of data.batches) {
|
|
49925
49978
|
fields.push({
|
|
49926
|
-
label:
|
|
49927
|
-
value: `${
|
|
49979
|
+
label: b2.id,
|
|
49980
|
+
value: `${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords}, ${b2.progress}%)`,
|
|
49928
49981
|
color: "yellow"
|
|
49929
49982
|
});
|
|
49930
49983
|
}
|
|
49931
|
-
for (const
|
|
49984
|
+
for (const b2 of data.recent) {
|
|
49932
49985
|
fields.push({
|
|
49933
|
-
label:
|
|
49934
|
-
value: `${
|
|
49935
|
-
color:
|
|
49986
|
+
label: b2.id,
|
|
49987
|
+
value: `${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords})`,
|
|
49988
|
+
color: b2.status === "completed" ? "green" : "red"
|
|
49936
49989
|
});
|
|
49937
49990
|
}
|
|
49938
49991
|
setResultNode(React6.createElement(EntityCard, { fields }));
|
|
@@ -50096,8 +50149,8 @@ configCommand.command("get [key]").description("Get configuration value").action
|
|
|
50096
50149
|
const allConfig = config2.store;
|
|
50097
50150
|
if (Object.keys(allConfig).length > 0) {
|
|
50098
50151
|
console.log(chalk10.cyan("Current Configuration:"));
|
|
50099
|
-
for (const [
|
|
50100
|
-
console.log(` ${chalk10.green(
|
|
50152
|
+
for (const [k2, v2] of Object.entries(allConfig)) {
|
|
50153
|
+
console.log(` ${chalk10.green(k2)}: ${v2}`);
|
|
50101
50154
|
}
|
|
50102
50155
|
} else {
|
|
50103
50156
|
console.log(chalk10.gray("No configuration set"));
|
|
@@ -51497,7 +51550,7 @@ Keys (${keys.length}):`));
|
|
|
51497
51550
|
const itemSummary = items.length === 0 ? "No items" : items.map(
|
|
51498
51551
|
(i) => `${i.exposedName || i.capabilityName || i.capabilityId}${i.isEntryPoint ? " (entry point)" : ""}`
|
|
51499
51552
|
).join("\n");
|
|
51500
|
-
const keySummary = keys.length === 0 ? "No keys" : keys.map((
|
|
51553
|
+
const keySummary = keys.length === 0 ? "No keys" : keys.map((k2) => `${k2.name ?? "(unnamed)"} ${k2.keyPrefix ?? ""}`.trim()).join("\n");
|
|
51501
51554
|
setResultNode(
|
|
51502
51555
|
React10.createElement(EntityCard, {
|
|
51503
51556
|
fields: [
|
|
@@ -51676,7 +51729,7 @@ logsCommand.command("stats").description("Aggregate log stats: totals, counts by
|
|
|
51676
51729
|
const formatCounts = (counts) => {
|
|
51677
51730
|
const entries = Object.entries(counts);
|
|
51678
51731
|
if (entries.length === 0) return "(none)";
|
|
51679
|
-
return entries.map(([
|
|
51732
|
+
return entries.map(([k2, v2]) => `${k2}=${v2}`).join(", ");
|
|
51680
51733
|
};
|
|
51681
51734
|
if (!isTTY(options) || options.json) {
|
|
51682
51735
|
try {
|
|
@@ -51702,9 +51755,9 @@ Histogram (${histogram.length} buckets):`));
|
|
|
51702
51755
|
if (histogram.length === 0) {
|
|
51703
51756
|
console.log(chalk15.gray(" No data"));
|
|
51704
51757
|
} else {
|
|
51705
|
-
for (const
|
|
51706
|
-
const errPart =
|
|
51707
|
-
console.log(` ${chalk15.dim(
|
|
51758
|
+
for (const b2 of histogram) {
|
|
51759
|
+
const errPart = b2.errors > 0 ? chalk15.red(` (${b2.errors} errors)`) : "";
|
|
51760
|
+
console.log(` ${chalk15.dim(b2.bucket)} ${b2.count}${errPart}`);
|
|
51708
51761
|
}
|
|
51709
51762
|
}
|
|
51710
51763
|
} catch (error51) {
|
|
@@ -51726,7 +51779,7 @@ Histogram (${histogram.length} buckets):`));
|
|
|
51726
51779
|
const stats = res.data;
|
|
51727
51780
|
const histogram = stats.histogram ?? [];
|
|
51728
51781
|
const histogramSummary = histogram.length === 0 ? "No data" : histogram.map(
|
|
51729
|
-
(
|
|
51782
|
+
(b2) => `${b2.bucket}: ${b2.count}${b2.errors > 0 ? ` (${b2.errors} err)` : ""}`
|
|
51730
51783
|
).join("\n");
|
|
51731
51784
|
setResultNode(
|
|
51732
51785
|
React11.createElement(EntityCard, {
|
|
@@ -55766,7 +55819,7 @@ function extractTrackedFiles(snapshots, liveTools, planPath) {
|
|
|
55766
55819
|
result.push({ path: planPath, type: "plan" });
|
|
55767
55820
|
}
|
|
55768
55821
|
const sorted = Array.from(fileMap.values()).sort(
|
|
55769
|
-
(a,
|
|
55822
|
+
(a, b2) => (b2.lastTouchedAt ?? 0) - (a.lastTouchedAt ?? 0)
|
|
55770
55823
|
);
|
|
55771
55824
|
result.push(...sorted);
|
|
55772
55825
|
return result;
|
|
@@ -56997,7 +57050,7 @@ function ModelPicker({ currentModel, onSelect, onCancel, models }) {
|
|
|
56997
57050
|
[contentWidth]
|
|
56998
57051
|
);
|
|
56999
57052
|
const sorted = useMemo7(
|
|
57000
|
-
() => [...availableModels].sort((a,
|
|
57053
|
+
() => [...availableModels].sort((a, b2) => a.group.localeCompare(b2.group)),
|
|
57001
57054
|
[availableModels]
|
|
57002
57055
|
);
|
|
57003
57056
|
const filtered = useMemo7(() => {
|
|
@@ -58356,11 +58409,11 @@ function compactRawStreamEventForCopy(event) {
|
|
|
58356
58409
|
data = JSON.parse(JSON.stringify(event.listData, stringCompactionReplacer));
|
|
58357
58410
|
} else {
|
|
58358
58411
|
data = {};
|
|
58359
|
-
for (const [
|
|
58360
|
-
if (STREAM_EVENT_HEAVY_KEYS.has(
|
|
58361
|
-
data[
|
|
58412
|
+
for (const [k2, v2] of Object.entries(event.data)) {
|
|
58413
|
+
if (STREAM_EVENT_HEAVY_KEYS.has(k2)) {
|
|
58414
|
+
data[k2] = compactHeavyField(v2);
|
|
58362
58415
|
} else {
|
|
58363
|
-
data[
|
|
58416
|
+
data[k2] = compactJsonLike(v2);
|
|
58364
58417
|
}
|
|
58365
58418
|
}
|
|
58366
58419
|
}
|
|
@@ -61376,7 +61429,7 @@ function getSanitizedEnv() {
|
|
|
61376
61429
|
return clean;
|
|
61377
61430
|
}
|
|
61378
61431
|
function redactSecrets(output, secrets) {
|
|
61379
|
-
const sorted = secrets.filter((s) => s.length >= 8).sort((a,
|
|
61432
|
+
const sorted = secrets.filter((s) => s.length >= 8).sort((a, b2) => b2.length - a.length);
|
|
61380
61433
|
let redacted = output;
|
|
61381
61434
|
for (const secret of sorted) {
|
|
61382
61435
|
redacted = redacted.replaceAll(secret, "[REDACTED]");
|
|
@@ -62309,7 +62362,7 @@ function buildTree(dirPath, maxDepth, depth = 0) {
|
|
|
62309
62362
|
return [`${" ".repeat(depth)}[error reading ${normalizeToolPath(dirPath)}: ${message}]`];
|
|
62310
62363
|
}
|
|
62311
62364
|
const lines = [];
|
|
62312
|
-
for (const entry of entries.sort((a,
|
|
62365
|
+
for (const entry of entries.sort((a, b2) => a.name.localeCompare(b2.name))) {
|
|
62313
62366
|
const entryPath = path10.join(dirPath, entry.name);
|
|
62314
62367
|
if (shouldIgnoreRepoEntry(entryPath)) continue;
|
|
62315
62368
|
lines.push(`${" ".repeat(depth)}- ${entry.name}${entry.isDirectory() ? "/" : ""}`);
|
|
@@ -62564,7 +62617,7 @@ function createDefaultLocalTools(context) {
|
|
|
62564
62617
|
});
|
|
62565
62618
|
}
|
|
62566
62619
|
});
|
|
62567
|
-
const matches = candidates.sort((a,
|
|
62620
|
+
const matches = candidates.sort((a, b2) => b2.score - a.score || a.text.localeCompare(b2.text)).map((candidate) => candidate.text).filter((text, index, array2) => array2.indexOf(text) === index).slice(0, maxResults);
|
|
62568
62621
|
return matches.length > 0 ? matches.join("\n") : `No matches found for "${query}" under ${normalizeToolPath(startPath.resolvedPath)}`;
|
|
62569
62622
|
}
|
|
62570
62623
|
},
|
|
@@ -62613,7 +62666,7 @@ function createDefaultLocalTools(context) {
|
|
|
62613
62666
|
});
|
|
62614
62667
|
}
|
|
62615
62668
|
});
|
|
62616
|
-
const rankedMatches = matches.sort((a,
|
|
62669
|
+
const rankedMatches = matches.sort((a, b2) => b2.score - a.score || a.path.localeCompare(b2.path)).map((match) => match.path).slice(0, maxResults);
|
|
62617
62670
|
return rankedMatches.length > 0 ? rankedMatches.join("\n") : `No files matched "${pattern}" under ${normalizeToolPath(startPath.resolvedPath)}`;
|
|
62618
62671
|
}
|
|
62619
62672
|
},
|
|
@@ -67135,14 +67188,14 @@ evalCommand.command("list").description("List eval batches").option("--flow <id>
|
|
|
67135
67188
|
total,
|
|
67136
67189
|
emptyMessage: "No eval batches found",
|
|
67137
67190
|
renderCard: (item) => {
|
|
67138
|
-
const
|
|
67139
|
-
const name =
|
|
67140
|
-
const progress =
|
|
67141
|
-
const statusColor =
|
|
67191
|
+
const b2 = item;
|
|
67192
|
+
const name = b2.name || b2.id;
|
|
67193
|
+
const progress = b2.totalRecords ? `${b2.completedRecords ?? 0}/${b2.totalRecords}` : "";
|
|
67194
|
+
const statusColor = b2.status === "completed" ? "green" : "yellow";
|
|
67142
67195
|
return React20.createElement(
|
|
67143
67196
|
Text34,
|
|
67144
67197
|
{ color: statusColor },
|
|
67145
|
-
` ${
|
|
67198
|
+
` ${b2.id} ${name} [${b2.status}] ${progress}`
|
|
67146
67199
|
);
|
|
67147
67200
|
}
|
|
67148
67201
|
});
|
|
@@ -67525,10 +67578,10 @@ apiKeysCommand.command("list").description("List your API keys").option("--json"
|
|
|
67525
67578
|
total,
|
|
67526
67579
|
emptyMessage: "No API keys found",
|
|
67527
67580
|
renderCard: (item) => {
|
|
67528
|
-
const
|
|
67529
|
-
const prefix =
|
|
67530
|
-
const lastUsed =
|
|
67531
|
-
return React21.createElement(Text35, null, ` ${
|
|
67581
|
+
const k2 = item;
|
|
67582
|
+
const prefix = k2.prefix ? ` (${k2.prefix}...)` : "";
|
|
67583
|
+
const lastUsed = k2.lastUsedAt ? ` last used: ${k2.lastUsedAt}` : "";
|
|
67584
|
+
return React21.createElement(Text35, null, ` ${k2.id} ${k2.name}${prefix}${lastUsed}`);
|
|
67532
67585
|
}
|
|
67533
67586
|
});
|
|
67534
67587
|
};
|
|
@@ -68309,13 +68362,16 @@ import { execFileSync } from "child_process";
|
|
|
68309
68362
|
// src/lib/persona-init.ts
|
|
68310
68363
|
init_credential_store();
|
|
68311
68364
|
|
|
68312
|
-
// ../../node_modules/.pnpm/@runtypelabs+persona@4.
|
|
68313
|
-
var w = "4.
|
|
68314
|
-
var
|
|
68365
|
+
// ../../node_modules/.pnpm/@runtypelabs+persona@4.12.0/node_modules/@runtypelabs/persona/dist/codegen.js
|
|
68366
|
+
var w = "4.12.0";
|
|
68367
|
+
var S = w;
|
|
68368
|
+
function b(e) {
|
|
68369
|
+
return e?.cdnBase?.trim().replace(/\/+$/, "").replace(/[\\'"<>`]/g, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`) || `https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`;
|
|
68370
|
+
}
|
|
68315
68371
|
function u(e) {
|
|
68316
68372
|
if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((i) => i.toString()).join(", ")}]` : e.toString();
|
|
68317
68373
|
}
|
|
68318
|
-
function
|
|
68374
|
+
function I(e) {
|
|
68319
68375
|
if (e) return { getHeaders: u(e.getHeaders), onFeedback: u(e.onFeedback), onCopy: u(e.onCopy), requestMiddleware: u(e.requestMiddleware), actionHandlers: u(e.actionHandlers), actionParsers: u(e.actionParsers), postprocessMessage: u(e.postprocessMessage), contextProviders: u(e.contextProviders), streamParser: u(e.streamParser) };
|
|
68320
68376
|
}
|
|
68321
68377
|
var x = `({ text, message }: any) => {
|
|
@@ -68332,7 +68388,7 @@ var x = `({ text, message }: any) => {
|
|
|
68332
68388
|
} catch (e) { return null; }
|
|
68333
68389
|
return null;
|
|
68334
68390
|
}`;
|
|
68335
|
-
var
|
|
68391
|
+
var A = `function(ctx) {
|
|
68336
68392
|
var jsonSource = ctx.message.rawContent || ctx.text || ctx.message.content;
|
|
68337
68393
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
68338
68394
|
var cleanJson = jsonSource
|
|
@@ -68346,7 +68402,7 @@ var S = `function(ctx) {
|
|
|
68346
68402
|
} catch (e) { return null; }
|
|
68347
68403
|
return null;
|
|
68348
68404
|
}`;
|
|
68349
|
-
var
|
|
68405
|
+
var j = `(action: any, context: any) => {
|
|
68350
68406
|
if (action.type !== 'nav_then_click') return;
|
|
68351
68407
|
const payload = action.payload || action.raw || {};
|
|
68352
68408
|
const url = payload?.page;
|
|
@@ -68364,7 +68420,7 @@ var A = `(action: any, context: any) => {
|
|
|
68364
68420
|
window.location.href = targetUrl;
|
|
68365
68421
|
return { handled: true, displayText: text };
|
|
68366
68422
|
}`;
|
|
68367
|
-
var
|
|
68423
|
+
var O = `function(action, context) {
|
|
68368
68424
|
if (action.type !== 'nav_then_click') return;
|
|
68369
68425
|
var payload = action.payload || action.raw || {};
|
|
68370
68426
|
var url = payload.page;
|
|
@@ -68389,126 +68445,126 @@ var v = `(parsed: any) => {
|
|
|
68389
68445
|
if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
|
|
68390
68446
|
return parsed.text || null;
|
|
68391
68447
|
}`;
|
|
68392
|
-
var
|
|
68448
|
+
var _ = `function(parsed) {
|
|
68393
68449
|
if (!parsed || typeof parsed !== 'object') return null;
|
|
68394
68450
|
if (parsed.action === 'nav_then_click') return 'Navigating...';
|
|
68395
68451
|
if (parsed.action === 'message') return parsed.text || '';
|
|
68396
68452
|
if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
|
|
68397
68453
|
return parsed.text || null;
|
|
68398
68454
|
}`;
|
|
68399
|
-
function
|
|
68455
|
+
function T(e) {
|
|
68400
68456
|
if (!e) return null;
|
|
68401
68457
|
let i = e.toString();
|
|
68402
68458
|
return i.includes("createJsonStreamParser") || i.includes("partial-json") ? "json" : i.includes("createRegexJsonParser") || i.includes("regex") ? "regex-json" : i.includes("createXmlParser") || i.includes("<text>") ? "xml" : null;
|
|
68403
68459
|
}
|
|
68404
|
-
function
|
|
68405
|
-
return e.parserType ??
|
|
68406
|
-
}
|
|
68407
|
-
function
|
|
68408
|
-
let
|
|
68409
|
-
return e.toolCall && (
|
|
68410
|
-
typeof a == "string" &&
|
|
68411
|
-
}),
|
|
68412
|
-
}
|
|
68413
|
-
function
|
|
68414
|
-
let s = [], a = e.messageActions && Object.entries(e.messageActions).some(([
|
|
68415
|
-
return (a || t) && (s.push(`${i}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([
|
|
68416
|
-
|
|
68417
|
-
}),
|
|
68418
|
-
}
|
|
68419
|
-
function
|
|
68420
|
-
let
|
|
68460
|
+
function h(e) {
|
|
68461
|
+
return e.parserType ?? T(e.streamParser) ?? "plain";
|
|
68462
|
+
}
|
|
68463
|
+
function g(e, i) {
|
|
68464
|
+
let r = [];
|
|
68465
|
+
return e.toolCall && (r.push(`${i}toolCall: {`), Object.entries(e.toolCall).forEach(([s, a]) => {
|
|
68466
|
+
typeof a == "string" && r.push(`${i} ${s}: "${a}",`);
|
|
68467
|
+
}), r.push(`${i}},`)), r;
|
|
68468
|
+
}
|
|
68469
|
+
function m(e, i, r) {
|
|
68470
|
+
let s = [], a = e.messageActions && Object.entries(e.messageActions).some(([n, o]) => n !== "onFeedback" && n !== "onCopy" && o !== void 0), t = r?.onFeedback || r?.onCopy;
|
|
68471
|
+
return (a || t) && (s.push(`${i}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([n, o]) => {
|
|
68472
|
+
n === "onFeedback" || n === "onCopy" || (typeof o == "string" ? s.push(`${i} ${n}: "${o}",`) : typeof o == "boolean" && s.push(`${i} ${n}: ${o},`));
|
|
68473
|
+
}), r?.onFeedback && s.push(`${i} onFeedback: ${r.onFeedback},`), r?.onCopy && s.push(`${i} onCopy: ${r.onCopy},`), s.push(`${i}},`)), s;
|
|
68474
|
+
}
|
|
68475
|
+
function f(e, i) {
|
|
68476
|
+
let r = [];
|
|
68421
68477
|
if (e.markdown) {
|
|
68422
68478
|
let s = e.markdown.options && Object.keys(e.markdown.options).length > 0, a = e.markdown.disableDefaultStyles !== void 0;
|
|
68423
|
-
(s || a) && (
|
|
68424
|
-
typeof
|
|
68425
|
-
}),
|
|
68479
|
+
(s || a) && (r.push(`${i}markdown: {`), s && (r.push(`${i} options: {`), Object.entries(e.markdown.options).forEach(([t, n]) => {
|
|
68480
|
+
typeof n == "string" ? r.push(`${i} ${t}: "${n}",`) : typeof n == "boolean" && r.push(`${i} ${t}: ${n},`);
|
|
68481
|
+
}), r.push(`${i} },`)), a && r.push(`${i} disableDefaultStyles: ${e.markdown.disableDefaultStyles},`), r.push(`${i}},`));
|
|
68426
68482
|
}
|
|
68427
|
-
return
|
|
68483
|
+
return r;
|
|
68428
68484
|
}
|
|
68429
|
-
function
|
|
68430
|
-
let
|
|
68485
|
+
function y(e, i) {
|
|
68486
|
+
let r = [];
|
|
68431
68487
|
if (e.layout) {
|
|
68432
68488
|
let s = e.layout.header && Object.keys(e.layout.header).some((t) => t !== "render"), a = e.layout.messages && Object.keys(e.layout.messages).some((t) => t !== "renderUserMessage" && t !== "renderAssistantMessage");
|
|
68433
|
-
(s || a) && (
|
|
68434
|
-
t !== "render" && (typeof
|
|
68435
|
-
}),
|
|
68436
|
-
t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof
|
|
68437
|
-
typeof p == "string" ?
|
|
68438
|
-
}),
|
|
68439
|
-
p !== "format" && (typeof l == "string" ?
|
|
68440
|
-
}),
|
|
68441
|
-
}),
|
|
68489
|
+
(s || a) && (r.push(`${i}layout: {`), s && (r.push(`${i} header: {`), Object.entries(e.layout.header).forEach(([t, n]) => {
|
|
68490
|
+
t !== "render" && (typeof n == "string" ? r.push(`${i} ${t}: "${n}",`) : typeof n == "boolean" && r.push(`${i} ${t}: ${n},`));
|
|
68491
|
+
}), r.push(`${i} },`)), a && (r.push(`${i} messages: {`), Object.entries(e.layout.messages).forEach(([t, n]) => {
|
|
68492
|
+
t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof n == "object" && n !== null ? (r.push(`${i} avatar: {`), Object.entries(n).forEach(([o, p]) => {
|
|
68493
|
+
typeof p == "string" ? r.push(`${i} ${o}: "${p}",`) : typeof p == "boolean" && r.push(`${i} ${o}: ${p},`);
|
|
68494
|
+
}), r.push(`${i} },`)) : t === "timestamp" && typeof n == "object" && n !== null ? Object.entries(n).some(([p]) => p !== "format") && (r.push(`${i} timestamp: {`), Object.entries(n).forEach(([p, l]) => {
|
|
68495
|
+
p !== "format" && (typeof l == "string" ? r.push(`${i} ${p}: "${l}",`) : typeof l == "boolean" && r.push(`${i} ${p}: ${l},`));
|
|
68496
|
+
}), r.push(`${i} },`)) : typeof n == "string" ? r.push(`${i} ${t}: "${n}",`) : typeof n == "boolean" && r.push(`${i} ${t}: ${n},`));
|
|
68497
|
+
}), r.push(`${i} },`)), r.push(`${i}},`));
|
|
68442
68498
|
}
|
|
68443
|
-
return
|
|
68499
|
+
return r;
|
|
68444
68500
|
}
|
|
68445
68501
|
function $(e, i) {
|
|
68446
|
-
let
|
|
68447
|
-
return e && (e.getHeaders &&
|
|
68502
|
+
let r = [];
|
|
68503
|
+
return e && (e.getHeaders && r.push(`${i}getHeaders: ${e.getHeaders},`), e.requestMiddleware && r.push(`${i}requestMiddleware: ${e.requestMiddleware},`), e.actionParsers && r.push(`${i}actionParsers: ${e.actionParsers},`), e.actionHandlers && r.push(`${i}actionHandlers: ${e.actionHandlers},`), e.contextProviders && r.push(`${i}contextProviders: ${e.contextProviders},`), e.streamParser && r.push(`${i}streamParser: ${e.streamParser},`)), r;
|
|
68448
68504
|
}
|
|
68449
|
-
function
|
|
68505
|
+
function E(e, i, r) {
|
|
68450
68506
|
Object.entries(i).forEach(([s, a]) => {
|
|
68451
68507
|
if (!(a === void 0 || typeof a == "function")) {
|
|
68452
68508
|
if (Array.isArray(a)) {
|
|
68453
|
-
e.push(`${
|
|
68509
|
+
e.push(`${r}${s}: ${JSON.stringify(a)},`);
|
|
68454
68510
|
return;
|
|
68455
68511
|
}
|
|
68456
68512
|
if (a && typeof a == "object") {
|
|
68457
|
-
e.push(`${
|
|
68513
|
+
e.push(`${r}${s}: {`), E(e, a, `${r} `), e.push(`${r}},`);
|
|
68458
68514
|
return;
|
|
68459
68515
|
}
|
|
68460
|
-
e.push(`${
|
|
68516
|
+
e.push(`${r}${s}: ${JSON.stringify(a)},`);
|
|
68461
68517
|
}
|
|
68462
68518
|
});
|
|
68463
68519
|
}
|
|
68464
|
-
function d(e, i,
|
|
68465
|
-
|
|
68520
|
+
function d(e, i, r, s) {
|
|
68521
|
+
r && (e.push(`${s}${i}: {`), E(e, r, `${s} `), e.push(`${s}},`));
|
|
68466
68522
|
}
|
|
68467
|
-
function
|
|
68523
|
+
function c(e) {
|
|
68468
68524
|
return (e?.target ?? "body").replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
68469
68525
|
}
|
|
68470
|
-
function
|
|
68526
|
+
function M(e, i = "esm", r) {
|
|
68471
68527
|
let s = { ...e };
|
|
68472
68528
|
delete s.postprocessMessage, delete s.initialMessages;
|
|
68473
|
-
let a =
|
|
68474
|
-
return i === "esm" ?
|
|
68475
|
-
}
|
|
68476
|
-
function M(e, i) {
|
|
68477
|
-
let n = i?.hooks, s = g(e), a = s !== "plain", t = ["import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "", "initAgentWidget({", ` target: '${h(i)}',`, " config: {"];
|
|
68478
|
-
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([r, o]) => {
|
|
68479
|
-
t.push(` ${r}: "${o}",`);
|
|
68480
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, o]) => {
|
|
68481
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68482
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, o]) => {
|
|
68483
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" ? t.push(` ${r}: ${o},`) : typeof o == "number" && t.push(` ${r}: ${o},`);
|
|
68484
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, o]) => {
|
|
68485
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68486
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, o]) => {
|
|
68487
|
-
t.push(` ${r}: ${o},`);
|
|
68488
|
-
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68489
|
-
t.push(` "${r}",`);
|
|
68490
|
-
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...m(e, " ")), t.push(...f(e, " ", n)), t.push(...y(e, " ")), t.push(...C(e, " ")), t.push(...$(n, " ")), e.debug && t.push(` debug: ${e.debug},`), n?.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push("});"), t.join(`
|
|
68491
|
-
`);
|
|
68529
|
+
let a = r ? { ...r, hooks: I(r.hooks) } : void 0;
|
|
68530
|
+
return i === "esm" ? R(s, a) : i === "script-installer" ? N(s, a) : i === "script-advanced" ? F(s, a) : i === "react-component" ? W(s, a) : i === "react-advanced" ? H(s, a) : D(s, a);
|
|
68492
68531
|
}
|
|
68493
68532
|
function R(e, i) {
|
|
68494
|
-
let
|
|
68495
|
-
return e.apiUrl && t.push(`
|
|
68496
|
-
t.push(`
|
|
68497
|
-
}), t.push("
|
|
68498
|
-
typeof o == "string" ? t.push(`
|
|
68499
|
-
}), t.push("
|
|
68500
|
-
typeof o == "string" ? t.push(`
|
|
68501
|
-
}), t.push("
|
|
68502
|
-
typeof o == "string" ? t.push(`
|
|
68503
|
-
}), t.push("
|
|
68504
|
-
t.push(`
|
|
68505
|
-
}), t.push("
|
|
68506
|
-
t.push(`
|
|
68507
|
-
}), t.push("
|
|
68533
|
+
let r = i?.hooks, s = h(e), a = s !== "plain", t = ["import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "", "initAgentWidget({", ` target: '${c(i)}',`, " config: {"];
|
|
68534
|
+
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([n, o]) => {
|
|
68535
|
+
t.push(` ${n}: "${o}",`);
|
|
68536
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([n, o]) => {
|
|
68537
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" && t.push(` ${n}: ${o},`);
|
|
68538
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([n, o]) => {
|
|
68539
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" ? t.push(` ${n}: ${o},`) : typeof o == "number" && t.push(` ${n}: ${o},`);
|
|
68540
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([n, o]) => {
|
|
68541
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" && t.push(` ${n}: ${o},`);
|
|
68542
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([n, o]) => {
|
|
68543
|
+
t.push(` ${n}: ${o},`);
|
|
68544
|
+
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((n) => {
|
|
68545
|
+
t.push(` "${n}",`);
|
|
68546
|
+
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...y(e, " ")), t.push(...$(r, " ")), e.debug && t.push(` debug: ${e.debug},`), r?.postprocessMessage ? t.push(` postprocessMessage: ${r.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push("});"), t.join(`
|
|
68508
68547
|
`);
|
|
68509
68548
|
}
|
|
68510
68549
|
function W(e, i) {
|
|
68511
|
-
let
|
|
68550
|
+
let r = i?.hooks, s = h(e), a = s !== "plain", t = ["// ChatWidget.tsx", "'use client'; // Required for Next.js - remove for Vite/CRA", "", "import { useEffect } from 'react';", "import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "import type { AgentWidgetInitHandle } from '@runtypelabs/persona';", "", "export function ChatWidget() {", " useEffect(() => {", " let handle: AgentWidgetInitHandle | null = null;", "", " handle = initAgentWidget({", ` target: '${c(i)}',`, " config: {"];
|
|
68551
|
+
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.agentId && t.push(` agentId: "${e.agentId}",`), e.target && t.push(` target: "${e.target}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), a && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(t, "theme", e.theme, " "), e.launcher && d(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([n, o]) => {
|
|
68552
|
+
t.push(` ${n}: "${o}",`);
|
|
68553
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([n, o]) => {
|
|
68554
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" && t.push(` ${n}: ${o},`);
|
|
68555
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([n, o]) => {
|
|
68556
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" ? t.push(` ${n}: ${o},`) : typeof o == "number" && t.push(` ${n}: ${o},`);
|
|
68557
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([n, o]) => {
|
|
68558
|
+
typeof o == "string" ? t.push(` ${n}: "${o}",`) : typeof o == "boolean" && t.push(` ${n}: ${o},`);
|
|
68559
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([n, o]) => {
|
|
68560
|
+
t.push(` ${n}: ${o},`);
|
|
68561
|
+
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((n) => {
|
|
68562
|
+
t.push(` "${n}",`);
|
|
68563
|
+
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...y(e, " ")), t.push(...$(r, " ")), e.debug && t.push(` debug: ${e.debug},`), r?.postprocessMessage ? t.push(` postprocessMessage: ${r.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push(""), t.push(" // Cleanup on unmount"), t.push(" return () => {"), t.push(" if (handle) {"), t.push(" handle.destroy();"), t.push(" }"), t.push(" };"), t.push(" }, []);"), t.push(""), t.push(" return null; // Widget injects itself into the DOM"), t.push("}"), t.push(""), t.push("// Usage in your app:"), t.push("// import { ChatWidget } from './components/ChatWidget';"), t.push("//"), t.push("// export default function App() {"), t.push("// return ("), t.push("// <div>"), t.push("// {/* Your app content */}"), t.push("// <ChatWidget />"), t.push("// </div>"), t.push("// );"), t.push("// }"), t.join(`
|
|
68564
|
+
`);
|
|
68565
|
+
}
|
|
68566
|
+
function H(e, i) {
|
|
68567
|
+
let r = i?.hooks, s = ["// ChatWidgetAdvanced.tsx", "'use client'; // Required for Next.js - remove for Vite/CRA", "", "import { useEffect } from 'react';", "import '@runtypelabs/persona/widget.css';", "import {", " initAgentWidget,", " createFlexibleJsonStreamParser,", " defaultJsonActionParser,", " defaultActionHandlers,", " markdownPostprocessor", "} from '@runtypelabs/persona';", "import type { AgentWidgetInitHandle } from '@runtypelabs/persona';", "", "const STORAGE_KEY = 'chat-widget-state';", "const PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", "// Types for DOM elements", "interface PageElement {", " type: string;", " tagName: string;", " selector: string;", " innerText: string;", " href?: string;", "}", "", "interface DOMContext {", " page_elements: PageElement[];", " page_element_count: number;", " element_types: Record<string, number>;", " page_url: string;", " page_title: string;", " timestamp: string;", "}", "", "// DOM context provider - extracts page elements for AI context", "const collectDOMContext = (): DOMContext => {", " const selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " const elements: PageElement[] = [];", " Object.entries(selectors).forEach(([type, selector]) => {", " document.querySelectorAll(selector).forEach((element) => {", " if (!(element instanceof HTMLElement)) return;", " ", " // Exclude elements within the widget", " const widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " ", " const text = element.innerText?.trim();", " if (!text) return;", "", " const selectorString =", " element.id ? `#${element.id}` :", " element.getAttribute('data-testid') ? `[data-testid=\"${element.getAttribute('data-testid')}\"]` :", " element.getAttribute('data-product-id') ? `[data-product-id=\"${element.getAttribute('data-product-id')}\"]` :", " element.tagName.toLowerCase();", "", " const elementData: PageElement = {", " type,", " tagName: element.tagName.toLowerCase(),", " selector: selectorString,", " innerText: text.substring(0, 200)", " };", "", " if (type === 'links' && element instanceof HTMLAnchorElement && element.href) {", " elementData.href = element.href;", " }", "", " elements.push(elementData);", " });", " });", "", " const counts = elements.reduce((acc, el) => {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {} as Record<string, number>);", "", " return {", " page_elements: elements.slice(0, 50),", " page_element_count: elements.length,", " element_types: counts,", " page_url: window.location.href,", " page_title: document.title,", " timestamp: new Date().toISOString()", " };", "};", "", "export function ChatWidgetAdvanced() {", " useEffect(() => {", " let handle: AgentWidgetInitHandle | null = null;", "", " // Load saved state", " const loadSavedMessages = () => {", " const savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " const { messages } = JSON.parse(savedState);", " return messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", " return [];", " };", "", " handle = initAgentWidget({", ` target: '${c(i)}',`, " config: {"];
|
|
68512
68568
|
return e.apiUrl && s.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && s.push(` clientToken: "${e.clientToken}",`), e.agentId && s.push(` agentId: "${e.agentId}",`), e.target && s.push(` target: "${e.target}",`), e.flowId && s.push(` flowId: "${e.flowId}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(s, "theme", e.theme, " "), e.launcher && d(s, "launcher", e.launcher, " "), e.copy && (s.push(" copy: {"), Object.entries(e.copy).forEach(([a, t]) => {
|
|
68513
68569
|
s.push(` ${a}: "${t}",`);
|
|
68514
68570
|
}), s.push(" },")), e.sendButton && (s.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([a, t]) => {
|
|
@@ -68521,21 +68577,21 @@ function W(e, i) {
|
|
|
68521
68577
|
s.push(` ${a}: ${t},`);
|
|
68522
68578
|
}), s.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((a) => {
|
|
68523
68579
|
s.push(` "${a}",`);
|
|
68524
|
-
}), s.push(" ],")), e.suggestionChipsConfig && (s.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && s.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && s.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), s.push(" },")), s.push(...
|
|
68580
|
+
}), s.push(" ],")), e.suggestionChipsConfig && (s.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && s.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && s.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), s.push(" },")), s.push(...g(e, " ")), s.push(...m(e, " ", r)), s.push(...f(e, " ")), s.push(...y(e, " ")), r?.getHeaders && s.push(` getHeaders: ${r.getHeaders},`), r?.contextProviders && s.push(` contextProviders: ${r.contextProviders},`), e.debug && s.push(` debug: ${e.debug},`), s.push(" initialMessages: loadSavedMessages(),"), r?.streamParser ? s.push(` streamParser: ${r.streamParser},`) : (s.push(" // Flexible JSON stream parser for handling structured actions"), s.push(` streamParser: () => createFlexibleJsonStreamParser(${v}),`)), r?.actionParsers ? (s.push(" // Action parsers (custom merged with defaults)"), s.push(` actionParsers: [...(${r.actionParsers}), defaultJsonActionParser,`), s.push(" // Built-in parser for markdown-wrapped JSON"), s.push(` ${x}`), s.push(" ],")) : (s.push(" // Action parsers to detect JSON actions in responses"), s.push(" actionParsers: ["), s.push(" defaultJsonActionParser,"), s.push(" // Parser for markdown-wrapped JSON"), s.push(` ${x}`), s.push(" ],")), r?.actionHandlers ? (s.push(" // Action handlers (custom merged with defaults)"), s.push(` actionHandlers: [...(${r.actionHandlers}),`), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Built-in handler for nav_then_click action"), s.push(` ${j}`), s.push(" ],")) : (s.push(" // Action handlers for navigation and other actions"), s.push(" actionHandlers: ["), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Handler for nav_then_click action"), s.push(` ${j}`), s.push(" ],")), r?.postprocessMessage ? s.push(` postprocessMessage: ${r.postprocessMessage},`) : s.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text),"), r?.requestMiddleware ? (s.push(" // Request middleware (custom merged with DOM context)"), s.push(" requestMiddleware: ({ payload, config }) => {"), s.push(` const customResult = (${r.requestMiddleware})({ payload, config });`), s.push(" const merged = customResult || payload;"), s.push(" return {"), s.push(" ...merged,"), s.push(" metadata: { ...merged.metadata, ...collectDOMContext() }"), s.push(" };"), s.push(" }")) : (s.push(" requestMiddleware: ({ payload }) => {"), s.push(" return {"), s.push(" ...payload,"), s.push(" metadata: collectDOMContext()"), s.push(" };"), s.push(" }")), s.push(" }"), s.push(" });"), s.push(""), s.push(" // Save state on message events"), s.push(" const handleMessage = () => {"), s.push(" const session = handle?.getSession?.();"), s.push(" if (session) {"), s.push(" localStorage.setItem(STORAGE_KEY, JSON.stringify({"), s.push(" messages: session.messages,"), s.push(" timestamp: new Date().toISOString()"), s.push(" }));"), s.push(" }"), s.push(" };"), s.push(""), s.push(" // Clear state on clear chat"), s.push(" const handleClearChat = () => {"), s.push(" localStorage.removeItem(STORAGE_KEY);"), s.push(" localStorage.removeItem(PROCESSED_ACTIONS_KEY);"), s.push(" };"), s.push(""), s.push(" window.addEventListener('persona:message', handleMessage);"), s.push(" window.addEventListener('persona:clear-chat', handleClearChat);"), s.push(""), s.push(" // Cleanup on unmount"), s.push(" return () => {"), s.push(" window.removeEventListener('persona:message', handleMessage);"), s.push(" window.removeEventListener('persona:clear-chat', handleClearChat);"), s.push(" if (handle) {"), s.push(" handle.destroy();"), s.push(" }"), s.push(" };"), s.push(" }, []);"), s.push(""), s.push(" return null; // Widget injects itself into the DOM"), s.push("}"), s.push(""), s.push("// Usage: Collects DOM context for AI-powered navigation"), s.push("// Features:"), s.push("// - Extracts page elements (products, buttons, links)"), s.push("// - Persists chat history across page loads"), s.push("// - Handles navigation actions (nav_then_click)"), s.push("// - Processes structured JSON actions from AI"), s.push("//"), s.push("// Example usage in Next.js:"), s.push("// import { ChatWidgetAdvanced } from './components/ChatWidgetAdvanced';"), s.push("//"), s.push("// export default function RootLayout({ children }) {"), s.push("// return ("), s.push('// <html lang="en">'), s.push("// <body>"), s.push("// {children}"), s.push("// <ChatWidgetAdvanced />"), s.push("// </body>"), s.push("// </html>"), s.push("// );"), s.push("// }"), s.join(`
|
|
68525
68581
|
`);
|
|
68526
68582
|
}
|
|
68527
|
-
function
|
|
68528
|
-
let i =
|
|
68529
|
-
if (e.apiUrl && (s.apiUrl = e.apiUrl), e.clientToken && (s.clientToken = e.clientToken), e.agentId && (s.agentId = e.agentId), e.target && (s.target = e.target), e.flowId && (s.flowId = e.flowId),
|
|
68583
|
+
function k(e) {
|
|
68584
|
+
let i = h(e), r = i !== "plain", s = {};
|
|
68585
|
+
if (e.apiUrl && (s.apiUrl = e.apiUrl), e.clientToken && (s.clientToken = e.clientToken), e.agentId && (s.agentId = e.agentId), e.target && (s.target = e.target), e.flowId && (s.flowId = e.flowId), r && (s.parserType = i), e.theme && (s.theme = e.theme), e.launcher && (s.launcher = e.launcher), e.copy && (s.copy = e.copy), e.sendButton && (s.sendButton = e.sendButton), e.voiceRecognition && (s.voiceRecognition = e.voiceRecognition), e.statusIndicator && (s.statusIndicator = e.statusIndicator), e.features && (s.features = e.features), e.suggestionChips?.length > 0 && (s.suggestionChips = e.suggestionChips), e.suggestionChipsConfig && (s.suggestionChipsConfig = e.suggestionChipsConfig), e.debug && (s.debug = e.debug), e.toolCall) {
|
|
68530
68586
|
let a = {};
|
|
68531
|
-
Object.entries(e.toolCall).forEach(([t,
|
|
68532
|
-
typeof
|
|
68587
|
+
Object.entries(e.toolCall).forEach(([t, n]) => {
|
|
68588
|
+
typeof n == "string" && (a[t] = n);
|
|
68533
68589
|
}), Object.keys(a).length > 0 && (s.toolCall = a);
|
|
68534
68590
|
}
|
|
68535
68591
|
if (e.messageActions) {
|
|
68536
68592
|
let a = {};
|
|
68537
|
-
Object.entries(e.messageActions).forEach(([t,
|
|
68538
|
-
t !== "onFeedback" && t !== "onCopy" &&
|
|
68593
|
+
Object.entries(e.messageActions).forEach(([t, n]) => {
|
|
68594
|
+
t !== "onFeedback" && t !== "onCopy" && n !== void 0 && (typeof n == "string" || typeof n == "boolean") && (a[t] = n);
|
|
68539
68595
|
}), Object.keys(a).length > 0 && (s.messageActions = a);
|
|
68540
68596
|
}
|
|
68541
68597
|
if (e.markdown) {
|
|
@@ -68546,52 +68602,52 @@ function E(e) {
|
|
|
68546
68602
|
let a = {};
|
|
68547
68603
|
if (e.layout.header) {
|
|
68548
68604
|
let t = {};
|
|
68549
|
-
Object.entries(e.layout.header).forEach(([
|
|
68550
|
-
|
|
68605
|
+
Object.entries(e.layout.header).forEach(([n, o]) => {
|
|
68606
|
+
n !== "render" && (typeof o == "string" || typeof o == "boolean") && (t[n] = o);
|
|
68551
68607
|
}), Object.keys(t).length > 0 && (a.header = t);
|
|
68552
68608
|
}
|
|
68553
68609
|
if (e.layout.messages) {
|
|
68554
68610
|
let t = {};
|
|
68555
|
-
Object.entries(e.layout.messages).forEach(([
|
|
68556
|
-
if (
|
|
68557
|
-
else if (
|
|
68611
|
+
Object.entries(e.layout.messages).forEach(([n, o]) => {
|
|
68612
|
+
if (n !== "renderUserMessage" && n !== "renderAssistantMessage") if (n === "avatar" && typeof o == "object" && o !== null) t.avatar = o;
|
|
68613
|
+
else if (n === "timestamp" && typeof o == "object" && o !== null) {
|
|
68558
68614
|
let p = {};
|
|
68559
|
-
Object.entries(o).forEach(([l,
|
|
68560
|
-
l !== "format" && (typeof
|
|
68615
|
+
Object.entries(o).forEach(([l, C]) => {
|
|
68616
|
+
l !== "format" && (typeof C == "string" || typeof C == "boolean") && (p[l] = C);
|
|
68561
68617
|
}), Object.keys(p).length > 0 && (t.timestamp = p);
|
|
68562
|
-
} else (typeof o == "string" || typeof o == "boolean") && (t[
|
|
68618
|
+
} else (typeof o == "string" || typeof o == "boolean") && (t[n] = o);
|
|
68563
68619
|
}), Object.keys(t).length > 0 && (a.messages = t);
|
|
68564
68620
|
}
|
|
68565
68621
|
Object.keys(a).length > 0 && (s.layout = a);
|
|
68566
68622
|
}
|
|
68567
68623
|
return s;
|
|
68568
68624
|
}
|
|
68569
|
-
function H(e, i) {
|
|
68570
|
-
let n = E(e), a = !!(i?.windowKey || i?.target) ? { config: n, ...i?.windowKey ? { windowKey: i.windowKey } : {}, ...i?.target ? { target: i.target } : {} } : n, t = JSON.stringify(a, null, 0).replace(/'/g, "'");
|
|
68571
|
-
return `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/install.global.js" data-config='${t}'></script>`;
|
|
68572
|
-
}
|
|
68573
68625
|
function N(e, i) {
|
|
68574
|
-
let
|
|
68575
|
-
return
|
|
68576
|
-
t.push(` ${r}: "${o}",`);
|
|
68577
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, o]) => {
|
|
68578
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68579
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, o]) => {
|
|
68580
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" ? t.push(` ${r}: ${o},`) : typeof o == "number" && t.push(` ${r}: ${o},`);
|
|
68581
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, o]) => {
|
|
68582
|
-
typeof o == "string" ? t.push(` ${r}: "${o}",`) : typeof o == "boolean" && t.push(` ${r}: ${o},`);
|
|
68583
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, o]) => {
|
|
68584
|
-
t.push(` ${r}: ${o},`);
|
|
68585
|
-
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68586
|
-
t.push(` "${r}",`);
|
|
68587
|
-
}), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...m(e, " ")), t.push(...f(e, " ", n)), t.push(...y(e, " ")), t.push(...C(e, " ")), t.push(...$(n, " ")), e.debug && t.push(` debug: ${e.debug},`), n?.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push("</script>"), t.join(`
|
|
68588
|
-
`);
|
|
68626
|
+
let r = k(e), a = !!(i?.windowKey || i?.target) ? { config: r, ...i?.windowKey ? { windowKey: i.windowKey } : {}, ...i?.target ? { target: i.target } : {} } : r, t = JSON.stringify(a, null, 0).replace(/'/g, "'");
|
|
68627
|
+
return `<script src="${b(i)}/install.global.js" data-config='${t}'></script>`;
|
|
68589
68628
|
}
|
|
68590
68629
|
function D(e, i) {
|
|
68591
|
-
let
|
|
68592
|
-
`).
|
|
68593
|
-
|
|
68594
|
-
|
|
68630
|
+
let r = i?.hooks, s = h(e), a = s !== "plain", t = b(i), n = ["<!-- Load CSS -->", `<link rel="stylesheet" href="${t}/widget.css" />`, "", "<!-- Load JavaScript -->", `<script src="${t}/index.global.js"></script>`, "", "<!-- Initialize widget -->", "<script>", " var handle = window.AgentWidget.initAgentWidget({", ` target: '${c(i)}',`, ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: {"];
|
|
68631
|
+
return e.apiUrl && n.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && n.push(` clientToken: "${e.clientToken}",`), e.agentId && n.push(` agentId: "${e.agentId}",`), e.target && n.push(` target: "${e.target}",`), e.flowId && n.push(` flowId: "${e.flowId}",`), a && n.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(n, "theme", e.theme, " "), e.launcher && d(n, "launcher", e.launcher, " "), e.copy && (n.push(" copy: {"), Object.entries(e.copy).forEach(([o, p]) => {
|
|
68632
|
+
n.push(` ${o}: "${p}",`);
|
|
68633
|
+
}), n.push(" },")), e.sendButton && (n.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([o, p]) => {
|
|
68634
|
+
typeof p == "string" ? n.push(` ${o}: "${p}",`) : typeof p == "boolean" && n.push(` ${o}: ${p},`);
|
|
68635
|
+
}), n.push(" },")), e.voiceRecognition && (n.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([o, p]) => {
|
|
68636
|
+
typeof p == "string" ? n.push(` ${o}: "${p}",`) : typeof p == "boolean" ? n.push(` ${o}: ${p},`) : typeof p == "number" && n.push(` ${o}: ${p},`);
|
|
68637
|
+
}), n.push(" },")), e.statusIndicator && (n.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([o, p]) => {
|
|
68638
|
+
typeof p == "string" ? n.push(` ${o}: "${p}",`) : typeof p == "boolean" && n.push(` ${o}: ${p},`);
|
|
68639
|
+
}), n.push(" },")), e.features && (n.push(" features: {"), Object.entries(e.features).forEach(([o, p]) => {
|
|
68640
|
+
n.push(` ${o}: ${p},`);
|
|
68641
|
+
}), n.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (n.push(" suggestionChips: ["), e.suggestionChips.forEach((o) => {
|
|
68642
|
+
n.push(` "${o}",`);
|
|
68643
|
+
}), n.push(" ],")), e.suggestionChipsConfig && (n.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && n.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && n.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && n.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && n.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), n.push(" },")), n.push(...g(e, " ")), n.push(...m(e, " ", r)), n.push(...f(e, " ")), n.push(...y(e, " ")), n.push(...$(r, " ")), e.debug && n.push(` debug: ${e.debug},`), r?.postprocessMessage ? n.push(` postprocessMessage: ${r.postprocessMessage}`) : n.push(" postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)"), n.push(" }"), n.push(" });"), n.push("</script>"), n.join(`
|
|
68644
|
+
`);
|
|
68645
|
+
}
|
|
68646
|
+
function F(e, i) {
|
|
68647
|
+
let r = i?.hooks, s = k(e), t = ["<script>", "(function() {", " 'use strict';", "", " // Configuration", ` var CONFIG = ${JSON.stringify(s, null, 2).split(`
|
|
68648
|
+
`).map((n, o) => o === 0 ? n : " " + n).join(`
|
|
68649
|
+
`)};`, "", " // Constants", ` var CDN_BASE = '${b(i)}';`, " var STORAGE_KEY = 'chat-widget-state';", " var PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", " // DOM context provider - extracts page elements for AI context", " var domContextProvider = function() {", " var selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " var elements = [];", " Object.entries(selectors).forEach(function(entry) {", " var type = entry[0], selector = entry[1];", " document.querySelectorAll(selector).forEach(function(element) {", " if (!(element instanceof HTMLElement)) return;", " var widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " var text = element.innerText ? element.innerText.trim() : '';", " if (!text) return;", "", " var selectorString = element.id ? '#' + element.id :", ` element.getAttribute('data-testid') ? '[data-testid="' + element.getAttribute('data-testid') + '"]' :`, ` element.getAttribute('data-product-id') ? '[data-product-id="' + element.getAttribute('data-product-id') + '"]' :`, " element.tagName.toLowerCase();", "", " var elementData = {", " type: type,", " tagName: element.tagName.toLowerCase(),", " selector: selectorString,", " innerText: text.substring(0, 200)", " };", "", " if (type === 'links' && element instanceof HTMLAnchorElement && element.href) {", " elementData.href = element.href;", " }", " elements.push(elementData);", " });", " });", "", " var counts = elements.reduce(function(acc, el) {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {});", "", " return {", " page_elements: elements.slice(0, 50),", " page_element_count: elements.length,", " element_types: counts,", " page_url: window.location.href,", " page_title: document.title,", " timestamp: new Date().toISOString()", " };", " };", "", " // Load CSS dynamically", " var loadCSS = function() {", " if (document.querySelector('link[data-persona]')) return;", " var link = document.createElement('link');", " link.rel = 'stylesheet';", " link.href = CDN_BASE + '/widget.css';", " link.setAttribute('data-persona', 'true');", " document.head.appendChild(link);", " };", "", " // Load JS dynamically", " var loadJS = function(callback) {", " if (window.AgentWidget) { callback(); return; }", " var script = document.createElement('script');", " script.src = CDN_BASE + '/index.global.js';", " script.onload = callback;", " script.onerror = function() { console.error('Failed to load AgentWidget'); };", " document.head.appendChild(script);", " };", "", " // Create widget config with advanced features", " var createWidgetConfig = function(agentWidget) {", " var widgetConfig = Object.assign({}, CONFIG);", ""];
|
|
68650
|
+
return r?.getHeaders && (t.push(` widgetConfig.getHeaders = ${r.getHeaders};`), t.push("")), r?.contextProviders && (t.push(` widgetConfig.contextProviders = ${r.contextProviders};`), t.push("")), r?.streamParser ? t.push(` widgetConfig.streamParser = ${r.streamParser};`) : (t.push(" // Flexible JSON stream parser for handling structured actions"), t.push(" widgetConfig.streamParser = function() {"), t.push(` return agentWidget.createFlexibleJsonStreamParser(${_});`), t.push(" };")), t.push(""), r?.actionParsers ? (t.push(" // Action parsers (custom merged with defaults)"), t.push(` var customParsers = ${r.actionParsers};`), t.push(" widgetConfig.actionParsers = customParsers.concat(["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${A}`), t.push(" ]);")) : (t.push(" // Action parsers to detect JSON actions in responses"), t.push(" widgetConfig.actionParsers = ["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${A}`), t.push(" ];")), t.push(""), r?.actionHandlers ? (t.push(" // Action handlers (custom merged with defaults)"), t.push(` var customHandlers = ${r.actionHandlers};`), t.push(" widgetConfig.actionHandlers = customHandlers.concat(["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${O}`), t.push(" ]);")) : (t.push(" // Action handlers for navigation and other actions"), t.push(" widgetConfig.actionHandlers = ["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${O}`), t.push(" ];")), t.push(""), r?.requestMiddleware ? (t.push(" // Request middleware (custom merged with DOM context)"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(` var customResult = (${r.requestMiddleware})(ctx);`), t.push(" var merged = customResult || ctx.payload;"), t.push(" return Object.assign({}, merged, { metadata: Object.assign({}, merged.metadata, domContextProvider()) });"), t.push(" };")) : (t.push(" // Send DOM context with each request"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(" return Object.assign({}, ctx.payload, { metadata: domContextProvider() });"), t.push(" };")), t.push(""), r?.postprocessMessage ? t.push(` widgetConfig.postprocessMessage = ${r.postprocessMessage};`) : (t.push(" // Markdown postprocessor"), t.push(" widgetConfig.postprocessMessage = function(ctx) {"), t.push(" return agentWidget.markdownPostprocessor(ctx.text);"), t.push(" };")), t.push(""), (r?.onFeedback || r?.onCopy) && (t.push(" // Message action callbacks"), t.push(" widgetConfig.messageActions = widgetConfig.messageActions || {};"), r?.onFeedback && t.push(` widgetConfig.messageActions.onFeedback = ${r.onFeedback};`), r?.onCopy && t.push(` widgetConfig.messageActions.onCopy = ${r.onCopy};`), t.push("")), t.push(" return widgetConfig;", " };", "", " // Initialize widget", " var init = function() {", " var agentWidget = window.AgentWidget;", " if (!agentWidget) {", " console.error('AgentWidget not loaded');", " return;", " }", "", " var widgetConfig = createWidgetConfig(agentWidget);", "", " // Load saved state", " var savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " var parsed = JSON.parse(savedState);", " widgetConfig.initialMessages = parsed.messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", "", " // Initialize widget", " var handle = agentWidget.initAgentWidget({", ` target: '${c(i)}',`, " useShadowDom: false,", ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: widgetConfig", " });", "", " // Save state on message events", " window.addEventListener('persona:message', function() {", " var session = handle.getSession ? handle.getSession() : null;", " if (session) {", " localStorage.setItem(STORAGE_KEY, JSON.stringify({", " messages: session.messages,", " timestamp: new Date().toISOString()", " }));", " }", " });", "", " // Clear state on clear chat", " window.addEventListener('persona:clear-chat', function() {", " localStorage.removeItem(STORAGE_KEY);", " localStorage.removeItem(PROCESSED_ACTIONS_KEY);", " });", " };", "", " // Wait for framework hydration to complete (Next.js, Nuxt, etc.)", " // This prevents the framework from removing dynamically added CSS during reconciliation", " var waitForHydration = function(callback) {", " var executed = false;", " ", " var execute = function() {", " if (executed) return;", " executed = true;", " callback();", " };", "", " var afterDom = function() {", " // Strategy 1: Use requestIdleCallback if available (best for detecting idle after hydration)", " if (typeof requestIdleCallback !== 'undefined') {", " requestIdleCallback(function() {", " // Double requestAnimationFrame ensures at least one full paint cycle completed", " requestAnimationFrame(function() {", " requestAnimationFrame(execute);", " });", " }, { timeout: 3000 }); // Max wait 3 seconds, then proceed anyway", " } else {", " // Strategy 2: Fallback for Safari (no requestIdleCallback)", " // 300ms is typically enough for hydration on most pages", " setTimeout(execute, 300);", " }", " };", "", " if (document.readyState === 'loading') {", " document.addEventListener('DOMContentLoaded', afterDom);", " } else {", " // DOM already ready, but still wait for potential hydration", " afterDom();", " }", " };", "", " // Boot sequence: wait for hydration, then load CSS and JS, then initialize", " // This prevents Next.js/Nuxt/etc. from removing dynamically added CSS during reconciliation", " waitForHydration(function() {", " loadCSS();", " loadJS(function() {", " init();", " });", " });", "})();", "</script>"), t.join(`
|
|
68595
68651
|
`);
|
|
68596
68652
|
}
|
|
68597
68653
|
|
|
@@ -68631,14 +68687,14 @@ function buildWidgetConfig(input) {
|
|
|
68631
68687
|
function generatePersonaInitSnippet(input, personaFormat) {
|
|
68632
68688
|
const widgetConfig = buildWidgetConfig(input);
|
|
68633
68689
|
const target = input.targetSelector?.trim();
|
|
68634
|
-
return
|
|
68690
|
+
return M(
|
|
68635
68691
|
widgetConfig,
|
|
68636
68692
|
personaFormat,
|
|
68637
68693
|
target ? { target } : void 0
|
|
68638
68694
|
);
|
|
68639
68695
|
}
|
|
68640
68696
|
function getPersonaInstallerScriptUrl() {
|
|
68641
|
-
const snippet =
|
|
68697
|
+
const snippet = M(
|
|
68642
68698
|
{
|
|
68643
68699
|
apiUrl: "https://api.runtype.com",
|
|
68644
68700
|
clientToken: "ct_test_demo_00000000000000000000000000000000",
|
|
@@ -71030,7 +71086,7 @@ function categoryBadge(category, useColor) {
|
|
|
71030
71086
|
return chalk36.magenta(`[${category}]`);
|
|
71031
71087
|
}
|
|
71032
71088
|
function formatTailData(data) {
|
|
71033
|
-
return Object.entries(data).map(([
|
|
71089
|
+
return Object.entries(data).map(([k2, v2]) => `${k2}=${typeof v2 === "string" ? v2 : JSON.stringify(v2)}`).join(" ");
|
|
71034
71090
|
}
|
|
71035
71091
|
function formatContextIds(event, useColor) {
|
|
71036
71092
|
const ids = [];
|
|
@@ -71118,9 +71174,9 @@ async function createSession(apiUrl, apiKey, filters) {
|
|
|
71118
71174
|
level: "levels",
|
|
71119
71175
|
category: "categories"
|
|
71120
71176
|
};
|
|
71121
|
-
for (const [
|
|
71122
|
-
if (v2 !== void 0 && arrayFields[
|
|
71123
|
-
filter[arrayFields[
|
|
71177
|
+
for (const [k2, v2] of Object.entries(filters)) {
|
|
71178
|
+
if (v2 !== void 0 && arrayFields[k2]) {
|
|
71179
|
+
filter[arrayFields[k2]] = [v2];
|
|
71124
71180
|
}
|
|
71125
71181
|
}
|
|
71126
71182
|
const body = Object.keys(filter).length > 0 ? { filter } : {};
|
|
@@ -71175,7 +71231,7 @@ async function runTail(options) {
|
|
|
71175
71231
|
category: options.category
|
|
71176
71232
|
};
|
|
71177
71233
|
const useColor = options.color;
|
|
71178
|
-
const activeFilters = Object.entries(filters).filter(([, v2]) => v2 !== void 0).map(([
|
|
71234
|
+
const activeFilters = Object.entries(filters).filter(([, v2]) => v2 !== void 0).map(([k2, v2]) => `${k2}=${v2}`);
|
|
71179
71235
|
process.stderr.write(
|
|
71180
71236
|
(useColor ? chalk36.gray(
|
|
71181
71237
|
`Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`
|
|
@@ -74255,10 +74311,10 @@ function parseVersion(version2) {
|
|
|
74255
74311
|
}
|
|
74256
74312
|
function compareVersions(left, right) {
|
|
74257
74313
|
const a = parseVersion(left);
|
|
74258
|
-
const
|
|
74259
|
-
if (!a || !
|
|
74314
|
+
const b2 = parseVersion(right);
|
|
74315
|
+
if (!a || !b2) return 0;
|
|
74260
74316
|
for (let index = 0; index < 3; index++) {
|
|
74261
|
-
const diff = a[index] -
|
|
74317
|
+
const diff = a[index] - b2[index];
|
|
74262
74318
|
if (diff !== 0) return diff;
|
|
74263
74319
|
}
|
|
74264
74320
|
return 0;
|
|
@@ -74940,8 +74996,7 @@ import { Command as Command37, InvalidArgumentError } from "commander";
|
|
|
74940
74996
|
import chalk46 from "chalk";
|
|
74941
74997
|
|
|
74942
74998
|
// src/lib/mcp-client.ts
|
|
74943
|
-
import { Client } from "@modelcontextprotocol/
|
|
74944
|
-
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
74999
|
+
import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
|
|
74945
75000
|
var CONNECT_TIMEOUT_MS = 1e4;
|
|
74946
75001
|
function parseHttpUrl(raw, label) {
|
|
74947
75002
|
let url2;
|
|
@@ -75299,9 +75354,12 @@ function createMcpCommand(overrides = {}) {
|
|
|
75299
75354
|
dependencies,
|
|
75300
75355
|
async (client) => {
|
|
75301
75356
|
const args = await dependencies.resolveArguments(options);
|
|
75302
|
-
const result = await client.callTool(
|
|
75303
|
-
|
|
75304
|
-
|
|
75357
|
+
const result = await client.callTool(
|
|
75358
|
+
{ name, arguments: args },
|
|
75359
|
+
{
|
|
75360
|
+
timeout: options.timeout
|
|
75361
|
+
}
|
|
75362
|
+
);
|
|
75305
75363
|
if (!("content" in result) || !Array.isArray(result.content)) {
|
|
75306
75364
|
throw new Error("Task-augmented MCP tool results are not supported by this command");
|
|
75307
75365
|
}
|