@runtypelabs/cli 2.22.2 → 2.22.4
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 +629 -164
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1154,7 +1154,7 @@ function $constructor(name, initializer3, params) {
|
|
|
1154
1154
|
Object.defineProperty(inst, "_zod", {
|
|
1155
1155
|
value: {
|
|
1156
1156
|
def,
|
|
1157
|
-
constr:
|
|
1157
|
+
constr: _2,
|
|
1158
1158
|
traits: /* @__PURE__ */ new Set()
|
|
1159
1159
|
},
|
|
1160
1160
|
enumerable: false
|
|
@@ -1165,7 +1165,7 @@ function $constructor(name, initializer3, params) {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
inst._zod.traits.add(name);
|
|
1167
1167
|
initializer3(inst, def);
|
|
1168
|
-
const proto =
|
|
1168
|
+
const proto = _2.prototype;
|
|
1169
1169
|
const keys = Object.keys(proto);
|
|
1170
1170
|
for (let i = 0; i < keys.length; i++) {
|
|
1171
1171
|
const k2 = keys[i];
|
|
@@ -1178,7 +1178,7 @@ function $constructor(name, initializer3, params) {
|
|
|
1178
1178
|
class Definition extends Parent {
|
|
1179
1179
|
}
|
|
1180
1180
|
Object.defineProperty(Definition, "name", { value: name });
|
|
1181
|
-
function
|
|
1181
|
+
function _2(def) {
|
|
1182
1182
|
var _a3;
|
|
1183
1183
|
const inst = params?.Parent ? new Definition() : this;
|
|
1184
1184
|
init(inst, def);
|
|
@@ -1188,16 +1188,16 @@ function $constructor(name, initializer3, params) {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
return inst;
|
|
1190
1190
|
}
|
|
1191
|
-
Object.defineProperty(
|
|
1192
|
-
Object.defineProperty(
|
|
1191
|
+
Object.defineProperty(_2, "init", { value: init });
|
|
1192
|
+
Object.defineProperty(_2, Symbol.hasInstance, {
|
|
1193
1193
|
value: (inst) => {
|
|
1194
1194
|
if (params?.Parent && inst instanceof params.Parent)
|
|
1195
1195
|
return true;
|
|
1196
1196
|
return inst?._zod?.traits?.has(name);
|
|
1197
1197
|
}
|
|
1198
1198
|
});
|
|
1199
|
-
Object.defineProperty(
|
|
1200
|
-
return
|
|
1199
|
+
Object.defineProperty(_2, "name", { value: name });
|
|
1200
|
+
return _2;
|
|
1201
1201
|
}
|
|
1202
1202
|
var $brand = /* @__PURE__ */ Symbol("zod_brand");
|
|
1203
1203
|
var $ZodAsyncError = class extends Error {
|
|
@@ -1297,17 +1297,17 @@ function assertIs(_arg) {
|
|
|
1297
1297
|
function assertNever(_x) {
|
|
1298
1298
|
throw new Error("Unexpected value in exhaustive check");
|
|
1299
1299
|
}
|
|
1300
|
-
function assert(
|
|
1300
|
+
function assert(_2) {
|
|
1301
1301
|
}
|
|
1302
1302
|
function getEnumValues(entries) {
|
|
1303
|
-
const numericValues = Object.values(entries).filter((
|
|
1304
|
-
const values = Object.entries(entries).filter(([k2,
|
|
1303
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
1304
|
+
const values = Object.entries(entries).filter(([k2, _2]) => numericValues.indexOf(+k2) === -1).map(([_2, v]) => v);
|
|
1305
1305
|
return values;
|
|
1306
1306
|
}
|
|
1307
1307
|
function joinValues(array2, separator = "|") {
|
|
1308
1308
|
return array2.map((val) => stringifyPrimitive(val)).join(separator);
|
|
1309
1309
|
}
|
|
1310
|
-
function jsonStringifyReplacer(
|
|
1310
|
+
function jsonStringifyReplacer(_2, value) {
|
|
1311
1311
|
if (typeof value === "bigint")
|
|
1312
1312
|
return value.toString();
|
|
1313
1313
|
return value;
|
|
@@ -1355,9 +1355,9 @@ function defineLazy(object2, key, getter) {
|
|
|
1355
1355
|
}
|
|
1356
1356
|
return value;
|
|
1357
1357
|
},
|
|
1358
|
-
set(
|
|
1358
|
+
set(v) {
|
|
1359
1359
|
Object.defineProperty(object2, key, {
|
|
1360
|
-
value:
|
|
1360
|
+
value: v
|
|
1361
1361
|
// configurable: true,
|
|
1362
1362
|
});
|
|
1363
1363
|
},
|
|
@@ -1432,7 +1432,7 @@ var allowsEval = /* @__PURE__ */ cached(() => {
|
|
|
1432
1432
|
const F2 = Function;
|
|
1433
1433
|
new F2("");
|
|
1434
1434
|
return true;
|
|
1435
|
-
} catch (
|
|
1435
|
+
} catch (_2) {
|
|
1436
1436
|
return false;
|
|
1437
1437
|
}
|
|
1438
1438
|
});
|
|
@@ -1553,31 +1553,31 @@ function normalizeParams(_params) {
|
|
|
1553
1553
|
function createTransparentProxy(getter) {
|
|
1554
1554
|
let target;
|
|
1555
1555
|
return new Proxy({}, {
|
|
1556
|
-
get(
|
|
1556
|
+
get(_2, prop, receiver) {
|
|
1557
1557
|
target ?? (target = getter());
|
|
1558
1558
|
return Reflect.get(target, prop, receiver);
|
|
1559
1559
|
},
|
|
1560
|
-
set(
|
|
1560
|
+
set(_2, prop, value, receiver) {
|
|
1561
1561
|
target ?? (target = getter());
|
|
1562
1562
|
return Reflect.set(target, prop, value, receiver);
|
|
1563
1563
|
},
|
|
1564
|
-
has(
|
|
1564
|
+
has(_2, prop) {
|
|
1565
1565
|
target ?? (target = getter());
|
|
1566
1566
|
return Reflect.has(target, prop);
|
|
1567
1567
|
},
|
|
1568
|
-
deleteProperty(
|
|
1568
|
+
deleteProperty(_2, prop) {
|
|
1569
1569
|
target ?? (target = getter());
|
|
1570
1570
|
return Reflect.deleteProperty(target, prop);
|
|
1571
1571
|
},
|
|
1572
|
-
ownKeys(
|
|
1572
|
+
ownKeys(_2) {
|
|
1573
1573
|
target ?? (target = getter());
|
|
1574
1574
|
return Reflect.ownKeys(target);
|
|
1575
1575
|
},
|
|
1576
|
-
getOwnPropertyDescriptor(
|
|
1576
|
+
getOwnPropertyDescriptor(_2, prop) {
|
|
1577
1577
|
target ?? (target = getter());
|
|
1578
1578
|
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
1579
1579
|
},
|
|
1580
|
-
defineProperty(
|
|
1580
|
+
defineProperty(_2, prop, descriptor) {
|
|
1581
1581
|
target ?? (target = getter());
|
|
1582
1582
|
return Reflect.defineProperty(target, prop, descriptor);
|
|
1583
1583
|
}
|
|
@@ -1869,7 +1869,7 @@ function issue(...args) {
|
|
|
1869
1869
|
return { ...iss };
|
|
1870
1870
|
}
|
|
1871
1871
|
function cleanEnum(obj) {
|
|
1872
|
-
return Object.entries(obj).filter(([k2,
|
|
1872
|
+
return Object.entries(obj).filter(([k2, _2]) => {
|
|
1873
1873
|
return Number.isNaN(Number.parseInt(k2, 10));
|
|
1874
1874
|
}).map((el) => el[1]);
|
|
1875
1875
|
}
|
|
@@ -2928,13 +2928,13 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2928
2928
|
continue;
|
|
2929
2929
|
}
|
|
2930
2930
|
const currLen = payload.issues.length;
|
|
2931
|
-
const
|
|
2932
|
-
if (
|
|
2931
|
+
const _2 = ch._zod.check(payload);
|
|
2932
|
+
if (_2 instanceof Promise && ctx?.async === false) {
|
|
2933
2933
|
throw new $ZodAsyncError();
|
|
2934
2934
|
}
|
|
2935
|
-
if (asyncResult ||
|
|
2935
|
+
if (asyncResult || _2 instanceof Promise) {
|
|
2936
2936
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
2937
|
-
await
|
|
2937
|
+
await _2;
|
|
2938
2938
|
const nextLen = payload.issues.length;
|
|
2939
2939
|
if (nextLen === currLen)
|
|
2940
2940
|
return;
|
|
@@ -2996,7 +2996,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2996
2996
|
try {
|
|
2997
2997
|
const r = safeParse(inst, value);
|
|
2998
2998
|
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
2999
|
-
} catch (
|
|
2999
|
+
} catch (_2) {
|
|
3000
3000
|
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
3001
3001
|
}
|
|
3002
3002
|
},
|
|
@@ -3007,11 +3007,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
3007
3007
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
3008
3008
|
$ZodType.init(inst, def);
|
|
3009
3009
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
3010
|
-
inst._zod.parse = (payload,
|
|
3010
|
+
inst._zod.parse = (payload, _2) => {
|
|
3011
3011
|
if (def.coerce)
|
|
3012
3012
|
try {
|
|
3013
3013
|
payload.value = String(payload.value);
|
|
3014
|
-
} catch (
|
|
3014
|
+
} catch (_3) {
|
|
3015
3015
|
}
|
|
3016
3016
|
if (typeof payload.value === "string")
|
|
3017
3017
|
return payload;
|
|
@@ -3044,10 +3044,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
3044
3044
|
v7: 7,
|
|
3045
3045
|
v8: 8
|
|
3046
3046
|
};
|
|
3047
|
-
const
|
|
3048
|
-
if (
|
|
3047
|
+
const v = versionMap[def.version];
|
|
3048
|
+
if (v === void 0)
|
|
3049
3049
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
3050
|
-
def.pattern ?? (def.pattern = uuid(
|
|
3050
|
+
def.pattern ?? (def.pattern = uuid(v));
|
|
3051
3051
|
} else
|
|
3052
3052
|
def.pattern ?? (def.pattern = uuid());
|
|
3053
3053
|
$ZodStringFormat.init(inst, def);
|
|
@@ -3109,7 +3109,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
3109
3109
|
payload.value = trimmed;
|
|
3110
3110
|
}
|
|
3111
3111
|
return;
|
|
3112
|
-
} catch (
|
|
3112
|
+
} catch (_2) {
|
|
3113
3113
|
payload.issues.push({
|
|
3114
3114
|
code: "invalid_format",
|
|
3115
3115
|
format: "url",
|
|
@@ -3336,7 +3336,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
3336
3336
|
if (def.coerce)
|
|
3337
3337
|
try {
|
|
3338
3338
|
payload.value = Number(payload.value);
|
|
3339
|
-
} catch (
|
|
3339
|
+
} catch (_2) {
|
|
3340
3340
|
}
|
|
3341
3341
|
const input = payload.value;
|
|
3342
3342
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
@@ -3364,7 +3364,7 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
3364
3364
|
if (def.coerce)
|
|
3365
3365
|
try {
|
|
3366
3366
|
payload.value = Boolean(payload.value);
|
|
3367
|
-
} catch (
|
|
3367
|
+
} catch (_2) {
|
|
3368
3368
|
}
|
|
3369
3369
|
const input = payload.value;
|
|
3370
3370
|
if (typeof input === "boolean")
|
|
@@ -3385,7 +3385,7 @@ var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
|
3385
3385
|
if (def.coerce)
|
|
3386
3386
|
try {
|
|
3387
3387
|
payload.value = BigInt(payload.value);
|
|
3388
|
-
} catch (
|
|
3388
|
+
} catch (_2) {
|
|
3389
3389
|
}
|
|
3390
3390
|
if (typeof payload.value === "bigint")
|
|
3391
3391
|
return payload;
|
|
@@ -3652,8 +3652,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3652
3652
|
const field = shape[key]._zod;
|
|
3653
3653
|
if (field.values) {
|
|
3654
3654
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3655
|
-
for (const
|
|
3656
|
-
propValues[key].add(
|
|
3655
|
+
for (const v of field.values)
|
|
3656
|
+
propValues[key].add(v);
|
|
3657
3657
|
}
|
|
3658
3658
|
}
|
|
3659
3659
|
return propValues;
|
|
@@ -3948,10 +3948,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3948
3948
|
const pv = option._zod.propValues;
|
|
3949
3949
|
if (!pv || Object.keys(pv).length === 0)
|
|
3950
3950
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
3951
|
-
for (const [k2,
|
|
3951
|
+
for (const [k2, v] of Object.entries(pv)) {
|
|
3952
3952
|
if (!propValues[k2])
|
|
3953
3953
|
propValues[k2] = /* @__PURE__ */ new Set();
|
|
3954
|
-
for (const val of
|
|
3954
|
+
for (const val of v) {
|
|
3955
3955
|
propValues[k2].add(val);
|
|
3956
3956
|
}
|
|
3957
3957
|
}
|
|
@@ -3965,11 +3965,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3965
3965
|
const values = o._zod.propValues?.[def.discriminator];
|
|
3966
3966
|
if (!values || values.size === 0)
|
|
3967
3967
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
3968
|
-
for (const
|
|
3969
|
-
if (map2.has(
|
|
3970
|
-
throw new Error(`Duplicate discriminator value "${String(
|
|
3968
|
+
for (const v of values) {
|
|
3969
|
+
if (map2.has(v)) {
|
|
3970
|
+
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
3971
3971
|
}
|
|
3972
|
-
map2.set(
|
|
3972
|
+
map2.set(v, o);
|
|
3973
3973
|
}
|
|
3974
3974
|
}
|
|
3975
3975
|
return map2;
|
|
@@ -4604,8 +4604,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
4604
4604
|
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
4605
4605
|
$ZodType.init(inst, def);
|
|
4606
4606
|
defineLazy(inst._zod, "values", () => {
|
|
4607
|
-
const
|
|
4608
|
-
return
|
|
4607
|
+
const v = def.innerType._zod.values;
|
|
4608
|
+
return v ? new Set([...v].filter((x2) => x2 !== void 0)) : void 0;
|
|
4609
4609
|
});
|
|
4610
4610
|
inst._zod.parse = (payload, ctx) => {
|
|
4611
4611
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -4950,7 +4950,7 @@ var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
|
4950
4950
|
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
4951
4951
|
$ZodCheck.init(inst, def);
|
|
4952
4952
|
$ZodType.init(inst, def);
|
|
4953
|
-
inst._zod.parse = (payload,
|
|
4953
|
+
inst._zod.parse = (payload, _2) => {
|
|
4954
4954
|
return payload;
|
|
4955
4955
|
};
|
|
4956
4956
|
inst._zod.check = (payload) => {
|
|
@@ -7002,7 +7002,7 @@ var error17 = () => {
|
|
|
7002
7002
|
if (issue2.values.length === 1) {
|
|
7003
7003
|
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])}`;
|
|
7004
7004
|
}
|
|
7005
|
-
const stringified = issue2.values.map((
|
|
7005
|
+
const stringified = issue2.values.map((v) => stringifyPrimitive(v));
|
|
7006
7006
|
if (issue2.values.length === 2) {
|
|
7007
7007
|
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]}`;
|
|
7008
7008
|
}
|
|
@@ -11757,7 +11757,7 @@ function _set(Class2, valueType, params) {
|
|
|
11757
11757
|
}
|
|
11758
11758
|
// @__NO_SIDE_EFFECTS__
|
|
11759
11759
|
function _enum(Class2, values, params) {
|
|
11760
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
11760
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
11761
11761
|
return new Class2({
|
|
11762
11762
|
type: "enum",
|
|
11763
11763
|
entries,
|
|
@@ -11962,8 +11962,8 @@ function _stringbool(Classes, _params) {
|
|
|
11962
11962
|
let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
|
|
11963
11963
|
let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
|
|
11964
11964
|
if (params.case !== "sensitive") {
|
|
11965
|
-
truthyArray = truthyArray.map((
|
|
11966
|
-
falsyArray = falsyArray.map((
|
|
11965
|
+
truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
|
|
11966
|
+
falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
|
|
11967
11967
|
}
|
|
11968
11968
|
const truthySet = new Set(truthyArray);
|
|
11969
11969
|
const falsySet = new Set(falsyArray);
|
|
@@ -12505,9 +12505,9 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
12505
12505
|
var enumProcessor = (schema, _ctx, json2, _params) => {
|
|
12506
12506
|
const def = schema._zod.def;
|
|
12507
12507
|
const values = getEnumValues(def.entries);
|
|
12508
|
-
if (values.every((
|
|
12508
|
+
if (values.every((v) => typeof v === "number"))
|
|
12509
12509
|
json2.type = "number";
|
|
12510
|
-
if (values.every((
|
|
12510
|
+
if (values.every((v) => typeof v === "string"))
|
|
12511
12511
|
json2.type = "string";
|
|
12512
12512
|
json2.enum = values;
|
|
12513
12513
|
};
|
|
@@ -12540,13 +12540,13 @@ var literalProcessor = (schema, ctx, json2, _params) => {
|
|
|
12540
12540
|
json2.const = val;
|
|
12541
12541
|
}
|
|
12542
12542
|
} else {
|
|
12543
|
-
if (vals.every((
|
|
12543
|
+
if (vals.every((v) => typeof v === "number"))
|
|
12544
12544
|
json2.type = "number";
|
|
12545
|
-
if (vals.every((
|
|
12545
|
+
if (vals.every((v) => typeof v === "string"))
|
|
12546
12546
|
json2.type = "string";
|
|
12547
|
-
if (vals.every((
|
|
12547
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
12548
12548
|
json2.type = "boolean";
|
|
12549
|
-
if (vals.every((
|
|
12549
|
+
if (vals.every((v) => v === null))
|
|
12550
12550
|
json2.type = "null";
|
|
12551
12551
|
json2.enum = vals;
|
|
12552
12552
|
}
|
|
@@ -12644,11 +12644,11 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12644
12644
|
}
|
|
12645
12645
|
const allKeys = new Set(Object.keys(shape));
|
|
12646
12646
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
12647
|
-
const
|
|
12647
|
+
const v = def.shape[key]._zod;
|
|
12648
12648
|
if (ctx.io === "input") {
|
|
12649
|
-
return
|
|
12649
|
+
return v.optin === void 0;
|
|
12650
12650
|
} else {
|
|
12651
|
-
return
|
|
12651
|
+
return v.optout === void 0;
|
|
12652
12652
|
}
|
|
12653
12653
|
}));
|
|
12654
12654
|
if (requiredKeys.size > 0) {
|
|
@@ -12768,7 +12768,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
12768
12768
|
}
|
|
12769
12769
|
const keyValues = keyType._zod.values;
|
|
12770
12770
|
if (keyValues) {
|
|
12771
|
-
const validKeyValues = [...keyValues].filter((
|
|
12771
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
12772
12772
|
if (validKeyValues.length > 0) {
|
|
12773
12773
|
json2.required = validKeyValues;
|
|
12774
12774
|
}
|
|
@@ -12899,7 +12899,7 @@ function toJSONSchema(input, params) {
|
|
|
12899
12899
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
12900
12900
|
const defs = {};
|
|
12901
12901
|
for (const entry of registry2._idmap.entries()) {
|
|
12902
|
-
const [
|
|
12902
|
+
const [_2, schema] = entry;
|
|
12903
12903
|
process2(schema, ctx2);
|
|
12904
12904
|
}
|
|
12905
12905
|
const schemas = {};
|
|
@@ -12998,7 +12998,7 @@ var JSONSchemaGenerator = class {
|
|
|
12998
12998
|
}
|
|
12999
12999
|
extractDefs(this.ctx, schema);
|
|
13000
13000
|
const result = finalize(this.ctx, schema);
|
|
13001
|
-
const { "~standard":
|
|
13001
|
+
const { "~standard": _2, ...plainResult } = result;
|
|
13002
13002
|
return plainResult;
|
|
13003
13003
|
}
|
|
13004
13004
|
};
|
|
@@ -13333,12 +13333,12 @@ function _installLazyMethods(inst, group, methods) {
|
|
|
13333
13333
|
});
|
|
13334
13334
|
return bound;
|
|
13335
13335
|
},
|
|
13336
|
-
set(
|
|
13336
|
+
set(v) {
|
|
13337
13337
|
Object.defineProperty(this, key, {
|
|
13338
13338
|
configurable: true,
|
|
13339
13339
|
writable: true,
|
|
13340
13340
|
enumerable: true,
|
|
13341
|
-
value:
|
|
13341
|
+
value: v
|
|
13342
13342
|
});
|
|
13343
13343
|
}
|
|
13344
13344
|
});
|
|
@@ -14226,7 +14226,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
14226
14226
|
};
|
|
14227
14227
|
});
|
|
14228
14228
|
function _enum2(values, params) {
|
|
14229
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
14229
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
14230
14230
|
return new ZodEnum({
|
|
14231
14231
|
type: "enum",
|
|
14232
14232
|
entries,
|
|
@@ -14778,10 +14778,10 @@ function convertBaseSchema(schema, ctx) {
|
|
|
14778
14778
|
if (enumValues.length === 1) {
|
|
14779
14779
|
return z.literal(enumValues[0]);
|
|
14780
14780
|
}
|
|
14781
|
-
if (enumValues.every((
|
|
14781
|
+
if (enumValues.every((v) => typeof v === "string")) {
|
|
14782
14782
|
return z.enum(enumValues);
|
|
14783
14783
|
}
|
|
14784
|
-
const literalSchemas = enumValues.map((
|
|
14784
|
+
const literalSchemas = enumValues.map((v) => z.literal(v));
|
|
14785
14785
|
if (literalSchemas.length < 2) {
|
|
14786
14786
|
return literalSchemas[0];
|
|
14787
14787
|
}
|
|
@@ -15566,14 +15566,414 @@ function resolveFallback(parsed, context, tracking) {
|
|
|
15566
15566
|
}
|
|
15567
15567
|
var templateEngine = new SimpleTemplateEngine();
|
|
15568
15568
|
|
|
15569
|
-
// ../shared/dist/
|
|
15570
|
-
var
|
|
15571
|
-
var
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15569
|
+
// ../shared/dist/chunk-6KHYBEWY.mjs
|
|
15570
|
+
var tokensSchema = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
|
|
15571
|
+
var wireStopReasonSchema = external_exports.enum([
|
|
15572
|
+
"end_turn",
|
|
15573
|
+
"max_tool_calls",
|
|
15574
|
+
"length",
|
|
15575
|
+
"content_filter",
|
|
15576
|
+
"error",
|
|
15577
|
+
"unknown"
|
|
15578
|
+
]);
|
|
15579
|
+
var unifiedBase = {
|
|
15580
|
+
executionId: external_exports.string(),
|
|
15581
|
+
seq: external_exports.number()
|
|
15582
|
+
};
|
|
15583
|
+
var executionKindSchema = external_exports.enum(["agent", "flow"]);
|
|
15584
|
+
var fallbackAttemptSchema = external_exports.object({
|
|
15585
|
+
attempt: external_exports.number(),
|
|
15586
|
+
type: external_exports.enum(["retry", "model", "message", "flow"]),
|
|
15587
|
+
model: external_exports.string().optional(),
|
|
15588
|
+
success: external_exports.boolean(),
|
|
15589
|
+
error: external_exports.string().optional()
|
|
15590
|
+
});
|
|
15591
|
+
var fallbackInfoSchema = external_exports.object({
|
|
15592
|
+
used: external_exports.boolean(),
|
|
15593
|
+
model: external_exports.string().optional(),
|
|
15594
|
+
attempts: external_exports.array(fallbackAttemptSchema),
|
|
15595
|
+
exhausted: external_exports.boolean(),
|
|
15596
|
+
reason: external_exports.string().nullable().optional()
|
|
15597
|
+
});
|
|
15598
|
+
var unifiedErrorPayloadSchema = external_exports.union([
|
|
15599
|
+
external_exports.string(),
|
|
15600
|
+
external_exports.object({
|
|
15601
|
+
code: external_exports.string(),
|
|
15602
|
+
message: external_exports.string(),
|
|
15603
|
+
details: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
15604
|
+
})
|
|
15605
|
+
]);
|
|
15606
|
+
var unifiedExecutionStartEventSchema = external_exports.object({
|
|
15607
|
+
...unifiedBase,
|
|
15608
|
+
type: external_exports.literal("execution_start"),
|
|
15609
|
+
kind: executionKindSchema,
|
|
15610
|
+
startedAt: external_exports.string(),
|
|
15611
|
+
agentId: external_exports.string().optional(),
|
|
15612
|
+
agentName: external_exports.string().optional(),
|
|
15613
|
+
flowId: external_exports.string().optional(),
|
|
15614
|
+
flowName: external_exports.string().optional(),
|
|
15615
|
+
maxTurns: external_exports.number().optional(),
|
|
15616
|
+
totalSteps: external_exports.number().optional(),
|
|
15617
|
+
source: external_exports.string().optional(),
|
|
15618
|
+
config: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
15619
|
+
});
|
|
15620
|
+
var unifiedExecutionCompleteEventSchema = external_exports.object({
|
|
15621
|
+
...unifiedBase,
|
|
15622
|
+
type: external_exports.literal("execution_complete"),
|
|
15623
|
+
kind: executionKindSchema,
|
|
15624
|
+
success: external_exports.boolean(),
|
|
15625
|
+
completedAt: external_exports.string().optional(),
|
|
15626
|
+
durationMs: external_exports.number().optional(),
|
|
15627
|
+
finalOutput: external_exports.string().optional(),
|
|
15628
|
+
iterations: external_exports.number().optional(),
|
|
15629
|
+
// Loop-level stop reason (agent) or unset (flow). Loose: vocab differs by kind.
|
|
15630
|
+
stopReason: external_exports.string().optional(),
|
|
15631
|
+
totalCost: external_exports.number().optional(),
|
|
15632
|
+
totalTokens: tokensSchema.optional(),
|
|
15633
|
+
totalSteps: external_exports.number().optional(),
|
|
15634
|
+
successfulSteps: external_exports.number().optional(),
|
|
15635
|
+
failedSteps: external_exports.number().optional()
|
|
15636
|
+
});
|
|
15637
|
+
var unifiedExecutionErrorEventSchema = external_exports.object({
|
|
15638
|
+
...unifiedBase,
|
|
15639
|
+
type: external_exports.literal("execution_error"),
|
|
15640
|
+
kind: executionKindSchema,
|
|
15641
|
+
error: unifiedErrorPayloadSchema,
|
|
15642
|
+
completedAt: external_exports.string().optional(),
|
|
15643
|
+
code: external_exports.string().optional(),
|
|
15644
|
+
upgradeUrl: external_exports.string().optional()
|
|
15645
|
+
});
|
|
15646
|
+
var unifiedTurnStartEventSchema = external_exports.object({
|
|
15647
|
+
...unifiedBase,
|
|
15648
|
+
type: external_exports.literal("turn_start"),
|
|
15649
|
+
id: external_exports.string(),
|
|
15650
|
+
iteration: external_exports.number().optional(),
|
|
15651
|
+
turnIndex: external_exports.number().optional(),
|
|
15652
|
+
role: external_exports.enum(["user", "assistant", "system"])
|
|
15653
|
+
});
|
|
15654
|
+
var unifiedTurnCompleteEventSchema = external_exports.object({
|
|
15655
|
+
...unifiedBase,
|
|
15656
|
+
type: external_exports.literal("turn_complete"),
|
|
15657
|
+
id: external_exports.string(),
|
|
15658
|
+
iteration: external_exports.number().optional(),
|
|
15659
|
+
role: external_exports.enum(["user", "assistant", "system"]),
|
|
15660
|
+
content: external_exports.string().optional(),
|
|
15661
|
+
tokens: tokensSchema.optional(),
|
|
15662
|
+
cost: external_exports.number().optional(),
|
|
15663
|
+
stopReason: wireStopReasonSchema.optional(),
|
|
15664
|
+
completedAt: external_exports.string().optional(),
|
|
15665
|
+
fallback: fallbackInfoSchema.optional()
|
|
15666
|
+
});
|
|
15667
|
+
var unifiedStepStartEventSchema = external_exports.object({
|
|
15668
|
+
...unifiedBase,
|
|
15669
|
+
type: external_exports.literal("step_start"),
|
|
15670
|
+
id: external_exports.string(),
|
|
15671
|
+
name: external_exports.string().optional(),
|
|
15672
|
+
stepType: external_exports.string().optional(),
|
|
15673
|
+
index: external_exports.number().optional(),
|
|
15674
|
+
totalSteps: external_exports.number().optional(),
|
|
15675
|
+
startedAt: external_exports.string().optional(),
|
|
15676
|
+
outputVariable: external_exports.string().optional()
|
|
15677
|
+
});
|
|
15678
|
+
var unifiedStepCompleteEventSchema = external_exports.object({
|
|
15679
|
+
...unifiedBase,
|
|
15680
|
+
type: external_exports.literal("step_complete"),
|
|
15681
|
+
id: external_exports.string(),
|
|
15682
|
+
name: external_exports.string().optional(),
|
|
15683
|
+
stepType: external_exports.string().optional(),
|
|
15684
|
+
// `step_error` is folded here as `success:false` (merged spec §3).
|
|
15685
|
+
success: external_exports.boolean().optional(),
|
|
15686
|
+
durationMs: external_exports.number().optional(),
|
|
15687
|
+
result: external_exports.unknown().optional(),
|
|
15688
|
+
stopReason: wireStopReasonSchema.optional(),
|
|
15689
|
+
completedAt: external_exports.string().optional(),
|
|
15690
|
+
error: external_exports.string().optional(),
|
|
15691
|
+
unresolvedVariables: external_exports.array(external_exports.string()).optional(),
|
|
15692
|
+
fallback: fallbackInfoSchema.optional()
|
|
15693
|
+
});
|
|
15694
|
+
var unifiedStepSkipEventSchema = external_exports.object({
|
|
15695
|
+
...unifiedBase,
|
|
15696
|
+
type: external_exports.literal("step_skip"),
|
|
15697
|
+
id: external_exports.string(),
|
|
15698
|
+
name: external_exports.string().optional(),
|
|
15699
|
+
stepType: external_exports.string().optional(),
|
|
15700
|
+
index: external_exports.number().optional(),
|
|
15701
|
+
totalSteps: external_exports.number().optional(),
|
|
15702
|
+
when: external_exports.string().optional(),
|
|
15703
|
+
skippedAt: external_exports.string().optional()
|
|
15704
|
+
});
|
|
15705
|
+
var unifiedTextStartEventSchema = external_exports.object({
|
|
15706
|
+
...unifiedBase,
|
|
15707
|
+
type: external_exports.literal("text_start"),
|
|
15708
|
+
id: external_exports.string(),
|
|
15709
|
+
role: external_exports.enum(["user", "assistant", "system"]).optional(),
|
|
15710
|
+
turnId: external_exports.string().optional(),
|
|
15711
|
+
stepId: external_exports.string().optional()
|
|
15712
|
+
});
|
|
15713
|
+
var unifiedTextDeltaEventSchema = external_exports.object({
|
|
15714
|
+
...unifiedBase,
|
|
15715
|
+
type: external_exports.literal("text_delta"),
|
|
15716
|
+
id: external_exports.string(),
|
|
15717
|
+
delta: external_exports.string()
|
|
15718
|
+
});
|
|
15719
|
+
var unifiedTextCompleteEventSchema = external_exports.object({
|
|
15720
|
+
...unifiedBase,
|
|
15721
|
+
type: external_exports.literal("text_complete"),
|
|
15722
|
+
id: external_exports.string(),
|
|
15723
|
+
text: external_exports.string().optional()
|
|
15724
|
+
});
|
|
15725
|
+
var unifiedReasoningStartEventSchema = external_exports.object({
|
|
15726
|
+
...unifiedBase,
|
|
15727
|
+
type: external_exports.literal("reasoning_start"),
|
|
15728
|
+
id: external_exports.string(),
|
|
15729
|
+
// `scope:"loop"` marks loop-level reflection (E3 fold); default renders as thinking.
|
|
15730
|
+
scope: external_exports.enum(["turn", "loop"]).optional()
|
|
15731
|
+
});
|
|
15732
|
+
var unifiedReasoningDeltaEventSchema = external_exports.object({
|
|
15733
|
+
...unifiedBase,
|
|
15734
|
+
type: external_exports.literal("reasoning_delta"),
|
|
15735
|
+
id: external_exports.string(),
|
|
15736
|
+
delta: external_exports.string()
|
|
15737
|
+
});
|
|
15738
|
+
var unifiedReasoningCompleteEventSchema = external_exports.object({
|
|
15739
|
+
...unifiedBase,
|
|
15740
|
+
type: external_exports.literal("reasoning_complete"),
|
|
15741
|
+
id: external_exports.string(),
|
|
15742
|
+
text: external_exports.string().optional(),
|
|
15743
|
+
scope: external_exports.enum(["turn", "loop"]).optional()
|
|
15744
|
+
});
|
|
15745
|
+
var unifiedMediaStartEventSchema = external_exports.object({
|
|
15746
|
+
...unifiedBase,
|
|
15747
|
+
type: external_exports.literal("media_start"),
|
|
15748
|
+
id: external_exports.string(),
|
|
15749
|
+
mediaType: external_exports.string(),
|
|
15750
|
+
role: external_exports.enum(["user", "assistant", "system"]).optional(),
|
|
15751
|
+
toolCallId: external_exports.string().optional()
|
|
15752
|
+
});
|
|
15753
|
+
var unifiedMediaDeltaEventSchema = external_exports.object({
|
|
15754
|
+
...unifiedBase,
|
|
15755
|
+
type: external_exports.literal("media_delta"),
|
|
15756
|
+
id: external_exports.string(),
|
|
15757
|
+
delta: external_exports.string()
|
|
15758
|
+
});
|
|
15759
|
+
var unifiedMediaCompleteEventSchema = external_exports.object({
|
|
15760
|
+
...unifiedBase,
|
|
15761
|
+
type: external_exports.literal("media_complete"),
|
|
15762
|
+
id: external_exports.string(),
|
|
15763
|
+
mediaType: external_exports.string().optional(),
|
|
15764
|
+
url: external_exports.string().optional(),
|
|
15765
|
+
data: external_exports.string().optional(),
|
|
15766
|
+
toolCallId: external_exports.string().optional()
|
|
15767
|
+
});
|
|
15768
|
+
var unifiedArtifactStartEventSchema = external_exports.object({
|
|
15769
|
+
type: external_exports.literal("artifact_start"),
|
|
15770
|
+
id: external_exports.string(),
|
|
15771
|
+
artifactType: external_exports.enum(["markdown", "component"]),
|
|
15772
|
+
title: external_exports.string().optional(),
|
|
15773
|
+
component: external_exports.string().optional(),
|
|
15774
|
+
executionId: external_exports.string().optional(),
|
|
15775
|
+
seq: external_exports.number().optional()
|
|
15776
|
+
});
|
|
15777
|
+
var unifiedArtifactDeltaEventSchema = external_exports.object({
|
|
15778
|
+
type: external_exports.literal("artifact_delta"),
|
|
15779
|
+
id: external_exports.string(),
|
|
15780
|
+
delta: external_exports.string(),
|
|
15781
|
+
executionId: external_exports.string().optional(),
|
|
15782
|
+
seq: external_exports.number().optional()
|
|
15783
|
+
});
|
|
15784
|
+
var unifiedArtifactUpdateEventSchema = external_exports.object({
|
|
15785
|
+
type: external_exports.literal("artifact_update"),
|
|
15786
|
+
id: external_exports.string(),
|
|
15787
|
+
component: external_exports.string(),
|
|
15788
|
+
props: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
15789
|
+
executionId: external_exports.string().optional(),
|
|
15790
|
+
seq: external_exports.number().optional()
|
|
15791
|
+
});
|
|
15792
|
+
var unifiedArtifactCompleteEventSchema = external_exports.object({
|
|
15793
|
+
type: external_exports.literal("artifact_complete"),
|
|
15794
|
+
id: external_exports.string(),
|
|
15795
|
+
executionId: external_exports.string().optional(),
|
|
15796
|
+
seq: external_exports.number().optional()
|
|
15797
|
+
});
|
|
15798
|
+
var unifiedSourceEventSchema = external_exports.object({
|
|
15799
|
+
...unifiedBase,
|
|
15800
|
+
type: external_exports.literal("source"),
|
|
15801
|
+
id: external_exports.string().optional(),
|
|
15802
|
+
url: external_exports.string().optional(),
|
|
15803
|
+
title: external_exports.string().optional(),
|
|
15804
|
+
sourceType: external_exports.string().optional()
|
|
15805
|
+
}).passthrough();
|
|
15806
|
+
var unifiedToolStartEventSchema = external_exports.object({
|
|
15807
|
+
...unifiedBase,
|
|
15808
|
+
type: external_exports.literal("tool_start"),
|
|
15809
|
+
toolCallId: external_exports.string(),
|
|
15810
|
+
toolName: external_exports.string(),
|
|
15811
|
+
toolType: external_exports.string(),
|
|
15812
|
+
iteration: external_exports.number().optional(),
|
|
15813
|
+
stepId: external_exports.string().optional(),
|
|
15814
|
+
parameters: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
15815
|
+
hiddenParameterNames: external_exports.array(external_exports.string()).optional(),
|
|
15816
|
+
startedAt: external_exports.string().optional(),
|
|
15817
|
+
origin: external_exports.enum(["webmcp", "sdk"]).optional(),
|
|
15818
|
+
pageOrigin: external_exports.string().optional()
|
|
15819
|
+
});
|
|
15820
|
+
var unifiedToolInputDeltaEventSchema = external_exports.object({
|
|
15821
|
+
...unifiedBase,
|
|
15822
|
+
type: external_exports.literal("tool_input_delta"),
|
|
15823
|
+
toolCallId: external_exports.string(),
|
|
15824
|
+
delta: external_exports.string()
|
|
15825
|
+
});
|
|
15826
|
+
var unifiedToolInputCompleteEventSchema = external_exports.object({
|
|
15827
|
+
...unifiedBase,
|
|
15828
|
+
type: external_exports.literal("tool_input_complete"),
|
|
15829
|
+
toolCallId: external_exports.string(),
|
|
15830
|
+
toolName: external_exports.string().optional(),
|
|
15831
|
+
parameters: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
15832
|
+
hiddenParameterNames: external_exports.array(external_exports.string()).optional()
|
|
15833
|
+
});
|
|
15834
|
+
var unifiedToolOutputDeltaEventSchema = external_exports.object({
|
|
15835
|
+
...unifiedBase,
|
|
15836
|
+
type: external_exports.literal("tool_output_delta"),
|
|
15837
|
+
toolCallId: external_exports.string(),
|
|
15838
|
+
delta: external_exports.string()
|
|
15839
|
+
});
|
|
15840
|
+
var unifiedToolCompleteEventSchema = external_exports.object({
|
|
15841
|
+
...unifiedBase,
|
|
15842
|
+
type: external_exports.literal("tool_complete"),
|
|
15843
|
+
toolCallId: external_exports.string(),
|
|
15844
|
+
toolName: external_exports.string().optional(),
|
|
15845
|
+
success: external_exports.boolean(),
|
|
15846
|
+
// `result.kind` ∈ "skill_loaded" | "skill_proposed" folds the skill events (E2 §4a).
|
|
15847
|
+
result: external_exports.unknown().optional(),
|
|
15848
|
+
// `tool_error` is folded here as `success:false` (merged spec §3).
|
|
15849
|
+
error: external_exports.string().optional(),
|
|
15850
|
+
executionTime: external_exports.number().optional(),
|
|
15851
|
+
iteration: external_exports.number().optional(),
|
|
15852
|
+
stepId: external_exports.string().optional()
|
|
15853
|
+
});
|
|
15854
|
+
var unifiedApprovalStartEventSchema = external_exports.object({
|
|
15855
|
+
...unifiedBase,
|
|
15856
|
+
type: external_exports.literal("approval_start"),
|
|
15857
|
+
approvalId: external_exports.string(),
|
|
15858
|
+
toolCallId: external_exports.string().optional(),
|
|
15859
|
+
toolName: external_exports.string(),
|
|
15860
|
+
toolType: external_exports.string().optional(),
|
|
15861
|
+
description: external_exports.string().optional(),
|
|
15862
|
+
// Agent's own claim about intent — UX context, NEVER a control signal.
|
|
15863
|
+
reason: external_exports.string().optional(),
|
|
15864
|
+
parameters: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
15865
|
+
timeout: external_exports.number().optional(),
|
|
15866
|
+
startedAt: external_exports.string().optional(),
|
|
15867
|
+
iteration: external_exports.number().optional()
|
|
15868
|
+
});
|
|
15869
|
+
var unifiedApprovalCompleteEventSchema = external_exports.object({
|
|
15870
|
+
...unifiedBase,
|
|
15871
|
+
type: external_exports.literal("approval_complete"),
|
|
15872
|
+
approvalId: external_exports.string(),
|
|
15873
|
+
decision: external_exports.enum(["approved", "denied", "timeout"]),
|
|
15874
|
+
completedAt: external_exports.string().optional(),
|
|
15875
|
+
resolvedBy: external_exports.enum(["user", "system"]).optional()
|
|
15876
|
+
});
|
|
15877
|
+
var unifiedAwaitEventSchema = external_exports.object({
|
|
15878
|
+
...unifiedBase,
|
|
15879
|
+
type: external_exports.literal("await"),
|
|
15880
|
+
toolId: external_exports.string().optional(),
|
|
15881
|
+
toolCallId: external_exports.string().optional(),
|
|
15882
|
+
toolName: external_exports.string().optional(),
|
|
15883
|
+
parameters: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
15884
|
+
awaitedAt: external_exports.string().optional(),
|
|
15885
|
+
origin: external_exports.enum(["webmcp", "sdk"]).optional(),
|
|
15886
|
+
pageOrigin: external_exports.string().optional()
|
|
15887
|
+
});
|
|
15888
|
+
var unifiedErrorEventSchema = external_exports.object({
|
|
15889
|
+
...unifiedBase,
|
|
15890
|
+
type: external_exports.literal("error"),
|
|
15891
|
+
error: unifiedErrorPayloadSchema,
|
|
15892
|
+
recoverable: external_exports.boolean().optional()
|
|
15893
|
+
});
|
|
15894
|
+
var unifiedPingEventSchema = external_exports.object({
|
|
15895
|
+
...unifiedBase,
|
|
15896
|
+
type: external_exports.literal("ping"),
|
|
15897
|
+
timestamp: external_exports.string()
|
|
15898
|
+
});
|
|
15899
|
+
var unifiedCustomEventSchema = external_exports.object({
|
|
15900
|
+
type: external_exports.literal("custom"),
|
|
15901
|
+
name: external_exports.string(),
|
|
15902
|
+
value: external_exports.unknown(),
|
|
15903
|
+
executionId: external_exports.string().optional(),
|
|
15904
|
+
seq: external_exports.number().optional()
|
|
15905
|
+
});
|
|
15906
|
+
var unifiedSSEEventSchema = external_exports.discriminatedUnion("type", [
|
|
15907
|
+
unifiedExecutionStartEventSchema,
|
|
15908
|
+
unifiedExecutionCompleteEventSchema,
|
|
15909
|
+
unifiedExecutionErrorEventSchema,
|
|
15910
|
+
unifiedTurnStartEventSchema,
|
|
15911
|
+
unifiedTurnCompleteEventSchema,
|
|
15912
|
+
unifiedStepStartEventSchema,
|
|
15913
|
+
unifiedStepCompleteEventSchema,
|
|
15914
|
+
unifiedStepSkipEventSchema,
|
|
15915
|
+
unifiedTextStartEventSchema,
|
|
15916
|
+
unifiedTextDeltaEventSchema,
|
|
15917
|
+
unifiedTextCompleteEventSchema,
|
|
15918
|
+
unifiedReasoningStartEventSchema,
|
|
15919
|
+
unifiedReasoningDeltaEventSchema,
|
|
15920
|
+
unifiedReasoningCompleteEventSchema,
|
|
15921
|
+
unifiedMediaStartEventSchema,
|
|
15922
|
+
unifiedMediaDeltaEventSchema,
|
|
15923
|
+
unifiedMediaCompleteEventSchema,
|
|
15924
|
+
unifiedArtifactStartEventSchema,
|
|
15925
|
+
unifiedArtifactDeltaEventSchema,
|
|
15926
|
+
unifiedArtifactUpdateEventSchema,
|
|
15927
|
+
unifiedArtifactCompleteEventSchema,
|
|
15928
|
+
unifiedSourceEventSchema,
|
|
15929
|
+
unifiedToolStartEventSchema,
|
|
15930
|
+
unifiedToolInputDeltaEventSchema,
|
|
15931
|
+
unifiedToolInputCompleteEventSchema,
|
|
15932
|
+
unifiedToolOutputDeltaEventSchema,
|
|
15933
|
+
unifiedToolCompleteEventSchema,
|
|
15934
|
+
unifiedApprovalStartEventSchema,
|
|
15935
|
+
unifiedApprovalCompleteEventSchema,
|
|
15936
|
+
unifiedAwaitEventSchema,
|
|
15937
|
+
unifiedErrorEventSchema,
|
|
15938
|
+
unifiedPingEventSchema,
|
|
15939
|
+
unifiedCustomEventSchema
|
|
15940
|
+
]);
|
|
15941
|
+
var _unifiedTuple = (types) => types;
|
|
15942
|
+
var UNIFIED_SSE_EVENT_TYPES = _unifiedTuple([
|
|
15943
|
+
"execution_start",
|
|
15944
|
+
"execution_complete",
|
|
15945
|
+
"execution_error",
|
|
15946
|
+
"turn_start",
|
|
15947
|
+
"turn_complete",
|
|
15948
|
+
"step_start",
|
|
15949
|
+
"step_complete",
|
|
15950
|
+
"step_skip",
|
|
15951
|
+
"text_start",
|
|
15952
|
+
"text_delta",
|
|
15953
|
+
"text_complete",
|
|
15954
|
+
"reasoning_start",
|
|
15955
|
+
"reasoning_delta",
|
|
15956
|
+
"reasoning_complete",
|
|
15957
|
+
"media_start",
|
|
15958
|
+
"media_delta",
|
|
15959
|
+
"media_complete",
|
|
15960
|
+
"artifact_start",
|
|
15961
|
+
"artifact_delta",
|
|
15962
|
+
"artifact_update",
|
|
15963
|
+
"artifact_complete",
|
|
15964
|
+
"source",
|
|
15965
|
+
"tool_start",
|
|
15966
|
+
"tool_input_delta",
|
|
15967
|
+
"tool_input_complete",
|
|
15968
|
+
"tool_output_delta",
|
|
15969
|
+
"tool_complete",
|
|
15970
|
+
"approval_start",
|
|
15971
|
+
"approval_complete",
|
|
15972
|
+
"await",
|
|
15973
|
+
"error",
|
|
15974
|
+
"ping",
|
|
15975
|
+
"custom"
|
|
15976
|
+
]);
|
|
15577
15977
|
var mediaAnnotationsSchema = external_exports.object({
|
|
15578
15978
|
audience: external_exports.array(external_exports.enum(["user", "assistant"])).optional()
|
|
15579
15979
|
});
|
|
@@ -15601,8 +16001,8 @@ var externalAgentContextSchema = external_exports.object({
|
|
|
15601
16001
|
contextId: external_exports.string().optional(),
|
|
15602
16002
|
taskId: external_exports.string().optional()
|
|
15603
16003
|
});
|
|
15604
|
-
var
|
|
15605
|
-
var
|
|
16004
|
+
var tokensSchema2 = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
|
|
16005
|
+
var wireStopReasonSchema2 = external_exports.enum([
|
|
15606
16006
|
"end_turn",
|
|
15607
16007
|
"max_tool_calls",
|
|
15608
16008
|
"length",
|
|
@@ -15664,9 +16064,9 @@ var agentTurnCompleteEventSchema = external_exports.object({
|
|
|
15664
16064
|
role: external_exports.enum(["user", "assistant", "system"]),
|
|
15665
16065
|
completedAt: external_exports.string(),
|
|
15666
16066
|
content: external_exports.string().optional(),
|
|
15667
|
-
tokens:
|
|
16067
|
+
tokens: tokensSchema2.optional(),
|
|
15668
16068
|
cost: external_exports.number().optional(),
|
|
15669
|
-
stopReason:
|
|
16069
|
+
stopReason: wireStopReasonSchema2.optional(),
|
|
15670
16070
|
estimatedContextBreakdown: estimatedContextBreakdownSchema.optional()
|
|
15671
16071
|
});
|
|
15672
16072
|
var agentToolStartEventSchema = external_exports.object({
|
|
@@ -15785,7 +16185,7 @@ var agentIterationCompleteEventSchema = external_exports.object({
|
|
|
15785
16185
|
toolCallsMade: external_exports.number(),
|
|
15786
16186
|
cost: external_exports.number().optional(),
|
|
15787
16187
|
runningTotalCost: external_exports.number().optional(),
|
|
15788
|
-
tokens:
|
|
16188
|
+
tokens: tokensSchema2.optional(),
|
|
15789
16189
|
duration: external_exports.number().optional(),
|
|
15790
16190
|
stopConditionMet: external_exports.boolean(),
|
|
15791
16191
|
estimatedContextBreakdown: estimatedContextBreakdownSchema.optional()
|
|
@@ -15834,7 +16234,7 @@ var agentCompleteEventSchema = external_exports.object({
|
|
|
15834
16234
|
stopReason: external_exports.enum(["complete", "end_turn", "max_turns", "max_cost", "timeout", "error"]),
|
|
15835
16235
|
completedAt: external_exports.string(),
|
|
15836
16236
|
totalCost: external_exports.number().optional(),
|
|
15837
|
-
totalTokens:
|
|
16237
|
+
totalTokens: tokensSchema2.optional(),
|
|
15838
16238
|
finalOutput: external_exports.string().optional(),
|
|
15839
16239
|
duration: external_exports.number().optional(),
|
|
15840
16240
|
error: external_exports.string().optional(),
|
|
@@ -16030,7 +16430,7 @@ var stepCompleteEventSchema = external_exports.object({
|
|
|
16030
16430
|
// context steps omit it). Same `wireStopReasonSchema` vocabulary as
|
|
16031
16431
|
// `agentTurnCompleteEventSchema.stopReason`. Persona reads it to attach a
|
|
16032
16432
|
// stop-reason notice to the final assistant message.
|
|
16033
|
-
stopReason:
|
|
16433
|
+
stopReason: wireStopReasonSchema2.optional(),
|
|
16034
16434
|
stepId: external_exports.string().optional(),
|
|
16035
16435
|
stepName: external_exports.string().optional(),
|
|
16036
16436
|
toolContext: toolContextSchema.optional(),
|
|
@@ -16234,6 +16634,16 @@ var artifactSSEEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
16234
16634
|
artifactCompleteEventSchema,
|
|
16235
16635
|
artifactSingleEventSchema
|
|
16236
16636
|
]);
|
|
16637
|
+
var UNIFIED_SSE_EVENT_TYPE_SET = new Set(UNIFIED_SSE_EVENT_TYPES);
|
|
16638
|
+
|
|
16639
|
+
// ../shared/dist/index.mjs
|
|
16640
|
+
var FORMULA_TRIGGER = /^[=+\-@\t\r\n]/;
|
|
16641
|
+
var STRICT_NUMBER = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
|
|
16642
|
+
function neutralizeCsvFormula(value) {
|
|
16643
|
+
if (!FORMULA_TRIGGER.test(value)) return value;
|
|
16644
|
+
if (STRICT_NUMBER.test(value)) return value;
|
|
16645
|
+
return `'${value}`;
|
|
16646
|
+
}
|
|
16237
16647
|
var AGENT_CONTENT_CONFIG_KEYS = {
|
|
16238
16648
|
model: true,
|
|
16239
16649
|
systemPrompt: true,
|
|
@@ -20938,6 +21348,49 @@ var runtimeArtifactManifestSchema = external_exports.object({
|
|
|
20938
21348
|
reasons: external_exports.array(runtimeArtifactEligibilityReasonSchema)
|
|
20939
21349
|
})
|
|
20940
21350
|
});
|
|
21351
|
+
var edgeAuthSnapshotSchema = external_exports.object({
|
|
21352
|
+
/**
|
|
21353
|
+
* Schema version. A plain positive int (not a literal) so a consumer pinned
|
|
21354
|
+
* to v1 can still parse a future v(N) record whose only delta is additive
|
|
21355
|
+
* optional fields. Producer writes {@link EDGE_AUTH_SNAPSHOT_SCHEMA_VERSION}.
|
|
21356
|
+
*/
|
|
21357
|
+
schemaVersion: external_exports.number().int().positive(),
|
|
21358
|
+
/** Resolved Runtype user id (`user_…`). */
|
|
21359
|
+
userId: external_exports.string().min(1),
|
|
21360
|
+
/** Resolved org id (`org_…`); null for a personal (no-org) credential. */
|
|
21361
|
+
orgId: external_exports.string().min(1).nullable(),
|
|
21362
|
+
/** Effective permission scopes for the credential (e.g. `["*"]`). */
|
|
21363
|
+
scopes: external_exports.array(external_exports.string()),
|
|
21364
|
+
/**
|
|
21365
|
+
* Test credential? Normalized across types: API key → prefix-derived
|
|
21366
|
+
* `isTestKey`; client token → `environment === 'test'`. The consumer routes
|
|
21367
|
+
* test credentials to the API (never the edge fast path).
|
|
21368
|
+
*/
|
|
21369
|
+
isTestKey: external_exports.boolean(),
|
|
21370
|
+
/**
|
|
21371
|
+
* Mirror of the platform-key spend ceiling (`getPlatformKeyAccessStatus`'s
|
|
21372
|
+
* `blocked`, per-org). A best-effort copy bounded by the record's short TTL;
|
|
21373
|
+
* the authoritative spend gate stays on the API path.
|
|
21374
|
+
*/
|
|
21375
|
+
spendExceeded: external_exports.boolean(),
|
|
21376
|
+
/**
|
|
21377
|
+
* Demotion backstop (decision D): when true the edge must fall back to the
|
|
21378
|
+
* API. Always `false` from the producer; flipped asynchronously by the
|
|
21379
|
+
* control plane (out of scope for the write-through producer).
|
|
21380
|
+
*/
|
|
21381
|
+
forceFallback: external_exports.boolean(),
|
|
21382
|
+
/**
|
|
21383
|
+
* Credential expiry as epoch MILLISECONDS (same unit as the signed-context
|
|
21384
|
+
* `exp`), or `null` for no expiry. The edge MUST reject a record whose
|
|
21385
|
+
* `expiresAt <= now` even on a KV hit: the producer also caps the KV TTL at
|
|
21386
|
+
* the remaining lifetime, but KV's 60s minimum TTL means a near-expiry record
|
|
21387
|
+
* can briefly outlive the credential, so the field is the precise gate.
|
|
21388
|
+
* Optional for additive-compat with records written before this field existed
|
|
21389
|
+
* (a v1 consumer treats an absent value as "no expiry recorded"). API keys
|
|
21390
|
+
* populate it from their `expiresAt`; client tokens have no expiry (null).
|
|
21391
|
+
*/
|
|
21392
|
+
expiresAt: external_exports.number().int().positive().nullable().optional()
|
|
21393
|
+
});
|
|
20941
21394
|
var EMIT_ARTIFACT_MARKDOWN_TOOL_ID = "emit_artifact_markdown";
|
|
20942
21395
|
var EMIT_ARTIFACT_COMPONENT_TOOL_ID = "emit_artifact_component";
|
|
20943
21396
|
var EMIT_ARTIFACT_MARKDOWN_FULL_ID = `builtin:${EMIT_ARTIFACT_MARKDOWN_TOOL_ID}`;
|
|
@@ -36807,7 +37260,10 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
|
|
|
36807
37260
|
// NVIDIA Nemotron Ultra (reasoning + tool-use flagship, routed via Vercel)
|
|
36808
37261
|
{ provider: "runtype", modelId: "nemotron-3-ultra-550b-a55b", isDefault: false },
|
|
36809
37262
|
// Google models (routed via Cloudflare Workers AI)
|
|
36810
|
-
{ provider: "runtype", modelId: "gemma-4-26b-a4b-it", isDefault: false }
|
|
37263
|
+
{ provider: "runtype", modelId: "gemma-4-26b-a4b-it", isDefault: false },
|
|
37264
|
+
// Z.ai GLM-5.2 (agentic coding flagship, routed via Cloudflare Workers AI,
|
|
37265
|
+
// Vercel fallback). The bare routed name resolves to `@cf/zai-org/glm-5.2`.
|
|
37266
|
+
{ provider: "runtype", modelId: "glm-5.2", isDefault: false }
|
|
36811
37267
|
];
|
|
36812
37268
|
var DEFAULT_MODEL_ID = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.find((m2) => m2.isDefault)?.modelId ?? "kimi-k2.6";
|
|
36813
37269
|
var userProfileFeaturesSchema = external_exports.object({
|
|
@@ -37241,12 +37697,18 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
37241
37697
|
"togetherai": "togetherai/zai-org/GLM-5.1",
|
|
37242
37698
|
"vercel": "zai/glm-5.1"
|
|
37243
37699
|
},
|
|
37700
|
+
"glm-5-2": {
|
|
37701
|
+
"vercel": "zai/glm-5.2"
|
|
37702
|
+
},
|
|
37244
37703
|
"glm-5-turbo": {
|
|
37245
37704
|
"vercel": "zai/glm-5-turbo"
|
|
37246
37705
|
},
|
|
37247
37706
|
"glm-5.1": {
|
|
37248
37707
|
"vercel": "zai/glm-5.1"
|
|
37249
37708
|
},
|
|
37709
|
+
"glm-5.2": {
|
|
37710
|
+
"vercel": "zai/glm-5.2"
|
|
37711
|
+
},
|
|
37250
37712
|
"glm-5v-turbo": {
|
|
37251
37713
|
"vercel": "zai/glm-5v-turbo"
|
|
37252
37714
|
},
|
|
@@ -37623,8 +38085,8 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
37623
38085
|
"vercel": "moonshotai/kimi-k2.6"
|
|
37624
38086
|
},
|
|
37625
38087
|
"kimi-k2-7-code": {
|
|
37626
|
-
"
|
|
37627
|
-
"
|
|
38088
|
+
"mixlayer": "moonshotai/kimi-k2.7-code",
|
|
38089
|
+
"togetherai": "togetherai/moonshotai/Kimi-K2.7-Code"
|
|
37628
38090
|
},
|
|
37629
38091
|
"kimi-k2-7-code-highspeed": {
|
|
37630
38092
|
"vercel": "moonshotai/kimi-k2.7-code-highspeed"
|
|
@@ -37639,7 +38101,7 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
37639
38101
|
"vercel": "moonshotai/kimi-k2.6"
|
|
37640
38102
|
},
|
|
37641
38103
|
"kimi-k2.7-code": {
|
|
37642
|
-
"
|
|
38104
|
+
"mixlayer": "moonshotai/kimi-k2.7-code"
|
|
37643
38105
|
},
|
|
37644
38106
|
"kimi-k2.7-code-highspeed": {
|
|
37645
38107
|
"vercel": "moonshotai/kimi-k2.7-code-highspeed"
|
|
@@ -38450,7 +38912,7 @@ var PLATFORM_KEY_PROVIDER_MAP = {
|
|
|
38450
38912
|
"mock": false
|
|
38451
38913
|
};
|
|
38452
38914
|
var PLATFORM_KEY_PROVIDERS = new Set(
|
|
38453
|
-
Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([,
|
|
38915
|
+
Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v]) => v).map(([k2]) => k2)
|
|
38454
38916
|
);
|
|
38455
38917
|
var MANUAL_PROVIDER_MAP_OVERRIDES = {
|
|
38456
38918
|
// Bedrock uses different model ID format
|
|
@@ -38494,6 +38956,9 @@ var MANUAL_PROVIDER_MAP_OVERRIDES = {
|
|
|
38494
38956
|
"gpt-oss-120b": {
|
|
38495
38957
|
"workers-ai": "@cf/openai/gpt-oss-120b"
|
|
38496
38958
|
},
|
|
38959
|
+
"glm-5.2": {
|
|
38960
|
+
"workers-ai": "@cf/zai-org/glm-5.2"
|
|
38961
|
+
},
|
|
38497
38962
|
// MiniMax M2.7: explicit provider IDs for the GC-primary / Vercel-fallback route.
|
|
38498
38963
|
// `general-compute` is NOT in PROVIDERS_WITHOUT_PREFIX, so resolveRoutedFamily
|
|
38499
38964
|
// prepends `general-compute/` itself — store the BARE id here to avoid a double
|
|
@@ -39524,18 +39989,18 @@ function extractSecretReferencesFromAnyValue(value, maxDepth = 10) {
|
|
|
39524
39989
|
const keys = /* @__PURE__ */ new Set();
|
|
39525
39990
|
walk(value, 0);
|
|
39526
39991
|
return Array.from(keys);
|
|
39527
|
-
function walk(
|
|
39992
|
+
function walk(v, depth) {
|
|
39528
39993
|
if (depth > maxDepth) return;
|
|
39529
|
-
if (typeof
|
|
39530
|
-
for (const key of extractSecretReferences(
|
|
39994
|
+
if (typeof v === "string") {
|
|
39995
|
+
for (const key of extractSecretReferences(v)) keys.add(key);
|
|
39531
39996
|
return;
|
|
39532
39997
|
}
|
|
39533
|
-
if (Array.isArray(
|
|
39534
|
-
for (const item of
|
|
39998
|
+
if (Array.isArray(v)) {
|
|
39999
|
+
for (const item of v) walk(item, depth + 1);
|
|
39535
40000
|
return;
|
|
39536
40001
|
}
|
|
39537
|
-
if (
|
|
39538
|
-
for (const inner of Object.values(
|
|
40002
|
+
if (v && typeof v === "object") {
|
|
40003
|
+
for (const inner of Object.values(v)) {
|
|
39539
40004
|
walk(inner, depth + 1);
|
|
39540
40005
|
}
|
|
39541
40006
|
}
|
|
@@ -39772,7 +40237,7 @@ var capabilitySchema = external_exports.object({
|
|
|
39772
40237
|
}).refine(
|
|
39773
40238
|
(cap) => {
|
|
39774
40239
|
const set2 = [cap.flow, cap.agent, cap.existingFlowId, cap.existingAgentId].filter(
|
|
39775
|
-
(
|
|
40240
|
+
(v) => v !== void 0 && v !== null
|
|
39776
40241
|
);
|
|
39777
40242
|
return set2.length === 1;
|
|
39778
40243
|
},
|
|
@@ -40191,7 +40656,7 @@ function validateCapability(cap, index, context) {
|
|
|
40191
40656
|
const result = emptyResult();
|
|
40192
40657
|
const base = `capabilities[${index}]`;
|
|
40193
40658
|
const backings = [cap.flow, cap.agent, cap.existingFlowId, cap.existingAgentId].filter(
|
|
40194
|
-
(
|
|
40659
|
+
(v) => v !== void 0 && v !== null
|
|
40195
40660
|
);
|
|
40196
40661
|
if (backings.length === 0) {
|
|
40197
40662
|
result.errors.push(
|
|
@@ -46092,8 +46557,8 @@ configCommand.command("get [key]").description("Get configuration value").action
|
|
|
46092
46557
|
const allConfig = config2.store;
|
|
46093
46558
|
if (Object.keys(allConfig).length > 0) {
|
|
46094
46559
|
console.log(chalk9.cyan("Current Configuration:"));
|
|
46095
|
-
for (const [k2,
|
|
46096
|
-
console.log(` ${chalk9.green(k2)}: ${
|
|
46560
|
+
for (const [k2, v] of Object.entries(allConfig)) {
|
|
46561
|
+
console.log(` ${chalk9.green(k2)}: ${v}`);
|
|
46097
46562
|
}
|
|
46098
46563
|
} else {
|
|
46099
46564
|
console.log(chalk9.gray("No configuration set"));
|
|
@@ -47661,7 +48126,7 @@ logsCommand.command("stats").description("Aggregate log stats: totals, counts by
|
|
|
47661
48126
|
const formatCounts = (counts) => {
|
|
47662
48127
|
const entries = Object.entries(counts);
|
|
47663
48128
|
if (entries.length === 0) return "(none)";
|
|
47664
|
-
return entries.map(([k2,
|
|
48129
|
+
return entries.map(([k2, v]) => `${k2}=${v}`).join(", ");
|
|
47665
48130
|
};
|
|
47666
48131
|
if (!isTTY(options) || options.json) {
|
|
47667
48132
|
try {
|
|
@@ -48974,8 +49439,8 @@ var dispatchCommand = new Command14("dispatch").description("Execute a flow or a
|
|
|
48974
49439
|
}
|
|
48975
49440
|
if (options.variable && options.variable.length > 0) {
|
|
48976
49441
|
const variables = {};
|
|
48977
|
-
for (const
|
|
48978
|
-
const [key, ...rest] =
|
|
49442
|
+
for (const v of options.variable) {
|
|
49443
|
+
const [key, ...rest] = v.split("=");
|
|
48979
49444
|
variables[key] = rest.join("=");
|
|
48980
49445
|
}
|
|
48981
49446
|
payload.variables = variables;
|
|
@@ -50562,7 +51027,7 @@ function Scrollbar({ totalLines, visibleLines, scrollOffset, height }) {
|
|
|
50562
51027
|
const clampedOffset = Math.min(scrollOffset, maxScroll);
|
|
50563
51028
|
const thumbSize = Math.max(1, Math.round(visibleLines / totalLines * height));
|
|
50564
51029
|
const thumbStart = maxScroll > 0 ? Math.round(clampedOffset / maxScroll * (height - thumbSize)) : 0;
|
|
50565
|
-
return /* @__PURE__ */ jsx11(Box10, { flexDirection: "column", marginLeft: 1, children: Array.from({ length: height }, (
|
|
51030
|
+
return /* @__PURE__ */ jsx11(Box10, { flexDirection: "column", marginLeft: 1, children: Array.from({ length: height }, (_2, i) => {
|
|
50566
51031
|
const isThumb = i >= thumbStart && i < thumbStart + thumbSize;
|
|
50567
51032
|
return /* @__PURE__ */ jsx11(Text12, { color: isThumb ? theme12.textMuted : theme12.border, children: isThumb ? "\u2588" : "\u2502" }, i);
|
|
50568
51033
|
}) });
|
|
@@ -52824,7 +53289,7 @@ function BlinkingTextInput({
|
|
|
52824
53289
|
return;
|
|
52825
53290
|
}
|
|
52826
53291
|
blinkRef.current = setInterval(() => {
|
|
52827
|
-
setBlinkVisible((
|
|
53292
|
+
setBlinkVisible((v) => !v);
|
|
52828
53293
|
}, CURSOR_BLINK_MS);
|
|
52829
53294
|
return () => {
|
|
52830
53295
|
if (blinkRef.current) {
|
|
@@ -53122,7 +53587,7 @@ function ModelPicker({ currentModel, onSelect, onCancel, models }) {
|
|
|
53122
53587
|
/* @__PURE__ */ jsx19(Box17, { height: 1, children: /* @__PURE__ */ jsx19(Text20, { color: theme19.textSubtle, children: pad(showScrollUp ? " ..." : "") }) }),
|
|
53123
53588
|
/* @__PURE__ */ jsx19(Box17, { flexDirection: "column", height: MAX_VISIBLE2, children: filtered.length === 0 ? /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
53124
53589
|
/* @__PURE__ */ jsx19(Text20, { color: theme19.textSubtle, children: pad(" No matching models") }),
|
|
53125
|
-
Array.from({ length: MAX_VISIBLE2 - 1 }, (
|
|
53590
|
+
Array.from({ length: MAX_VISIBLE2 - 1 }, (_2, i) => /* @__PURE__ */ jsx19(Text20, { children: pad("") }, `empty-${i}`))
|
|
53126
53591
|
] }) : rows.map((row, i) => {
|
|
53127
53592
|
if (row.type === "blank") {
|
|
53128
53593
|
return /* @__PURE__ */ jsx19(Text20, { children: pad("") }, `blank-${i}`);
|
|
@@ -53376,7 +53841,7 @@ function TextArea({
|
|
|
53376
53841
|
cursorRef.current = cursor;
|
|
53377
53842
|
useEffect20(() => {
|
|
53378
53843
|
blinkRef.current = setInterval(() => {
|
|
53379
|
-
setBlinkVisible((
|
|
53844
|
+
setBlinkVisible((v) => !v);
|
|
53380
53845
|
}, CURSOR_BLINK_MS);
|
|
53381
53846
|
return () => {
|
|
53382
53847
|
if (blinkRef.current) {
|
|
@@ -54334,11 +54799,11 @@ function compactRawStreamEventForCopy(event) {
|
|
|
54334
54799
|
data = JSON.parse(JSON.stringify(event.listData, stringCompactionReplacer));
|
|
54335
54800
|
} else {
|
|
54336
54801
|
data = {};
|
|
54337
|
-
for (const [k2,
|
|
54802
|
+
for (const [k2, v] of Object.entries(event.data)) {
|
|
54338
54803
|
if (STREAM_EVENT_HEAVY_KEYS.has(k2)) {
|
|
54339
|
-
data[k2] = compactHeavyField(
|
|
54804
|
+
data[k2] = compactHeavyField(v);
|
|
54340
54805
|
} else {
|
|
54341
|
-
data[k2] = compactJsonLike(
|
|
54806
|
+
data[k2] = compactJsonLike(v);
|
|
54342
54807
|
}
|
|
54343
54808
|
}
|
|
54344
54809
|
}
|
|
@@ -57567,7 +58032,7 @@ ${message}`));
|
|
|
57567
58032
|
cleanup();
|
|
57568
58033
|
resolve11(value);
|
|
57569
58034
|
};
|
|
57570
|
-
const onKeypress = (
|
|
58035
|
+
const onKeypress = (_2, key) => {
|
|
57571
58036
|
if (key.ctrl && key.name === "c") {
|
|
57572
58037
|
cleanup();
|
|
57573
58038
|
process.kill(process.pid, "SIGINT");
|
|
@@ -62179,10 +62644,10 @@ modelsCommand.command("available").description("List all available models groupe
|
|
|
62179
62644
|
const group = item;
|
|
62180
62645
|
return React17.createElement(EntityCard, {
|
|
62181
62646
|
title: `${group.provider} / ${group.baseModel}`,
|
|
62182
|
-
fields: group.variants.map((
|
|
62183
|
-
label:
|
|
62184
|
-
value:
|
|
62185
|
-
color:
|
|
62647
|
+
fields: group.variants.map((v) => ({
|
|
62648
|
+
label: v.modelId,
|
|
62649
|
+
value: v.configured ? "configured" : "available",
|
|
62650
|
+
color: v.configured ? "green" : void 0
|
|
62186
62651
|
}))
|
|
62187
62652
|
});
|
|
62188
62653
|
},
|
|
@@ -63999,13 +64464,13 @@ import { execFileSync } from "child_process";
|
|
|
63999
64464
|
// src/lib/persona-init.ts
|
|
64000
64465
|
init_credential_store();
|
|
64001
64466
|
|
|
64002
|
-
// ../../node_modules/.pnpm/@runtypelabs+persona@3.
|
|
64003
|
-
var S = "3.
|
|
64467
|
+
// ../../node_modules/.pnpm/@runtypelabs+persona@3.37.0/node_modules/@runtypelabs/persona/dist/codegen.js
|
|
64468
|
+
var S = "3.37.0";
|
|
64004
64469
|
var c = S;
|
|
64005
64470
|
function u(e) {
|
|
64006
64471
|
if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((r) => r.toString()).join(", ")}]` : e.toString();
|
|
64007
64472
|
}
|
|
64008
|
-
function
|
|
64473
|
+
function _(e) {
|
|
64009
64474
|
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) };
|
|
64010
64475
|
}
|
|
64011
64476
|
var x = `({ text, message }: any) => {
|
|
@@ -64036,7 +64501,7 @@ var A = `function(ctx) {
|
|
|
64036
64501
|
} catch (e) { return null; }
|
|
64037
64502
|
return null;
|
|
64038
64503
|
}`;
|
|
64039
|
-
var
|
|
64504
|
+
var j = `(action: any, context: any) => {
|
|
64040
64505
|
if (action.type !== 'nav_then_click') return;
|
|
64041
64506
|
const payload = action.payload || action.raw || {};
|
|
64042
64507
|
const url = payload?.page;
|
|
@@ -64054,7 +64519,7 @@ var O = `(action: any, context: any) => {
|
|
|
64054
64519
|
window.location.href = targetUrl;
|
|
64055
64520
|
return { handled: true, displayText: text };
|
|
64056
64521
|
}`;
|
|
64057
|
-
var
|
|
64522
|
+
var O = `function(action, context) {
|
|
64058
64523
|
if (action.type !== 'nav_then_click') return;
|
|
64059
64524
|
var payload = action.payload || action.raw || {};
|
|
64060
64525
|
var url = payload.page;
|
|
@@ -64072,36 +64537,36 @@ var E = `function(action, context) {
|
|
|
64072
64537
|
window.location.href = targetUrl;
|
|
64073
64538
|
return { handled: true, displayText: text };
|
|
64074
64539
|
}`;
|
|
64075
|
-
var
|
|
64540
|
+
var T = `(parsed: any) => {
|
|
64076
64541
|
if (!parsed || typeof parsed !== 'object') return null;
|
|
64077
64542
|
if (parsed.action === 'nav_then_click') return 'Navigating...';
|
|
64078
64543
|
if (parsed.action === 'message') return parsed.text || '';
|
|
64079
64544
|
if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
|
|
64080
64545
|
return parsed.text || null;
|
|
64081
64546
|
}`;
|
|
64082
|
-
var
|
|
64547
|
+
var M = `function(parsed) {
|
|
64083
64548
|
if (!parsed || typeof parsed !== 'object') return null;
|
|
64084
64549
|
if (parsed.action === 'nav_then_click') return 'Navigating...';
|
|
64085
64550
|
if (parsed.action === 'message') return parsed.text || '';
|
|
64086
64551
|
if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
|
|
64087
64552
|
return parsed.text || null;
|
|
64088
64553
|
}`;
|
|
64089
|
-
function
|
|
64554
|
+
function R(e) {
|
|
64090
64555
|
if (!e) return null;
|
|
64091
64556
|
let r = e.toString();
|
|
64092
64557
|
return r.includes("createJsonStreamParser") || r.includes("partial-json") ? "json" : r.includes("createRegexJsonParser") || r.includes("regex") ? "regex-json" : r.includes("createXmlParser") || r.includes("<text>") ? "xml" : null;
|
|
64093
64558
|
}
|
|
64094
64559
|
function h(e) {
|
|
64095
64560
|
var r, n;
|
|
64096
|
-
return (n = (r = e.parserType) != null ? r :
|
|
64561
|
+
return (n = (r = e.parserType) != null ? r : R(e.streamParser)) != null ? n : "plain";
|
|
64097
64562
|
}
|
|
64098
|
-
function
|
|
64563
|
+
function m(e, r) {
|
|
64099
64564
|
let n = [];
|
|
64100
64565
|
return e.toolCall && (n.push(`${r}toolCall: {`), Object.entries(e.toolCall).forEach(([s, o]) => {
|
|
64101
64566
|
typeof o == "string" && n.push(`${r} ${s}: "${o}",`);
|
|
64102
64567
|
}), n.push(`${r}},`)), n;
|
|
64103
64568
|
}
|
|
64104
|
-
function
|
|
64569
|
+
function f(e, r, n) {
|
|
64105
64570
|
let s = [], o = e.messageActions && Object.entries(e.messageActions).some(([i, a]) => i !== "onFeedback" && i !== "onCopy" && a !== void 0), t = (n == null ? void 0 : n.onFeedback) || (n == null ? void 0 : n.onCopy);
|
|
64106
64571
|
return (o || t) && (s.push(`${r}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([i, a]) => {
|
|
64107
64572
|
i === "onFeedback" || i === "onCopy" || (typeof a == "string" ? s.push(`${r} ${i}: "${a}",`) : typeof a == "boolean" && s.push(`${r} ${i}: ${a},`));
|
|
@@ -64137,7 +64602,7 @@ function $(e, r) {
|
|
|
64137
64602
|
let n = [];
|
|
64138
64603
|
return e && (e.getHeaders && n.push(`${r}getHeaders: ${e.getHeaders},`), e.requestMiddleware && n.push(`${r}requestMiddleware: ${e.requestMiddleware},`), e.actionParsers && n.push(`${r}actionParsers: ${e.actionParsers},`), e.actionHandlers && n.push(`${r}actionHandlers: ${e.actionHandlers},`), e.contextProviders && n.push(`${r}contextProviders: ${e.contextProviders},`), e.streamParser && n.push(`${r}streamParser: ${e.streamParser},`)), n;
|
|
64139
64604
|
}
|
|
64140
|
-
function
|
|
64605
|
+
function E(e, r, n) {
|
|
64141
64606
|
Object.entries(r).forEach(([s, o]) => {
|
|
64142
64607
|
if (!(o === void 0 || typeof o == "function")) {
|
|
64143
64608
|
if (Array.isArray(o)) {
|
|
@@ -64145,7 +64610,7 @@ function j(e, r, n) {
|
|
|
64145
64610
|
return;
|
|
64146
64611
|
}
|
|
64147
64612
|
if (o && typeof o == "object") {
|
|
64148
|
-
e.push(`${n}${s}: {`),
|
|
64613
|
+
e.push(`${n}${s}: {`), E(e, o, `${n} `), e.push(`${n}},`);
|
|
64149
64614
|
return;
|
|
64150
64615
|
}
|
|
64151
64616
|
e.push(`${n}${s}: ${JSON.stringify(o)},`);
|
|
@@ -64153,7 +64618,7 @@ function j(e, r, n) {
|
|
|
64153
64618
|
});
|
|
64154
64619
|
}
|
|
64155
64620
|
function l(e, r, n, s) {
|
|
64156
|
-
n && (e.push(`${s}${r}: {`),
|
|
64621
|
+
n && (e.push(`${s}${r}: {`), E(e, n, `${s} `), e.push(`${s}},`));
|
|
64157
64622
|
}
|
|
64158
64623
|
function g(e) {
|
|
64159
64624
|
var r;
|
|
@@ -64162,8 +64627,8 @@ function g(e) {
|
|
|
64162
64627
|
function I(e, r = "esm", n) {
|
|
64163
64628
|
let s = { ...e };
|
|
64164
64629
|
delete s.postprocessMessage, delete s.initialMessages;
|
|
64165
|
-
let o = n ? { ...n, hooks:
|
|
64166
|
-
return r === "esm" ? W(s, o) : r === "script-installer" ?
|
|
64630
|
+
let o = n ? { ...n, hooks: _(n.hooks) } : void 0;
|
|
64631
|
+
return r === "esm" ? W(s, o) : r === "script-installer" ? k(s, o) : r === "script-advanced" ? F(s, o) : r === "react-component" ? H(s, o) : r === "react-advanced" ? N(s, o) : D(s, o);
|
|
64167
64632
|
}
|
|
64168
64633
|
function W(e, r) {
|
|
64169
64634
|
let n = r == null ? void 0 : r.hooks, s = h(e), o = s !== "plain", t = ["import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "", "initAgentWidget({", ` target: '${g(r)}',`, " config: {"];
|
|
@@ -64179,7 +64644,7 @@ function W(e, r) {
|
|
|
64179
64644
|
t.push(` ${i}: ${a},`);
|
|
64180
64645
|
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
|
|
64181
64646
|
t.push(` "${i}",`);
|
|
64182
|
-
}), 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(...
|
|
64647
|
+
}), 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 != null && n.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push("});"), t.join(`
|
|
64183
64648
|
`);
|
|
64184
64649
|
}
|
|
64185
64650
|
function H(e, r) {
|
|
@@ -64196,7 +64661,7 @@ function H(e, r) {
|
|
|
64196
64661
|
t.push(` ${i}: ${a},`);
|
|
64197
64662
|
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
|
|
64198
64663
|
t.push(` "${i}",`);
|
|
64199
|
-
}), 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(...
|
|
64664
|
+
}), 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 != null && 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(`
|
|
64200
64665
|
`);
|
|
64201
64666
|
}
|
|
64202
64667
|
function N(e, r) {
|
|
@@ -64213,7 +64678,7 @@ function N(e, r) {
|
|
|
64213
64678
|
s.push(` ${o}: ${t},`);
|
|
64214
64679
|
}), s.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((o) => {
|
|
64215
64680
|
s.push(` "${o}",`);
|
|
64216
|
-
}), 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(...
|
|
64681
|
+
}), 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 != null && n.getHeaders && s.push(` getHeaders: ${n.getHeaders},`), n != null && n.contextProviders && s.push(` contextProviders: ${n.contextProviders},`), e.debug && s.push(` debug: ${e.debug},`), s.push(" initialMessages: loadSavedMessages(),"), n != null && n.streamParser ? s.push(` streamParser: ${n.streamParser},`) : (s.push(" // Flexible JSON stream parser for handling structured actions"), s.push(` streamParser: () => createFlexibleJsonStreamParser(${T}),`)), n != null && 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(` ${x}`), s.push(" ],")) : (s.push(" // Action parsers to detect JSON actions in responses"), s.push(" actionParsers: ["), s.push(" defaultJsonActionParser,"), s.push(" // Parser for markdown-wrapped JSON"), s.push(` ${x}`), s.push(" ],")), n != null && 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(` ${j}`), s.push(" ],")) : (s.push(" // Action handlers for navigation and other actions"), s.push(" actionHandlers: ["), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Handler for nav_then_click action"), s.push(` ${j}`), s.push(" ],")), n != null && n.postprocessMessage ? s.push(` postprocessMessage: ${n.postprocessMessage},`) : s.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text),"), n != null && 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(`
|
|
64217
64682
|
`);
|
|
64218
64683
|
}
|
|
64219
64684
|
function P(e) {
|
|
@@ -64259,11 +64724,11 @@ function P(e) {
|
|
|
64259
64724
|
}
|
|
64260
64725
|
return s;
|
|
64261
64726
|
}
|
|
64262
|
-
function
|
|
64727
|
+
function k(e, r) {
|
|
64263
64728
|
let n = P(e), o = !!(r != null && r.windowKey || r != null && r.target) ? { config: n, ...r != null && r.windowKey ? { windowKey: r.windowKey } : {}, ...r != null && r.target ? { target: r.target } : {} } : n, t = JSON.stringify(o, null, 0).replace(/'/g, "'");
|
|
64264
64729
|
return `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/install.global.js" data-config='${t}'></script>`;
|
|
64265
64730
|
}
|
|
64266
|
-
function
|
|
64731
|
+
function D(e, r) {
|
|
64267
64732
|
let n = r == null ? void 0 : r.hooks, s = h(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: '${g(r)}',`, ...r != null && r.windowKey ? [` windowKey: '${r.windowKey}',`] : [], " config: {"];
|
|
64268
64733
|
return e.apiUrl && t.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && t.push(` clientToken: "${e.clientToken}",`), e.flowId && t.push(` flowId: "${e.flowId}",`), o && t.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && l(t, "theme", e.theme, " "), e.launcher && l(t, "launcher", e.launcher, " "), e.copy && (t.push(" copy: {"), Object.entries(e.copy).forEach(([i, a]) => {
|
|
64269
64734
|
t.push(` ${i}: "${a}",`);
|
|
@@ -64277,14 +64742,14 @@ function k(e, r) {
|
|
|
64277
64742
|
t.push(` ${i}: ${a},`);
|
|
64278
64743
|
}), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
|
|
64279
64744
|
t.push(` "${i}",`);
|
|
64280
|
-
}), 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(...
|
|
64745
|
+
}), 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 != null && n.postprocessMessage ? t.push(` postprocessMessage: ${n.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push("</script>"), t.join(`
|
|
64281
64746
|
`);
|
|
64282
64747
|
}
|
|
64283
64748
|
function F(e, r) {
|
|
64284
64749
|
let n = r == null ? void 0 : r.hooks, s = P(e), t = ["<script>", "(function() {", " 'use strict';", "", " // Configuration", ` var CONFIG = ${JSON.stringify(s, null, 2).split(`
|
|
64285
64750
|
`).map((i, a) => a === 0 ? i : " " + i).join(`
|
|
64286
64751
|
`)};`, "", " // 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);", ""];
|
|
64287
|
-
return n != null && n.getHeaders && (t.push(` widgetConfig.getHeaders = ${n.getHeaders};`), t.push("")), n != null && n.contextProviders && (t.push(` widgetConfig.contextProviders = ${n.contextProviders};`), t.push("")), n != null && 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(${
|
|
64752
|
+
return n != null && n.getHeaders && (t.push(` widgetConfig.getHeaders = ${n.getHeaders};`), t.push("")), n != null && n.contextProviders && (t.push(` widgetConfig.contextProviders = ${n.contextProviders};`), t.push("")), n != null && 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(${M});`), t.push(" };")), t.push(""), n != null && 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(` ${A}`), t.push(" ]);")) : (t.push(" // Action parsers to detect JSON actions in responses"), t.push(" widgetConfig.actionParsers = ["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${A}`), t.push(" ];")), t.push(""), n != null && 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(` ${O}`), t.push(" ]);")) : (t.push(" // Action handlers for navigation and other actions"), t.push(" widgetConfig.actionHandlers = ["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${O}`), t.push(" ];")), t.push(""), n != null && 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 != null && 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 != null && n.onFeedback || n != null && n.onCopy) && (t.push(" // Message action callbacks"), t.push(" widgetConfig.messageActions = widgetConfig.messageActions || {};"), n != null && n.onFeedback && t.push(` widgetConfig.messageActions.onFeedback = ${n.onFeedback};`), n != null && 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: '${g(r)}',`, " useShadowDom: false,", ...r != null && r.windowKey ? [` windowKey: '${r.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(`
|
|
64288
64753
|
`);
|
|
64289
64754
|
}
|
|
64290
64755
|
|
|
@@ -65133,11 +65598,11 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
|
|
|
65133
65598
|
return;
|
|
65134
65599
|
}
|
|
65135
65600
|
console.log(chalk33.cyan(`Versions for flow ${flowId}:`));
|
|
65136
|
-
for (const
|
|
65137
|
-
const publishedTag =
|
|
65138
|
-
const versionNum =
|
|
65139
|
-
const date5 =
|
|
65140
|
-
console.log(` ${chalk33.green(
|
|
65601
|
+
for (const v of versions) {
|
|
65602
|
+
const publishedTag = v.published ? chalk33.green(" [published]") : "";
|
|
65603
|
+
const versionNum = v.version !== void 0 ? `v${v.version}` : v.id;
|
|
65604
|
+
const date5 = v.createdAt ? chalk33.gray(` ${v.createdAt}`) : "";
|
|
65605
|
+
console.log(` ${chalk33.green(v.id)} ${versionNum}${publishedTag}${date5}`);
|
|
65141
65606
|
}
|
|
65142
65607
|
}
|
|
65143
65608
|
} catch (error51) {
|
|
@@ -65172,10 +65637,10 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
|
|
|
65172
65637
|
loading,
|
|
65173
65638
|
emptyMessage: "No versions found",
|
|
65174
65639
|
renderCard: (item) => {
|
|
65175
|
-
const
|
|
65176
|
-
const publishedTag =
|
|
65177
|
-
const versionNum =
|
|
65178
|
-
return React24.createElement(Text38, null, ` ${
|
|
65640
|
+
const v = item;
|
|
65641
|
+
const publishedTag = v.published ? " [published]" : "";
|
|
65642
|
+
const versionNum = v.version !== void 0 ? `v${v.version}` : v.id;
|
|
65643
|
+
return React24.createElement(Text38, null, ` ${v.id} ${versionNum}${publishedTag}${v.createdAt ? ` ${v.createdAt}` : ""}`);
|
|
65179
65644
|
}
|
|
65180
65645
|
});
|
|
65181
65646
|
};
|
|
@@ -65390,12 +65855,12 @@ agentVersionsCommand.command("list <agentId>").description("List all versions fo
|
|
|
65390
65855
|
return;
|
|
65391
65856
|
}
|
|
65392
65857
|
console.log(chalk34.cyan(`Versions for agent ${agentId}:`));
|
|
65393
|
-
for (const
|
|
65394
|
-
const isPublished =
|
|
65858
|
+
for (const v of versions) {
|
|
65859
|
+
const isPublished = v.id === data.publishedVersionId;
|
|
65395
65860
|
const liveTag = isPublished ? chalk34.green(" [live]") : "";
|
|
65396
|
-
const versionLabel =
|
|
65397
|
-
const date5 =
|
|
65398
|
-
console.log(` ${chalk34.green(
|
|
65861
|
+
const versionLabel = v.label || (v.versionNumber !== void 0 ? `v${v.versionNumber}` : v.id);
|
|
65862
|
+
const date5 = v.createdAt ? chalk34.gray(` ${v.createdAt}`) : "";
|
|
65863
|
+
console.log(` ${chalk34.green(v.id)} ${versionLabel}${liveTag}${date5}`);
|
|
65399
65864
|
}
|
|
65400
65865
|
}
|
|
65401
65866
|
} catch (error51) {
|
|
@@ -65432,13 +65897,13 @@ agentVersionsCommand.command("list <agentId>").description("List all versions fo
|
|
|
65432
65897
|
loading,
|
|
65433
65898
|
emptyMessage: "No versions found",
|
|
65434
65899
|
renderCard: (item) => {
|
|
65435
|
-
const
|
|
65436
|
-
const liveTag =
|
|
65437
|
-
const versionLabel =
|
|
65900
|
+
const v = item;
|
|
65901
|
+
const liveTag = v.id === publishedId ? " [live]" : "";
|
|
65902
|
+
const versionLabel = v.label || (v.versionNumber !== void 0 ? `v${v.versionNumber}` : v.id);
|
|
65438
65903
|
return React25.createElement(
|
|
65439
65904
|
Text39,
|
|
65440
65905
|
null,
|
|
65441
|
-
` ${
|
|
65906
|
+
` ${v.id} ${versionLabel}${liveTag}${v.createdAt ? ` ${v.createdAt}` : ""}`
|
|
65442
65907
|
);
|
|
65443
65908
|
}
|
|
65444
65909
|
});
|
|
@@ -65675,7 +66140,7 @@ function categoryBadge(category, useColor) {
|
|
|
65675
66140
|
return chalk35.magenta(`[${category}]`);
|
|
65676
66141
|
}
|
|
65677
66142
|
function formatTailData(data) {
|
|
65678
|
-
return Object.entries(data).map(([k2,
|
|
66143
|
+
return Object.entries(data).map(([k2, v]) => `${k2}=${typeof v === "string" ? v : JSON.stringify(v)}`).join(" ");
|
|
65679
66144
|
}
|
|
65680
66145
|
function formatContextIds(event, useColor) {
|
|
65681
66146
|
const ids = [];
|
|
@@ -65763,9 +66228,9 @@ async function createSession(apiUrl, apiKey, filters) {
|
|
|
65763
66228
|
level: "levels",
|
|
65764
66229
|
category: "categories"
|
|
65765
66230
|
};
|
|
65766
|
-
for (const [k2,
|
|
65767
|
-
if (
|
|
65768
|
-
filter[arrayFields[k2]] = [
|
|
66231
|
+
for (const [k2, v] of Object.entries(filters)) {
|
|
66232
|
+
if (v !== void 0 && arrayFields[k2]) {
|
|
66233
|
+
filter[arrayFields[k2]] = [v];
|
|
65769
66234
|
}
|
|
65770
66235
|
}
|
|
65771
66236
|
const body = Object.keys(filter).length > 0 ? { filter } : {};
|
|
@@ -65819,7 +66284,7 @@ async function runTail(options) {
|
|
|
65819
66284
|
category: options.category
|
|
65820
66285
|
};
|
|
65821
66286
|
const useColor = options.color;
|
|
65822
|
-
const activeFilters = Object.entries(filters).filter(([,
|
|
66287
|
+
const activeFilters = Object.entries(filters).filter(([, v]) => v !== void 0).map(([k2, v]) => `${k2}=${v}`);
|
|
65823
66288
|
process.stderr.write(
|
|
65824
66289
|
(useColor ? chalk35.gray(
|
|
65825
66290
|
`Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`
|
|
@@ -67015,11 +67480,11 @@ function collectSecretNames(agentDef) {
|
|
|
67015
67480
|
function slugify2(s) {
|
|
67016
67481
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
|
|
67017
67482
|
}
|
|
67018
|
-
var deployCommand = new Command30("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)", (
|
|
67019
|
-
acc.push(
|
|
67483
|
+
var deployCommand = new Command30("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)", (v, acc) => {
|
|
67484
|
+
acc.push(v);
|
|
67020
67485
|
return acc;
|
|
67021
|
-
}, []).option("--flow <id>", "Flow ID to export (may be repeated)", (
|
|
67022
|
-
acc.push(
|
|
67486
|
+
}, []).option("--flow <id>", "Flow ID to export (may be repeated)", (v, acc) => {
|
|
67487
|
+
acc.push(v);
|
|
67023
67488
|
return acc;
|
|
67024
67489
|
}, []).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(
|
|
67025
67490
|
async (options) => {
|