@runtypelabs/cli 2.16.14 → 2.16.15

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 +592 -260
  2. package/package.json +4 -3
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
5
5
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
6
+ }) : x2)(function(x2) {
7
7
  if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
8
+ throw Error('Dynamic require of "' + x2 + '" is not supported');
9
9
  });
10
10
  var __esm = (fn, res) => function __init() {
11
11
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
@@ -741,10 +741,10 @@ function evaluateOperand(operand, context) {
741
741
  }
742
742
  function countTrailingBackslashes(s, i) {
743
743
  let n = 0;
744
- let j = i - 1;
745
- while (j >= 0 && s[j] === "\\") {
744
+ let j2 = i - 1;
745
+ while (j2 >= 0 && s[j2] === "\\") {
746
746
  n++;
747
- j--;
747
+ j2--;
748
748
  }
749
749
  return n;
750
750
  }
@@ -1581,8 +1581,8 @@ function assertNever(_x) {
1581
1581
  function assert(_) {
1582
1582
  }
1583
1583
  function getEnumValues(entries) {
1584
- const numericValues = Object.values(entries).filter((v) => typeof v === "number");
1585
- const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
1584
+ const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
1585
+ const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v2]) => v2);
1586
1586
  return values;
1587
1587
  }
1588
1588
  function joinValues(array2, separator = "|") {
@@ -1636,9 +1636,9 @@ function defineLazy(object2, key, getter) {
1636
1636
  }
1637
1637
  return value;
1638
1638
  },
1639
- set(v) {
1639
+ set(v2) {
1640
1640
  Object.defineProperty(object2, key, {
1641
- value: v
1641
+ value: v2
1642
1642
  // configurable: true,
1643
1643
  });
1644
1644
  },
@@ -1710,8 +1710,8 @@ var allowsEval = /* @__PURE__ */ cached(() => {
1710
1710
  return false;
1711
1711
  }
1712
1712
  try {
1713
- const F = Function;
1714
- new F("");
1713
+ const F2 = Function;
1714
+ new F2("");
1715
1715
  return true;
1716
1716
  } catch (_) {
1717
1717
  return false;
@@ -2059,21 +2059,21 @@ function required(Class2, schema, mask) {
2059
2059
  });
2060
2060
  return clone(schema, def);
2061
2061
  }
2062
- function aborted(x, startIndex = 0) {
2063
- if (x.aborted === true)
2062
+ function aborted(x2, startIndex = 0) {
2063
+ if (x2.aborted === true)
2064
2064
  return true;
2065
- for (let i = startIndex; i < x.issues.length; i++) {
2066
- if (x.issues[i]?.continue !== true) {
2065
+ for (let i = startIndex; i < x2.issues.length; i++) {
2066
+ if (x2.issues[i]?.continue !== true) {
2067
2067
  return true;
2068
2068
  }
2069
2069
  }
2070
2070
  return false;
2071
2071
  }
2072
- function explicitlyAborted(x, startIndex = 0) {
2073
- if (x.aborted === true)
2072
+ function explicitlyAborted(x2, startIndex = 0) {
2073
+ if (x2.aborted === true)
2074
2074
  return true;
2075
- for (let i = startIndex; i < x.issues.length; i++) {
2076
- if (x.issues[i]?.continue === false) {
2075
+ for (let i = startIndex; i < x2.issues.length; i++) {
2076
+ if (x2.issues[i]?.continue === false) {
2077
2077
  return true;
2078
2078
  }
2079
2079
  }
@@ -3150,19 +3150,19 @@ var Doc = class {
3150
3150
  return;
3151
3151
  }
3152
3152
  const content = arg;
3153
- const lines = content.split("\n").filter((x) => x);
3154
- const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
3155
- const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
3153
+ const lines = content.split("\n").filter((x2) => x2);
3154
+ const minIndent = Math.min(...lines.map((x2) => x2.length - x2.trimStart().length));
3155
+ const dedented = lines.map((x2) => x2.slice(minIndent)).map((x2) => " ".repeat(this.indent * 2) + x2);
3156
3156
  for (const line of dedented) {
3157
3157
  this.content.push(line);
3158
3158
  }
3159
3159
  }
3160
3160
  compile() {
3161
- const F = Function;
3161
+ const F2 = Function;
3162
3162
  const args = this?.args;
3163
3163
  const content = this?.content ?? [``];
3164
- const lines = [...content.map((x) => ` ${x}`)];
3165
- return new F(...args, lines.join("\n"));
3164
+ const lines = [...content.map((x2) => ` ${x2}`)];
3165
+ return new F2(...args, lines.join("\n"));
3166
3166
  }
3167
3167
  };
3168
3168
 
@@ -3325,10 +3325,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
3325
3325
  v7: 7,
3326
3326
  v8: 8
3327
3327
  };
3328
- const v = versionMap[def.version];
3329
- if (v === void 0)
3328
+ const v2 = versionMap[def.version];
3329
+ if (v2 === void 0)
3330
3330
  throw new Error(`Invalid UUID version: "${def.version}"`);
3331
- def.pattern ?? (def.pattern = uuid(v));
3331
+ def.pattern ?? (def.pattern = uuid(v2));
3332
3332
  } else
3333
3333
  def.pattern ?? (def.pattern = uuid());
3334
3334
  $ZodStringFormat.init(inst, def);
@@ -3538,7 +3538,7 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
3538
3538
  function isValidBase64URL(data) {
3539
3539
  if (!base64url.test(data))
3540
3540
  return false;
3541
- const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
3541
+ const base643 = data.replace(/[-_]/g, (c2) => c2 === "-" ? "+" : "/");
3542
3542
  const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
3543
3543
  return isValidBase64(padded);
3544
3544
  }
@@ -3933,8 +3933,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3933
3933
  const field = shape[key]._zod;
3934
3934
  if (field.values) {
3935
3935
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3936
- for (const v of field.values)
3937
- propValues[key].add(v);
3936
+ for (const v2 of field.values)
3937
+ propValues[key].add(v2);
3938
3938
  }
3939
3939
  }
3940
3940
  return propValues;
@@ -4229,10 +4229,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
4229
4229
  const pv = option._zod.propValues;
4230
4230
  if (!pv || Object.keys(pv).length === 0)
4231
4231
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
4232
- for (const [k, v] of Object.entries(pv)) {
4232
+ for (const [k, v2] of Object.entries(pv)) {
4233
4233
  if (!propValues[k])
4234
4234
  propValues[k] = /* @__PURE__ */ new Set();
4235
- for (const val of v) {
4235
+ for (const val of v2) {
4236
4236
  propValues[k].add(val);
4237
4237
  }
4238
4238
  }
@@ -4246,11 +4246,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
4246
4246
  const values = o._zod.propValues?.[def.discriminator];
4247
4247
  if (!values || values.size === 0)
4248
4248
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
4249
- for (const v of values) {
4250
- if (map2.has(v)) {
4251
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
4249
+ for (const v2 of values) {
4250
+ if (map2.has(v2)) {
4251
+ throw new Error(`Duplicate discriminator value "${String(v2)}"`);
4252
4252
  }
4253
- map2.set(v, o);
4253
+ map2.set(v2, o);
4254
4254
  }
4255
4255
  }
4256
4256
  return map2;
@@ -4371,7 +4371,7 @@ function handleIntersectionResults(result, left, right) {
4371
4371
  result.issues.push(iss);
4372
4372
  }
4373
4373
  }
4374
- const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
4374
+ const bothKeys = [...unrecKeys].filter(([, f2]) => f2.l && f2.r).map(([k]) => k);
4375
4375
  if (bothKeys.length && unrecIssue) {
4376
4376
  result.issues.push({ ...unrecIssue, keys: bothKeys });
4377
4377
  }
@@ -4885,8 +4885,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
4885
4885
  var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
4886
4886
  $ZodType.init(inst, def);
4887
4887
  defineLazy(inst._zod, "values", () => {
4888
- const v = def.innerType._zod.values;
4889
- return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
4888
+ const v2 = def.innerType._zod.values;
4889
+ return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
4890
4890
  });
4891
4891
  inst._zod.parse = (payload, ctx) => {
4892
4892
  const result = def.innerType._zod.run(payload, ctx);
@@ -5177,9 +5177,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
5177
5177
  return payload;
5178
5178
  };
5179
5179
  inst.input = (...args) => {
5180
- const F = inst.constructor;
5180
+ const F2 = inst.constructor;
5181
5181
  if (Array.isArray(args[0])) {
5182
- return new F({
5182
+ return new F2({
5183
5183
  type: "function",
5184
5184
  input: new $ZodTuple({
5185
5185
  type: "tuple",
@@ -5189,15 +5189,15 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
5189
5189
  output: inst._def.output
5190
5190
  });
5191
5191
  }
5192
- return new F({
5192
+ return new F2({
5193
5193
  type: "function",
5194
5194
  input: args[0],
5195
5195
  output: inst._def.output
5196
5196
  });
5197
5197
  };
5198
5198
  inst.output = (output) => {
5199
- const F = inst.constructor;
5200
- return new F({
5199
+ const F2 = inst.constructor;
5200
+ return new F2({
5201
5201
  type: "function",
5202
5202
  input: inst._def.input,
5203
5203
  output
@@ -7283,7 +7283,7 @@ var error17 = () => {
7283
7283
  if (issue2.values.length === 1) {
7284
7284
  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])}`;
7285
7285
  }
7286
- const stringified = issue2.values.map((v) => stringifyPrimitive(v));
7286
+ const stringified = issue2.values.map((v2) => stringifyPrimitive(v2));
7287
7287
  if (issue2.values.length === 2) {
7288
7288
  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]}`;
7289
7289
  }
@@ -11252,8 +11252,8 @@ var $ZodRegistry = class {
11252
11252
  if (p) {
11253
11253
  const pm = { ...this.get(p) ?? {} };
11254
11254
  delete pm.id;
11255
- const f = { ...pm, ...this._map.get(schema) };
11256
- return Object.keys(f).length ? f : void 0;
11255
+ const f2 = { ...pm, ...this._map.get(schema) };
11256
+ return Object.keys(f2).length ? f2 : void 0;
11257
11257
  }
11258
11258
  return this._map.get(schema);
11259
11259
  }
@@ -12038,7 +12038,7 @@ function _set(Class2, valueType, params) {
12038
12038
  }
12039
12039
  // @__NO_SIDE_EFFECTS__
12040
12040
  function _enum(Class2, values, params) {
12041
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
12041
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
12042
12042
  return new Class2({
12043
12043
  type: "enum",
12044
12044
  entries,
@@ -12243,8 +12243,8 @@ function _stringbool(Classes, _params) {
12243
12243
  let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
12244
12244
  let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
12245
12245
  if (params.case !== "sensitive") {
12246
- truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
12247
- falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
12246
+ truthyArray = truthyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
12247
+ falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
12248
12248
  }
12249
12249
  const truthySet = new Set(truthyArray);
12250
12250
  const falsySet = new Set(falsyArray);
@@ -12786,9 +12786,9 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
12786
12786
  var enumProcessor = (schema, _ctx, json2, _params) => {
12787
12787
  const def = schema._zod.def;
12788
12788
  const values = getEnumValues(def.entries);
12789
- if (values.every((v) => typeof v === "number"))
12789
+ if (values.every((v2) => typeof v2 === "number"))
12790
12790
  json2.type = "number";
12791
- if (values.every((v) => typeof v === "string"))
12791
+ if (values.every((v2) => typeof v2 === "string"))
12792
12792
  json2.type = "string";
12793
12793
  json2.enum = values;
12794
12794
  };
@@ -12821,13 +12821,13 @@ var literalProcessor = (schema, ctx, json2, _params) => {
12821
12821
  json2.const = val;
12822
12822
  }
12823
12823
  } else {
12824
- if (vals.every((v) => typeof v === "number"))
12824
+ if (vals.every((v2) => typeof v2 === "number"))
12825
12825
  json2.type = "number";
12826
- if (vals.every((v) => typeof v === "string"))
12826
+ if (vals.every((v2) => typeof v2 === "string"))
12827
12827
  json2.type = "string";
12828
- if (vals.every((v) => typeof v === "boolean"))
12828
+ if (vals.every((v2) => typeof v2 === "boolean"))
12829
12829
  json2.type = "boolean";
12830
- if (vals.every((v) => v === null))
12830
+ if (vals.every((v2) => v2 === null))
12831
12831
  json2.type = "null";
12832
12832
  json2.enum = vals;
12833
12833
  }
@@ -12863,7 +12863,7 @@ var fileProcessor = (schema, _ctx, json2, _params) => {
12863
12863
  Object.assign(_json, file2);
12864
12864
  } else {
12865
12865
  Object.assign(_json, file2);
12866
- _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
12866
+ _json.anyOf = mime.map((m2) => ({ contentMediaType: m2 }));
12867
12867
  }
12868
12868
  } else {
12869
12869
  Object.assign(_json, file2);
@@ -12925,11 +12925,11 @@ var objectProcessor = (schema, ctx, _json, params) => {
12925
12925
  }
12926
12926
  const allKeys = new Set(Object.keys(shape));
12927
12927
  const requiredKeys = new Set([...allKeys].filter((key) => {
12928
- const v = def.shape[key]._zod;
12928
+ const v2 = def.shape[key]._zod;
12929
12929
  if (ctx.io === "input") {
12930
- return v.optin === void 0;
12930
+ return v2.optin === void 0;
12931
12931
  } else {
12932
- return v.optout === void 0;
12932
+ return v2.optout === void 0;
12933
12933
  }
12934
12934
  }));
12935
12935
  if (requiredKeys.size > 0) {
@@ -12950,7 +12950,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
12950
12950
  var unionProcessor = (schema, ctx, json2, params) => {
12951
12951
  const def = schema._zod.def;
12952
12952
  const isExclusive = def.inclusive === false;
12953
- const options = def.options.map((x, i) => process2(x, ctx, {
12953
+ const options = def.options.map((x2, i) => process2(x2, ctx, {
12954
12954
  ...params,
12955
12955
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
12956
12956
  }));
@@ -12983,7 +12983,7 @@ var tupleProcessor = (schema, ctx, _json, params) => {
12983
12983
  json2.type = "array";
12984
12984
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
12985
12985
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
12986
- const prefixItems = def.items.map((x, i) => process2(x, ctx, {
12986
+ const prefixItems = def.items.map((x2, i) => process2(x2, ctx, {
12987
12987
  ...params,
12988
12988
  path: [...params.path, prefixPath, i]
12989
12989
  }));
@@ -13049,7 +13049,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
13049
13049
  }
13050
13050
  const keyValues = keyType._zod.values;
13051
13051
  if (keyValues) {
13052
- const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
13052
+ const validKeyValues = [...keyValues].filter((v2) => typeof v2 === "string" || typeof v2 === "number");
13053
13053
  if (validKeyValues.length > 0) {
13054
13054
  json2.required = validKeyValues;
13055
13055
  }
@@ -13614,12 +13614,12 @@ function _installLazyMethods(inst, group, methods) {
13614
13614
  });
13615
13615
  return bound;
13616
13616
  },
13617
- set(v) {
13617
+ set(v2) {
13618
13618
  Object.defineProperty(this, key, {
13619
13619
  configurable: true,
13620
13620
  writable: true,
13621
13621
  enumerable: true,
13622
- value: v
13622
+ value: v2
13623
13623
  });
13624
13624
  }
13625
13625
  });
@@ -14210,9 +14210,9 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
14210
14210
  inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
14211
14211
  inst.min = (value, params) => inst.check(_gte(value, params));
14212
14212
  inst.max = (value, params) => inst.check(_lte(value, params));
14213
- const c = inst._zod.bag;
14214
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
14215
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
14213
+ const c2 = inst._zod.bag;
14214
+ inst.minDate = c2.minimum ? new Date(c2.minimum) : null;
14215
+ inst.maxDate = c2.maximum ? new Date(c2.maximum) : null;
14216
14216
  });
14217
14217
  function date3(params) {
14218
14218
  return _date(ZodDate, params);
@@ -14507,7 +14507,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
14507
14507
  };
14508
14508
  });
14509
14509
  function _enum2(values, params) {
14510
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
14510
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
14511
14511
  return new ZodEnum({
14512
14512
  type: "enum",
14513
14513
  entries,
@@ -15059,10 +15059,10 @@ function convertBaseSchema(schema, ctx) {
15059
15059
  if (enumValues.length === 1) {
15060
15060
  return z.literal(enumValues[0]);
15061
15061
  }
15062
- if (enumValues.every((v) => typeof v === "string")) {
15062
+ if (enumValues.every((v2) => typeof v2 === "string")) {
15063
15063
  return z.enum(enumValues);
15064
15064
  }
15065
- const literalSchemas = enumValues.map((v) => z.literal(v));
15065
+ const literalSchemas = enumValues.map((v2) => z.literal(v2));
15066
15066
  if (literalSchemas.length < 2) {
15067
15067
  return literalSchemas[0];
15068
15068
  }
@@ -15626,7 +15626,10 @@ var agentReflectionEventSchema = external_exports.object({
15626
15626
  ...baseAgentEvent,
15627
15627
  type: external_exports.literal("agent_reflection"),
15628
15628
  iteration: external_exports.number(),
15629
- reflection: external_exports.string().optional()
15629
+ reflection: external_exports.string().optional(),
15630
+ // The runtime `AgentEventEmitter` injects an ISO timestamp on emit; mirrored
15631
+ // here for wire-superset parity (the api emitter omits it).
15632
+ timestamp: external_exports.string().optional()
15630
15633
  });
15631
15634
  var agentSkillLoadedEventSchema = external_exports.object({
15632
15635
  ...baseAgentEvent,
@@ -15636,7 +15639,9 @@ var agentSkillLoadedEventSchema = external_exports.object({
15636
15639
  /** Skill slug (the part after `skill:`). */
15637
15640
  skill: external_exports.string(),
15638
15641
  /** Names of the capability tools this skill activated for later turns. */
15639
- activatedCapabilities: external_exports.array(external_exports.string())
15642
+ activatedCapabilities: external_exports.array(external_exports.string()),
15643
+ // Runtime emitter injects an ISO timestamp on emit (api emitter omits it).
15644
+ timestamp: external_exports.string().optional()
15640
15645
  });
15641
15646
  var agentSkillProposedEventSchema = external_exports.object({
15642
15647
  ...baseAgentEvent,
@@ -15648,7 +15653,9 @@ var agentSkillProposedEventSchema = external_exports.object({
15648
15653
  /** Review outcome: queued for review, or auto-published under the opt-out. */
15649
15654
  outcome: external_exports.enum(["pending_approval", "auto_published"]),
15650
15655
  /** Proposal audit-row id (for the dashboard review queue). */
15651
- proposalId: external_exports.string().optional()
15656
+ proposalId: external_exports.string().optional(),
15657
+ // Runtime emitter injects an ISO timestamp on emit (api emitter omits it).
15658
+ timestamp: external_exports.string().optional()
15652
15659
  });
15653
15660
  var agentCompleteEventSchema = external_exports.object({
15654
15661
  ...baseAgentEvent,
@@ -15674,7 +15681,9 @@ var agentErrorEventSchema = external_exports.object({
15674
15681
  message: external_exports.string(),
15675
15682
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
15676
15683
  }),
15677
- recoverable: external_exports.boolean()
15684
+ recoverable: external_exports.boolean(),
15685
+ // Runtime emitter injects an ISO timestamp on emit (api emitter omits it).
15686
+ timestamp: external_exports.string().optional()
15678
15687
  });
15679
15688
  var agentPingEventSchema = external_exports.object({
15680
15689
  ...baseAgentEvent,
@@ -15738,6 +15747,9 @@ var flowCompleteEventSchema = external_exports.object({
15738
15747
  // The agent-dispatch / claude-managed paths emit via `formatFlowComplete({ success, duration })`,
15739
15748
  // which omits both flowId and completedAt — so both are optional on the wire superset.
15740
15749
  flowId: external_exports.string().optional(),
15750
+ // The api raw-write paths (engine.ts / virtual-flow.ts) spread `flowName: flow.name`
15751
+ // onto flow_complete; declared on flow_start too. Optional on the superset.
15752
+ flowName: external_exports.string().optional(),
15741
15753
  // emitter/runtime send success+duration; api raw-writes send the step counts instead.
15742
15754
  success: external_exports.boolean().optional(),
15743
15755
  duration: external_exports.number().optional(),
@@ -15801,6 +15813,11 @@ var stepStartEventSchema = external_exports.object({
15801
15813
  totalSteps: external_exports.number().optional(),
15802
15814
  startedAt: external_exports.string(),
15803
15815
  estimatedTokens: external_exports.number().optional(),
15816
+ // The step output-variable name. The api step-orchestrator spreads it onto
15817
+ // step_start (context + prompt step paths) and it survives the user-facing
15818
+ // filter; dashboard clients read it to unwrap the step's
15819
+ // `{ [outputVariable]: <rendered> }` envelope at render time.
15820
+ outputVariable: external_exports.string().optional(),
15804
15821
  stepId: external_exports.string().optional(),
15805
15822
  stepName: external_exports.string().optional(),
15806
15823
  toolContext: toolContextSchema.optional()
@@ -17407,41 +17424,41 @@ var PROVIDER_SECRET_SPECS = [
17407
17424
  {
17408
17425
  providerId: "google-vertex-anthropic",
17409
17426
  // Must come before google-vertex (shares vertex prefix) and anthropic (matches */claude-*).
17410
- matches: (m) => m.startsWith("vertex-anthropic/"),
17427
+ matches: (m2) => m2.startsWith("vertex-anthropic/"),
17411
17428
  secretNames: ["GOOGLE_VERTEX_PROJECT", "GOOGLE_VERTEX_LOCATION", "GOOGLE_VERTEX_CREDENTIALS"]
17412
17429
  },
17413
17430
  {
17414
17431
  providerId: "google-vertex",
17415
17432
  // Must come before google (matches */gemini-*).
17416
- matches: (m) => m.startsWith("vertex/"),
17433
+ matches: (m2) => m2.startsWith("vertex/"),
17417
17434
  secretNames: ["GOOGLE_VERTEX_PROJECT", "GOOGLE_VERTEX_LOCATION", "GOOGLE_VERTEX_CREDENTIALS"]
17418
17435
  },
17419
17436
  {
17420
17437
  providerId: "vercel-gateway",
17421
17438
  // Must come before openai — vercel/openai/gpt-4o would otherwise match openai.
17422
- matches: (m) => m.startsWith("vercel/") || m.startsWith("vercel."),
17439
+ matches: (m2) => m2.startsWith("vercel/") || m2.startsWith("vercel."),
17423
17440
  secretNames: ["VERCEL_AI_GATEWAY_API_KEY"]
17424
17441
  },
17425
17442
  {
17426
17443
  providerId: "cloudflare-gateway",
17427
17444
  // Must come before workers-ai — cloudflare/<provider>/<model> needs gateway routing.
17428
- matches: (m) => m.startsWith("cloudflare/") || m.startsWith("cloudflare:"),
17445
+ matches: (m2) => m2.startsWith("cloudflare/") || m2.startsWith("cloudflare:"),
17429
17446
  secretNames: ["CF_ACCOUNT_ID", "CF_AI_GATEWAY_ID"]
17430
17447
  },
17431
17448
  {
17432
17449
  providerId: "bedrock",
17433
- matches: (m) => m.startsWith("bedrock/"),
17450
+ matches: (m2) => m2.startsWith("bedrock/"),
17434
17451
  secretNames: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_REGION"]
17435
17452
  },
17436
17453
  {
17437
17454
  providerId: "tinfoil",
17438
- matches: (m) => m.startsWith("tinfoil/") || m.startsWith("tinfoil:"),
17455
+ matches: (m2) => m2.startsWith("tinfoil/") || m2.startsWith("tinfoil:"),
17439
17456
  secretNames: ["TINFOIL_API_KEY"]
17440
17457
  },
17441
17458
  {
17442
17459
  providerId: "generic-openai",
17443
17460
  // Must come before openai — shares the openai substring in its prefix.
17444
- matches: (m) => m.startsWith("generic-openai/") || m.startsWith("generic-openai:"),
17461
+ matches: (m2) => m2.startsWith("generic-openai/") || m2.startsWith("generic-openai:"),
17445
17462
  secretNames: ["GENERIC_OPENAI_API_KEY", "GENERIC_OPENAI_BASE_URL"]
17446
17463
  },
17447
17464
  {
@@ -17450,34 +17467,34 @@ var PROVIDER_SECRET_SPECS = [
17450
17467
  // host. Models are addressed only with the explicit `general-compute/` prefix
17451
17468
  // (e.g. `general-compute/minimax-m2.7`) so they never collide with the same
17452
17469
  // bare model id served by another gateway (Vercel already routes `minimax-m2.7`).
17453
- matches: (m) => m.startsWith("general-compute/") || m.startsWith("general-compute:"),
17470
+ matches: (m2) => m2.startsWith("general-compute/") || m2.startsWith("general-compute:"),
17454
17471
  secretNames: ["GENERAL_COMPUTE_API_KEY"]
17455
17472
  },
17456
17473
  {
17457
17474
  providerId: "workers-ai",
17458
17475
  // Uses a CF platform binding, not a secret — secretNames is intentionally empty.
17459
- matches: (m) => m.startsWith("@cf/") || m.startsWith("workers-ai/"),
17476
+ matches: (m2) => m2.startsWith("@cf/") || m2.startsWith("workers-ai/"),
17460
17477
  secretNames: []
17461
17478
  },
17462
17479
  {
17463
17480
  providerId: "togetherai",
17464
- matches: (m) => m.startsWith("together/") || m.startsWith("togetherai/"),
17481
+ matches: (m2) => m2.startsWith("together/") || m2.startsWith("togetherai/"),
17465
17482
  secretNames: ["TOGETHER_API_KEY"]
17466
17483
  },
17467
17484
  // ----- Base providers (broader patterns — must come last) -----
17468
17485
  {
17469
17486
  providerId: "anthropic",
17470
- matches: (m) => m.startsWith("anthropic/") || m.startsWith("claude-") || m.includes("/claude-"),
17487
+ matches: (m2) => m2.startsWith("anthropic/") || m2.startsWith("claude-") || m2.includes("/claude-"),
17471
17488
  secretNames: ["ANTHROPIC_API_KEY"]
17472
17489
  },
17473
17490
  {
17474
17491
  providerId: "openai",
17475
- matches: (m) => m.startsWith("openai/") || m.startsWith("gpt-") || m.startsWith("o1-") || m.startsWith("o3-") || m.startsWith("o4-") || m.includes("/gpt-"),
17492
+ matches: (m2) => m2.startsWith("openai/") || m2.startsWith("gpt-") || m2.startsWith("o1-") || m2.startsWith("o3-") || m2.startsWith("o4-") || m2.includes("/gpt-"),
17476
17493
  secretNames: ["OPENAI_API_KEY"]
17477
17494
  },
17478
17495
  {
17479
17496
  providerId: "google",
17480
- matches: (m) => m.startsWith("google/") || m.startsWith("gemini-") || m.includes("/gemini-"),
17497
+ matches: (m2) => m2.startsWith("google/") || m2.startsWith("gemini-") || m2.includes("/gemini-"),
17481
17498
  secretNames: ["GOOGLE_API_KEY"]
17482
17499
  },
17483
17500
  {
@@ -17486,12 +17503,12 @@ var PROVIDER_SECRET_SPECS = [
17486
17503
  // explicit prefixes. Does NOT match closed Alibaba models (qwen3.5-flash/plus)
17487
17504
  // which route through Vercel Gateway. See mixlayer-executor.ts for the
17488
17505
  // canonical predicate mirrored here.
17489
- matches: (m) => m.startsWith("mixlayer/") || m.startsWith("modelsocket/") || m.startsWith("qwen/") || m.startsWith("kimi-") || m.includes("/kimi-") || /(?:^|\/)qwen3[.-]5-\d+b(?:-a\d+b)?$/i.test(m),
17506
+ matches: (m2) => m2.startsWith("mixlayer/") || m2.startsWith("modelsocket/") || m2.startsWith("qwen/") || m2.startsWith("kimi-") || m2.includes("/kimi-") || /(?:^|\/)qwen3[.-]5-\d+b(?:-a\d+b)?$/i.test(m2),
17490
17507
  secretNames: ["MIXLAYER_API_KEY"]
17491
17508
  },
17492
17509
  {
17493
17510
  providerId: "xai",
17494
- matches: (m) => m.startsWith("grok-") || m.startsWith("xai/"),
17511
+ matches: (m2) => m2.startsWith("grok-") || m2.startsWith("xai/"),
17495
17512
  secretNames: ["XAI_API_KEY"]
17496
17513
  }
17497
17514
  ];
@@ -17502,6 +17519,102 @@ function resolveModelSecretNames(model) {
17502
17519
  }
17503
17520
  return [];
17504
17521
  }
17522
+ var RUNTIME_ARTIFACT_MANIFEST_VERSION = "2026-06-08";
17523
+ var runtimeArtifactResourceTypeSchema = external_exports.enum(["flow", "agent"]);
17524
+ var runtimeArtifactEntrypointSchema = external_exports.enum(["flow", "agent"]);
17525
+ var runtimeArtifactStatusSchema = external_exports.enum([
17526
+ "queued",
17527
+ "analyzing",
17528
+ "ineligible",
17529
+ "building",
17530
+ "uploaded",
17531
+ "active",
17532
+ "unhealthy",
17533
+ "failed",
17534
+ "disabled",
17535
+ "superseded"
17536
+ ]);
17537
+ var runtimeArtifactSandboxSchema = external_exports.enum([
17538
+ "none",
17539
+ "worker-loader",
17540
+ "runtype-sandbox",
17541
+ "daytona"
17542
+ ]);
17543
+ var runtimeArtifactServiceBackingSchema = external_exports.enum(["none", "service-binding"]);
17544
+ var runtimeArtifactPersistenceSchema = external_exports.enum(["none", "kv", "service-binding"]);
17545
+ var runtimeArtifactKeyModeSchema = external_exports.enum(["own", "platform", "hybrid"]);
17546
+ var runtimeArtifactBindingTypeSchema = external_exports.enum([
17547
+ "service",
17548
+ "kv_namespace",
17549
+ "dispatch_namespace",
17550
+ "worker_loader",
17551
+ "ai",
17552
+ "vectorize",
17553
+ "r2_bucket",
17554
+ "d1_database",
17555
+ "queue",
17556
+ "durable_object_namespace",
17557
+ "secret",
17558
+ "var"
17559
+ ]);
17560
+ var runtimeArtifactBindingSchema = external_exports.object({
17561
+ name: external_exports.string().min(1),
17562
+ type: runtimeArtifactBindingTypeSchema,
17563
+ target: external_exports.string().min(1).optional(),
17564
+ optional: external_exports.boolean().optional()
17565
+ });
17566
+ var runtimeArtifactEligibilityReasonSchema = external_exports.object({
17567
+ code: external_exports.string().min(1),
17568
+ detail: external_exports.string().min(1),
17569
+ severity: external_exports.enum(["warning", "error"]).default("error")
17570
+ });
17571
+ var runtimeArtifactManifestSchema = external_exports.object({
17572
+ version: external_exports.literal(RUNTIME_ARTIFACT_MANIFEST_VERSION),
17573
+ resource: external_exports.object({
17574
+ type: runtimeArtifactResourceTypeSchema,
17575
+ id: external_exports.string().min(1),
17576
+ versionId: external_exports.string().min(1),
17577
+ exportHash: external_exports.string().min(1)
17578
+ }),
17579
+ runtime: external_exports.object({
17580
+ packageVersion: external_exports.string().min(1),
17581
+ schemaVersion: external_exports.string().min(1).optional(),
17582
+ entrypoint: runtimeArtifactEntrypointSchema
17583
+ }),
17584
+ capabilities: external_exports.object({
17585
+ stepTypes: external_exports.array(external_exports.string().min(1)),
17586
+ modelProviders: external_exports.array(external_exports.string().min(1)),
17587
+ runtimeToolTypes: external_exports.array(external_exports.string().min(1)),
17588
+ builtinToolIds: external_exports.array(external_exports.string().min(1)),
17589
+ hasSubagents: external_exports.boolean(),
17590
+ hasMcpServers: external_exports.boolean(),
17591
+ hasSkills: external_exports.boolean(),
17592
+ sandbox: runtimeArtifactSandboxSchema,
17593
+ records: runtimeArtifactServiceBackingSchema,
17594
+ vectorStore: runtimeArtifactServiceBackingSchema,
17595
+ persistence: runtimeArtifactPersistenceSchema
17596
+ }),
17597
+ cloudflare: external_exports.object({
17598
+ compatibilityDate: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/),
17599
+ compatibilityFlags: external_exports.array(external_exports.string().min(1)),
17600
+ bindings: external_exports.array(runtimeArtifactBindingSchema),
17601
+ limits: external_exports.object({
17602
+ cpuMs: external_exports.number().int().positive(),
17603
+ subRequests: external_exports.number().int().positive()
17604
+ }),
17605
+ tags: external_exports.array(external_exports.string().min(1)).max(8)
17606
+ }),
17607
+ security: external_exports.object({
17608
+ keyMode: runtimeArtifactKeyModeSchema,
17609
+ requiresDirectProviderSecrets: external_exports.boolean(),
17610
+ secretNames: external_exports.array(external_exports.string().min(1)),
17611
+ contextTokenAudience: external_exports.string().min(1)
17612
+ }),
17613
+ eligibility: external_exports.object({
17614
+ eligible: external_exports.boolean(),
17615
+ reasons: external_exports.array(runtimeArtifactEligibilityReasonSchema)
17616
+ })
17617
+ });
17505
17618
  var EMIT_ARTIFACT_MARKDOWN_TOOL_ID = "emit_artifact_markdown";
17506
17619
  var EMIT_ARTIFACT_COMPONENT_TOOL_ID = "emit_artifact_component";
17507
17620
  var EMIT_ARTIFACT_MARKDOWN_FULL_ID = `builtin:${EMIT_ARTIFACT_MARKDOWN_TOOL_ID}`;
@@ -31800,10 +31913,10 @@ function isToolCompatibleWithModel(toolId, modelId, provider) {
31800
31913
  if (!tool.modelCompatibility || tool.modelCompatibility.length === 0) {
31801
31914
  return true;
31802
31915
  }
31803
- const compatibility = tool.modelCompatibility.find((c) => c.provider === providerKey);
31916
+ const compatibility = tool.modelCompatibility.find((c2) => c2.provider === providerKey);
31804
31917
  if (!compatibility) return true;
31805
31918
  if (compatibility.models.length === 0) return true;
31806
- return compatibility.models.some((m) => modelId.includes(m));
31919
+ return compatibility.models.some((m2) => modelId.includes(m2));
31807
31920
  }
31808
31921
  var SLACK_INTEGRATION = {
31809
31922
  id: "slack",
@@ -33197,7 +33310,7 @@ var DEFAULT_MODELS_FOR_NEW_ACCOUNTS = [
33197
33310
  // Google models (routed via Cloudflare Workers AI)
33198
33311
  { provider: "runtype", modelId: "gemma-4-26b-a4b-it", isDefault: false }
33199
33312
  ];
33200
- var DEFAULT_MODEL_ID = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.find((m) => m.isDefault)?.modelId ?? "qwen/qwen3.5-9b";
33313
+ var DEFAULT_MODEL_ID = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.find((m2) => m2.isDefault)?.modelId ?? "qwen/qwen3.5-9b";
33201
33314
  var MODEL_FAMILY_PROVIDER_IDS = {
33202
33315
  "claude-4-opus": {
33203
33316
  "vercel": "anthropic/claude-4-opus"
@@ -34452,7 +34565,7 @@ var PLATFORM_KEY_PROVIDER_MAP = {
34452
34565
  "mock": false
34453
34566
  };
34454
34567
  var PLATFORM_KEY_PROVIDERS = new Set(
34455
- Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v]) => v).map(([k]) => k)
34568
+ Object.entries(PLATFORM_KEY_PROVIDER_MAP).filter(([, v2]) => v2).map(([k]) => k)
34456
34569
  );
34457
34570
  var MANUAL_PROVIDER_MAP_OVERRIDES = {
34458
34571
  // Bedrock uses different model ID format
@@ -35503,18 +35616,18 @@ function extractSecretReferencesFromAnyValue(value, maxDepth = 10) {
35503
35616
  const keys = /* @__PURE__ */ new Set();
35504
35617
  walk(value, 0);
35505
35618
  return Array.from(keys);
35506
- function walk(v, depth) {
35619
+ function walk(v2, depth) {
35507
35620
  if (depth > maxDepth) return;
35508
- if (typeof v === "string") {
35509
- for (const key of extractSecretReferences(v)) keys.add(key);
35621
+ if (typeof v2 === "string") {
35622
+ for (const key of extractSecretReferences(v2)) keys.add(key);
35510
35623
  return;
35511
35624
  }
35512
- if (Array.isArray(v)) {
35513
- for (const item of v) walk(item, depth + 1);
35625
+ if (Array.isArray(v2)) {
35626
+ for (const item of v2) walk(item, depth + 1);
35514
35627
  return;
35515
35628
  }
35516
- if (v && typeof v === "object") {
35517
- for (const inner of Object.values(v)) {
35629
+ if (v2 && typeof v2 === "object") {
35630
+ for (const inner of Object.values(v2)) {
35518
35631
  walk(inner, depth + 1);
35519
35632
  }
35520
35633
  }
@@ -35736,7 +35849,7 @@ var capabilitySchema = external_exports.object({
35736
35849
  }).refine(
35737
35850
  (cap) => {
35738
35851
  const set2 = [cap.flow, cap.agent, cap.existingFlowId, cap.existingAgentId].filter(
35739
- (v) => v !== void 0 && v !== null
35852
+ (v2) => v2 !== void 0 && v2 !== null
35740
35853
  );
35741
35854
  return set2.length === 1;
35742
35855
  },
@@ -36104,7 +36217,7 @@ function validateCapability(cap, index, context) {
36104
36217
  const result = emptyResult();
36105
36218
  const base = `capabilities[${index}]`;
36106
36219
  const backings = [cap.flow, cap.agent, cap.existingFlowId, cap.existingAgentId].filter(
36107
- (v) => v !== void 0 && v !== null
36220
+ (v2) => v2 !== void 0 && v2 !== null
36108
36221
  );
36109
36222
  if (backings.length === 0) {
36110
36223
  result.errors.push(
@@ -36238,7 +36351,7 @@ function validateSurfaceDefinition(surface, index) {
36238
36351
  }
36239
36352
  function validateConnectivity(fpo) {
36240
36353
  const result = emptyResult();
36241
- const capabilityIds = new Set(fpo.capabilities.map((c) => c.id));
36354
+ const capabilityIds = new Set(fpo.capabilities.map((c2) => c2.id));
36242
36355
  for (const [si, surface] of fpo.surfaces.entries()) {
36243
36356
  if (!surface.routes) continue;
36244
36357
  for (const [ri, route] of surface.routes.entries()) {
@@ -36275,7 +36388,7 @@ function validateConnectivity(fpo) {
36275
36388
  );
36276
36389
  }
36277
36390
  }
36278
- const capabilityMap = new Map(fpo.capabilities.map((c) => [c.id, c]));
36391
+ const capabilityMap = new Map(fpo.capabilities.map((c2) => [c2.id, c2]));
36279
36392
  for (const [ci, cap] of fpo.capabilities.entries()) {
36280
36393
  if (!cap.agent?.capabilityToolRefs) continue;
36281
36394
  for (const [ri, ref] of cap.agent.capabilityToolRefs.entries()) {
@@ -37618,7 +37731,7 @@ ${lines.join("\n")}`;
37618
37731
  var PLATFORM_FEATURES_SUMMARY = (() => {
37619
37732
  const integrations = PLATFORM_CATALOG.availableIntegrations.map((i) => i.provider).join(", ");
37620
37733
  const stepTypes = FLOW_STEP_TYPES.filter((t) => t !== "prompt").join(", ");
37621
- const models = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.map((m) => m.modelId).join(", ");
37734
+ const models = DEFAULT_MODELS_FOR_NEW_ACCOUNTS.map((m2) => m2.modelId).join(", ");
37622
37735
  return `## Available Platform Features
37623
37736
 
37624
37737
  - **Built-in tools**: GPT Image 2 image generation, provider-native web search (OpenAI web search, Anthropic web search/fetch, xAI Live Search for Grok-3 series, xAI X Search / Web Search agentic tools for Grok-4 series), Exa (AI search), Firecrawl (simple web scraping), Browser Run tools (rendered markdown, HTML, screenshots, snapshots, selector scraping, JSON extraction, link harvesting \u2014 stateless), Browser Session tools (persistent interactive browsing: open, navigate, click, type, scroll, screenshot, evaluate, close), Browser Agent (autonomous higher-level alternative \u2014 give a natural-language goal plus a startUrl or sessionId and the agent navigates/clicks/extracts on its own), Store Asset (host any file from a URL or base64 inline content \u2014 returns a permanent public or signed private URL, downloads as attachment), Publish Page (host HTML that renders inline in the browser at a shareable 7-day /preview/ URL under a locked-down CSP), vector search, UCP commerce tools (discovery, catalog, cart, checkout, orders for any UCP-enabled merchant)
@@ -38831,7 +38944,7 @@ import { theme } from "@runtypelabs/ink-components";
38831
38944
  import { jsx, jsxs } from "react/jsx-runtime";
38832
38945
  function EntityCard({ fields, title }) {
38833
38946
  const visibleFields = fields.filter(
38834
- (f) => f.value !== null && f.value !== void 0
38947
+ (f2) => f2.value !== null && f2.value !== void 0
38835
38948
  );
38836
38949
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
38837
38950
  title && /* @__PURE__ */ jsx(Text, { color: theme.primary, bold: true, children: title }),
@@ -41495,8 +41608,8 @@ configCommand.command("get [key]").description("Get configuration value").action
41495
41608
  const allConfig = config2.store;
41496
41609
  if (Object.keys(allConfig).length > 0) {
41497
41610
  console.log(chalk9.cyan("Current Configuration:"));
41498
- for (const [k, v] of Object.entries(allConfig)) {
41499
- console.log(` ${chalk9.green(k)}: ${v}`);
41611
+ for (const [k, v2] of Object.entries(allConfig)) {
41612
+ console.log(` ${chalk9.green(k)}: ${v2}`);
41500
41613
  }
41501
41614
  } else {
41502
41615
  console.log(chalk9.gray("No configuration set"));
@@ -43064,7 +43177,7 @@ logsCommand.command("stats").description("Aggregate log stats: totals, counts by
43064
43177
  const formatCounts = (counts) => {
43065
43178
  const entries = Object.entries(counts);
43066
43179
  if (entries.length === 0) return "(none)";
43067
- return entries.map(([k, v]) => `${k}=${v}`).join(", ");
43180
+ return entries.map(([k, v2]) => `${k}=${v2}`).join(", ");
43068
43181
  };
43069
43182
  if (!isTTY(options) || options.json) {
43070
43183
  try {
@@ -44383,8 +44496,8 @@ var dispatchCommand = new Command14("dispatch").description("Execute a flow or a
44383
44496
  }
44384
44497
  if (options.variable && options.variable.length > 0) {
44385
44498
  const variables = {};
44386
- for (const v of options.variable) {
44387
- const [key, ...rest] = v.split("=");
44499
+ for (const v2 of options.variable) {
44500
+ const [key, ...rest] = v2.split("=");
44388
44501
  variables[key] = rest.join("=");
44389
44502
  }
44390
44503
  payload.variables = variables;
@@ -44662,7 +44775,7 @@ Messages (${messages.length}):`));
44662
44775
  try {
44663
44776
  const data = await client.get(`/conversations/${id}`);
44664
44777
  const messages = data.messages ?? [];
44665
- const messageSummary = messages.length === 0 ? "No messages" : messages.map((m) => `${m.role}: ${m.content}`).join("\n");
44778
+ const messageSummary = messages.length === 0 ? "No messages" : messages.map((m2) => `${m2.role}: ${m2.content}`).join("\n");
44666
44779
  setResultNode(
44667
44780
  React14.createElement(EntityCard, {
44668
44781
  fields: [
@@ -47726,7 +47839,7 @@ function BlinkingTextInput({
47726
47839
  return;
47727
47840
  }
47728
47841
  blinkRef.current = setInterval(() => {
47729
- setBlinkVisible((v) => !v);
47842
+ setBlinkVisible((v2) => !v2);
47730
47843
  }, CURSOR_BLINK_MS);
47731
47844
  return () => {
47732
47845
  if (blinkRef.current) {
@@ -47884,7 +47997,7 @@ function ModelPicker({ currentModel, onSelect, onCancel, models }) {
47884
47997
  if (!search.trim()) return sorted;
47885
47998
  const q = search.toLowerCase();
47886
47999
  return sorted.filter(
47887
- (m) => m.label.toLowerCase().includes(q) || m.value.toLowerCase().includes(q) || m.group.toLowerCase().includes(q)
48000
+ (m2) => m2.label.toLowerCase().includes(q) || m2.value.toLowerCase().includes(q) || m2.group.toLowerCase().includes(q)
47888
48001
  );
47889
48002
  }, [sorted, search]);
47890
48003
  const searchRef = useRef6("");
@@ -48264,8 +48377,8 @@ function TextArea({
48264
48377
  const separator = theme21.separator ?? " \xB7 ";
48265
48378
  const [lines, setLines] = useState23(() => splitLines(defaultValue));
48266
48379
  const [cursor, setCursor] = useState23(() => {
48267
- const l = splitLines(defaultValue);
48268
- return { line: l.length - 1, col: l[l.length - 1].length };
48380
+ const l2 = splitLines(defaultValue);
48381
+ return { line: l2.length - 1, col: l2[l2.length - 1].length };
48269
48382
  });
48270
48383
  const [scrollOffset, setScrollOffset] = useState23(0);
48271
48384
  const [blinkVisible, setBlinkVisible] = useState23(true);
@@ -48276,7 +48389,7 @@ function TextArea({
48276
48389
  cursorRef.current = cursor;
48277
48390
  useEffect20(() => {
48278
48391
  blinkRef.current = setInterval(() => {
48279
- setBlinkVisible((v) => !v);
48392
+ setBlinkVisible((v2) => !v2);
48280
48393
  }, CURSOR_BLINK_MS);
48281
48394
  return () => {
48282
48395
  if (blinkRef.current) {
@@ -48973,11 +49086,11 @@ function compactRawStreamEventForCopy(event) {
48973
49086
  data = JSON.parse(JSON.stringify(event.listData, stringCompactionReplacer));
48974
49087
  } else {
48975
49088
  data = {};
48976
- for (const [k, v] of Object.entries(event.data)) {
49089
+ for (const [k, v2] of Object.entries(event.data)) {
48977
49090
  if (STREAM_EVENT_HEAVY_KEYS.has(k)) {
48978
- data[k] = compactHeavyField(v);
49091
+ data[k] = compactHeavyField(v2);
48979
49092
  } else {
48980
- data[k] = compactJsonLike(v);
49093
+ data[k] = compactJsonLike(v2);
48981
49094
  }
48982
49095
  }
48983
49096
  }
@@ -49048,10 +49161,10 @@ function compactSessionSummaryForContextExport(s) {
49048
49161
  ...s.toolTraceSummary !== void 0 ? { toolTraceSummary: compactLongText(s.toolTraceSummary) } : {}
49049
49162
  };
49050
49163
  }
49051
- function compactContinuationForContextExport(c) {
49164
+ function compactContinuationForContextExport(c2) {
49052
49165
  return {
49053
- ...c,
49054
- ...c.userMessage !== void 0 ? { userMessage: compactLongText(c.userMessage) } : {}
49166
+ ...c2,
49167
+ ...c2.userMessage !== void 0 ? { userMessage: compactLongText(c2.userMessage) } : {}
49055
49168
  };
49056
49169
  }
49057
49170
  function compactMarathonStateJsonForContextExport(parsed) {
@@ -49069,11 +49182,11 @@ function compactMarathonStateJsonForContextExport(parsed) {
49069
49182
  (snap) => compactSessionSnapshotForContextExport(snap)
49070
49183
  );
49071
49184
  } else if (key === "messages" && Array.isArray(value)) {
49072
- out[key] = value.map((m) => compactAgentMessageForContextExport(m));
49185
+ out[key] = value.map((m2) => compactAgentMessageForContextExport(m2));
49073
49186
  } else if (key === "sessions" && Array.isArray(value)) {
49074
49187
  out[key] = value.map((s) => compactSessionSummaryForContextExport(s));
49075
49188
  } else if (key === "continuations" && Array.isArray(value)) {
49076
- out[key] = value.map((c) => compactContinuationForContextExport(c));
49189
+ out[key] = value.map((c2) => compactContinuationForContextExport(c2));
49077
49190
  } else if (key === "lastOutput" || key === "bootstrapContext" || key === "originalMessage" || key === "lastError" || key === "phaseTransitionSummary") {
49078
49191
  out[key] = typeof value === "string" ? compactLongText(value) : value;
49079
49192
  } else if (key === "workflowState" && value && typeof value === "object") {
@@ -49712,8 +49825,8 @@ function copyToClipboard(text) {
49712
49825
  }
49713
49826
  function isBlank(s) {
49714
49827
  for (let i = 0; i < s.length; i++) {
49715
- const c = s.charCodeAt(i);
49716
- if (c !== 32 && c !== 9 && c !== 10 && c !== 13) return false;
49828
+ const c2 = s.charCodeAt(i);
49829
+ if (c2 !== 32 && c2 !== 9 && c2 !== 10 && c2 !== 13) return false;
49717
49830
  }
49718
49831
  return true;
49719
49832
  }
@@ -52365,7 +52478,7 @@ function findLatestStateFile(stateDir) {
52365
52478
  let latest = null;
52366
52479
  for (const dir of dirs) {
52367
52480
  if (!fs7.existsSync(dir)) continue;
52368
- const files = fs7.readdirSync(dir).filter((f) => f.endsWith(".json"));
52481
+ const files = fs7.readdirSync(dir).filter((f2) => f2.endsWith(".json"));
52369
52482
  for (const file2 of files) {
52370
52483
  const fullPath = path8.join(dir, file2);
52371
52484
  const stat = fs7.statSync(fullPath);
@@ -53710,7 +53823,7 @@ function loadRules(cwd) {
53710
53823
  if (!fs11.existsSync(rulesDir)) return [];
53711
53824
  const rules = [];
53712
53825
  try {
53713
- const entries = fs11.readdirSync(rulesDir).filter((f) => f.endsWith(".md"));
53826
+ const entries = fs11.readdirSync(rulesDir).filter((f2) => f2.endsWith(".md"));
53714
53827
  for (const entry of entries) {
53715
53828
  const filePath = path12.join(rulesDir, entry);
53716
53829
  try {
@@ -53964,15 +54077,15 @@ function loadPlaybook(nameOrPath, cwd) {
53964
54077
  validatePlaybook(config3, candidate);
53965
54078
  const milestoneModels = {};
53966
54079
  const milestoneFallbackModels = {};
53967
- for (const m of config3.milestones) {
53968
- if (m.model) milestoneModels[m.name] = m.model;
53969
- if (m.fallbackModels?.length) {
53970
- milestoneFallbackModels[m.name] = m.fallbackModels.map(normalizeFallbackModel);
54080
+ for (const m2 of config3.milestones) {
54081
+ if (m2.model) milestoneModels[m2.name] = m2.model;
54082
+ if (m2.fallbackModels?.length) {
54083
+ milestoneFallbackModels[m2.name] = m2.fallbackModels.map(normalizeFallbackModel);
53971
54084
  }
53972
54085
  }
53973
54086
  return {
53974
54087
  workflow: convertToWorkflow(config3),
53975
- milestones: config3.milestones.map((m) => m.name),
54088
+ milestones: config3.milestones.map((m2) => m2.name),
53976
54089
  milestoneModels: Object.keys(milestoneModels).length > 0 ? milestoneModels : void 0,
53977
54090
  milestoneFallbackModels: Object.keys(milestoneFallbackModels).length > 0 ? milestoneFallbackModels : void 0,
53978
54091
  verification: config3.verification,
@@ -53982,7 +54095,7 @@ function loadPlaybook(nameOrPath, cwd) {
53982
54095
  }
53983
54096
  throw new Error(
53984
54097
  `Playbook '${nameOrPath}' not found. Searched:
53985
- ${candidates.map((c) => ` ${c}`).join("\n")}`
54098
+ ${candidates.map((c2) => ` ${c2}`).join("\n")}`
53986
54099
  );
53987
54100
  }
53988
54101
 
@@ -54238,7 +54351,7 @@ async function taskAction(agent, options) {
54238
54351
  options.model,
54239
54352
  options.planningModel,
54240
54353
  options.executionModel
54241
- ].filter((m) => Boolean(m))
54354
+ ].filter((m2) => Boolean(m2))
54242
54355
  )
54243
54356
  ];
54244
54357
  let resolvedToolIds = [];
@@ -55289,11 +55402,11 @@ Saving state... done. Session saved to ${filePath}`);
55289
55402
  if (finalState.continuations && finalState.continuations.length > 0) {
55290
55403
  console.log(chalk23.dim("\nContinuation history:"));
55291
55404
  for (let i = 0; i < finalState.continuations.length; i++) {
55292
- const c = finalState.continuations[i];
55293
- const msg = c.userMessage ? ` "${c.userMessage.slice(0, 50)}"` : " (no message)";
55294
- const modelName = c.model ? ` [${c.model}]` : "";
55405
+ const c2 = finalState.continuations[i];
55406
+ const msg = c2.userMessage ? ` "${c2.userMessage.slice(0, 50)}"` : " (no message)";
55407
+ const modelName = c2.model ? ` [${c2.model}]` : "";
55295
55408
  console.log(
55296
- chalk23.gray(` #${i + 1}: ${c.continuedAt}${modelName}${msg} \u2014 $${c.segmentCost.toFixed(4)}`)
55409
+ chalk23.gray(` #${i + 1}: ${c2.continuedAt}${modelName}${msg} \u2014 $${c2.segmentCost.toFixed(4)}`)
55297
55410
  );
55298
55411
  }
55299
55412
  }
@@ -55938,10 +56051,10 @@ modelsCommand.command("available").description("List all available models groupe
55938
56051
  const group = item;
55939
56052
  return React17.createElement(EntityCard, {
55940
56053
  title: `${group.provider} / ${group.baseModel}`,
55941
- fields: group.variants.map((v) => ({
55942
- label: v.modelId,
55943
- value: v.configured ? "configured" : "available",
55944
- color: v.configured ? "green" : void 0
56054
+ fields: group.variants.map((v2) => ({
56055
+ label: v2.modelId,
56056
+ value: v2.configured ? "configured" : "available",
56057
+ color: v2.configured ? "green" : void 0
55945
56058
  }))
55946
56059
  });
55947
56060
  },
@@ -57758,14 +57871,304 @@ import { execFileSync } from "child_process";
57758
57871
  // src/lib/persona-init.ts
57759
57872
  init_credential_store();
57760
57873
 
57874
+ // ../../node_modules/.pnpm/@runtypelabs+persona@3.29.0/node_modules/@runtypelabs/persona/dist/codegen.js
57875
+ var S = { name: "@runtypelabs/persona", version: "3.29.0", description: "Themeable, pluggable streaming agent widget for websites, in plain JS with support for voice input and reasoning / tool output.", type: "module", main: "dist/index.cjs", module: "dist/index.js", types: "dist/index.d.ts", exports: { ".": { types: "./dist/index.d.ts", import: "./dist/index.js", require: "./dist/index.cjs" }, "./theme-reference": { types: "./dist/theme-reference.d.ts", import: "./dist/theme-reference.js", require: "./dist/theme-reference.cjs" }, "./codegen": { types: "./dist/codegen.d.ts", import: "./dist/codegen.js", require: "./dist/codegen.cjs" }, "./theme-editor": { types: "./dist/theme-editor.d.ts", import: "./dist/theme-editor.js", require: "./dist/theme-editor.cjs" }, "./testing": { types: "./dist/testing.d.ts", import: "./dist/testing.js", require: "./dist/testing.cjs" }, "./smart-dom-reader": { types: "./dist/smart-dom-reader.d.ts", import: "./dist/smart-dom-reader.js", require: "./dist/smart-dom-reader.cjs" }, "./animations/glyph-cycle": { types: "./dist/animations/glyph-cycle.d.ts", import: "./dist/animations/glyph-cycle.js", require: "./dist/animations/glyph-cycle.cjs" }, "./animations/wipe": { types: "./dist/animations/wipe.d.ts", import: "./dist/animations/wipe.js", require: "./dist/animations/wipe.cjs" }, "./widget.css": "./dist/widget.css" }, files: ["dist", "src"], scripts: { build: "rimraf dist && pnpm run build:styles && pnpm run build:client && pnpm run build:installer && pnpm run build:launcher && pnpm run build:theme-ref && pnpm run build:codegen && pnpm run build:theme-editor && pnpm run build:testing && pnpm run build:smart-dom-reader && pnpm run build:animations", "build:theme-editor": "tsup src/theme-editor.ts --format esm,cjs --minify --dts --out-dir dist --no-splitting", "build:testing": "tsup src/testing.ts --format esm,cjs --minify --dts --out-dir dist --no-splitting", "build:smart-dom-reader": "tsup src/smart-dom-reader.ts --format esm,cjs --minify --dts --out-dir dist --no-splitting", "build:animations": "tsup src/animations/glyph-cycle.ts src/animations/wipe.ts --format esm,cjs --minify --dts --out-dir dist/animations --no-splitting", "build:theme-ref": "tsup src/theme-reference.ts --format esm,cjs --minify --dts", "build:codegen": "tsup src/codegen.ts --format esm,cjs --minify --dts", "build:styles": `node -e "const fs=require('fs');fs.mkdirSync('dist',{recursive:true});fs.copyFileSync('src/styles/widget.css','dist/widget.css');"`, "build:client": `tsup src/index.ts --format esm,cjs --minify --sourcemap --splitting false --dts --loader ".css=text" && tsup src/index-global.ts --format iife --global-name AgentWidget --minify --sourcemap --splitting false --out-dir dist --loader ".css=text" && node -e "const fs=require('fs');for(const ext of ['.global.js','.global.js.map']){const from='dist/index-global'+ext;if(fs.existsSync(from))fs.renameSync(from,'dist/index'+ext);}"`, "build:installer": "tsup src/install.ts --format iife --global-name SiteAgentInstaller --out-dir dist --minify --sourcemap --no-splitting", "build:launcher": `tsup src/launcher-global.ts --format iife --global-name AgentWidgetLauncher --minify --sourcemap --splitting false --out-dir dist && node -e "const fs=require('fs');for(const ext of ['.global.js','.global.js.map']){const from='dist/launcher-global'+ext;if(fs.existsSync(from))fs.renameSync(from,'dist/launcher'+ext);}"`, lint: "eslint . --ext .ts", typecheck: "pnpm run check:runtype-types && tsc --noEmit", test: "vitest", "test:ui": "vitest --ui", "test:run": "vitest run", size: "size-limit", "fetch:runtype-openapi": "node scripts/fetch-runtype-openapi.mjs", "generate:runtype-types": "pnpm run fetch:runtype-openapi && node scripts/generate-runtype-openapi-types.mjs", "check:runtype-types": "pnpm run fetch:runtype-openapi && node scripts/generate-runtype-openapi-types.mjs --check" }, dependencies: { "@mcp-b/webmcp-polyfill": "^3.0.0", dompurify: "^3.3.3", idiomorph: "^0.7.4", lucide: "^0.552.0", marked: "^12.0.2", "partial-json": "^0.1.7", zod: "^3.22.4" }, devDependencies: { "@size-limit/file": "^12.1.0", "@types/node": "^20.12.7", "@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/parser": "^7.0.0", "@vitest/ui": "^4.0.9", eslint: "^8.57.0", "eslint-config-prettier": "^9.1.0", "fake-indexeddb": "^6.2.5", rimraf: "^5.0.5", "size-limit": "^12.1.0", tsup: "^8.0.1", typescript: "^5.4.5", vitest: "^4.0.9" }, engines: { node: ">=20.0.0" }, author: "Runtype", license: "MIT", keywords: ["ai", "chat", "widget", "streaming", "typescript", "persona", "agent"], repository: { type: "git", url: "git+https://github.com/runtypelabs/persona.git", directory: "packages/widget" }, bugs: { url: "https://github.com/runtypelabs/persona/issues" }, homepage: "https://github.com/runtypelabs/persona/tree/main/packages/widget#readme", publishConfig: { access: "public" } };
57876
+ var c = S.version;
57877
+ function u(e) {
57878
+ if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((r) => r.toString()).join(", ")}]` : e.toString();
57879
+ }
57880
+ function T(e) {
57881
+ 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) };
57882
+ }
57883
+ var x = `({ text, message }: any) => {
57884
+ const jsonSource = (message as any).rawContent || text || message.content;
57885
+ if (!jsonSource || typeof jsonSource !== 'string') return null;
57886
+ let cleanJson = jsonSource
57887
+ .replace(/^\`\`\`(?:json)?\\s*\\n?/, '')
57888
+ .replace(/\\n?\`\`\`\\s*$/, '')
57889
+ .trim();
57890
+ if (!cleanJson.startsWith('{') || !cleanJson.endsWith('}')) return null;
57891
+ try {
57892
+ const parsed = JSON.parse(cleanJson);
57893
+ if (parsed.action) return { type: parsed.action, payload: parsed };
57894
+ } catch (e) { return null; }
57895
+ return null;
57896
+ }`;
57897
+ var A = `function(ctx) {
57898
+ var jsonSource = ctx.message.rawContent || ctx.text || ctx.message.content;
57899
+ if (!jsonSource || typeof jsonSource !== 'string') return null;
57900
+ var cleanJson = jsonSource
57901
+ .replace(/^\`\`\`(?:json)?\\s*\\n?/, '')
57902
+ .replace(/\\n?\`\`\`\\s*$/, '')
57903
+ .trim();
57904
+ if (!cleanJson.startsWith('{') || !cleanJson.endsWith('}')) return null;
57905
+ try {
57906
+ var parsed = JSON.parse(cleanJson);
57907
+ if (parsed.action) return { type: parsed.action, payload: parsed };
57908
+ } catch (e) { return null; }
57909
+ return null;
57910
+ }`;
57911
+ var O = `(action: any, context: any) => {
57912
+ if (action.type !== 'nav_then_click') return;
57913
+ const payload = action.payload || action.raw || {};
57914
+ const url = payload?.page;
57915
+ const text = payload?.on_load_text || 'Navigating...';
57916
+ if (!url) return { handled: true, displayText: text };
57917
+ const messageId = context.message?.id;
57918
+ const processedActions = JSON.parse(localStorage.getItem(PROCESSED_ACTIONS_KEY) || '[]');
57919
+ const actionKey = \`nav_\${messageId}_\${url}\`;
57920
+ if (processedActions.includes(actionKey)) {
57921
+ return { handled: true, displayText: text };
57922
+ }
57923
+ processedActions.push(actionKey);
57924
+ localStorage.setItem(PROCESSED_ACTIONS_KEY, JSON.stringify(processedActions));
57925
+ const targetUrl = url.startsWith('http') ? url : new URL(url, window.location.origin).toString();
57926
+ window.location.href = targetUrl;
57927
+ return { handled: true, displayText: text };
57928
+ }`;
57929
+ var E = `function(action, context) {
57930
+ if (action.type !== 'nav_then_click') return;
57931
+ var payload = action.payload || action.raw || {};
57932
+ var url = payload.page;
57933
+ var text = payload.on_load_text || 'Navigating...';
57934
+ if (!url) return { handled: true, displayText: text };
57935
+ var messageId = context.message ? context.message.id : null;
57936
+ var processedActions = JSON.parse(localStorage.getItem(PROCESSED_ACTIONS_KEY) || '[]');
57937
+ var actionKey = 'nav_' + messageId + '_' + url;
57938
+ if (processedActions.includes(actionKey)) {
57939
+ return { handled: true, displayText: text };
57940
+ }
57941
+ processedActions.push(actionKey);
57942
+ localStorage.setItem(PROCESSED_ACTIONS_KEY, JSON.stringify(processedActions));
57943
+ var targetUrl = url.startsWith('http') ? url : new URL(url, window.location.origin).toString();
57944
+ window.location.href = targetUrl;
57945
+ return { handled: true, displayText: text };
57946
+ }`;
57947
+ var M = `(parsed: any) => {
57948
+ if (!parsed || typeof parsed !== 'object') return null;
57949
+ if (parsed.action === 'nav_then_click') return 'Navigating...';
57950
+ if (parsed.action === 'message') return parsed.text || '';
57951
+ if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
57952
+ return parsed.text || null;
57953
+ }`;
57954
+ var R = `function(parsed) {
57955
+ if (!parsed || typeof parsed !== 'object') return null;
57956
+ if (parsed.action === 'nav_then_click') return 'Navigating...';
57957
+ if (parsed.action === 'message') return parsed.text || '';
57958
+ if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
57959
+ return parsed.text || null;
57960
+ }`;
57961
+ function v(e) {
57962
+ if (!e) return null;
57963
+ let r = e.toString();
57964
+ 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;
57965
+ }
57966
+ function h(e) {
57967
+ var r, n;
57968
+ return (n = (r = e.parserType) != null ? r : v(e.streamParser)) != null ? n : "plain";
57969
+ }
57970
+ function f(e, r) {
57971
+ let n = [];
57972
+ return e.toolCall && (n.push(`${r}toolCall: {`), Object.entries(e.toolCall).forEach(([s, o]) => {
57973
+ typeof o == "string" && n.push(`${r} ${s}: "${o}",`);
57974
+ }), n.push(`${r}},`)), n;
57975
+ }
57976
+ function m(e, r, n) {
57977
+ 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);
57978
+ return (o || t) && (s.push(`${r}messageActions: {`), e.messageActions && Object.entries(e.messageActions).forEach(([i, a]) => {
57979
+ i === "onFeedback" || i === "onCopy" || (typeof a == "string" ? s.push(`${r} ${i}: "${a}",`) : typeof a == "boolean" && s.push(`${r} ${i}: ${a},`));
57980
+ }), n != null && n.onFeedback && s.push(`${r} onFeedback: ${n.onFeedback},`), n != null && n.onCopy && s.push(`${r} onCopy: ${n.onCopy},`), s.push(`${r}},`)), s;
57981
+ }
57982
+ function y(e, r) {
57983
+ let n = [];
57984
+ if (e.markdown) {
57985
+ let s = e.markdown.options && Object.keys(e.markdown.options).length > 0, o = e.markdown.disableDefaultStyles !== void 0;
57986
+ (s || o) && (n.push(`${r}markdown: {`), s && (n.push(`${r} options: {`), Object.entries(e.markdown.options).forEach(([t, i]) => {
57987
+ typeof i == "string" ? n.push(`${r} ${t}: "${i}",`) : typeof i == "boolean" && n.push(`${r} ${t}: ${i},`);
57988
+ }), n.push(`${r} },`)), o && n.push(`${r} disableDefaultStyles: ${e.markdown.disableDefaultStyles},`), n.push(`${r}},`));
57989
+ }
57990
+ return n;
57991
+ }
57992
+ function C(e, r) {
57993
+ let n = [];
57994
+ if (e.layout) {
57995
+ let s = e.layout.header && Object.keys(e.layout.header).some((t) => t !== "render"), o = e.layout.messages && Object.keys(e.layout.messages).some((t) => t !== "renderUserMessage" && t !== "renderAssistantMessage");
57996
+ (s || o) && (n.push(`${r}layout: {`), s && (n.push(`${r} header: {`), Object.entries(e.layout.header).forEach(([t, i]) => {
57997
+ t !== "render" && (typeof i == "string" ? n.push(`${r} ${t}: "${i}",`) : typeof i == "boolean" && n.push(`${r} ${t}: ${i},`));
57998
+ }), n.push(`${r} },`)), o && (n.push(`${r} messages: {`), Object.entries(e.layout.messages).forEach(([t, i]) => {
57999
+ t === "renderUserMessage" || t === "renderAssistantMessage" || (t === "avatar" && typeof i == "object" && i !== null ? (n.push(`${r} avatar: {`), Object.entries(i).forEach(([a, p]) => {
58000
+ typeof p == "string" ? n.push(`${r} ${a}: "${p}",`) : typeof p == "boolean" && n.push(`${r} ${a}: ${p},`);
58001
+ }), n.push(`${r} },`)) : t === "timestamp" && typeof i == "object" && i !== null ? Object.entries(i).some(([p]) => p !== "format") && (n.push(`${r} timestamp: {`), Object.entries(i).forEach(([p, d]) => {
58002
+ p !== "format" && (typeof d == "string" ? n.push(`${r} ${p}: "${d}",`) : typeof d == "boolean" && n.push(`${r} ${p}: ${d},`));
58003
+ }), n.push(`${r} },`)) : typeof i == "string" ? n.push(`${r} ${t}: "${i}",`) : typeof i == "boolean" && n.push(`${r} ${t}: ${i},`));
58004
+ }), n.push(`${r} },`)), n.push(`${r}},`));
58005
+ }
58006
+ return n;
58007
+ }
58008
+ function $(e, r) {
58009
+ let n = [];
58010
+ 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;
58011
+ }
58012
+ function j(e, r, n) {
58013
+ Object.entries(r).forEach(([s, o]) => {
58014
+ if (!(o === void 0 || typeof o == "function")) {
58015
+ if (Array.isArray(o)) {
58016
+ e.push(`${n}${s}: ${JSON.stringify(o)},`);
58017
+ return;
58018
+ }
58019
+ if (o && typeof o == "object") {
58020
+ e.push(`${n}${s}: {`), j(e, o, `${n} `), e.push(`${n}},`);
58021
+ return;
58022
+ }
58023
+ e.push(`${n}${s}: ${JSON.stringify(o)},`);
58024
+ }
58025
+ });
58026
+ }
58027
+ function l(e, r, n, s) {
58028
+ n && (e.push(`${s}${r}: {`), j(e, n, `${s} `), e.push(`${s}},`));
58029
+ }
58030
+ function g(e) {
58031
+ var r;
58032
+ return ((r = e == null ? void 0 : e.target) != null ? r : "body").replace(/\\/g, "\\\\").replace(/'/g, "\\'");
58033
+ }
58034
+ function I(e, r = "esm", n) {
58035
+ let s = { ...e };
58036
+ delete s.postprocessMessage, delete s.initialMessages;
58037
+ let o = n ? { ...n, hooks: T(n.hooks) } : void 0;
58038
+ return r === "esm" ? W(s, o) : r === "script-installer" ? D(s, o) : r === "script-advanced" ? J(s, o) : r === "react-component" ? H(s, o) : r === "react-advanced" ? N(s, o) : F(s, o);
58039
+ }
58040
+ function W(e, r) {
58041
+ 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: {"];
58042
+ 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]) => {
58043
+ t.push(` ${i}: "${a}",`);
58044
+ }), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([i, a]) => {
58045
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" && t.push(` ${i}: ${a},`);
58046
+ }), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([i, a]) => {
58047
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" ? t.push(` ${i}: ${a},`) : typeof a == "number" && t.push(` ${i}: ${a},`);
58048
+ }), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([i, a]) => {
58049
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" && t.push(` ${i}: ${a},`);
58050
+ }), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([i, a]) => {
58051
+ t.push(` ${i}: ${a},`);
58052
+ }), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
58053
+ t.push(` "${i}",`);
58054
+ }), 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(`
58055
+ `);
58056
+ }
58057
+ function H(e, r) {
58058
+ let n = r == null ? void 0 : r.hooks, s = h(e), o = s !== "plain", t = ["// ChatWidget.tsx", "'use client'; // Required for Next.js - remove for Vite/CRA", "", "import { useEffect } from 'react';", "import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "import type { AgentWidgetInitHandle } from '@runtypelabs/persona';", "", "export function ChatWidget() {", " useEffect(() => {", " let handle: AgentWidgetInitHandle | null = null;", "", " handle = initAgentWidget({", ` target: '${g(r)}',`, " config: {"];
58059
+ 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]) => {
58060
+ t.push(` ${i}: "${a}",`);
58061
+ }), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([i, a]) => {
58062
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" && t.push(` ${i}: ${a},`);
58063
+ }), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([i, a]) => {
58064
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" ? t.push(` ${i}: ${a},`) : typeof a == "number" && t.push(` ${i}: ${a},`);
58065
+ }), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([i, a]) => {
58066
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" && t.push(` ${i}: ${a},`);
58067
+ }), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([i, a]) => {
58068
+ t.push(` ${i}: ${a},`);
58069
+ }), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
58070
+ t.push(` "${i}",`);
58071
+ }), 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(`
58072
+ `);
58073
+ }
58074
+ function N(e, r) {
58075
+ let n = r == null ? void 0 : r.hooks, s = ["// ChatWidgetAdvanced.tsx", "'use client'; // Required for Next.js - remove for Vite/CRA", "", "import { useEffect } from 'react';", "import '@runtypelabs/persona/widget.css';", "import {", " initAgentWidget,", " createFlexibleJsonStreamParser,", " defaultJsonActionParser,", " defaultActionHandlers,", " markdownPostprocessor", "} from '@runtypelabs/persona';", "import type { AgentWidgetInitHandle } from '@runtypelabs/persona';", "", "const STORAGE_KEY = 'chat-widget-state';", "const PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", "// Types for DOM elements", "interface PageElement {", " type: string;", " tagName: string;", " selector: string;", " innerText: string;", " href?: string;", "}", "", "interface DOMContext {", " page_elements: PageElement[];", " page_element_count: number;", " element_types: Record<string, number>;", " page_url: string;", " page_title: string;", " timestamp: string;", "}", "", "// DOM context provider - extracts page elements for AI context", "const collectDOMContext = (): DOMContext => {", " const selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " const elements: PageElement[] = [];", " Object.entries(selectors).forEach(([type, selector]) => {", " document.querySelectorAll(selector).forEach((element) => {", " if (!(element instanceof HTMLElement)) return;", " ", " // Exclude elements within the widget", " const widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " ", " const text = element.innerText?.trim();", " if (!text) return;", "", " const selectorString =", " element.id ? `#${element.id}` :", " element.getAttribute('data-testid') ? `[data-testid=\"${element.getAttribute('data-testid')}\"]` :", " element.getAttribute('data-product-id') ? `[data-product-id=\"${element.getAttribute('data-product-id')}\"]` :", " element.tagName.toLowerCase();", "", " const elementData: PageElement = {", " type,", " tagName: element.tagName.toLowerCase(),", " selector: selectorString,", " innerText: text.substring(0, 200)", " };", "", " if (type === 'links' && element instanceof HTMLAnchorElement && element.href) {", " elementData.href = element.href;", " }", "", " elements.push(elementData);", " });", " });", "", " const counts = elements.reduce((acc, el) => {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {} as Record<string, number>);", "", " return {", " page_elements: elements.slice(0, 50),", " page_element_count: elements.length,", " element_types: counts,", " page_url: window.location.href,", " page_title: document.title,", " timestamp: new Date().toISOString()", " };", "};", "", "export function ChatWidgetAdvanced() {", " useEffect(() => {", " let handle: AgentWidgetInitHandle | null = null;", "", " // Load saved state", " const loadSavedMessages = () => {", " const savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " const { messages } = JSON.parse(savedState);", " return messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", " return [];", " };", "", " handle = initAgentWidget({", ` target: '${g(r)}',`, " config: {"];
58076
+ return e.apiUrl && s.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && s.push(` clientToken: "${e.clientToken}",`), e.flowId && s.push(` flowId: "${e.flowId}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && l(s, "theme", e.theme, " "), e.launcher && l(s, "launcher", e.launcher, " "), e.copy && (s.push(" copy: {"), Object.entries(e.copy).forEach(([o, t]) => {
58077
+ s.push(` ${o}: "${t}",`);
58078
+ }), s.push(" },")), e.sendButton && (s.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([o, t]) => {
58079
+ typeof t == "string" ? s.push(` ${o}: "${t}",`) : typeof t == "boolean" && s.push(` ${o}: ${t},`);
58080
+ }), s.push(" },")), e.voiceRecognition && (s.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([o, t]) => {
58081
+ typeof t == "string" ? s.push(` ${o}: "${t}",`) : typeof t == "boolean" ? s.push(` ${o}: ${t},`) : typeof t == "number" && s.push(` ${o}: ${t},`);
58082
+ }), s.push(" },")), e.statusIndicator && (s.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([o, t]) => {
58083
+ typeof t == "string" ? s.push(` ${o}: "${t}",`) : typeof t == "boolean" && s.push(` ${o}: ${t},`);
58084
+ }), s.push(" },")), e.features && (s.push(" features: {"), Object.entries(e.features).forEach(([o, t]) => {
58085
+ s.push(` ${o}: ${t},`);
58086
+ }), s.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((o) => {
58087
+ s.push(` "${o}",`);
58088
+ }), 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(`
58089
+ `);
58090
+ }
58091
+ function P(e) {
58092
+ var o;
58093
+ let r = h(e), n = r !== "plain", s = {};
58094
+ if (e.apiUrl && (s.apiUrl = e.apiUrl), e.clientToken && (s.clientToken = e.clientToken), e.flowId && (s.flowId = e.flowId), n && (s.parserType = r), e.theme && (s.theme = e.theme), e.launcher && (s.launcher = e.launcher), e.copy && (s.copy = e.copy), e.sendButton && (s.sendButton = e.sendButton), e.voiceRecognition && (s.voiceRecognition = e.voiceRecognition), e.statusIndicator && (s.statusIndicator = e.statusIndicator), e.features && (s.features = e.features), ((o = e.suggestionChips) == null ? void 0 : o.length) > 0 && (s.suggestionChips = e.suggestionChips), e.suggestionChipsConfig && (s.suggestionChipsConfig = e.suggestionChipsConfig), e.debug && (s.debug = e.debug), e.toolCall) {
58095
+ let t = {};
58096
+ Object.entries(e.toolCall).forEach(([i, a]) => {
58097
+ typeof a == "string" && (t[i] = a);
58098
+ }), Object.keys(t).length > 0 && (s.toolCall = t);
58099
+ }
58100
+ if (e.messageActions) {
58101
+ let t = {};
58102
+ Object.entries(e.messageActions).forEach(([i, a]) => {
58103
+ i !== "onFeedback" && i !== "onCopy" && a !== void 0 && (typeof a == "string" || typeof a == "boolean") && (t[i] = a);
58104
+ }), Object.keys(t).length > 0 && (s.messageActions = t);
58105
+ }
58106
+ if (e.markdown) {
58107
+ let t = {};
58108
+ e.markdown.options && (t.options = e.markdown.options), e.markdown.disableDefaultStyles !== void 0 && (t.disableDefaultStyles = e.markdown.disableDefaultStyles), Object.keys(t).length > 0 && (s.markdown = t);
58109
+ }
58110
+ if (e.layout) {
58111
+ let t = {};
58112
+ if (e.layout.header) {
58113
+ let i = {};
58114
+ Object.entries(e.layout.header).forEach(([a, p]) => {
58115
+ a !== "render" && (typeof p == "string" || typeof p == "boolean") && (i[a] = p);
58116
+ }), Object.keys(i).length > 0 && (t.header = i);
58117
+ }
58118
+ if (e.layout.messages) {
58119
+ let i = {};
58120
+ Object.entries(e.layout.messages).forEach(([a, p]) => {
58121
+ if (a !== "renderUserMessage" && a !== "renderAssistantMessage") if (a === "avatar" && typeof p == "object" && p !== null) i.avatar = p;
58122
+ else if (a === "timestamp" && typeof p == "object" && p !== null) {
58123
+ let d = {};
58124
+ Object.entries(p).forEach(([w, b]) => {
58125
+ w !== "format" && (typeof b == "string" || typeof b == "boolean") && (d[w] = b);
58126
+ }), Object.keys(d).length > 0 && (i.timestamp = d);
58127
+ } else (typeof p == "string" || typeof p == "boolean") && (i[a] = p);
58128
+ }), Object.keys(i).length > 0 && (t.messages = i);
58129
+ }
58130
+ Object.keys(t).length > 0 && (s.layout = t);
58131
+ }
58132
+ return s;
58133
+ }
58134
+ function D(e, r) {
58135
+ 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;");
58136
+ return `<script src="https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${c}/dist/install.global.js" data-config='${t}'></script>`;
58137
+ }
58138
+ function F(e, r) {
58139
+ 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: {"];
58140
+ 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]) => {
58141
+ t.push(` ${i}: "${a}",`);
58142
+ }), t.push(" },")), e.sendButton && (t.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([i, a]) => {
58143
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" && t.push(` ${i}: ${a},`);
58144
+ }), t.push(" },")), e.voiceRecognition && (t.push(" voiceRecognition: {"), Object.entries(e.voiceRecognition).forEach(([i, a]) => {
58145
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" ? t.push(` ${i}: ${a},`) : typeof a == "number" && t.push(` ${i}: ${a},`);
58146
+ }), t.push(" },")), e.statusIndicator && (t.push(" statusIndicator: {"), Object.entries(e.statusIndicator).forEach(([i, a]) => {
58147
+ typeof a == "string" ? t.push(` ${i}: "${a}",`) : typeof a == "boolean" && t.push(` ${i}: ${a},`);
58148
+ }), t.push(" },")), e.features && (t.push(" features: {"), Object.entries(e.features).forEach(([i, a]) => {
58149
+ t.push(` ${i}: ${a},`);
58150
+ }), t.push(" },")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((i) => {
58151
+ t.push(` "${i}",`);
58152
+ }), 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(`
58153
+ `);
58154
+ }
58155
+ function J(e, r) {
58156
+ 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(`
58157
+ `).map((i, a) => a === 0 ? i : " " + i).join(`
58158
+ `)};`, "", " // 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);", ""];
58159
+ 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(`
58160
+ `);
58161
+ }
58162
+
57761
58163
  // src/lib/persona-snippets.ts
57762
58164
  function mapCliFormatToPersona(cli) {
57763
58165
  switch (cli) {
57764
58166
  case "script-installer":
57765
58167
  return "script-installer";
57766
58168
  case "script-manual":
57767
- return "script-advanced";
58169
+ return "script-manual";
57768
58170
  case "esm":
58171
+ return "esm";
57769
58172
  case "react":
57770
58173
  return "react-component";
57771
58174
  default: {
@@ -57783,92 +58186,21 @@ function parsePersonaInitFormat(raw) {
57783
58186
  `Invalid --format "${raw}". Use: script-installer | script-manual | esm | react`
57784
58187
  );
57785
58188
  }
57786
- var PERSONA_CDN_BASE = "https://cdn.jsdelivr.net/npm/@runtypelabs/persona@latest/dist";
57787
- function mountIdFromSelector(sel) {
57788
- const s = sel.trim();
57789
- if (s.startsWith("#")) return s.slice(1);
57790
- return s || "chat";
57791
- }
57792
- function escapeHtmlAttr(s) {
57793
- return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;");
57794
- }
57795
- function buildScriptInstaller(input) {
57796
- const targetSel = input.targetSelector?.trim() || void 0;
57797
- if (!targetSel) {
57798
- return `<script
57799
- src="${PERSONA_CDN_BASE}/install.global.js"
57800
- data-runtype-token="${escapeHtmlAttr(input.clientToken)}"
57801
- ></script>`.trim();
57802
- }
57803
- const id = mountIdFromSelector(targetSel);
57804
- const cfg = JSON.stringify({ target: targetSel, apiUrl: input.apiUrl });
57805
- return `<div id="${escapeHtmlAttr(id)}"></div>
57806
- <script
57807
- src="${PERSONA_CDN_BASE}/install.global.js"
57808
- data-runtype-token="${escapeHtmlAttr(input.clientToken)}"
57809
- data-config='${cfg.replace(/'/g, "&#39;")}'
57810
- ></script>`.trim();
57811
- }
57812
- function buildScriptAdvancedHtml(input) {
57813
- const targetSel = input.targetSelector?.trim() || void 0;
57814
- const apiUrl = JSON.stringify(input.apiUrl);
57815
- const token = JSON.stringify(input.clientToken);
57816
- const targetJson = JSON.stringify(targetSel || "body");
57817
- const divLine = targetSel ? `<div id="${escapeHtmlAttr(mountIdFromSelector(targetSel))}"></div>
57818
- ` : "";
57819
- return `<link rel="stylesheet" href="${PERSONA_CDN_BASE}/widget.css" />
57820
- ${divLine}<script type="module">
57821
- import { initAgentWidget, markdownPostprocessor } from '${PERSONA_CDN_BASE}/index.js';
57822
-
57823
- initAgentWidget({
57824
- target: ${targetJson},
57825
- config: {
57826
- apiUrl: ${apiUrl},
57827
- clientToken: ${token},
57828
- parserType: 'json',
57829
- postprocessMessage: ({ text }) => markdownPostprocessor(text),
57830
- launcher: {
57831
- enabled: true,
57832
- title: 'Chat',
57833
- subtitle: 'How can I help you today?',
57834
- position: 'bottom-right',
57835
- },
57836
- },
57837
- });
57838
- </script>`.trim();
57839
- }
57840
- function buildReactComponentSnippet(input) {
57841
- const targetSel = input.targetSelector?.trim() || void 0;
57842
- const apiUrl = JSON.stringify(input.apiUrl);
57843
- const token = JSON.stringify(input.clientToken);
57844
- const targetStr = JSON.stringify(targetSel || "body");
57845
- return `import "@runtypelabs/persona/widget.css";
57846
- import { DEFAULT_WIDGET_CONFIG, initAgentWidget, markdownPostprocessor } from "@runtypelabs/persona";
57847
-
57848
- initAgentWidget({
57849
- target: ${targetStr},
57850
- config: {
57851
- ...DEFAULT_WIDGET_CONFIG,
57852
- apiUrl: ${apiUrl},
57853
- clientToken: ${token},
57854
- parserType: "json",
57855
- postprocessMessage: ({ text }) => markdownPostprocessor(text),
57856
- },
57857
- });`.trim();
58189
+ function buildWidgetConfig(input) {
58190
+ return {
58191
+ apiUrl: input.apiUrl,
58192
+ clientToken: input.clientToken,
58193
+ parserType: "json"
58194
+ };
57858
58195
  }
57859
58196
  function generatePersonaInitSnippet(input, personaFormat) {
57860
- switch (personaFormat) {
57861
- case "script-installer":
57862
- return buildScriptInstaller(input);
57863
- case "script-advanced":
57864
- return buildScriptAdvancedHtml(input);
57865
- case "react-component":
57866
- return buildReactComponentSnippet(input);
57867
- default: {
57868
- const _exhaustive = personaFormat;
57869
- return _exhaustive;
57870
- }
57871
- }
58197
+ const widgetConfig = buildWidgetConfig(input);
58198
+ const target = input.targetSelector?.trim();
58199
+ return I(
58200
+ widgetConfig,
58201
+ personaFormat,
58202
+ target ? { target } : void 0
58203
+ );
57872
58204
  }
57873
58205
 
57874
58206
  // src/lib/persona-init.ts
@@ -58673,11 +59005,11 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
58673
59005
  return;
58674
59006
  }
58675
59007
  console.log(chalk33.cyan(`Versions for flow ${flowId}:`));
58676
- for (const v of versions) {
58677
- const publishedTag = v.published ? chalk33.green(" [published]") : "";
58678
- const versionNum = v.version !== void 0 ? `v${v.version}` : v.id;
58679
- const date5 = v.createdAt ? chalk33.gray(` ${v.createdAt}`) : "";
58680
- console.log(` ${chalk33.green(v.id)} ${versionNum}${publishedTag}${date5}`);
59008
+ for (const v2 of versions) {
59009
+ const publishedTag = v2.published ? chalk33.green(" [published]") : "";
59010
+ const versionNum = v2.version !== void 0 ? `v${v2.version}` : v2.id;
59011
+ const date5 = v2.createdAt ? chalk33.gray(` ${v2.createdAt}`) : "";
59012
+ console.log(` ${chalk33.green(v2.id)} ${versionNum}${publishedTag}${date5}`);
58681
59013
  }
58682
59014
  }
58683
59015
  } catch (error51) {
@@ -58712,10 +59044,10 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
58712
59044
  loading,
58713
59045
  emptyMessage: "No versions found",
58714
59046
  renderCard: (item) => {
58715
- const v = item;
58716
- const publishedTag = v.published ? " [published]" : "";
58717
- const versionNum = v.version !== void 0 ? `v${v.version}` : v.id;
58718
- return React24.createElement(Text35, null, ` ${v.id} ${versionNum}${publishedTag}${v.createdAt ? ` ${v.createdAt}` : ""}`);
59047
+ const v2 = item;
59048
+ const publishedTag = v2.published ? " [published]" : "";
59049
+ const versionNum = v2.version !== void 0 ? `v${v2.version}` : v2.id;
59050
+ return React24.createElement(Text35, null, ` ${v2.id} ${versionNum}${publishedTag}${v2.createdAt ? ` ${v2.createdAt}` : ""}`);
58719
59051
  }
58720
59052
  });
58721
59053
  };
@@ -58930,12 +59262,12 @@ agentVersionsCommand.command("list <agentId>").description("List all versions fo
58930
59262
  return;
58931
59263
  }
58932
59264
  console.log(chalk34.cyan(`Versions for agent ${agentId}:`));
58933
- for (const v of versions) {
58934
- const isPublished = v.id === data.publishedVersionId;
59265
+ for (const v2 of versions) {
59266
+ const isPublished = v2.id === data.publishedVersionId;
58935
59267
  const liveTag = isPublished ? chalk34.green(" [live]") : "";
58936
- const versionLabel = v.label || (v.versionNumber !== void 0 ? `v${v.versionNumber}` : v.id);
58937
- const date5 = v.createdAt ? chalk34.gray(` ${v.createdAt}`) : "";
58938
- console.log(` ${chalk34.green(v.id)} ${versionLabel}${liveTag}${date5}`);
59268
+ const versionLabel = v2.label || (v2.versionNumber !== void 0 ? `v${v2.versionNumber}` : v2.id);
59269
+ const date5 = v2.createdAt ? chalk34.gray(` ${v2.createdAt}`) : "";
59270
+ console.log(` ${chalk34.green(v2.id)} ${versionLabel}${liveTag}${date5}`);
58939
59271
  }
58940
59272
  }
58941
59273
  } catch (error51) {
@@ -58972,13 +59304,13 @@ agentVersionsCommand.command("list <agentId>").description("List all versions fo
58972
59304
  loading,
58973
59305
  emptyMessage: "No versions found",
58974
59306
  renderCard: (item) => {
58975
- const v = item;
58976
- const liveTag = v.id === publishedId ? " [live]" : "";
58977
- const versionLabel = v.label || (v.versionNumber !== void 0 ? `v${v.versionNumber}` : v.id);
59307
+ const v2 = item;
59308
+ const liveTag = v2.id === publishedId ? " [live]" : "";
59309
+ const versionLabel = v2.label || (v2.versionNumber !== void 0 ? `v${v2.versionNumber}` : v2.id);
58978
59310
  return React25.createElement(
58979
59311
  Text36,
58980
59312
  null,
58981
- ` ${v.id} ${versionLabel}${liveTag}${v.createdAt ? ` ${v.createdAt}` : ""}`
59313
+ ` ${v2.id} ${versionLabel}${liveTag}${v2.createdAt ? ` ${v2.createdAt}` : ""}`
58982
59314
  );
58983
59315
  }
58984
59316
  });
@@ -59215,7 +59547,7 @@ function categoryBadge(category, useColor) {
59215
59547
  return chalk35.magenta(`[${category}]`);
59216
59548
  }
59217
59549
  function formatTailData(data) {
59218
- return Object.entries(data).map(([k, v]) => `${k}=${typeof v === "string" ? v : JSON.stringify(v)}`).join(" ");
59550
+ return Object.entries(data).map(([k, v2]) => `${k}=${typeof v2 === "string" ? v2 : JSON.stringify(v2)}`).join(" ");
59219
59551
  }
59220
59552
  function formatContextIds(event, useColor) {
59221
59553
  const ids = [];
@@ -59303,9 +59635,9 @@ async function createSession(apiUrl, apiKey, filters) {
59303
59635
  level: "levels",
59304
59636
  category: "categories"
59305
59637
  };
59306
- for (const [k, v] of Object.entries(filters)) {
59307
- if (v !== void 0 && arrayFields[k]) {
59308
- filter[arrayFields[k]] = [v];
59638
+ for (const [k, v2] of Object.entries(filters)) {
59639
+ if (v2 !== void 0 && arrayFields[k]) {
59640
+ filter[arrayFields[k]] = [v2];
59309
59641
  }
59310
59642
  }
59311
59643
  const body = Object.keys(filter).length > 0 ? { filter } : {};
@@ -59359,7 +59691,7 @@ async function runTail(options) {
59359
59691
  category: options.category
59360
59692
  };
59361
59693
  const useColor = options.color;
59362
- const activeFilters = Object.entries(filters).filter(([, v]) => v !== void 0).map(([k, v]) => `${k}=${v}`);
59694
+ const activeFilters = Object.entries(filters).filter(([, v2]) => v2 !== void 0).map(([k, v2]) => `${k}=${v2}`);
59363
59695
  process.stderr.write(
59364
59696
  (useColor ? chalk35.gray(
59365
59697
  `Connecting to ${apiUrl}...${activeFilters.length ? ` filters: ${activeFilters.join(", ")}` : ""}`
@@ -60555,11 +60887,11 @@ function collectSecretNames(agentDef) {
60555
60887
  function slugify2(s) {
60556
60888
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
60557
60889
  }
60558
- 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) => {
60559
- acc.push(v);
60890
+ 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) => {
60891
+ acc.push(v2);
60560
60892
  return acc;
60561
- }, []).option("--flow <id>", "Flow ID to export (may be repeated)", (v, acc) => {
60562
- acc.push(v);
60893
+ }, []).option("--flow <id>", "Flow ID to export (may be repeated)", (v2, acc) => {
60894
+ acc.push(v2);
60563
60895
  return acc;
60564
60896
  }, []).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(
60565
60897
  async (options) => {
@@ -60844,7 +61176,7 @@ async function runSkillsInstall(agents, options = {}) {
60844
61176
  try {
60845
61177
  const outcome = await installSkills(
60846
61178
  agentIds,
60847
- options.verbose && !options.quiet ? (m) => console.log(chalk38.dim(` ${m}`)) : void 0
61179
+ options.verbose && !options.quiet ? (m2) => console.log(chalk38.dim(` ${m2}`)) : void 0
60848
61180
  );
60849
61181
  const failedSet = new Set(outcome.failedAgents);
60850
61182
  const succeeded = agents.filter((a) => !failedSet.has(a.rosieId));