@runtypelabs/cli 2.22.1 → 2.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +614 -166
  2. 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 = _.prototype;
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 _(def) {
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(_, "init", { value: init });
1192
- Object.defineProperty(_, Symbol.hasInstance, {
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(_, "name", { value: name });
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((v2) => typeof v2 === "number");
1304
- const values = Object.entries(entries).filter(([k2, _]) => numericValues.indexOf(+k2) === -1).map(([_, v2]) => v2);
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(_, value) {
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(v2) {
1358
+ set(v) {
1359
1359
  Object.defineProperty(object2, key, {
1360
- value: v2
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(_, prop, receiver) {
1556
+ get(_2, prop, receiver) {
1557
1557
  target ?? (target = getter());
1558
1558
  return Reflect.get(target, prop, receiver);
1559
1559
  },
1560
- set(_, prop, value, receiver) {
1560
+ set(_2, prop, value, receiver) {
1561
1561
  target ?? (target = getter());
1562
1562
  return Reflect.set(target, prop, value, receiver);
1563
1563
  },
1564
- has(_, prop) {
1564
+ has(_2, prop) {
1565
1565
  target ?? (target = getter());
1566
1566
  return Reflect.has(target, prop);
1567
1567
  },
1568
- deleteProperty(_, prop) {
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(_, prop) {
1576
+ getOwnPropertyDescriptor(_2, prop) {
1577
1577
  target ?? (target = getter());
1578
1578
  return Reflect.getOwnPropertyDescriptor(target, prop);
1579
1579
  },
1580
- defineProperty(_, prop, descriptor) {
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 _ = ch._zod.check(payload);
2932
- if (_ instanceof Promise && ctx?.async === false) {
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 || _ instanceof Promise) {
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 (_2) {
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 v2 = versionMap[def.version];
3048
- if (v2 === void 0)
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(v2));
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 v2 of field.values)
3656
- propValues[key].add(v2);
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, v2] of Object.entries(pv)) {
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 v2) {
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 v2 of values) {
3969
- if (map2.has(v2)) {
3970
- throw new Error(`Duplicate discriminator value "${String(v2)}"`);
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(v2, o);
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 v2 = def.innerType._zod.values;
4608
- return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
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((v2) => stringifyPrimitive(v2));
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((v2) => [v2, v2])) : values;
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((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
11966
- falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
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((v2) => typeof v2 === "number"))
12508
+ if (values.every((v) => typeof v === "number"))
12509
12509
  json2.type = "number";
12510
- if (values.every((v2) => typeof v2 === "string"))
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((v2) => typeof v2 === "number"))
12543
+ if (vals.every((v) => typeof v === "number"))
12544
12544
  json2.type = "number";
12545
- if (vals.every((v2) => typeof v2 === "string"))
12545
+ if (vals.every((v) => typeof v === "string"))
12546
12546
  json2.type = "string";
12547
- if (vals.every((v2) => typeof v2 === "boolean"))
12547
+ if (vals.every((v) => typeof v === "boolean"))
12548
12548
  json2.type = "boolean";
12549
- if (vals.every((v2) => v2 === null))
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 v2 = def.shape[key]._zod;
12647
+ const v = def.shape[key]._zod;
12648
12648
  if (ctx.io === "input") {
12649
- return v2.optin === void 0;
12649
+ return v.optin === void 0;
12650
12650
  } else {
12651
- return v2.optout === void 0;
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((v2) => typeof v2 === "string" || typeof v2 === "number");
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 [_, schema] = entry;
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": _, ...plainResult } = result;
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(v2) {
13336
+ set(v) {
13337
13337
  Object.defineProperty(this, key, {
13338
13338
  configurable: true,
13339
13339
  writable: true,
13340
13340
  enumerable: true,
13341
- value: v2
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((v2) => [v2, v2])) : values;
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((v2) => typeof v2 === "string")) {
14781
+ if (enumValues.every((v) => typeof v === "string")) {
14782
14782
  return z.enum(enumValues);
14783
14783
  }
14784
- const literalSchemas = enumValues.map((v2) => z.literal(v2));
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/index.mjs
15570
- var FORMULA_TRIGGER = /^[=+\-@\t\r\n]/;
15571
- var STRICT_NUMBER = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
15572
- function neutralizeCsvFormula(value) {
15573
- if (!FORMULA_TRIGGER.test(value)) return value;
15574
- if (STRICT_NUMBER.test(value)) return value;
15575
- return `'${value}`;
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 tokensSchema = external_exports.object({ input: external_exports.number(), output: external_exports.number() });
15605
- var wireStopReasonSchema = external_exports.enum([
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: tokensSchema.optional(),
16067
+ tokens: tokensSchema2.optional(),
15668
16068
  cost: external_exports.number().optional(),
15669
- stopReason: wireStopReasonSchema.optional(),
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: tokensSchema.optional(),
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: tokensSchema.optional(),
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: wireStopReasonSchema.optional(),
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,
@@ -36807,7 +37217,10 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
36807
37217
  // NVIDIA Nemotron Ultra (reasoning + tool-use flagship, routed via Vercel)
36808
37218
  { provider: "runtype", modelId: "nemotron-3-ultra-550b-a55b", isDefault: false },
36809
37219
  // Google models (routed via Cloudflare Workers AI)
36810
- { provider: "runtype", modelId: "gemma-4-26b-a4b-it", isDefault: false }
37220
+ { provider: "runtype", modelId: "gemma-4-26b-a4b-it", isDefault: false },
37221
+ // Z.ai GLM-5.2 (agentic coding flagship, routed via Cloudflare Workers AI,
37222
+ // Vercel fallback). The bare routed name resolves to `@cf/zai-org/glm-5.2`.
37223
+ { provider: "runtype", modelId: "glm-5.2", isDefault: false }
36811
37224
  ];
36812
37225
  var DEFAULT_MODEL_ID = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.find((m2) => m2.isDefault)?.modelId ?? "kimi-k2.6";
36813
37226
  var userProfileFeaturesSchema = external_exports.object({
@@ -36837,8 +37250,7 @@ var userProfileFeaturesSchema = external_exports.object({
36837
37250
  });
36838
37251
  var MODEL_FAMILY_PROVIDER_IDS = {
36839
37252
  "claude-fable-5": {
36840
- "anthropic": "claude-fable-5",
36841
- "vercel": "anthropic/claude-fable-5"
37253
+ "anthropic": "claude-fable-5"
36842
37254
  },
36843
37255
  "claude-haiku-4-5": {
36844
37256
  "anthropic": "claude-haiku-4-5-20251001",
@@ -37168,6 +37580,18 @@ var MODEL_FAMILY_PROVIDER_IDS = {
37168
37580
  "togetherai": "togetherai/pearl-ai/gemma-4-31b-it",
37169
37581
  "vercel": "google/gemma-4-31b-it"
37170
37582
  },
37583
+ "gemma-4-e2b-it": {
37584
+ "google": "gemma-4-E2B-it"
37585
+ },
37586
+ "gemma-4-E2B-it": {
37587
+ "google": "gemma-4-E2B-it"
37588
+ },
37589
+ "gemma-4-e4b-it": {
37590
+ "google": "gemma-4-E4B-it"
37591
+ },
37592
+ "gemma-4-E4B-it": {
37593
+ "google": "gemma-4-E4B-it"
37594
+ },
37171
37595
  "glm-4-5": {
37172
37596
  "vercel": "zai/glm-4.5"
37173
37597
  },
@@ -37230,12 +37654,18 @@ var MODEL_FAMILY_PROVIDER_IDS = {
37230
37654
  "togetherai": "togetherai/zai-org/GLM-5.1",
37231
37655
  "vercel": "zai/glm-5.1"
37232
37656
  },
37657
+ "glm-5-2": {
37658
+ "vercel": "zai/glm-5.2"
37659
+ },
37233
37660
  "glm-5-turbo": {
37234
37661
  "vercel": "zai/glm-5-turbo"
37235
37662
  },
37236
37663
  "glm-5.1": {
37237
37664
  "vercel": "zai/glm-5.1"
37238
37665
  },
37666
+ "glm-5.2": {
37667
+ "vercel": "zai/glm-5.2"
37668
+ },
37239
37669
  "glm-5v-turbo": {
37240
37670
  "vercel": "zai/glm-5v-turbo"
37241
37671
  },
@@ -37612,7 +38042,11 @@ var MODEL_FAMILY_PROVIDER_IDS = {
37612
38042
  "vercel": "moonshotai/kimi-k2.6"
37613
38043
  },
37614
38044
  "kimi-k2-7-code": {
37615
- "vercel": "moonshotai/kimi-k2.7-code"
38045
+ "mixlayer": "moonshotai/kimi-k2.7-code",
38046
+ "togetherai": "togetherai/moonshotai/Kimi-K2.7-Code"
38047
+ },
38048
+ "kimi-k2-7-code-highspeed": {
38049
+ "vercel": "moonshotai/kimi-k2.7-code-highspeed"
37616
38050
  },
37617
38051
  "kimi-k2-thinking": {
37618
38052
  "vercel": "moonshotai/kimi-k2-thinking"
@@ -37624,7 +38058,10 @@ var MODEL_FAMILY_PROVIDER_IDS = {
37624
38058
  "vercel": "moonshotai/kimi-k2.6"
37625
38059
  },
37626
38060
  "kimi-k2.7-code": {
37627
- "vercel": "moonshotai/kimi-k2.7-code"
38061
+ "mixlayer": "moonshotai/kimi-k2.7-code"
38062
+ },
38063
+ "kimi-k2.7-code-highspeed": {
38064
+ "vercel": "moonshotai/kimi-k2.7-code-highspeed"
37628
38065
  },
37629
38066
  "kling-v2-5-turbo-i2v": {
37630
38067
  "vercel": "klingai/kling-v2.5-turbo-i2v"
@@ -37808,6 +38245,7 @@ var MODEL_FAMILY_PROVIDER_IDS = {
37808
38245
  "vercel": "minimax/minimax-m2.7-highspeed"
37809
38246
  },
37810
38247
  "minimax-m3": {
38248
+ "togetherai": "togetherai/MiniMaxAI/MiniMax-M3",
37811
38249
  "vercel": "minimax/minimax-m3"
37812
38250
  },
37813
38251
  "MiniMaxAI/MiniMax-M2.5": {
@@ -37816,6 +38254,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
37816
38254
  "MiniMaxAI/MiniMax-M2.7": {
37817
38255
  "togetherai": "togetherai/MiniMaxAI/MiniMax-M2.7"
37818
38256
  },
38257
+ "MiniMaxAI/MiniMax-M3": {
38258
+ "togetherai": "togetherai/MiniMaxAI/MiniMax-M3"
38259
+ },
37819
38260
  "ministral-14b": {
37820
38261
  "vercel": "mistral/ministral-14b"
37821
38262
  },
@@ -37843,6 +38284,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
37843
38284
  "moonshotai/Kimi-K2.6": {
37844
38285
  "togetherai": "togetherai/moonshotai/Kimi-K2.6"
37845
38286
  },
38287
+ "moonshotai/Kimi-K2.7-Code": {
38288
+ "togetherai": "togetherai/moonshotai/Kimi-K2.7-Code"
38289
+ },
37846
38290
  "morph-v3-fast": {
37847
38291
  "vercel": "morph/morph-v3-fast"
37848
38292
  },
@@ -38425,7 +38869,7 @@ var PLATFORM_KEY_PROVIDER_MAP = {
38425
38869
  "mock": false
38426
38870
  };
38427
38871
  var PLATFORM_KEY_PROVIDERS = new Set(
38428
- Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v2]) => v2).map(([k2]) => k2)
38872
+ Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v]) => v).map(([k2]) => k2)
38429
38873
  );
38430
38874
  var MANUAL_PROVIDER_MAP_OVERRIDES = {
38431
38875
  // Bedrock uses different model ID format
@@ -38469,6 +38913,9 @@ var MANUAL_PROVIDER_MAP_OVERRIDES = {
38469
38913
  "gpt-oss-120b": {
38470
38914
  "workers-ai": "@cf/openai/gpt-oss-120b"
38471
38915
  },
38916
+ "glm-5.2": {
38917
+ "workers-ai": "@cf/zai-org/glm-5.2"
38918
+ },
38472
38919
  // MiniMax M2.7: explicit provider IDs for the GC-primary / Vercel-fallback route.
38473
38920
  // `general-compute` is NOT in PROVIDERS_WITHOUT_PREFIX, so resolveRoutedFamily
38474
38921
  // prepends `general-compute/` itself — store the BARE id here to avoid a double
@@ -39499,18 +39946,18 @@ function extractSecretReferencesFromAnyValue(value, maxDepth = 10) {
39499
39946
  const keys = /* @__PURE__ */ new Set();
39500
39947
  walk(value, 0);
39501
39948
  return Array.from(keys);
39502
- function walk(v2, depth) {
39949
+ function walk(v, depth) {
39503
39950
  if (depth > maxDepth) return;
39504
- if (typeof v2 === "string") {
39505
- for (const key of extractSecretReferences(v2)) keys.add(key);
39951
+ if (typeof v === "string") {
39952
+ for (const key of extractSecretReferences(v)) keys.add(key);
39506
39953
  return;
39507
39954
  }
39508
- if (Array.isArray(v2)) {
39509
- for (const item of v2) walk(item, depth + 1);
39955
+ if (Array.isArray(v)) {
39956
+ for (const item of v) walk(item, depth + 1);
39510
39957
  return;
39511
39958
  }
39512
- if (v2 && typeof v2 === "object") {
39513
- for (const inner of Object.values(v2)) {
39959
+ if (v && typeof v === "object") {
39960
+ for (const inner of Object.values(v)) {
39514
39961
  walk(inner, depth + 1);
39515
39962
  }
39516
39963
  }
@@ -39747,7 +40194,7 @@ var capabilitySchema = external_exports.object({
39747
40194
  }).refine(
39748
40195
  (cap) => {
39749
40196
  const set2 = [cap.flow, cap.agent, cap.existingFlowId, cap.existingAgentId].filter(
39750
- (v2) => v2 !== void 0 && v2 !== null
40197
+ (v) => v !== void 0 && v !== null
39751
40198
  );
39752
40199
  return set2.length === 1;
39753
40200
  },
@@ -40166,7 +40613,7 @@ function validateCapability(cap, index, context) {
40166
40613
  const result = emptyResult();
40167
40614
  const base = `capabilities[${index}]`;
40168
40615
  const backings = [cap.flow, cap.agent, cap.existingFlowId, cap.existingAgentId].filter(
40169
- (v2) => v2 !== void 0 && v2 !== null
40616
+ (v) => v !== void 0 && v !== null
40170
40617
  );
40171
40618
  if (backings.length === 0) {
40172
40619
  result.errors.push(
@@ -42753,7 +43200,8 @@ var InlineClientToolSchema = external_exports.object({
42753
43200
  type: external_exports.literal("object")
42754
43201
  }).passthrough(),
42755
43202
  origin: external_exports.enum(["webmcp", "sdk"]).optional(),
42756
- pageOrigin: external_exports.string().optional()
43203
+ pageOrigin: external_exports.string().optional(),
43204
+ untrustedContentHint: external_exports.boolean().optional()
42757
43205
  });
42758
43206
  var ClientToolsPolicySchema = external_exports.object({
42759
43207
  allowlist: external_exports.array(external_exports.string()).optional()
@@ -46066,8 +46514,8 @@ configCommand.command("get [key]").description("Get configuration value").action
46066
46514
  const allConfig = config2.store;
46067
46515
  if (Object.keys(allConfig).length > 0) {
46068
46516
  console.log(chalk9.cyan("Current Configuration:"));
46069
- for (const [k2, v2] of Object.entries(allConfig)) {
46070
- console.log(` ${chalk9.green(k2)}: ${v2}`);
46517
+ for (const [k2, v] of Object.entries(allConfig)) {
46518
+ console.log(` ${chalk9.green(k2)}: ${v}`);
46071
46519
  }
46072
46520
  } else {
46073
46521
  console.log(chalk9.gray("No configuration set"));
@@ -47635,7 +48083,7 @@ logsCommand.command("stats").description("Aggregate log stats: totals, counts by
47635
48083
  const formatCounts = (counts) => {
47636
48084
  const entries = Object.entries(counts);
47637
48085
  if (entries.length === 0) return "(none)";
47638
- return entries.map(([k2, v2]) => `${k2}=${v2}`).join(", ");
48086
+ return entries.map(([k2, v]) => `${k2}=${v}`).join(", ");
47639
48087
  };
47640
48088
  if (!isTTY(options) || options.json) {
47641
48089
  try {
@@ -48948,8 +49396,8 @@ var dispatchCommand = new Command14("dispatch").description("Execute a flow or a
48948
49396
  }
48949
49397
  if (options.variable && options.variable.length > 0) {
48950
49398
  const variables = {};
48951
- for (const v2 of options.variable) {
48952
- const [key, ...rest] = v2.split("=");
49399
+ for (const v of options.variable) {
49400
+ const [key, ...rest] = v.split("=");
48953
49401
  variables[key] = rest.join("=");
48954
49402
  }
48955
49403
  payload.variables = variables;
@@ -50536,7 +50984,7 @@ function Scrollbar({ totalLines, visibleLines, scrollOffset, height }) {
50536
50984
  const clampedOffset = Math.min(scrollOffset, maxScroll);
50537
50985
  const thumbSize = Math.max(1, Math.round(visibleLines / totalLines * height));
50538
50986
  const thumbStart = maxScroll > 0 ? Math.round(clampedOffset / maxScroll * (height - thumbSize)) : 0;
50539
- return /* @__PURE__ */ jsx11(Box10, { flexDirection: "column", marginLeft: 1, children: Array.from({ length: height }, (_, i) => {
50987
+ return /* @__PURE__ */ jsx11(Box10, { flexDirection: "column", marginLeft: 1, children: Array.from({ length: height }, (_2, i) => {
50540
50988
  const isThumb = i >= thumbStart && i < thumbStart + thumbSize;
50541
50989
  return /* @__PURE__ */ jsx11(Text12, { color: isThumb ? theme12.textMuted : theme12.border, children: isThumb ? "\u2588" : "\u2502" }, i);
50542
50990
  }) });
@@ -52798,7 +53246,7 @@ function BlinkingTextInput({
52798
53246
  return;
52799
53247
  }
52800
53248
  blinkRef.current = setInterval(() => {
52801
- setBlinkVisible((v2) => !v2);
53249
+ setBlinkVisible((v) => !v);
52802
53250
  }, CURSOR_BLINK_MS);
52803
53251
  return () => {
52804
53252
  if (blinkRef.current) {
@@ -53096,7 +53544,7 @@ function ModelPicker({ currentModel, onSelect, onCancel, models }) {
53096
53544
  /* @__PURE__ */ jsx19(Box17, { height: 1, children: /* @__PURE__ */ jsx19(Text20, { color: theme19.textSubtle, children: pad(showScrollUp ? " ..." : "") }) }),
53097
53545
  /* @__PURE__ */ jsx19(Box17, { flexDirection: "column", height: MAX_VISIBLE2, children: filtered.length === 0 ? /* @__PURE__ */ jsxs16(Fragment2, { children: [
53098
53546
  /* @__PURE__ */ jsx19(Text20, { color: theme19.textSubtle, children: pad(" No matching models") }),
53099
- Array.from({ length: MAX_VISIBLE2 - 1 }, (_, i) => /* @__PURE__ */ jsx19(Text20, { children: pad("") }, `empty-${i}`))
53547
+ Array.from({ length: MAX_VISIBLE2 - 1 }, (_2, i) => /* @__PURE__ */ jsx19(Text20, { children: pad("") }, `empty-${i}`))
53100
53548
  ] }) : rows.map((row, i) => {
53101
53549
  if (row.type === "blank") {
53102
53550
  return /* @__PURE__ */ jsx19(Text20, { children: pad("") }, `blank-${i}`);
@@ -53350,7 +53798,7 @@ function TextArea({
53350
53798
  cursorRef.current = cursor;
53351
53799
  useEffect20(() => {
53352
53800
  blinkRef.current = setInterval(() => {
53353
- setBlinkVisible((v2) => !v2);
53801
+ setBlinkVisible((v) => !v);
53354
53802
  }, CURSOR_BLINK_MS);
53355
53803
  return () => {
53356
53804
  if (blinkRef.current) {
@@ -54308,11 +54756,11 @@ function compactRawStreamEventForCopy(event) {
54308
54756
  data = JSON.parse(JSON.stringify(event.listData, stringCompactionReplacer));
54309
54757
  } else {
54310
54758
  data = {};
54311
- for (const [k2, v2] of Object.entries(event.data)) {
54759
+ for (const [k2, v] of Object.entries(event.data)) {
54312
54760
  if (STREAM_EVENT_HEAVY_KEYS.has(k2)) {
54313
- data[k2] = compactHeavyField(v2);
54761
+ data[k2] = compactHeavyField(v);
54314
54762
  } else {
54315
- data[k2] = compactJsonLike(v2);
54763
+ data[k2] = compactJsonLike(v);
54316
54764
  }
54317
54765
  }
54318
54766
  }
@@ -57541,7 +57989,7 @@ ${message}`));
57541
57989
  cleanup();
57542
57990
  resolve11(value);
57543
57991
  };
57544
- const onKeypress = (_, key) => {
57992
+ const onKeypress = (_2, key) => {
57545
57993
  if (key.ctrl && key.name === "c") {
57546
57994
  cleanup();
57547
57995
  process.kill(process.pid, "SIGINT");
@@ -62153,10 +62601,10 @@ modelsCommand.command("available").description("List all available models groupe
62153
62601
  const group = item;
62154
62602
  return React17.createElement(EntityCard, {
62155
62603
  title: `${group.provider} / ${group.baseModel}`,
62156
- fields: group.variants.map((v2) => ({
62157
- label: v2.modelId,
62158
- value: v2.configured ? "configured" : "available",
62159
- color: v2.configured ? "green" : void 0
62604
+ fields: group.variants.map((v) => ({
62605
+ label: v.modelId,
62606
+ value: v.configured ? "configured" : "available",
62607
+ color: v.configured ? "green" : void 0
62160
62608
  }))
62161
62609
  });
62162
62610
  },
@@ -63973,13 +64421,13 @@ import { execFileSync } from "child_process";
63973
64421
  // src/lib/persona-init.ts
63974
64422
  init_credential_store();
63975
64423
 
63976
- // ../../node_modules/.pnpm/@runtypelabs+persona@3.34.1/node_modules/@runtypelabs/persona/dist/codegen.js
63977
- var S = "3.34.1";
64424
+ // ../../node_modules/.pnpm/@runtypelabs+persona@3.37.0/node_modules/@runtypelabs/persona/dist/codegen.js
64425
+ var S = "3.37.0";
63978
64426
  var c = S;
63979
64427
  function u(e) {
63980
64428
  if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((r) => r.toString()).join(", ")}]` : e.toString();
63981
64429
  }
63982
- function T(e) {
64430
+ function _(e) {
63983
64431
  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) };
63984
64432
  }
63985
64433
  var x = `({ text, message }: any) => {
@@ -64010,7 +64458,7 @@ var A = `function(ctx) {
64010
64458
  } catch (e) { return null; }
64011
64459
  return null;
64012
64460
  }`;
64013
- var O = `(action: any, context: any) => {
64461
+ var j = `(action: any, context: any) => {
64014
64462
  if (action.type !== 'nav_then_click') return;
64015
64463
  const payload = action.payload || action.raw || {};
64016
64464
  const url = payload?.page;
@@ -64028,7 +64476,7 @@ var O = `(action: any, context: any) => {
64028
64476
  window.location.href = targetUrl;
64029
64477
  return { handled: true, displayText: text };
64030
64478
  }`;
64031
- var E = `function(action, context) {
64479
+ var O = `function(action, context) {
64032
64480
  if (action.type !== 'nav_then_click') return;
64033
64481
  var payload = action.payload || action.raw || {};
64034
64482
  var url = payload.page;
@@ -64046,36 +64494,36 @@ var E = `function(action, context) {
64046
64494
  window.location.href = targetUrl;
64047
64495
  return { handled: true, displayText: text };
64048
64496
  }`;
64049
- var M = `(parsed: any) => {
64497
+ var T = `(parsed: any) => {
64050
64498
  if (!parsed || typeof parsed !== 'object') return null;
64051
64499
  if (parsed.action === 'nav_then_click') return 'Navigating...';
64052
64500
  if (parsed.action === 'message') return parsed.text || '';
64053
64501
  if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
64054
64502
  return parsed.text || null;
64055
64503
  }`;
64056
- var R = `function(parsed) {
64504
+ var M = `function(parsed) {
64057
64505
  if (!parsed || typeof parsed !== 'object') return null;
64058
64506
  if (parsed.action === 'nav_then_click') return 'Navigating...';
64059
64507
  if (parsed.action === 'message') return parsed.text || '';
64060
64508
  if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
64061
64509
  return parsed.text || null;
64062
64510
  }`;
64063
- function v(e) {
64511
+ function R(e) {
64064
64512
  if (!e) return null;
64065
64513
  let r = e.toString();
64066
64514
  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;
64067
64515
  }
64068
64516
  function h(e) {
64069
64517
  var r, n;
64070
- return (n = (r = e.parserType) != null ? r : v(e.streamParser)) != null ? n : "plain";
64518
+ return (n = (r = e.parserType) != null ? r : R(e.streamParser)) != null ? n : "plain";
64071
64519
  }
64072
- function f(e, r) {
64520
+ function m(e, r) {
64073
64521
  let n = [];
64074
64522
  return e.toolCall && (n.push(`${r}toolCall: {`), Object.entries(e.toolCall).forEach(([s, o]) => {
64075
64523
  typeof o == "string" && n.push(`${r} ${s}: "${o}",`);
64076
64524
  }), n.push(`${r}},`)), n;
64077
64525
  }
64078
- function m(e, r, n) {
64526
+ function f(e, r, n) {
64079
64527
  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);
64080
64528
  return (o || t) && (s.push(`${r}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([i, a]) => {
64081
64529
  i === "onFeedback" || i === "onCopy" || (typeof a == "string" ? s.push(`${r} ${i}: "${a}",`) : typeof a == "boolean" && s.push(`${r} ${i}: ${a},`));
@@ -64111,7 +64559,7 @@ function $(e, r) {
64111
64559
  let n = [];
64112
64560
  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;
64113
64561
  }
64114
- function j(e, r, n) {
64562
+ function E(e, r, n) {
64115
64563
  Object.entries(r).forEach(([s, o]) => {
64116
64564
  if (!(o === void 0 || typeof o == "function")) {
64117
64565
  if (Array.isArray(o)) {
@@ -64119,7 +64567,7 @@ function j(e, r, n) {
64119
64567
  return;
64120
64568
  }
64121
64569
  if (o && typeof o == "object") {
64122
- e.push(`${n}${s}: {`), j(e, o, `${n} `), e.push(`${n}},`);
64570
+ e.push(`${n}${s}: {`), E(e, o, `${n} `), e.push(`${n}},`);
64123
64571
  return;
64124
64572
  }
64125
64573
  e.push(`${n}${s}: ${JSON.stringify(o)},`);
@@ -64127,7 +64575,7 @@ function j(e, r, n) {
64127
64575
  });
64128
64576
  }
64129
64577
  function l(e, r, n, s) {
64130
- n && (e.push(`${s}${r}: {`), j(e, n, `${s} `), e.push(`${s}},`));
64578
+ n && (e.push(`${s}${r}: {`), E(e, n, `${s} `), e.push(`${s}},`));
64131
64579
  }
64132
64580
  function g(e) {
64133
64581
  var r;
@@ -64136,8 +64584,8 @@ function g(e) {
64136
64584
  function I(e, r = "esm", n) {
64137
64585
  let s = { ...e };
64138
64586
  delete s.postprocessMessage, delete s.initialMessages;
64139
- let o = n ? { ...n, hooks: T(n.hooks) } : void 0;
64140
- return r === "esm" ? W(s, o) : r === "script-installer" ? D(s, o) : r === "script-advanced" ? F(s, o) : r === "react-component" ? H(s, o) : r === "react-advanced" ? N(s, o) : k(s, o);
64587
+ let o = n ? { ...n, hooks: _(n.hooks) } : void 0;
64588
+ 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);
64141
64589
  }
64142
64590
  function W(e, r) {
64143
64591
  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: {"];
@@ -64153,7 +64601,7 @@ function W(e, r) {
64153
64601
  t.push(` ${i}: ${a},`);
64154
64602
  }), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
64155
64603
  t.push(` "${i}",`);
64156
- }), 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(...f(e, " ")), t.push(...m(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(`
64604
+ }), 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(`
64157
64605
  `);
64158
64606
  }
64159
64607
  function H(e, r) {
@@ -64170,7 +64618,7 @@ function H(e, r) {
64170
64618
  t.push(` ${i}: ${a},`);
64171
64619
  }), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
64172
64620
  t.push(` "${i}",`);
64173
- }), 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(...f(e, " ")), t.push(...m(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(`
64621
+ }), 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(`
64174
64622
  `);
64175
64623
  }
64176
64624
  function N(e, r) {
@@ -64187,7 +64635,7 @@ function N(e, r) {
64187
64635
  s.push(` ${o}: ${t},`);
64188
64636
  }), s.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((o) => {
64189
64637
  s.push(` "${o}",`);
64190
- }), 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(...f(e, " ")), s.push(...m(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(${M}),`)), 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(` ${O}`), 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(` ${O}`), 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(`
64638
+ }), 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(`
64191
64639
  `);
64192
64640
  }
64193
64641
  function P(e) {
@@ -64233,11 +64681,11 @@ function P(e) {
64233
64681
  }
64234
64682
  return s;
64235
64683
  }
64236
- function D(e, r) {
64684
+ function k(e, r) {
64237
64685
  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, "&#39;");
64238
64686
  return `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/install.global.js" data-config='${t}'></script>`;
64239
64687
  }
64240
- function k(e, r) {
64688
+ function D(e, r) {
64241
64689
  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: {"];
64242
64690
  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]) => {
64243
64691
  t.push(` ${i}: "${a}",`);
@@ -64251,14 +64699,14 @@ function k(e, r) {
64251
64699
  t.push(` ${i}: ${a},`);
64252
64700
  }), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
64253
64701
  t.push(` "${i}",`);
64254
- }), 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(...f(e, " ")), t.push(...m(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(`
64702
+ }), 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(`
64255
64703
  `);
64256
64704
  }
64257
64705
  function F(e, r) {
64258
64706
  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(`
64259
64707
  `).map((i, a) => a === 0 ? i : " " + i).join(`
64260
64708
  `)};`, "", " // 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);", ""];
64261
- 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(${R});`), 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(` ${E}`), 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(` ${E}`), 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(`
64709
+ 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(`
64262
64710
  `);
64263
64711
  }
64264
64712
 
@@ -65107,11 +65555,11 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
65107
65555
  return;
65108
65556
  }
65109
65557
  console.log(chalk33.cyan(`Versions for flow ${flowId}:`));
65110
- for (const v2 of versions) {
65111
- const publishedTag = v2.published ? chalk33.green(" [published]") : "";
65112
- const versionNum = v2.version !== void 0 ? `v${v2.version}` : v2.id;
65113
- const date5 = v2.createdAt ? chalk33.gray(` ${v2.createdAt}`) : "";
65114
- console.log(` ${chalk33.green(v2.id)} ${versionNum}${publishedTag}${date5}`);
65558
+ for (const v of versions) {
65559
+ const publishedTag = v.published ? chalk33.green(" [published]") : "";
65560
+ const versionNum = v.version !== void 0 ? `v${v.version}` : v.id;
65561
+ const date5 = v.createdAt ? chalk33.gray(` ${v.createdAt}`) : "";
65562
+ console.log(` ${chalk33.green(v.id)} ${versionNum}${publishedTag}${date5}`);
65115
65563
  }
65116
65564
  }
65117
65565
  } catch (error51) {
@@ -65146,10 +65594,10 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
65146
65594
  loading,
65147
65595
  emptyMessage: "No versions found",
65148
65596
  renderCard: (item) => {
65149
- const v2 = item;
65150
- const publishedTag = v2.published ? " [published]" : "";
65151
- const versionNum = v2.version !== void 0 ? `v${v2.version}` : v2.id;
65152
- return React24.createElement(Text38, null, ` ${v2.id} ${versionNum}${publishedTag}${v2.createdAt ? ` ${v2.createdAt}` : ""}`);
65597
+ const v = item;
65598
+ const publishedTag = v.published ? " [published]" : "";
65599
+ const versionNum = v.version !== void 0 ? `v${v.version}` : v.id;
65600
+ return React24.createElement(Text38, null, ` ${v.id} ${versionNum}${publishedTag}${v.createdAt ? ` ${v.createdAt}` : ""}`);
65153
65601
  }
65154
65602
  });
65155
65603
  };
@@ -65364,12 +65812,12 @@ agentVersionsCommand.command("list <agentId>").description("List all versions fo
65364
65812
  return;
65365
65813
  }
65366
65814
  console.log(chalk34.cyan(`Versions for agent ${agentId}:`));
65367
- for (const v2 of versions) {
65368
- const isPublished = v2.id === data.publishedVersionId;
65815
+ for (const v of versions) {
65816
+ const isPublished = v.id === data.publishedVersionId;
65369
65817
  const liveTag = isPublished ? chalk34.green(" [live]") : "";
65370
- const versionLabel = v2.label || (v2.versionNumber !== void 0 ? `v${v2.versionNumber}` : v2.id);
65371
- const date5 = v2.createdAt ? chalk34.gray(` ${v2.createdAt}`) : "";
65372
- console.log(` ${chalk34.green(v2.id)} ${versionLabel}${liveTag}${date5}`);
65818
+ const versionLabel = v.label || (v.versionNumber !== void 0 ? `v${v.versionNumber}` : v.id);
65819
+ const date5 = v.createdAt ? chalk34.gray(` ${v.createdAt}`) : "";
65820
+ console.log(` ${chalk34.green(v.id)} ${versionLabel}${liveTag}${date5}`);
65373
65821
  }
65374
65822
  }
65375
65823
  } catch (error51) {
@@ -65406,13 +65854,13 @@ agentVersionsCommand.command("list <agentId>").description("List all versions fo
65406
65854
  loading,
65407
65855
  emptyMessage: "No versions found",
65408
65856
  renderCard: (item) => {
65409
- const v2 = item;
65410
- const liveTag = v2.id === publishedId ? " [live]" : "";
65411
- const versionLabel = v2.label || (v2.versionNumber !== void 0 ? `v${v2.versionNumber}` : v2.id);
65857
+ const v = item;
65858
+ const liveTag = v.id === publishedId ? " [live]" : "";
65859
+ const versionLabel = v.label || (v.versionNumber !== void 0 ? `v${v.versionNumber}` : v.id);
65412
65860
  return React25.createElement(
65413
65861
  Text39,
65414
65862
  null,
65415
- ` ${v2.id} ${versionLabel}${liveTag}${v2.createdAt ? ` ${v2.createdAt}` : ""}`
65863
+ ` ${v.id} ${versionLabel}${liveTag}${v.createdAt ? ` ${v.createdAt}` : ""}`
65416
65864
  );
65417
65865
  }
65418
65866
  });
@@ -65649,7 +66097,7 @@ function categoryBadge(category, useColor) {
65649
66097
  return chalk35.magenta(`[${category}]`);
65650
66098
  }
65651
66099
  function formatTailData(data) {
65652
- return Object.entries(data).map(([k2, v2]) => `${k2}=${typeof v2 === "string" ? v2 : JSON.stringify(v2)}`).join(" ");
66100
+ return Object.entries(data).map(([k2, v]) => `${k2}=${typeof v === "string" ? v : JSON.stringify(v)}`).join(" ");
65653
66101
  }
65654
66102
  function formatContextIds(event, useColor) {
65655
66103
  const ids = [];
@@ -65737,9 +66185,9 @@ async function createSession(apiUrl, apiKey, filters) {
65737
66185
  level: "levels",
65738
66186
  category: "categories"
65739
66187
  };
65740
- for (const [k2, v2] of Object.entries(filters)) {
65741
- if (v2 !== void 0 && arrayFields[k2]) {
65742
- filter[arrayFields[k2]] = [v2];
66188
+ for (const [k2, v] of Object.entries(filters)) {
66189
+ if (v !== void 0 && arrayFields[k2]) {
66190
+ filter[arrayFields[k2]] = [v];
65743
66191
  }
65744
66192
  }
65745
66193
  const body = Object.keys(filter).length > 0 ? { filter } : {};
@@ -65793,7 +66241,7 @@ async function runTail(options) {
65793
66241
  category: options.category
65794
66242
  };
65795
66243
  const useColor = options.color;
65796
- const activeFilters = Object.entries(filters).filter(([, v2]) => v2 !== void 0).map(([k2, v2]) => `${k2}=${v2}`);
66244
+ const activeFilters = Object.entries(filters).filter(([, v]) => v !== void 0).map(([k2, v]) => `${k2}=${v}`);
65797
66245
  process.stderr.write(
65798
66246
  (useColor ? chalk35.gray(
65799
66247
  `Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`
@@ -66989,11 +67437,11 @@ function collectSecretNames(agentDef) {
66989
67437
  function slugify2(s) {
66990
67438
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
66991
67439
  }
66992
- 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)", (v2, acc) => {
66993
- acc.push(v2);
67440
+ 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) => {
67441
+ acc.push(v);
66994
67442
  return acc;
66995
- }, []).option("--flow <id>", "Flow ID to export (may be repeated)", (v2, acc) => {
66996
- acc.push(v2);
67443
+ }, []).option("--flow <id>", "Flow ID to export (may be repeated)", (v, acc) => {
67444
+ acc.push(v);
66997
67445
  return acc;
66998
67446
  }, []).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(
66999
67447
  async (options) => {