@runtypelabs/cli 2.31.0 → 2.31.3
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 +600 -358
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -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 k = keys[i];
|
|
1242
|
+
if (!(k in inst)) {
|
|
1243
|
+
inst[k] = proto[k].bind(inst);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
@@ -1370,8 +1370,8 @@ function assertNever(_x) {
|
|
|
1370
1370
|
function assert(_2) {
|
|
1371
1371
|
}
|
|
1372
1372
|
function getEnumValues(entries) {
|
|
1373
|
-
const numericValues = Object.values(entries).filter((
|
|
1374
|
-
const values = Object.entries(entries).filter(([
|
|
1373
|
+
const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
|
|
1374
|
+
const values = Object.entries(entries).filter(([k, _2]) => numericValues.indexOf(+k) === -1).map(([_2, v2]) => v2);
|
|
1375
1375
|
return values;
|
|
1376
1376
|
}
|
|
1377
1377
|
function joinValues(array2, separator = "|") {
|
|
@@ -1425,9 +1425,9 @@ function defineLazy(object2, key, getter) {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
return value;
|
|
1427
1427
|
},
|
|
1428
|
-
set(
|
|
1428
|
+
set(v2) {
|
|
1429
1429
|
Object.defineProperty(object2, key, {
|
|
1430
|
-
value:
|
|
1430
|
+
value: v2
|
|
1431
1431
|
// configurable: true,
|
|
1432
1432
|
});
|
|
1433
1433
|
},
|
|
@@ -1499,8 +1499,8 @@ var allowsEval = /* @__PURE__ */ cached(() => {
|
|
|
1499
1499
|
return false;
|
|
1500
1500
|
}
|
|
1501
1501
|
try {
|
|
1502
|
-
const
|
|
1503
|
-
new
|
|
1502
|
+
const F = Function;
|
|
1503
|
+
new F("");
|
|
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((k) => {
|
|
1665
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
1666
1666
|
});
|
|
1667
1667
|
}
|
|
1668
1668
|
var NUMBER_FORMAT_RANGES = {
|
|
@@ -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(([k, _2]) => {
|
|
1943
|
+
return Number.isNaN(Number.parseInt(k, 10));
|
|
1944
1944
|
}).map((el) => el[1]);
|
|
1945
1945
|
}
|
|
1946
1946
|
function base64ToUint8Array(base643) {
|
|
@@ -2947,11 +2947,11 @@ var Doc = class {
|
|
|
2947
2947
|
}
|
|
2948
2948
|
}
|
|
2949
2949
|
compile() {
|
|
2950
|
-
const
|
|
2950
|
+
const F = 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 F(...args, lines.join("\n"));
|
|
2955
2955
|
}
|
|
2956
2956
|
};
|
|
2957
2957
|
|
|
@@ -3114,10 +3114,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
3114
3114
|
v7: 7,
|
|
3115
3115
|
v8: 8
|
|
3116
3116
|
};
|
|
3117
|
-
const
|
|
3118
|
-
if (
|
|
3117
|
+
const v2 = versionMap[def.version];
|
|
3118
|
+
if (v2 === void 0)
|
|
3119
3119
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
3120
|
-
def.pattern ?? (def.pattern = uuid(
|
|
3120
|
+
def.pattern ?? (def.pattern = uuid(v2));
|
|
3121
3121
|
} else
|
|
3122
3122
|
def.pattern ?? (def.pattern = uuid());
|
|
3123
3123
|
$ZodStringFormat.init(inst, def);
|
|
@@ -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 k of keys) {
|
|
3652
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
3653
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
3654
3654
|
}
|
|
3655
3655
|
}
|
|
3656
3656
|
const okeys = optionalKeys(def.shape);
|
|
@@ -3722,8 +3722,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3722
3722
|
const field = shape[key]._zod;
|
|
3723
3723
|
if (field.values) {
|
|
3724
3724
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3725
|
-
for (const
|
|
3726
|
-
propValues[key].add(
|
|
3725
|
+
for (const v2 of field.values)
|
|
3726
|
+
propValues[key].add(v2);
|
|
3727
3727
|
}
|
|
3728
3728
|
}
|
|
3729
3729
|
return propValues;
|
|
@@ -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 k = esc(key);
|
|
3775
|
+
return `shape[${k}]._zod.run({ value: input[${k}], 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 k = 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 (${k} in input) {
|
|
3795
3795
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3796
3796
|
...iss,
|
|
3797
|
-
path: iss.path ? [${
|
|
3797
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3798
3798
|
})));
|
|
3799
3799
|
}
|
|
3800
3800
|
}
|
|
3801
3801
|
|
|
3802
3802
|
if (${id}.value === undefined) {
|
|
3803
|
-
if (${
|
|
3804
|
-
newResult[${
|
|
3803
|
+
if (${k} in input) {
|
|
3804
|
+
newResult[${k}] = undefined;
|
|
3805
3805
|
}
|
|
3806
3806
|
} else {
|
|
3807
|
-
newResult[${
|
|
3807
|
+
newResult[${k}] = ${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 = ${k} 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 ? [${k}, ...iss.path] : [${k}]
|
|
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: [${k}]
|
|
3826
3826
|
});
|
|
3827
3827
|
}
|
|
3828
3828
|
|
|
3829
3829
|
if (${id}_present) {
|
|
3830
3830
|
if (${id}.value === undefined) {
|
|
3831
|
-
newResult[${
|
|
3831
|
+
newResult[${k}] = undefined;
|
|
3832
3832
|
} else {
|
|
3833
|
-
newResult[${
|
|
3833
|
+
newResult[${k}] = ${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 ? [${k}, ...iss.path] : [${k}]
|
|
3844
3844
|
})));
|
|
3845
3845
|
}
|
|
3846
3846
|
|
|
3847
3847
|
if (${id}.value === undefined) {
|
|
3848
|
-
if (${
|
|
3849
|
-
newResult[${
|
|
3848
|
+
if (${k} in input) {
|
|
3849
|
+
newResult[${k}] = undefined;
|
|
3850
3850
|
}
|
|
3851
3851
|
} else {
|
|
3852
|
-
newResult[${
|
|
3852
|
+
newResult[${k}] = ${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[
|
|
4024
|
-
for (const val of
|
|
4025
|
-
propValues[
|
|
4021
|
+
for (const [k, v2] of Object.entries(pv)) {
|
|
4022
|
+
if (!propValues[k])
|
|
4023
|
+
propValues[k] = /* @__PURE__ */ new Set();
|
|
4024
|
+
for (const val of v2) {
|
|
4025
|
+
propValues[k].add(val);
|
|
4026
4026
|
}
|
|
4027
4027
|
}
|
|
4028
4028
|
}
|
|
@@ -4035,11 +4035,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
4035
4035
|
const values = o._zod.propValues?.[def.discriminator];
|
|
4036
4036
|
if (!values || values.size === 0)
|
|
4037
4037
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
4038
|
-
for (const
|
|
4039
|
-
if (map2.has(
|
|
4040
|
-
throw new Error(`Duplicate discriminator value "${String(
|
|
4038
|
+
for (const v2 of values) {
|
|
4039
|
+
if (map2.has(v2)) {
|
|
4040
|
+
throw new Error(`Duplicate discriminator value "${String(v2)}"`);
|
|
4041
4041
|
}
|
|
4042
|
-
map2.set(
|
|
4042
|
+
map2.set(v2, o);
|
|
4043
4043
|
}
|
|
4044
4044
|
}
|
|
4045
4045
|
return map2;
|
|
@@ -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 k of iss.keys) {
|
|
4144
|
+
if (!unrecKeys.has(k))
|
|
4145
|
+
unrecKeys.set(k, {});
|
|
4146
|
+
unrecKeys.get(k).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 k of iss.keys) {
|
|
4155
|
+
if (!unrecKeys.has(k))
|
|
4156
|
+
unrecKeys.set(k, {});
|
|
4157
|
+
unrecKeys.get(k).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(([k]) => k);
|
|
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((k) => propertyKeyTypes.has(typeof k)).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)) {
|
|
@@ -4678,8 +4678,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
4678
4678
|
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
4679
4679
|
$ZodType.init(inst, def);
|
|
4680
4680
|
defineLazy(inst._zod, "values", () => {
|
|
4681
|
-
const
|
|
4682
|
-
return
|
|
4681
|
+
const v2 = def.innerType._zod.values;
|
|
4682
|
+
return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
|
|
4683
4683
|
});
|
|
4684
4684
|
inst._zod.parse = (payload, ctx) => {
|
|
4685
4685
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -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 F = inst.constructor;
|
|
4974
4974
|
if (Array.isArray(args[0])) {
|
|
4975
|
-
return new
|
|
4975
|
+
return new F({
|
|
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 F({
|
|
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 F = inst.constructor;
|
|
4993
|
+
return new F({
|
|
4994
4994
|
type: "function",
|
|
4995
4995
|
input: inst._def.input,
|
|
4996
4996
|
output
|
|
@@ -5007,10 +5007,10 @@ var $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => {
|
|
|
5007
5007
|
var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
5008
5008
|
$ZodType.init(inst, def);
|
|
5009
5009
|
defineLazy(inst._zod, "innerType", () => {
|
|
5010
|
-
const
|
|
5011
|
-
if (!
|
|
5012
|
-
|
|
5013
|
-
return
|
|
5010
|
+
const d2 = def;
|
|
5011
|
+
if (!d2._cachedInner)
|
|
5012
|
+
d2._cachedInner = def.getter();
|
|
5013
|
+
return d2._cachedInner;
|
|
5014
5014
|
});
|
|
5015
5015
|
defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
|
|
5016
5016
|
defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
|
|
@@ -7076,7 +7076,7 @@ var error17 = () => {
|
|
|
7076
7076
|
if (issue2.values.length === 1) {
|
|
7077
7077
|
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${stringifyPrimitive(issue2.values[0])}`;
|
|
7078
7078
|
}
|
|
7079
|
-
const stringified = issue2.values.map((
|
|
7079
|
+
const stringified = issue2.values.map((v2) => stringifyPrimitive(v2));
|
|
7080
7080
|
if (issue2.values.length === 2) {
|
|
7081
7081
|
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${stringified[0]} \u05D0\u05D5 ${stringified[1]}`;
|
|
7082
7082
|
}
|
|
@@ -11831,7 +11831,7 @@ function _set(Class2, valueType, params) {
|
|
|
11831
11831
|
}
|
|
11832
11832
|
// @__NO_SIDE_EFFECTS__
|
|
11833
11833
|
function _enum(Class2, values, params) {
|
|
11834
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
11834
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
11835
11835
|
return new Class2({
|
|
11836
11836
|
type: "enum",
|
|
11837
11837
|
entries,
|
|
@@ -12036,8 +12036,8 @@ function _stringbool(Classes, _params) {
|
|
|
12036
12036
|
let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
|
|
12037
12037
|
let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
|
|
12038
12038
|
if (params.case !== "sensitive") {
|
|
12039
|
-
truthyArray = truthyArray.map((
|
|
12040
|
-
falsyArray = falsyArray.map((
|
|
12039
|
+
truthyArray = truthyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
|
|
12040
|
+
falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
|
|
12041
12041
|
}
|
|
12042
12042
|
const truthySet = new Set(truthyArray);
|
|
12043
12043
|
const falsySet = new Set(falsyArray);
|
|
@@ -12579,9 +12579,9 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
12579
12579
|
var enumProcessor = (schema, _ctx, json2, _params) => {
|
|
12580
12580
|
const def = schema._zod.def;
|
|
12581
12581
|
const values = getEnumValues(def.entries);
|
|
12582
|
-
if (values.every((
|
|
12582
|
+
if (values.every((v2) => typeof v2 === "number"))
|
|
12583
12583
|
json2.type = "number";
|
|
12584
|
-
if (values.every((
|
|
12584
|
+
if (values.every((v2) => typeof v2 === "string"))
|
|
12585
12585
|
json2.type = "string";
|
|
12586
12586
|
json2.enum = values;
|
|
12587
12587
|
};
|
|
@@ -12614,13 +12614,13 @@ var literalProcessor = (schema, ctx, json2, _params) => {
|
|
|
12614
12614
|
json2.const = val;
|
|
12615
12615
|
}
|
|
12616
12616
|
} else {
|
|
12617
|
-
if (vals.every((
|
|
12617
|
+
if (vals.every((v2) => typeof v2 === "number"))
|
|
12618
12618
|
json2.type = "number";
|
|
12619
|
-
if (vals.every((
|
|
12619
|
+
if (vals.every((v2) => typeof v2 === "string"))
|
|
12620
12620
|
json2.type = "string";
|
|
12621
|
-
if (vals.every((
|
|
12621
|
+
if (vals.every((v2) => typeof v2 === "boolean"))
|
|
12622
12622
|
json2.type = "boolean";
|
|
12623
|
-
if (vals.every((
|
|
12623
|
+
if (vals.every((v2) => v2 === null))
|
|
12624
12624
|
json2.type = "null";
|
|
12625
12625
|
json2.enum = vals;
|
|
12626
12626
|
}
|
|
@@ -12718,11 +12718,11 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12718
12718
|
}
|
|
12719
12719
|
const allKeys = new Set(Object.keys(shape));
|
|
12720
12720
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
12721
|
-
const
|
|
12721
|
+
const v2 = def.shape[key]._zod;
|
|
12722
12722
|
if (ctx.io === "input") {
|
|
12723
|
-
return
|
|
12723
|
+
return v2.optin === void 0;
|
|
12724
12724
|
} else {
|
|
12725
|
-
return
|
|
12725
|
+
return v2.optout === void 0;
|
|
12726
12726
|
}
|
|
12727
12727
|
}));
|
|
12728
12728
|
if (requiredKeys.size > 0) {
|
|
@@ -12842,7 +12842,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
12842
12842
|
}
|
|
12843
12843
|
const keyValues = keyType._zod.values;
|
|
12844
12844
|
if (keyValues) {
|
|
12845
|
-
const validKeyValues = [...keyValues].filter((
|
|
12845
|
+
const validKeyValues = [...keyValues].filter((v2) => typeof v2 === "string" || typeof v2 === "number");
|
|
12846
12846
|
if (validKeyValues.length > 0) {
|
|
12847
12847
|
json2.required = validKeyValues;
|
|
12848
12848
|
}
|
|
@@ -13407,12 +13407,12 @@ function _installLazyMethods(inst, group, methods) {
|
|
|
13407
13407
|
});
|
|
13408
13408
|
return bound;
|
|
13409
13409
|
},
|
|
13410
|
-
set(
|
|
13410
|
+
set(v2) {
|
|
13411
13411
|
Object.defineProperty(this, key, {
|
|
13412
13412
|
configurable: true,
|
|
13413
13413
|
writable: true,
|
|
13414
13414
|
enumerable: true,
|
|
13415
|
-
value:
|
|
13415
|
+
value: v2
|
|
13416
13416
|
});
|
|
13417
13417
|
}
|
|
13418
13418
|
});
|
|
@@ -13502,11 +13502,11 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
13502
13502
|
transform(tx) {
|
|
13503
13503
|
return pipe(this, transform(tx));
|
|
13504
13504
|
},
|
|
13505
|
-
default(
|
|
13506
|
-
return _default2(this,
|
|
13505
|
+
default(d2) {
|
|
13506
|
+
return _default2(this, d2);
|
|
13507
13507
|
},
|
|
13508
|
-
prefault(
|
|
13509
|
-
return prefault(this,
|
|
13508
|
+
prefault(d2) {
|
|
13509
|
+
return prefault(this, d2);
|
|
13510
13510
|
},
|
|
13511
13511
|
catch(params) {
|
|
13512
13512
|
return _catch2(this, params);
|
|
@@ -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 k = clone(keyType);
|
|
14212
|
+
k._zod.values = void 0;
|
|
14213
14213
|
return new ZodRecord({
|
|
14214
14214
|
type: "record",
|
|
14215
|
-
keyType:
|
|
14215
|
+
keyType: k,
|
|
14216
14216
|
valueType,
|
|
14217
14217
|
...util_exports.normalizeParams(params)
|
|
14218
14218
|
});
|
|
@@ -14300,7 +14300,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
14300
14300
|
};
|
|
14301
14301
|
});
|
|
14302
14302
|
function _enum2(values, params) {
|
|
14303
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
14303
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
14304
14304
|
return new ZodEnum({
|
|
14305
14305
|
type: "enum",
|
|
14306
14306
|
entries,
|
|
@@ -14854,10 +14854,10 @@ function convertBaseSchema(schema, ctx) {
|
|
|
14854
14854
|
if (enumValues.length === 1) {
|
|
14855
14855
|
return z.literal(enumValues[0]);
|
|
14856
14856
|
}
|
|
14857
|
-
if (enumValues.every((
|
|
14857
|
+
if (enumValues.every((v2) => typeof v2 === "string")) {
|
|
14858
14858
|
return z.enum(enumValues);
|
|
14859
14859
|
}
|
|
14860
|
-
const literalSchemas = enumValues.map((
|
|
14860
|
+
const literalSchemas = enumValues.map((v2) => z.literal(v2));
|
|
14861
14861
|
if (literalSchemas.length < 2) {
|
|
14862
14862
|
return literalSchemas[0];
|
|
14863
14863
|
}
|
|
@@ -15260,7 +15260,7 @@ var edgeContextPayloadSchema = external_exports.object({
|
|
|
15260
15260
|
// ../shared/dist/chunk-SCJRL6LP.mjs
|
|
15261
15261
|
var MAX_DURABLE_POLL_ATTEMPTS = 1e3;
|
|
15262
15262
|
|
|
15263
|
-
// ../shared/dist/chunk-
|
|
15263
|
+
// ../shared/dist/chunk-R7RM64AL.mjs
|
|
15264
15264
|
var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
15265
15265
|
// Mixlayer models
|
|
15266
15266
|
{
|
|
@@ -15325,7 +15325,7 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
|
15325
15325
|
},
|
|
15326
15326
|
{
|
|
15327
15327
|
provider: "runtype",
|
|
15328
|
-
modelId: "gemini-3.
|
|
15328
|
+
modelId: "gemini-3.6-flash",
|
|
15329
15329
|
isDefault: false,
|
|
15330
15330
|
strengths: "Fast, low-cost, and natively multimodal with good reasoning, tool-use, and a 1M context \u2014 a strong choice for vision and high-throughput steps.",
|
|
15331
15331
|
bestFor: ["default", "vision", "fast-cheap", "agentic-tools", "long-context"]
|
|
@@ -15702,7 +15702,7 @@ var _SimpleTemplateEngine = class _SimpleTemplateEngine2 {
|
|
|
15702
15702
|
const result = this.substitute(template, context);
|
|
15703
15703
|
if (result.usedDefaults.length > 0) {
|
|
15704
15704
|
warnings.push(
|
|
15705
|
-
`Used ${result.usedDefaults.length} default values: ${result.usedDefaults.map((
|
|
15705
|
+
`Used ${result.usedDefaults.length} default values: ${result.usedDefaults.map((d2) => d2.variable).join(", ")}`
|
|
15706
15706
|
);
|
|
15707
15707
|
}
|
|
15708
15708
|
if (result.missingVariables.length > 0) {
|
|
@@ -15786,7 +15786,7 @@ function resolveFallback(parsed, context, tracking, options = {}) {
|
|
|
15786
15786
|
}
|
|
15787
15787
|
var templateEngine = new SimpleTemplateEngine();
|
|
15788
15788
|
|
|
15789
|
-
// ../shared/dist/chunk-
|
|
15789
|
+
// ../shared/dist/chunk-TJITC2J6.mjs
|
|
15790
15790
|
var tokensSchema = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
|
|
15791
15791
|
var wireStopReasonSchema = external_exports.enum([
|
|
15792
15792
|
"end_turn",
|
|
@@ -15807,6 +15807,10 @@ var unifiedBase = {
|
|
|
15807
15807
|
seq: external_exports.number()
|
|
15808
15808
|
};
|
|
15809
15809
|
var executionKindSchema = external_exports.enum(["agent", "flow"]);
|
|
15810
|
+
var unifiedExternalAgentContextSchema = external_exports.object({
|
|
15811
|
+
contextId: external_exports.string().optional(),
|
|
15812
|
+
taskId: external_exports.string().optional()
|
|
15813
|
+
});
|
|
15810
15814
|
var fallbackAttemptSchema = external_exports.object({
|
|
15811
15815
|
attempt: external_exports.number(),
|
|
15812
15816
|
type: external_exports.enum(["retry", "model", "message", "flow"]),
|
|
@@ -15861,7 +15865,10 @@ var unifiedExecutionCompleteEventSchema = external_exports.object({
|
|
|
15861
15865
|
failedSteps: external_exports.number().optional(),
|
|
15862
15866
|
// Inline Claude Managed create dispatches return the reusable Anthropic
|
|
15863
15867
|
// agent id on the terminal frame so callers can connect on a later turn.
|
|
15864
|
-
claudeManagedAgentId: external_exports.string().optional()
|
|
15868
|
+
claudeManagedAgentId: external_exports.string().optional(),
|
|
15869
|
+
// External A2A agents return the conversation handle callers must persist in
|
|
15870
|
+
// order to resume the same upstream task on the next execution.
|
|
15871
|
+
externalAgent: unifiedExternalAgentContextSchema.optional()
|
|
15865
15872
|
});
|
|
15866
15873
|
var unifiedExecutionErrorEventSchema = external_exports.object({
|
|
15867
15874
|
...unifiedBase,
|
|
@@ -16135,7 +16142,10 @@ var unifiedApprovalStartEventSchema = external_exports.object({
|
|
|
16135
16142
|
iteration: external_exports.number().optional(),
|
|
16136
16143
|
// Present when the approval originated inside a subagent's execution.
|
|
16137
16144
|
// Attribution only — never a control signal.
|
|
16138
|
-
subagent: unifiedSubagentAttributionSchema.optional()
|
|
16145
|
+
subagent: unifiedSubagentAttributionSchema.optional(),
|
|
16146
|
+
// External A2A input/auth pauses must expose the handle used to resume the
|
|
16147
|
+
// paused upstream conversation after approval.
|
|
16148
|
+
externalAgent: unifiedExternalAgentContextSchema.optional()
|
|
16139
16149
|
});
|
|
16140
16150
|
var unifiedApprovalCompleteEventSchema = external_exports.object({
|
|
16141
16151
|
...unifiedBase,
|
|
@@ -16428,6 +16438,7 @@ var agentToolCompleteEventSchema = external_exports.object({
|
|
|
16428
16438
|
toolName: external_exports.string(),
|
|
16429
16439
|
success: external_exports.boolean(),
|
|
16430
16440
|
result: external_exports.unknown().optional(),
|
|
16441
|
+
error: external_exports.string().optional(),
|
|
16431
16442
|
executionTime: external_exports.number().optional()
|
|
16432
16443
|
});
|
|
16433
16444
|
var agentMediaEventSchema = external_exports.object({
|
|
@@ -17145,15 +17156,13 @@ var AGENT_CONTENT_CONFIG_KEYS = {
|
|
|
17145
17156
|
tenancyStrategy: true
|
|
17146
17157
|
};
|
|
17147
17158
|
var AGENT_CONTENT_CONFIG_KEY_LIST = Object.keys(AGENT_CONTENT_CONFIG_KEYS).sort();
|
|
17148
|
-
var configurationStatusSchema = external_exports.enum([
|
|
17149
|
-
|
|
17150
|
-
"needs_configuration",
|
|
17151
|
-
"invalid"
|
|
17152
|
-
]);
|
|
17159
|
+
var configurationStatusSchema = external_exports.enum(["configured", "needs_configuration", "invalid"]);
|
|
17160
|
+
var secretDocsUrlSchema = external_exports.url({ protocol: /^https$/ }).max(2048);
|
|
17153
17161
|
var secretRequirementSourceSchema = external_exports.object({
|
|
17154
17162
|
type: external_exports.enum(["manual", "secret", "product"]),
|
|
17155
17163
|
key: external_exports.string().optional(),
|
|
17156
|
-
productId: external_exports.string().optional()
|
|
17164
|
+
productId: external_exports.string().optional(),
|
|
17165
|
+
description: external_exports.string().optional()
|
|
17157
17166
|
});
|
|
17158
17167
|
var secretIntakeItemSchema = external_exports.object({
|
|
17159
17168
|
itemId: external_exports.string(),
|
|
@@ -17201,6 +17210,10 @@ var secretIntakeSubmitItemSchema = external_exports.object({
|
|
|
17201
17210
|
displayName: external_exports.string().optional(),
|
|
17202
17211
|
description: external_exports.string().optional(),
|
|
17203
17212
|
value: external_exports.string().optional(),
|
|
17213
|
+
// Write-path acquisition link for API/MCP submitters. The dashboard intake
|
|
17214
|
+
// form does not expose an input for it in v1; it flows into the same
|
|
17215
|
+
// create/update service paths. https-only via secretDocsUrlSchema.
|
|
17216
|
+
docsUrl: secretDocsUrlSchema.optional(),
|
|
17204
17217
|
// Required when `value` is set AND the item targets an existing secret
|
|
17205
17218
|
// (has `secretId` or a `key` that already exists). Echoed from the
|
|
17206
17219
|
// manifest item's `version` field. Omit for new-secret creations.
|
|
@@ -35067,6 +35080,36 @@ var CORE_BUILTIN_TOOLS_REGISTRY = [
|
|
|
35067
35080
|
// Requires OpenAI key for embeddings
|
|
35068
35081
|
executionHint: "platform"
|
|
35069
35082
|
},
|
|
35083
|
+
// Runtype documentation search — semantic RAG over the published docs corpus.
|
|
35084
|
+
// Executes server-side against Fern's hosted docs MCP server (see
|
|
35085
|
+
// apps/api/src/services/docs-search-service.ts). Free (no per-call cost, no
|
|
35086
|
+
// provider key); gated by the `enable-docs-search` Flagship flag at execution.
|
|
35087
|
+
{
|
|
35088
|
+
id: "search_runtype_docs",
|
|
35089
|
+
name: "Search Runtype Docs",
|
|
35090
|
+
description: "Search Runtype's own product documentation and get back a synthesized answer with citations. Use this to answer how-to and conceptual questions about building on Runtype \u2014 flows, agents, surfaces, tools, records, schedules, and platform capabilities. Prefer this over generic web search for anything about how Runtype itself works. Returns { success, content } where content carries the answer text and its source citations.",
|
|
35091
|
+
category: BuiltInToolCategory.KNOWLEDGE_RETRIEVAL,
|
|
35092
|
+
providers: [BuiltInToolProvider.MULTI],
|
|
35093
|
+
parametersSchema: {
|
|
35094
|
+
type: "object",
|
|
35095
|
+
properties: {
|
|
35096
|
+
query: {
|
|
35097
|
+
type: "string",
|
|
35098
|
+
description: 'Natural-language documentation question about how to build or configure something on Runtype. Example: "How do I add an approval step to an agent?"',
|
|
35099
|
+
minLength: 1
|
|
35100
|
+
}
|
|
35101
|
+
},
|
|
35102
|
+
required: ["query"]
|
|
35103
|
+
},
|
|
35104
|
+
executionHint: "platform",
|
|
35105
|
+
requiresApiKey: false,
|
|
35106
|
+
platformKeySupport: false,
|
|
35107
|
+
// Hidden from production tool discovery until `enable-docs-search` rolls out
|
|
35108
|
+
// (the flag fails closed in production, so a discoverable tool would just
|
|
35109
|
+
// error "not enabled" for every prod account). Execution path is
|
|
35110
|
+
// unaffected — the Generator Agent and non-prod accounts still use it.
|
|
35111
|
+
experimental: true
|
|
35112
|
+
},
|
|
35070
35113
|
// ElevenLabs Text-to-Speech
|
|
35071
35114
|
{
|
|
35072
35115
|
id: "elevenlabs-tts",
|
|
@@ -38738,10 +38781,18 @@ var caseCheckpointSchema = external_exports.object({
|
|
|
38738
38781
|
*/
|
|
38739
38782
|
forkMessageIndex: external_exports.number().int().nonnegative()
|
|
38740
38783
|
}).strict();
|
|
38784
|
+
var requiredJsonValueSchema = external_exports.union([
|
|
38785
|
+
external_exports.null(),
|
|
38786
|
+
external_exports.boolean(),
|
|
38787
|
+
external_exports.number(),
|
|
38788
|
+
external_exports.string(),
|
|
38789
|
+
external_exports.array(external_exports.any()),
|
|
38790
|
+
external_exports.record(external_exports.string(), external_exports.any())
|
|
38791
|
+
]);
|
|
38741
38792
|
var toolMockSchema = external_exports.object({
|
|
38742
38793
|
toolName: external_exports.string().min(1),
|
|
38743
38794
|
input: external_exports.unknown().optional(),
|
|
38744
|
-
output:
|
|
38795
|
+
output: requiredJsonValueSchema,
|
|
38745
38796
|
/**
|
|
38746
38797
|
* True when the recorded call FAILED — `output` is then the error payload,
|
|
38747
38798
|
* and a replay must serve it as a failure, not a success. Captured now so
|
|
@@ -38780,7 +38831,7 @@ var recordedToolUnmatchedPolicySchema = external_exports.enum(RECORDED_TOOL_UNMA
|
|
|
38780
38831
|
var EVAL_JUDGE_SYSTEM_PROMPT = [
|
|
38781
38832
|
"You are Runtype's evaluation expert: a rigorous, impartial judge of AI agent and flow behavior. Your job is to decide whether ONE run of an AI system met ONE plain-language criterion written by the system's builder.",
|
|
38782
38833
|
"",
|
|
38783
|
-
|
|
38834
|
+
`You are given the criterion (what this flow or agent is supposed to do \u2014 the only standard you grade against), the case name, an optional expected answer for reference, and the run transcript: an indexed record of the steps that ran and every tool call with its inputs and outputs (labeled "[message N]" and "[tool_call N]"), followed by the final output. For conversation-seeded cases, the transcript opens with the seeded conversation \u2014 the dialogue the run was replying to. It is context the system was given, not something the run produced: use it to understand what the final output is responding to, and never grade the seeded turns themselves against the criterion. The transcript may also include a "Deterministic check results" section: the pass/fail outcomes of the suite's automated checks, already decided before you were called. Treat those results as settled ground truth.`,
|
|
38784
38835
|
"",
|
|
38785
38836
|
"How to judge:",
|
|
38786
38837
|
'1. Read the criterion first and decide what evidence it demands. A process criterion ("confirms X before Y", "never calls Z", "asks first") is judged on the trajectory \u2014 what the system actually did. An outcome criterion ("answers the question", "matches the expected answer", "right tone") is judged on the final output. Many criteria need both.',
|
|
@@ -38788,6 +38839,7 @@ var EVAL_JUDGE_SYSTEM_PROMPT = [
|
|
|
38788
38839
|
"3. Judge whether a required action occurred when it mattered. Never demand a rigid, exact step ordering unless the criterion explicitly requires one; incidental extra steps or interleaved calls are not failures.",
|
|
38789
38840
|
"4. Grade only the criterion you were given. Do not reward or punish anything outside it: not verbosity or brevity, not style, not parts of the run the criterion doesn't mention, and not whether you would have approached the task differently.",
|
|
38790
38841
|
"5. When the transcript is truncated or no trajectory was captured, judge what you can see. If what you can see cannot settle the criterion, decline \u2014 do not guess in either direction.",
|
|
38842
|
+
'6. Do not re-litigate the deterministic checks. Whether a tool was or was not called, a step ran, the run completed, or the output contains a required string is already settled by the "Deterministic check results" shown as ground truth \u2014 take those outcomes as given, never re-assert or contradict them, and do not make your verdict hinge on restating one. Your job is the qualitative substance those structural checks cannot decide.',
|
|
38791
38843
|
"",
|
|
38792
38844
|
"Reason first, then decide: in one paragraph, walk through the specific evidence for and against the criterion BEFORE settling on a verdict, and never rewrite your reasoning to justify a verdict you already picked.",
|
|
38793
38845
|
"",
|
|
@@ -38796,7 +38848,7 @@ var EVAL_JUDGE_SYSTEM_PROMPT = [
|
|
|
38796
38848
|
'- "fail" \u2014 the criterion is clearly not met on the evidence shown.',
|
|
38797
38849
|
'- "insufficient_evidence" \u2014 what you were shown cannot settle this criterion. This is the honest answer, not a failure; use it instead of guessing.',
|
|
38798
38850
|
"",
|
|
38799
|
-
'Cite the transcript entries your verdict rests on as an array of {"kind": "message"|"tool_call", "index": N}, using the exact labeled indices. An empty array is correct when the final output
|
|
38851
|
+
'Cite the transcript entries your verdict rests on as an array of {"kind": "message"|"tool_call", "index": N}, using the exact labeled indices. An empty array is correct when the evidence is the final output or the seeded conversation (neither has a labeled index).',
|
|
38800
38852
|
"",
|
|
38801
38853
|
'Return ONLY a JSON object of the form {"reasoning": "<one paragraph>", "verdict": "pass"|"fail"|"insufficient_evidence", "evidence": [{"kind": "message"|"tool_call", "index": <integer>}]}. Do not include any text outside the JSON object.',
|
|
38802
38854
|
"",
|
|
@@ -39160,6 +39212,14 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39160
39212
|
"google": "gemini-3.5-flash",
|
|
39161
39213
|
"vercel": "google/gemini-3.5-flash"
|
|
39162
39214
|
},
|
|
39215
|
+
"gemini-3-5-flash-lite": {
|
|
39216
|
+
"google": "gemini-3.5-flash-lite",
|
|
39217
|
+
"vercel": "google/gemini-3.5-flash-lite"
|
|
39218
|
+
},
|
|
39219
|
+
"gemini-3-6-flash": {
|
|
39220
|
+
"google": "gemini-3.6-flash",
|
|
39221
|
+
"vercel": "google/gemini-3.6-flash"
|
|
39222
|
+
},
|
|
39163
39223
|
"gemini-3-flash": {
|
|
39164
39224
|
"google": "gemini-3-flash-preview"
|
|
39165
39225
|
},
|
|
@@ -39194,6 +39254,14 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39194
39254
|
"google": "gemini-3.5-flash",
|
|
39195
39255
|
"vercel": "google/gemini-3.5-flash"
|
|
39196
39256
|
},
|
|
39257
|
+
"gemini-3.5-flash-lite": {
|
|
39258
|
+
"google": "gemini-3.5-flash-lite",
|
|
39259
|
+
"vercel": "google/gemini-3.5-flash-lite"
|
|
39260
|
+
},
|
|
39261
|
+
"gemini-3.6-flash": {
|
|
39262
|
+
"google": "gemini-3.6-flash",
|
|
39263
|
+
"vercel": "google/gemini-3.6-flash"
|
|
39264
|
+
},
|
|
39197
39265
|
"gemini-embedding-001": {
|
|
39198
39266
|
"google": "gemini-embedding-001"
|
|
39199
39267
|
},
|
|
@@ -39530,7 +39598,11 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39530
39598
|
"grok-voice-think-fast-1.0": {
|
|
39531
39599
|
"vercel": "xai/grok-voice-think-fast-1.0"
|
|
39532
39600
|
},
|
|
39601
|
+
"hy3": {
|
|
39602
|
+
"vercel": "tencent/hy3"
|
|
39603
|
+
},
|
|
39533
39604
|
"inkling": {
|
|
39605
|
+
"togetherai": "togetherai/thinkingmachines/Inkling",
|
|
39534
39606
|
"vercel": "thinkingmachines/inkling"
|
|
39535
39607
|
},
|
|
39536
39608
|
"interfaze-beta": {
|
|
@@ -39593,23 +39665,23 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39593
39665
|
"kimi-k3": {
|
|
39594
39666
|
"vercel": "moonshotai/kimi-k3"
|
|
39595
39667
|
},
|
|
39596
|
-
"
|
|
39597
|
-
"
|
|
39668
|
+
"laguna-s-2-1": {
|
|
39669
|
+
"vercel": "poolside/laguna-s-2.1"
|
|
39598
39670
|
},
|
|
39599
|
-
"
|
|
39600
|
-
"
|
|
39671
|
+
"laguna-s-2-1-free": {
|
|
39672
|
+
"vercel": "poolside/laguna-s-2.1-free"
|
|
39601
39673
|
},
|
|
39602
|
-
"
|
|
39603
|
-
"vercel": "
|
|
39674
|
+
"laguna-s-2.1": {
|
|
39675
|
+
"vercel": "poolside/laguna-s-2.1"
|
|
39604
39676
|
},
|
|
39605
|
-
"
|
|
39606
|
-
"vercel": "
|
|
39677
|
+
"laguna-s-2.1-free": {
|
|
39678
|
+
"vercel": "poolside/laguna-s-2.1-free"
|
|
39607
39679
|
},
|
|
39608
|
-
"
|
|
39609
|
-
"
|
|
39680
|
+
"lfm2-24b-a2b": {
|
|
39681
|
+
"togetherai": "togetherai/LiquidAI/LFM2-24B-A2B"
|
|
39610
39682
|
},
|
|
39611
|
-
"
|
|
39612
|
-
"
|
|
39683
|
+
"LiquidAI/LFM2-24B-A2B": {
|
|
39684
|
+
"togetherai": "togetherai/LiquidAI/LFM2-24B-A2B"
|
|
39613
39685
|
},
|
|
39614
39686
|
"llama-3-3-70b-instruct-turbo": {
|
|
39615
39687
|
"togetherai": "togetherai/meta-llama/Llama-3.3-70B-Instruct-Turbo"
|
|
@@ -39620,18 +39692,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39620
39692
|
"llama-3.1-8b": {
|
|
39621
39693
|
"vercel": "meta/llama-3.1-8b"
|
|
39622
39694
|
},
|
|
39623
|
-
"llama-3.2-11b": {
|
|
39624
|
-
"vercel": "meta/llama-3.2-11b"
|
|
39625
|
-
},
|
|
39626
|
-
"llama-3.2-1b": {
|
|
39627
|
-
"vercel": "meta/llama-3.2-1b"
|
|
39628
|
-
},
|
|
39629
|
-
"llama-3.2-3b": {
|
|
39630
|
-
"vercel": "meta/llama-3.2-3b"
|
|
39631
|
-
},
|
|
39632
|
-
"llama-3.2-90b": {
|
|
39633
|
-
"vercel": "meta/llama-3.2-90b"
|
|
39634
|
-
},
|
|
39635
39695
|
"llama-3.3-70b": {
|
|
39636
39696
|
"vercel": "meta/llama-3.3-70b"
|
|
39637
39697
|
},
|
|
@@ -40037,6 +40097,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
40037
40097
|
"text-embedding-ada-002": {
|
|
40038
40098
|
"openai": "text-embedding-ada-002"
|
|
40039
40099
|
},
|
|
40100
|
+
"thinkingmachines/Inkling": {
|
|
40101
|
+
"togetherai": "togetherai/thinkingmachines/Inkling"
|
|
40102
|
+
},
|
|
40040
40103
|
"trinity-large": {
|
|
40041
40104
|
"vercel": "arcee-ai/trinity-large-thinking"
|
|
40042
40105
|
},
|
|
@@ -40078,7 +40141,7 @@ var PLATFORM_KEY_PROVIDER_MAP = {
|
|
|
40078
40141
|
"mock": false
|
|
40079
40142
|
};
|
|
40080
40143
|
var PLATFORM_KEY_PROVIDERS = new Set(
|
|
40081
|
-
Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([,
|
|
40144
|
+
Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v2]) => v2).map(([k]) => k)
|
|
40082
40145
|
);
|
|
40083
40146
|
var MANUAL_PROVIDER_MAP_OVERRIDES = {
|
|
40084
40147
|
// Bedrock uses different model ID format
|
|
@@ -41402,18 +41465,18 @@ function extractSecretReferencesFromAnyValue(value, maxDepth = 10) {
|
|
|
41402
41465
|
const keys = /* @__PURE__ */ new Set();
|
|
41403
41466
|
walk(value, 0);
|
|
41404
41467
|
return Array.from(keys);
|
|
41405
|
-
function walk(
|
|
41468
|
+
function walk(v2, depth) {
|
|
41406
41469
|
if (depth > maxDepth) return;
|
|
41407
|
-
if (typeof
|
|
41408
|
-
for (const key of extractSecretReferences(
|
|
41470
|
+
if (typeof v2 === "string") {
|
|
41471
|
+
for (const key of extractSecretReferences(v2)) keys.add(key);
|
|
41409
41472
|
return;
|
|
41410
41473
|
}
|
|
41411
|
-
if (Array.isArray(
|
|
41412
|
-
for (const item of
|
|
41474
|
+
if (Array.isArray(v2)) {
|
|
41475
|
+
for (const item of v2) walk(item, depth + 1);
|
|
41413
41476
|
return;
|
|
41414
41477
|
}
|
|
41415
|
-
if (
|
|
41416
|
-
for (const inner of Object.values(
|
|
41478
|
+
if (v2 && typeof v2 === "object") {
|
|
41479
|
+
for (const inner of Object.values(v2)) {
|
|
41417
41480
|
walk(inner, depth + 1);
|
|
41418
41481
|
}
|
|
41419
41482
|
}
|
|
@@ -41759,7 +41822,7 @@ var capabilitySchema = external_exports.object({
|
|
|
41759
41822
|
}).refine(
|
|
41760
41823
|
(cap) => {
|
|
41761
41824
|
const set2 = [cap.flow, cap.agent, cap.existingFlowId, cap.existingAgentId].filter(
|
|
41762
|
-
(
|
|
41825
|
+
(v2) => v2 !== void 0 && v2 !== null
|
|
41763
41826
|
);
|
|
41764
41827
|
return set2.length === 1;
|
|
41765
41828
|
},
|
|
@@ -41776,11 +41839,12 @@ var secretSchema = external_exports.object({
|
|
|
41776
41839
|
var setupInstructionsSchema = external_exports.object({
|
|
41777
41840
|
summary: external_exports.string().min(1),
|
|
41778
41841
|
steps: external_exports.array(external_exports.string()),
|
|
41779
|
-
// Constrained to an absolute URL because this lands in the
|
|
41780
|
-
// `<a href={…}>` in the secret intake and quick-start preview UIs —
|
|
41781
|
-
// `javascript:` / `data:` schemes in an unrestricted string would
|
|
41782
|
-
// live XSS vector when a malicious template is imported.
|
|
41783
|
-
|
|
41842
|
+
// Constrained to an https-only absolute URL because this lands in the
|
|
41843
|
+
// rendered `<a href={…}>` in the secret intake and quick-start preview UIs —
|
|
41844
|
+
// `javascript:` / `data:` / `http:` schemes in an unrestricted string would
|
|
41845
|
+
// be a live XSS / downgrade vector when a malicious template is imported.
|
|
41846
|
+
// Canonical schema lives in secrets-types.ts (`secretDocsUrlSchema`).
|
|
41847
|
+
docsUrl: secretDocsUrlSchema.optional()
|
|
41784
41848
|
});
|
|
41785
41849
|
var toolAuthSchema = external_exports.object({
|
|
41786
41850
|
type: external_exports.enum(["oauth", "api_key", "none", "user_provided"]),
|
|
@@ -42117,6 +42181,90 @@ var productReadinessSchema = external_exports.object({
|
|
|
42117
42181
|
/** Single best dashboard link if any browser step remains (secret-parity). */
|
|
42118
42182
|
handoff: browserFulfillmentSchema.optional()
|
|
42119
42183
|
});
|
|
42184
|
+
var briefFieldStatusSchema = external_exports.enum(["confirmed", "assumed"]);
|
|
42185
|
+
var briefProblemSchema = external_exports.object({
|
|
42186
|
+
status: briefFieldStatusSchema,
|
|
42187
|
+
/** The specific situation, in the user's own words. Always present when the field is. */
|
|
42188
|
+
statement: external_exports.string().min(1),
|
|
42189
|
+
/** Who runs into this situation. */
|
|
42190
|
+
whoFeelsIt: external_exports.string().min(1).optional(),
|
|
42191
|
+
/** What the problem costs them (time, money, missed work, frustration). */
|
|
42192
|
+
cost: external_exports.string().min(1).optional()
|
|
42193
|
+
});
|
|
42194
|
+
var briefAudienceGroupSchema = external_exports.object({
|
|
42195
|
+
group: external_exports.string().min(1),
|
|
42196
|
+
whatTheyDo: external_exports.string().min(1)
|
|
42197
|
+
});
|
|
42198
|
+
var briefAudienceSchema = external_exports.object({
|
|
42199
|
+
status: briefFieldStatusSchema,
|
|
42200
|
+
groups: external_exports.array(briefAudienceGroupSchema)
|
|
42201
|
+
});
|
|
42202
|
+
var briefCapabilitySchema = external_exports.object({
|
|
42203
|
+
name: external_exports.string().min(1),
|
|
42204
|
+
/** What it does, in plain terms. */
|
|
42205
|
+
behavior: external_exports.string().min(1),
|
|
42206
|
+
/** True = needed on day one; false = explicitly deferred to "later". */
|
|
42207
|
+
dayOne: external_exports.boolean()
|
|
42208
|
+
});
|
|
42209
|
+
var briefCapabilitiesSchema = external_exports.object({
|
|
42210
|
+
status: briefFieldStatusSchema,
|
|
42211
|
+
items: external_exports.array(briefCapabilitySchema)
|
|
42212
|
+
});
|
|
42213
|
+
var briefSurfaceTypeSchema = surfaceSchema.shape.type;
|
|
42214
|
+
var briefSurfaceSchema = external_exports.object({
|
|
42215
|
+
type: briefSurfaceTypeSchema,
|
|
42216
|
+
/** Optional plain-language label (e.g. "our website chat"). */
|
|
42217
|
+
name: external_exports.string().min(1).optional(),
|
|
42218
|
+
/** Optional note on why people reach the product here. */
|
|
42219
|
+
purpose: external_exports.string().min(1).optional()
|
|
42220
|
+
});
|
|
42221
|
+
var briefSurfacesSchema = external_exports.object({
|
|
42222
|
+
status: briefFieldStatusSchema,
|
|
42223
|
+
items: external_exports.array(briefSurfaceSchema)
|
|
42224
|
+
});
|
|
42225
|
+
var briefDataNeedsSchema = external_exports.object({
|
|
42226
|
+
status: briefFieldStatusSchema,
|
|
42227
|
+
/** Things it should remember run-to-run. */
|
|
42228
|
+
remembers: external_exports.array(external_exports.string().min(1)).optional(),
|
|
42229
|
+
/** Things it must already know before it can help. */
|
|
42230
|
+
mustAlreadyKnow: external_exports.array(external_exports.string().min(1)).optional()
|
|
42231
|
+
});
|
|
42232
|
+
var briefIntegrationSchema = external_exports.object({
|
|
42233
|
+
name: external_exports.string().min(1),
|
|
42234
|
+
purpose: external_exports.string().min(1).optional()
|
|
42235
|
+
});
|
|
42236
|
+
var briefIntegrationsSchema = external_exports.object({
|
|
42237
|
+
status: briefFieldStatusSchema,
|
|
42238
|
+
items: external_exports.array(briefIntegrationSchema)
|
|
42239
|
+
});
|
|
42240
|
+
var briefSuccessCriteriaSchema = external_exports.object({
|
|
42241
|
+
status: briefFieldStatusSchema,
|
|
42242
|
+
measure: external_exports.string().min(1)
|
|
42243
|
+
});
|
|
42244
|
+
var productBriefSchema = external_exports.object({
|
|
42245
|
+
problem: briefProblemSchema.optional(),
|
|
42246
|
+
audience: briefAudienceSchema.optional(),
|
|
42247
|
+
capabilities: briefCapabilitiesSchema.optional(),
|
|
42248
|
+
surfaces: briefSurfacesSchema.optional(),
|
|
42249
|
+
dataNeeds: briefDataNeedsSchema.optional(),
|
|
42250
|
+
integrations: briefIntegrationsSchema.optional(),
|
|
42251
|
+
successCriteria: briefSuccessCriteriaSchema.optional()
|
|
42252
|
+
});
|
|
42253
|
+
var fieldSoliditySchema = external_exports.enum(["empty", "sketched", "solid"]);
|
|
42254
|
+
var briefReadinessFieldsSchema = external_exports.object({
|
|
42255
|
+
problem: fieldSoliditySchema,
|
|
42256
|
+
audience: fieldSoliditySchema,
|
|
42257
|
+
capabilities: fieldSoliditySchema,
|
|
42258
|
+
surfaces: fieldSoliditySchema,
|
|
42259
|
+
dataNeeds: fieldSoliditySchema,
|
|
42260
|
+
integrations: fieldSoliditySchema,
|
|
42261
|
+
successCriteria: fieldSoliditySchema
|
|
42262
|
+
});
|
|
42263
|
+
var briefReadinessSchema = external_exports.object({
|
|
42264
|
+
ready: external_exports.boolean(),
|
|
42265
|
+
fields: briefReadinessFieldsSchema,
|
|
42266
|
+
missing: external_exports.array(external_exports.string())
|
|
42267
|
+
});
|
|
42120
42268
|
var FLAT_ADVANCED_CONFIG_KEYS = {
|
|
42121
42269
|
loopConfig: true,
|
|
42122
42270
|
reasoning: true,
|
|
@@ -42330,7 +42478,7 @@ function validateCapability(cap, index, context) {
|
|
|
42330
42478
|
const result = emptyResult();
|
|
42331
42479
|
const base = `capabilities[${index}]`;
|
|
42332
42480
|
const backings = [cap.flow, cap.agent, cap.existingFlowId, cap.existingAgentId].filter(
|
|
42333
|
-
(
|
|
42481
|
+
(v2) => v2 !== void 0 && v2 !== null
|
|
42334
42482
|
);
|
|
42335
42483
|
if (backings.length === 0) {
|
|
42336
42484
|
result.errors.push(
|
|
@@ -44992,6 +45140,70 @@ var MOCK_INVENTORY_LEVELS = MOCK_PRODUCTS.flatMap(
|
|
|
44992
45140
|
sku: variant.sku
|
|
44993
45141
|
}))
|
|
44994
45142
|
);
|
|
45143
|
+
var LOCAL_INFERENCE_PROTOCOL_VERSION = 1;
|
|
45144
|
+
var LocalInferenceSelectionSchema = external_exports.object({
|
|
45145
|
+
sessionId: external_exports.string().uuid(),
|
|
45146
|
+
model: external_exports.string().trim().min(1).max(256),
|
|
45147
|
+
backend: external_exports.literal("ollama")
|
|
45148
|
+
});
|
|
45149
|
+
var LocalInferenceMessageSchema = external_exports.object({
|
|
45150
|
+
role: external_exports.enum(["system", "user", "assistant"]),
|
|
45151
|
+
content: external_exports.string().max(1e6)
|
|
45152
|
+
});
|
|
45153
|
+
var LocalInferenceInvokeSchema = external_exports.object({
|
|
45154
|
+
type: external_exports.literal("inference.invoke"),
|
|
45155
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
45156
|
+
invocationId: external_exports.string().uuid(),
|
|
45157
|
+
model: external_exports.string().trim().min(1).max(256),
|
|
45158
|
+
messages: external_exports.array(LocalInferenceMessageSchema).min(1).max(500),
|
|
45159
|
+
temperature: external_exports.number().finite().min(0).max(2).optional(),
|
|
45160
|
+
maxTokens: external_exports.number().int().positive().max(131072).optional()
|
|
45161
|
+
});
|
|
45162
|
+
var LocalInferenceServerFrameSchema = external_exports.discriminatedUnion("type", [
|
|
45163
|
+
LocalInferenceInvokeSchema,
|
|
45164
|
+
external_exports.object({
|
|
45165
|
+
type: external_exports.literal("inference.cancel"),
|
|
45166
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
45167
|
+
invocationId: external_exports.string().uuid()
|
|
45168
|
+
}),
|
|
45169
|
+
external_exports.object({
|
|
45170
|
+
type: external_exports.literal("session.connected"),
|
|
45171
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
45172
|
+
sessionId: external_exports.string().uuid()
|
|
45173
|
+
})
|
|
45174
|
+
]);
|
|
45175
|
+
var LocalInferenceClientFrameSchema = external_exports.discriminatedUnion("type", [
|
|
45176
|
+
external_exports.object({
|
|
45177
|
+
type: external_exports.literal("session.ready"),
|
|
45178
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION)
|
|
45179
|
+
}),
|
|
45180
|
+
external_exports.object({
|
|
45181
|
+
type: external_exports.literal("inference.chunk"),
|
|
45182
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
45183
|
+
invocationId: external_exports.string().uuid(),
|
|
45184
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
45185
|
+
text: external_exports.string().max(256e3)
|
|
45186
|
+
}),
|
|
45187
|
+
external_exports.object({
|
|
45188
|
+
type: external_exports.literal("inference.complete"),
|
|
45189
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
45190
|
+
invocationId: external_exports.string().uuid(),
|
|
45191
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
45192
|
+
finishReason: external_exports.string().max(64).optional(),
|
|
45193
|
+
usage: external_exports.object({
|
|
45194
|
+
inputTokens: external_exports.number().int().nonnegative().max(1e8).optional(),
|
|
45195
|
+
outputTokens: external_exports.number().int().nonnegative().max(1e8).optional()
|
|
45196
|
+
}).optional()
|
|
45197
|
+
}),
|
|
45198
|
+
external_exports.object({
|
|
45199
|
+
type: external_exports.literal("inference.error"),
|
|
45200
|
+
protocolVersion: external_exports.literal(LOCAL_INFERENCE_PROTOCOL_VERSION),
|
|
45201
|
+
invocationId: external_exports.string().uuid(),
|
|
45202
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
45203
|
+
code: external_exports.enum(["cancelled", "ollama_unavailable", "model_error", "protocol_error"]),
|
|
45204
|
+
message: external_exports.string().min(1).max(2e3)
|
|
45205
|
+
})
|
|
45206
|
+
]);
|
|
44995
45207
|
function flattenTextContent(content) {
|
|
44996
45208
|
if (typeof content === "string") return content;
|
|
44997
45209
|
return content.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => p.text).join("");
|
|
@@ -45292,7 +45504,11 @@ var DispatchRequestSchema = external_exports.object({
|
|
|
45292
45504
|
autoAppendMetadata: external_exports.boolean().optional().default(false),
|
|
45293
45505
|
debugMode: external_exports.boolean().optional().default(false),
|
|
45294
45506
|
loggingPolicy: external_exports.enum(["default", "on", "off"]).optional(),
|
|
45295
|
-
useRuntimePackage: external_exports.boolean().optional().
|
|
45507
|
+
useRuntimePackage: external_exports.boolean().optional().describe(
|
|
45508
|
+
"Selects the execution engine for a streaming FLOW dispatch (two controls, A4-3). `true` forces the @runtypelabs/runtime lane (subject only to eligibility \u2014 an ineligible flow still folds to legacy silently); `false` forces the legacy engine. When omitted, the `use-runtime-package-flows` rollout flag sets the default engine for this caller. An explicit value always wins over the flag. Left undefined on purpose \u2014 do NOT default it, or the flag-as-default case becomes unreachable."
|
|
45509
|
+
),
|
|
45510
|
+
/** Route prompt model calls through an attached dashboard browser. */
|
|
45511
|
+
localInference: LocalInferenceSelectionSchema.optional(),
|
|
45296
45512
|
/**
|
|
45297
45513
|
* Resume a checkpointed agent-loop execution from its latest (or a
|
|
45298
45514
|
* specific) iteration-boundary snapshot. Runtime-path only: requires
|
|
@@ -45313,6 +45529,18 @@ var DispatchRequestSchema = external_exports.object({
|
|
|
45313
45529
|
/** Specific boundary to resume from (time-travel); latest when omitted. */
|
|
45314
45530
|
iteration: external_exports.number().int().nonnegative().optional()
|
|
45315
45531
|
}).optional(),
|
|
45532
|
+
/**
|
|
45533
|
+
* Client-executed (local / WebMCP) tool outputs for resuming a
|
|
45534
|
+
* client-tool pause on the runtime agent lane. Keyed by the paused
|
|
45535
|
+
* call's per-call id (`toolu_…` / `call_…`) or, as a fallback, the tool
|
|
45536
|
+
* name; the value is the tool's result. Runtime-path only and consumed
|
|
45537
|
+
* ONLY together with `resumeFrom` — the engine resolves each output
|
|
45538
|
+
* against the checkpoint's pending calls, injects the tool-call/result
|
|
45539
|
+
* message pairs so the model sees its prior calls, and re-pauses for any
|
|
45540
|
+
* unresolved parallel siblings. Passthrough-typed so a client can
|
|
45541
|
+
* resolve arbitrary tool return values.
|
|
45542
|
+
*/
|
|
45543
|
+
clientToolOutputs: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
45316
45544
|
environment: external_exports.enum(["development", "production"]).optional().default("development"),
|
|
45317
45545
|
createVersion: external_exports.boolean().optional().default(false),
|
|
45318
45546
|
versionType: external_exports.enum(["published", "draft", "test", "virtual"]).optional(),
|
|
@@ -45344,12 +45572,29 @@ var DispatchRequestSchema = external_exports.object({
|
|
|
45344
45572
|
storeResults: true,
|
|
45345
45573
|
autoAppendMetadata: false,
|
|
45346
45574
|
debugMode: false,
|
|
45347
|
-
useRuntimePackage
|
|
45575
|
+
// useRuntimePackage intentionally omitted — absent = silent request, so
|
|
45576
|
+
// the `use-runtime-package-flows` flag decides the default engine (A4-3).
|
|
45348
45577
|
environment: "development",
|
|
45349
45578
|
createVersion: false
|
|
45350
45579
|
})
|
|
45351
45580
|
}).refine((data) => data.flow || data.agent, {
|
|
45352
45581
|
message: "Either 'flow' or 'agent' configuration must be provided"
|
|
45582
|
+
}).superRefine((data, ctx) => {
|
|
45583
|
+
if (!data.options.localInference) return;
|
|
45584
|
+
if (!data.options.useRuntimePackage) {
|
|
45585
|
+
ctx.addIssue({
|
|
45586
|
+
code: "custom",
|
|
45587
|
+
path: ["options", "useRuntimePackage"],
|
|
45588
|
+
message: "Local inference requires useRuntimePackage to be enabled"
|
|
45589
|
+
});
|
|
45590
|
+
}
|
|
45591
|
+
if (data.options.modelOverride) {
|
|
45592
|
+
ctx.addIssue({
|
|
45593
|
+
code: "custom",
|
|
45594
|
+
path: ["options", "modelOverride"],
|
|
45595
|
+
message: "Local inference cannot be combined with modelOverride"
|
|
45596
|
+
});
|
|
45597
|
+
}
|
|
45353
45598
|
}).superRefine((data, ctx) => {
|
|
45354
45599
|
if (data.agent?.agentType !== "claude_managed") return;
|
|
45355
45600
|
if (!hasUsableClaudeManagedSeed(data.messages ?? [])) {
|
|
@@ -49809,8 +50054,8 @@ configCommand.command("get [key]").description("Get configuration value").action
|
|
|
49809
50054
|
const allConfig = config2.store;
|
|
49810
50055
|
if (Object.keys(allConfig).length > 0) {
|
|
49811
50056
|
console.log(chalk10.cyan("Current Configuration:"));
|
|
49812
|
-
for (const [
|
|
49813
|
-
console.log(` ${chalk10.green(
|
|
50057
|
+
for (const [k, v2] of Object.entries(allConfig)) {
|
|
50058
|
+
console.log(` ${chalk10.green(k)}: ${v2}`);
|
|
49814
50059
|
}
|
|
49815
50060
|
} else {
|
|
49816
50061
|
console.log(chalk10.gray("No configuration set"));
|
|
@@ -51210,7 +51455,7 @@ Keys (${keys.length}):`));
|
|
|
51210
51455
|
const itemSummary = items.length === 0 ? "No items" : items.map(
|
|
51211
51456
|
(i) => `${i.exposedName || i.capabilityName || i.capabilityId}${i.isEntryPoint ? " (entry point)" : ""}`
|
|
51212
51457
|
).join("\n");
|
|
51213
|
-
const keySummary = keys.length === 0 ? "No keys" : keys.map((
|
|
51458
|
+
const keySummary = keys.length === 0 ? "No keys" : keys.map((k) => `${k.name ?? "(unnamed)"} ${k.keyPrefix ?? ""}`.trim()).join("\n");
|
|
51214
51459
|
setResultNode(
|
|
51215
51460
|
React10.createElement(EntityCard, {
|
|
51216
51461
|
fields: [
|
|
@@ -51389,7 +51634,7 @@ logsCommand.command("stats").description("Aggregate log stats: totals, counts by
|
|
|
51389
51634
|
const formatCounts = (counts) => {
|
|
51390
51635
|
const entries = Object.entries(counts);
|
|
51391
51636
|
if (entries.length === 0) return "(none)";
|
|
51392
|
-
return entries.map(([
|
|
51637
|
+
return entries.map(([k, v2]) => `${k}=${v2}`).join(", ");
|
|
51393
51638
|
};
|
|
51394
51639
|
if (!isTTY(options) || options.json) {
|
|
51395
51640
|
try {
|
|
@@ -52709,8 +52954,8 @@ var dispatchCommand = new Command15("dispatch").description("Execute a flow or a
|
|
|
52709
52954
|
}
|
|
52710
52955
|
if (options.variable && options.variable.length > 0) {
|
|
52711
52956
|
const variables = {};
|
|
52712
|
-
for (const
|
|
52713
|
-
const [key, ...rest] =
|
|
52957
|
+
for (const v2 of options.variable) {
|
|
52958
|
+
const [key, ...rest] = v2.split("=");
|
|
52714
52959
|
variables[key] = rest.join("=");
|
|
52715
52960
|
}
|
|
52716
52961
|
payload.variables = variables;
|
|
@@ -53322,7 +53567,7 @@ function buildToolPreview(params) {
|
|
|
53322
53567
|
function pushRawEvent(eventsRef, type, data, writer, listData) {
|
|
53323
53568
|
const event = { timestamp: Date.now(), type, data, ...listData ? { listData } : {} };
|
|
53324
53569
|
if (writer?.current) {
|
|
53325
|
-
const
|
|
53570
|
+
const w2 = writer.current;
|
|
53326
53571
|
const jsonlEvent = {
|
|
53327
53572
|
timestamp: event.timestamp,
|
|
53328
53573
|
type: event.type,
|
|
@@ -53330,7 +53575,7 @@ function pushRawEvent(eventsRef, type, data, writer, listData) {
|
|
|
53330
53575
|
};
|
|
53331
53576
|
queueMicrotask(() => {
|
|
53332
53577
|
try {
|
|
53333
|
-
|
|
53578
|
+
w2(jsonlEvent);
|
|
53334
53579
|
} catch {
|
|
53335
53580
|
}
|
|
53336
53581
|
});
|
|
@@ -56559,7 +56804,7 @@ function BlinkingTextInput({
|
|
|
56559
56804
|
return;
|
|
56560
56805
|
}
|
|
56561
56806
|
blinkRef.current = setInterval(() => {
|
|
56562
|
-
setBlinkVisible((
|
|
56807
|
+
setBlinkVisible((v2) => !v2);
|
|
56563
56808
|
}, CURSOR_BLINK_MS);
|
|
56564
56809
|
return () => {
|
|
56565
56810
|
if (blinkRef.current) {
|
|
@@ -57099,8 +57344,8 @@ function TextArea({
|
|
|
57099
57344
|
const separator = theme21.separator ?? " \xB7 ";
|
|
57100
57345
|
const [lines, setLines] = useState24(() => splitLines(defaultValue));
|
|
57101
57346
|
const [cursor, setCursor] = useState24(() => {
|
|
57102
|
-
const
|
|
57103
|
-
return { line:
|
|
57347
|
+
const l = splitLines(defaultValue);
|
|
57348
|
+
return { line: l.length - 1, col: l[l.length - 1].length };
|
|
57104
57349
|
});
|
|
57105
57350
|
const [scrollOffset, setScrollOffset] = useState24(0);
|
|
57106
57351
|
const [blinkVisible, setBlinkVisible] = useState24(true);
|
|
@@ -57111,7 +57356,7 @@ function TextArea({
|
|
|
57111
57356
|
cursorRef.current = cursor;
|
|
57112
57357
|
useEffect21(() => {
|
|
57113
57358
|
blinkRef.current = setInterval(() => {
|
|
57114
|
-
setBlinkVisible((
|
|
57359
|
+
setBlinkVisible((v2) => !v2);
|
|
57115
57360
|
}, CURSOR_BLINK_MS);
|
|
57116
57361
|
return () => {
|
|
57117
57362
|
if (blinkRef.current) {
|
|
@@ -58069,11 +58314,11 @@ function compactRawStreamEventForCopy(event) {
|
|
|
58069
58314
|
data = JSON.parse(JSON.stringify(event.listData, stringCompactionReplacer));
|
|
58070
58315
|
} else {
|
|
58071
58316
|
data = {};
|
|
58072
|
-
for (const [
|
|
58073
|
-
if (STREAM_EVENT_HEAVY_KEYS.has(
|
|
58074
|
-
data[
|
|
58317
|
+
for (const [k, v2] of Object.entries(event.data)) {
|
|
58318
|
+
if (STREAM_EVENT_HEAVY_KEYS.has(k)) {
|
|
58319
|
+
data[k] = compactHeavyField(v2);
|
|
58075
58320
|
} else {
|
|
58076
|
-
data[
|
|
58321
|
+
data[k] = compactJsonLike(v2);
|
|
58077
58322
|
}
|
|
58078
58323
|
}
|
|
58079
58324
|
}
|
|
@@ -65914,10 +66159,10 @@ modelsCommand.command("available").description("List all available models groupe
|
|
|
65914
66159
|
const group = item;
|
|
65915
66160
|
return React18.createElement(EntityCard, {
|
|
65916
66161
|
title: `${group.provider} / ${group.baseModel}`,
|
|
65917
|
-
fields: group.variants.map((
|
|
65918
|
-
label:
|
|
65919
|
-
value:
|
|
65920
|
-
color:
|
|
66162
|
+
fields: group.variants.map((v2) => ({
|
|
66163
|
+
label: v2.modelId,
|
|
66164
|
+
value: v2.configured ? "configured" : "available",
|
|
66165
|
+
color: v2.configured ? "green" : void 0
|
|
65921
66166
|
}))
|
|
65922
66167
|
});
|
|
65923
66168
|
},
|
|
@@ -67238,10 +67483,10 @@ apiKeysCommand.command("list").description("List your API keys").option("--json"
|
|
|
67238
67483
|
total,
|
|
67239
67484
|
emptyMessage: "No API keys found",
|
|
67240
67485
|
renderCard: (item) => {
|
|
67241
|
-
const
|
|
67242
|
-
const prefix =
|
|
67243
|
-
const lastUsed =
|
|
67244
|
-
return React21.createElement(Text35, null, ` ${
|
|
67486
|
+
const k = item;
|
|
67487
|
+
const prefix = k.prefix ? ` (${k.prefix}...)` : "";
|
|
67488
|
+
const lastUsed = k.lastUsedAt ? ` last used: ${k.lastUsedAt}` : "";
|
|
67489
|
+
return React21.createElement(Text35, null, ` ${k.id} ${k.name}${prefix}${lastUsed}`);
|
|
67245
67490
|
}
|
|
67246
67491
|
});
|
|
67247
67492
|
};
|
|
@@ -67801,8 +68046,8 @@ clientTokensCommand.command("create").description("Create a new client token").r
|
|
|
67801
68046
|
console.log(` Token: ${chalk30.yellow(data.token)}`);
|
|
67802
68047
|
if (data.warnings?.length > 0) {
|
|
67803
68048
|
console.log("");
|
|
67804
|
-
for (const
|
|
67805
|
-
console.log(chalk30.yellow(` \u26A0 ${
|
|
68049
|
+
for (const w2 of data.warnings) {
|
|
68050
|
+
console.log(chalk30.yellow(` \u26A0 ${w2.message}`));
|
|
67806
68051
|
}
|
|
67807
68052
|
}
|
|
67808
68053
|
}
|
|
@@ -67830,8 +68075,8 @@ clientTokensCommand.command("create").description("Create a new client token").r
|
|
|
67830
68075
|
{ label: "Token", value: data.token, color: "yellow" }
|
|
67831
68076
|
];
|
|
67832
68077
|
if (data.warnings?.length > 0) {
|
|
67833
|
-
for (const
|
|
67834
|
-
fields.push({ label: "Warning", value:
|
|
68078
|
+
for (const w2 of data.warnings) {
|
|
68079
|
+
fields.push({ label: "Warning", value: w2.message, color: "yellow" });
|
|
67835
68080
|
}
|
|
67836
68081
|
}
|
|
67837
68082
|
setResultNode(React22.createElement(EntityCard, { fields }));
|
|
@@ -68022,16 +68267,16 @@ import { execFileSync } from "child_process";
|
|
|
68022
68267
|
// src/lib/persona-init.ts
|
|
68023
68268
|
init_credential_store();
|
|
68024
68269
|
|
|
68025
|
-
// ../../node_modules/.pnpm/@runtypelabs+persona@4.
|
|
68026
|
-
var
|
|
68027
|
-
var c =
|
|
68270
|
+
// ../../node_modules/.pnpm/@runtypelabs+persona@4.8.0/node_modules/@runtypelabs/persona/dist/codegen.js
|
|
68271
|
+
var w = "4.8.0";
|
|
68272
|
+
var c = w;
|
|
68028
68273
|
function u(e) {
|
|
68029
|
-
if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((
|
|
68274
|
+
if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((i) => i.toString()).join(", ")}]` : e.toString();
|
|
68030
68275
|
}
|
|
68031
|
-
function
|
|
68276
|
+
function P(e) {
|
|
68032
68277
|
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) };
|
|
68033
68278
|
}
|
|
68034
|
-
var
|
|
68279
|
+
var S = `({ text, message }: any) => {
|
|
68035
68280
|
const jsonSource = (message as any).rawContent || text || message.content;
|
|
68036
68281
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
68037
68282
|
let cleanJson = jsonSource
|
|
@@ -68045,7 +68290,7 @@ var x = `({ text, message }: any) => {
|
|
|
68045
68290
|
} catch (e) { return null; }
|
|
68046
68291
|
return null;
|
|
68047
68292
|
}`;
|
|
68048
|
-
var
|
|
68293
|
+
var x = `function(ctx) {
|
|
68049
68294
|
var jsonSource = ctx.message.rawContent || ctx.text || ctx.message.content;
|
|
68050
68295
|
if (!jsonSource || typeof jsonSource !== 'string') return null;
|
|
68051
68296
|
var cleanJson = jsonSource
|
|
@@ -68059,7 +68304,7 @@ var A = `function(ctx) {
|
|
|
68059
68304
|
} catch (e) { return null; }
|
|
68060
68305
|
return null;
|
|
68061
68306
|
}`;
|
|
68062
|
-
var
|
|
68307
|
+
var A = `(action: any, context: any) => {
|
|
68063
68308
|
if (action.type !== 'nav_then_click') return;
|
|
68064
68309
|
const payload = action.payload || action.raw || {};
|
|
68065
68310
|
const url = payload?.page;
|
|
@@ -68077,7 +68322,7 @@ var j = `(action: any, context: any) => {
|
|
|
68077
68322
|
window.location.href = targetUrl;
|
|
68078
68323
|
return { handled: true, displayText: text };
|
|
68079
68324
|
}`;
|
|
68080
|
-
var
|
|
68325
|
+
var j = `function(action, context) {
|
|
68081
68326
|
if (action.type !== 'nav_then_click') return;
|
|
68082
68327
|
var payload = action.payload || action.raw || {};
|
|
68083
68328
|
var url = payload.page;
|
|
@@ -68095,136 +68340,134 @@ var O = `function(action, context) {
|
|
|
68095
68340
|
window.location.href = targetUrl;
|
|
68096
68341
|
return { handled: true, displayText: text };
|
|
68097
68342
|
}`;
|
|
68098
|
-
var
|
|
68343
|
+
var v = `(parsed: any) => {
|
|
68099
68344
|
if (!parsed || typeof parsed !== 'object') return null;
|
|
68100
68345
|
if (parsed.action === 'nav_then_click') return 'Navigating...';
|
|
68101
68346
|
if (parsed.action === 'message') return parsed.text || '';
|
|
68102
68347
|
if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
|
|
68103
68348
|
return parsed.text || null;
|
|
68104
68349
|
}`;
|
|
68105
|
-
var
|
|
68350
|
+
var I = `function(parsed) {
|
|
68106
68351
|
if (!parsed || typeof parsed !== 'object') return null;
|
|
68107
68352
|
if (parsed.action === 'nav_then_click') return 'Navigating...';
|
|
68108
68353
|
if (parsed.action === 'message') return parsed.text || '';
|
|
68109
68354
|
if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
|
|
68110
68355
|
return parsed.text || null;
|
|
68111
68356
|
}`;
|
|
68112
|
-
function
|
|
68357
|
+
function _(e) {
|
|
68113
68358
|
if (!e) return null;
|
|
68114
|
-
let
|
|
68115
|
-
return
|
|
68359
|
+
let i = e.toString();
|
|
68360
|
+
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;
|
|
68116
68361
|
}
|
|
68117
|
-
function
|
|
68118
|
-
|
|
68119
|
-
return (n = (r = e.parserType) != null ? r : M(e.streamParser)) != null ? n : "plain";
|
|
68362
|
+
function g(e) {
|
|
68363
|
+
return e.parserType ?? _(e.streamParser) ?? "plain";
|
|
68120
68364
|
}
|
|
68121
|
-
function m(e,
|
|
68365
|
+
function m(e, i) {
|
|
68122
68366
|
let n = [];
|
|
68123
|
-
return e.toolCall && (n.push(`${
|
|
68124
|
-
typeof o == "string" && n.push(`${
|
|
68125
|
-
}), n.push(`${
|
|
68367
|
+
return e.toolCall && (n.push(`${i}toolCall: {`), Object.entries(e.toolCall).forEach(([s, o]) => {
|
|
68368
|
+
typeof o == "string" && n.push(`${i} ${s}: "${o}",`);
|
|
68369
|
+
}), n.push(`${i}},`)), n;
|
|
68126
68370
|
}
|
|
68127
|
-
function f(e,
|
|
68128
|
-
let s = [], o = e.messageActions && Object.entries(e.messageActions).some(([
|
|
68129
|
-
return (o || t) && (s.push(`${
|
|
68130
|
-
|
|
68131
|
-
}), n
|
|
68371
|
+
function f(e, i, n) {
|
|
68372
|
+
let s = [], o = e.messageActions && Object.entries(e.messageActions).some(([r, a]) => r !== "onFeedback" && r !== "onCopy" && a !== void 0), t = n?.onFeedback || n?.onCopy;
|
|
68373
|
+
return (o || t) && (s.push(`${i}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([r, a]) => {
|
|
68374
|
+
r === "onFeedback" || r === "onCopy" || (typeof a == "string" ? s.push(`${i} ${r}: "${a}",`) : typeof a == "boolean" && s.push(`${i} ${r}: ${a},`));
|
|
68375
|
+
}), n?.onFeedback && s.push(`${i} onFeedback: ${n.onFeedback},`), n?.onCopy && s.push(`${i} onCopy: ${n.onCopy},`), s.push(`${i}},`)), s;
|
|
68132
68376
|
}
|
|
68133
|
-
function y(e,
|
|
68377
|
+
function y(e, i) {
|
|
68134
68378
|
let n = [];
|
|
68135
68379
|
if (e.markdown) {
|
|
68136
68380
|
let s = e.markdown.options && Object.keys(e.markdown.options).length > 0, o = e.markdown.disableDefaultStyles !== void 0;
|
|
68137
|
-
(s || o) && (n.push(`${
|
|
68138
|
-
typeof
|
|
68139
|
-
}), n.push(`${
|
|
68381
|
+
(s || o) && (n.push(`${i}markdown: {`), s && (n.push(`${i} options: {`), Object.entries(e.markdown.options).forEach(([t, r]) => {
|
|
68382
|
+
typeof r == "string" ? n.push(`${i} ${t}: "${r}",`) : typeof r == "boolean" && n.push(`${i} ${t}: ${r},`);
|
|
68383
|
+
}), n.push(`${i} },`)), o && n.push(`${i} disableDefaultStyles: ${e.markdown.disableDefaultStyles},`), n.push(`${i}},`));
|
|
68140
68384
|
}
|
|
68141
68385
|
return n;
|
|
68142
68386
|
}
|
|
68143
|
-
function C(e,
|
|
68387
|
+
function C(e, i) {
|
|
68144
68388
|
let n = [];
|
|
68145
68389
|
if (e.layout) {
|
|
68146
68390
|
let s = e.layout.header && Object.keys(e.layout.header).some((t) => t !== "render"), o = e.layout.messages && Object.keys(e.layout.messages).some((t) => t !== "renderUserMessage" && t !== "renderAssistantMessage");
|
|
68147
|
-
(s || o) && (n.push(`${
|
|
68148
|
-
t !== "render" && (typeof
|
|
68149
|
-
}), n.push(`${
|
|
68150
|
-
t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof
|
|
68151
|
-
typeof p == "string" ? n.push(`${
|
|
68152
|
-
}), n.push(`${
|
|
68153
|
-
p !== "format" && (typeof
|
|
68154
|
-
}), n.push(`${
|
|
68155
|
-
}), n.push(`${
|
|
68391
|
+
(s || o) && (n.push(`${i}layout: {`), s && (n.push(`${i} header: {`), Object.entries(e.layout.header).forEach(([t, r]) => {
|
|
68392
|
+
t !== "render" && (typeof r == "string" ? n.push(`${i} ${t}: "${r}",`) : typeof r == "boolean" && n.push(`${i} ${t}: ${r},`));
|
|
68393
|
+
}), n.push(`${i} },`)), o && (n.push(`${i} messages: {`), Object.entries(e.layout.messages).forEach(([t, r]) => {
|
|
68394
|
+
t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof r == "object" && r !== null ? (n.push(`${i} avatar: {`), Object.entries(r).forEach(([a, p]) => {
|
|
68395
|
+
typeof p == "string" ? n.push(`${i} ${a}: "${p}",`) : typeof p == "boolean" && n.push(`${i} ${a}: ${p},`);
|
|
68396
|
+
}), n.push(`${i} },`)) : t === "timestamp" && typeof r == "object" && r !== null ? Object.entries(r).some(([p]) => p !== "format") && (n.push(`${i} timestamp: {`), Object.entries(r).forEach(([p, l]) => {
|
|
68397
|
+
p !== "format" && (typeof l == "string" ? n.push(`${i} ${p}: "${l}",`) : typeof l == "boolean" && n.push(`${i} ${p}: ${l},`));
|
|
68398
|
+
}), n.push(`${i} },`)) : typeof r == "string" ? n.push(`${i} ${t}: "${r}",`) : typeof r == "boolean" && n.push(`${i} ${t}: ${r},`));
|
|
68399
|
+
}), n.push(`${i} },`)), n.push(`${i}},`));
|
|
68156
68400
|
}
|
|
68157
68401
|
return n;
|
|
68158
68402
|
}
|
|
68159
|
-
function $(e,
|
|
68403
|
+
function $(e, i) {
|
|
68160
68404
|
let n = [];
|
|
68161
|
-
return e && (e.getHeaders && n.push(`${
|
|
68405
|
+
return e && (e.getHeaders && n.push(`${i}getHeaders: ${e.getHeaders},`), e.requestMiddleware && n.push(`${i}requestMiddleware: ${e.requestMiddleware},`), e.actionParsers && n.push(`${i}actionParsers: ${e.actionParsers},`), e.actionHandlers && n.push(`${i}actionHandlers: ${e.actionHandlers},`), e.contextProviders && n.push(`${i}contextProviders: ${e.contextProviders},`), e.streamParser && n.push(`${i}streamParser: ${e.streamParser},`)), n;
|
|
68162
68406
|
}
|
|
68163
|
-
function
|
|
68164
|
-
Object.entries(
|
|
68407
|
+
function O(e, i, n) {
|
|
68408
|
+
Object.entries(i).forEach(([s, o]) => {
|
|
68165
68409
|
if (!(o === void 0 || typeof o == "function")) {
|
|
68166
68410
|
if (Array.isArray(o)) {
|
|
68167
68411
|
e.push(`${n}${s}: ${JSON.stringify(o)},`);
|
|
68168
68412
|
return;
|
|
68169
68413
|
}
|
|
68170
68414
|
if (o && typeof o == "object") {
|
|
68171
|
-
e.push(`${n}${s}: {`),
|
|
68415
|
+
e.push(`${n}${s}: {`), O(e, o, `${n} `), e.push(`${n}},`);
|
|
68172
68416
|
return;
|
|
68173
68417
|
}
|
|
68174
68418
|
e.push(`${n}${s}: ${JSON.stringify(o)},`);
|
|
68175
68419
|
}
|
|
68176
68420
|
});
|
|
68177
68421
|
}
|
|
68178
|
-
function
|
|
68179
|
-
n && (e.push(`${s}${
|
|
68422
|
+
function d(e, i, n, s) {
|
|
68423
|
+
n && (e.push(`${s}${i}: {`), O(e, n, `${s} `), e.push(`${s}},`));
|
|
68180
68424
|
}
|
|
68181
|
-
function
|
|
68182
|
-
|
|
68183
|
-
return ((r = e == null ? void 0 : e.target) != null ? r : "body").replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
68425
|
+
function h(e) {
|
|
68426
|
+
return (e?.target ?? "body").replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
68184
68427
|
}
|
|
68185
|
-
function
|
|
68428
|
+
function T(e, i = "esm", n) {
|
|
68186
68429
|
let s = { ...e };
|
|
68187
68430
|
delete s.postprocessMessage, delete s.initialMessages;
|
|
68188
|
-
let o = n ? { ...n, hooks:
|
|
68189
|
-
return
|
|
68190
|
-
}
|
|
68191
|
-
function
|
|
68192
|
-
let n =
|
|
68193
|
-
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}",`), o && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 &&
|
|
68194
|
-
t.push(` ${
|
|
68195
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([
|
|
68196
|
-
typeof a == "string" ? t.push(` ${
|
|
68197
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([
|
|
68198
|
-
typeof a == "string" ? t.push(` ${
|
|
68199
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([
|
|
68200
|
-
typeof a == "string" ? t.push(` ${
|
|
68201
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([
|
|
68202
|
-
t.push(` ${
|
|
68203
|
-
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((
|
|
68204
|
-
t.push(` "${
|
|
68205
|
-
}), 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
|
|
68431
|
+
let o = n ? { ...n, hooks: P(n.hooks) } : void 0;
|
|
68432
|
+
return i === "esm" ? M(s, o) : i === "script-installer" ? H(s, o) : i === "script-advanced" ? D(s, o) : i === "react-component" ? R(s, o) : i === "react-advanced" ? W(s, o) : N(s, o);
|
|
68433
|
+
}
|
|
68434
|
+
function M(e, i) {
|
|
68435
|
+
let n = i?.hooks, s = g(e), o = s !== "plain", t = ["import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "", "initAgentWidget({", ` target: '${h(i)}',`, " config: {"];
|
|
68436
|
+
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}",`), o && 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, a]) => {
|
|
68437
|
+
t.push(` ${r}: "${a}",`);
|
|
68438
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, a]) => {
|
|
68439
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" && t.push(` ${r}: ${a},`);
|
|
68440
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, a]) => {
|
|
68441
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" ? t.push(` ${r}: ${a},`) : typeof a == "number" && t.push(` ${r}: ${a},`);
|
|
68442
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, a]) => {
|
|
68443
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" && t.push(` ${r}: ${a},`);
|
|
68444
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, a]) => {
|
|
68445
|
+
t.push(` ${r}: ${a},`);
|
|
68446
|
+
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68447
|
+
t.push(` "${r}",`);
|
|
68448
|
+
}), 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(`
|
|
68206
68449
|
`);
|
|
68207
68450
|
}
|
|
68208
|
-
function
|
|
68209
|
-
let n =
|
|
68210
|
-
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}",`), o && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 &&
|
|
68211
|
-
t.push(` ${
|
|
68212
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([
|
|
68213
|
-
typeof a == "string" ? t.push(` ${
|
|
68214
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([
|
|
68215
|
-
typeof a == "string" ? t.push(` ${
|
|
68216
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([
|
|
68217
|
-
typeof a == "string" ? t.push(` ${
|
|
68218
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([
|
|
68219
|
-
t.push(` ${
|
|
68220
|
-
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((
|
|
68221
|
-
t.push(` "${
|
|
68222
|
-
}), 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
|
|
68451
|
+
function R(e, i) {
|
|
68452
|
+
let n = i?.hooks, s = g(e), o = 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: '${h(i)}',`, " config: {"];
|
|
68453
|
+
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}",`), o && 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, a]) => {
|
|
68454
|
+
t.push(` ${r}: "${a}",`);
|
|
68455
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, a]) => {
|
|
68456
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" && t.push(` ${r}: ${a},`);
|
|
68457
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, a]) => {
|
|
68458
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" ? t.push(` ${r}: ${a},`) : typeof a == "number" && t.push(` ${r}: ${a},`);
|
|
68459
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, a]) => {
|
|
68460
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" && t.push(` ${r}: ${a},`);
|
|
68461
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, a]) => {
|
|
68462
|
+
t.push(` ${r}: ${a},`);
|
|
68463
|
+
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68464
|
+
t.push(` "${r}",`);
|
|
68465
|
+
}), 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.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(`
|
|
68223
68466
|
`);
|
|
68224
68467
|
}
|
|
68225
|
-
function
|
|
68226
|
-
let n =
|
|
68227
|
-
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 &&
|
|
68468
|
+
function W(e, i) {
|
|
68469
|
+
let n = 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: '${h(i)}',`, " config: {"];
|
|
68470
|
+
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(([o, t]) => {
|
|
68228
68471
|
s.push(` ${o}: "${t}",`);
|
|
68229
68472
|
}), s.push(" },")), e.sendButton && (s.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([o, t]) => {
|
|
68230
68473
|
typeof t == "string" ? s.push(` ${o}: "${t}",`) : typeof t == "boolean" && s.push(` ${o}: ${t},`);
|
|
@@ -68236,78 +68479,77 @@ function k(e, r) {
|
|
|
68236
68479
|
s.push(` ${o}: ${t},`);
|
|
68237
68480
|
}), s.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((o) => {
|
|
68238
68481
|
s.push(` "${o}",`);
|
|
68239
|
-
}), 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(...m(e, " ")), s.push(...f(e, " ", n)), s.push(...y(e, " ")), s.push(...C(e, " ")), n
|
|
68482
|
+
}), 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(...m(e, " ")), s.push(...f(e, " ", n)), s.push(...y(e, " ")), s.push(...C(e, " ")), n?.getHeaders && s.push(` getHeaders: ${n.getHeaders},`), n?.contextProviders && s.push(` contextProviders: ${n.contextProviders},`), e.debug && s.push(` debug: ${e.debug},`), s.push(" initialMessages: loadSavedMessages(),"), n?.streamParser ? s.push(` streamParser: ${n.streamParser},`) : (s.push(" // Flexible JSON stream parser for handling structured actions"), s.push(` streamParser: () => createFlexibleJsonStreamParser(${v}),`)), n?.actionParsers ? (s.push(" // Action parsers (custom merged with defaults)"), s.push(` actionParsers: [...(${n.actionParsers}), defaultJsonActionParser,`), s.push(" // Built-in parser for markdown-wrapped JSON"), s.push(` ${S}`), 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(` ${S}`), s.push(" ],")), n?.actionHandlers ? (s.push(" // Action handlers (custom merged with defaults)"), s.push(` actionHandlers: [...(${n.actionHandlers}),`), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Built-in handler for nav_then_click action"), s.push(` ${A}`), 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(` ${A}`), s.push(" ],")), n?.postprocessMessage ? s.push(` postprocessMessage: ${n.postprocessMessage},`) : s.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text),"), n?.requestMiddleware ? (s.push(" // Request middleware (custom merged with DOM context)"), s.push(" requestMiddleware: ({ payload, config }) => {"), s.push(` const customResult = (${n.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(`
|
|
68240
68483
|
`);
|
|
68241
68484
|
}
|
|
68242
|
-
function
|
|
68243
|
-
|
|
68244
|
-
|
|
68245
|
-
|
|
68246
|
-
|
|
68247
|
-
|
|
68248
|
-
|
|
68249
|
-
}), Object.keys(t).length > 0 && (s.toolCall = t);
|
|
68485
|
+
function E(e) {
|
|
68486
|
+
let i = g(e), n = i !== "plain", s = {};
|
|
68487
|
+
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), n && (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) {
|
|
68488
|
+
let o = {};
|
|
68489
|
+
Object.entries(e.toolCall).forEach(([t, r]) => {
|
|
68490
|
+
typeof r == "string" && (o[t] = r);
|
|
68491
|
+
}), Object.keys(o).length > 0 && (s.toolCall = o);
|
|
68250
68492
|
}
|
|
68251
68493
|
if (e.messageActions) {
|
|
68252
|
-
let
|
|
68253
|
-
Object.entries(e.messageActions).forEach(([
|
|
68254
|
-
|
|
68255
|
-
}), Object.keys(
|
|
68494
|
+
let o = {};
|
|
68495
|
+
Object.entries(e.messageActions).forEach(([t, r]) => {
|
|
68496
|
+
t !== "onFeedback" && t !== "onCopy" && r !== void 0 && (typeof r == "string" || typeof r == "boolean") && (o[t] = r);
|
|
68497
|
+
}), Object.keys(o).length > 0 && (s.messageActions = o);
|
|
68256
68498
|
}
|
|
68257
68499
|
if (e.markdown) {
|
|
68258
|
-
let
|
|
68259
|
-
e.markdown.options && (
|
|
68500
|
+
let o = {};
|
|
68501
|
+
e.markdown.options && (o.options = e.markdown.options), e.markdown.disableDefaultStyles !== void 0 && (o.disableDefaultStyles = e.markdown.disableDefaultStyles), Object.keys(o).length > 0 && (s.markdown = o);
|
|
68260
68502
|
}
|
|
68261
68503
|
if (e.layout) {
|
|
68262
|
-
let
|
|
68504
|
+
let o = {};
|
|
68263
68505
|
if (e.layout.header) {
|
|
68264
|
-
let
|
|
68265
|
-
Object.entries(e.layout.header).forEach(([
|
|
68266
|
-
|
|
68267
|
-
}), Object.keys(
|
|
68506
|
+
let t = {};
|
|
68507
|
+
Object.entries(e.layout.header).forEach(([r, a]) => {
|
|
68508
|
+
r !== "render" && (typeof a == "string" || typeof a == "boolean") && (t[r] = a);
|
|
68509
|
+
}), Object.keys(t).length > 0 && (o.header = t);
|
|
68268
68510
|
}
|
|
68269
68511
|
if (e.layout.messages) {
|
|
68270
|
-
let
|
|
68271
|
-
Object.entries(e.layout.messages).forEach(([
|
|
68272
|
-
if (
|
|
68273
|
-
else if (
|
|
68274
|
-
let
|
|
68275
|
-
Object.entries(
|
|
68276
|
-
|
|
68277
|
-
}), Object.keys(
|
|
68278
|
-
} else (typeof
|
|
68279
|
-
}), Object.keys(
|
|
68280
|
-
}
|
|
68281
|
-
Object.keys(
|
|
68512
|
+
let t = {};
|
|
68513
|
+
Object.entries(e.layout.messages).forEach(([r, a]) => {
|
|
68514
|
+
if (r !== "renderUserMessage" && r !== "renderAssistantMessage") if (r === "avatar" && typeof a == "object" && a !== null) t.avatar = a;
|
|
68515
|
+
else if (r === "timestamp" && typeof a == "object" && a !== null) {
|
|
68516
|
+
let p = {};
|
|
68517
|
+
Object.entries(a).forEach(([l, b]) => {
|
|
68518
|
+
l !== "format" && (typeof b == "string" || typeof b == "boolean") && (p[l] = b);
|
|
68519
|
+
}), Object.keys(p).length > 0 && (t.timestamp = p);
|
|
68520
|
+
} else (typeof a == "string" || typeof a == "boolean") && (t[r] = a);
|
|
68521
|
+
}), Object.keys(t).length > 0 && (o.messages = t);
|
|
68522
|
+
}
|
|
68523
|
+
Object.keys(o).length > 0 && (s.layout = o);
|
|
68282
68524
|
}
|
|
68283
68525
|
return s;
|
|
68284
68526
|
}
|
|
68285
|
-
function
|
|
68286
|
-
let n =
|
|
68527
|
+
function H(e, i) {
|
|
68528
|
+
let n = E(e), o = !!(i?.windowKey || i?.target) ? { config: n, ...i?.windowKey ? { windowKey: i.windowKey } : {}, ...i?.target ? { target: i.target } : {} } : n, t = JSON.stringify(o, null, 0).replace(/'/g, "'");
|
|
68287
68529
|
return `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/install.global.js" data-config='${t}'></script>`;
|
|
68288
68530
|
}
|
|
68289
|
-
function
|
|
68290
|
-
let n =
|
|
68291
|
-
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}",`), o && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 &&
|
|
68292
|
-
t.push(` ${
|
|
68293
|
-
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([
|
|
68294
|
-
typeof a == "string" ? t.push(` ${
|
|
68295
|
-
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([
|
|
68296
|
-
typeof a == "string" ? t.push(` ${
|
|
68297
|
-
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([
|
|
68298
|
-
typeof a == "string" ? t.push(` ${
|
|
68299
|
-
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([
|
|
68300
|
-
t.push(` ${
|
|
68301
|
-
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((
|
|
68302
|
-
t.push(` "${
|
|
68303
|
-
}), 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
|
|
68531
|
+
function N(e, i) {
|
|
68532
|
+
let n = i?.hooks, s = g(e), o = s !== "plain", t = ["<!-- Load CSS -->", `<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/widget.css" />`, "", "<!-- Load JavaScript -->", `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/index.global.js"></script>`, "", "<!-- Initialize widget -->", "<script>", " var handle = window.AgentWidget.initAgentWidget({", ` target: '${h(i)}',`, ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: {"];
|
|
68533
|
+
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}",`), o && 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, a]) => {
|
|
68534
|
+
t.push(` ${r}: "${a}",`);
|
|
68535
|
+
}), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([r, a]) => {
|
|
68536
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" && t.push(` ${r}: ${a},`);
|
|
68537
|
+
}), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([r, a]) => {
|
|
68538
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" ? t.push(` ${r}: ${a},`) : typeof a == "number" && t.push(` ${r}: ${a},`);
|
|
68539
|
+
}), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([r, a]) => {
|
|
68540
|
+
typeof a == "string" ? t.push(` ${r}: "${a}",`) : typeof a == "boolean" && t.push(` ${r}: ${a},`);
|
|
68541
|
+
}), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([r, a]) => {
|
|
68542
|
+
t.push(` ${r}: ${a},`);
|
|
68543
|
+
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((r) => {
|
|
68544
|
+
t.push(` "${r}",`);
|
|
68545
|
+
}), 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(`
|
|
68304
68546
|
`);
|
|
68305
68547
|
}
|
|
68306
|
-
function
|
|
68307
|
-
let n =
|
|
68308
|
-
`).map((
|
|
68548
|
+
function D(e, i) {
|
|
68549
|
+
let n = i?.hooks, s = E(e), t = ["<script>", "(function() {", " 'use strict';", "", " // Configuration", ` var CONFIG = ${JSON.stringify(s, null, 2).split(`
|
|
68550
|
+
`).map((r, a) => a === 0 ? r : " " + r).join(`
|
|
68309
68551
|
`)};`, "", " // Constants", ` var CDN_BASE = 'https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist';`, " 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);", ""];
|
|
68310
|
-
return n
|
|
68552
|
+
return n?.getHeaders && (t.push(` widgetConfig.getHeaders = ${n.getHeaders};`), t.push("")), n?.contextProviders && (t.push(` widgetConfig.contextProviders = ${n.contextProviders};`), t.push("")), n?.streamParser ? t.push(` widgetConfig.streamParser = ${n.streamParser};`) : (t.push(" // Flexible JSON stream parser for handling structured actions"), t.push(" widgetConfig.streamParser = function() {"), t.push(` return agentWidget.createFlexibleJsonStreamParser(${I});`), t.push(" };")), t.push(""), n?.actionParsers ? (t.push(" // Action parsers (custom merged with defaults)"), t.push(` var customParsers = ${n.actionParsers};`), t.push(" widgetConfig.actionParsers = customParsers.concat(["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${x}`), t.push(" ]);")) : (t.push(" // Action parsers to detect JSON actions in responses"), t.push(" widgetConfig.actionParsers = ["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${x}`), t.push(" ];")), t.push(""), n?.actionHandlers ? (t.push(" // Action handlers (custom merged with defaults)"), t.push(` var customHandlers = ${n.actionHandlers};`), t.push(" widgetConfig.actionHandlers = customHandlers.concat(["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${j}`), 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(` ${j}`), t.push(" ];")), t.push(""), n?.requestMiddleware ? (t.push(" // Request middleware (custom merged with DOM context)"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(` var customResult = (${n.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(""), n?.postprocessMessage ? t.push(` widgetConfig.postprocessMessage = ${n.postprocessMessage};`) : (t.push(" // Markdown postprocessor"), t.push(" widgetConfig.postprocessMessage = function(ctx) {"), t.push(" return agentWidget.markdownPostprocessor(ctx.text);"), t.push(" };")), t.push(""), (n?.onFeedback || n?.onCopy) && (t.push(" // Message action callbacks"), t.push(" widgetConfig.messageActions = widgetConfig.messageActions || {};"), n?.onFeedback && t.push(` widgetConfig.messageActions.onFeedback = ${n.onFeedback};`), n?.onCopy && t.push(` widgetConfig.messageActions.onCopy = ${n.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: '${h(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(`
|
|
68311
68553
|
`);
|
|
68312
68554
|
}
|
|
68313
68555
|
|
|
@@ -68347,14 +68589,14 @@ function buildWidgetConfig(input) {
|
|
|
68347
68589
|
function generatePersonaInitSnippet(input, personaFormat) {
|
|
68348
68590
|
const widgetConfig = buildWidgetConfig(input);
|
|
68349
68591
|
const target = input.targetSelector?.trim();
|
|
68350
|
-
return
|
|
68592
|
+
return T(
|
|
68351
68593
|
widgetConfig,
|
|
68352
68594
|
personaFormat,
|
|
68353
68595
|
target ? { target } : void 0
|
|
68354
68596
|
);
|
|
68355
68597
|
}
|
|
68356
68598
|
function getPersonaInstallerScriptUrl() {
|
|
68357
|
-
const snippet =
|
|
68599
|
+
const snippet = T(
|
|
68358
68600
|
{
|
|
68359
68601
|
apiUrl: "https://api.runtype.com",
|
|
68360
68602
|
clientToken: "ct_test_demo_00000000000000000000000000000000",
|
|
@@ -69316,8 +69558,8 @@ Dashboard: ${initial.dashboardUrl}`));
|
|
|
69316
69558
|
}
|
|
69317
69559
|
}
|
|
69318
69560
|
if (initial.warnings?.length) {
|
|
69319
|
-
for (const
|
|
69320
|
-
console.log(chalk31.yellow(`\u26A0 ${
|
|
69561
|
+
for (const w2 of initial.warnings) {
|
|
69562
|
+
console.log(chalk31.yellow(`\u26A0 ${w2.message}`));
|
|
69321
69563
|
}
|
|
69322
69564
|
}
|
|
69323
69565
|
if (demo) {
|
|
@@ -69775,8 +70017,8 @@ Dashboard: ${output.dashboardUrl}`));
|
|
|
69775
70017
|
);
|
|
69776
70018
|
}
|
|
69777
70019
|
if (success2.warnings?.length) {
|
|
69778
|
-
for (const
|
|
69779
|
-
console.log(chalk31.yellow(`\u26A0 ${
|
|
70020
|
+
for (const w2 of success2.warnings) {
|
|
70021
|
+
console.log(chalk31.yellow(`\u26A0 ${w2.message}`));
|
|
69780
70022
|
}
|
|
69781
70023
|
}
|
|
69782
70024
|
if (!demoOutput) {
|
|
@@ -70204,11 +70446,11 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
|
|
|
70204
70446
|
return;
|
|
70205
70447
|
}
|
|
70206
70448
|
console.log(chalk34.cyan(`Versions for flow ${flowId}:`));
|
|
70207
|
-
for (const
|
|
70208
|
-
const publishedTag =
|
|
70209
|
-
const versionNum =
|
|
70210
|
-
const date5 =
|
|
70211
|
-
console.log(` ${chalk34.green(
|
|
70449
|
+
for (const v2 of versions) {
|
|
70450
|
+
const publishedTag = v2.published ? chalk34.green(" [published]") : "";
|
|
70451
|
+
const versionNum = v2.version !== void 0 ? `v${v2.version}` : v2.id;
|
|
70452
|
+
const date5 = v2.createdAt ? chalk34.gray(` ${v2.createdAt}`) : "";
|
|
70453
|
+
console.log(` ${chalk34.green(v2.id)} ${versionNum}${publishedTag}${date5}`);
|
|
70212
70454
|
}
|
|
70213
70455
|
}
|
|
70214
70456
|
} catch (error51) {
|
|
@@ -70243,10 +70485,10 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
|
|
|
70243
70485
|
loading,
|
|
70244
70486
|
emptyMessage: "No versions found",
|
|
70245
70487
|
renderCard: (item) => {
|
|
70246
|
-
const
|
|
70247
|
-
const publishedTag =
|
|
70248
|
-
const versionNum =
|
|
70249
|
-
return React25.createElement(Text38, null, ` ${
|
|
70488
|
+
const v2 = item;
|
|
70489
|
+
const publishedTag = v2.published ? " [published]" : "";
|
|
70490
|
+
const versionNum = v2.version !== void 0 ? `v${v2.version}` : v2.id;
|
|
70491
|
+
return React25.createElement(Text38, null, ` ${v2.id} ${versionNum}${publishedTag}${v2.createdAt ? ` ${v2.createdAt}` : ""}`);
|
|
70250
70492
|
}
|
|
70251
70493
|
});
|
|
70252
70494
|
};
|
|
@@ -70461,12 +70703,12 @@ agentVersionsCommand.command("list <agentId>").description("List all versions fo
|
|
|
70461
70703
|
return;
|
|
70462
70704
|
}
|
|
70463
70705
|
console.log(chalk35.cyan(`Versions for agent ${agentId}:`));
|
|
70464
|
-
for (const
|
|
70465
|
-
const isPublished =
|
|
70706
|
+
for (const v2 of versions) {
|
|
70707
|
+
const isPublished = v2.id === data.publishedVersionId;
|
|
70466
70708
|
const liveTag = isPublished ? chalk35.green(" [live]") : "";
|
|
70467
|
-
const versionLabel =
|
|
70468
|
-
const date5 =
|
|
70469
|
-
console.log(` ${chalk35.green(
|
|
70709
|
+
const versionLabel = v2.label || (v2.versionNumber !== void 0 ? `v${v2.versionNumber}` : v2.id);
|
|
70710
|
+
const date5 = v2.createdAt ? chalk35.gray(` ${v2.createdAt}`) : "";
|
|
70711
|
+
console.log(` ${chalk35.green(v2.id)} ${versionLabel}${liveTag}${date5}`);
|
|
70470
70712
|
}
|
|
70471
70713
|
}
|
|
70472
70714
|
} catch (error51) {
|
|
@@ -70503,13 +70745,13 @@ agentVersionsCommand.command("list <agentId>").description("List all versions fo
|
|
|
70503
70745
|
loading,
|
|
70504
70746
|
emptyMessage: "No versions found",
|
|
70505
70747
|
renderCard: (item) => {
|
|
70506
|
-
const
|
|
70507
|
-
const liveTag =
|
|
70508
|
-
const versionLabel =
|
|
70748
|
+
const v2 = item;
|
|
70749
|
+
const liveTag = v2.id === publishedId ? " [live]" : "";
|
|
70750
|
+
const versionLabel = v2.label || (v2.versionNumber !== void 0 ? `v${v2.versionNumber}` : v2.id);
|
|
70509
70751
|
return React26.createElement(
|
|
70510
70752
|
Text39,
|
|
70511
70753
|
null,
|
|
70512
|
-
` ${
|
|
70754
|
+
` ${v2.id} ${versionLabel}${liveTag}${v2.createdAt ? ` ${v2.createdAt}` : ""}`
|
|
70513
70755
|
);
|
|
70514
70756
|
}
|
|
70515
70757
|
});
|
|
@@ -70722,11 +70964,11 @@ function abbreviateId(id) {
|
|
|
70722
70964
|
return `${prefix}_${suffix.slice(0, 4)}...`;
|
|
70723
70965
|
}
|
|
70724
70966
|
function formatTime(ts) {
|
|
70725
|
-
const
|
|
70726
|
-
const hh = String(
|
|
70727
|
-
const mm = String(
|
|
70728
|
-
const ss = String(
|
|
70729
|
-
const ms = String(
|
|
70967
|
+
const d2 = new Date(ts);
|
|
70968
|
+
const hh = String(d2.getHours()).padStart(2, "0");
|
|
70969
|
+
const mm = String(d2.getMinutes()).padStart(2, "0");
|
|
70970
|
+
const ss = String(d2.getSeconds()).padStart(2, "0");
|
|
70971
|
+
const ms = String(d2.getMilliseconds()).padStart(3, "0");
|
|
70730
70972
|
return `${hh}:${mm}:${ss}.${ms}`;
|
|
70731
70973
|
}
|
|
70732
70974
|
var LEVEL_COLORS = {
|
|
@@ -70746,7 +70988,7 @@ function categoryBadge(category, useColor) {
|
|
|
70746
70988
|
return chalk36.magenta(`[${category}]`);
|
|
70747
70989
|
}
|
|
70748
70990
|
function formatTailData(data) {
|
|
70749
|
-
return Object.entries(data).map(([
|
|
70991
|
+
return Object.entries(data).map(([k, v2]) => `${k}=${typeof v2 === "string" ? v2 : JSON.stringify(v2)}`).join(" ");
|
|
70750
70992
|
}
|
|
70751
70993
|
function formatContextIds(event, useColor) {
|
|
70752
70994
|
const ids = [];
|
|
@@ -70834,9 +71076,9 @@ async function createSession(apiUrl, apiKey, filters) {
|
|
|
70834
71076
|
level: "levels",
|
|
70835
71077
|
category: "categories"
|
|
70836
71078
|
};
|
|
70837
|
-
for (const [
|
|
70838
|
-
if (
|
|
70839
|
-
filter[arrayFields[
|
|
71079
|
+
for (const [k, v2] of Object.entries(filters)) {
|
|
71080
|
+
if (v2 !== void 0 && arrayFields[k]) {
|
|
71081
|
+
filter[arrayFields[k]] = [v2];
|
|
70840
71082
|
}
|
|
70841
71083
|
}
|
|
70842
71084
|
const body = Object.keys(filter).length > 0 ? { filter } : {};
|
|
@@ -70891,7 +71133,7 @@ async function runTail(options) {
|
|
|
70891
71133
|
category: options.category
|
|
70892
71134
|
};
|
|
70893
71135
|
const useColor = options.color;
|
|
70894
|
-
const activeFilters = Object.entries(filters).filter(([,
|
|
71136
|
+
const activeFilters = Object.entries(filters).filter(([, v2]) => v2 !== void 0).map(([k, v2]) => `${k}=${v2}`);
|
|
70895
71137
|
process.stderr.write(
|
|
70896
71138
|
(useColor ? chalk36.gray(
|
|
70897
71139
|
`Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`
|
|
@@ -72087,11 +72329,11 @@ function collectSecretNames(agentDef) {
|
|
|
72087
72329
|
function slugify2(s) {
|
|
72088
72330
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
|
|
72089
72331
|
}
|
|
72090
|
-
var deployCommand = new Command31("deploy").description("Export an agent or flow and scaffold a deployment (cloud-run, cloudflare, or vercel)").option("--agent <id>", "Agent ID to export (may be repeated)", (
|
|
72091
|
-
acc.push(
|
|
72332
|
+
var deployCommand = new Command31("deploy").description("Export an agent or flow and scaffold a deployment (cloud-run, cloudflare, or vercel)").option("--agent <id>", "Agent ID to export (may be repeated)", (v2, acc) => {
|
|
72333
|
+
acc.push(v2);
|
|
72092
72334
|
return acc;
|
|
72093
|
-
}, []).option("--flow <id>", "Flow ID to export (may be repeated)", (
|
|
72094
|
-
acc.push(
|
|
72335
|
+
}, []).option("--flow <id>", "Flow ID to export (may be repeated)", (v2, acc) => {
|
|
72336
|
+
acc.push(v2);
|
|
72095
72337
|
return acc;
|
|
72096
72338
|
}, []).option("--output <dir>", "Output directory for the scaffold (default: ./runtype-deploy)", "./runtype-deploy").option("--name <name>", "Project name used in package.json (default: derived from output dir)").option("--target <target>", "Deployment target: cloud-run, cloudflare, or vercel (default: cloud-run)", "cloud-run").action(
|
|
72097
72339
|
async (options) => {
|