@runtypelabs/cli 2.35.7 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +303 -158
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
6
6
  }) : x2)(function(x2) {
7
7
  if (typeof require !== "undefined") return require.apply(this, arguments);
8
8
  throw Error('Dynamic require of "' + x2 + '" is not supported');
@@ -1395,8 +1395,8 @@ var allowsEval = /* @__PURE__ */ cached(() => {
1395
1395
  return false;
1396
1396
  }
1397
1397
  try {
1398
- const F2 = Function;
1399
- new F2("");
1398
+ const F = Function;
1399
+ new F("");
1400
1400
  return true;
1401
1401
  } catch (_2) {
1402
1402
  return false;
@@ -1658,8 +1658,8 @@ function safeExtend(schema, shape) {
1658
1658
  });
1659
1659
  return clone(schema, def);
1660
1660
  }
1661
- function merge(a, b) {
1662
- if (!b?._zod?.def) {
1661
+ function merge(a, b2) {
1662
+ if (!b2?._zod?.def) {
1663
1663
  throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
1664
1664
  }
1665
1665
  if (a._zod.def.checks?.length) {
@@ -1667,14 +1667,14 @@ function merge(a, b) {
1667
1667
  }
1668
1668
  const def = mergeDefs(a._zod.def, {
1669
1669
  get shape() {
1670
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
1670
+ const _shape = { ...a._zod.def.shape, ...b2._zod.def.shape };
1671
1671
  assignProp(this, "shape", _shape);
1672
1672
  return _shape;
1673
1673
  },
1674
1674
  get catchall() {
1675
- return b._zod.def.catchall;
1675
+ return b2._zod.def.catchall;
1676
1676
  },
1677
- checks: b._zod.def.checks ?? []
1677
+ checks: b2._zod.def.checks ?? []
1678
1678
  });
1679
1679
  return clone(a, def);
1680
1680
  }
@@ -1906,7 +1906,7 @@ function hexToUint8Array(hex3) {
1906
1906
  return bytes;
1907
1907
  }
1908
1908
  function uint8ArrayToHex(bytes) {
1909
- return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
1909
+ return Array.from(bytes).map((b2) => b2.toString(16).padStart(2, "0")).join("");
1910
1910
  }
1911
1911
  var Class = class {
1912
1912
  constructor(..._args) {
@@ -2319,7 +2319,7 @@ function toDotPath(_path) {
2319
2319
  }
2320
2320
  function prettifyError(error61) {
2321
2321
  const lines = [];
2322
- const issues = [...error61.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
2322
+ const issues = [...error61.issues].sort((a, b2) => (a.path ?? []).length - (b2.path ?? []).length);
2323
2323
  for (const issue2 of issues) {
2324
2324
  lines.push(`\u2716 ${issue2.message}`);
2325
2325
  if (issue2.path?.length)
@@ -3209,9 +3209,9 @@ var Doc = class {
3209
3209
  }
3210
3210
  }
3211
3211
  compile() {
3212
- const F2 = Function;
3212
+ const F = Function;
3213
3213
  const content = this?.content ?? [``];
3214
- const factory = new F2(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {
3214
+ const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {
3215
3215
  ${content.join("\n")}
3216
3216
  };`);
3217
3217
  return factory(...Object.values(this.closed));
@@ -4482,23 +4482,23 @@ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, d
4482
4482
  return handleIntersectionResults(payload, left, right);
4483
4483
  };
4484
4484
  });
4485
- function mergeValues(a, b) {
4486
- if (a === b) {
4485
+ function mergeValues(a, b2) {
4486
+ if (a === b2) {
4487
4487
  return { valid: true, data: a };
4488
4488
  }
4489
- if (a instanceof Date && b instanceof Date && +a === +b) {
4489
+ if (a instanceof Date && b2 instanceof Date && +a === +b2) {
4490
4490
  return { valid: true, data: a };
4491
4491
  }
4492
- if (isPlainObject(a) && isPlainObject(b)) {
4493
- const bKeys = Object.keys(b);
4492
+ if (isPlainObject(a) && isPlainObject(b2)) {
4493
+ const bKeys = Object.keys(b2);
4494
4494
  const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
4495
- const newObj = { ...a, ...b };
4495
+ const newObj = { ...a, ...b2 };
4496
4496
  if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
4497
4497
  delete newObj.__proto__;
4498
4498
  for (const key of sharedKeys) {
4499
4499
  if (key === "__proto__")
4500
4500
  continue;
4501
- const sharedValue = mergeValues(a[key], b[key]);
4501
+ const sharedValue = mergeValues(a[key], b2[key]);
4502
4502
  if (!sharedValue.valid) {
4503
4503
  return {
4504
4504
  valid: false,
@@ -4509,14 +4509,14 @@ function mergeValues(a, b) {
4509
4509
  }
4510
4510
  return { valid: true, data: newObj };
4511
4511
  }
4512
- if (Array.isArray(a) && Array.isArray(b)) {
4513
- if (a.length !== b.length) {
4512
+ if (Array.isArray(a) && Array.isArray(b2)) {
4513
+ if (a.length !== b2.length) {
4514
4514
  return { valid: false, mergeErrorPath: [] };
4515
4515
  }
4516
4516
  const newArray = [];
4517
4517
  for (let index = 0; index < a.length; index++) {
4518
4518
  const itemA = a[index];
4519
- const itemB = b[index];
4519
+ const itemB = b2[index];
4520
4520
  const sharedValue = mergeValues(itemA, itemB);
4521
4521
  if (!sharedValue.valid) {
4522
4522
  return {
@@ -5404,9 +5404,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
5404
5404
  return payload;
5405
5405
  };
5406
5406
  inst.input = (...args) => {
5407
- const F2 = inst.constructor;
5407
+ const F = inst.constructor;
5408
5408
  if (Array.isArray(args[0])) {
5409
- return new F2({
5409
+ return new F({
5410
5410
  type: "function",
5411
5411
  input: new $ZodTuple({
5412
5412
  type: "tuple",
@@ -5416,15 +5416,15 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
5416
5416
  output: inst._def.output
5417
5417
  });
5418
5418
  }
5419
- return new F2({
5419
+ return new F({
5420
5420
  type: "function",
5421
5421
  input: args[0],
5422
5422
  output: inst._def.output
5423
5423
  });
5424
5424
  };
5425
5425
  inst.output = (output2) => {
5426
- const F2 = inst.constructor;
5427
- return new F2({
5426
+ const F = inst.constructor;
5427
+ return new F({
5428
5428
  type: "function",
5429
5429
  input: inst._def.input,
5430
5430
  output: output2
@@ -13136,13 +13136,13 @@ function compileFn(schema, options) {
13136
13136
  const code = doc.content.join("\n");
13137
13137
  const fullCode = options?.debug ? constantNames.length > 0 ? `// Constants: ${constantNames.join(", ")}
13138
13138
  ${code}` : code : "";
13139
- const F2 = Function;
13139
+ const F = Function;
13140
13140
  const factoryCode = `return (input) => {
13141
13141
  ${code}
13142
13142
  }`;
13143
13143
  let fn;
13144
13144
  try {
13145
- const factory = new F2(...constantNames, factoryCode);
13145
+ const factory = new F(...constantNames, factoryCode);
13146
13146
  fn = factory(...constantValues);
13147
13147
  } catch (err) {
13148
13148
  throw new ZodCompileUnsupportedError(`this schema (generated code failed to evaluate: ${err.message})`);
@@ -15927,7 +15927,7 @@ function foldIntersection(json2) {
15927
15927
  return;
15928
15928
  const rest = allOf.filter((m2) => m2 !== union2);
15929
15929
  const branches = union2[keyword].map((branch) => foldObjects([...rest, branch]));
15930
- if (branches.some((b) => !b))
15930
+ if (branches.some((b2) => !b2))
15931
15931
  return;
15932
15932
  folded = { [keyword]: branches };
15933
15933
  }
@@ -16460,14 +16460,14 @@ var intersectionProcessor = (schema, ctx, json2, params) => {
16460
16460
  ...params,
16461
16461
  path: [...params.path, "allOf", 0]
16462
16462
  });
16463
- const b = process2(def.right, ctx, {
16463
+ const b2 = process2(def.right, ctx, {
16464
16464
  ...params,
16465
16465
  path: [...params.path, "allOf", 1]
16466
16466
  });
16467
16467
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
16468
16468
  const allOf = [
16469
16469
  ...isSimpleIntersection(a) ? a.allOf : [a],
16470
- ...isSimpleIntersection(b) ? b.allOf : [b]
16470
+ ...isSimpleIntersection(b2) ? b2.allOf : [b2]
16471
16471
  ];
16472
16472
  json2.allOf = allOf;
16473
16473
  ctx.intersections.push(allOf);
@@ -19436,12 +19436,15 @@ var CANONICAL_LOG_COLUMN_SET = {
19436
19436
  };
19437
19437
  var CANONICAL_LOG_COLUMNS = Object.keys(CANONICAL_LOG_COLUMN_SET);
19438
19438
 
19439
- // ../shared/dist/chunk-HUUBCQSQ.mjs
19439
+ // ../shared/dist/chunk-L2YZQMNS.mjs
19440
19440
  var MODEL_FAMILY_PROVIDER_IDS = {
19441
19441
  "claude-fable-5": {
19442
19442
  "anthropic": "claude-fable-5",
19443
19443
  "vercel": "anthropic/claude-fable-5"
19444
19444
  },
19445
+ "claude-fable-5-1": {
19446
+ "anthropic": "claude-fable-5-1"
19447
+ },
19445
19448
  "claude-haiku-4-5": {
19446
19449
  "anthropic": "claude-haiku-4-5-20251001",
19447
19450
  "vercel": "anthropic/claude-haiku-4.5"
@@ -19698,12 +19701,6 @@ var MODEL_FAMILY_PROVIDER_IDS = {
19698
19701
  "gemini-omni-flash-preview": {
19699
19702
  "vercel": "google/gemini-omni-flash-preview"
19700
19703
  },
19701
- "gemini-robotics-er-1-6": {
19702
- "google": "gemini-robotics-er-1.6-preview"
19703
- },
19704
- "gemini-robotics-er-1.6-preview": {
19705
- "google": "gemini-robotics-er-1.6-preview"
19706
- },
19707
19704
  "gemma-4-26b-a4b-it": {
19708
19705
  "google": "gemma-4-26b-a4b-it",
19709
19706
  "vercel": "google/gemma-4-26b-a4b-it"
@@ -20241,12 +20238,18 @@ var MODEL_FAMILY_PROVIDER_IDS = {
20241
20238
  "mimo-v2-5-pro": {
20242
20239
  "vercel": "xiaomi/mimo-v2.5-pro"
20243
20240
  },
20241
+ "mimo-v2-5-pro-ultraspeed": {
20242
+ "vercel": "xiaomi/mimo-v2.5-pro-ultraspeed"
20243
+ },
20244
20244
  "mimo-v2.5": {
20245
20245
  "vercel": "xiaomi/mimo-v2.5"
20246
20246
  },
20247
20247
  "mimo-v2.5-pro": {
20248
20248
  "vercel": "xiaomi/mimo-v2.5-pro"
20249
20249
  },
20250
+ "mimo-v2.5-pro-ultraspeed": {
20251
+ "vercel": "xiaomi/mimo-v2.5-pro-ultraspeed"
20252
+ },
20250
20253
  "minimax-m2-7": {
20251
20254
  "vercel": "minimax/minimax-m2.7"
20252
20255
  },
@@ -20432,11 +20435,15 @@ var MODEL_FAMILY_PROVIDER_IDS = {
20432
20435
  "vercel": "alibaba/qwen3.8-2.4t-a95b"
20433
20436
  },
20434
20437
  "qwen3-8-27b": {
20438
+ "mixlayer": "qwen/qwen3.8-27b",
20435
20439
  "vercel": "alibaba/qwen3.8-27b"
20436
20440
  },
20437
20441
  "qwen3-8-flash": {
20438
20442
  "vercel": "alibaba/qwen3.8-flash"
20439
20443
  },
20444
+ "qwen3-8-flash-next": {
20445
+ "vercel": "alibaba/qwen3.8-flash-next"
20446
+ },
20440
20447
  "qwen3-8-max": {
20441
20448
  "vercel": "alibaba/qwen3.8-max"
20442
20449
  },
@@ -20526,11 +20533,15 @@ var MODEL_FAMILY_PROVIDER_IDS = {
20526
20533
  "vercel": "alibaba/qwen3.8-2.4t-a95b"
20527
20534
  },
20528
20535
  "qwen3.8-27b": {
20536
+ "mixlayer": "qwen/qwen3.8-27b",
20529
20537
  "vercel": "alibaba/qwen3.8-27b"
20530
20538
  },
20531
20539
  "qwen3.8-flash": {
20532
20540
  "vercel": "alibaba/qwen3.8-flash"
20533
20541
  },
20542
+ "qwen3.8-flash-next": {
20543
+ "vercel": "alibaba/qwen3.8-flash-next"
20544
+ },
20534
20545
  "qwen3.8-max": {
20535
20546
  "vercel": "alibaba/qwen3.8-max"
20536
20547
  },
@@ -21293,7 +21304,7 @@ var BuiltInToolIdPrefix = {
21293
21304
  PLATFORM: "platform"
21294
21305
  };
21295
21306
 
21296
- // ../shared/dist/chunk-FQCDNFXE.mjs
21307
+ // ../shared/dist/chunk-MICECRNL.mjs
21297
21308
  function sanitizeToolNameForAiSdk(name) {
21298
21309
  return name.replace(/[^a-zA-Z0-9_]/g, "_").toLowerCase().replace(/_+/g, "_").replace(/^_|_$/g, "");
21299
21310
  }
@@ -21654,7 +21665,7 @@ var recordCollectionSchemaSchema = external_exports.strictObject({
21654
21665
  additionalProperties: external_exports.boolean().optional()
21655
21666
  }).superRefine((schema, ctx) => addSemanticIssues(schema, ctx));
21656
21667
 
21657
- // ../shared/dist/chunk-4HCZLGCG.mjs
21668
+ // ../shared/dist/chunk-44VM7STG.mjs
21658
21669
  var MCPServerCategory = {
21659
21670
  COMMUNICATION: "communication",
21660
21671
  PRODUCTIVITY: "productivity",
@@ -23531,6 +23542,50 @@ var GITHUB_INTEGRATION = {
23531
23542
  required: ["owner", "repo", "pull_number"]
23532
23543
  }
23533
23544
  },
23545
+ {
23546
+ name: "list_pull_request_files",
23547
+ description: "List all files changed by a pull request, including GitHub patch data (up to 3,000 files)",
23548
+ parametersSchema: {
23549
+ type: "object",
23550
+ properties: {
23551
+ owner: {
23552
+ type: "string",
23553
+ description: "Repository owner"
23554
+ },
23555
+ repo: {
23556
+ type: "string",
23557
+ description: "Repository name"
23558
+ },
23559
+ pull_number: {
23560
+ type: "number",
23561
+ description: "Pull request number"
23562
+ }
23563
+ },
23564
+ required: ["owner", "repo", "pull_number"]
23565
+ }
23566
+ },
23567
+ {
23568
+ name: "list_issue_comments",
23569
+ description: "List all comments on an issue or pull request; fails instead of returning an incomplete list above 3,000 comments",
23570
+ parametersSchema: {
23571
+ type: "object",
23572
+ properties: {
23573
+ owner: {
23574
+ type: "string",
23575
+ description: "Repository owner"
23576
+ },
23577
+ repo: {
23578
+ type: "string",
23579
+ description: "Repository name"
23580
+ },
23581
+ issue_number: {
23582
+ type: "number",
23583
+ description: "Issue or pull request number"
23584
+ }
23585
+ },
23586
+ required: ["owner", "repo", "issue_number"]
23587
+ }
23588
+ },
23534
23589
  {
23535
23590
  name: "create_pr_comment",
23536
23591
  description: "Add a comment to a pull request",
@@ -23635,6 +23690,58 @@ var GITHUB_INTEGRATION = {
23635
23690
  required: ["owner", "repo"]
23636
23691
  }
23637
23692
  },
23693
+ {
23694
+ name: "create_branch",
23695
+ description: "Create a branch at a commit SHA. Repeating the same request succeeds without creating a duplicate branch.",
23696
+ parametersSchema: {
23697
+ type: "object",
23698
+ properties: {
23699
+ owner: {
23700
+ type: "string",
23701
+ description: "Repository owner"
23702
+ },
23703
+ repo: {
23704
+ type: "string",
23705
+ description: "Repository name"
23706
+ },
23707
+ branch: {
23708
+ type: "string",
23709
+ description: "Branch name to create"
23710
+ },
23711
+ sha: {
23712
+ type: "string",
23713
+ description: "Commit SHA where the branch starts"
23714
+ }
23715
+ },
23716
+ required: ["owner", "repo", "branch", "sha"]
23717
+ }
23718
+ },
23719
+ {
23720
+ name: "compare_commits",
23721
+ description: "Compare a base commit or branch with a head commit or branch, including changed files and ahead/behind counts",
23722
+ parametersSchema: {
23723
+ type: "object",
23724
+ properties: {
23725
+ owner: {
23726
+ type: "string",
23727
+ description: "Repository owner"
23728
+ },
23729
+ repo: {
23730
+ type: "string",
23731
+ description: "Repository name"
23732
+ },
23733
+ base: {
23734
+ type: "string",
23735
+ description: "Base branch, tag, or commit SHA"
23736
+ },
23737
+ head: {
23738
+ type: "string",
23739
+ description: "Head branch, tag, or commit SHA"
23740
+ }
23741
+ },
23742
+ required: ["owner", "repo", "base", "head"]
23743
+ }
23744
+ },
23638
23745
  {
23639
23746
  name: "commit_files",
23640
23747
  description: "Create one atomic Git commit that writes and/or deletes multiple files, then fast-forward a branch to it. If any operation fails, the branch is not partially updated.",
@@ -30297,28 +30404,28 @@ function formatPath(path21) {
30297
30404
  return acc ? `${acc}.${key}` : key;
30298
30405
  }, "");
30299
30406
  }
30300
- function compareIssuePath(a, b) {
30301
- if (!a && !b) return 0;
30407
+ function compareIssuePath(a, b2) {
30408
+ if (!a && !b2) return 0;
30302
30409
  if (!a) return 1;
30303
- if (!b) return -1;
30304
- return a.localeCompare(b);
30410
+ if (!b2) return -1;
30411
+ return a.localeCompare(b2);
30305
30412
  }
30306
30413
  function sortIssues(issues) {
30307
- return [...issues].sort((a, b) => {
30414
+ return [...issues].sort((a, b2) => {
30308
30415
  const aStepIndex = a.step?.index ?? Number.MAX_SAFE_INTEGER;
30309
- const bStepIndex = b.step?.index ?? Number.MAX_SAFE_INTEGER;
30416
+ const bStepIndex = b2.step?.index ?? Number.MAX_SAFE_INTEGER;
30310
30417
  if (aStepIndex !== bStepIndex) {
30311
30418
  return aStepIndex - bStepIndex;
30312
30419
  }
30313
- const pathCompare = compareIssuePath(a.path, b.path);
30420
+ const pathCompare = compareIssuePath(a.path, b2.path);
30314
30421
  if (pathCompare !== 0) {
30315
30422
  return pathCompare;
30316
30423
  }
30317
- const codeCompare = a.code.localeCompare(b.code);
30424
+ const codeCompare = a.code.localeCompare(b2.code);
30318
30425
  if (codeCompare !== 0) {
30319
30426
  return codeCompare;
30320
30427
  }
30321
- return a.message.localeCompare(b.message);
30428
+ return a.message.localeCompare(b2.message);
30322
30429
  });
30323
30430
  }
30324
30431
  function addIssue(level, issue2, buckets) {
@@ -30878,7 +30985,7 @@ function validateStoreVectorSource(flowSteps, buckets, declaredFlowInputs) {
30878
30985
  (step) => step.enabled !== false && step.type === "vector-search"
30879
30986
  );
30880
30987
  const executionOrderedSteps = [...flowSteps.entries()].sort(
30881
- ([, a], [, b]) => (a.order ?? 0) - (b.order ?? 0)
30988
+ ([, a], [, b2]) => (a.order ?? 0) - (b2.order ?? 0)
30882
30989
  );
30883
30990
  for (const [stepIndex, step] of executionOrderedSteps) {
30884
30991
  if (step.enabled === false) continue;
@@ -33173,6 +33280,8 @@ var userProfileFeaturesSchema = external_exports.object({
33173
33280
  // WHY(docs/why/packages/shared/src.md#workspacemodelready-tracks-migration-workspacemo): workspaceModelReady tracks migration; workspaceModelEligible is a kept compatibility constant
33174
33281
  workspaceModelReady: external_exports.boolean(),
33175
33282
  workspaceModelEligible: external_exports.boolean(),
33283
+ // INVARIANT: Gates the first-run intent gate; fail-closed so a flag outage shows the ordinary dashboard
33284
+ enableOnboardingIntentGate: external_exports.boolean(),
33176
33285
  // WHY(docs/why/packages/shared/src.md#model-credit-promo-multiplier-for-billing-discou): Model credit promo multiplier for billing discounts; billing never trusts the client value
33177
33286
  modelCreditPromoMultiplier: external_exports.number().min(0).max(1).optional(),
33178
33287
  // WHY(docs/claude/telemetry-suppression.md): Org-scoped external-telemetry gate; browser and Code Mode MCP surfaces read it here.
@@ -40467,18 +40576,18 @@ batchCommand.command("summary").description("Show a summary of active and recent
40467
40576
  console.log(` Recently completed: ${data.recentlyCompleted}`);
40468
40577
  if (data.batches.length > 0) {
40469
40578
  console.log(chalk9.cyan("\nActive Batches:"));
40470
- for (const b of data.batches) {
40579
+ for (const b2 of data.batches) {
40471
40580
  console.log(
40472
- ` ${chalk9.green(b.id)} ${b.flowName ?? ""} \u2014 ${b.status} (${b.processedRecords}/${b.totalRecords}, ${b.progress}%)`
40581
+ ` ${chalk9.green(b2.id)} ${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords}, ${b2.progress}%)`
40473
40582
  );
40474
40583
  }
40475
40584
  }
40476
40585
  if (data.recent.length > 0) {
40477
40586
  console.log(chalk9.cyan("\nRecently Completed:"));
40478
- for (const b of data.recent) {
40479
- const statusColor = b.status === "completed" ? chalk9.green(b.status) : chalk9.red(b.status);
40587
+ for (const b2 of data.recent) {
40588
+ const statusColor = b2.status === "completed" ? chalk9.green(b2.status) : chalk9.red(b2.status);
40480
40589
  console.log(
40481
- ` ${chalk9.green(b.id)} ${b.flowName ?? ""} \u2014 ${statusColor} (${b.processedRecords}/${b.totalRecords})`
40590
+ ` ${chalk9.green(b2.id)} ${b2.flowName ?? ""} \u2014 ${statusColor} (${b2.processedRecords}/${b2.totalRecords})`
40482
40591
  );
40483
40592
  }
40484
40593
  }
@@ -40507,18 +40616,18 @@ batchCommand.command("summary").description("Show a summary of active and recent
40507
40616
  { label: "Active", value: data.activeBatches, color: "green" },
40508
40617
  { label: "Recently completed", value: data.recentlyCompleted }
40509
40618
  ];
40510
- for (const b of data.batches) {
40619
+ for (const b2 of data.batches) {
40511
40620
  fields.push({
40512
- label: b.id,
40513
- value: `${b.flowName ?? ""} \u2014 ${b.status} (${b.processedRecords}/${b.totalRecords}, ${b.progress}%)`,
40621
+ label: b2.id,
40622
+ value: `${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords}, ${b2.progress}%)`,
40514
40623
  color: "yellow"
40515
40624
  });
40516
40625
  }
40517
- for (const b of data.recent) {
40626
+ for (const b2 of data.recent) {
40518
40627
  fields.push({
40519
- label: b.id,
40520
- value: `${b.flowName ?? ""} \u2014 ${b.status} (${b.processedRecords}/${b.totalRecords})`,
40521
- color: b.status === "completed" ? "green" : "red"
40628
+ label: b2.id,
40629
+ value: `${b2.flowName ?? ""} \u2014 ${b2.status} (${b2.processedRecords}/${b2.totalRecords})`,
40630
+ color: b2.status === "completed" ? "green" : "red"
40522
40631
  });
40523
40632
  }
40524
40633
  setResultNode(React6.createElement(EntityCard, { fields }));
@@ -41939,11 +42048,18 @@ integrationsCommand.command("get <id>").description("Get integration details, in
41939
42048
  });
41940
42049
 
41941
42050
  // src/commands/surfaces.ts
41942
- import { Command as Command11 } from "commander";
42051
+ import { Command as Command11, Option } from "commander";
41943
42052
  import chalk14 from "chalk";
41944
42053
  import React10 from "react";
41945
42054
  import { render as render10 } from "ink";
41946
42055
  import { useState as useState11, useEffect as useEffect12 } from "react";
42056
+ function parsePositiveInteger(value, option) {
42057
+ const parsed = Number(value);
42058
+ if (!Number.isInteger(parsed) || parsed < 1) {
42059
+ throw new Error(`${option} must be a positive integer`);
42060
+ }
42061
+ return parsed;
42062
+ }
41947
42063
  var surfacesCommand = new Command11("surfaces").description("View product surfaces");
41948
42064
  surfacesCommand.command("list").description("List surfaces across your products").option("--json", "Output as JSON").option("--limit <n>", "Maximum number of surfaces to return").option("--cursor <cursor>", "Pagination cursor for the next page").option("--type <type>", "Filter by surface type").option("--status <status>", "Filter by surface status").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
41949
42065
  async (options) => {
@@ -42029,12 +42145,14 @@ surfacesCommand.command("list").description("List surfaces across your products"
42029
42145
  await waitUntilExit();
42030
42146
  }
42031
42147
  );
42032
- surfacesCommand.command("get <id>").description("Get surface details including its items and keys (requires --product)").requiredOption("--product <productId>", "ID of the product that owns the surface").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
42148
+ surfacesCommand.command("get <id>").description("Get surface details including its items and keys").addOption(
42149
+ new Option("--product <productId>", "Deprecated; surface IDs resolve their product").hideHelp()
42150
+ ).option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
42033
42151
  async (id, options) => {
42034
42152
  const apiKey = await ensureAuth();
42035
42153
  if (!apiKey) return;
42036
42154
  const client = createCliClient(apiKey);
42037
- const detailPath = `/products/${options.product}/surfaces/${id}`;
42155
+ const detailPath = `/surfaces/${encodeURIComponent(id)}`;
42038
42156
  if (!isTTY(options) || options.json) {
42039
42157
  try {
42040
42158
  const data = await client.get(detailPath);
@@ -42136,6 +42254,51 @@ Keys (${keys.length}):`));
42136
42254
  await waitUntilExit();
42137
42255
  }
42138
42256
  );
42257
+ surfacesCommand.command("test <id>").description("Send a provider fixture through a surface\u2019s real ingress").addOption(
42258
+ new Option("--product <productId>", "Deprecated; surface IDs resolve their product").hideHelp()
42259
+ ).requiredOption(
42260
+ "--fixture <fixture>",
42261
+ "Fixture name, such as github.pull_request.opened or github.pull_request.merged_plan"
42262
+ ).requiredOption("--repo <owner/repository>", "GitHub repository in owner/repository format").requiredOption("--pr <number>", "Pull request number").option("--repeat <number>", "Deliver the same provider event more than once", "1").option("--planning-path <path>", "Planning-document directory for merged-plan fixtures").option("--json", "Output as JSON").action(
42263
+ async (id, options) => {
42264
+ const apiKey = await ensureAuth();
42265
+ if (!apiKey) return;
42266
+ try {
42267
+ const pullRequest = parsePositiveInteger(options.pr, "--pr");
42268
+ const repeat = parsePositiveInteger(options.repeat, "--repeat");
42269
+ if (repeat > 3) throw new Error("--repeat must not exceed 3");
42270
+ const client = createCliClient(apiKey);
42271
+ const result = await client.post(
42272
+ `/surfaces/${encodeURIComponent(id)}/test-deliveries`,
42273
+ {
42274
+ fixture: options.fixture,
42275
+ repository: options.repo,
42276
+ pullRequest,
42277
+ repeat,
42278
+ ...options.planningPath ? { planningPath: options.planningPath } : {}
42279
+ }
42280
+ );
42281
+ if (options.json) {
42282
+ printJson(result);
42283
+ return;
42284
+ }
42285
+ console.log(chalk14.green("Test delivery accepted"));
42286
+ console.log(
42287
+ ` Surface: ${result.surface.id} [${result.surface.type}/${result.surface.provider}]`
42288
+ );
42289
+ console.log(` Fixture: ${result.fixture}`);
42290
+ console.log(` Source: ${result.repository}#${result.pullRequest}`);
42291
+ console.log(` Delivery: ${result.deliveryId}`);
42292
+ for (const attempt of result.attempts) {
42293
+ console.log(` Attempt ${attempt.attempt}: HTTP ${attempt.status}`);
42294
+ }
42295
+ } catch (error61) {
42296
+ const message = error61 instanceof Error ? error61.message : "Unknown error";
42297
+ console.error(chalk14.red(`Failed to test surface: ${message}`));
42298
+ process.exitCode = 1;
42299
+ }
42300
+ }
42301
+ );
42139
42302
 
42140
42303
  // src/commands/logs.ts
42141
42304
  import { Command as Command12 } from "commander";
@@ -42309,9 +42472,9 @@ Histogram (${histogram.length} buckets):`));
42309
42472
  if (histogram.length === 0) {
42310
42473
  console.log(chalk15.gray(" No data"));
42311
42474
  } else {
42312
- for (const b of histogram) {
42313
- const errPart = b.errors > 0 ? chalk15.red(` (${b.errors} errors)`) : "";
42314
- console.log(` ${chalk15.dim(b.bucket)} ${b.count}${errPart}`);
42475
+ for (const b2 of histogram) {
42476
+ const errPart = b2.errors > 0 ? chalk15.red(` (${b2.errors} errors)`) : "";
42477
+ console.log(` ${chalk15.dim(b2.bucket)} ${b2.count}${errPart}`);
42315
42478
  }
42316
42479
  }
42317
42480
  } catch (error61) {
@@ -42333,7 +42496,7 @@ Histogram (${histogram.length} buckets):`));
42333
42496
  const stats = res.data;
42334
42497
  const histogram = stats.histogram ?? [];
42335
42498
  const histogramSummary = histogram.length === 0 ? "No data" : histogram.map(
42336
- (b) => `${b.bucket}: ${b.count}${b.errors > 0 ? ` (${b.errors} err)` : ""}`
42499
+ (b2) => `${b2.bucket}: ${b2.count}${b2.errors > 0 ? ` (${b2.errors} err)` : ""}`
42337
42500
  ).join("\n");
42338
42501
  setResultNode(
42339
42502
  React11.createElement(EntityCard, {
@@ -46372,7 +46535,7 @@ function extractTrackedFiles(snapshots, liveTools, planPath) {
46372
46535
  result.push({ path: planPath, type: "plan" });
46373
46536
  }
46374
46537
  const sorted = Array.from(fileMap.values()).sort(
46375
- (a, b) => (b.lastTouchedAt ?? 0) - (a.lastTouchedAt ?? 0)
46538
+ (a, b2) => (b2.lastTouchedAt ?? 0) - (a.lastTouchedAt ?? 0)
46376
46539
  );
46377
46540
  result.push(...sorted);
46378
46541
  return result;
@@ -47597,14 +47760,14 @@ function ModelPicker({ currentModel, onSelect, onCancel, models }) {
47597
47760
  [contentWidth]
47598
47761
  );
47599
47762
  const sorted = useMemo7(
47600
- () => [...availableModels].sort((a, b) => a.group.localeCompare(b.group)),
47763
+ () => [...availableModels].sort((a, b2) => a.group.localeCompare(b2.group)),
47601
47764
  [availableModels]
47602
47765
  );
47603
47766
  const filtered = useMemo7(() => {
47604
47767
  if (!search.trim()) return sorted;
47605
- const q = search.toLowerCase();
47768
+ const q2 = search.toLowerCase();
47606
47769
  return sorted.filter(
47607
- (m2) => m2.label.toLowerCase().includes(q) || m2.value.toLowerCase().includes(q) || m2.group.toLowerCase().includes(q)
47770
+ (m2) => m2.label.toLowerCase().includes(q2) || m2.value.toLowerCase().includes(q2) || m2.group.toLowerCase().includes(q2)
47608
47771
  );
47609
47772
  }, [sorted, search]);
47610
47773
  const searchRef = useRef6("");
@@ -47820,9 +47983,9 @@ function CommandPicker({ onSelect, onCancel, initialFilter = "" }) {
47820
47983
  );
47821
47984
  const filtered = useMemo8(() => {
47822
47985
  if (!search.trim()) return MARATHON_CHECKPOINT_COMMANDS;
47823
- const q = search.toLowerCase();
47986
+ const q2 = search.toLowerCase();
47824
47987
  return MARATHON_CHECKPOINT_COMMANDS.filter(
47825
- (cmd) => cmd.name.toLowerCase().includes(q) || cmd.description.toLowerCase().includes(q)
47988
+ (cmd) => cmd.name.toLowerCase().includes(q2) || cmd.description.toLowerCase().includes(q2)
47826
47989
  );
47827
47990
  }, [search]);
47828
47991
  const handleSearchChange = (value) => {
@@ -51974,7 +52137,7 @@ function getSanitizedEnv() {
51974
52137
  return clean;
51975
52138
  }
51976
52139
  function redactSecrets(output2, secrets) {
51977
- const sorted = secrets.filter((s) => s.length >= 8).sort((a, b) => b.length - a.length);
52140
+ const sorted = secrets.filter((s) => s.length >= 8).sort((a, b2) => b2.length - a.length);
51978
52141
  let redacted = output2;
51979
52142
  for (const secret of sorted) {
51980
52143
  redacted = redacted.replaceAll(secret, "[REDACTED]");
@@ -52906,7 +53069,7 @@ function buildTree(dirPath, maxDepth, depth = 0) {
52906
53069
  return [`${" ".repeat(depth)}[error reading ${normalizeToolPath(dirPath)}: ${message}]`];
52907
53070
  }
52908
53071
  const lines = [];
52909
- for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
53072
+ for (const entry of entries.sort((a, b2) => a.name.localeCompare(b2.name))) {
52910
53073
  const entryPath = path10.join(dirPath, entry.name);
52911
53074
  if (shouldIgnoreRepoEntry(entryPath)) continue;
52912
53075
  lines.push(`${" ".repeat(depth)}- ${entry.name}${entry.isDirectory() ? "/" : ""}`);
@@ -53161,7 +53324,7 @@ function createDefaultLocalTools(context) {
53161
53324
  });
53162
53325
  }
53163
53326
  });
53164
- const matches = candidates.sort((a, b) => b.score - a.score || a.text.localeCompare(b.text)).map((candidate) => candidate.text).filter((text, index, array2) => array2.indexOf(text) === index).slice(0, maxResults);
53327
+ const matches = candidates.sort((a, b2) => b2.score - a.score || a.text.localeCompare(b2.text)).map((candidate) => candidate.text).filter((text, index, array2) => array2.indexOf(text) === index).slice(0, maxResults);
53165
53328
  return matches.length > 0 ? matches.join("\n") : `No matches found for "${query}" under ${normalizeToolPath(startPath.resolvedPath)}`;
53166
53329
  }
53167
53330
  },
@@ -53210,7 +53373,7 @@ function createDefaultLocalTools(context) {
53210
53373
  });
53211
53374
  }
53212
53375
  });
53213
- const rankedMatches = matches.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path)).map((match) => match.path).slice(0, maxResults);
53376
+ const rankedMatches = matches.sort((a, b2) => b2.score - a.score || a.path.localeCompare(b2.path)).map((match) => match.path).slice(0, maxResults);
53214
53377
  return rankedMatches.length > 0 ? rankedMatches.join("\n") : `No files matched "${pattern}" under ${normalizeToolPath(startPath.resolvedPath)}`;
53215
53378
  }
53216
53379
  },
@@ -57721,14 +57884,14 @@ evalCommand.command("list").description("List eval batches").option("--flow <id>
57721
57884
  total,
57722
57885
  emptyMessage: "No eval batches found",
57723
57886
  renderCard: (item) => {
57724
- const b = item;
57725
- const name = b.name || b.id;
57726
- const progress = b.totalRecords ? `${b.completedRecords ?? 0}/${b.totalRecords}` : "";
57727
- const statusColor = b.status === "completed" ? "green" : "yellow";
57887
+ const b2 = item;
57888
+ const name = b2.name || b2.id;
57889
+ const progress = b2.totalRecords ? `${b2.completedRecords ?? 0}/${b2.totalRecords}` : "";
57890
+ const statusColor = b2.status === "completed" ? "green" : "yellow";
57728
57891
  return React20.createElement(
57729
57892
  Text34,
57730
57893
  { color: statusColor },
57731
- ` ${b.id} ${name} [${b.status}] ${progress}`
57894
+ ` ${b2.id} ${name} [${b2.status}] ${progress}`
57732
57895
  );
57733
57896
  }
57734
57897
  });
@@ -59585,19 +59748,19 @@ import { execFileSync } from "child_process";
59585
59748
  // src/lib/persona-init.ts
59586
59749
  init_credential_store();
59587
59750
 
59588
- // ../../node_modules/.pnpm/@runtypelabs+persona@4.17.1/node_modules/@runtypelabs/persona/dist/codegen.js
59589
- var S = "4.17.1";
59590
- var x = S;
59591
- function $(e) {
59592
- return e?.cdnBase?.trim().replace(/\/+$/, "").replace(/[\\'"<>`]/g, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`) || `https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${x}/dist`;
59751
+ // ../../node_modules/.pnpm/@runtypelabs+persona@4.22.0/node_modules/@runtypelabs/persona/dist/codegen.js
59752
+ var x = "4.22.0";
59753
+ var S = x;
59754
+ function w(e) {
59755
+ return e?.cdnBase?.trim().replace(/\/+$/, "").replace(/[\\'"<>`]/g, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`) || `https://cdn.jsdelivr.net/npm/@runtypelabs/persona@${S}/dist`;
59593
59756
  }
59594
59757
  function u(e) {
59595
59758
  if (e !== void 0) return typeof e == "string" ? e : Array.isArray(e) ? `[${e.map((i) => i.toString()).join(", ")}]` : e.toString();
59596
59759
  }
59597
- function v(e) {
59760
+ function I(e) {
59598
59761
  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) };
59599
59762
  }
59600
- var A = `({ text, message }: any) => {
59763
+ var j = `({ text, message }: any) => {
59601
59764
  const jsonSource = (message as any).rawContent || text || message.content;
59602
59765
  if (!jsonSource || typeof jsonSource !== 'string') return null;
59603
59766
  let cleanJson = jsonSource
@@ -59611,7 +59774,7 @@ var A = `({ text, message }: any) => {
59611
59774
  } catch (e) { return null; }
59612
59775
  return null;
59613
59776
  }`;
59614
- var j = `function(ctx) {
59777
+ var A = `function(ctx) {
59615
59778
  var jsonSource = ctx.message.rawContent || ctx.text || ctx.message.content;
59616
59779
  if (!jsonSource || typeof jsonSource !== 'string') return null;
59617
59780
  var cleanJson = jsonSource
@@ -59714,7 +59877,7 @@ function y(e, i) {
59714
59877
  return `${t}${s}${n}`;
59715
59878
  });
59716
59879
  }
59717
- function C(e, i) {
59880
+ function b(e, i) {
59718
59881
  let r = [];
59719
59882
  if (e.layout) {
59720
59883
  let s = e.layout.header && Object.keys(e.layout.header).some((t) => t !== "render"), a = e.layout.messages && Object.keys(e.layout.messages).some((t) => t !== "renderUserMessage" && t !== "renderAssistantMessage");
@@ -59730,11 +59893,11 @@ function C(e, i) {
59730
59893
  }
59731
59894
  return r;
59732
59895
  }
59733
- function w(e, i) {
59896
+ function $(e, i) {
59734
59897
  let r = [];
59735
59898
  return e && (e.getHeaders && r.push(`${i}getHeaders: ${e.getHeaders},`), e.requestMiddleware && r.push(`${i}requestMiddleware: ${e.requestMiddleware},`), e.actionParsers && r.push(`${i}actionParsers: ${e.actionParsers},`), e.actionHandlers && r.push(`${i}actionHandlers: ${e.actionHandlers},`), e.contextProviders && r.push(`${i}contextProviders: ${e.contextProviders},`), e.streamParser && r.push(`${i}streamParser: ${e.streamParser},`)), r;
59736
59899
  }
59737
- function k(e, i, r) {
59900
+ function v(e, i, r) {
59738
59901
  Object.entries(i).forEach(([s, a]) => {
59739
59902
  if (!(a === void 0 || typeof a == "function")) {
59740
59903
  if (Array.isArray(a)) {
@@ -59742,7 +59905,7 @@ function k(e, i, r) {
59742
59905
  return;
59743
59906
  }
59744
59907
  if (a && typeof a == "object") {
59745
- e.push(`${r}${s}: {`), k(e, a, `${r} `), e.push(`${r}},`);
59908
+ e.push(`${r}${s}: {`), v(e, a, `${r} `), e.push(`${r}},`);
59746
59909
  return;
59747
59910
  }
59748
59911
  e.push(`${r}${s}: ${JSON.stringify(a)},`);
@@ -59750,7 +59913,7 @@ function k(e, i, r) {
59750
59913
  });
59751
59914
  }
59752
59915
  function d(e, i, r, s) {
59753
- r && (e.push(`${s}${i}: {`), k(e, r, `${s} `), e.push(`${s}},`));
59916
+ r && (e.push(`${s}${i}: {`), v(e, r, `${s} `), e.push(`${s}},`));
59754
59917
  }
59755
59918
  function c(e) {
59756
59919
  return (e?.target ?? "body").replace(/\\/g, "\\\\").replace(/'/g, "\\'");
@@ -59758,8 +59921,8 @@ function c(e) {
59758
59921
  function R(e, i = "esm", r) {
59759
59922
  let s = { ...e };
59760
59923
  delete s.postprocessMessage, delete s.initialMessages;
59761
- let a = r ? { ...r, hooks: v(r.hooks) } : void 0;
59762
- return i === "esm" ? W(s, a) : i === "script-installer" ? D(s, a) : i === "script-advanced" ? F(s, a) : i === "react-component" ? H(s, a) : i === "react-advanced" ? N(s, a) : J(s, a);
59924
+ let a = r ? { ...r, hooks: I(r.hooks) } : void 0;
59925
+ return i === "esm" ? W(s, a) : i === "script-installer" ? q(s, a) : i === "script-advanced" ? J(s, a) : i === "react-component" ? H(s, a) : i === "react-advanced" ? N(s, a) : D(s, a);
59763
59926
  }
59764
59927
  function W(e, i) {
59765
59928
  let r = i?.hooks, s = h(e), a = s !== "plain", t = ["import '@runtypelabs/persona/widget.css';", "import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';", "", "initAgentWidget({", ` target: '${c(i)}',`, " config: {"];
@@ -59775,7 +59938,7 @@ function W(e, i) {
59775
59938
  t.push(` ${n}: ${o},`);
59776
59939
  }), t.push(" },")), t.push(...y(e, " ")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((n) => {
59777
59940
  t.push(` "${n}",`);
59778
- }), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...C(e, " ")), t.push(...w(r, " ")), e.debug && t.push(` debug: ${e.debug},`), r?.postprocessMessage ? t.push(` postprocessMessage: ${r.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push("});"), t.join(`
59941
+ }), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...b(e, " ")), t.push(...$(r, " ")), e.debug && t.push(` debug: ${e.debug},`), r?.postprocessMessage ? t.push(` postprocessMessage: ${r.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push("});"), t.join(`
59779
59942
  `);
59780
59943
  }
59781
59944
  function H(e, i) {
@@ -59792,7 +59955,7 @@ function H(e, i) {
59792
59955
  t.push(` ${n}: ${o},`);
59793
59956
  }), t.push(" },")), t.push(...y(e, " ")), e.suggestionChips && e.suggestionChips.length > 0 && (t.push(" suggestionChips: ["), e.suggestionChips.forEach((n) => {
59794
59957
  t.push(` "${n}",`);
59795
- }), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...C(e, " ")), t.push(...w(r, " ")), e.debug && t.push(` debug: ${e.debug},`), r?.postprocessMessage ? t.push(` postprocessMessage: ${r.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push(""), t.push(" // Cleanup on unmount"), t.push(" return () => {"), t.push(" if (handle) {"), t.push(" handle.destroy();"), t.push(" }"), t.push(" };"), t.push(" }, []);"), t.push(""), t.push(" return null; // Widget injects itself into the DOM"), t.push("}"), t.push(""), t.push("// Usage in your app:"), t.push("// import { ChatWidget } from './components/ChatWidget';"), t.push("//"), t.push("// export default function App() {"), t.push("// return ("), t.push("// <div>"), t.push("// {/* Your app content */}"), t.push("// <ChatWidget />"), t.push("// </div>"), t.push("// );"), t.push("// }"), t.join(`
59958
+ }), t.push(" ],")), e.suggestionChipsConfig && (t.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && t.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && t.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && t.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && t.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), t.push(" },")), t.push(...g(e, " ")), t.push(...m(e, " ", r)), t.push(...f(e, " ")), t.push(...b(e, " ")), t.push(...$(r, " ")), e.debug && t.push(` debug: ${e.debug},`), r?.postprocessMessage ? t.push(` postprocessMessage: ${r.postprocessMessage}`) : t.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text)"), t.push(" }"), t.push(" });"), t.push(""), t.push(" // Cleanup on unmount"), t.push(" return () => {"), t.push(" if (handle) {"), t.push(" handle.destroy();"), t.push(" }"), t.push(" };"), t.push(" }, []);"), t.push(""), t.push(" return null; // Widget injects itself into the DOM"), t.push("}"), t.push(""), t.push("// Usage in your app:"), t.push("// import { ChatWidget } from './components/ChatWidget';"), t.push("//"), t.push("// export default function App() {"), t.push("// return ("), t.push("// <div>"), t.push("// {/* Your app content */}"), t.push("// <ChatWidget />"), t.push("// </div>"), t.push("// );"), t.push("// }"), t.join(`
59796
59959
  `);
59797
59960
  }
59798
59961
  function N(e, i) {
@@ -59809,10 +59972,10 @@ function N(e, i) {
59809
59972
  s.push(` ${a}: ${t},`);
59810
59973
  }), s.push(" },")), s.push(...y(e, " ")), e.suggestionChips && e.suggestionChips.length > 0 && (s.push(" suggestionChips: ["), e.suggestionChips.forEach((a) => {
59811
59974
  s.push(` "${a}",`);
59812
- }), s.push(" ],")), e.suggestionChipsConfig && (s.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && s.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && s.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), s.push(" },")), s.push(...g(e, " ")), s.push(...m(e, " ", r)), s.push(...f(e, " ")), s.push(...C(e, " ")), r?.getHeaders && s.push(` getHeaders: ${r.getHeaders},`), r?.contextProviders && s.push(` contextProviders: ${r.contextProviders},`), e.debug && s.push(` debug: ${e.debug},`), s.push(" initialMessages: loadSavedMessages(),"), r?.streamParser ? s.push(` streamParser: ${r.streamParser},`) : (s.push(" // Flexible JSON stream parser for handling structured actions"), s.push(` streamParser: () => createFlexibleJsonStreamParser(${_}),`)), r?.actionParsers ? (s.push(" // Action parsers (custom merged with defaults)"), s.push(` actionParsers: [...(${r.actionParsers}), defaultJsonActionParser,`), s.push(" // Built-in parser for markdown-wrapped JSON"), s.push(` ${A}`), 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(` ${A}`), s.push(" ],")), r?.actionHandlers ? (s.push(" // Action handlers (custom merged with defaults)"), s.push(` actionHandlers: [...(${r.actionHandlers}),`), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Built-in handler for nav_then_click action"), s.push(` ${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(" ],")), r?.postprocessMessage ? s.push(` postprocessMessage: ${r.postprocessMessage},`) : s.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text),"), r?.requestMiddleware ? (s.push(" // Request middleware (custom merged with DOM context)"), s.push(" requestMiddleware: ({ payload, config }) => {"), s.push(` const customResult = (${r.requestMiddleware})({ payload, config });`), s.push(" const merged = customResult || payload;"), s.push(" return {"), s.push(" ...merged,"), s.push(" metadata: { ...merged.metadata, ...collectDOMContext() }"), s.push(" };"), s.push(" }")) : (s.push(" requestMiddleware: ({ payload }) => {"), s.push(" return {"), s.push(" ...payload,"), s.push(" metadata: collectDOMContext()"), s.push(" };"), s.push(" }")), s.push(" }"), s.push(" });"), s.push(""), s.push(" // Save state on message events"), s.push(" const handleMessage = () => {"), s.push(" const session = handle?.getSession?.();"), s.push(" if (session) {"), s.push(" localStorage.setItem(STORAGE_KEY, JSON.stringify({"), s.push(" messages: session.messages,"), s.push(" timestamp: new Date().toISOString()"), s.push(" }));"), s.push(" }"), s.push(" };"), s.push(""), s.push(" // Clear state on clear chat"), s.push(" const handleClearChat = () => {"), s.push(" localStorage.removeItem(STORAGE_KEY);"), s.push(" localStorage.removeItem(PROCESSED_ACTIONS_KEY);"), s.push(" };"), s.push(""), s.push(" window.addEventListener('persona:message', handleMessage);"), s.push(" window.addEventListener('persona:clear-chat', handleClearChat);"), s.push(""), s.push(" // Cleanup on unmount"), s.push(" return () => {"), s.push(" window.removeEventListener('persona:message', handleMessage);"), s.push(" window.removeEventListener('persona:clear-chat', handleClearChat);"), s.push(" if (handle) {"), s.push(" handle.destroy();"), s.push(" }"), s.push(" };"), s.push(" }, []);"), s.push(""), s.push(" return null; // Widget injects itself into the DOM"), s.push("}"), s.push(""), s.push("// Usage: Collects DOM context for AI-powered navigation"), s.push("// Features:"), s.push("// - Extracts page elements (products, buttons, links)"), s.push("// - Persists chat history across page loads"), s.push("// - Handles navigation actions (nav_then_click)"), s.push("// - Processes structured JSON actions from AI"), s.push("//"), s.push("// Example usage in Next.js:"), s.push("// import { ChatWidgetAdvanced } from './components/ChatWidgetAdvanced';"), s.push("//"), s.push("// export default function RootLayout({ children }) {"), s.push("// return ("), s.push('// <html lang="en">'), s.push("// <body>"), s.push("// {children}"), s.push("// <ChatWidgetAdvanced />"), s.push("// </body>"), s.push("// </html>"), s.push("// );"), s.push("// }"), s.join(`
59975
+ }), s.push(" ],")), e.suggestionChipsConfig && (s.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && s.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && s.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), s.push(" },")), s.push(...g(e, " ")), s.push(...m(e, " ", r)), s.push(...f(e, " ")), s.push(...b(e, " ")), r?.getHeaders && s.push(` getHeaders: ${r.getHeaders},`), r?.contextProviders && s.push(` contextProviders: ${r.contextProviders},`), e.debug && s.push(` debug: ${e.debug},`), s.push(" initialMessages: loadSavedMessages(),"), r?.streamParser ? s.push(` streamParser: ${r.streamParser},`) : (s.push(" // Flexible JSON stream parser for handling structured actions"), s.push(` streamParser: () => createFlexibleJsonStreamParser(${_}),`)), r?.actionParsers ? (s.push(" // Action parsers (custom merged with defaults)"), s.push(` actionParsers: [...(${r.actionParsers}), defaultJsonActionParser,`), s.push(" // Built-in parser for markdown-wrapped JSON"), s.push(` ${j}`), 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(` ${j}`), s.push(" ],")), r?.actionHandlers ? (s.push(" // Action handlers (custom merged with defaults)"), s.push(` actionHandlers: [...(${r.actionHandlers}),`), s.push(" defaultActionHandlers.message,"), s.push(" defaultActionHandlers.messageAndClick,"), s.push(" // Built-in handler for nav_then_click action"), s.push(` ${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(" ],")), r?.postprocessMessage ? s.push(` postprocessMessage: ${r.postprocessMessage},`) : s.push(" postprocessMessage: ({ text }) => markdownPostprocessor(text),"), r?.requestMiddleware ? (s.push(" // Request middleware (custom merged with DOM context)"), s.push(" requestMiddleware: ({ payload, config }) => {"), s.push(` const customResult = (${r.requestMiddleware})({ payload, config });`), s.push(" const merged = customResult || payload;"), s.push(" return {"), s.push(" ...merged,"), s.push(" metadata: { ...merged.metadata, ...collectDOMContext() }"), s.push(" };"), s.push(" }")) : (s.push(" requestMiddleware: ({ payload }) => {"), s.push(" return {"), s.push(" ...payload,"), s.push(" metadata: collectDOMContext()"), s.push(" };"), s.push(" }")), s.push(" }"), s.push(" });"), s.push(""), s.push(" // Save state on message events"), s.push(" const handleMessage = () => {"), s.push(" const session = handle?.getSession?.();"), s.push(" if (session) {"), s.push(" localStorage.setItem(STORAGE_KEY, JSON.stringify({"), s.push(" messages: session.messages,"), s.push(" timestamp: new Date().toISOString()"), s.push(" }));"), s.push(" }"), s.push(" };"), s.push(""), s.push(" // Clear state on clear chat"), s.push(" const handleClearChat = () => {"), s.push(" localStorage.removeItem(STORAGE_KEY);"), s.push(" localStorage.removeItem(PROCESSED_ACTIONS_KEY);"), s.push(" };"), s.push(""), s.push(" window.addEventListener('persona:message', handleMessage);"), s.push(" window.addEventListener('persona:clear-chat', handleClearChat);"), s.push(""), s.push(" // Cleanup on unmount"), s.push(" return () => {"), s.push(" window.removeEventListener('persona:message', handleMessage);"), s.push(" window.removeEventListener('persona:clear-chat', handleClearChat);"), s.push(" if (handle) {"), s.push(" handle.destroy();"), s.push(" }"), s.push(" };"), s.push(" }, []);"), s.push(""), s.push(" return null; // Widget injects itself into the DOM"), s.push("}"), s.push(""), s.push("// Usage: Collects DOM context for AI-powered navigation"), s.push("// Features:"), s.push("// - Extracts page elements (products, buttons, links)"), s.push("// - Persists chat history across page loads"), s.push("// - Handles navigation actions (nav_then_click)"), s.push("// - Processes structured JSON actions from AI"), s.push("//"), s.push("// Example usage in Next.js:"), s.push("// import { ChatWidgetAdvanced } from './components/ChatWidgetAdvanced';"), s.push("//"), s.push("// export default function RootLayout({ children }) {"), s.push("// return ("), s.push('// <html lang="en">'), s.push("// <body>"), s.push("// {children}"), s.push("// <ChatWidgetAdvanced />"), s.push("// </body>"), s.push("// </html>"), s.push("// );"), s.push("// }"), s.join(`
59813
59976
  `);
59814
59977
  }
59815
- function P(e) {
59978
+ function k(e) {
59816
59979
  let i = h(e), r = i !== "plain", s = {};
59817
59980
  if (e.apiUrl && (s.apiUrl = e.apiUrl), e.clientToken && (s.clientToken = e.clientToken), e.agentId && (s.agentId = e.agentId), e.target && (s.target = e.target), e.flowId && (s.flowId = e.flowId), r && (s.parserType = i), e.theme && (s.theme = e.theme), e.launcher && (s.launcher = e.launcher), e.copy && (s.copy = e.copy), e.sendButton && (s.sendButton = e.sendButton), e.voiceRecognition && (s.voiceRecognition = e.voiceRecognition), e.statusIndicator && (s.statusIndicator = e.statusIndicator), e.features && (s.features = e.features), e.suggestions && (s.suggestions = e.suggestions), e.suggestionChips?.length > 0 && (s.suggestionChips = e.suggestionChips), e.suggestionChipsConfig && (s.suggestionChipsConfig = e.suggestionChipsConfig), e.debug && (s.debug = e.debug), e.toolCall) {
59818
59981
  let a = {};
@@ -59844,8 +60007,8 @@ function P(e) {
59844
60007
  if (n !== "renderUserMessage" && n !== "renderAssistantMessage") if (n === "avatar" && typeof o == "object" && o !== null) t.avatar = o;
59845
60008
  else if (n === "timestamp" && typeof o == "object" && o !== null) {
59846
60009
  let p = {};
59847
- Object.entries(o).forEach(([l, b]) => {
59848
- l !== "format" && (typeof b == "string" || typeof b == "boolean") && (p[l] = b);
60010
+ Object.entries(o).forEach(([l, C]) => {
60011
+ l !== "format" && (typeof C == "string" || typeof C == "boolean") && (p[l] = C);
59849
60012
  }), Object.keys(p).length > 0 && (t.timestamp = p);
59850
60013
  } else (typeof o == "string" || typeof o == "boolean") && (t[n] = o);
59851
60014
  }), Object.keys(t).length > 0 && (a.messages = t);
@@ -59854,12 +60017,12 @@ function P(e) {
59854
60017
  }
59855
60018
  return s;
59856
60019
  }
59857
- function D(e, i) {
59858
- let r = P(e), a = !!(i?.windowKey || i?.target) ? { config: r, ...i?.windowKey ? { windowKey: i.windowKey } : {}, ...i?.target ? { target: i.target } : {} } : r, t = JSON.stringify(a, null, 0).replace(/'/g, "&#39;");
59859
- return `<script src="${$(i)}/install.global.js" data-config='${t}'></script>`;
60020
+ function q(e, i) {
60021
+ let r = k(e), a = !!(i?.windowKey || i?.target) ? { config: r, ...i?.windowKey ? { windowKey: i.windowKey } : {}, ...i?.target ? { target: i.target } : {} } : r, t = JSON.stringify(a, null, 0).replace(/'/g, "&#39;");
60022
+ return `<script src="${w(i)}/install.global.js" data-config='${t}'></script>`;
59860
60023
  }
59861
- function J(e, i) {
59862
- let r = i?.hooks, s = h(e), a = s !== "plain", t = $(i), n = ["<!-- Load CSS -->", `<link rel="stylesheet" href="${t}/widget.css" />`, "", "<!-- Load JavaScript -->", `<script src="${t}/index.global.js"></script>`, "", "<!-- Initialize widget -->", "<script>", " var handle = window.AgentWidget.initAgentWidget({", ` target: '${c(i)}',`, ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: {"];
60024
+ function D(e, i) {
60025
+ let r = i?.hooks, s = h(e), a = s !== "plain", t = w(i), n = ["<!-- Load CSS -->", `<link rel="stylesheet" href="${t}/widget.css" />`, "", "<!-- Load JavaScript -->", `<script src="${t}/index.global.js"></script>`, "", "<!-- Initialize widget -->", "<script>", " var handle = window.AgentWidget.initAgentWidget({", ` target: '${c(i)}',`, ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: {"];
59863
60026
  return e.apiUrl && n.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && n.push(` clientToken: "${e.clientToken}",`), e.agentId && n.push(` agentId: "${e.agentId}",`), e.target && n.push(` target: "${e.target}",`), e.flowId && n.push(` flowId: "${e.flowId}",`), a && n.push(` parserType: "${s}",`), e.theme && typeof e.theme == "object" && Object.keys(e.theme).length > 0 && d(n, "theme", e.theme, " "), e.launcher && d(n, "launcher", e.launcher, " "), e.copy && (n.push(" copy: {"), Object.entries(e.copy).forEach(([o, p]) => {
59864
60027
  n.push(` ${o}: "${p}",`);
59865
60028
  }), n.push(" },")), e.sendButton && (n.push(" sendButton: {"), Object.entries(e.sendButton).forEach(([o, p]) => {
@@ -59872,14 +60035,14 @@ function J(e, i) {
59872
60035
  n.push(` ${o}: ${p},`);
59873
60036
  }), n.push(" },")), n.push(...y(e, " ")), e.suggestionChips && e.suggestionChips.length > 0 && (n.push(" suggestionChips: ["), e.suggestionChips.forEach((o) => {
59874
60037
  n.push(` "${o}",`);
59875
- }), n.push(" ],")), e.suggestionChipsConfig && (n.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && n.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && n.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && n.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && n.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), n.push(" },")), n.push(...g(e, " ")), n.push(...m(e, " ", r)), n.push(...f(e, " ")), n.push(...C(e, " ")), n.push(...w(r, " ")), e.debug && n.push(` debug: ${e.debug},`), r?.postprocessMessage ? n.push(` postprocessMessage: ${r.postprocessMessage}`) : n.push(" postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)"), n.push(" }"), n.push(" });"), n.push("</script>"), n.join(`
60038
+ }), n.push(" ],")), e.suggestionChipsConfig && (n.push(" suggestionChipsConfig: {"), e.suggestionChipsConfig.fontFamily && n.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && n.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && n.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && n.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), n.push(" },")), n.push(...g(e, " ")), n.push(...m(e, " ", r)), n.push(...f(e, " ")), n.push(...b(e, " ")), n.push(...$(r, " ")), e.debug && n.push(` debug: ${e.debug},`), r?.postprocessMessage ? n.push(` postprocessMessage: ${r.postprocessMessage}`) : n.push(" postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)"), n.push(" }"), n.push(" });"), n.push("</script>"), n.join(`
59876
60039
  `);
59877
60040
  }
59878
- function F(e, i) {
59879
- let r = i?.hooks, s = P(e), t = ["<script>", "(function() {", " 'use strict';", "", " // Configuration", ` var CONFIG = ${JSON.stringify(s, null, 2).split(`
60041
+ function J(e, i) {
60042
+ let r = i?.hooks, s = k(e), t = ["<script>", "(function() {", " 'use strict';", "", " // Configuration", ` var CONFIG = ${JSON.stringify(s, null, 2).split(`
59880
60043
  `).map((n, o) => o === 0 ? n : " " + n).join(`
59881
- `)};`, "", " // Constants", ` var CDN_BASE = '${$(i)}';`, " var STORAGE_KEY = 'chat-widget-state';", " var PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", " // DOM context provider - extracts page elements for AI context", " var domContextProvider = function() {", " var selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " var elements = [];", " Object.entries(selectors).forEach(function(entry) {", " var type = entry[0], selector = entry[1];", " document.querySelectorAll(selector).forEach(function(element) {", " if (!(element instanceof HTMLElement)) return;", " var widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " var text = element.innerText ? element.innerText.trim() : '';", " if (!text) return;", "", " var selectorString = element.id ? '#' + element.id :", ` element.getAttribute('data-testid') ? '[data-testid="' + element.getAttribute('data-testid') + '"]' :`, ` element.getAttribute('data-product-id') ? '[data-product-id="' + element.getAttribute('data-product-id') + '"]' :`, " element.tagName.toLowerCase();", "", " var elementData = {", " type: type,", " tagName: element.tagName.toLowerCase(),", " selector: selectorString,", " innerText: text.substring(0, 200)", " };", "", " if (type === 'links' && element instanceof HTMLAnchorElement && element.href) {", " elementData.href = element.href;", " }", " elements.push(elementData);", " });", " });", "", " var counts = elements.reduce(function(acc, el) {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {});", "", " return {", " page_elements: elements.slice(0, 50),", " page_element_count: elements.length,", " element_types: counts,", " page_url: window.location.href,", " page_title: document.title,", " timestamp: new Date().toISOString()", " };", " };", "", " // Load CSS dynamically", " var loadCSS = function() {", " if (document.querySelector('link[data-persona]')) return;", " var link = document.createElement('link');", " link.rel = 'stylesheet';", " link.href = CDN_BASE + '/widget.css';", " link.setAttribute('data-persona', 'true');", " document.head.appendChild(link);", " };", "", " // Load JS dynamically", " var loadJS = function(callback) {", " if (window.AgentWidget) { callback(); return; }", " var script = document.createElement('script');", " script.src = CDN_BASE + '/index.global.js';", " script.onload = callback;", " script.onerror = function() { console.error('Failed to load AgentWidget'); };", " document.head.appendChild(script);", " };", "", " // Create widget config with advanced features", " var createWidgetConfig = function(agentWidget) {", " var widgetConfig = Object.assign({}, CONFIG);", ""];
59882
- return r?.getHeaders && (t.push(` widgetConfig.getHeaders = ${r.getHeaders};`), t.push("")), r?.contextProviders && (t.push(` widgetConfig.contextProviders = ${r.contextProviders};`), t.push("")), r?.streamParser ? t.push(` widgetConfig.streamParser = ${r.streamParser};`) : (t.push(" // Flexible JSON stream parser for handling structured actions"), t.push(" widgetConfig.streamParser = function() {"), t.push(` return agentWidget.createFlexibleJsonStreamParser(${T});`), t.push(" };")), t.push(""), r?.actionParsers ? (t.push(" // Action parsers (custom merged with defaults)"), t.push(` var customParsers = ${r.actionParsers};`), t.push(" widgetConfig.actionParsers = customParsers.concat(["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${j}`), t.push(" ]);")) : (t.push(" // Action parsers to detect JSON actions in responses"), t.push(" widgetConfig.actionParsers = ["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${j}`), t.push(" ];")), t.push(""), r?.actionHandlers ? (t.push(" // Action handlers (custom merged with defaults)"), t.push(` var customHandlers = ${r.actionHandlers};`), t.push(" widgetConfig.actionHandlers = customHandlers.concat(["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${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(""), r?.requestMiddleware ? (t.push(" // Request middleware (custom merged with DOM context)"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(` var customResult = (${r.requestMiddleware})(ctx);`), t.push(" var merged = customResult || ctx.payload;"), t.push(" return Object.assign({}, merged, { metadata: Object.assign({}, merged.metadata, domContextProvider()) });"), t.push(" };")) : (t.push(" // Send DOM context with each request"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(" return Object.assign({}, ctx.payload, { metadata: domContextProvider() });"), t.push(" };")), t.push(""), r?.postprocessMessage ? t.push(` widgetConfig.postprocessMessage = ${r.postprocessMessage};`) : (t.push(" // Markdown postprocessor"), t.push(" widgetConfig.postprocessMessage = function(ctx) {"), t.push(" return agentWidget.markdownPostprocessor(ctx.text);"), t.push(" };")), t.push(""), (r?.onFeedback || r?.onCopy) && (t.push(" // Message action callbacks"), t.push(" widgetConfig.messageActions = widgetConfig.messageActions || {};"), r?.onFeedback && t.push(` widgetConfig.messageActions.onFeedback = ${r.onFeedback};`), r?.onCopy && t.push(` widgetConfig.messageActions.onCopy = ${r.onCopy};`), t.push("")), t.push(" return widgetConfig;", " };", "", " // Initialize widget", " var init = function() {", " var agentWidget = window.AgentWidget;", " if (!agentWidget) {", " console.error('AgentWidget not loaded');", " return;", " }", "", " var widgetConfig = createWidgetConfig(agentWidget);", "", " // Load saved state", " var savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " var parsed = JSON.parse(savedState);", " widgetConfig.initialMessages = parsed.messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", "", " // Initialize widget", " var handle = agentWidget.initAgentWidget({", ` target: '${c(i)}',`, " useShadowDom: false,", ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: widgetConfig", " });", "", " // Save state on message events", " window.addEventListener('persona:message', function() {", " var session = handle.getSession ? handle.getSession() : null;", " if (session) {", " localStorage.setItem(STORAGE_KEY, JSON.stringify({", " messages: session.messages,", " timestamp: new Date().toISOString()", " }));", " }", " });", "", " // Clear state on clear chat", " window.addEventListener('persona:clear-chat', function() {", " localStorage.removeItem(STORAGE_KEY);", " localStorage.removeItem(PROCESSED_ACTIONS_KEY);", " });", " };", "", " // Wait for framework hydration to complete (Next.js, Nuxt, etc.)", " // This prevents the framework from removing dynamically added CSS during reconciliation", " var waitForHydration = function(callback) {", " var executed = false;", " ", " var execute = function() {", " if (executed) return;", " executed = true;", " callback();", " };", "", " var afterDom = function() {", " // Strategy 1: Use requestIdleCallback if available (best for detecting idle after hydration)", " if (typeof requestIdleCallback !== 'undefined') {", " requestIdleCallback(function() {", " // Double requestAnimationFrame ensures at least one full paint cycle completed", " requestAnimationFrame(function() {", " requestAnimationFrame(execute);", " });", " }, { timeout: 3000 }); // Max wait 3 seconds, then proceed anyway", " } else {", " // Strategy 2: Fallback for Safari (no requestIdleCallback)", " // 300ms is typically enough for hydration on most pages", " setTimeout(execute, 300);", " }", " };", "", " if (document.readyState === 'loading') {", " document.addEventListener('DOMContentLoaded', afterDom);", " } else {", " // DOM already ready, but still wait for potential hydration", " afterDom();", " }", " };", "", " // Boot sequence: wait for hydration, then load CSS and JS, then initialize", " // This prevents Next.js/Nuxt/etc. from removing dynamically added CSS during reconciliation", " waitForHydration(function() {", " loadCSS();", " loadJS(function() {", " init();", " });", " });", "})();", "</script>"), t.join(`
60044
+ `)};`, "", " // Constants", ` var CDN_BASE = '${w(i)}';`, " var STORAGE_KEY = 'chat-widget-state';", " var PROCESSED_ACTIONS_KEY = 'chat-widget-processed-actions';", "", " // DOM context provider - extracts page elements for AI context", " var domContextProvider = function() {", " var selectors = {", ` products: '[data-product-id], .product-card, .product-item, [role="article"]',`, ` buttons: 'button, [role="button"], .btn',`, " links: 'a[href]',", " inputs: 'input, textarea, select'", " };", "", " var elements = [];", " Object.entries(selectors).forEach(function(entry) {", " var type = entry[0], selector = entry[1];", " document.querySelectorAll(selector).forEach(function(element) {", " if (!(element instanceof HTMLElement)) return;", " var widgetHost = element.closest('.persona-host');", " if (widgetHost) return;", " var text = element.innerText ? element.innerText.trim() : '';", " if (!text) return;", "", " var selectorString = element.id ? '#' + element.id :", ` element.getAttribute('data-testid') ? '[data-testid="' + element.getAttribute('data-testid') + '"]' :`, ` element.getAttribute('data-product-id') ? '[data-product-id="' + element.getAttribute('data-product-id') + '"]' :`, " element.tagName.toLowerCase();", "", " var elementData = {", " type: type,", " tagName: element.tagName.toLowerCase(),", " selector: selectorString,", " innerText: text.substring(0, 200)", " };", "", " if (type === 'links' && element instanceof HTMLAnchorElement && element.href) {", " elementData.href = element.href;", " }", " elements.push(elementData);", " });", " });", "", " var counts = elements.reduce(function(acc, el) {", " acc[el.type] = (acc[el.type] || 0) + 1;", " return acc;", " }, {});", "", " return {", " page_elements: elements.slice(0, 50),", " page_element_count: elements.length,", " element_types: counts,", " page_url: window.location.href,", " page_title: document.title,", " timestamp: new Date().toISOString()", " };", " };", "", " // Load CSS dynamically", " var loadCSS = function() {", " if (document.querySelector('link[data-persona]')) return;", " var link = document.createElement('link');", " link.rel = 'stylesheet';", " link.href = CDN_BASE + '/widget.css';", " link.setAttribute('data-persona', 'true');", " document.head.appendChild(link);", " };", "", " // Load JS dynamically", " var loadJS = function(callback) {", " if (window.AgentWidget) { callback(); return; }", " var script = document.createElement('script');", " script.src = CDN_BASE + '/index.global.js';", " script.onload = callback;", " script.onerror = function() { console.error('Failed to load AgentWidget'); };", " document.head.appendChild(script);", " };", "", " // Create widget config with advanced features", " var createWidgetConfig = function(agentWidget) {", " var widgetConfig = Object.assign({}, CONFIG);", ""];
60045
+ return r?.getHeaders && (t.push(` widgetConfig.getHeaders = ${r.getHeaders};`), t.push("")), r?.contextProviders && (t.push(` widgetConfig.contextProviders = ${r.contextProviders};`), t.push("")), r?.streamParser ? t.push(` widgetConfig.streamParser = ${r.streamParser};`) : (t.push(" // Flexible JSON stream parser for handling structured actions"), t.push(" widgetConfig.streamParser = function() {"), t.push(` return agentWidget.createFlexibleJsonStreamParser(${T});`), t.push(" };")), t.push(""), r?.actionParsers ? (t.push(" // Action parsers (custom merged with defaults)"), t.push(` var customParsers = ${r.actionParsers};`), t.push(" widgetConfig.actionParsers = customParsers.concat(["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${A}`), t.push(" ]);")) : (t.push(" // Action parsers to detect JSON actions in responses"), t.push(" widgetConfig.actionParsers = ["), t.push(" agentWidget.defaultJsonActionParser,"), t.push(` ${A}`), t.push(" ];")), t.push(""), r?.actionHandlers ? (t.push(" // Action handlers (custom merged with defaults)"), t.push(` var customHandlers = ${r.actionHandlers};`), t.push(" widgetConfig.actionHandlers = customHandlers.concat(["), t.push(" agentWidget.defaultActionHandlers.message,"), t.push(" agentWidget.defaultActionHandlers.messageAndClick,"), t.push(` ${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(""), r?.requestMiddleware ? (t.push(" // Request middleware (custom merged with DOM context)"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(` var customResult = (${r.requestMiddleware})(ctx);`), t.push(" var merged = customResult || ctx.payload;"), t.push(" return Object.assign({}, merged, { metadata: Object.assign({}, merged.metadata, domContextProvider()) });"), t.push(" };")) : (t.push(" // Send DOM context with each request"), t.push(" widgetConfig.requestMiddleware = function(ctx) {"), t.push(" return Object.assign({}, ctx.payload, { metadata: domContextProvider() });"), t.push(" };")), t.push(""), r?.postprocessMessage ? t.push(` widgetConfig.postprocessMessage = ${r.postprocessMessage};`) : (t.push(" // Markdown postprocessor"), t.push(" widgetConfig.postprocessMessage = function(ctx) {"), t.push(" return agentWidget.markdownPostprocessor(ctx.text);"), t.push(" };")), t.push(""), (r?.onFeedback || r?.onCopy) && (t.push(" // Message action callbacks"), t.push(" widgetConfig.messageActions = widgetConfig.messageActions || {};"), r?.onFeedback && t.push(` widgetConfig.messageActions.onFeedback = ${r.onFeedback};`), r?.onCopy && t.push(` widgetConfig.messageActions.onCopy = ${r.onCopy};`), t.push("")), t.push(" return widgetConfig;", " };", "", " // Initialize widget", " var init = function() {", " var agentWidget = window.AgentWidget;", " if (!agentWidget) {", " console.error('AgentWidget not loaded');", " return;", " }", "", " var widgetConfig = createWidgetConfig(agentWidget);", "", " // Load saved state", " var savedState = localStorage.getItem(STORAGE_KEY);", " if (savedState) {", " try {", " var parsed = JSON.parse(savedState);", " widgetConfig.initialMessages = parsed.messages || [];", " } catch (e) {", " console.error('Failed to load saved state:', e);", " }", " }", "", " // Initialize widget", " var handle = agentWidget.initAgentWidget({", ` target: '${c(i)}',`, " useShadowDom: false,", ...i?.windowKey ? [` windowKey: '${i.windowKey}',`] : [], " config: widgetConfig", " });", "", " // Save state on message events", " window.addEventListener('persona:message', function() {", " var session = handle.getSession ? handle.getSession() : null;", " if (session) {", " localStorage.setItem(STORAGE_KEY, JSON.stringify({", " messages: session.messages,", " timestamp: new Date().toISOString()", " }));", " }", " });", "", " // Clear state on clear chat", " window.addEventListener('persona:clear-chat', function() {", " localStorage.removeItem(STORAGE_KEY);", " localStorage.removeItem(PROCESSED_ACTIONS_KEY);", " });", " };", "", " // Wait for framework hydration to complete (Next.js, Nuxt, etc.)", " // This prevents the framework from removing dynamically added CSS during reconciliation", " var waitForHydration = function(callback) {", " var executed = false;", " ", " var execute = function() {", " if (executed) return;", " executed = true;", " callback();", " };", "", " var afterDom = function() {", " // Strategy 1: Use requestIdleCallback if available (best for detecting idle after hydration)", " if (typeof requestIdleCallback !== 'undefined') {", " requestIdleCallback(function() {", " // Double requestAnimationFrame ensures at least one full paint cycle completed", " requestAnimationFrame(function() {", " requestAnimationFrame(execute);", " });", " }, { timeout: 3000 }); // Max wait 3 seconds, then proceed anyway", " } else {", " // Strategy 2: Fallback for Safari (no requestIdleCallback)", " // 300ms is typically enough for hydration on most pages", " setTimeout(execute, 300);", " }", " };", "", " if (document.readyState === 'loading') {", " document.addEventListener('DOMContentLoaded', afterDom);", " } else {", " // DOM already ready, but still wait for potential hydration", " afterDom();", " }", " };", "", " // Boot sequence: wait for hydration, then load CSS and JS, then initialize", " // This prevents Next.js/Nuxt/etc. from removing dynamically added CSS during reconciliation", " waitForHydration(function() {", " loadCSS();", " loadJS(function() {", " init();", " });", " });", "})();", "</script>"), t.join(`
59883
60046
  `);
59884
60047
  }
59885
60048
 
@@ -62549,7 +62712,7 @@ var tailCommand = new Command29("tail").description("Stream live execution logs
62549
62712
  });
62550
62713
 
62551
62714
  // src/commands/validate-product.ts
62552
- import { Command as Command30, Option } from "commander";
62715
+ import { Command as Command30, Option as Option2 } from "commander";
62553
62716
  import chalk38 from "chalk";
62554
62717
  import { readFileSync as readFileSync18 } from "fs";
62555
62718
  function createValidateProductCommand() {
@@ -62557,7 +62720,7 @@ function createValidateProductCommand() {
62557
62720
  "[input]",
62558
62721
  'Path to JSON file, raw JSON string (starts with "{"), or "-" for stdin'
62559
62722
  ).option("--template", "Force FPO template validation").option("--fpo", "Force FPO (non-template) validation").addOption(
62560
- new Option("--json", "Output the full validation result as JSON").default(void 0)
62723
+ new Option2("--json", "Output the full validation result as JSON").default(void 0)
62561
62724
  ).option("-q, --quiet", "Suppress output; rely on exit code only").addHelpText(
62562
62725
  "after",
62563
62726
  `
@@ -63751,7 +63914,6 @@ function collectExportedExecutionInventory(definition) {
63751
63914
  walkTools(agent.config.tools);
63752
63915
  }
63753
63916
  if (isObject2(agent.claudeManagedConfig)) addModel(agent.claudeManagedConfig.model);
63754
- if (isObject2(agent.primaryFlow)) walkFlow(agent.primaryFlow);
63755
63917
  if (Array.isArray(agent.capabilities)) {
63756
63918
  for (const capability of agent.capabilities) {
63757
63919
  if (!isObject2(capability)) continue;
@@ -63790,18 +63952,31 @@ function collectDeploymentSecretInventory(agentDef) {
63790
63952
  function slugify2(s) {
63791
63953
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 63);
63792
63954
  }
63793
- var deployCommand = new Command31("deploy").description("Export an agent or flow and scaffold a deployment (cloud-run, cloudflare, or vercel)").option("--agent <id>", "Agent ID to export (may be repeated)", (v2, acc) => {
63955
+ var RETIRED_DEPLOY_FLOW_MESSAGE = [
63956
+ "Error: `runtype deploy --flow` is retired (ADR 0024).",
63957
+ " The scaffold wrapped an exported flow in a primary-flow agent, and that agent execution mode is gone.",
63958
+ " Two ways to deploy a flow instead:",
63959
+ " 1. Attach the flow to an agent as a runtime tool ({ toolType: 'flow', flowId }), then deploy that agent:",
63960
+ " runtype deploy --agent <agentId>",
63961
+ " 2. Run the flow on the hosted API without scaffolding anything:",
63962
+ " runtype dispatch --flow <flowId>"
63963
+ ];
63964
+ var deployCommand = new Command31("deploy").description("Export an agent and scaffold a deployment (cloud-run, cloudflare, or vercel)").option("--agent <id>", "Agent ID to export (may be repeated)", (v2, acc) => {
63794
63965
  acc.push(v2);
63795
63966
  return acc;
63796
- }, []).option("--flow <id>", "Flow ID to export (may be repeated)", (v2, acc) => {
63967
+ }, []).option("--flow <id>", "Removed (ADR 0024): export the agent that runs the flow instead", (v2, acc) => {
63797
63968
  acc.push(v2);
63798
63969
  return acc;
63799
63970
  }, []).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(
63800
63971
  async (options) => {
63801
63972
  const agentIds = options.agent;
63802
63973
  const flowIds = options.flow;
63803
- if (agentIds.length === 0 && flowIds.length === 0) {
63804
- console.error(chalk39.red("Error: provide at least one --agent <id> or --flow <id>"));
63974
+ if (flowIds.length > 0) {
63975
+ for (const line of RETIRED_DEPLOY_FLOW_MESSAGE) console.error(chalk39.yellow(line));
63976
+ process.exit(1);
63977
+ }
63978
+ if (agentIds.length === 0) {
63979
+ console.error(chalk39.red("Error: provide at least one --agent <id>"));
63805
63980
  process.exit(1);
63806
63981
  }
63807
63982
  const target = options.target;
@@ -63836,36 +64011,6 @@ Scaffolding ${target} deployment to ${outDir}
63836
64011
  process.exit(1);
63837
64012
  }
63838
64013
  }
63839
- for (const id of flowIds) {
63840
- process.stdout.write(` Exporting flow ${chalk39.green(id)}... `);
63841
- try {
63842
- const def = await client.get(`/flows/${id}/export-runtime`);
63843
- const wrappedName = String(def.name ?? id);
63844
- agentDefs.push({
63845
- id,
63846
- name: wrappedName,
63847
- def: {
63848
- id: def.id,
63849
- name: wrappedName,
63850
- description: def.description ?? null,
63851
- agentType: "runtype",
63852
- config: {},
63853
- primaryFlow: def
63854
- }
63855
- });
63856
- process.stdout.write(chalk39.green("\u2713\n"));
63857
- } catch (err) {
63858
- const msg = err instanceof RuntypeApiError4 ? err.message : String(err);
63859
- process.stdout.write(chalk39.red(`\u2717
63860
- `));
63861
- console.error(chalk39.red(` Failed to export flow ${id}: ${msg}`));
63862
- if (err instanceof RuntypeApiError4 && err.statusCode === 404) {
63863
- console.error(chalk39.yellow(" The export-runtime feature may not be enabled on your account or environment."));
63864
- console.error(chalk39.gray(" If you have your own environment, try: RUNTYPE_API_URL={API Base URI} runtype deploy ..."));
63865
- }
63866
- process.exit(1);
63867
- }
63868
- }
63869
64014
  const agentSlugs = agentDefs.map(({ name }) => slugify2(name));
63870
64015
  const slugSet = /* @__PURE__ */ new Set();
63871
64016
  for (let i = 0; i < agentSlugs.length; i++) {
@@ -65707,10 +65852,10 @@ function parseVersion(version2) {
65707
65852
  }
65708
65853
  function compareVersions(left, right) {
65709
65854
  const a = parseVersion(left);
65710
- const b = parseVersion(right);
65711
- if (!a || !b) return 0;
65855
+ const b2 = parseVersion(right);
65856
+ if (!a || !b2) return 0;
65712
65857
  for (let index = 0; index < 3; index++) {
65713
- const diff = a[index] - b[index];
65858
+ const diff = a[index] - b2[index];
65714
65859
  if (diff !== 0) return diff;
65715
65860
  }
65716
65861
  return 0;
@@ -66623,7 +66768,7 @@ function parseServer(value) {
66623
66768
  if (value === "standard" || value === "code") return value;
66624
66769
  throw new InvalidArgumentError('Allowed values are "standard" and "code"');
66625
66770
  }
66626
- function parsePositiveInteger(value) {
66771
+ function parsePositiveInteger2(value) {
66627
66772
  const parsed = Number(value);
66628
66773
  if (!Number.isSafeInteger(parsed) || parsed <= 0) {
66629
66774
  throw new InvalidArgumentError("Timeout must be a positive integer in milliseconds");
@@ -66740,7 +66885,7 @@ function createMcpCommand(overrides = {}) {
66740
66885
  ).option("--json-body <json>", "Use an inline JSON object as the tool arguments").option("--input <file>", "Read the tool arguments JSON object from a file or - for stdin").option(
66741
66886
  "--timeout <ms>",
66742
66887
  "Maximum time to wait for the tool result in milliseconds",
66743
- parsePositiveInteger,
66888
+ parsePositiveInteger2,
66744
66889
  DEFAULT_TOOL_TIMEOUT_MS
66745
66890
  )
66746
66891
  ).action(async (name, options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/cli",
3
- "version": "2.35.7",
3
+ "version": "2.36.0",
4
4
  "description": "Command-line interface for Runtype AI platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,7 +11,7 @@
11
11
  "@modelcontextprotocol/client": "2.0.0",
12
12
  "@modelcontextprotocol/core": "2.0.0",
13
13
  "@runtypelabs/ink-components": "0.3.7",
14
- "@runtypelabs/sdk": "9.5.1",
14
+ "@runtypelabs/sdk": "9.6.0",
15
15
  "@runtypelabs/terminal-animations": "0.2.4",
16
16
  "add-mcp": "2.0.0",
17
17
  "chalk": "^5.3.0",
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@modelcontextprotocol/server": "2.0.0",
35
- "@runtypelabs/persona": "4.17.1",
36
- "@runtypelabs/shared": "3.38.1",
35
+ "@runtypelabs/persona": "4.22.0",
36
+ "@runtypelabs/shared": "3.39.0",
37
37
  "@types/express": "^5.0.6",
38
38
  "@types/micromatch": "^4.0.9",
39
39
  "@types/node": "^25.3.3",