@runtypelabs/cli 2.53.3 → 2.55.2

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 +424 -536
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/cli
41
41
  import WebSocket from "ws";
42
42
  import { Readable, Transform } from "node:stream";
43
43
  import { pipeline } from "node:stream/promises";
44
- //#region \0rolldown/runtime.js
44
+ // \0rolldown/runtime.js
45
45
  var __defProp = Object.defineProperty;
46
46
  var __exportAll = (all, no_symbols) => {
47
47
  let target = {};
@@ -53,8 +53,7 @@ var __exportAll = (all, no_symbols) => {
53
53
  return target;
54
54
  };
55
55
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
56
- //#endregion
57
- //#region ../shared/dist/chunk-CBBsMeGB.mjs
56
+ // ../shared/dist/chunk-D9RiVw4h.mjs
58
57
  /**
59
58
  * Every product surface type the platform stores and serves. The single source for the FPO surface
60
59
  * enum, the REST create and ensure schemas, and the shared `SurfaceType`; add a new type here only.
@@ -108,8 +107,7 @@ function mergeResults(...results) {
108
107
  merged.valid = merged.errors.length === 0;
109
108
  return merged;
110
109
  }
111
- //#endregion
112
- //#region ../shared/dist/chunk-DHTzYHWZ.mjs
110
+ // ../shared/dist/chunk-XcxbQPuh.mjs
113
111
  /** Names every key of `T` exactly once, so a new credential field fails the build. */
114
112
  function credentialKeysOf(presence) {
115
113
  return Object.keys(presence);
@@ -134,14 +132,13 @@ const SURFACE_OUTBOUND_CREDENTIAL_KEYS = credentialKeysOf({
134
132
  smtpPassword: true
135
133
  });
136
134
  [.../* @__PURE__ */ new Set([...SURFACE_INBOUND_CREDENTIAL_KEYS, ...SURFACE_OUTBOUND_CREDENTIAL_KEYS])];
137
- //#endregion
138
- //#region ../shared/dist/chunk-BXAx6kZN.mjs
135
+ // ../shared/dist/chunk-BgsR9QB6.mjs
139
136
  /** Every evaluation model the gateway lists, keyed by the gateway id a call names. */
140
137
  const GATEWAY_EVALUATION_MODELS = Object.freeze({
141
138
  "baseten/elephant-1": Object.freeze({
142
139
  id: "baseten/elephant-1",
143
140
  name: "Elephant-1",
144
- description: "Elephant-1 is a 9B evaluation model from Baseten's Base Labs for classification, routing, and scoring. It evaluates structured context against choice, yes/no, and ordered scoring questions and returns answer probabilities and confidence in a single forward pass, without generating free-form text. Applications can use these probabilities to select answers or set confidence thresholds.",
141
+ description: "Elephant-1 is a 9B decision model from Baseten's Base Labs for classification, routing, and scoring. It evaluates structured context against choice, yes/no, and ordered scoring questions and returns answer probabilities and confidence in a single forward pass, without generating free-form text. Applications can use these probabilities to select answers or set confidence thresholds.",
145
142
  contextWindow: 16384,
146
143
  supportedSpecifications: Object.freeze(["v4"]),
147
144
  pricing: Object.freeze({
@@ -154,7 +151,7 @@ const GATEWAY_EVALUATION_MODELS = Object.freeze({
154
151
  "baseten/mammoth-1": Object.freeze({
155
152
  id: "baseten/mammoth-1",
156
153
  name: "Mammoth-1",
157
- description: "Mammoth-1 is a 27B evaluation model from Baseten's Base Labs, fine-tuned from Qwen3.5-27B for classification, routing, and scoring. It answers multiple-choice, yes/no, and ordered scoring questions with probabilities over predefined options rather than generated text. Shared-prefix caching reuses context across questions, while per-option probabilities support confidence thresholds and escalation decisions.",
154
+ description: "Mammoth-1 is a 27B decision model from Baseten's Base Labs, fine-tuned from Qwen3.5-27B for classification, routing, and scoring. It answers multiple-choice, yes/no, and ordered scoring questions with probabilities over predefined options rather than generated text. Shared-prefix caching reuses context across questions, while per-option probabilities support confidence thresholds and escalation decisions.",
158
155
  contextWindow: 16384,
159
156
  supportedSpecifications: Object.freeze(["v4"]),
160
157
  pricing: Object.freeze({
@@ -387,8 +384,7 @@ const modelsById$1 = new Map(models$1.map((model) => [model.id, model]));
387
384
  function getDecisionModel(modelId) {
388
385
  return modelsById$1.get(modelId);
389
386
  }
390
- //#endregion
391
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
387
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
392
388
  function getEnumValues(entries) {
393
389
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
394
390
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -805,6 +801,7 @@ function hide(inst, key, value) {
805
801
  return own(inst, key, value, false);
806
802
  }
807
803
  /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
804
+ /* @__NO_SIDE_EFFECTS__ */
808
805
  function derived(computes, table) {
809
806
  for (const key in computes) {
810
807
  const compute = computes[key];
@@ -928,8 +925,7 @@ function constantCatch(value) {
928
925
  fn[CONSTANT_CATCH] = true;
929
926
  return fn;
930
927
  }
931
- //#endregion
932
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
928
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
933
929
  var _a$1;
934
930
  const _zodDesc = {
935
931
  value: void 0,
@@ -956,6 +952,7 @@ function newError(Definition) {
956
952
  }
957
953
  return new Definition();
958
954
  }
955
+ /* @__NO_SIDE_EFFECTS__ */
959
956
  function $constructor(name, initializer, proto, params) {
960
957
  const zodProto = {};
961
958
  function Internals(def) {
@@ -1034,8 +1031,7 @@ function config(newConfig) {
1034
1031
  if (newConfig) Object.assign(globalConfig, newConfig);
1035
1032
  return globalConfig;
1036
1033
  }
1037
- //#endregion
1038
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
1034
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
1039
1035
  function _getMessage() {
1040
1036
  const internals = this._zod;
1041
1037
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -1086,8 +1082,7 @@ const initializer$1 = (inst, def) => {
1086
1082
  });
1087
1083
  }
1088
1084
  };
1089
- const $ZodError = $constructor("$ZodError", initializer$1);
1090
- $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
1085
+ const $ZodError = /* @__PURE__ */ $constructor("$ZodError", initializer$1);
1091
1086
  /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
1092
1087
  * ("toString", "constructor") would otherwise read through to the prototype, and assigning
1093
1088
  * "__proto__" would hit the setter instead of creating a key. */
@@ -1150,8 +1145,7 @@ function formatError(error, mapper = (issue) => issue.message) {
1150
1145
  processError(error);
1151
1146
  return fieldErrors;
1152
1147
  }
1153
- //#endregion
1154
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
1148
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
1155
1149
  function finalizeParams(callee, params) {
1156
1150
  return {
1157
1151
  callee: params?.callee ?? callee,
@@ -1353,8 +1347,7 @@ const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
1353
1347
  const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
1354
1348
  return _safeParseAsync(_Err)(schema, value, _ctx);
1355
1349
  };
1356
- //#endregion
1357
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
1350
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
1358
1351
  /**
1359
1352
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
1360
1353
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -1426,8 +1419,7 @@ const boolean$1 = /^(?:true|false)$/i;
1426
1419
  const _null$2 = /^null$/i;
1427
1420
  const lowercase = /^[^A-Z]*$/;
1428
1421
  const uppercase = /^[^a-z]*$/;
1429
- //#endregion
1430
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
1422
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
1431
1423
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
1432
1424
  var _a;
1433
1425
  inst._zod ?? (inst._zod = {});
@@ -1722,8 +1714,7 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
1722
1714
  payload.value = def.tx(payload.value);
1723
1715
  };
1724
1716
  });
1725
- //#endregion
1726
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
1717
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
1727
1718
  var Doc = class {
1728
1719
  constructor(args = [], closed = {}) {
1729
1720
  this.content = [];
@@ -1756,15 +1747,13 @@ var Doc = class {
1756
1747
  return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
1757
1748
  }
1758
1749
  };
1759
- //#endregion
1760
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
1750
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
1761
1751
  const version = {
1762
1752
  major: 4,
1763
1753
  minor: 6,
1764
1754
  patch: 5
1765
1755
  };
1766
- //#endregion
1767
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
1756
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
1768
1757
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1769
1758
  var _a;
1770
1759
  inst ?? (inst = {});
@@ -3343,8 +3332,7 @@ function handleRefineResult(result, payload, input, inst) {
3343
3332
  payload.issues.push(issue(_iss));
3344
3333
  }
3345
3334
  }
3346
- //#endregion
3347
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
3335
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
3348
3336
  var $ZodCyclicError = class extends Error {
3349
3337
  constructor() {
3350
3338
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -3596,8 +3584,7 @@ function isBackEdge(ctx, value) {
3596
3584
  const backEdges = ctx[STATE]?.backEdges;
3597
3585
  return backEdges !== void 0 && isRef(value) && backEdges.has(value);
3598
3586
  }
3599
- //#endregion
3600
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
3587
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
3601
3588
  const error = () => {
3602
3589
  const Sizable = {
3603
3590
  string: {
@@ -3704,8 +3691,7 @@ const error = () => {
3704
3691
  function en_default() {
3705
3692
  return { localeError: error() };
3706
3693
  }
3707
- //#endregion
3708
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.js
3694
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.js
3709
3695
  var _a;
3710
3696
  var $ZodRegistry = class {
3711
3697
  constructor() {
@@ -3751,8 +3737,7 @@ function registry() {
3751
3737
  }
3752
3738
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
3753
3739
  const globalRegistry = globalThis.__zod_globalRegistry;
3754
- //#endregion
3755
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
3740
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
3756
3741
  function snapshotChecks(def) {
3757
3742
  if (def.checks) def.checks = [...def.checks];
3758
3743
  return def;
@@ -4291,8 +4276,7 @@ function _check(fn, params) {
4291
4276
  ch._zod.check = fn;
4292
4277
  return ch;
4293
4278
  }
4294
- //#endregion
4295
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
4279
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
4296
4280
  function assignProps(target, ...sources) {
4297
4281
  for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
4298
4282
  return target;
@@ -4735,8 +4719,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
4735
4719
  extractDefs(ctx, schema);
4736
4720
  return finalize$1(ctx, schema);
4737
4721
  };
4738
- //#endregion
4739
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
4722
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
4740
4723
  const narrowMin = (agg, key, value) => {
4741
4724
  if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
4742
4725
  };
@@ -5381,8 +5364,7 @@ function toJSONSchema(input, params) {
5381
5364
  extractDefs(ctx, input);
5382
5365
  return finalize$1(ctx, input);
5383
5366
  }
5384
- //#endregion
5385
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.js
5367
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.js
5386
5368
  const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
5387
5369
  function _lazyMethod(proto, key, make) {
5388
5370
  Object.defineProperty(proto, key, {
@@ -5431,8 +5413,7 @@ const initializer = (inst, issues) => {
5431
5413
  });
5432
5414
  };
5433
5415
  const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
5434
- //#endregion
5435
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
5416
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
5436
5417
  const parse$1 = /* @__PURE__ */ _parse(ZodRealError);
5437
5418
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
5438
5419
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -5445,8 +5426,7 @@ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
5445
5426
  const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
5446
5427
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
5447
5428
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
5448
- //#endregion
5449
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
5429
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
5450
5430
  function _ensureDefaultLocale() {
5451
5431
  if (!globalConfig.localeError) config(en_default());
5452
5432
  }
@@ -6422,8 +6402,7 @@ function preprocess(fn, schema) {
6422
6402
  out: schema
6423
6403
  });
6424
6404
  }
6425
- //#endregion
6426
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/compat.js
6405
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/compat.js
6427
6406
  /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
6428
6407
  const ZodIssueCode = {
6429
6408
  invalid_type: "invalid_type",
@@ -6441,21 +6420,18 @@ const ZodIssueCode = {
6441
6420
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
6442
6421
  var ZodFirstPartyTypeKind;
6443
6422
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6444
- //#endregion
6445
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
6423
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
6446
6424
  function datetime(params) {
6447
6425
  return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
6448
6426
  }
6449
6427
  function date(params) {
6450
6428
  return /* @__PURE__ */ _isoDate(ZodISODate, params);
6451
6429
  }
6452
- //#endregion
6453
- //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/coerce.js
6430
+ // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/coerce.js
6454
6431
  function number(params) {
6455
6432
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
6456
6433
  }
6457
- //#endregion
6458
- //#region ../shared/dist/chunk-DKcBd-4r.mjs
6434
+ // ../shared/dist/chunk-BwvziRCX.mjs
6459
6435
  const judgmentJsonValueSchema = lazy(() => union([
6460
6436
  _null(),
6461
6437
  string(),
@@ -6542,7 +6518,7 @@ const judgmentQuestionMessages = {
6542
6518
  scoreLevelCount: (id, count) => count === void 0 ? `Score question "${id}" needs criteria as an ordered list of 2 to 10 levels.` : `Score question "${id}" has ${count} ${count === 1 ? "level" : "levels"}, but a score question needs 2 to 10.`,
6543
6519
  malformed: (id, path, detail) => `Question "${id}" is malformed at ${path.length > 0 ? path.join(".") : "its root"}: ${detail.replace(/\.$/, "")}.`
6544
6520
  };
6545
- function isPlainObject$4(value) {
6521
+ function isPlainObject$3(value) {
6546
6522
  return typeof value === "object" && value !== null && !Array.isArray(value);
6547
6523
  }
6548
6524
  function instructionsMissing(value) {
@@ -6550,7 +6526,7 @@ function instructionsMissing(value) {
6550
6526
  return typeof value === "string" && value.trim().length === 0;
6551
6527
  }
6552
6528
  function collectRuleIssues(id, question) {
6553
- if (!isPlainObject$4(question)) return [{
6529
+ if (!isPlainObject$3(question)) return [{
6554
6530
  code: "JUDGMENT_QUESTION_NOT_OBJECT",
6555
6531
  path: [id],
6556
6532
  message: judgmentQuestionMessages.notObject(id)
@@ -6569,7 +6545,7 @@ function collectRuleIssues(id, question) {
6569
6545
  });
6570
6546
  const criteria = question.criteria;
6571
6547
  if (type === "choice") {
6572
- if (!isPlainObject$4(criteria) || Object.keys(criteria).length === 0) issues.push({
6548
+ if (!isPlainObject$3(criteria) || Object.keys(criteria).length === 0) issues.push({
6573
6549
  code: "JUDGMENT_CHOICE_CRITERIA_EMPTY",
6574
6550
  path: [id, "criteria"],
6575
6551
  message: judgmentQuestionMessages.choiceCriteriaEmpty(id)
@@ -6608,7 +6584,7 @@ function collectShapeIssues(id, question) {
6608
6584
  * an author sees the rule's sentence rather than a generic parser message.
6609
6585
  */
6610
6586
  function validateJudgmentQuestions(questions) {
6611
- if (!isPlainObject$4(questions) || Object.keys(questions).length === 0) return [{
6587
+ if (!isPlainObject$3(questions) || Object.keys(questions).length === 0) return [{
6612
6588
  code: "JUDGMENT_NO_QUESTIONS",
6613
6589
  path: [],
6614
6590
  message: judgmentQuestionMessages.noQuestions()
@@ -6767,8 +6743,7 @@ function hasNoReservedInputKeys(inputs) {
6767
6743
  if (!inputs) return true;
6768
6744
  return Object.keys(inputs).every((key) => !key.startsWith("_"));
6769
6745
  }
6770
- //#endregion
6771
- //#region ../shared/dist/chunk-CBi4Kg_f.mjs
6746
+ // ../shared/dist/chunk-DWLsnzbx.mjs
6772
6747
  /**
6773
6748
  * Get nested property value using dot notation and bracket notation.
6774
6749
  * Example: getNestedValue({user: {name: 'John'}}, 'user.name') returns 'John'.
@@ -7112,8 +7087,7 @@ function resolveFallback(parsed, context, tracking, options = {}) {
7112
7087
  return tracking.match;
7113
7088
  }
7114
7089
  new SimpleTemplateEngine();
7115
- //#endregion
7116
- //#region ../shared/dist/chunk-DYthNbe0.mjs
7090
+ // ../shared/dist/chunk-CRRVsJap.mjs
7117
7091
  /**
7118
7092
  * Canonical record type guard: a non-null object that is NOT an array.
7119
7093
  * This is the array-EXCLUDING variant — `isRecord([])` is false.
@@ -7121,8 +7095,7 @@ new SimpleTemplateEngine();
7121
7095
  function isRecord$5(value) {
7122
7096
  return typeof value === "object" && value !== null && !Array.isArray(value);
7123
7097
  }
7124
- //#endregion
7125
- //#region ../shared/dist/chunk-CFak88Vc.mjs
7098
+ // ../shared/dist/chunk-DJMWTgFP.mjs
7126
7099
  /**
7127
7100
  * The AI-SDK tool-name sanitizer, as a dependency-free leaf.
7128
7101
  * Canonical home: the rule is enforced in three places that cannot all import model-execution.
@@ -7151,8 +7124,7 @@ function modelVisibleToolName(toolId) {
7151
7124
  function toolNamesCollideForAiSdk(left, right) {
7152
7125
  return sanitizeToolNameForAiSdk(left) === sanitizeToolNameForAiSdk(right);
7153
7126
  }
7154
- //#endregion
7155
- //#region ../shared/dist/chunk-HH7aA8wp.mjs
7127
+ // ../shared/dist/chunk-DZsv6wYf.mjs
7156
7128
  const BUILTIN_TOOLS_LEAN = [
7157
7129
  {
7158
7130
  "id": "gpt-image-2-5",
@@ -9636,8 +9608,7 @@ const BUILTIN_TOOLS_LEAN = [
9636
9608
  "managedExecutionKind": "orthogonal"
9637
9609
  }
9638
9610
  ];
9639
- //#endregion
9640
- //#region ../shared/dist/chunk-CS4x6DfE.mjs
9611
+ // ../shared/dist/chunk-B-U9MA7t.mjs
9641
9612
  const BuiltInToolProvider = {
9642
9613
  OPENAI: "openai",
9643
9614
  ANTHROPIC: "anthropic",
@@ -9681,8 +9652,7 @@ const BuiltInToolGroup = {
9681
9652
  SANDBOX_AGENT: "sandbox_agent",
9682
9653
  TEMPORAL: "temporal"
9683
9654
  };
9684
- //#endregion
9685
- //#region ../shared/dist/chunk-B_P1LIsa.mjs
9655
+ // ../shared/dist/chunk-DsafYLgI.mjs
9686
9656
  /**
9687
9657
  * Built-in Model Tools Registry — the LEAN tier.
9688
9658
  *
@@ -9741,8 +9711,7 @@ function isToolCompatibleWithModel(toolId, modelId, provider) {
9741
9711
  if (compatibility.models.length === 0) return true;
9742
9712
  return compatibility.models.some((m) => modelId.includes(m));
9743
9713
  }
9744
- //#endregion
9745
- //#region ../shared/dist/chunk-CL_QZn3S.mjs
9714
+ // ../shared/dist/chunk-9uTZDlBG.mjs
9746
9715
  const nonNegativeInteger = number$1().int().nonnegative();
9747
9716
  const annotations = {
9748
9717
  title: string().optional(),
@@ -9816,8 +9785,7 @@ function isSupportedElicitationSchema(schema) {
9816
9785
  const parsed = schemaNode.safeParse(schema);
9817
9786
  return parsed.success && typeof parsed.data !== "boolean" && parsed.data.type === "object";
9818
9787
  }
9819
- //#endregion
9820
- //#region ../shared/dist/chunk-BcjKHO7O.mjs
9788
+ // ../shared/dist/chunk-DBw0Iwzv.mjs
9821
9789
  /** The Tenancy Assurance Levels, in the order `tenancyAssuranceLevelSchema` is built from. */
9822
9790
  const TENANCY_ASSURANCE_LEVELS = [
9823
9791
  "anonymous",
@@ -9860,8 +9828,7 @@ function identityAudienceAllowed(audience, patterns) {
9860
9828
  return HOSTNAME_LABEL.test(label);
9861
9829
  });
9862
9830
  }
9863
- //#endregion
9864
- //#region ../shared/dist/chunk-CCF2zL4u.mjs
9831
+ // ../shared/dist/chunk-sRQYvcOi.mjs
9865
9832
  function extractSecretReferences(template) {
9866
9833
  const keys = /* @__PURE__ */ new Set();
9867
9834
  let match;
@@ -10449,8 +10416,7 @@ function separateToolIds(toolIds) {
10449
10416
  function isDataConnectionToolId(toolId) {
10450
10417
  return toolId.startsWith("dc:");
10451
10418
  }
10452
- //#endregion
10453
- //#region ../shared/dist/chunk-RD6b0or7.mjs
10419
+ // ../shared/dist/chunk-DTtvtyD1.mjs
10454
10420
  /**
10455
10421
  * The reserved model-facing name of the agent state write tool
10456
10422
  * (`packages/runtime/src/engine/state-write-tool.ts`). The model is told to call
@@ -10511,8 +10477,7 @@ function resolveDirectProviderToolOwner(toolId) {
10511
10477
  const owner = ownerOf(toolId);
10512
10478
  return owner && DIRECT_PROVIDER_TOOL_OWNERS.has(owner) ? owner : void 0;
10513
10479
  }
10514
- //#endregion
10515
- //#region ../shared/dist/chunk-C-OBmD9q.mjs
10480
+ // ../shared/dist/chunk-CCggKUGZ.mjs
10516
10481
  /**
10517
10482
  * Unwraps a single {{variableName}} template to its bare variable name, preserving array/object identity instead of stringifying via the template engine.
10518
10483
  * Returns source unchanged when it is not a lone {{...}} wrapper.
@@ -10558,8 +10523,7 @@ function getConditionalBranches(config) {
10558
10523
  isBinary: true
10559
10524
  };
10560
10525
  }
10561
- //#endregion
10562
- //#region ../shared/dist/chunk-D-Avt9oa.mjs
10526
+ // ../shared/dist/chunk-DaWm3aVW.mjs
10563
10527
  /** Post-normalization metadata key shape. Mirrors the api's key-length cap (64). */
10564
10528
  const RECORD_COLLECTION_FIELD_NAME_PATTERN = /^[a-z0-9_]{1,64}$/;
10565
10529
  const RECORD_COLLECTION_VALIDATION_MODES = [
@@ -10675,8 +10639,7 @@ function parseRecordCollectionSchema(input) {
10675
10639
  }))
10676
10640
  };
10677
10641
  }
10678
- //#endregion
10679
- //#region ../shared/dist/browser-domain-policy.mjs
10642
+ // ../shared/dist/browser-domain-policy.mjs
10680
10643
  function canonicalHostname(hostname) {
10681
10644
  let end = hostname.length;
10682
10645
  while (end > 0 && hostname.charCodeAt(end - 1) === 46) end--;
@@ -10701,8 +10664,7 @@ const COMPACTION_STRATEGIES = [
10701
10664
  "provider_native",
10702
10665
  "summary"
10703
10666
  ];
10704
- //#endregion
10705
- //#region ../shared/dist/chunk-fDlRxlNl.mjs
10667
+ // ../shared/dist/chunk-65wXea33.mjs
10706
10668
  const EXTRACTION_FIELD_TYPES = [
10707
10669
  "text",
10708
10670
  "number",
@@ -10816,8 +10778,7 @@ object({
10816
10778
  schemaTokens: number$1().int().min(0).optional(),
10817
10779
  passes: number$1().int().min(0).optional()
10818
10780
  });
10819
- //#endregion
10820
- //#region ../shared/dist/chunk-BQYclXzM.mjs
10781
+ // ../shared/dist/chunk-aBxNuVz7.mjs
10821
10782
  const CONTEXT_STEP_TYPES = [
10822
10783
  "crawl",
10823
10784
  "fetch-url",
@@ -10851,8 +10812,7 @@ const CONTEXT_STEP_TYPES = [
10851
10812
  "extract"
10852
10813
  ];
10853
10814
  const FLOW_STEP_TYPES = ["prompt", ...CONTEXT_STEP_TYPES];
10854
- //#endregion
10855
- //#region ../shared/dist/durable-poll-limits.mjs
10815
+ // ../shared/dist/durable-poll-limits.mjs
10856
10816
  /**
10857
10817
  * Durable-poll budget limits shared between the api's Cloudflare Workflow poll loops and the author-time flow validator.
10858
10818
  * Cloudflare Workflows bounds an instance to 10,000 steps (paid plan); each poll attempt consumes up to TWO steps.
@@ -10944,8 +10904,7 @@ function durableCrawlBudget(plan) {
10944
10904
  worstCaseMs: Math.max(nominalBudgetMs, requestOverheadMs + sleepMs)
10945
10905
  };
10946
10906
  }
10947
- //#endregion
10948
- //#region ../shared/dist/chunk-jV5RTDSl.mjs
10907
+ // ../shared/dist/chunk-BQzmoulw.mjs
10949
10908
  const DEFAULT_EXTRACTION_MODEL = "@cf/cloudflare/clairic";
10950
10909
  const MIB = 1048576;
10951
10910
  const clairic = Object.freeze({
@@ -11093,16 +11052,14 @@ function validateExtractionFields(fields) {
11093
11052
  * fragments, and the agent-facing skill references.
11094
11053
  */
11095
11054
  const DISPATCH_TRANSIENT_SECRETS_RETIRED_NOTE = `Retired on BOTH dispatch targets. A NON-EMPTY map is rejected with 400: RUNTIME_AGENT_TRANSIENT_SECRETS_UNSUPPORTED on an agent dispatch, RUNTIME_FLOW_TRANSIENT_SECRETS_UNSUPPORTED on a flow dispatch (the flow target used to drop the map silently). An empty map is accepted and does nothing. Store credentials as managed secrets and reference them as {{secret:NAME}}. The field is kept on the wire for compatibility only.`;
11096
- //#endregion
11097
- //#region ../shared/dist/dispatch-timeout-limits.mjs
11055
+ // ../shared/dist/dispatch-timeout-limits.mjs
11098
11056
  /**
11099
11057
  * Continuous-run ceiling for a Flow detached through `Prefer: respond-async`.
11100
11058
  * Cloudflare Workflows caps an explicitly configured `step.do` timeout at the
11101
11059
  * same 30-minute boundary, and batch execution already exposes this budget.
11102
11060
  */
11103
11061
  const ASYNC_DISPATCH_TIMEOUT_MAX_MS = 18e5;
11104
- //#endregion
11105
- //#region ../shared/dist/container-sandbox-timeout.mjs
11062
+ // ../shared/dist/container-sandbox-timeout.mjs
11106
11063
  /**
11107
11064
  * The Cloudflare container instance type every Runtype sandbox provisions (a deployment fact, not a producer choice).
11108
11065
  * Carried on the exec RPC and sandbox_billing_sessions because the spend ledger's rate card keys by instance type.
@@ -11110,8 +11067,7 @@ const ASYNC_DISPATCH_TIMEOUT_MAX_MS = 18e5;
11110
11067
  * Pinned against wrangler config by apps/sandbox/tests/wrangler-instance-type-lockstep.test.ts.
11111
11068
  */
11112
11069
  const CONTAINER_SANDBOX_INSTANCE_TYPE = "standard-4";
11113
- //#endregion
11114
- //#region ../shared/dist/chunk-2GuzPgAk.mjs
11070
+ // ../shared/dist/chunk-DH-C5yxa.mjs
11115
11071
  /** The person a turn runs as: exposed to tools as `_endUser.*`, shards memory, and satisfies `end-user-isolated`. */
11116
11072
  const hostEndUserIdentitySchema = object({
11117
11073
  id: string().min(1),
@@ -11431,8 +11387,7 @@ object({
11431
11387
  expected: caseExpectedSchema.optional(),
11432
11388
  notes: string().optional()
11433
11389
  }).strict();
11434
- //#endregion
11435
- //#region ../shared/dist/tool-annotations.mjs
11390
+ // ../shared/dist/tool-annotations.mjs
11436
11391
  /** Advisory WebMCP and MCP metadata; never an authorization or replay-safety grant. */
11437
11392
  const ToolAnnotationsSchema = object({
11438
11393
  readOnlyHint: boolean().optional(),
@@ -11443,8 +11398,7 @@ const ToolAnnotationsSchema = object({
11443
11398
  openWorldHint: boolean().optional(),
11444
11399
  debugging: boolean().optional()
11445
11400
  });
11446
- //#endregion
11447
- //#region ../shared/dist/chunk-Cwt-3iUR.mjs
11401
+ // ../shared/dist/chunk-Rt9Q4CVj.mjs
11448
11402
  /**
11449
11403
  * Inline client-side tool executed on the dispatching client (browser/SDK), not on Runtype.
11450
11404
  * `origin: 'webmcp'` marks tools harvested from `document.modelContext` and requires a `webmcp:` name prefix.
@@ -11542,8 +11496,7 @@ object({
11542
11496
  externalId: string().min(1).max(500).optional().describe("The conversation id in the source system. Re-creating with the same system and externalId returns the existing conversation with imported: false instead of a duplicate."),
11543
11497
  importedAt: string().datetime({ offset: true }).optional()
11544
11498
  });
11545
- //#endregion
11546
- //#region ../shared/dist/chunk-DPqK6XE9.mjs
11499
+ // ../shared/dist/chunk--1WwmeLq.mjs
11547
11500
  const voiceInterruptionModeSchema = _enum([
11548
11501
  "none",
11549
11502
  "cancel",
@@ -21889,7 +21842,7 @@ const fpoTemplateVariableSchema = object({
21889
21842
  path: ["options"]
21890
21843
  });
21891
21844
  });
21892
- function isPlainObject$3(value) {
21845
+ function isPlainObject$4(value) {
21893
21846
  return typeof value === "object" && value !== null && !Array.isArray(value);
21894
21847
  }
21895
21848
  function valueAtPath(root, path) {
@@ -21921,7 +21874,7 @@ function isDeferredToResolution(issue, productObject, basePath = []) {
21921
21874
  /** Whether a template needs setup beyond its variables: declared or referenced secrets. */
21922
21875
  function declaresPendingSecrets(productObject) {
21923
21876
  if ((Array.isArray(productObject.tools) ? productObject.tools : []).some((tool) => {
21924
- const auth = isPlainObject$3(tool) && isPlainObject$3(tool.auth) ? tool.auth : void 0;
21877
+ const auth = isPlainObject$4(tool) && isPlainObject$4(tool.auth) ? tool.auth : void 0;
21925
21878
  return auth?.setupRequired === true && Array.isArray(auth.secrets) && auth.secrets.length > 0;
21926
21879
  })) return true;
21927
21880
  if (Array.isArray(productObject.secrets) && productObject.secrets.length > 0) return true;
@@ -21929,7 +21882,7 @@ function declaresPendingSecrets(productObject) {
21929
21882
  }
21930
21883
  const fullProductObjectTemplateSchema = object({
21931
21884
  version: _enum(["1.0", "1.1"]),
21932
- productObject: custom(isPlainObject$3, { message: "productObject must be a Full Product Object" }),
21885
+ productObject: custom(isPlainObject$4, { message: "productObject must be a Full Product Object" }),
21933
21886
  template: object({ variables: array(fpoTemplateVariableSchema).max(50) }),
21934
21887
  internalDocs: internalDocsSchema.optional()
21935
21888
  }).superRefine((doc, ctx) => {
@@ -22152,8 +22105,7 @@ function validateFPOTemplate(body, options = {}) {
22152
22105
  defaultsValidation
22153
22106
  };
22154
22107
  }
22155
- //#endregion
22156
- //#region ../shared/dist/chunk-DwruX1rx.mjs
22108
+ // ../shared/dist/chunk-BM6tsheI.mjs
22157
22109
  /**
22158
22110
  * A single RFC-6902 operation, JSON-shape so Zod-first per `.claude/rules/runtime.md`.
22159
22111
  * value/from are optional at the schema level rather than a discriminated union.
@@ -22179,8 +22131,7 @@ const jsonPatchOperationSchema = object({
22179
22131
  /** An RFC-6902 patch: an ordered, atomically-applied list of operations. */
22180
22132
  const jsonPatchSchema = array(jsonPatchOperationSchema);
22181
22133
  new Set(jsonPatchOperationSchema.shape.op.options);
22182
- //#endregion
22183
- //#region ../shared/dist/unified-terminal-outcome.mjs
22134
+ // ../shared/dist/unified-terminal-outcome.mjs
22184
22135
  /**
22185
22136
  * How a unified execution ended, carried as `outcome` on `execution_complete` and `execution_error`.
22186
22137
  * A pause is not an outcome: it ends the stream on `approval_start` / `await` with no terminal frame.
@@ -22190,8 +22141,7 @@ const UNIFIED_TERMINAL_OUTCOMES = [
22190
22141
  "error",
22191
22142
  "aborted"
22192
22143
  ];
22193
- //#endregion
22194
- //#region ../shared/dist/chunk-CAzK0R6E.mjs
22144
+ // ../shared/dist/chunk-mLybVlrx.mjs
22195
22145
  const tokensSchema$1 = object({
22196
22146
  input: number$1(),
22197
22147
  output: number$1()
@@ -22850,8 +22800,7 @@ const UNIFIED_SSE_EVENT_TYPES = _unifiedTuple([
22850
22800
  "ping",
22851
22801
  "custom"
22852
22802
  ]);
22853
- //#endregion
22854
- //#region ../shared/dist/chunk-LEMSxKn9.mjs
22803
+ // ../shared/dist/chunk-BH-i05S2.mjs
22855
22804
  /** {@link MediaContentPart} — mirror of the union in `../media-types`. */
22856
22805
  const mediaAnnotationsSchema = object({ audience: array(_enum(["user", "assistant"])).optional() });
22857
22806
  const mediaContentPartSchema = union([
@@ -23559,8 +23508,7 @@ discriminatedUnion("type", [
23559
23508
  }).passthrough()
23560
23509
  ]);
23561
23510
  new Set(UNIFIED_SSE_EVENT_TYPES);
23562
- //#endregion
23563
- //#region ../shared/dist/chunk-B4H63iE3.mjs
23511
+ // ../shared/dist/chunk-DoHuU_c7.mjs
23564
23512
  /** Types the extraction model answers. */
23565
23513
  const SIGNAL_EXTRACTION_TYPES = [
23566
23514
  "text",
@@ -23908,6 +23856,12 @@ object({
23908
23856
  agentExecutionRowId: string().nullable().describe("The agent_executions ROW id the scheduled run stored. Provenance only: a different id space from executionId, and never a /v1/runs key."),
23909
23857
  batchExecutionId: string().nullable().describe("The batch whose per-record runs are GET /v1/runs?batchExecutionId=.")
23910
23858
  });
23859
+ // ../shared/dist/chunk-COkqZIIU.mjs
23860
+ const HTTP_REASON_PHRASES = "bad request|unauthori[sz]ed|forbidden|not found|method not allowed|request timeout|conflict|gone|unprocessable entity|too many requests|internal server error|not implemented|bad gateway|service unavailable|gateway timeout";
23861
+ /** A bare status number ends the message, meets punctuation (not a `,000` digit group), or leads its reason phrase. */
23862
+ const STATUS_NUMBER_END = String.raw`(?=\s*$|[:;)\]]|[.,](?!\d)|\s*[:-]?\s*(?:${HTTP_REASON_PHRASES})\b)`;
23863
+ new RegExp(String.raw`\b(?:status(?:[ _]code)?|code|error|returned|responded(?: with)?|failed(?: with)?)[\s:=]*([45]\d{2})\b` + STATUS_NUMBER_END, "i");
23864
+ new RegExp(String.raw`(?<![$€£#.\d])\b([45]\d{2})\s*[:-]?\s*(?:${HTTP_REASON_PHRASES})\b`, "i");
23911
23865
  /**
23912
23866
  * The same attribute names, exported for readers of GenAI spans.
23913
23867
  * OTLP trace ingest reads back the identical vocabulary a customer's own SDK produced.
@@ -23932,8 +23886,7 @@ const GEN_AI_ATTRIBUTES = {
23932
23886
  toolType: "gen_ai.tool.type",
23933
23887
  toolCallId: "gen_ai.tool.call.id"
23934
23888
  };
23935
- //#endregion
23936
- //#region ../shared/dist/context-manifest-wire.mjs
23889
+ // ../shared/dist/context-manifest-wire.mjs
23937
23890
  const entryTupleSchema = union([tuple([
23938
23891
  string(),
23939
23892
  number$1().int(),
@@ -23973,8 +23926,7 @@ object({
23973
23926
  content: string(),
23974
23927
  truncated: boolean()
23975
23928
  });
23976
- //#endregion
23977
- //#region ../shared/dist/chunk-_ZhmfUpr.mjs
23929
+ // ../shared/dist/chunk-B0KsOsGW.mjs
23978
23930
  /**
23979
23931
  * GenAI semconv content attributes, set by a customer's own instrumentation when it opts into content export.
23980
23932
  * Two first-party producers write them: @runtypelabs/runtime's OTLP tracer for exported agents (content on by default), and @runtypelabs/flue-otel (opt-in).
@@ -24044,8 +23996,7 @@ const CLOUDFLARE_AGENTS_CONTENT_PREFIXES = ["cloudflare.agents.metadata.", "clou
24044
23996
  ];
24045
23997
  [...Object.values(GEN_AI_CONTENT_ATTRIBUTES), ...Object.values(GEN_AI_CONTENT_ATTRIBUTE_ALIASES).flat()];
24046
23998
  GEN_AI_ATTRIBUTES.responseModel;
24047
- //#endregion
24048
- //#region ../shared/dist/chunk-DKbPTNRC.mjs
23999
+ // ../shared/dist/chunk-MA677TZK.mjs
24049
24000
  /**
24050
24001
  * Regex-only HTML adapter for source-injection isolates, where DOMParser and
24051
24002
  * HTMLRewriter are unavailable. This function is intentionally self-contained
@@ -24392,8 +24343,7 @@ _enum([
24392
24343
  "cancelled",
24393
24344
  "interrupted"
24394
24345
  ]);
24395
- //#endregion
24396
- //#region ../shared/dist/chunk-B4rF4aQI.mjs
24346
+ // ../shared/dist/chunk-aheuzo9K.mjs
24397
24347
  /**
24398
24348
  * Maps model families to provider-specific model IDs.
24399
24349
  * Use for routing: family + provider → exact model ID
@@ -24718,8 +24668,6 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24718
24668
  "openai": "gpt-4.1-nano",
24719
24669
  "vercel": "openai/gpt-4.1-nano"
24720
24670
  },
24721
- "gpt-4-1-nano-batch": { "vercel": "openai/gpt-4.1-nano-batch" },
24722
- "gpt-4-1-nano-fast": { "vercel": "openai/gpt-4.1-nano-fast" },
24723
24671
  "gpt-4.1": {
24724
24672
  "openai": "gpt-4.1",
24725
24673
  "vercel": "openai/gpt-4.1"
@@ -24736,8 +24684,6 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24736
24684
  "openai": "gpt-4.1-nano",
24737
24685
  "vercel": "openai/gpt-4.1-nano"
24738
24686
  },
24739
- "gpt-4.1-nano-batch": { "vercel": "openai/gpt-4.1-nano-batch" },
24740
- "gpt-4.1-nano-fast": { "vercel": "openai/gpt-4.1-nano-fast" },
24741
24687
  "gpt-4o": {
24742
24688
  "openai": "gpt-4o",
24743
24689
  "vercel": "openai/gpt-4o"
@@ -24925,6 +24871,7 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24925
24871
  },
24926
24872
  "gpt-6-1-sol-batch": { "vercel": "openai/gpt-6.1-sol-batch" },
24927
24873
  "gpt-6-1-sol-fast": { "vercel": "openai/gpt-6.1-sol-fast" },
24874
+ "gpt-6-1-sol-ultrafast": { "openai": "gpt-6.1-sol-ultrafast" },
24928
24875
  "gpt-6-astra": {
24929
24876
  "openai": "gpt-6-astra",
24930
24877
  "vercel": "openai/gpt-6-astra"
@@ -24949,6 +24896,7 @@ const MODEL_FAMILY_PROVIDER_IDS = {
24949
24896
  },
24950
24897
  "gpt-6.1-sol-batch": { "vercel": "openai/gpt-6.1-sol-batch" },
24951
24898
  "gpt-6.1-sol-fast": { "vercel": "openai/gpt-6.1-sol-fast" },
24899
+ "gpt-6.1-sol-ultrafast": { "openai": "gpt-6.1-sol-ultrafast" },
24952
24900
  "gpt-image-1-5": { "openai": "gpt-image-1.5" },
24953
24901
  "gpt-image-1-mini": { "openai": "gpt-image-1-mini" },
24954
24902
  "gpt-image-1.5": { "openai": "gpt-image-1.5" },
@@ -25033,7 +24981,11 @@ const MODEL_FAMILY_PROVIDER_IDS = {
25033
24981
  "kimi-k2.7-code": { "vercel": "moonshotai/kimi-k2.7-code" },
25034
24982
  "kimi-k2.7-code-highspeed": { "vercel": "moonshotai/kimi-k2.7-code-highspeed" },
25035
24983
  "kimi-k3": { "vercel": "moonshotai/kimi-k3" },
24984
+ "kimi-k3-1-pro": { "vercel": "moonshotai/kimi-k3.1-pro" },
24985
+ "kimi-k3-1-pro-highspeed": { "vercel": "moonshotai/kimi-k3.1-pro-highspeed" },
25036
24986
  "kimi-k3-fast": { "vercel": "moonshotai/kimi-k3-fast" },
24987
+ "kimi-k3.1-pro": { "vercel": "moonshotai/kimi-k3.1-pro" },
24988
+ "kimi-k3.1-pro-highspeed": { "vercel": "moonshotai/kimi-k3.1-pro-highspeed" },
25037
24989
  "laguna-s-2-1": { "vercel": "poolside/laguna-s-2.1" },
25038
24990
  "laguna-s-2-1-free": { "vercel": "poolside/laguna-s-2.1-free" },
25039
24991
  "laguna-s-2.1": { "vercel": "poolside/laguna-s-2.1" },
@@ -25489,8 +25441,7 @@ const CREATOR_TO_PROVIDER = {
25489
25441
  "xiaomi": "vercel",
25490
25442
  "unknown": "openai"
25491
25443
  };
25492
- //#endregion
25493
- //#region ../shared/dist/chunk-56H9IdjP.mjs
25444
+ // ../shared/dist/chunk-DFt584Tt.mjs
25494
25445
  const DEFAULT_GENERIC_OPENAI_API_FORMAT = "chat-completions";
25495
25446
  /** Provider defaults shared by every execution engine and deploy guidance. */
25496
25447
  const DEFAULT_BEDROCK_REGION = "us-east-1";
@@ -25776,8 +25727,7 @@ MCPServerCategory.DEVELOPMENT;
25776
25727
  MCPServerCategory.COMMUNICATION;
25777
25728
  MCPServerCategory.COMMUNICATION;
25778
25729
  MCPServerCategory.PRODUCTIVITY;
25779
- //#endregion
25780
- //#region ../shared/dist/chunk-D_ntTgKu.mjs
25730
+ // ../shared/dist/chunk-DUhmP1k_.mjs
25781
25731
  /** The persona knob (DataMorgana pattern) — who is writing the input. */
25782
25732
  const EVAL_CASE_PERSONAS = [
25783
25733
  {
@@ -25848,8 +25798,7 @@ object({ verdicts: array(object({
25848
25798
  gradeable: boolean(),
25849
25799
  reason: string().optional()
25850
25800
  })) });
25851
- //#endregion
25852
- //#region ../shared/dist/chunk-CIi5jW2t.mjs
25801
+ // ../shared/dist/chunk-afupRRVE.mjs
25853
25802
  /**
25854
25803
  * Registry of all available brand configurations
25855
25804
  * Add new brand configs here when creating additional deployments
@@ -25917,8 +25866,7 @@ function loadBrandConfig(env) {
25917
25866
  }
25918
25867
  loadBrandConfig();
25919
25868
  BRAND_CONFIGS[DEFAULT_BRAND_NAME];
25920
- //#endregion
25921
- //#region ../shared/dist/chunk-CNTixTjk.mjs
25869
+ // ../shared/dist/chunk-CggV6srJ.mjs
25922
25870
  const ARCHITECTURE_PREVIEW_SURFACE_TYPES = [
25923
25871
  "chat",
25924
25872
  "api",
@@ -25937,8 +25885,7 @@ const ARCHITECTURE_PREVIEW_SURFACE_TYPES = [
25937
25885
  "messaging"
25938
25886
  ];
25939
25887
  new Set(ARCHITECTURE_PREVIEW_SURFACE_TYPES);
25940
- //#endregion
25941
- //#region ../shared/dist/chunk-CoMlpzHZ.mjs
25888
+ // ../shared/dist/chunk-D3z94Ai6.mjs
25942
25889
  const citedRunClaimSchema = object({
25943
25890
  text: string().min(1).max(700),
25944
25891
  eventIds: array(string().min(1).max(256)).min(1).max(4)
@@ -25963,8 +25910,7 @@ object({
25963
25910
  analysis: runAnalysisSchema
25964
25911
  })
25965
25912
  });
25966
- //#endregion
25967
- //#region ../shared/dist/managed-sandbox-provider-contract.mjs
25913
+ // ../shared/dist/managed-sandbox-provider-contract.mjs
25968
25914
  /**
25969
25915
  * Contract types for the hosted managed-sandbox provider boundary: the closed
25970
25916
  * capability vocabulary, the profile identity a capability claim is scoped to,
@@ -26070,8 +26016,7 @@ Object.freeze({
26070
26016
  deployment: "runtype.deployment",
26071
26017
  generation: "runtype.generation"
26072
26018
  });
26073
- //#endregion
26074
- //#region ../shared/dist/index.mjs
26019
+ // ../shared/dist/index.mjs
26075
26020
  /**
26076
26021
  * Neutralize spreadsheet formula injection (CSV injection).
26077
26022
  * A cell starting with `=+-@` or leading tab/CR/LF is treated as a formula by Excel/Sheets/LibreOffice; prefix a single quote to force text.
@@ -27431,6 +27376,7 @@ const PRODUCT_EVENT_NAMES = [
27431
27376
  "runtype.approval.requested",
27432
27377
  "runtype.schedule.run_failed",
27433
27378
  "runtype.eval.run_completed",
27379
+ "runtype.simulation.run_completed",
27434
27380
  "runtype.conversation.human_takeover",
27435
27381
  "runtype.skill.proposal_created",
27436
27382
  "runtype.task.input_required",
@@ -27456,6 +27402,7 @@ const ProductEventFilterFieldSchemas = {
27456
27402
  surfaceId: resourceId("Only occurrences on this surface"),
27457
27403
  scheduleId: resourceId("Only occurrences for this schedule"),
27458
27404
  suiteId: resourceId("Only occurrences for this eval suite"),
27405
+ simulationId: resourceId("Only occurrences for this simulation"),
27459
27406
  taskId: resourceId("Only occurrences for this delegated task"),
27460
27407
  key: string().min(1).max(64).describe("Only signal occurrences for this signal key, such as tool_error"),
27461
27408
  onlyRegressions: boolean().describe("Only eval runs whose pass rate dropped below the previous run"),
@@ -27481,6 +27428,10 @@ const EvalRunCompletedArgumentsSchema = object({
27481
27428
  suiteId: filter.suiteId.optional(),
27482
27429
  onlyRegressions: filter.onlyRegressions.optional()
27483
27430
  }).strict();
27431
+ const SimulationRunCompletedArgumentsSchema = object({
27432
+ simulationId: filter.simulationId.optional(),
27433
+ productId: filter.productId.optional()
27434
+ }).strict();
27484
27435
  const ConversationHumanTakeoverArgumentsSchema = object({
27485
27436
  surfaceId: filter.surfaceId.optional(),
27486
27437
  productId: filter.productId.optional()
@@ -27503,6 +27454,7 @@ object({
27503
27454
  surfaceId: filter.surfaceId.optional(),
27504
27455
  scheduleId: filter.scheduleId.optional(),
27505
27456
  suiteId: filter.suiteId.optional(),
27457
+ simulationId: filter.simulationId.optional(),
27506
27458
  taskId: filter.taskId.optional(),
27507
27459
  key: filter.key.optional(),
27508
27460
  onlyRegressions: filter.onlyRegressions.optional(),
@@ -27546,6 +27498,23 @@ const EvalRunCompletedPayloadSchema = object({
27546
27498
  regressed: boolean().describe("True when passRate is below previousPassRate"),
27547
27499
  completedAt: isoTimestamp("When the run finished")
27548
27500
  });
27501
+ const SimulationRunCompletedPayloadSchema = object({
27502
+ runId: resourceId("The simulation run"),
27503
+ simulationId: resourceId("The simulation"),
27504
+ productId: resourceId("Product the simulation belongs to").optional(),
27505
+ status: _enum([
27506
+ "completed",
27507
+ "failed",
27508
+ "cancelled",
27509
+ "budget_exhausted"
27510
+ ]).describe("Terminal status of the run; budget_exhausted stopped at its spend cap"),
27511
+ episodesPlanned: number$1().int().min(0).describe("Episodes the run planned"),
27512
+ episodesCompleted: number$1().int().min(0).describe("Episodes that completed"),
27513
+ episodesFailed: number$1().int().min(0).describe("Episodes that failed"),
27514
+ spentUsd: number$1().min(0).describe("Spend the run recorded, in USD"),
27515
+ errorMessage: errorMessage$2.optional(),
27516
+ completedAt: isoTimestamp("When the run finished")
27517
+ });
27549
27518
  const ConversationHumanTakeoverPayloadSchema = object({
27550
27519
  conversationId: resourceId("The conversation a human took over"),
27551
27520
  surfaceId: resourceId("Surface the conversation is on").optional(),
@@ -27611,6 +27580,7 @@ const PRODUCT_EVENT_ARGUMENT_SCHEMAS = {
27611
27580
  "runtype.approval.requested": ApprovalRequestedArgumentsSchema,
27612
27581
  "runtype.schedule.run_failed": ScheduleRunFailedArgumentsSchema,
27613
27582
  "runtype.eval.run_completed": EvalRunCompletedArgumentsSchema,
27583
+ "runtype.simulation.run_completed": SimulationRunCompletedArgumentsSchema,
27614
27584
  "runtype.conversation.human_takeover": ConversationHumanTakeoverArgumentsSchema,
27615
27585
  "runtype.skill.proposal_created": SkillProposalCreatedArgumentsSchema,
27616
27586
  "runtype.task.input_required": DelegateTaskArgumentsSchema,
@@ -27625,6 +27595,7 @@ const PRODUCT_EVENT_PAYLOAD_SCHEMAS = {
27625
27595
  "runtype.approval.requested": ApprovalRequestedPayloadSchema,
27626
27596
  "runtype.schedule.run_failed": ScheduleRunFailedPayloadSchema,
27627
27597
  "runtype.eval.run_completed": EvalRunCompletedPayloadSchema,
27598
+ "runtype.simulation.run_completed": SimulationRunCompletedPayloadSchema,
27628
27599
  "runtype.conversation.human_takeover": ConversationHumanTakeoverPayloadSchema,
27629
27600
  "runtype.skill.proposal_created": SkillProposalCreatedPayloadSchema,
27630
27601
  "runtype.task.input_required": TaskInputRequiredPayloadSchema,
@@ -27639,6 +27610,7 @@ const PRODUCT_EVENT_DESCRIPTIONS = {
27639
27610
  "runtype.approval.requested": "An agent paused for a human to approve a tool call.",
27640
27611
  "runtype.schedule.run_failed": "A scheduled run of a flow or agent failed.",
27641
27612
  "runtype.eval.run_completed": "An eval suite run finished; `regressed` is true when its pass rate dropped.",
27613
+ "runtype.simulation.run_completed": "A simulation run reached a terminal status: completed, failed, cancelled or budget_exhausted. Read its report with get_simulation_report.",
27642
27614
  "runtype.conversation.human_takeover": "A human took over a messaging conversation from the agent.",
27643
27615
  "runtype.skill.proposal_created": "A deployed agent proposed a skill that is waiting for review.",
27644
27616
  "runtype.task.input_required": "A delegated task stopped to ask a question; answer it by calling delegate_to_runtype with its task id.",
@@ -27654,6 +27626,11 @@ const PRODUCT_EVENT_REQUIRED_SCOPES = {
27654
27626
  "runtype.approval.requested": ["AGENTS:READ"],
27655
27627
  "runtype.schedule.run_failed": ["SCHEDULES:READ"],
27656
27628
  "runtype.eval.run_completed": ["EVALS:READ"],
27629
+ "runtype.simulation.run_completed": [
27630
+ "SIMULATIONS:READ",
27631
+ "SIMULATIONS:WRITE",
27632
+ "SIMULATIONS:RUN"
27633
+ ],
27657
27634
  "runtype.conversation.human_takeover": ["MESSAGING:READ"],
27658
27635
  "runtype.skill.proposal_created": ["SKILLS:READ"],
27659
27636
  "runtype.task.input_required": ["DELEGATE_TASKS:READ", "DELEGATE_TASKS:WRITE"],
@@ -28883,8 +28860,17 @@ object({
28883
28860
  byFlowSurface: record(string(), runStatsBucketSchema).describe("Runs grouped by flow and surface, keyed `<flowId>:<surfaceId>`."),
28884
28861
  byAgentSurface: record(string(), runStatsBucketSchema).describe("Runs grouped by agent and surface, keyed `<agentId>:<surfaceId>`.")
28885
28862
  });
28886
- //#endregion
28887
- //#region src/config/paths.ts
28863
+ runListQuerySchema.pick({
28864
+ traffic: true,
28865
+ from: true,
28866
+ to: true
28867
+ }).extend({ productIds: string().describe(`Comma-separated product ids, at most 100. A product the caller does not own is left out of the answer.`) });
28868
+ const runProductStatsBucketSchema = object({
28869
+ total: count("Runs of the product's flows plus runs of its agents."),
28870
+ failed: count("Of those, the runs that read as failed in `/v1/runs` (the same predicate as `status=failed`).")
28871
+ });
28872
+ object({ byProductId: record(string(), runProductStatsBucketSchema).describe("One entry per named product the caller owns, a product with no flow or agent reading zero. Each sums `/v1/runs/stats` for its flows and for its agents, read one family at a time.") });
28873
+ // src/config/paths.ts
28888
28874
  /** Root state directory: RUNTYPE_STATE_DIR or ~/.runtype */
28889
28875
  function getRuntypeHomeDir() {
28890
28876
  return process.env.RUNTYPE_STATE_DIR || path$2.join(os$1.homedir(), ".runtype");
@@ -28905,8 +28891,7 @@ function getProjectStateDir(projectDir) {
28905
28891
  function getMarathonStateDir(projectDir) {
28906
28892
  return path$2.join(getProjectStateDir(projectDir), "marathons");
28907
28893
  }
28908
- //#endregion
28909
- //#region src/auth/secret-backend.ts
28894
+ // src/auth/secret-backend.ts
28910
28895
  const KEYCHAIN_SERVICE = "runtype-cli";
28911
28896
  let keyringModule;
28912
28897
  /** Load the native keyring binding lazily; a missing prebuilt binary means "no keychain", not a crash. */
@@ -29003,8 +28988,7 @@ function getSecretStorePreference() {
29003
28988
  const value = process.env.RUNTYPE_CREDENTIAL_STORE?.trim().toLowerCase();
29004
28989
  return value === "file" || value === "keychain" ? value : "auto";
29005
28990
  }
29006
- //#endregion
29007
- //#region src/auth/account-store.ts
28991
+ // src/auth/account-store.ts
29008
28992
  const LAST_USED_RESOLUTION_MS = 6e4;
29009
28993
  /** Canonical API base used for account identity; mirrors normalizeApiUrl for valid URLs. */
29010
28994
  function canonicalApiUrl(value) {
@@ -29327,8 +29311,7 @@ var AccountStore = class {
29327
29311
  writePrivateJsonFile(this.filePath, data);
29328
29312
  }
29329
29313
  };
29330
- //#endregion
29331
- //#region src/auth/credential-store.ts
29314
+ // src/auth/credential-store.ts
29332
29315
  var credential_store_exports = /* @__PURE__ */ __exportAll({ CredentialStore: () => CredentialStore });
29333
29316
  /**
29334
29317
  * Credential access for CLI commands. "Active" methods act on the login this invocation
@@ -29468,8 +29451,7 @@ var CredentialStore = class {
29468
29451
  return (await this.accounts.list()).filter((account) => account.claim).sort((a, b) => b.createdAt.localeCompare(a.createdAt))[0] ?? null;
29469
29452
  }
29470
29453
  };
29471
- //#endregion
29472
- //#region src/config/project-link.ts
29454
+ // src/config/project-link.ts
29473
29455
  const PROJECT_LINK_DIR = ".runtype";
29474
29456
  const PROJECT_LINK_FILENAME = "project.json";
29475
29457
  var ProjectLinkError = class extends Error {
@@ -29558,8 +29540,7 @@ function removeProjectLink(directory) {
29558
29540
  } catch {}
29559
29541
  return true;
29560
29542
  }
29561
- //#endregion
29562
- //#region src/config/effective-context.ts
29543
+ // src/config/effective-context.ts
29563
29544
  var CliContextError = class extends Error {
29564
29545
  code;
29565
29546
  constructor(message, code = "INVALID_INPUT") {
@@ -29744,8 +29725,7 @@ function redactEffectiveContext(context) {
29744
29725
  projectLink: context.projectLink?.path ?? null
29745
29726
  };
29746
29727
  }
29747
- //#endregion
29748
- //#region src/config/env.ts
29728
+ // src/config/env.ts
29749
29729
  function getApiUrl() {
29750
29730
  return getEffectiveApiUrl();
29751
29731
  }
@@ -29764,8 +29744,7 @@ function getRuntimeApiKey() {
29764
29744
  function getDevPlanOverride() {
29765
29745
  return process.env.RUNTYPE_DEV_PLAN_OVERRIDE;
29766
29746
  }
29767
- //#endregion
29768
- //#region src/lib/cli-version.ts
29747
+ // src/lib/cli-version.ts
29769
29748
  const CLI_PACKAGE_NAME = "@runtypelabs/cli";
29770
29749
  let cachedCliVersion = null;
29771
29750
  /** Read the published package version from package.json so runtime and npm stay aligned. */
@@ -29783,8 +29762,7 @@ function getCliVersion() {
29783
29762
  cachedCliVersion = "0.0.0";
29784
29763
  return cachedCliVersion;
29785
29764
  }
29786
- //#endregion
29787
- //#region src/lib/sdk-client.ts
29765
+ // src/lib/sdk-client.ts
29788
29766
  /**
29789
29767
  * Construct the SDK client used by every CLI command for API access.
29790
29768
  * The SDK is the single source of truth for the API surface; do NOT reintroduce raw fetch (enforced by `runtype/cli-use-sdk`).
@@ -29807,8 +29785,7 @@ function createCliClient(apiKey, baseUrl) {
29807
29785
  }
29808
29786
  });
29809
29787
  }
29810
- //#endregion
29811
- //#region src/auth/api-key-manager.ts
29788
+ // src/auth/api-key-manager.ts
29812
29789
  const isCliTokenResponse = (value) => {
29813
29790
  if (!value || typeof value !== "object") return false;
29814
29791
  const record = value;
@@ -29902,8 +29879,7 @@ var ApiKeyManager = class {
29902
29879
  return data;
29903
29880
  }
29904
29881
  };
29905
- //#endregion
29906
- //#region src/auth/callback-server.ts
29882
+ // src/auth/callback-server.ts
29907
29883
  var CallbackServer = class {
29908
29884
  server = null;
29909
29885
  app;
@@ -30230,8 +30206,7 @@ var CallbackServer = class {
30230
30206
  `;
30231
30207
  }
30232
30208
  };
30233
- //#endregion
30234
- //#region src/auth/oauth-manager.ts
30209
+ // src/auth/oauth-manager.ts
30235
30210
  var OAuthManager = class {
30236
30211
  clerkPublishableKey;
30237
30212
  dashboardUrl;
@@ -30276,8 +30251,7 @@ var OAuthManager = class {
30276
30251
  return code;
30277
30252
  }
30278
30253
  };
30279
- //#endregion
30280
- //#region src/auth/login-flow.ts
30254
+ // src/auth/login-flow.ts
30281
30255
  var InvalidApiKeyError = class extends Error {
30282
30256
  constructor() {
30283
30257
  super("Invalid API key");
@@ -30333,8 +30307,7 @@ function orgMismatchWarning(login) {
30333
30307
  if (!login.requestedOrgId || login.requestedOrgId === login.orgId) return null;
30334
30308
  return `Logged in to ${login.orgId ?? "a personal account"}, but this invocation targets ${login.requestedOrgId}. Commands here will keep asking for a login to ${login.requestedOrgId}; run "runtype login" again and pick that organization, or update the link with "runtype link ${login.orgId ?? ""}".`;
30335
30309
  }
30336
- //#endregion
30337
- //#region src/lib/ensure-auth.ts
30310
+ // src/lib/ensure-auth.ts
30338
30311
  const verifiedUsers = /* @__PURE__ */ new WeakMap();
30339
30312
  async function getAuthenticatedUser() {
30340
30313
  const context = await loadEffectiveContext();
@@ -30453,8 +30426,7 @@ async function handleBrowserLogin(apiUrl) {
30453
30426
  return null;
30454
30427
  }
30455
30428
  }
30456
- //#endregion
30457
- //#region src/lib/output.ts
30429
+ // src/lib/output.ts
30458
30430
  /**
30459
30431
  * Print data as formatted JSON.
30460
30432
  */
@@ -30532,8 +30504,7 @@ function printNextCursorHint(commandPath, pagination) {
30532
30504
  if (!hasMore || !nextCursor) return;
30533
30505
  console.log(chalk.yellow("\n More results available — fetch the next page with:") + chalk.dim(`\n ${commandPath} --cursor ${nextCursor}`));
30534
30506
  }
30535
- //#endregion
30536
- //#region src/commands/sandbox-deployments.ts
30507
+ // src/commands/sandbox-deployments.ts
30537
30508
  const sandboxDeploymentsCommand = new Command("sandbox-deployments").description("Author managed deployments using retained runtime profiles and uploaded source IDs");
30538
30509
  async function run$2(action) {
30539
30510
  try {
@@ -30560,8 +30531,7 @@ sandboxDeploymentsCommand.command("update <id>").description("Replace the comple
30560
30531
  ifMatch: options.ifMatch
30561
30532
  });
30562
30533
  }));
30563
- //#endregion
30564
- //#region src/lib/load-env.ts
30534
+ // src/lib/load-env.ts
30565
30535
  function loadEnv(path = resolve(process.cwd(), ".env")) {
30566
30536
  try {
30567
30537
  const content = readFileSync(path, "utf8").replace(/\r\n?/g, "\n");
@@ -30575,8 +30545,7 @@ function loadEnv(path = resolve(process.cwd(), ".env")) {
30575
30545
  }
30576
30546
  } catch {}
30577
30547
  }
30578
- //#endregion
30579
- //#region src/ink/shared/isTTY.ts
30548
+ // src/ink/shared/isTTY.ts
30580
30549
  /**
30581
30550
  * Determine whether the current environment supports TTY (Ink rendering).
30582
30551
  * Respects explicit --tty / --no-tty flags, falling back to process.stdout.isTTY.
@@ -30586,8 +30555,7 @@ function isTTY(options) {
30586
30555
  if (options.tty) return true;
30587
30556
  return process.stdout.isTTY === true;
30588
30557
  }
30589
- //#endregion
30590
- //#region src/ink/shared/altScreen.ts
30558
+ // src/ink/shared/altScreen.ts
30591
30559
  /**
30592
30560
  * Enter the terminal's alternate screen buffer for fullscreen TUI apps.
30593
30561
  * Fullscreen apps use the alternate screen so rendering doesn't pollute scrollback history.
@@ -30607,8 +30575,7 @@ function enterAltScreen() {
30607
30575
  process.on("exit", restore);
30608
30576
  return restore;
30609
30577
  }
30610
- //#endregion
30611
- //#region src/ink/shared/EntityCard.tsx
30578
+ // src/ink/shared/EntityCard.tsx
30612
30579
  function EntityCard({ fields, title }) {
30613
30580
  const visibleFields = fields.filter((f) => f.value !== null && f.value !== void 0);
30614
30581
  return /* @__PURE__ */ jsxs(Box, {
@@ -30632,8 +30599,7 @@ function EntityCard({ fields, title }) {
30632
30599
  ] }, index))]
30633
30600
  });
30634
30601
  }
30635
- //#endregion
30636
- //#region src/ink/shared/ConfirmPrompt.tsx
30602
+ // src/ink/shared/ConfirmPrompt.tsx
30637
30603
  function ConfirmPrompt({ message, defaultValue = false, onConfirm }) {
30638
30604
  const [answered, setAnswered] = useState(false);
30639
30605
  const [result, setResult] = useState(null);
@@ -30676,8 +30642,7 @@ function ConfirmPrompt({ message, defaultValue = false, onConfirm }) {
30676
30642
  })
30677
30643
  ] });
30678
30644
  }
30679
- //#endregion
30680
- //#region src/ink/shared/DataList.tsx
30645
+ // src/ink/shared/DataList.tsx
30681
30646
  function DataList({ title, items, error, loading, renderCard, emptyMessage = "None found", total, onRetry, onDone }) {
30682
30647
  const { exit } = useApp();
30683
30648
  const hasDone = useRef(false);
@@ -30739,8 +30704,7 @@ function DataList({ title, items, error, loading, renderCard, emptyMessage = "No
30739
30704
  ]
30740
30705
  });
30741
30706
  }
30742
- //#endregion
30743
- //#region src/ink/shared/MutationResult.tsx
30707
+ // src/ink/shared/MutationResult.tsx
30744
30708
  function MutationResult({ loading, loadingLabel = "Processing...", success, successMessage, result, error, onRetry, onDone }) {
30745
30709
  const { exit } = useApp();
30746
30710
  const hasDone = useRef(false);
@@ -30797,8 +30761,7 @@ function MutationResult({ loading, loadingLabel = "Processing...", success, succ
30797
30761
  });
30798
30762
  return null;
30799
30763
  }
30800
- //#endregion
30801
- //#region src/ink/shared/account-picker.ts
30764
+ // src/ink/shared/account-picker.ts
30802
30765
  /** Interactive picker over stored logins; resolves undefined if the user exits without choosing. */
30803
30766
  async function promptForAccount(accounts) {
30804
30767
  let chosen;
@@ -30816,8 +30779,7 @@ async function promptForAccount(accounts) {
30816
30779
  await waitUntilExit();
30817
30780
  return chosen;
30818
30781
  }
30819
- //#endregion
30820
- //#region src/auth/agent-auth-client.ts
30782
+ // src/auth/agent-auth-client.ts
30821
30783
  /**
30822
30784
  * Protocol error with the spec error code and an agent-actionable hint.
30823
30785
  * `hint` is safe to surface verbatim in JSON output as the next step.
@@ -30926,8 +30888,7 @@ async function completeClaim(claimToken, otp, apiUrl) {
30926
30888
  scopes: stringArray(data.scopes)
30927
30889
  };
30928
30890
  }
30929
- //#endregion
30930
- //#region src/commands/auth-agent.ts
30891
+ // src/commands/auth-agent.ts
30931
30892
  const VERIFY_NEXT = "Ask the user for the 6-digit code from their email, then run: runtype auth verify <code>";
30932
30893
  function claimNext(email) {
30933
30894
  return email ? `Send the verification email with: runtype auth claim ${email}` : "Ask the user for their email address, then run: runtype auth claim <email>";
@@ -31123,8 +31084,7 @@ function registerAgentAuthCommands(authCommand) {
31123
31084
  authCommand.command("claim <email>").description("Email the user a 6-digit code to attach the account to them").option("--api-url <url>", "Custom API URL").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(claimAction);
31124
31085
  authCommand.command("verify <code>").description("Complete signup with the 6-digit code from the verification email (step 2 of 2)").option("--api-url <url>", "Custom API URL").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(verifyAction);
31125
31086
  }
31126
- //#endregion
31127
- //#region src/commands/auth.ts
31087
+ // src/commands/auth.ts
31128
31088
  const authCommand = new Command("auth").description("Manage authentication");
31129
31089
  const NON_TTY_LOGIN_GUIDANCE = {
31130
31090
  status: "error",
@@ -31646,8 +31606,7 @@ authCommand.command("whoami").description("Display current user information").op
31646
31606
  };
31647
31607
  });
31648
31608
  });
31649
- //#endregion
31650
- //#region src/commands/link.ts
31609
+ // src/commands/link.ts
31651
31610
  const PRODUCTION_API_URL = "https://api.runtype.com";
31652
31611
  async function chooseOrganization(orgArgument, options) {
31653
31612
  if (orgArgument) return { orgId: orgArgument };
@@ -31735,8 +31694,7 @@ const unlinkCommand = new Command("unlink").description("Remove the nearest .run
31735
31694
  }
31736
31695
  console.log(removedPath ? chalk.green(`Removed ${removedPath}. Commands here now use the default login.`) : chalk.yellow("No .runtype/project.json found in this directory or its parents."));
31737
31696
  });
31738
- //#endregion
31739
- //#region src/lib/file-utils.ts
31697
+ // src/lib/file-utils.ts
31740
31698
  /** Parse a string as a JSON object, exiting with a clear error on failure. */
31741
31699
  function parseJsonObject$1(raw, label) {
31742
31700
  let parsed;
@@ -31794,8 +31752,7 @@ function resolveJsonPayload(inline, fromFile, label) {
31794
31752
  if (fromFile !== void 0) return readJsonFile(fromFile, { label });
31795
31753
  return parseJsonObject$1(inline, label);
31796
31754
  }
31797
- //#endregion
31798
- //#region src/lib/ensure-output.ts
31755
+ // src/lib/ensure-output.ts
31799
31756
  /**
31800
31757
  * Emit a pulled definition as JSON: to `out` when given, otherwise to stdout so
31801
31758
  * `runtype <entity> pull <name> > file.json` works. Hash and warnings go to stderr.
@@ -31809,8 +31766,7 @@ function writePulledDefinition(data, meta) {
31809
31766
  if (meta.contentHash) console.error(chalk.gray(`contentHash ${meta.contentHash}`));
31810
31767
  for (const warning of meta.warnings ?? []) console.error(chalk.yellow(`warning: ${warning}`));
31811
31768
  }
31812
- //#endregion
31813
- //#region src/commands/entity-ensure.ts
31769
+ // src/commands/entity-ensure.ts
31814
31770
  function namespaceTransport(client) {
31815
31771
  const transport = {
31816
31772
  get: (path, params) => client.get(path, params),
@@ -32072,8 +32028,7 @@ const clientTokenEnsureCommand = new Command("ensure").description("Converge a c
32072
32028
  fail$4("Failed to converge the client token", error);
32073
32029
  }
32074
32030
  });
32075
- //#endregion
32076
- //#region src/lib/execution-input.ts
32031
+ // src/lib/execution-input.ts
32077
32032
  function addExecutionInputOptions(command) {
32078
32033
  return command.option("--inputs <json>", "Typed input variables as a JSON object").option("--inputs-file <file|->", "Read input variables from a JSON object file or stdin").option("-v, --variable <key=value>", "Set a string variable (repeatable)", collectVariables, []).option("--messages-file <file|->", "Read structured messages from a JSON array file or stdin");
32079
32034
  }
@@ -32180,8 +32135,7 @@ function resolveExecutionInput(options, agent = false) {
32180
32135
  ...record ? { record } : {}
32181
32136
  };
32182
32137
  }
32183
- //#endregion
32184
- //#region src/lib/execution-output.ts
32138
+ // src/lib/execution-output.ts
32185
32139
  function asObject(value) {
32186
32140
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
32187
32141
  }
@@ -32388,8 +32342,7 @@ async function runExecution(options, build, execute, label, renderResult) {
32388
32342
  else console.error(chalk.red(String(result.error.message)));
32389
32343
  }
32390
32344
  }
32391
- //#endregion
32392
- //#region src/commands/flows.ts
32345
+ // src/commands/flows.ts
32393
32346
  /** Build the typed list params the SDK endpoint expects from the CLI's string flags. */
32394
32347
  function flowsListParams(options) {
32395
32348
  return {
@@ -32725,8 +32678,7 @@ flowsCommand.command("delete <id>").description("Delete a flow").option("--tty",
32725
32678
  const { waitUntilExit } = render(React.createElement(App));
32726
32679
  await waitUntilExit();
32727
32680
  });
32728
- //#endregion
32729
- //#region src/lib/terminal-image.ts
32681
+ // src/lib/terminal-image.ts
32730
32682
  const ESC = "\x1B";
32731
32683
  const BEL = "\x07";
32732
32684
  const ST = `${ESC}\\`;
@@ -32801,8 +32753,7 @@ function renderInlineImage(value, protocol) {
32801
32753
  protocol
32802
32754
  });
32803
32755
  }
32804
- //#endregion
32805
- //#region src/lib/message-content.ts
32756
+ // src/lib/message-content.ts
32806
32757
  /**
32807
32758
  * Render a message's `content` to a single human-readable line for the CLI.
32808
32759
  * A plain string passes through; an array of parts renders text inline and collapses media parts to compact markers.
@@ -32852,8 +32803,7 @@ function renderMessageContentWithImages(content, protocol) {
32852
32803
  images
32853
32804
  };
32854
32805
  }
32855
- //#endregion
32856
- //#region src/commands/records.ts
32806
+ // src/commands/records.ts
32857
32807
  /**
32858
32808
  * Resolve the owner-key intent of a `records update` invocation into the body field the API expects.
32859
32809
  * `--owner-id` reassigns the owner; `--clear-owner` sends an explicit `null`; omitting both leaves the stored owner untouched.
@@ -33614,8 +33564,7 @@ function csvEscape(value) {
33614
33564
  if (text.includes(",") || text.includes("\"") || text.includes("\n")) return `"${text.replace(/"/g, "\"\"")}"`;
33615
33565
  return text;
33616
33566
  }
33617
- //#endregion
33618
- //#region src/commands/collections.ts
33567
+ // src/commands/collections.ts
33619
33568
  /**
33620
33569
  * Record collections: a collection registers a record type (slug =
33621
33570
  * records.type) and optionally owns a metadata schema, validated at every
@@ -34022,8 +33971,7 @@ collectionsCommand.command("validate <slug>").description("Dry-run existing reco
34022
33971
  process.exit(1);
34023
33972
  }
34024
33973
  });
34025
- //#endregion
34026
- //#region src/commands/prompts.ts
33974
+ // src/commands/prompts.ts
34027
33975
  const promptsCommand = new Command("prompts").description("Manage prompts");
34028
33976
  promptsCommand.command("list").description("List all prompts").option("--limit <n>", "Limit results (defaults to the API page size)").option("--cursor <cursor>", "Pagination cursor for the next page").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
34029
33977
  const apiKey = await ensureAuth();
@@ -34451,8 +34399,7 @@ promptsCommand.command("delete <id>").description("Delete a prompt").option("--t
34451
34399
  const { waitUntilExit } = render(React.createElement(runDelete()));
34452
34400
  await waitUntilExit();
34453
34401
  });
34454
- //#endregion
34455
- //#region src/lib/wait-for-status.ts
34402
+ // src/lib/wait-for-status.ts
34456
34403
  const MAX_WAIT_DURATION_MS = 2147483647;
34457
34404
  /** Poll read-only status until terminal, timeout, or caller abort; never cancel the remote task. */
34458
34405
  async function waitForStatus(options) {
@@ -34499,8 +34446,7 @@ async function waitForStatus(options) {
34499
34446
  controller.abort();
34500
34447
  }
34501
34448
  }
34502
- //#endregion
34503
- //#region src/commands/batch.ts
34449
+ // src/commands/batch.ts
34504
34450
  function parseWatchDuration(value) {
34505
34451
  const duration = Number(value);
34506
34452
  if (!/^\d+$/.test(value) || !Number.isInteger(duration) || duration <= 0 || duration > 2147483647) throw new InvalidArgumentError(`Expected an integer between 1 and ${MAX_WAIT_DURATION_MS} ms`);
@@ -34978,8 +34924,7 @@ batchCommand.command("cost <id>").description("Show the total cost of a batch jo
34978
34924
  const { waitUntilExit } = render(React.createElement(App));
34979
34925
  await waitUntilExit();
34980
34926
  });
34981
- //#endregion
34982
- //#region src/commands/config.ts
34927
+ // src/commands/config.ts
34983
34928
  const CLI_CONFIG_KEYS = [
34984
34929
  "apiUrl",
34985
34930
  "defaultModel",
@@ -35070,8 +35015,7 @@ configCommand.command("reset").description("Reset all configuration to defaults"
35070
35015
  configCommand.command("path").description("Show configuration file path").action(() => {
35071
35016
  console.log(getCliConfig().path);
35072
35017
  });
35073
- //#endregion
35074
- //#region src/commands/secrets.ts
35018
+ // src/commands/secrets.ts
35075
35019
  /**
35076
35020
  * Read a secret value from stdin without echoing it back. Used when `--value`
35077
35021
  * is not supplied so the value never appears in shell history or terminal
@@ -35589,8 +35533,7 @@ secretsCommand.command("check <keys...>").description("Check which secret keys e
35589
35533
  const { waitUntilExit } = render(React.createElement(App));
35590
35534
  await waitUntilExit();
35591
35535
  });
35592
- //#endregion
35593
- //#region src/commands/tools.ts
35536
+ // src/commands/tools.ts
35594
35537
  function buildToolRunBody(options) {
35595
35538
  const parameters = resolveJsonPayload(options.input, options.fromFile, "input parameters");
35596
35539
  const toolConfig = options.config !== void 0 || options.configFile !== void 0 ? resolveJsonPayload(options.config, options.configFile, "tool config") : void 0;
@@ -36201,8 +36144,7 @@ toolsCommand.command("test <id>").description("Test a tool with sample input par
36201
36144
  const { waitUntilExit } = render(React.createElement(App));
36202
36145
  await waitUntilExit();
36203
36146
  });
36204
- //#endregion
36205
- //#region src/commands/integrations.ts
36147
+ // src/commands/integrations.ts
36206
36148
  const integrationsCommand = new Command("integrations").description("View built-in integrations (Slack, Google, Linear, GitHub, and more)");
36207
36149
  integrationsCommand.command("list").description("List all available integrations").option("--environment <env>", "Filter credential status by environment: development or production").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
36208
36150
  const apiKey = await ensureAuth();
@@ -36404,8 +36346,7 @@ integrationsCommand.command("get <id>").description("Get integration details, in
36404
36346
  const { waitUntilExit } = render(React.createElement(App));
36405
36347
  await waitUntilExit();
36406
36348
  });
36407
- //#endregion
36408
- //#region src/commands/surfaces.ts
36349
+ // src/commands/surfaces.ts
36409
36350
  const DELIVERY_ID_PATTERN = /^[A-Za-z0-9._:-]{1,128}$/;
36410
36351
  async function readStdin$2() {
36411
36352
  let value = "";
@@ -36710,8 +36651,7 @@ surfacesCommand.command("test <id>").description("Send a provider fixture throug
36710
36651
  process.exitCode = 1;
36711
36652
  }
36712
36653
  });
36713
- //#endregion
36714
- //#region src/commands/logs.ts
36654
+ // src/commands/logs.ts
36715
36655
  /** The API's own sentence for a store refusal; both log commands answer on it. */
36716
36656
  const STORE_UNAVAILABLE_MESSAGE = "Log store temporarily unavailable";
36717
36657
  /**
@@ -37000,8 +36940,7 @@ logsCommand.command("stats").description("Aggregate log stats: totals, counts by
37000
36940
  const { waitUntilExit } = render(React.createElement(App));
37001
36941
  await waitUntilExit();
37002
36942
  });
37003
- //#endregion
37004
- //#region src/commands/signals.ts
36943
+ // src/commands/signals.ts
37005
36944
  const signalsCommand = new Command("signals").description("Configure trace signals: typed fields read out of every bound agent turn");
37006
36945
  async function run$1(action) {
37007
36946
  try {
@@ -37030,6 +36969,7 @@ signalsCommand.command("create <name>").description("Create a signal set from a
37030
36969
  ...options.file ? { definition: await readDefinition(options.file) } : {}
37031
36970
  })));
37032
36971
  signalsCommand.command("update <signalSetId>").description("Rename or re-describe a signal set").option("--name <name>", "New name").option("--description <text>", "New description").action((id, options) => run$1((client) => client.signals.updateSet(id, options)));
36972
+ signalsCommand.command("delete <signalSetId>").description("Delete a signal set; unbind every binding of it first").action((id) => run$1((client) => client.signals.deleteSet(id)));
37033
36973
  signalsCommand.command("publish <signalSetId>").description("Publish a new immutable version from a definition file and make it current").requiredOption("-f, --file <path>", "JSON definition").action((id, options) => run$1(async (client) => client.signals.publishVersion(id, await readDefinition(options.file))));
37034
36974
  signalsCommand.command("preview <signalSetId> <version>").description("Dry-run a version over an agent's recent traces (billed, writes nothing)").requiredOption("--agent <agentId>", "Agent whose recent completed traces to read").option("--limit <n>", "Traces to read (default 20, at most 50)", positiveNumber).option("--acknowledge-external-processing", "Only after a human confirms (PHI organization, model outside Workers AI)").action((id, version, options) => run$1((client) => client.signals.preview(id, positiveNumber(version), {
37035
36975
  agentId: options.agent,
@@ -37076,8 +37016,7 @@ runsCommand.command("list").description("List runs, newest first").option("--age
37076
37016
  ...options.limit !== void 0 ? { limit: options.limit } : {},
37077
37017
  ...options.cursor ? { cursor: options.cursor } : {}
37078
37018
  })));
37079
- //#endregion
37080
- //#region src/lib/account-context.ts
37019
+ // src/lib/account-context.ts
37081
37020
  /**
37082
37021
  * Resolve the Clerk ID (`org_...` preferred, else `user_...`) to embed as `?account=` in dashboard URLs.
37083
37022
  * When an API key is provided, prefer asking the API who that key belongs to.
@@ -37105,8 +37044,7 @@ async function getCurrentAccountId(options) {
37105
37044
  return;
37106
37045
  }
37107
37046
  }
37108
- //#endregion
37109
- //#region src/lib/quick-start-api.ts
37047
+ // src/lib/quick-start-api.ts
37110
37048
  function isObjectRecord(value) {
37111
37049
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
37112
37050
  }
@@ -37143,8 +37081,7 @@ async function createQuickStartProduct(apiKey, input, apiUrl) {
37143
37081
  throw error;
37144
37082
  }
37145
37083
  }
37146
- //#endregion
37147
- //#region src/commands/products.ts
37084
+ // src/commands/products.ts
37148
37085
  function displayAgentCard(agentCard) {
37149
37086
  console.log(chalk.cyan("\nAgent Details:"));
37150
37087
  console.log(` Name: ${agentCard.name}`);
@@ -37647,8 +37584,7 @@ async function getApiKeyOrExit(isJsonMode, agentCard) {
37647
37584
  }
37648
37585
  return apiKey;
37649
37586
  }
37650
- //#endregion
37651
- //#region src/ink/init/WizardStep.tsx
37587
+ // src/ink/init/WizardStep.tsx
37652
37588
  function WizardStep({ stepNumber, totalSteps, title, children }) {
37653
37589
  return /* @__PURE__ */ jsxs(Box, {
37654
37590
  flexDirection: "column",
@@ -37678,8 +37614,7 @@ function WizardStep({ stepNumber, totalSteps, title, children }) {
37678
37614
  ]
37679
37615
  });
37680
37616
  }
37681
- //#endregion
37682
- //#region src/ink/init/StepSummary.tsx
37617
+ // src/ink/init/StepSummary.tsx
37683
37618
  function StepSummary({ answers }) {
37684
37619
  if (answers.length === 0) return null;
37685
37620
  return /* @__PURE__ */ jsx(Box, {
@@ -37701,8 +37636,7 @@ function StepSummary({ answers }) {
37701
37636
  }, index))
37702
37637
  });
37703
37638
  }
37704
- //#endregion
37705
- //#region src/ink/init/InitApp.tsx
37639
+ // src/ink/init/InitApp.tsx
37706
37640
  const TOTAL_VISIBLE_STEPS = 3;
37707
37641
  function getStepNumber(step) {
37708
37642
  if (step <= 1) return 1;
@@ -38273,8 +38207,7 @@ function ConfirmInput({ onConfirm }) {
38273
38207
  }, { isActive: !answered });
38274
38208
  return null;
38275
38209
  }
38276
- //#endregion
38277
- //#region src/commands/init.ts
38210
+ // src/commands/init.ts
38278
38211
  const initCommand = new Command("init").description("Set up Runtype CLI with guided onboarding").option("--api-url <url>", "Custom API URL").option("--api-key <key>", "API key for non-interactive setup").option("--name <name>", "Product name for non-interactive setup").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
38279
38212
  if (!isTTY(options)) {
38280
38213
  if (!options.apiKey) {
@@ -38348,8 +38281,7 @@ const initCommand = new Command("init").description("Set up Runtype CLI with gui
38348
38281
  }), { exitOnCtrlC: false });
38349
38282
  await waitUntilExit();
38350
38283
  });
38351
- //#endregion
38352
- //#region src/lib/agent-version-selector.ts
38284
+ // src/lib/agent-version-selector.ts
38353
38285
  var AgentVersionSelectorConflictError = class extends Error {
38354
38286
  name = "AgentVersionSelectorConflictError";
38355
38287
  constructor() {
@@ -38374,8 +38306,7 @@ function buildNestedAgentSelector(flags) {
38374
38306
  const selector = buildAgentVersionSelector(flags);
38375
38307
  return selector ? { agent: selector } : {};
38376
38308
  }
38377
- //#endregion
38378
- //#region src/commands/dispatch.ts
38309
+ // src/commands/dispatch.ts
38379
38310
  const dispatchCommand = addExecutionInputOptions(new Command("dispatch").description("Execute a flow or agent via the dispatch API").option("-f, --flow <id>", "Flow ID to execute").option("-a, --agent <id>", "Agent ID to execute").option("--alias <name>", "Run whichever version this release alias points at").option("--version-id <id>", "Run this exact version snapshot").option("-r, --record <id>", "Existing record ID").option("--record-json <file>", "JSON file with record data (use - for stdin)").option("-m, --message <text>", "Message to send").option("--stream", "Stream the response (default)", true).option("--no-stream", "Wait for complete response").option("--json", "Output one final JSON result").option("--jsonl", "Output stream events and a terminal execution_summary as JSON lines").option("--debug", "Show step-level details").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode")).action(async (options) => {
38380
38311
  await runExecution(options, () => buildDispatchRequest(options), (client, payload) => options.stream ? client.dispatch.executeStream(payload) : client.dispatch.execute(payload), "execution", renderDispatchResult);
38381
38312
  });
@@ -38407,8 +38338,7 @@ function renderDispatchResult(value) {
38407
38338
  else printJson(step.result);
38408
38339
  }
38409
38340
  }
38410
- //#endregion
38411
- //#region src/commands/conversations.ts
38341
+ // src/commands/conversations.ts
38412
38342
  /**
38413
38343
  * Write one message line, emitting inline image escape sequences for renderable
38414
38344
  * image parts and falling back to the text marker (via {@link renderMessageContent})
@@ -38715,8 +38645,7 @@ conversationsCommand.command("delete <id>").description("Delete a conversation")
38715
38645
  const { waitUntilExit } = render(React.createElement(runDelete()));
38716
38646
  await waitUntilExit();
38717
38647
  });
38718
- //#endregion
38719
- //#region src/ink/marathon/context-compaction-format.ts
38648
+ // src/ink/marathon/context-compaction-format.ts
38720
38649
  function formatTokenCount$1(value) {
38721
38650
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return void 0;
38722
38651
  return value.toLocaleString();
@@ -38731,8 +38660,7 @@ function formatCompactionThresholdLabel(compaction) {
38731
38660
  if (threshold && contextLimit) return `${threshold}/${contextLimit} tokens`;
38732
38661
  return contextLimit ? `${contextLimit} tokens` : threshold ? `${threshold} tokens` : void 0;
38733
38662
  }
38734
- //#endregion
38735
- //#region src/ink/marathon/transcript-utils.ts
38663
+ // src/ink/marathon/transcript-utils.ts
38736
38664
  function appendTranscriptText(content, delta, previousKind) {
38737
38665
  if (!content) return delta;
38738
38666
  return previousKind === "tool" && !content.endsWith("\n") && !delta.startsWith("\n") ? `${content}\n${delta}` : `${content}${delta}`;
@@ -38743,8 +38671,7 @@ function getVisibleReasoningLines(reasoning, maxLines) {
38743
38671
  if (!trimmed) return [];
38744
38672
  return trimmed.split("\n").slice(-maxLines);
38745
38673
  }
38746
- //#endregion
38747
- //#region src/ink/marathon/useMarathonStream.ts
38674
+ // src/ink/marathon/useMarathonStream.ts
38748
38675
  const INITIAL_STATE = {
38749
38676
  phase: "idle",
38750
38677
  content: "",
@@ -39373,8 +39300,7 @@ function useMarathonStream() {
39373
39300
  }, [])
39374
39301
  };
39375
39302
  }
39376
- //#endregion
39377
- //#region src/ink/marathon/RunnerTrack.tsx
39303
+ // src/ink/marathon/RunnerTrack.tsx
39378
39304
  const TRAIL_CHARS = [
39379
39305
  "•",
39380
39306
  "·",
@@ -39587,8 +39513,7 @@ function useRunnerTrack({ width, isAnimating, runnerChar = "🏃", finishChar =
39587
39513
  borderSegments
39588
39514
  };
39589
39515
  }
39590
- //#endregion
39591
- //#region src/ink/marathon/SessionHeader.tsx
39516
+ // src/ink/marathon/SessionHeader.tsx
39592
39517
  /** Render an array of TrackSegments as nested <Text> spans */
39593
39518
  function renderSegments(segments) {
39594
39519
  return segments.map((seg, i) => /* @__PURE__ */ jsx(Text, {
@@ -39711,8 +39636,7 @@ function SessionHeader({ sessionName, sessionCount, model, cost, goal, goalExpan
39711
39636
  children: /* @__PURE__ */ jsx(Text, { children: rows.map((row, rowIdx) => rowIdx === 0 ? renderSegments(row) : ["\n", ...renderSegments(row)]) })
39712
39637
  });
39713
39638
  }
39714
- //#endregion
39715
- //#region src/ink/marathon/SessionTabs.tsx
39639
+ // src/ink/marathon/SessionTabs.tsx
39716
39640
  const SELECTED_TAB_TEXT = "#0f161d";
39717
39641
  function getTabLabelColor(tab) {
39718
39642
  if (tab.isUnread) return theme.success;
@@ -39772,8 +39696,7 @@ function SessionTabs({ tabs, hiddenLeft, hiddenRight, shortcutHint }) {
39772
39696
  })
39773
39697
  ] });
39774
39698
  }
39775
- //#endregion
39776
- //#region src/ink/marathon/ScreenTabs.tsx
39699
+ // src/ink/marathon/ScreenTabs.tsx
39777
39700
  const TABS = [
39778
39701
  {
39779
39702
  key: "overview",
@@ -39823,8 +39746,7 @@ function ScreenTabs({ activeTab, width, shortcutHint }) {
39823
39746
  })]
39824
39747
  });
39825
39748
  }
39826
- //#endregion
39827
- //#region src/ink/marathon/Scrollbar.tsx
39749
+ // src/ink/marathon/Scrollbar.tsx
39828
39750
  /**
39829
39751
  * Vertical scrollbar with thumb + rail.
39830
39752
  * Only renders when totalLines > visibleLines.
@@ -39847,8 +39769,7 @@ function Scrollbar({ totalLines, visibleLines, scrollOffset, height }) {
39847
39769
  })
39848
39770
  });
39849
39771
  }
39850
- //#endregion
39851
- //#region src/ink/marathon/ToolsPanel.tsx
39772
+ // src/ink/marathon/ToolsPanel.tsx
39852
39773
  function getVisibleToolWindow(total, selectedIndex, maxVisibleLines) {
39853
39774
  const toolSlots = Math.floor(maxVisibleLines / 2);
39854
39775
  let start = selectedIndex - Math.floor(toolSlots / 2);
@@ -40192,8 +40113,7 @@ const ToolsPanel = memo(function ToolsPanel({ tools, maxVisibleLines = 50, selec
40192
40113
  }, (prev, next) => {
40193
40114
  return visibleToolsFingerprint(prev.tools, prev.selectedIndex, prev.maxVisibleLines ?? 50) === visibleToolsFingerprint(next.tools, next.selectedIndex, next.maxVisibleLines ?? 50) && prev.detailTool === next.detailTool && prev.detailScrollOffset === next.detailScrollOffset && prev.width === next.width;
40194
40115
  });
40195
- //#endregion
40196
- //#region src/ink/marathon/EventStreamPanel.tsx
40116
+ // src/ink/marathon/EventStreamPanel.tsx
40197
40117
  /** Color per event type for visual scanning */
40198
40118
  const EVENT_COLORS = {
40199
40119
  agent_start: theme.success,
@@ -40459,8 +40379,7 @@ const EventStreamPanel = memo(function EventStreamPanel({ events, startTime, max
40459
40379
  }, (prev, next) => {
40460
40380
  return prev.events.length === next.events.length && prev.selectedIndex === next.selectedIndex && prev.maxVisibleLines === next.maxVisibleLines && prev.startTime === next.startTime && prev.detailEvent === next.detailEvent && prev.detailScrollOffset === next.detailScrollOffset && prev.width === next.width && prev.activeFilterCount === next.activeFilterCount && prev.totalTypeCount === next.totalTypeCount;
40461
40381
  });
40462
- //#endregion
40463
- //#region src/ink/marathon/EventTypeFilter.tsx
40382
+ // src/ink/marathon/EventTypeFilter.tsx
40464
40383
  /** Max visible rows in the event type list */
40465
40384
  const MAX_VISIBLE$1 = 14;
40466
40385
  function EventTypeFilter({ eventTypes, selectedTypes, onApply, onCancel }) {
@@ -40587,8 +40506,7 @@ function EventTypeFilter({ eventTypes, selectedTypes, onApply, onCancel }) {
40587
40506
  ]
40588
40507
  });
40589
40508
  }
40590
- //#endregion
40591
- //#region src/ink/marathon/ReasoningPanel.tsx
40509
+ // src/ink/marathon/ReasoningPanel.tsx
40592
40510
  /** Wrap long lines at a given width so scroll math matches visual rows */
40593
40511
  function wrapLines$1(lines, width) {
40594
40512
  if (width <= 0) return lines;
@@ -40670,8 +40588,7 @@ function ReasoningPanel({ reasoning, maxVisibleLines = 50, scrollOffset = 0, wid
40670
40588
  })]
40671
40589
  });
40672
40590
  }
40673
- //#endregion
40674
- //#region src/ink/marathon/FilesPanel.tsx
40591
+ // src/ink/marathon/FilesPanel.tsx
40675
40592
  const TYPE_COLORS = {
40676
40593
  plan: theme.accent,
40677
40594
  written: theme.success,
@@ -40957,8 +40874,7 @@ function FilesPanel({ files, maxVisibleLines = 50, selectedIndex, detailFile, de
40957
40874
  })]
40958
40875
  });
40959
40876
  }
40960
- //#endregion
40961
- //#region src/ink/marathon/HelpPanel.tsx
40877
+ // src/ink/marathon/HelpPanel.tsx
40962
40878
  const NAVIGATION_SHORTCUTS = [
40963
40879
  {
40964
40880
  key: "Tab",
@@ -41255,8 +41171,7 @@ function HelpPanel({ width, height, isCheckpoint, scrollOffset }) {
41255
41171
  ]
41256
41172
  });
41257
41173
  }
41258
- //#endregion
41259
- //#region src/ink/marathon/file-utils.ts
41174
+ // src/ink/marathon/file-utils.ts
41260
41175
  /**
41261
41176
  * Extract tracked files from tool entries across all session snapshots + live tools.
41262
41177
  * Deduplicates by path, preferring 'written' over 'read'.
@@ -41350,8 +41265,7 @@ function readFileContent(filePath, snapshots, liveTools, maxLines = 5e3) {
41350
41265
  source: "disk"
41351
41266
  };
41352
41267
  }
41353
- //#endregion
41354
- //#region src/marathon/sandbox.ts
41268
+ // src/marathon/sandbox.ts
41355
41269
  function isRecord$3(value) {
41356
41270
  return typeof value === "object" && value !== null && !Array.isArray(value);
41357
41271
  }
@@ -41844,8 +41758,7 @@ function createDeployCfSandboxLocalTool(client, debugMode) {
41844
41758
  }
41845
41759
  };
41846
41760
  }
41847
- //#endregion
41848
- //#region src/marathon/event-log.ts
41761
+ // src/marathon/event-log.ts
41849
41762
  /** Derive the events directory from the state file path.
41850
41763
  * `task-name.json` → `task-name.events/` */
41851
41764
  function eventsDirForStateFile(stateFilePath) {
@@ -42288,8 +42201,7 @@ function syncTreeLogWithState(stateFilePath, state) {
42288
42201
  }
42289
42202
  } catch {}
42290
42203
  }
42291
- //#endregion
42292
- //#region src/marathon/session-tree-view.ts
42204
+ // src/marathon/session-tree-view.ts
42293
42205
  const PREVIEW_LENGTH = 60;
42294
42206
  function previewText(text, length = PREVIEW_LENGTH) {
42295
42207
  const collapsed = text.replace(/\s+/g, " ").trim();
@@ -42371,8 +42283,7 @@ function listForkCandidates(log) {
42371
42283
  });
42372
42284
  return candidates;
42373
42285
  }
42374
- //#endregion
42375
- //#region src/marathon/steering-queue.ts
42286
+ // src/marathon/steering-queue.ts
42376
42287
  /**
42377
42288
  * Create an in-memory FIFO steering queue. State lives in the closure, so the
42378
42289
  * caller should hold a single instance for the lifetime of a run (e.g. via a
@@ -42496,8 +42407,7 @@ function BlinkingTextInput({ value: originalValue, placeholder = "", focus = tru
42496
42407
  }, { isActive: focus });
42497
42408
  return /* @__PURE__ */ jsx(Text, { children: placeholder ? value.length > 0 ? renderedValue : renderedPlaceholder : renderedValue });
42498
42409
  }
42499
- //#endregion
42500
- //#region src/ink/talk/ModelPicker.tsx
42410
+ // src/ink/talk/ModelPicker.tsx
42501
42411
  const DEFAULT_MODELS = [
42502
42412
  {
42503
42413
  label: "Claude Opus 4.6",
@@ -42820,8 +42730,7 @@ function ModelPicker({ currentModel, onSelect, onCancel, models }) {
42820
42730
  ]
42821
42731
  });
42822
42732
  }
42823
- //#endregion
42824
- //#region src/ink/marathon/types.ts
42733
+ // src/ink/marathon/types.ts
42825
42734
  const MARATHON_CHECKPOINT_COMMANDS = [
42826
42735
  {
42827
42736
  name: "/model",
@@ -42894,8 +42803,7 @@ const MARATHON_CHECKPOINT_COMMANDS = [
42894
42803
  hasArgs: false
42895
42804
  }
42896
42805
  ];
42897
- //#endregion
42898
- //#region src/ink/marathon/CommandPicker.tsx
42806
+ // src/ink/marathon/CommandPicker.tsx
42899
42807
  function CommandPicker({ onSelect, onCancel, initialFilter = "" }) {
42900
42808
  const { stdout } = useStdout();
42901
42809
  const [search, setSearch] = useState(initialFilter);
@@ -42994,8 +42902,7 @@ function CommandPicker({ onSelect, onCancel, initialFilter = "" }) {
42994
42902
  ]
42995
42903
  });
42996
42904
  }
42997
- //#endregion
42998
- //#region src/ink/marathon/text-area-editing.ts
42905
+ // src/ink/marathon/text-area-editing.ts
42999
42906
  function ensureLines(lines) {
43000
42907
  return lines.length > 0 ? lines : [""];
43001
42908
  }
@@ -43065,8 +42972,7 @@ function deleteToLineStart(lines, cursor) {
43065
42972
  }
43066
42973
  };
43067
42974
  }
43068
- //#endregion
43069
- //#region src/ink/marathon/TextArea.tsx
42975
+ // src/ink/marathon/TextArea.tsx
43070
42976
  function splitLines(text) {
43071
42977
  const lines = text.split("\n");
43072
42978
  return lines.length === 0 ? [""] : lines;
@@ -43371,8 +43277,7 @@ function CursorLine({ content, cursorCol, maxWidth, visible = true }) {
43371
43277
  })
43372
43278
  ] });
43373
43279
  }
43374
- //#endregion
43375
- //#region src/ink/marathon/ReflectEditor.tsx
43280
+ // src/ink/marathon/ReflectEditor.tsx
43376
43281
  const DEFAULT_REFLECT_PROMPT = `Before continuing, step back and reflect:
43377
43282
  - What has been accomplished so far?
43378
43283
  - What isn't working or is blocking progress?
@@ -43387,8 +43292,7 @@ function ReflectEditor({ onSubmit, onCancel, maxHeight = 10 }) {
43387
43292
  maxHeight
43388
43293
  });
43389
43294
  }
43390
- //#endregion
43391
- //#region src/ink/marathon/CheckpointRecap.tsx
43295
+ // src/ink/marathon/CheckpointRecap.tsx
43392
43296
  function formatTokenCount(value) {
43393
43297
  return value.toLocaleString("en-US");
43394
43298
  }
@@ -43428,8 +43332,7 @@ function CheckpointRecap({ sessionNumber, toolCallsMade, tokensInput, tokensOutp
43428
43332
  ]
43429
43333
  });
43430
43334
  }
43431
- //#endregion
43432
- //#region src/ink/marathon/TreePanel.tsx
43335
+ // src/ink/marathon/TreePanel.tsx
43433
43336
  const MAX_VISIBLE_ROWS$1 = 12;
43434
43337
  function TreePanel({ rows, onSelect, onCancel }) {
43435
43338
  const initialIndex = Math.max(rows.findIndex((row) => row.isHead), 0);
@@ -43507,8 +43410,7 @@ function TreePanel({ rows, onSelect, onCancel }) {
43507
43410
  ]
43508
43411
  });
43509
43412
  }
43510
- //#endregion
43511
- //#region src/ink/marathon/ForkPicker.tsx
43413
+ // src/ink/marathon/ForkPicker.tsx
43512
43414
  const MAX_VISIBLE_ROWS = 10;
43513
43415
  function ForkPicker({ candidates, onSelect, onCancel }) {
43514
43416
  const [selectedIndex, setSelectedIndex] = useState(Math.max(candidates.length - 1, 0));
@@ -43580,8 +43482,7 @@ function ForkPicker({ candidates, onSelect, onCancel }) {
43580
43482
  ]
43581
43483
  });
43582
43484
  }
43583
- //#endregion
43584
- //#region src/ink/marathon/checkpoint-prompt-state.ts
43485
+ // src/ink/marathon/checkpoint-prompt-state.ts
43585
43486
  function shouldPauseCheckpointTimer(state) {
43586
43487
  return Boolean(state.isTerminal || state.isStopped || state.timeout === 0 || state.isTyping || state.hasPendingChanges || state.showModelPicker || state.showReflectEditor || state.showCommandPicker || state.showTreePanel || state.showForkPicker || state.isReviewing);
43587
43488
  }
@@ -43594,8 +43495,7 @@ function getCheckpointCountdownText(state) {
43594
43495
  if (state.isReviewing) return "(reviewing)";
43595
43496
  return `(${state.remaining}s)`;
43596
43497
  }
43597
- //#endregion
43598
- //#region src/ink/marathon/CheckpointPrompt.tsx
43498
+ // src/ink/marathon/CheckpointPrompt.tsx
43599
43499
  function CheckpointPrompt({ onSubmit, onToggleHelp, onCopySession, onCopySessionTrimmed, onOpenStateFile, onLoadTreeView, onLoadForkCandidates, timeout, isTerminal, isStopped = false, initialMessage, currentModel, recap, isReviewing = false }) {
43600
43500
  const [value, setValue] = useState(initialMessage ?? "");
43601
43501
  const [remaining, setRemaining] = useState(timeout);
@@ -43922,8 +43822,7 @@ function CheckpointPrompt({ onSubmit, onToggleHelp, onCopySession, onCopySession
43922
43822
  })]
43923
43823
  });
43924
43824
  }
43925
- //#endregion
43926
- //#region src/ink/marathon/SteerComposer.tsx
43825
+ // src/ink/marathon/SteerComposer.tsx
43927
43826
  /**
43928
43827
  * Mid-run steering composer (Pi-style message queue). Opened with Enter while
43929
43828
  * the marathon is streaming; Enter queues, Tab toggles delivery timing,
@@ -43994,8 +43893,7 @@ function SteerComposer({ initialDraft = "", onSubmit, onCancel }) {
43994
43893
  })]
43995
43894
  });
43996
43895
  }
43997
- //#endregion
43998
- //#region src/ink/marathon/SessionActionMenu.tsx
43896
+ // src/ink/marathon/SessionActionMenu.tsx
43999
43897
  const MENU_ITEMS = [
44000
43898
  {
44001
43899
  key: "c",
@@ -44086,8 +43984,7 @@ function SessionActionMenu({ onCopySession, onCopySessionTrimmed, onOpenStateFil
44086
43984
  ]
44087
43985
  });
44088
43986
  }
44089
- //#endregion
44090
- //#region src/ink/marathon/session-context-copy.ts
43987
+ // src/ink/marathon/session-context-copy.ts
44091
43988
  const DEFAULT_MAX_CHARS = 900;
44092
43989
  const HEAVY_PREVIEW_MAX_CHARS = 360;
44093
43990
  const STREAM_EVENT_HEAVY_KEYS = /* @__PURE__ */ new Set([
@@ -44232,8 +44129,7 @@ function compactLiveMarathonPayloadForContextExport(payload) {
44232
44129
  rawEvents: payload.rawEvents.map(compactRawStreamEventForCopy)
44233
44130
  };
44234
44131
  }
44235
- //#endregion
44236
- //#region src/ink/marathon/UpgradeModal.tsx
44132
+ // src/ink/marathon/UpgradeModal.tsx
44237
44133
  function UpgradeModal({ prompt, width }) {
44238
44134
  return /* @__PURE__ */ jsxs(Box, {
44239
44135
  width,
@@ -44314,8 +44210,7 @@ function UpgradeModal({ prompt, width }) {
44314
44210
  ]
44315
44211
  });
44316
44212
  }
44317
- //#endregion
44318
- //#region src/ink/marathon/ToolPanel.tsx
44213
+ // src/ink/marathon/ToolPanel.tsx
44319
44214
  const TOOL_PANEL_TIMER_MS = 500;
44320
44215
  function formatCharCount(chars) {
44321
44216
  if (chars >= 1e3) return `${(chars / 1e3).toFixed(1)}k chars`;
@@ -44522,8 +44417,7 @@ const ToolPanel = memo(function ToolPanel({ tools, reasoningCharCount = 0, files
44522
44417
  }, (prev, next) => {
44523
44418
  return toolsFingerprint(prev.tools) === toolsFingerprint(next.tools) && prev.maxHeight === next.maxHeight && (prev.reasoningCharCount ?? 0) === (next.reasoningCharCount ?? 0) && filesFingerprint(prev.files) === filesFingerprint(next.files);
44524
44419
  });
44525
- //#endregion
44526
- //#region src/ink/marathon/OverviewActivityPane.tsx
44420
+ // src/ink/marathon/OverviewActivityPane.tsx
44527
44421
  const OverviewActivityPane = memo(function OverviewActivityPane({ tools, reasoningCharCount, files, maxHeight, stacked = false, width }) {
44528
44422
  return /* @__PURE__ */ jsx(Box, {
44529
44423
  flexDirection: "column",
@@ -44542,8 +44436,7 @@ const OverviewActivityPane = memo(function OverviewActivityPane({ tools, reasoni
44542
44436
  })
44543
44437
  });
44544
44438
  });
44545
- //#endregion
44546
- //#region src/ink/marathon/ThinkingIndicator.tsx
44439
+ // src/ink/marathon/ThinkingIndicator.tsx
44547
44440
  function ThinkingIndicator({ startedAt }) {
44548
44441
  const [elapsed, setElapsed] = useState(() => startedAt ? Math.floor((Date.now() - startedAt) / 1e3) : 0);
44549
44442
  useEffect(() => {
@@ -44559,8 +44452,7 @@ function ThinkingIndicator({ startedAt }) {
44559
44452
  color: theme.textMuted
44560
44453
  });
44561
44454
  }
44562
- //#endregion
44563
- //#region src/ink/marathon/ContextCompactionIndicator.tsx
44455
+ // src/ink/marathon/ContextCompactionIndicator.tsx
44564
44456
  function buildCompactionLabel(compaction, elapsedSeconds) {
44565
44457
  const modeLabel = compaction.mode === "auto" ? "auto" : "manual";
44566
44458
  const strategyLabel = compaction.strategy === "provider_native" ? "native" : "summary";
@@ -44583,8 +44475,7 @@ function ContextCompactionIndicator({ compaction }) {
44583
44475
  color: theme.warning
44584
44476
  });
44585
44477
  }
44586
- //#endregion
44587
- //#region src/ink/marathon/ReasoningBlock.tsx
44478
+ // src/ink/marathon/ReasoningBlock.tsx
44588
44479
  const REASONING_LABEL_COLOR = theme.accent;
44589
44480
  const REASONING_TEXT_COLOR = theme.textMuted;
44590
44481
  const REASONING_HINT_COLOR = theme.textSubtle;
@@ -44621,8 +44512,7 @@ function ReasoningBlock({ lines, live = false, collapsed = false, compact = fals
44621
44512
  ]
44622
44513
  });
44623
44514
  }
44624
- //#endregion
44625
- //#region src/ink/marathon/OverviewTranscriptPane.tsx
44515
+ // src/ink/marathon/OverviewTranscriptPane.tsx
44626
44516
  const UPGRADE_BROWSE_HINT_LINES = ["Upgrade modal dismissed.", "Use Shift+Left/Right or 1-9 to review previous marathon runs."];
44627
44517
  const OverviewTranscriptPane = memo(function OverviewTranscriptPane({ content, enableMarkdown, isStreaming, maxVisibleLines, scrollOffset, totalLines, paneWidth, contentHeight, showLoadingAnimation = false, hasReasoning = false, visibleReasoningLines = [], reasoningCollapsed = false, reasoningLive = false, showThinkingIndicator = false, thinkingStartedAt, contextCompaction = null, showUpgradeBrowseHint = false, error = null }) {
44628
44518
  if (showLoadingAnimation) return /* @__PURE__ */ jsx(Box, {
@@ -44678,8 +44568,7 @@ const OverviewTranscriptPane = memo(function OverviewTranscriptPane({ content, e
44678
44568
  error && /* @__PURE__ */ jsx(ErrorDisplay, { error })
44679
44569
  ] });
44680
44570
  });
44681
- //#endregion
44682
- //#region src/ink/marathon/upgrade-modal-utils.ts
44571
+ // src/ink/marathon/upgrade-modal-utils.ts
44683
44572
  const UPGRADE_LIMIT_TYPES = /* @__PURE__ */ new Set([
44684
44573
  "daily_limit",
44685
44574
  "monthly_limit",
@@ -44712,8 +44601,7 @@ function parseMarathonUpgradePrompt(error) {
44712
44601
  ...retryAfter ? { retryAfter } : {}
44713
44602
  };
44714
44603
  }
44715
- //#endregion
44716
- //#region src/ink/marathon/session-tabs-utils.ts
44604
+ // src/ink/marathon/session-tabs-utils.ts
44717
44605
  const MAX_VISIBLE_TAB_SHORTCUTS = 9;
44718
44606
  const TAB_PADDING = 4;
44719
44607
  const TAB_SEPARATOR_WIDTH = 1;
@@ -44816,13 +44704,11 @@ function getSessionTabKeyForShortcut(visibleTabs, input) {
44816
44704
  const slot = Number(input);
44817
44705
  return visibleTabs.find((tab) => tab.shortcut === slot)?.key;
44818
44706
  }
44819
- //#endregion
44820
- //#region src/ink/marathon/checkpoint-navigation.ts
44707
+ // src/ink/marathon/checkpoint-navigation.ts
44821
44708
  function isAllowedCheckpointBrowseKey(key, isBrowsingScreen) {
44822
44709
  return Boolean(key.upArrow || key.downArrow || key.return && isBrowsingScreen || key.input === "c" && isBrowsingScreen || key.leftArrow && isBrowsingScreen || key.rightArrow && isBrowsingScreen || key.tab || key.escape || key.shift && key.leftArrow || key.shift && key.rightArrow);
44823
44710
  }
44824
- //#endregion
44825
- //#region src/ink/marathon/MarathonApp.tsx
44711
+ // src/ink/marathon/MarathonApp.tsx
44826
44712
  /** Columns allocated for tool panel in wide terminals */
44827
44713
  const TOOL_PANEL_WIDE = 48;
44828
44714
  /** Columns allocated for tool panel in medium terminals */
@@ -46125,8 +46011,7 @@ function MarathonApp({ taskName, agentId, model, sandbox, goal, initialSessionCo
46125
46011
  ]
46126
46012
  });
46127
46013
  }
46128
- //#endregion
46129
- //#region src/ink/marathon/MarathonStartupShell.tsx
46014
+ // src/ink/marathon/MarathonStartupShell.tsx
46130
46015
  const SCROLL_HINT = "↑↓ Enter 1-3";
46131
46016
  const PROMPT_COLUMN_MAX = 68;
46132
46017
  const MIN_HOLD_MS = 1500;
@@ -46601,8 +46486,7 @@ function MarathonStartupShell({ startupRef, marathonAppProps, version }) {
46601
46486
  ]
46602
46487
  });
46603
46488
  }
46604
- //#endregion
46605
- //#region src/lib/terminal-title.ts
46489
+ // src/lib/terminal-title.ts
46606
46490
  /** Set the terminal tab title via OSC 0 escape sequence. */
46607
46491
  function setTerminalTitle(title) {
46608
46492
  if (process.stdout.isTTY) process.stdout.write(`\x1b]0;${title}\x07`);
@@ -46619,8 +46503,7 @@ function setCliTitle() {
46619
46503
  function setMarathonTitle() {
46620
46504
  setTerminalTitle(`Runtype: Marathon (${getFolderName()})`);
46621
46505
  }
46622
- //#endregion
46623
- //#region src/marathon/checkpoint.ts
46506
+ // src/marathon/checkpoint.ts
46624
46507
  function defaultStateDir$2() {
46625
46508
  return getMarathonStateDir();
46626
46509
  }
@@ -46670,8 +46553,7 @@ function restoreMarathonFileCheckpoint(taskName, targetPath, stateDir, stateFile
46670
46553
  checkpointPath
46671
46554
  };
46672
46555
  }
46673
- //#endregion
46674
- //#region src/marathon/errors.ts
46556
+ // src/marathon/errors.ts
46675
46557
  /** Patterns that indicate a transient network failure (connection lost, DNS, timeout). */
46676
46558
  const NETWORK_ERROR_PATTERNS = [
46677
46559
  "fetch failed",
@@ -46875,8 +46757,7 @@ function formatMarathonApiError(error) {
46875
46757
  return chalk.gray(line);
46876
46758
  });
46877
46759
  }
46878
- //#endregion
46879
- //#region src/marathon/verification.ts
46760
+ // src/marathon/verification.ts
46880
46761
  /**
46881
46762
  * Verification command safety gate.
46882
46763
  *
@@ -47072,8 +46953,7 @@ function isScriptConfigModified(cwd, files) {
47072
46953
  return true;
47073
46954
  }
47074
46955
  }
47075
- //#endregion
47076
- //#region src/lib/select-prompt.ts
46956
+ // src/lib/select-prompt.ts
47077
46957
  function canUseArrowKeySelect() {
47078
46958
  return process.stdin.isTTY === true && process.stdout.isTTY === true && typeof process.stdin.setRawMode === "function";
47079
46959
  }
@@ -47176,8 +47056,7 @@ async function promptSelect(message, choices, options) {
47176
47056
  renderMenu();
47177
47057
  });
47178
47058
  }
47179
- //#endregion
47180
- //#region src/marathon/state.ts
47059
+ // src/marathon/state.ts
47181
47060
  function defaultStateDir$1() {
47182
47061
  return getMarathonStateDir();
47183
47062
  }
@@ -47539,8 +47418,7 @@ async function resolveMarathonStateResolution(options, taskName, filePath, promp
47539
47418
  function buildResumeCommand(agent, options, parsedSandbox) {
47540
47419
  return `runtype marathon ${agent} --resume${options.name ? ` --name ${options.name}` : ""}${options.session ? ` --session ${options.session}` : ""}${parsedSandbox ? ` --sandbox ${parsedSandbox}` : ""}`;
47541
47420
  }
47542
- //#endregion
47543
- //#region src/marathon/session-tree-nav.ts
47421
+ // src/marathon/session-tree-nav.ts
47544
47422
  /**
47545
47423
  * Apply `/tree` / `/fork` from a checkpoint result. Returns null when there
47546
47424
  * is nothing to do (no navigation requested, no state file, no tree log yet,
@@ -47605,8 +47483,7 @@ function applyCheckpointTreeNavigation(stateFilePath, navigation) {
47605
47483
  mergedState
47606
47484
  };
47607
47485
  }
47608
- //#endregion
47609
- //#region src/marathon/repo-discovery.ts
47486
+ // src/marathon/repo-discovery.ts
47610
47487
  const IGNORED_REPO_DIRS = /* @__PURE__ */ new Set([
47611
47488
  ".git",
47612
47489
  ".next",
@@ -47871,8 +47748,7 @@ function buildTree(dirPath, maxDepth, depth = 0) {
47871
47748
  }
47872
47749
  return lines;
47873
47750
  }
47874
- //#endregion
47875
- //#region src/marathon/local-tools.ts
47751
+ // src/marathon/local-tools.ts
47876
47752
  const DIRECT_TOOL_BLOCKED_SEGMENTS = /* @__PURE__ */ new Set([".git", ".runtype"]);
47877
47753
  const MAX_TOOL_PATH_SYMLINKS = 40;
47878
47754
  function stateSafeName$1(name) {
@@ -48523,8 +48399,7 @@ function buildLocalTools(client, sandboxProvider, options, context) {
48523
48399
  }
48524
48400
  return Object.keys(enabledTools).length > 0 ? enabledTools : void 0;
48525
48401
  }
48526
- //#endregion
48527
- //#region src/marathon/session-chunker.ts
48402
+ // src/marathon/session-chunker.ts
48528
48403
  /** Approximate max characters per chunk (~512 tokens) */
48529
48404
  const DEFAULT_MAX_CHUNK_CHARS = 2e3;
48530
48405
  /** Minimum content length worth indexing */
@@ -48634,8 +48509,7 @@ function chunkText(text, type, maxChars, toolName) {
48634
48509
  });
48635
48510
  return chunks;
48636
48511
  }
48637
- //#endregion
48638
- //#region src/marathon/loop-detector.ts
48512
+ // src/marathon/loop-detector.ts
48639
48513
  const DEFAULT_MAX_HISTORY = 30;
48640
48514
  const DEFAULT_MIN_PATTERN_LENGTH = 2;
48641
48515
  const DEFAULT_MAX_PATTERN_LENGTH = 5;
@@ -48709,8 +48583,7 @@ function createLoopDetector(options = {}) {
48709
48583
  }
48710
48584
  };
48711
48585
  }
48712
- //#endregion
48713
- //#region src/marathon/context-offload.ts
48586
+ // src/marathon/context-offload.ts
48714
48587
  /** Character threshold above which tool output is offloaded to a file */
48715
48588
  const DEFAULT_OUTPUT_THRESHOLD = 2e3;
48716
48589
  /** How many characters of the original output to include in the reference */
@@ -48828,8 +48701,7 @@ function withOffloading(tool, taskName, toolName, options, stateDir) {
48828
48701
  }
48829
48702
  };
48830
48703
  }
48831
- //#endregion
48832
- //#region src/marathon/model-context.ts
48704
+ // src/marathon/model-context.ts
48833
48705
  const DEFAULT_AUTO_COMPACT_THRESHOLD_RATIO = .8;
48834
48706
  const DEFAULT_PROVIDER_NATIVE_COMPACT_THRESHOLD_RATIO = .9;
48835
48707
  const DEFAULT_OUTPUT_RESERVE_RATIO = .15;
@@ -48924,8 +48796,7 @@ function resolveAutoCompactTokenThreshold(modelContextLength, rawThreshold, stra
48924
48796
  if (!Number.isFinite(numericValue) || numericValue <= 0) throw new Error(`Invalid --compact-threshold value "${rawThreshold}". Use a percentage (e.g. 80%) or absolute token count (e.g. 120000).`);
48925
48797
  return Math.max(1, Math.floor(numericValue));
48926
48798
  }
48927
- //#endregion
48928
- //#region src/marathon/recipes.ts
48799
+ // src/marathon/recipes.ts
48929
48800
  const RULES_DIR = ".marathon/rules";
48930
48801
  function loadRules(cwd) {
48931
48802
  const baseCwd = cwd || process.cwd();
@@ -49069,8 +48940,7 @@ function resolveErrorHandlingForPhase(phase, cliFallbackModel, milestoneFallback
49069
48940
  ...triggers ? { triggers } : {}
49070
48941
  };
49071
48942
  }
49072
- //#endregion
49073
- //#region src/marathon/playbook-loader.ts
48943
+ // src/marathon/playbook-loader.ts
49074
48944
  const PLAYBOOKS_DIR = ".runtype/marathons/playbooks";
49075
48945
  function getCandidatePaths(nameOrPath, cwd) {
49076
48946
  const home = os$1.homedir();
@@ -49254,8 +49124,7 @@ function normalizeFallbackModel(input) {
49254
49124
  ...input.maxTokens !== void 0 ? { maxTokens: input.maxTokens } : {}
49255
49125
  };
49256
49126
  }
49257
- //#endregion
49258
- //#region src/commands/agents-task.ts
49127
+ // src/commands/agents-task.ts
49259
49128
  function shouldRequestResumeCheckpoint(status, resumeMessage, noCheckpoint, originalMessage, continuations) {
49260
49129
  if (status !== "paused" || noCheckpoint) return false;
49261
49130
  const normalizedResumeMessage = resumeMessage?.trim();
@@ -50655,8 +50524,7 @@ const taskCommand = applyTaskOptions(new Command("task").description("Run a mult
50655
50524
  function createMarathonCommand() {
50656
50525
  return applyTaskOptions(new Command("marathon").description("Run a multi-session agent task (alias for agents task)"));
50657
50526
  }
50658
- //#endregion
50659
- //#region src/commands/agent-aliases.ts
50527
+ // src/commands/agent-aliases.ts
50660
50528
  /** Print a failure the way every other CLI command does, then exit non-zero. */
50661
50529
  function fail$3(headline, error) {
50662
50530
  const message = error instanceof Error ? error.message : String(error);
@@ -50897,8 +50765,7 @@ agentDeploymentsCommand.command("list <agentId>").description("List deployment r
50897
50765
  fail$3("Failed to list deployment receipts", error);
50898
50766
  }
50899
50767
  });
50900
- //#endregion
50901
- //#region src/commands/agent-ensure.ts
50768
+ // src/commands/agent-ensure.ts
50902
50769
  /**
50903
50770
  * The activation the flags ask for. `release` and `deploy` are two spellings of
50904
50771
  * one thing, so supplying both is refused before any request is sent.
@@ -51084,8 +50951,7 @@ const agentPullCommand = new Command("pull").description("Print an agent as the
51084
50951
  process.exit(1);
51085
50952
  }
51086
50953
  });
51087
- //#endregion
51088
- //#region src/commands/agent-promote.ts
50954
+ // src/commands/agent-promote.ts
51089
50955
  const DEFAULT_SOURCE_KEY_ENV = "RUNTYPE_SOURCE_API_KEY";
51090
50956
  const DEFAULT_TARGET_KEY_ENV = "RUNTYPE_TARGET_API_KEY";
51091
50957
  const DEFAULT_MANIFEST_PATH = "promotion.json";
@@ -51209,8 +51075,7 @@ addCredentialOptions(agentPromoteCommand.command("activate <manifest>").descript
51209
51075
  fail$2("Failed to activate the promotion", error);
51210
51076
  }
51211
51077
  });
51212
- //#endregion
51213
- //#region src/commands/deploy.ts
51078
+ // src/commands/deploy.ts
51214
51079
  function bashSingleQuote(s) {
51215
51080
  return "'" + s.replace(/'/g, "'\\''") + "'";
51216
51081
  }
@@ -52539,8 +52404,7 @@ const deployCommand = new Command("deploy").description("Export an agent and sca
52539
52404
  console.log(" --allow-unauthenticated --port 8080");
52540
52405
  }
52541
52406
  });
52542
- //#endregion
52543
- //#region src/commands/agent-export-runtime.ts
52407
+ // src/commands/agent-export-runtime.ts
52544
52408
  const agentExportRuntimeCommand = new Command("export-runtime").description("Export an agent for @runtypelabs/runtime, as JSON or as a vendorable bundle zip").argument("<id>", "Agent ID").option("--alias <name>", "Export the version the agent's release alias points at").option("--version-id <id>", "Export this published agent version").option("--format <format>", "json (the definition) or bundle (definition + prebuilt runtime zip)", "json").option("--output <path>", "Write to this file (bundle default: the server-provided file name)").action(async (id, options) => {
52545
52409
  if (options.format !== "json" && options.format !== "bundle") {
52546
52410
  console.error(chalk.red(`Error: unknown --format "${options.format}". Must be json or bundle.`));
@@ -52579,8 +52443,7 @@ const agentExportRuntimeCommand = new Command("export-runtime").description("Exp
52579
52443
  process.exit(1);
52580
52444
  }
52581
52445
  });
52582
- //#endregion
52583
- //#region src/commands/agents.ts
52446
+ // src/commands/agents.ts
52584
52447
  const agentsCommand = new Command("agents").description("Manage agents");
52585
52448
  agentsCommand.addCommand(taskCommand);
52586
52449
  agentsCommand.addCommand(agentAliasesCommand);
@@ -52960,8 +52823,7 @@ addExecutionInputOptions(agentsCommand.command("execute <id>").description("Exec
52960
52823
  return options.stream ? client.agents.executeStream(id, payload) : client.agents.execute(id, payload);
52961
52824
  }, "agent");
52962
52825
  });
52963
- //#endregion
52964
- //#region src/commands/models.ts
52826
+ // src/commands/models.ts
52965
52827
  const modelsCommand = new Command("models").description("Manage model configurations");
52966
52828
  modelsCommand.command("list").description("List your enabled model configurations").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
52967
52829
  const apiKey = await ensureAuth();
@@ -53251,8 +53113,7 @@ modelsCommand.command("usage").description("Show model usage statistics").option
53251
53113
  process.exit(1);
53252
53114
  }
53253
53115
  });
53254
- //#endregion
53255
- //#region src/commands/schedules.ts
53116
+ // src/commands/schedules.ts
53256
53117
  const schedulesCommand = new Command("schedules").description("Manage schedules");
53257
53118
  schedulesCommand.command("list").description("List all schedules").option("--limit <n>", "Limit results (defaults to the API page size)").option("--cursor <cursor>", "Pagination cursor for the next page").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
53258
53119
  const apiKey = await ensureAuth();
@@ -53784,8 +53645,7 @@ schedulesCommand.command("delete <id>").description("Delete a schedule").option(
53784
53645
  const { waitUntilExit } = render(React.createElement(App));
53785
53646
  await waitUntilExit();
53786
53647
  });
53787
- //#endregion
53788
- //#region src/lib/eval-discovery.ts
53648
+ // src/lib/eval-discovery.ts
53789
53649
  /** Suffixes that mark a file as an eval suite. */
53790
53650
  const EVAL_FILE_SUFFIXES = [".eval.ts", ".eval.mts"];
53791
53651
  /** Directories never worth walking into during discovery. */
@@ -53859,8 +53719,7 @@ async function loadEvalDefinition(filePath) {
53859
53719
  if (typeof exported !== "object" || !("target" in exported) || !("cases" in exported) || !Array.isArray(exported.cases)) throw new Error(`Eval file ${filePath} default export is not an eval definition. Export defineEval({ target, cases, ... }).`);
53860
53720
  return exported;
53861
53721
  }
53862
- //#endregion
53863
- //#region src/lib/eval-junit.ts
53722
+ // src/lib/eval-junit.ts
53864
53723
  /** XML-escape text/attribute content (the five predefined XML entities). */
53865
53724
  function escapeXml(value) {
53866
53725
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
@@ -53893,8 +53752,7 @@ function buildJUnitXml(suites) {
53893
53752
  lines.push("</testsuites>");
53894
53753
  return lines.join("\n") + "\n";
53895
53754
  }
53896
- //#endregion
53897
- //#region src/commands/eval.ts
53755
+ // src/commands/eval.ts
53898
53756
  const evalCommand = new Command("eval").description("Manage evaluations");
53899
53757
  evalCommand.command("submit").description("Submit an eval batch").requiredOption("-f, --flow <id>", "Flow ID to evaluate").requiredOption("-r, --records <file>", "JSON file with record IDs").option("-n, --name <name>", "Eval batch name").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
53900
53758
  const apiKey = await ensureAuth();
@@ -54414,8 +54272,7 @@ async function writeApiKeyFile(file, options = {}) {
54414
54272
  usageHint: apiKeyFileUsageHint(targetPath)
54415
54273
  };
54416
54274
  }
54417
- //#endregion
54418
- //#region src/lib/api-key-request-flow.ts
54275
+ // src/lib/api-key-request-flow.ts
54419
54276
  var ApiKeyRequestError = class extends Error {
54420
54277
  code;
54421
54278
  resumeCommand;
@@ -54715,8 +54572,7 @@ function deliveredKeyJson(delivered) {
54715
54572
  nextSteps: delivered.nextSteps
54716
54573
  };
54717
54574
  }
54718
- //#endregion
54719
- //#region src/commands/api-keys-requests.ts
54575
+ // src/commands/api-keys-requests.ts
54720
54576
  /**
54721
54577
  * `runtype api-keys request` and `runtype api-keys claim` are the CLI half of the agent key-request ceremony.
54722
54578
  * `request` files the request, hands a human the approval URL, polls, and redeems.
@@ -55003,8 +54859,7 @@ async function claimWithoutLogin(args) {
55003
54859
  });
55004
54860
  return deliverClaimedKey(args.json ? await redeem(() => {}) : await withSpinner(args.useInk && args.wait, "Redeeming without a login...", redeem), delivery);
55005
54861
  }
55006
- //#endregion
55007
- //#region src/commands/api-keys.ts
54862
+ // src/commands/api-keys.ts
55008
54863
  /** Best-effort org id for the key file; provenance only, never authorization. */
55009
54864
  async function storedOrganizationId() {
55010
54865
  try {
@@ -55505,8 +55360,7 @@ apiKeysCommand.command("analytics").description("Show API key usage analytics").
55505
55360
  await waitUntilExit();
55506
55361
  });
55507
55362
  registerApiKeyRequestCommands(apiKeysCommand);
55508
- //#endregion
55509
- //#region src/commands/client-tokens.ts
55363
+ // src/commands/client-tokens.ts
55510
55364
  const clientTokensCommand = new Command("client-tokens").description("Manage client tokens for Persona widget embedding");
55511
55365
  clientTokensCommand.command("list").description("List your client tokens").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
55512
55366
  const apiKey = await ensureAuth();
@@ -55996,10 +55850,9 @@ clientTokensCommand.command("regenerate <id>").description("Regenerate a client
55996
55850
  await waitUntilExit();
55997
55851
  });
55998
55852
  clientTokensCommand.addCommand(clientTokenEnsureCommand);
55999
- //#endregion
56000
- //#region ../../node_modules/.pnpm/@runtypelabs+persona@4.29.2/node_modules/@runtypelabs/persona/dist/codegen.js
55853
+ // ../../node_modules/.pnpm/@runtypelabs+persona@4.33.0/node_modules/@runtypelabs/persona/dist/codegen.js
56001
55854
  function e(e) {
56002
- return e?.cdnBase?.trim().replace(/\/+$/, ``).replace(/[\\'"<>`]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2, `0`)}`) || `https://cdn.jsdelivr.net/npm/@runtypelabs/persona@4.29.2/dist`;
55855
+ return e?.cdnBase?.trim().replace(/\/+$/, ``).replace(/[\\'"<>`]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2, `0`)}`) || `https://cdn.jsdelivr.net/npm/@runtypelabs/persona@4.33.0/dist`;
56003
55856
  }
56004
55857
  function t(e) {
56005
55858
  if (e !== void 0) return typeof e == `string` ? e : Array.isArray(e) ? `[${e.map((e) => e.toString()).join(`, `)}]` : e.toString();
@@ -56137,41 +55990,106 @@ function m(e, t) {
56137
55990
  let n = [];
56138
55991
  return e && (e.getHeaders && n.push(`${t}getHeaders: ${e.getHeaders},`), e.requestMiddleware && n.push(`${t}requestMiddleware: ${e.requestMiddleware},`), e.actionParsers && n.push(`${t}actionParsers: ${e.actionParsers},`), e.actionHandlers && n.push(`${t}actionHandlers: ${e.actionHandlers},`), e.contextProviders && n.push(`${t}contextProviders: ${e.contextProviders},`), e.streamParser && n.push(`${t}streamParser: ${e.streamParser},`)), n;
56139
55992
  }
56140
- function h(e, t, n) {
55993
+ function h(e, t) {
55994
+ return JSON.stringify(e, null, t).replace(/</g, `\\u003c`).replace(/\u2028/g, `\\u2028`).replace(/\u2029/g, `\\u2029`);
55995
+ }
55996
+ function g(e, t, n) {
56141
55997
  Object.entries(t).forEach(([t, r]) => {
56142
- r !== void 0 && typeof r != `function` && (Array.isArray(r) ? e.push(`${n}${t}: ${JSON.stringify(r)},`) : r && typeof r == `object` ? (e.push(`${n}${t}: {`), h(e, r, `${n} `), e.push(`${n}},`)) : e.push(`${n}${t}: ${JSON.stringify(r)},`));
55998
+ if (r === void 0 || typeof r == `function`) return;
55999
+ let i = /^[a-zA-Z_$][\w$]*$/.test(t) ? t : h(t);
56000
+ Array.isArray(r) ? e.push(`${n}${i}: ${h(r)},`) : r && typeof r == `object` ? (e.push(`${n}${i}: {`), g(e, r, `${n} `), e.push(`${n}},`)) : e.push(`${n}${i}: ${h(r)},`);
56143
56001
  });
56144
56002
  }
56145
- function g(e, t, n, r) {
56146
- n && (e.push(`${r}${t}: {`), h(e, n, `${r} `), e.push(`${r}},`));
56003
+ function _(e, t, n, r) {
56004
+ n && (e.push(`${r}${t}: {`), g(e, n, `${r} `), e.push(`${r}},`));
56005
+ }
56006
+ function v(e, t, n) {
56007
+ _(e, `copy`, t.copy, n), _(e, `welcome`, t.welcome, n), t.approval === !1 ? e.push(`${n}approval: false,`) : _(e, `approval`, t.approval, n);
56147
56008
  }
56148
- function _(e, t, n) {
56149
- t.future?.v5Defaults !== void 0 && e.push(`${n}future: { v5Defaults: ${t.future.v5Defaults === !0} },`);
56009
+ function y(e, t, n) {
56010
+ t.future?.v5Defaults !== void 0 && e.push(`${n}future: { v5Defaults: ${t.future.v5Defaults === !0} },`), _(e, `brand`, t.brand, n), _(e, `darkTheme`, t.darkTheme, n), t.colorScheme !== void 0 && e.push(`${n}colorScheme: ${JSON.stringify(t.colorScheme)},`);
56150
56011
  }
56151
- function v(e) {
56012
+ function b(e) {
56152
56013
  return (e?.target ?? `body`).replace(/\\/g, `\\\\`).replace(/'/g, `\\'`);
56153
56014
  }
56154
- function y(e, t = `esm`, r) {
56015
+ function x(e, t = `esm`, r) {
56016
+ if (r?.authoredOverrides) return S(e, t, r);
56155
56017
  let i = { ...e };
56156
56018
  delete i.postprocessMessage, delete i.initialMessages;
56157
56019
  let a = r ? {
56158
56020
  ...r,
56159
56021
  hooks: n(r.hooks)
56160
- } : void 0;
56161
- return t === `esm` ? b(i, a) : t === `script-installer` ? w(i, a) : t === `script-advanced` ? E(i, a) : t === `react-component` ? x(i, a) : t === `react-advanced` ? S(i, a) : T(i, a);
56162
- }
56163
- function b(e, t) {
56022
+ } : void 0, o;
56023
+ o = t === `esm` ? C(i, a) : t === `script-installer` ? D(i, a) : t === `script-advanced` ? k(i, a) : t === `react-component` ? w(i, a) : t === `react-advanced` ? T(i, a) : O(i, a);
56024
+ let s = [
56025
+ [`welcome.icon`, e.welcome?.icon],
56026
+ [`approval.formatDescription`, e.approval?.formatDescription],
56027
+ [`approval.onDecision`, e.approval?.onDecision]
56028
+ ].filter(([, e]) => typeof e == `function`).map(([e]) => e);
56029
+ if (s.length === 0) return o;
56030
+ let c = `Function-valued ${s.join(`, `)} omitted; reattach in host JavaScript.`;
56031
+ return t.startsWith(`script-`) ? `<!-- ${c} -->\n${o}` : `// ${c}\n${o}`;
56032
+ }
56033
+ function S(t, r, i) {
56034
+ let a = [], o = Symbol(`omit`), s = /* @__PURE__ */ new Set([
56035
+ `storageAdapter`,
56036
+ `targetProviders`,
56037
+ `components`,
56038
+ `voiceRecognition.provider`,
56039
+ `voiceRecognition.provider.custom`
56040
+ ]), c = (e) => typeof e == `function` || !!e && typeof e == `object` && Object.values(e).some(c), l = (e, t) => {
56041
+ if (typeof e == `function` || typeof e == `symbol` || e === void 0) return a.push(t), o;
56042
+ if (!e || typeof e != `object`) return e;
56043
+ if (s.has(t) && c(e) || !Array.isArray(e) && Object.getPrototypeOf(e) !== Object.prototype) return a.push(t), o;
56044
+ if (Array.isArray(e)) {
56045
+ let n = e.map((e, n) => l(e, `${t}.${n}`));
56046
+ return n.includes(o) ? (a.push(t), o) : n;
56047
+ }
56048
+ return Object.fromEntries(Object.entries(e).flatMap(([e, n]) => {
56049
+ let r = l(n, t ? `${t}.${e}` : e);
56050
+ return r === o ? [] : [[e, r]];
56051
+ }));
56052
+ }, u = l(t, ``), d = n(i.hooks), f = r === `script-installer`, p = h(u, 2);
56053
+ if (d) {
56054
+ let e = m(d, ` `);
56055
+ d.postprocessMessage && e.push(` postprocessMessage: ${d.postprocessMessage},`);
56056
+ let t = [`onFeedback`, `onCopy`];
56057
+ if (t.some((e) => d[e])) {
56058
+ if (!f) {
56059
+ let e = { ...u };
56060
+ delete e.messageActions, p = h(e, 2);
56061
+ }
56062
+ e.push(` messageActions: {`), e.push(...Object.entries(u.messageActions ?? {}).map(([e, t]) => ` ${h(e)}: ${h(t)},`));
56063
+ for (let n of t) d[n] && e.push(` ${n}: ${d[n]},`);
56064
+ e.push(` },`);
56065
+ }
56066
+ if (f) a.push(...Object.keys(d).map((e) => `hooks.${e}`));
56067
+ else if (e.length) {
56068
+ let t = p.slice(1, -1).trim();
56069
+ p = `{\n${t}${t ? `,` : ``}\n${e.join(`
56070
+ `)}\n}`;
56071
+ }
56072
+ }
56073
+ r.startsWith(`script-`) && (p = p.replace(/<\/script/gi, `<\\/script`));
56074
+ let g, _ = h(i.target ?? `body`), v = i.windowKey ? `, windowKey: ${h(i.windowKey)}` : ``, y = e(i);
56075
+ if (g = f ? `<script src="${y}/install.global.js" data-config='${h(i.target || i.windowKey ? {
56076
+ config: u,
56077
+ ...i.target ? { target: i.target } : {},
56078
+ ...i.windowKey ? { windowKey: i.windowKey } : {}
56079
+ } : u).replace(/&/g, `&amp;`).replace(/'/g, `&#39;`).replace(/"/g, `&quot;`)}'><\/script>` : r.startsWith(`script-`) ? `<link rel="stylesheet" href="${y}/widget.css" />\n<script src="${y}/index.global.js"><\/script>\n<script>\nvar config = ${p};\nvar handle = window.AgentWidget.initAgentWidget({ target: ${_}${v}, config });\n<\/script>` : r.startsWith(`react-`) ? `'use client';\nimport { useEffect } from 'react';\nimport '@runtypelabs/persona/widget.css';\nimport { initAgentWidget } from '@runtypelabs/persona';\n\nexport function ChatWidget() {\n useEffect(() => {\n const handle = initAgentWidget({ target: ${_}${v}, config: ${p} });\n return () => handle.destroy();\n }, []);\n return null;\n}` : `import '@runtypelabs/persona/widget.css';\nimport { initAgentWidget } from '@runtypelabs/persona';\n\ninitAgentWidget({ target: ${_}${v}, config: ${p} });`, !a.length) return g;
56080
+ let b = `Omitted non-serializable inputs: ${[...new Set(a)].join(`, `)}. Reattach functions/custom implementations in host JavaScript; closures cannot be reconstructed.`;
56081
+ return r.startsWith(`script-`) ? `<!-- ${b.replace(/--/g, `—`).replace(/</g, `&lt;`).replace(/>/g, `&gt;`)} -->\n${g}` : `// ${b.replace(/[\r\n\u2028\u2029]/g, ` `)}\n${g}`;
56082
+ }
56083
+ function C(e, t) {
56164
56084
  let n = t?.hooks, r = c(e), i = r !== `plain`, a = [
56165
56085
  `import '@runtypelabs/persona/widget.css';`,
56166
56086
  `import { initAgentWidget, markdownPostprocessor } from '@runtypelabs/persona';`,
56167
56087
  ``,
56168
56088
  `initAgentWidget({`,
56169
- ` target: '${v(t)}',`,
56089
+ ` target: '${b(t)}',`,
56170
56090
  ` config: {`
56171
56091
  ];
56172
- return e.apiUrl && a.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && a.push(` clientToken: "${e.clientToken}",`), e.agentId && a.push(` agentId: "${e.agentId}",`), e.target && a.push(` target: "${e.target}",`), e.flowId && a.push(` flowId: "${e.flowId}",`), i && a.push(` parserType: "${r}",`), _(a, e, ` `), e.theme && typeof e.theme == `object` && Object.keys(e.theme).length > 0 && g(a, `theme`, e.theme, ` `), e.launcher && g(a, `launcher`, e.launcher, ` `), e.copy && (a.push(` copy: {`), Object.entries(e.copy).forEach(([e, t]) => {
56173
- a.push(` ${e}: "${t}",`);
56174
- }), a.push(` },`)), e.sendButton && (a.push(` sendButton: {`), Object.entries(e.sendButton).forEach(([e, t]) => {
56092
+ return e.apiUrl && a.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && a.push(` clientToken: "${e.clientToken}",`), e.agentId && a.push(` agentId: "${e.agentId}",`), e.target && a.push(` target: "${e.target}",`), e.flowId && a.push(` flowId: "${e.flowId}",`), i && a.push(` parserType: "${r}",`), y(a, e, ` `), e.theme && typeof e.theme == `object` && Object.keys(e.theme).length > 0 && _(a, `theme`, e.theme, ` `), e.launcher && _(a, `launcher`, e.launcher, ` `), v(a, e, ` `), e.sendButton && (a.push(` sendButton: {`), Object.entries(e.sendButton).forEach(([e, t]) => {
56175
56093
  typeof t == `string` ? a.push(` ${e}: "${t}",`) : typeof t == `boolean` && a.push(` ${e}: ${t},`);
56176
56094
  }), a.push(` },`)), e.voiceRecognition && (a.push(` voiceRecognition: {`), Object.entries(e.voiceRecognition).forEach(([e, t]) => {
56177
56095
  typeof t == `string` ? a.push(` ${e}: "${t}",`) : (typeof t == `boolean` || typeof t == `number`) && a.push(` ${e}: ${t},`);
@@ -56184,7 +56102,7 @@ function b(e, t) {
56184
56102
  }), a.push(` ],`)), e.suggestionChipsConfig && (a.push(` suggestionChipsConfig: {`), e.suggestionChipsConfig.fontFamily && a.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && a.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && a.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && a.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), a.push(` },`)), a.push(...l(e, ` `)), a.push(...u(e, ` `, n)), a.push(...d(e, ` `)), a.push(...p(e, ` `)), a.push(...m(n, ` `)), e.debug && a.push(` debug: ${e.debug},`), n?.postprocessMessage ? a.push(` postprocessMessage: ${n.postprocessMessage}`) : a.push(` postprocessMessage: ({ text }) => markdownPostprocessor(text)`), a.push(` }`), a.push(`});`), a.join(`
56185
56103
  `);
56186
56104
  }
56187
- function x(e, t) {
56105
+ function w(e, t) {
56188
56106
  let n = t?.hooks, r = c(e), i = r !== `plain`, a = [
56189
56107
  `// ChatWidget.tsx`,
56190
56108
  `'use client'; // Required for Next.js - remove for Vite/CRA`,
@@ -56199,12 +56117,10 @@ function x(e, t) {
56199
56117
  ` let handle: AgentWidgetInitHandle | null = null;`,
56200
56118
  ``,
56201
56119
  ` handle = initAgentWidget({`,
56202
- ` target: '${v(t)}',`,
56120
+ ` target: '${b(t)}',`,
56203
56121
  ` config: {`
56204
56122
  ];
56205
- return e.apiUrl && a.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && a.push(` clientToken: "${e.clientToken}",`), e.agentId && a.push(` agentId: "${e.agentId}",`), e.target && a.push(` target: "${e.target}",`), e.flowId && a.push(` flowId: "${e.flowId}",`), i && a.push(` parserType: "${r}",`), _(a, e, ` `), e.theme && typeof e.theme == `object` && Object.keys(e.theme).length > 0 && g(a, `theme`, e.theme, ` `), e.launcher && g(a, `launcher`, e.launcher, ` `), e.copy && (a.push(` copy: {`), Object.entries(e.copy).forEach(([e, t]) => {
56206
- a.push(` ${e}: "${t}",`);
56207
- }), a.push(` },`)), e.sendButton && (a.push(` sendButton: {`), Object.entries(e.sendButton).forEach(([e, t]) => {
56123
+ return e.apiUrl && a.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && a.push(` clientToken: "${e.clientToken}",`), e.agentId && a.push(` agentId: "${e.agentId}",`), e.target && a.push(` target: "${e.target}",`), e.flowId && a.push(` flowId: "${e.flowId}",`), i && a.push(` parserType: "${r}",`), y(a, e, ` `), e.theme && typeof e.theme == `object` && Object.keys(e.theme).length > 0 && _(a, `theme`, e.theme, ` `), e.launcher && _(a, `launcher`, e.launcher, ` `), v(a, e, ` `), e.sendButton && (a.push(` sendButton: {`), Object.entries(e.sendButton).forEach(([e, t]) => {
56208
56124
  typeof t == `string` ? a.push(` ${e}: "${t}",`) : typeof t == `boolean` && a.push(` ${e}: ${t},`);
56209
56125
  }), a.push(` },`)), e.voiceRecognition && (a.push(` voiceRecognition: {`), Object.entries(e.voiceRecognition).forEach(([e, t]) => {
56210
56126
  typeof t == `string` ? a.push(` ${e}: "${t}",`) : (typeof t == `boolean` || typeof t == `number`) && a.push(` ${e}: ${t},`);
@@ -56217,7 +56133,7 @@ function x(e, t) {
56217
56133
  }), a.push(` ],`)), e.suggestionChipsConfig && (a.push(` suggestionChipsConfig: {`), e.suggestionChipsConfig.fontFamily && a.push(` fontFamily: "${e.suggestionChipsConfig.fontFamily}",`), e.suggestionChipsConfig.fontWeight && a.push(` fontWeight: "${e.suggestionChipsConfig.fontWeight}",`), e.suggestionChipsConfig.paddingX && a.push(` paddingX: "${e.suggestionChipsConfig.paddingX}",`), e.suggestionChipsConfig.paddingY && a.push(` paddingY: "${e.suggestionChipsConfig.paddingY}",`), a.push(` },`)), a.push(...l(e, ` `)), a.push(...u(e, ` `, n)), a.push(...d(e, ` `)), a.push(...p(e, ` `)), a.push(...m(n, ` `)), e.debug && a.push(` debug: ${e.debug},`), n?.postprocessMessage ? a.push(` postprocessMessage: ${n.postprocessMessage}`) : a.push(` postprocessMessage: ({ text }) => markdownPostprocessor(text)`), a.push(` }`), a.push(` });`), a.push(``), a.push(` // Cleanup on unmount`), a.push(` return () => {`), a.push(` if (handle) {`), a.push(` handle.destroy();`), a.push(` }`), a.push(` };`), a.push(` }, []);`), a.push(``), a.push(` return null; // Widget injects itself into the DOM`), a.push(`}`), a.push(``), a.push(`// Usage in your app:`), a.push(`// import { ChatWidget } from './components/ChatWidget';`), a.push(`//`), a.push(`// export default function App() {`), a.push(`// return (`), a.push(`// <div>`), a.push(`// {/* Your app content */}`), a.push(`// <ChatWidget />`), a.push(`// </div>`), a.push(`// );`), a.push(`// }`), a.join(`
56218
56134
  `);
56219
56135
  }
56220
- function S(e, t) {
56136
+ function T(e, t) {
56221
56137
  let n = t?.hooks, i = [
56222
56138
  `// ChatWidgetAdvanced.tsx`,
56223
56139
  `'use client'; // Required for Next.js - remove for Vite/CRA`,
@@ -56330,12 +56246,10 @@ function S(e, t) {
56330
56246
  ` };`,
56331
56247
  ``,
56332
56248
  ` handle = initAgentWidget({`,
56333
- ` target: '${v(t)}',`,
56249
+ ` target: '${b(t)}',`,
56334
56250
  ` config: {`
56335
56251
  ];
56336
- return e.apiUrl && i.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && i.push(` clientToken: "${e.clientToken}",`), e.agentId && i.push(` agentId: "${e.agentId}",`), e.target && i.push(` target: "${e.target}",`), e.flowId && i.push(` flowId: "${e.flowId}",`), _(i, e, ` `), e.theme && typeof e.theme == `object` && Object.keys(e.theme).length > 0 && g(i, `theme`, e.theme, ` `), e.launcher && g(i, `launcher`, e.launcher, ` `), e.copy && (i.push(` copy: {`), Object.entries(e.copy).forEach(([e, t]) => {
56337
- i.push(` ${e}: "${t}",`);
56338
- }), i.push(` },`)), e.sendButton && (i.push(` sendButton: {`), Object.entries(e.sendButton).forEach(([e, t]) => {
56252
+ return e.apiUrl && i.push(` apiUrl: "${e.apiUrl}",`), e.clientToken && i.push(` clientToken: "${e.clientToken}",`), e.agentId && i.push(` agentId: "${e.agentId}",`), e.target && i.push(` target: "${e.target}",`), e.flowId && i.push(` flowId: "${e.flowId}",`), y(i, e, ` `), e.theme && typeof e.theme == `object` && Object.keys(e.theme).length > 0 && _(i, `theme`, e.theme, ` `), e.launcher && _(i, `launcher`, e.launcher, ` `), v(i, e, ` `), e.sendButton && (i.push(` sendButton: {`), Object.entries(e.sendButton).forEach(([e, t]) => {
56339
56253
  typeof t == `string` ? i.push(` ${e}: "${t}",`) : typeof t == `boolean` && i.push(` ${e}: ${t},`);
56340
56254
  }), i.push(` },`)), e.voiceRecognition && (i.push(` voiceRecognition: {`), Object.entries(e.voiceRecognition).forEach(([e, t]) => {
56341
56255
  typeof t == `string` ? i.push(` ${e}: "${t}",`) : (typeof t == `boolean` || typeof t == `number`) && i.push(` ${e}: ${t},`);
@@ -56354,9 +56268,9 @@ function S(e, t) {
56354
56268
  }),`)), n?.actionParsers ? (i.push(` // Action parsers (custom merged with defaults)`), i.push(` actionParsers: [...(${n.actionParsers}), defaultJsonActionParser,`), i.push(` // Built-in parser for markdown-wrapped JSON`), i.push(` ${r}`), i.push(` ],`)) : (i.push(` // Action parsers to detect JSON actions in responses`), i.push(` actionParsers: [`), i.push(` defaultJsonActionParser,`), i.push(` // Parser for markdown-wrapped JSON`), i.push(` ${r}`), i.push(` ],`)), n?.actionHandlers ? (i.push(` // Action handlers (custom merged with defaults)`), i.push(` actionHandlers: [...(${n.actionHandlers}),`), i.push(` defaultActionHandlers.message,`), i.push(` defaultActionHandlers.messageAndClick,`), i.push(` // Built-in handler for nav_then_click action`), i.push(` ${a}`), i.push(` ],`)) : (i.push(` // Action handlers for navigation and other actions`), i.push(` actionHandlers: [`), i.push(` defaultActionHandlers.message,`), i.push(` defaultActionHandlers.messageAndClick,`), i.push(` // Handler for nav_then_click action`), i.push(` ${a}`), i.push(` ],`)), n?.postprocessMessage ? i.push(` postprocessMessage: ${n.postprocessMessage},`) : i.push(` postprocessMessage: ({ text }) => markdownPostprocessor(text),`), n?.requestMiddleware ? (i.push(` // Request middleware (custom merged with DOM context)`), i.push(` requestMiddleware: ({ payload, config }) => {`), i.push(` const customResult = (${n.requestMiddleware})({ payload, config });`), i.push(` const merged = customResult || payload;`), i.push(` return {`), i.push(` ...merged,`), i.push(` metadata: { ...merged.metadata, ...collectDOMContext() }`), i.push(` };`), i.push(` }`)) : (i.push(` requestMiddleware: ({ payload }) => {`), i.push(` return {`), i.push(` ...payload,`), i.push(` metadata: collectDOMContext()`), i.push(` };`), i.push(` }`)), i.push(` }`), i.push(` });`), i.push(``), i.push(` // Save state on message events`), i.push(` const handleMessage = () => {`), i.push(` const session = handle?.getSession?.();`), i.push(` if (session) {`), i.push(` localStorage.setItem(STORAGE_KEY, JSON.stringify({`), i.push(` messages: session.messages,`), i.push(` timestamp: new Date().toISOString()`), i.push(` }));`), i.push(` }`), i.push(` };`), i.push(``), i.push(` // Clear state on clear chat`), i.push(` const handleClearChat = () => {`), i.push(` localStorage.removeItem(STORAGE_KEY);`), i.push(` localStorage.removeItem(PROCESSED_ACTIONS_KEY);`), i.push(` };`), i.push(``), i.push(` window.addEventListener('persona:message', handleMessage);`), i.push(` window.addEventListener('persona:clear-chat', handleClearChat);`), i.push(``), i.push(` // Cleanup on unmount`), i.push(` return () => {`), i.push(` window.removeEventListener('persona:message', handleMessage);`), i.push(` window.removeEventListener('persona:clear-chat', handleClearChat);`), i.push(` if (handle) {`), i.push(` handle.destroy();`), i.push(` }`), i.push(` };`), i.push(` }, []);`), i.push(``), i.push(` return null; // Widget injects itself into the DOM`), i.push(`}`), i.push(``), i.push(`// Usage: Collects DOM context for AI-powered navigation`), i.push(`// Features:`), i.push(`// - Extracts page elements (products, buttons, links)`), i.push(`// - Persists chat history across page loads`), i.push(`// - Handles navigation actions (nav_then_click)`), i.push(`// - Processes structured JSON actions from AI`), i.push(`//`), i.push(`// Example usage in Next.js:`), i.push(`// import { ChatWidgetAdvanced } from './components/ChatWidgetAdvanced';`), i.push(`//`), i.push(`// export default function RootLayout({ children }) {`), i.push(`// return (`), i.push(`// <html lang="en">`), i.push(`// <body>`), i.push(`// {children}`), i.push(`// <ChatWidgetAdvanced />`), i.push(`// </body>`), i.push(`// </html>`), i.push(`// );`), i.push(`// }`), i.join(`
56355
56269
  `);
56356
56270
  }
56357
- function C(e) {
56271
+ function E(e) {
56358
56272
  let t = c(e), n = t !== `plain`, r = {};
56359
- if (e.apiUrl && (r.apiUrl = e.apiUrl), e.clientToken && (r.clientToken = e.clientToken), e.agentId && (r.agentId = e.agentId), e.target && (r.target = e.target), e.flowId && (r.flowId = e.flowId), n && (r.parserType = t), e.future?.v5Defaults !== void 0 && (r.future = { v5Defaults: e.future.v5Defaults === !0 }), e.theme && (r.theme = e.theme), e.launcher && (r.launcher = e.launcher), e.copy && (r.copy = e.copy), e.sendButton && (r.sendButton = e.sendButton), e.voiceRecognition && (r.voiceRecognition = e.voiceRecognition), e.statusIndicator && (r.statusIndicator = e.statusIndicator), e.features && (r.features = e.features), e.suggestions && (r.suggestions = e.suggestions), e.suggestionChips?.length > 0 && (r.suggestionChips = e.suggestionChips), e.suggestionChipsConfig && (r.suggestionChipsConfig = e.suggestionChipsConfig), e.debug && (r.debug = e.debug), e.toolCall) {
56273
+ if (e.apiUrl && (r.apiUrl = e.apiUrl), e.clientToken && (r.clientToken = e.clientToken), e.agentId && (r.agentId = e.agentId), e.target && (r.target = e.target), e.flowId && (r.flowId = e.flowId), n && (r.parserType = t), e.future?.v5Defaults !== void 0 && (r.future = { v5Defaults: e.future.v5Defaults === !0 }), e.theme && (r.theme = e.theme), e.brand && (r.brand = e.brand), e.darkTheme && (r.darkTheme = e.darkTheme), e.colorScheme !== void 0 && (r.colorScheme = e.colorScheme), e.launcher && (r.launcher = e.launcher), e.copy && (r.copy = e.copy), e.welcome !== void 0 && (r.welcome = e.welcome), e.approval !== void 0 && (r.approval = e.approval), e.sendButton && (r.sendButton = e.sendButton), e.voiceRecognition && (r.voiceRecognition = e.voiceRecognition), e.statusIndicator && (r.statusIndicator = e.statusIndicator), e.features && (r.features = e.features), e.suggestions && (r.suggestions = e.suggestions), e.suggestionChips?.length > 0 && (r.suggestionChips = e.suggestionChips), e.suggestionChipsConfig && (r.suggestionChipsConfig = e.suggestionChipsConfig), e.debug && (r.debug = e.debug), e.toolCall) {
56360
56274
  let t = {};
56361
56275
  Object.entries(e.toolCall).forEach(([e, n]) => {
56362
56276
  typeof n == `string` && (t[e] = n);
@@ -56398,15 +56312,15 @@ function C(e) {
56398
56312
  }
56399
56313
  return r;
56400
56314
  }
56401
- function w(t, n) {
56402
- let r = C(t), i = n?.windowKey || n?.target ? {
56315
+ function D(t, n) {
56316
+ let r = E(t), i = n?.windowKey || n?.target ? {
56403
56317
  config: r,
56404
56318
  ...n?.windowKey ? { windowKey: n.windowKey } : {},
56405
56319
  ...n?.target ? { target: n.target } : {}
56406
- } : r, a = JSON.stringify(i, null, 0).replace(/'/g, `&#39;`);
56320
+ } : r, a = JSON.stringify(i).replace(/&/g, `&amp;`).replace(/</g, `&lt;`).replace(/>/g, `&gt;`).replace(/'/g, `&#39;`);
56407
56321
  return `<script src="${e(n)}/install.global.js" data-config='${a}'><\/script>`;
56408
56322
  }
56409
- function T(t, n) {
56323
+ function O(t, n) {
56410
56324
  let r = n?.hooks, i = c(t), a = i !== `plain`, o = e(n), s = [
56411
56325
  `<!-- Load CSS -->`,
56412
56326
  `<link rel="stylesheet" href="${o}/widget.css" />`,
@@ -56417,13 +56331,11 @@ function T(t, n) {
56417
56331
  `<!-- Initialize widget -->`,
56418
56332
  `<script>`,
56419
56333
  ` var handle = window.AgentWidget.initAgentWidget({`,
56420
- ` target: '${v(n)}',`,
56334
+ ` target: '${b(n)}',`,
56421
56335
  ...n?.windowKey ? [` windowKey: '${n.windowKey}',`] : [],
56422
56336
  ` config: {`
56423
56337
  ];
56424
- return t.apiUrl && s.push(` apiUrl: "${t.apiUrl}",`), t.clientToken && s.push(` clientToken: "${t.clientToken}",`), t.agentId && s.push(` agentId: "${t.agentId}",`), t.target && s.push(` target: "${t.target}",`), t.flowId && s.push(` flowId: "${t.flowId}",`), a && s.push(` parserType: "${i}",`), _(s, t, ` `), t.theme && typeof t.theme == `object` && Object.keys(t.theme).length > 0 && g(s, `theme`, t.theme, ` `), t.launcher && g(s, `launcher`, t.launcher, ` `), t.copy && (s.push(` copy: {`), Object.entries(t.copy).forEach(([e, t]) => {
56425
- s.push(` ${e}: "${t}",`);
56426
- }), s.push(` },`)), t.sendButton && (s.push(` sendButton: {`), Object.entries(t.sendButton).forEach(([e, t]) => {
56338
+ return t.apiUrl && s.push(` apiUrl: "${t.apiUrl}",`), t.clientToken && s.push(` clientToken: "${t.clientToken}",`), t.agentId && s.push(` agentId: "${t.agentId}",`), t.target && s.push(` target: "${t.target}",`), t.flowId && s.push(` flowId: "${t.flowId}",`), a && s.push(` parserType: "${i}",`), y(s, t, ` `), t.theme && typeof t.theme == `object` && Object.keys(t.theme).length > 0 && _(s, `theme`, t.theme, ` `), t.launcher && _(s, `launcher`, t.launcher, ` `), v(s, t, ` `), t.sendButton && (s.push(` sendButton: {`), Object.entries(t.sendButton).forEach(([e, t]) => {
56427
56339
  typeof t == `string` ? s.push(` ${e}: "${t}",`) : typeof t == `boolean` && s.push(` ${e}: ${t},`);
56428
56340
  }), s.push(` },`)), t.voiceRecognition && (s.push(` voiceRecognition: {`), Object.entries(t.voiceRecognition).forEach(([e, t]) => {
56429
56341
  typeof t == `string` ? s.push(` ${e}: "${t}",`) : (typeof t == `boolean` || typeof t == `number`) && s.push(` ${e}: ${t},`);
@@ -56436,14 +56348,14 @@ function T(t, n) {
56436
56348
  }), s.push(` ],`)), t.suggestionChipsConfig && (s.push(` suggestionChipsConfig: {`), t.suggestionChipsConfig.fontFamily && s.push(` fontFamily: "${t.suggestionChipsConfig.fontFamily}",`), t.suggestionChipsConfig.fontWeight && s.push(` fontWeight: "${t.suggestionChipsConfig.fontWeight}",`), t.suggestionChipsConfig.paddingX && s.push(` paddingX: "${t.suggestionChipsConfig.paddingX}",`), t.suggestionChipsConfig.paddingY && s.push(` paddingY: "${t.suggestionChipsConfig.paddingY}",`), s.push(` },`)), s.push(...l(t, ` `)), s.push(...u(t, ` `, r)), s.push(...d(t, ` `)), s.push(...p(t, ` `)), s.push(...m(r, ` `)), t.debug && s.push(` debug: ${t.debug},`), r?.postprocessMessage ? s.push(` postprocessMessage: ${r.postprocessMessage}`) : s.push(` postprocessMessage: ({ text }) => window.AgentWidget.markdownPostprocessor(text)`), s.push(` }`), s.push(` });`), s.push(`<\/script>`), s.join(`
56437
56349
  `);
56438
56350
  }
56439
- function E(t, n) {
56440
- let r = n?.hooks, a = C(t), s = [
56351
+ function k(t, n) {
56352
+ let r = n?.hooks, a = [
56441
56353
  `<script>`,
56442
56354
  `(function() {`,
56443
56355
  ` 'use strict';`,
56444
56356
  ``,
56445
56357
  ` // Configuration`,
56446
- ` var CONFIG = ${JSON.stringify(a, null, 2).split(`
56358
+ ` var CONFIG = ${h(E(t), 2).split(`
56447
56359
  `).map((e, t) => t === 0 ? e : ` ` + e).join(`
56448
56360
  `)};`,
56449
56361
  ``,
@@ -56530,17 +56442,16 @@ function E(t, n) {
56530
56442
  ` var widgetConfig = Object.assign({}, CONFIG);`,
56531
56443
  ``
56532
56444
  ];
56533
- return r?.getHeaders && (s.push(` widgetConfig.getHeaders = ${r.getHeaders};`), s.push(``)), r?.contextProviders && (s.push(` widgetConfig.contextProviders = ${r.contextProviders};`), s.push(``)), r?.streamParser ? s.push(` widgetConfig.streamParser = ${r.streamParser};`) : (s.push(` // Flexible JSON stream parser for handling structured actions`), s.push(` widgetConfig.streamParser = function() {`), s.push(` return agentWidget.createFlexibleJsonStreamParser(function(parsed) {
56445
+ return r?.getHeaders && (a.push(` widgetConfig.getHeaders = ${r.getHeaders};`), a.push(``)), r?.contextProviders && (a.push(` widgetConfig.contextProviders = ${r.contextProviders};`), a.push(``)), r?.streamParser ? a.push(` widgetConfig.streamParser = ${r.streamParser};`) : (a.push(` // Flexible JSON stream parser for handling structured actions`), a.push(` widgetConfig.streamParser = function() {`), a.push(` return agentWidget.createFlexibleJsonStreamParser(function(parsed) {
56534
56446
  if (!parsed || typeof parsed !== 'object') return null;
56535
56447
  if (parsed.action === 'nav_then_click') return 'Navigating...';
56536
56448
  if (parsed.action === 'message') return parsed.text || '';
56537
56449
  if (parsed.action === 'message_and_click') return parsed.text || 'Processing...';
56538
56450
  return parsed.text || null;
56539
- });`), s.push(` };`)), s.push(``), r?.actionParsers ? (s.push(` // Action parsers (custom merged with defaults)`), s.push(` var customParsers = ${r.actionParsers};`), s.push(` widgetConfig.actionParsers = customParsers.concat([`), s.push(` agentWidget.defaultJsonActionParser,`), s.push(` ${i}`), s.push(` ]);`)) : (s.push(` // Action parsers to detect JSON actions in responses`), s.push(` widgetConfig.actionParsers = [`), s.push(` agentWidget.defaultJsonActionParser,`), s.push(` ${i}`), s.push(` ];`)), s.push(``), r?.actionHandlers ? (s.push(` // Action handlers (custom merged with defaults)`), s.push(` var customHandlers = ${r.actionHandlers};`), s.push(` widgetConfig.actionHandlers = customHandlers.concat([`), s.push(` agentWidget.defaultActionHandlers.message,`), s.push(` agentWidget.defaultActionHandlers.messageAndClick,`), s.push(` ${o}`), s.push(` ]);`)) : (s.push(` // Action handlers for navigation and other actions`), s.push(` widgetConfig.actionHandlers = [`), s.push(` agentWidget.defaultActionHandlers.message,`), s.push(` agentWidget.defaultActionHandlers.messageAndClick,`), s.push(` ${o}`), s.push(` ];`)), s.push(``), r?.requestMiddleware ? (s.push(` // Request middleware (custom merged with DOM context)`), s.push(` widgetConfig.requestMiddleware = function(ctx) {`), s.push(` var customResult = (${r.requestMiddleware})(ctx);`), s.push(` var merged = customResult || ctx.payload;`), s.push(` return Object.assign({}, merged, { metadata: Object.assign({}, merged.metadata, domContextProvider()) });`), s.push(` };`)) : (s.push(` // Send DOM context with each request`), s.push(` widgetConfig.requestMiddleware = function(ctx) {`), s.push(` return Object.assign({}, ctx.payload, { metadata: domContextProvider() });`), s.push(` };`)), s.push(``), r?.postprocessMessage ? s.push(` widgetConfig.postprocessMessage = ${r.postprocessMessage};`) : (s.push(` // Markdown postprocessor`), s.push(` widgetConfig.postprocessMessage = function(ctx) {`), s.push(` return agentWidget.markdownPostprocessor(ctx.text);`), s.push(` };`)), s.push(``), (r?.onFeedback || r?.onCopy) && (s.push(` // Message action callbacks`), s.push(` widgetConfig.messageActions = widgetConfig.messageActions || {};`), r?.onFeedback && s.push(` widgetConfig.messageActions.onFeedback = ${r.onFeedback};`), r?.onCopy && s.push(` widgetConfig.messageActions.onCopy = ${r.onCopy};`), s.push(``)), s.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: '${v(n)}',`, ` useShadowDom: false,`, ...n?.windowKey ? [` windowKey: '${n.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>`), s.join(`
56451
+ });`), a.push(` };`)), a.push(``), r?.actionParsers ? (a.push(` // Action parsers (custom merged with defaults)`), a.push(` var customParsers = ${r.actionParsers};`), a.push(` widgetConfig.actionParsers = customParsers.concat([`), a.push(` agentWidget.defaultJsonActionParser,`), a.push(` ${i}`), a.push(` ]);`)) : (a.push(` // Action parsers to detect JSON actions in responses`), a.push(` widgetConfig.actionParsers = [`), a.push(` agentWidget.defaultJsonActionParser,`), a.push(` ${i}`), a.push(` ];`)), a.push(``), r?.actionHandlers ? (a.push(` // Action handlers (custom merged with defaults)`), a.push(` var customHandlers = ${r.actionHandlers};`), a.push(` widgetConfig.actionHandlers = customHandlers.concat([`), a.push(` agentWidget.defaultActionHandlers.message,`), a.push(` agentWidget.defaultActionHandlers.messageAndClick,`), a.push(` ${o}`), a.push(` ]);`)) : (a.push(` // Action handlers for navigation and other actions`), a.push(` widgetConfig.actionHandlers = [`), a.push(` agentWidget.defaultActionHandlers.message,`), a.push(` agentWidget.defaultActionHandlers.messageAndClick,`), a.push(` ${o}`), a.push(` ];`)), a.push(``), r?.requestMiddleware ? (a.push(` // Request middleware (custom merged with DOM context)`), a.push(` widgetConfig.requestMiddleware = function(ctx) {`), a.push(` var customResult = (${r.requestMiddleware})(ctx);`), a.push(` var merged = customResult || ctx.payload;`), a.push(` return Object.assign({}, merged, { metadata: Object.assign({}, merged.metadata, domContextProvider()) });`), a.push(` };`)) : (a.push(` // Send DOM context with each request`), a.push(` widgetConfig.requestMiddleware = function(ctx) {`), a.push(` return Object.assign({}, ctx.payload, { metadata: domContextProvider() });`), a.push(` };`)), a.push(``), r?.postprocessMessage ? a.push(` widgetConfig.postprocessMessage = ${r.postprocessMessage};`) : (a.push(` // Markdown postprocessor`), a.push(` widgetConfig.postprocessMessage = function(ctx) {`), a.push(` return agentWidget.markdownPostprocessor(ctx.text);`), a.push(` };`)), a.push(``), (r?.onFeedback || r?.onCopy) && (a.push(` // Message action callbacks`), a.push(` widgetConfig.messageActions = widgetConfig.messageActions || {};`), r?.onFeedback && a.push(` widgetConfig.messageActions.onFeedback = ${r.onFeedback};`), r?.onCopy && a.push(` widgetConfig.messageActions.onCopy = ${r.onCopy};`), a.push(``)), a.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: '${b(n)}',`, ` useShadowDom: false,`, ...n?.windowKey ? [` windowKey: '${n.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>`), a.join(`
56540
56452
  `);
56541
56453
  }
56542
- //#endregion
56543
- //#region src/lib/persona-snippets.ts
56454
+ // src/lib/persona-snippets.ts
56544
56455
  /**
56545
56456
  * Map a CLI format to its real Persona generator format. Each maps to its true
56546
56457
  * equivalent: `script-manual` → Persona's CDN global-script `script-manual` (not
@@ -56571,13 +56482,14 @@ function buildWidgetConfig(input) {
56571
56482
  return {
56572
56483
  apiUrl: input.apiUrl,
56573
56484
  clientToken: input.clientToken,
56574
- parserType: "json"
56485
+ parserType: "json",
56486
+ future: { v5Defaults: true }
56575
56487
  };
56576
56488
  }
56577
56489
  function generatePersonaInitSnippet(input, personaFormat) {
56578
56490
  const widgetConfig = buildWidgetConfig(input);
56579
56491
  const target = input.targetSelector?.trim();
56580
- return y(widgetConfig, personaFormat, target ? { target } : void 0);
56492
+ return x(widgetConfig, personaFormat, target ? { target } : void 0);
56581
56493
  }
56582
56494
  /**
56583
56495
  * Return the version-pinned Persona CDN installer URL from the same generator
@@ -56585,14 +56497,13 @@ function generatePersonaInitSnippet(input, personaFormat) {
56585
56497
  * a second manually-maintained Persona version string in the CLI.
56586
56498
  */
56587
56499
  function getPersonaInstallerScriptUrl() {
56588
- return y({
56500
+ return x({
56589
56501
  apiUrl: "https://api.runtype.com",
56590
56502
  clientToken: "ct_test_demo_00000000000000000000000000000000",
56591
56503
  parserType: "json"
56592
56504
  }, "script-installer").match(/<script\s+src="([^"]+)"/)?.[1] ?? "https://cdn.jsdelivr.net/npm/@runtypelabs/persona/dist/install.global.js";
56593
56505
  }
56594
- //#endregion
56595
- //#region src/lib/persona-init.ts
56506
+ // src/lib/persona-init.ts
56596
56507
  const PERSONA_INIT_AGENT_MODEL = "nemotron-3-ultra-550b-a55b";
56597
56508
  const PERSONA_INIT_DEMO_SYSTEM_PROMPT = `
56598
56509
  # Persona Playground Agent
@@ -56748,8 +56659,7 @@ async function runPersonaInit(options) {
56748
56659
  ...demoResources ? { demo: demoResources } : {}
56749
56660
  };
56750
56661
  }
56751
- //#endregion
56752
- //#region src/lib/persona-demo.ts
56662
+ // src/lib/persona-demo.ts
56753
56663
  const PERSONA_DEMO_DEFAULT_DIR = "persona-demo";
56754
56664
  const PERSONA_DEMO_DEFAULT_PORT = 43110;
56755
56665
  const PERSONA_DEMO_TOOL_NAMES = ["get_playground_state", "update_playground"];
@@ -57322,6 +57232,7 @@ function generatePersonaDemoHtml(input) {
57322
57232
  apiUrl: demo.apiUrl,
57323
57233
  clientToken: demo.clientToken,
57324
57234
  parserType: 'json',
57235
+ future: { v5Defaults: true },
57325
57236
  launcher: {
57326
57237
  enabled: true,
57327
57238
  autoExpand: true,
@@ -57432,8 +57343,7 @@ Then open ${input.localUrl}.
57432
57343
  - Allowed origins: ${input.allowedOrigins.join(", ")}
57433
57344
  `;
57434
57345
  }
57435
- //#endregion
57436
- //#region src/commands/persona.ts
57346
+ // src/commands/persona.ts
57437
57347
  const FORMAT_CYCLE = [
57438
57348
  "script-installer",
57439
57349
  "react",
@@ -57896,8 +57806,7 @@ personaCommand.command("init").description("Create agent + client token and outp
57896
57806
  await demoServer?.close().catch(() => {});
57897
57807
  }
57898
57808
  });
57899
- //#endregion
57900
- //#region src/commands/analytics.ts
57809
+ // src/commands/analytics.ts
57901
57810
  const analyticsCommand = new Command("analytics").description("View analytics and execution results");
57902
57811
  analyticsCommand.command("stats").description("Show account statistics").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
57903
57812
  const apiKey = await ensureAuth();
@@ -58053,8 +57962,7 @@ analyticsCommand.command("results").description("List execution results").option
58053
57962
  const { waitUntilExit } = render(React.createElement(App));
58054
57963
  await waitUntilExit();
58055
57964
  });
58056
- //#endregion
58057
- //#region src/commands/billing.ts
57965
+ // src/commands/billing.ts
58058
57966
  /**
58059
57967
  * Render the execution count from `GET /v1/billing/status`.
58060
57968
  * No plan bounds an account by execution count, so this is a plain number, never a fraction.
@@ -58298,8 +58206,7 @@ billingCommand.command("refresh").description("Refresh plan data from billing pr
58298
58206
  const { waitUntilExit } = render(React.createElement(App));
58299
58207
  await waitUntilExit();
58300
58208
  });
58301
- //#endregion
58302
- //#region src/commands/flow-versions.ts
58209
+ // src/commands/flow-versions.ts
58303
58210
  const flowVersionsCommand = new Command("flow-versions").description("Manage flow versions");
58304
58211
  flowVersionsCommand.command("list <flowId>").description("List all versions for a flow").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (flowId, options) => {
58305
58212
  const apiKey = await ensureAuth();
@@ -58602,8 +58509,7 @@ flowVersionsCommand.command("publish <flowId>").description("Publish a version")
58602
58509
  const { waitUntilExit } = render(React.createElement(App));
58603
58510
  await waitUntilExit();
58604
58511
  });
58605
- //#endregion
58606
- //#region src/commands/agent-versions.ts
58512
+ // src/commands/agent-versions.ts
58607
58513
  const agentVersionsCommand = new Command("agent-versions").description("Manage agent versions");
58608
58514
  agentVersionsCommand.command("list <agentId>").description("List all versions for an agent").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (agentId, options) => {
58609
58515
  const apiKey = await ensureAuth();
@@ -58915,8 +58821,7 @@ agentVersionsCommand.command("publish <agentId>").description("Publish a version
58915
58821
  const { waitUntilExit } = render(React.createElement(App));
58916
58822
  await waitUntilExit();
58917
58823
  });
58918
- //#endregion
58919
- //#region src/commands/tail.ts
58824
+ // src/commands/tail.ts
58920
58825
  /** Show TypeID prefix + first 4 chars of suffix for compact display. */
58921
58826
  function abbreviateId(id) {
58922
58827
  const underscoreIdx = id.lastIndexOf("_");
@@ -59104,8 +59009,7 @@ async function runTail$1(options) {
59104
59009
  const tailCommand = new Command("tail").description("Stream live execution logs from the Runtype API").option("--flow <id>", "Filter by flow ID").option("--agent <id>", "Filter by agent ID").option("--surface <id>", "Filter by surface ID").option("--execution <id>", "Filter by execution ID").option("--level <level>", "Filter by level (debug/info/warn/error)").option("--category <category>", "Filter by category (execution/agent/tool/model/system/error)").option("--json", "Output raw JSON (one object per line)").option("--no-color", "Disable color output").action(async (options) => {
59105
59010
  await runTail$1(options);
59106
59011
  });
59107
- //#endregion
59108
- //#region src/commands/events.ts
59012
+ // src/commands/events.ts
59109
59013
  const LONG_POLL_WAIT_MS = PRODUCT_EVENT_MAX_WAIT_MS;
59110
59014
  const BASE_DELAY_MS = 1e3;
59111
59015
  const MAX_DELAY_MS = 3e4;
@@ -59154,6 +59058,7 @@ function buildEventsQuery(options, after) {
59154
59058
  ["surfaceId", options.surface],
59155
59059
  ["scheduleId", options.schedule],
59156
59060
  ["suiteId", options.suite],
59061
+ ["simulationId", options.simulation],
59157
59062
  ["taskId", options.task],
59158
59063
  ["key", options.key],
59159
59064
  ["onlyRegressions", options.onlyRegressions ? "true" : void 0],
@@ -59322,11 +59227,10 @@ const eventsCommand = new Command("events").description("Watch product events (f
59322
59227
  eventsCommand.command("types").description("List the product event types you can watch").option("--json", "Output as JSON").option("--no-color", "Disable color output").action(async (options) => {
59323
59228
  await runTypes(options);
59324
59229
  });
59325
- eventsCommand.command("watch").description("Long-poll product events and print one line per event").option("--name <name>", "Event type to watch (default: every type; see `runtype events types`)").option("--agent <id>", "Filter by agent ID").option("--flow <id>", "Filter by flow ID").option("--product <id>", "Filter by product ID").option("--surface <id>", "Filter by surface ID").option("--schedule <id>", "Filter by schedule ID").option("--suite <id>", "Filter by eval suite ID").option("--task <id>", "Filter by delegated task ID").option("--key <key>", "Signal events: only this signal key, such as tool_error").option("--only-regressions", "Eval runs: only those whose pass rate dropped").option("--since <cursor>", "Start after this cursor, or \"now\" (default)").option("--json", "Output NDJSON: one event object per line on stdout").option("--once", "Exit after the first poll that returns events").option("--no-color", "Disable color output").action(async (options) => {
59230
+ eventsCommand.command("watch").description("Long-poll product events and print one line per event").option("--name <name>", "Event type to watch (default: every type; see `runtype events types`)").option("--agent <id>", "Filter by agent ID").option("--flow <id>", "Filter by flow ID").option("--product <id>", "Filter by product ID").option("--surface <id>", "Filter by surface ID").option("--schedule <id>", "Filter by schedule ID").option("--suite <id>", "Filter by eval suite ID").option("--simulation <id>", "Filter by simulation ID").option("--task <id>", "Filter by delegated task ID").option("--key <key>", "Signal events: only this signal key, such as tool_error").option("--only-regressions", "Eval runs: only those whose pass rate dropped").option("--since <cursor>", "Start after this cursor, or \"now\" (default)").option("--json", "Output NDJSON: one event object per line on stdout").option("--once", "Exit after the first poll that returns events").option("--no-color", "Disable color output").action(async (options) => {
59326
59231
  await runWatch(options);
59327
59232
  });
59328
- //#endregion
59329
- //#region src/commands/validate-product.ts
59233
+ // src/commands/validate-product.ts
59330
59234
  function createValidateProductCommand() {
59331
59235
  return new Command("validate-product").description("Validate a product (FPO) or FPO template locally (no API call)").argument("[input]", "Path to JSON file, raw JSON string (starts with \"{\"), or \"-\" for stdin").option("--template", "Force FPO template validation").option("--fpo", "Force FPO (non-template) validation").addOption(new Option("--json", "Output the full validation result as JSON").default(void 0)).option("-q, --quiet", "Suppress output; rely on exit code only").addHelpText("after", `\nExamples:\n $ runtype validate-product ./my-product.json\n $ runtype validate-product '{"version":"1.0",...}'\n $ cat template.json | runtype validate-product -\n $ runtype validate-product ./tpl.json --template --json\n\nExit codes:\n 0 Valid (no errors)\n 1 Invalid (errors present) or input/IO failure\n`).action(runValidateAction);
59332
59236
  }
@@ -59445,8 +59349,7 @@ function printIssues(title, issues, color) {
59445
59349
  if (issue.suggestedFix) console.log(` ${chalk.gray("fix:")} ${issue.suggestedFix}`);
59446
59350
  }
59447
59351
  }
59448
- //#endregion
59449
- //#region src/lib/skills-install.ts
59352
+ // src/lib/skills-install.ts
59450
59353
  /**
59451
59354
  * Detects AI coding agents on the machine and installs Runtype's agent skills into their global skills directories.
59452
59355
  * The heavy lifting is delegated to `rosie-skills`; this is the thin Runtype orchestration layer, mirroring wrangler's equivalent.
@@ -59655,8 +59558,7 @@ async function maybeOfferSkillsInstall() {
59655
59558
  await runSkillsInstall(agents, { accepted: true });
59656
59559
  } catch {}
59657
59560
  }
59658
- //#endregion
59659
- //#region src/commands/skills.ts
59561
+ // src/commands/skills.ts
59660
59562
  const skillsCommand = new Command("skills").description("Install Runtype agent skills into your AI coding agents (Claude Code, Cursor, Codex, …)");
59661
59563
  skillsCommand.command("list").description("List AI coding agents detected on this machine").option("--json", "Structured JSON output").action(async (options, cmd) => {
59662
59564
  const globals = cmd.optsWithGlobals();
@@ -59751,8 +59653,7 @@ skillsCommand.command("install").description(`Install Runtype skills (${SKILLS_R
59751
59653
  }
59752
59654
  if (hadFailure) process.exit(1);
59753
59655
  });
59754
- //#endregion
59755
- //#region src/lib/mcp-install.ts
59656
+ // src/lib/mcp-install.ts
59756
59657
  const RUNTYPE_MCP_NAME = "runtype";
59757
59658
  const RUNTYPE_MCP_URL = "https://api.runtype.com/v1/mcp/protocol";
59758
59659
  const SUPPORTED_MCP_AGENTS = [
@@ -60284,8 +60185,7 @@ async function selectAgent(options, tty) {
60284
60185
  description: "user-level MCP configuration"
60285
60186
  })), { promptLabel: "Agent" });
60286
60187
  }
60287
- //#endregion
60288
- //#region src/commands/install-mcp.ts
60188
+ // src/commands/install-mcp.ts
60289
60189
  async function installSkillsForAgent(agent, jsonMode) {
60290
60190
  const rosieId = getMcpSkillsAgentId(agent);
60291
60191
  try {
@@ -60405,8 +60305,7 @@ const installMcpCommand = new Command("install-mcp").description("Install Runtyp
60405
60305
  }
60406
60306
  if (partial) process.exitCode = 1;
60407
60307
  });
60408
- //#endregion
60409
- //#region ../shared/dist/agent-onboarding-content.mjs
60308
+ // ../shared/dist/agent-onboarding-content.mjs
60410
60309
  const AGENT_ONBOARDING_MARKDOWN = `# Runtype for Coding Agents
60411
60310
 
60412
60311
  Use this guide when the user asks to connect their coding harness to Runtype. If they only ask what Runtype does, explain it without installing software or creating an account. During setup, use the CLI until the hosted MCP tools are available.
@@ -60536,8 +60435,7 @@ Docs: [docs.runtype.com](https://docs.runtype.com)
60536
60435
  Dashboard: [use.runtype.com](https://use.runtype.com)
60537
60436
  API: [api.runtype.com](https://api.runtype.com)
60538
60437
  `;
60539
- //#endregion
60540
- //#region src/commands/onboard.ts
60438
+ // src/commands/onboard.ts
60541
60439
  const AUTH_LOGIN_INSTRUCTION = "Sign in to Runtype first. New account: `runtype auth register --email <email>` then `runtype auth verify <code>`. Existing account: `runtype auth login --api-key <key>` (or set RUNTYPE_API_KEY). Then re-run `runtype onboard`.";
60542
60440
  const AFTER_RESTART_STEPS = [
60543
60441
  "Use the Runtype MCP server first for all Runtype work.",
@@ -60754,8 +60652,7 @@ function createOnboardCommand(overrides = {}) {
60754
60652
  });
60755
60653
  }
60756
60654
  const onboardCommand = createOnboardCommand();
60757
- //#endregion
60758
- //#region src/commands/apps.ts
60655
+ // src/commands/apps.ts
60759
60656
  const appsCommand = new Command("apps").description("Manage Runtype Apps (hosted AI apps on *.runtype.run)");
60760
60657
  const MANIFEST_FILENAME = "runtype.app.json";
60761
60658
  /** Walk a directory into a zippable map of relative paths, skipping dotfiles. */
@@ -60962,8 +60859,7 @@ appsCommand.command("delete <appId>").description("Permanently delete an app, it
60962
60859
  fail$1(`Delete failed: ${error instanceof Error ? error.message : String(error)}`, jsonMode, "DELETE_FAILED", error);
60963
60860
  }
60964
60861
  });
60965
- //#endregion
60966
- //#region src/lib/update-check.ts
60862
+ // src/lib/update-check.ts
60967
60863
  const UPDATE_CHECK_INTERVAL_MS = 36e5;
60968
60864
  const UPDATE_NOTIFY_INTERVAL_MS = 864e5;
60969
60865
  const UPDATE_CHECK_TIMEOUT_MS = 1500;
@@ -61075,8 +60971,7 @@ function maybeNotifyAboutCliUpdate(args, options = {}) {
61075
60971
  });
61076
60972
  refreshCliUpdateMetadata(options);
61077
60973
  }
61078
- //#endregion
61079
- //#region src/lib/auto-update.ts
60974
+ // src/lib/auto-update.ts
61080
60975
  const INTERNAL_AUTO_UPDATE_ARG = "__runtype_internal_auto_update";
61081
60976
  const AUTO_UPDATE_WORKER_ENV = "RUNTYPE_CLI_AUTO_UPDATE_WORKER";
61082
60977
  const MANAGED_CLI_ENV = "RUNTYPE_CLI_MANAGED_RUN";
@@ -61553,8 +61448,7 @@ function rollbackManagedCli(homeDir = getRuntypeHomeDir()) {
61553
61448
  to: to ?? void 0
61554
61449
  };
61555
61450
  }
61556
- //#endregion
61557
- //#region src/commands/update.ts
61451
+ // src/commands/update.ts
61558
61452
  const updateCommand = new Command("update").description("Check for, install, or roll back CLI updates").option("--check", "Check for an update without installing it").option("--rollback", "Roll back the most recent managed update").action(async (options) => {
61559
61453
  if (options.check && options.rollback) {
61560
61454
  console.error(chalk.red("Use either --check or --rollback, not both"));
@@ -61603,8 +61497,7 @@ const updateCommand = new Command("update").description("Check for, install, or
61603
61497
  process.exitCode = 1;
61604
61498
  }
61605
61499
  });
61606
- //#endregion
61607
- //#region src/lib/mcp-client.ts
61500
+ // src/lib/mcp-client.ts
61608
61501
  const CONNECT_TIMEOUT_MS = 1e4;
61609
61502
  function parseHttpUrl(raw, label) {
61610
61503
  let url;
@@ -61708,8 +61601,7 @@ async function listAllMcpTools(client) {
61708
61601
  } while (cursor !== void 0);
61709
61602
  return tools;
61710
61603
  }
61711
- //#endregion
61712
- //#region src/lib/mcp-input.ts
61604
+ // src/lib/mcp-input.ts
61713
61605
  /** Whether resolving these arguments will consume the process stdin stream. */
61714
61606
  function usesMcpStdin(options) {
61715
61607
  if (options.input === "-") return true;
@@ -61791,8 +61683,7 @@ async function resolveMcpArguments(options, dependencies = {}) {
61791
61683
  }
61792
61684
  return result;
61793
61685
  }
61794
- //#endregion
61795
- //#region src/commands/mcp.ts
61686
+ // src/commands/mcp.ts
61796
61687
  const defaultDependencies$1 = {
61797
61688
  ensureAuth,
61798
61689
  connect: connectMcpClient,
@@ -61948,8 +61839,7 @@ function createMcpCommand(overrides = {}) {
61948
61839
  return command;
61949
61840
  }
61950
61841
  const mcpCommand = createMcpCommand();
61951
- //#endregion
61952
- //#region src/lib/device-provider.ts
61842
+ // src/lib/device-provider.ts
61953
61843
  var DeviceProviderError = class extends Error {
61954
61844
  code;
61955
61845
  retryable;
@@ -61984,8 +61874,7 @@ function base64UrlToBytes(value) {
61984
61874
  return null;
61985
61875
  }
61986
61876
  }
61987
- //#endregion
61988
- //#region ../device-bridge/src/device-identity.ts
61877
+ // ../device-bridge/src/device-identity.ts
61989
61878
  const encoder$1 = new TextEncoder();
61990
61879
  function toArrayBuffer(bytes) {
61991
61880
  const copy = new Uint8Array(bytes.byteLength);
@@ -62211,8 +62100,7 @@ function deviceError(code, message, retryable, details) {
62211
62100
  details
62212
62101
  });
62213
62102
  }
62214
- //#endregion
62215
- //#region ../device-bridge/src/localhost-http.ts
62103
+ // ../device-bridge/src/localhost-http.ts
62216
62104
  const LOCALHOST_HTTP_TOOL_NAME = "localhost_http_call";
62217
62105
  const LOCALHOST_HTTP_MAX_BODY_BYTES = DEVICE_MAX_FRAME_BYTES;
62218
62106
  const LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
@@ -62357,8 +62245,7 @@ async function executeLocalhostHttpCall(args, fetchImpl = fetch, signal) {
62357
62245
  body
62358
62246
  });
62359
62247
  }
62360
- //#endregion
62361
- //#region src/lib/device-listen-identity.ts
62248
+ // src/lib/device-listen-identity.ts
62362
62249
  const DEVICE_LISTEN_CONFIG = "device-listen";
62363
62250
  function isRecord$2(value) {
62364
62251
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -62709,8 +62596,7 @@ function startDeviceListenSession(options) {
62709
62596
  }
62710
62597
  };
62711
62598
  }
62712
- //#endregion
62713
- //#region src/lib/device-listen.ts
62599
+ // src/lib/device-listen.ts
62714
62600
  const DEVICE_LISTEN_RECONNECT_DELAYS_MS = [
62715
62601
  250,
62716
62602
  500,
@@ -62935,8 +62821,7 @@ async function runDeviceListen(options) {
62935
62821
  uninstall();
62936
62822
  }
62937
62823
  }
62938
- //#endregion
62939
- //#region src/lib/macos-device-provider.ts
62824
+ // src/lib/macos-device-provider.ts
62940
62825
  const MAX_SIDECAR_OUTPUT_BYTES = 1048576;
62941
62826
  const MAX_HELPER_BYTES = 104857600;
62942
62827
  const DEFAULT_SIDECAR_TIMEOUT_MS = 3e4;
@@ -63188,8 +63073,7 @@ var MacOSDeviceProvider = class {
63188
63073
  return response.result;
63189
63074
  }
63190
63075
  };
63191
- //#endregion
63192
- //#region src/commands/devices.ts
63076
+ // src/commands/devices.ts
63193
63077
  const defaultDependencies = {
63194
63078
  ensureAuth,
63195
63079
  createClient: (apiKey) => createCliClient(apiKey),
@@ -63714,8 +63598,7 @@ object({
63714
63598
  reason: string().nullable().optional(),
63715
63599
  revealed: array(string()).optional()
63716
63600
  });
63717
- //#endregion
63718
- //#region ../shared/dist/chunk-DwsXhSgv.mjs
63601
+ // ../shared/dist/chunk-BOnokEtt.mjs
63719
63602
  /** Every change kind a scrub report can name; a leaf so the data-source contracts reach it without the scrubber. */
63720
63603
  const METADATA_SCRUB_CHANGE_KIND_NAMES = [
63721
63604
  "url_redirected",
@@ -63769,8 +63652,7 @@ const productKindSchema = _enum([
63769
63652
  "external",
63770
63653
  "spec_only"
63771
63654
  ]);
63772
- //#endregion
63773
- //#region ../shared/dist/chunk-D0CW0BS7.mjs
63655
+ // ../shared/dist/chunk-B1-br4C3.mjs
63774
63656
  /** The manifest file at the root of a candidate's source bundle. */
63775
63657
  const CANDIDATE_MANIFEST_FILENAME = "runtype-candidate.json";
63776
63658
  const candidateRuntimeSchema = _enum([
@@ -65098,6 +64980,8 @@ const toolCallFactsSchema = object({
65098
64980
  designedBy: _enum(FUTURE_STATE_OPS).optional(),
65099
64981
  /** The synthesizer's answer failed its contract twice, so the call was answered with a stub (D5). */
65100
64982
  synthesisFailed: boolean().optional(),
64983
+ /** A recorded read answer that shows the values of the episode's own earlier accepted recorded writes (D3). */
64984
+ writeOverlay: boolean().optional(),
65101
64985
  /** No rung could answer the call under its policy, so it got a stub; a policy stub of a write never sets it. */
65102
64986
  unanswered: boolean().optional(),
65103
64987
  /** Why the synthesizer answered as it did, on a synthesized call; the review panel and the judge citation read it. */
@@ -65382,6 +65266,8 @@ const reportVariantSummarySchema = object({
65382
65266
  clientLimitEpisodes: number$1().int().optional(),
65383
65267
  /** Episodes that ended `recording_miss`: a `recorded` policy met a call with no recording. Unscored. */
65384
65268
  recordingMissEpisodes: number$1().int().nonnegative().optional(),
65269
+ /** Recorded read answers the read-your-writes overlay patched (`ToolCallFacts.writeOverlay`); absent when none. */
65270
+ writeOverlayAnswers: number$1().int().nonnegative().optional(),
65385
65271
  /** Episodes that ended `agent_error` on a client-model provider stall (`metrics.clientModelStall`). Unscored. */
65386
65272
  clientModelStallEpisodes: number$1().int().nonnegative().optional(),
65387
65273
  scoringFailedEpisodes: number$1().int().optional(),
@@ -65746,7 +65632,7 @@ const comparisonQualitySchema = object({
65746
65632
  unscoredEpisodes: number$1().int().nonnegative(),
65747
65633
  /**
65748
65634
  * Episodes that ended `recording_miss`. Each leaves the paired comparison with its partner; past
65749
- * `RECORDING_MISS_SHARE_CAP` of finished episodes or of one comparison's pairs (misses and client-model stalls
65635
+ * `RECORDING_MISS_SHARE_CAP` of finished episodes or of an overlay's pooled pairs (misses and client-model stalls
65750
65636
  * together), or with a comparison left without pairs, the reason is `recording_coverage`. Absent when none missed.
65751
65637
  */
65752
65638
  recordingMissEpisodes: number$1().int().nonnegative().optional(),
@@ -66528,6 +66414,12 @@ const simulationRunResponseSchema = object({
66528
66414
  reportId: entityId.nullable()
66529
66415
  });
66530
66416
  object({ run: simulationRunSchema });
66417
+ simulationRunResponseSchema.extend({ repair: object({
66418
+ /** Episodes whose AI judge failed, graded again from their stored transcripts. */
66419
+ regrading: number$1().int(),
66420
+ /** Episodes the platform kept from running, played again under fresh episode ids. */
66421
+ replaying: number$1().int()
66422
+ }) });
66531
66423
  simulationRunResponseSchema.extend({ advance: object({
66532
66424
  /** Episodes this call finished; one it parked at the time budget resumes on the next call. */
66533
66425
  episodesFinished: number$1().int(),
@@ -66619,6 +66511,7 @@ object({
66619
66511
  "SIMULATION_OVERLAY_INVALID",
66620
66512
  "SIMULATION_OVERLAY_NOT_OWN_TARGET",
66621
66513
  "SIMULATION_RUN_NOT_CANCELLABLE",
66514
+ "SIMULATION_RUN_NOT_REPAIRABLE",
66622
66515
  "SIMULATION_VARIANT_INVALID",
66623
66516
  "SIMULATION_IDENTITY_INVALID",
66624
66517
  "SIMULATION_FORBIDDEN",
@@ -66675,8 +66568,7 @@ simulationSyntheticDatasetResponseSchema.extend({
66675
66568
  }).nullable()
66676
66569
  });
66677
66570
  object({ deleted: literal(true) });
66678
- //#endregion
66679
- //#region src/lib/candidate-bundle.ts
66571
+ // src/lib/candidate-bundle.ts
66680
66572
  /** The largest compressed bundle the API accepts (`POST /v1/simulations/candidate-bundles`). */
66681
66573
  const CANDIDATE_BUNDLE_MAX_BYTES = 262144e3;
66682
66574
  /** The API refuses a manifest larger than this. */
@@ -67125,8 +67017,7 @@ function registerToolMemoryCommands(simulations) {
67125
67017
  }
67126
67018
  });
67127
67019
  }
67128
- //#endregion
67129
- //#region src/commands/simulations.ts
67020
+ // src/commands/simulations.ts
67130
67021
  const ACTION_SCOPE = {
67131
67022
  upload: "SIMULATIONS:WRITE",
67132
67023
  "read-target": "SIMULATIONS:READ",
@@ -67341,8 +67232,7 @@ simulationsCommand.command("candidate").description("Sandbox candidates: an agen
67341
67232
  }
67342
67233
  if (!passed) process.exit(1);
67343
67234
  });
67344
- //#endregion
67345
- //#region src/lib/global-option-forwarding.ts
67235
+ // src/lib/global-option-forwarding.ts
67346
67236
  const DESTRUCTIVE_COMMANDS = /* @__PURE__ */ new Set([
67347
67237
  "delete",
67348
67238
  "bulk-delete",
@@ -67392,8 +67282,7 @@ function registerGlobalOptionForwarding(program) {
67392
67282
  if (invocation.expectApiUrl !== void 0) assertExpectedApiUrl((await loadEffectiveContext(invocation.apiUrl)).apiUrl);
67393
67283
  });
67394
67284
  }
67395
- //#endregion
67396
- //#region src/index.ts
67285
+ // src/index.ts
67397
67286
  loadEnv();
67398
67287
  const program = new Command();
67399
67288
  program.name("runtype").description("CLI for Runtype AI Platform").version(getCliVersion()).option("-v, --verbose", "Enable verbose output").option("--api-url <url>", "API URL (flag > env > project link > saved config > credential endpoint > default)").option("--org <id>", "Use the stored login for this organization (overrides RUNTYPE_ORG and .runtype/project.json)").option("--expect-api-url <url>", "Refuse actions unless the effective API URL matches").option("--expect-org <id>", "Require authenticated organization ID before API actions").option("--no-input", "Disable prompts; destructive delete/revoke/reset requires --yes").option("-y, --yes", "Explicitly consent to destructive commands in --no-input mode").option("--json", "Output as JSON").action(() => program.outputHelp());
@@ -67518,6 +67407,5 @@ async function handleNoCommand() {
67518
67407
  else throw error;
67519
67408
  }
67520
67409
  }
67521
- //#endregion
67522
67410
  export {};
67523
67411