lua-cli 3.46.0 → 3.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2118,9 +2118,9 @@ function formatClientOutcomeTurns(outcomes) {
2118
2118
  }
2119
2119
  __name(formatClientOutcomeTurns, "formatClientOutcomeTurns");
2120
2120
  __name3(formatClientOutcomeTurns, "formatClientOutcomeTurns");
2121
- function parseClientOutcomeTurns(text) {
2122
- if (typeof text !== "string") return null;
2123
- const lines = text.split("\n").map((line) => line.trim()).filter(Boolean);
2121
+ function parseClientOutcomeTurns(text2) {
2122
+ if (typeof text2 !== "string") return null;
2123
+ const lines = text2.split("\n").map((line) => line.trim()).filter(Boolean);
2124
2124
  if (lines.length === 0 || lines.length > CLIENT_OUTCOME_TURNS_MAX) return null;
2125
2125
  const out = [];
2126
2126
  for (const line of lines) {
@@ -2509,9 +2509,9 @@ function idOrName(value3) {
2509
2509
  }
2510
2510
  __name(idOrName, "idOrName");
2511
2511
  __name3(idOrName, "idOrName");
2512
- function addresses(text) {
2513
- if (typeof text !== "string") return [];
2514
- return (text.match(EMAIL_IN_TEXT) ?? []).map((address) => address.toLowerCase());
2512
+ function addresses(text2) {
2513
+ if (typeof text2 !== "string") return [];
2514
+ return (text2.match(EMAIL_IN_TEXT) ?? []).map((address) => address.toLowerCase());
2515
2515
  }
2516
2516
  __name(addresses, "addresses");
2517
2517
  __name3(addresses, "addresses");
@@ -2665,8 +2665,8 @@ __name3(contentRecordExcluded, "contentRecordExcluded");
2665
2665
  var MAX_EXCLUSION_DEPTH = 32;
2666
2666
  function jsonLookingString(value3) {
2667
2667
  if (typeof value3 !== "string") return false;
2668
- const text = value3.trim();
2669
- return text.startsWith("{") && text.endsWith("}") || text.startsWith("[") && text.endsWith("]");
2668
+ const text2 = value3.trim();
2669
+ return text2.startsWith("{") && text2.endsWith("}") || text2.startsWith("[") && text2.endsWith("]");
2670
2670
  }
2671
2671
  __name(jsonLookingString, "jsonLookingString");
2672
2672
  __name3(jsonLookingString, "jsonLookingString");
@@ -2690,11 +2690,11 @@ function applyContentExclusions(value3, exclusions) {
2690
2690
  };
2691
2691
  let removed = 0;
2692
2692
  let blocked = false;
2693
- const walkString = /* @__PURE__ */ __name3((text, depth) => {
2694
- const parsed = parseEmbeddedJson(text);
2695
- if (!parsed) return text;
2693
+ const walkString = /* @__PURE__ */ __name3((text2, depth) => {
2694
+ const parsed = parseEmbeddedJson(text2);
2695
+ if (!parsed) return text2;
2696
2696
  const next2 = walk22(parsed.value, depth);
2697
- return next2 === parsed.value ? text : JSON.stringify(next2);
2697
+ return next2 === parsed.value ? text2 : JSON.stringify(next2);
2698
2698
  }, "walkString");
2699
2699
  const walk22 = /* @__PURE__ */ __name3((node, depth) => {
2700
2700
  if (blocked) return node;
@@ -2800,8 +2800,8 @@ function contentProjectionParameters(params) {
2800
2800
  if (PROJECTION_PARAMETER_KEYS.has(name)) {
2801
2801
  found.push(key);
2802
2802
  } else if (name === "expand") {
2803
- const text = typeof value3 === "string" ? value3 : JSON.stringify(value3 ?? "");
2804
- if (/select/i.test(normaliseRequestParameterKey(text))) found.push(key);
2803
+ const text2 = typeof value3 === "string" ? value3 : JSON.stringify(value3 ?? "");
2804
+ if (/select/i.test(normaliseRequestParameterKey(text2))) found.push(key);
2805
2805
  }
2806
2806
  }
2807
2807
  return found;
@@ -2890,9 +2890,9 @@ __name(currencyMinorUnitExponent, "currencyMinorUnitExponent");
2890
2890
  __name3(currencyMinorUnitExponent, "currencyMinorUnitExponent");
2891
2891
  var DECIMAL_AMOUNT = /^(\d+)(?:\.(\d+))?$/;
2892
2892
  function majorToMinorUnits(amount, currency) {
2893
- const text = typeof amount === "number" ? Number.isFinite(amount) ? String(amount) : "" : typeof amount === "string" ? amount.trim() : "";
2894
- if (/e/i.test(text)) return void 0;
2895
- const match = DECIMAL_AMOUNT.exec(text);
2893
+ const text2 = typeof amount === "number" ? Number.isFinite(amount) ? String(amount) : "" : typeof amount === "string" ? amount.trim() : "";
2894
+ if (/e/i.test(text2)) return void 0;
2895
+ const match = DECIMAL_AMOUNT.exec(text2);
2896
2896
  if (!match) return void 0;
2897
2897
  const exponent = currencyMinorUnitExponent(currency);
2898
2898
  const whole = match[1];
@@ -2906,9 +2906,9 @@ function majorToMinorUnits(amount, currency) {
2906
2906
  __name(majorToMinorUnits, "majorToMinorUnits");
2907
2907
  __name3(majorToMinorUnits, "majorToMinorUnits");
2908
2908
  function readMinorUnits(amount) {
2909
- const text = typeof amount === "number" ? String(amount) : typeof amount === "string" ? amount.trim() : "";
2910
- if (!/^\d+$/.test(text)) return void 0;
2911
- const minor = Number(text);
2909
+ const text2 = typeof amount === "number" ? String(amount) : typeof amount === "string" ? amount.trim() : "";
2910
+ if (!/^\d+$/.test(text2)) return void 0;
2911
+ const minor = Number(text2);
2912
2912
  return Number.isSafeInteger(minor) ? minor : void 0;
2913
2913
  }
2914
2914
  __name(readMinorUnits, "readMinorUnits");
@@ -3034,8 +3034,8 @@ function isWorkflowSecretKey(key) {
3034
3034
  }
3035
3035
  __name(isWorkflowSecretKey, "isWorkflowSecretKey");
3036
3036
  __name3(isWorkflowSecretKey, "isWorkflowSecretKey");
3037
- function applyPatterns(text, patterns, counter) {
3038
- let out = text;
3037
+ function applyPatterns(text2, patterns, counter) {
3038
+ let out = text2;
3039
3039
  for (const { re, suffix } of patterns) {
3040
3040
  re.lastIndex = 0;
3041
3041
  if (!re.test(out)) continue;
@@ -3057,21 +3057,21 @@ function applyPatterns(text, patterns, counter) {
3057
3057
  }
3058
3058
  __name(applyPatterns, "applyPatterns");
3059
3059
  __name3(applyPatterns, "applyPatterns");
3060
- function scrubSecretText(text) {
3061
- if (typeof text !== "string" || text.length < 4) return text;
3062
- return applyPatterns(applyPatterns(text, SECRET_LITERAL_PATTERNS), SECRET_PAIR_PATTERNS);
3060
+ function scrubSecretText(text2) {
3061
+ if (typeof text2 !== "string" || text2.length < 4) return text2;
3062
+ return applyPatterns(applyPatterns(text2, SECRET_LITERAL_PATTERNS), SECRET_PAIR_PATTERNS);
3063
3063
  }
3064
3064
  __name(scrubSecretText, "scrubSecretText");
3065
3065
  __name3(scrubSecretText, "scrubSecretText");
3066
- function scrubSecretTextCounted(text) {
3067
- if (typeof text !== "string" || text.length < 4) return {
3068
- text,
3066
+ function scrubSecretTextCounted(text2) {
3067
+ if (typeof text2 !== "string" || text2.length < 4) return {
3068
+ text: text2,
3069
3069
  redactions: 0
3070
3070
  };
3071
3071
  const counter = {
3072
3072
  redactions: 0
3073
3073
  };
3074
- const out = applyPatterns(applyPatterns(text, SECRET_LITERAL_PATTERNS, counter), SECRET_PAIR_PATTERNS, counter);
3074
+ const out = applyPatterns(applyPatterns(text2, SECRET_LITERAL_PATTERNS, counter), SECRET_PAIR_PATTERNS, counter);
3075
3075
  return {
3076
3076
  text: out,
3077
3077
  redactions: counter.redactions
@@ -3081,12 +3081,12 @@ __name(scrubSecretTextCounted, "scrubSecretTextCounted");
3081
3081
  __name3(scrubSecretTextCounted, "scrubSecretTextCounted");
3082
3082
  var SCRUB_INPUT_MAX_CHARS = 16 * 1024;
3083
3083
  var SCRUB_CUT_BACKOFF_CHARS = 256;
3084
- function boundScrubInput(text, max = SCRUB_INPUT_MAX_CHARS) {
3085
- if (typeof text !== "string" || text.length <= max) return text;
3086
- const window = text.slice(Math.max(0, max - SCRUB_CUT_BACKOFF_CHARS), max);
3084
+ function boundScrubInput(text2, max = SCRUB_INPUT_MAX_CHARS) {
3085
+ if (typeof text2 !== "string" || text2.length <= max) return text2;
3086
+ const window = text2.slice(Math.max(0, max - SCRUB_CUT_BACKOFF_CHARS), max);
3087
3087
  const ws = window.search(/\s\S*$/);
3088
3088
  const cut2 = ws >= 0 ? max - window.length + ws : max;
3089
- return `${text.slice(0, cut2)}\u2026`;
3089
+ return `${text2.slice(0, cut2)}\u2026`;
3090
3090
  }
3091
3091
  __name(boundScrubInput, "boundScrubInput");
3092
3092
  __name3(boundScrubInput, "boundScrubInput");
@@ -3112,9 +3112,9 @@ function messageText(value3) {
3112
3112
  __name(messageText, "messageText");
3113
3113
  __name3(messageText, "messageText");
3114
3114
  function scrubProviderMessage(raw, max = PROVIDER_MESSAGE_MAX_CHARS) {
3115
- const text = boundScrubInput(messageText(raw)).replace(/\s+/g, " ").trim();
3116
- if (!text) return void 0;
3117
- const out = scrubSecretText(text);
3115
+ const text2 = boundScrubInput(messageText(raw)).replace(/\s+/g, " ").trim();
3116
+ if (!text2) return void 0;
3117
+ const out = scrubSecretText(text2);
3118
3118
  return out.length > max ? `${out.slice(0, max - 1)}\u2026` : out;
3119
3119
  }
3120
3120
  __name(scrubProviderMessage, "scrubProviderMessage");
@@ -3316,12 +3316,12 @@ var MEMBERS = [
3316
3316
  "account"
3317
3317
  ];
3318
3318
  var FORMAT_CHARS = /[\p{Cf}\u200b-\u200d\u202a-\u202e\u2066-\u2069\ufeff]/u;
3319
- function hasFormatCharacters(text) {
3320
- return FORMAT_CHARS.test(text);
3319
+ function hasFormatCharacters(text2) {
3320
+ return FORMAT_CHARS.test(text2);
3321
3321
  }
3322
3322
  __name(hasFormatCharacters, "hasFormatCharacters");
3323
3323
  __name3(hasFormatCharacters, "hasFormatCharacters");
3324
- var oneLine = /* @__PURE__ */ __name3((text) => text.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029"\u201c\u201d]/g, " ").replace(/\s+/g, " ").trim(), "oneLine");
3324
+ var oneLine = /* @__PURE__ */ __name3((text2) => text2.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029"\u201c\u201d]/g, " ").replace(/\s+/g, " ").trim(), "oneLine");
3325
3325
  function normalizedHandoverName(name) {
3326
3326
  return oneLine(name.normalize("NFKC")).toLowerCase();
3327
3327
  }
@@ -3396,8 +3396,8 @@ __name3(normalizeConnectionHandoverArgs, "normalizeConnectionHandoverArgs");
3396
3396
  function approvalPayloadCoversConnectionHandover(payload, stored) {
3397
3397
  const p = parseConnectionHandoverApprovalPayload(payload);
3398
3398
  if (!p) return false;
3399
- const text = describeConnectionHandoverApproval(payload) ?? "";
3400
- if (text.length > CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS || scrubSecretText(text) !== text) return false;
3399
+ const text2 = describeConnectionHandoverApproval(payload) ?? "";
3400
+ if (text2.length > CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS || scrubSecretText(text2) !== text2) return false;
3401
3401
  const storedAccount = stored.account?.trim() || void 0;
3402
3402
  return p.connectionId === stored.connectionId && p.agentId === stored.agentId && p.agentName === stored.agentName.trim() && p.supervisorName === stored.supervisorName.trim() && p.integration === stored.integration && p.account === storedAccount;
3403
3403
  }
@@ -3761,13 +3761,13 @@ function parseThreadFollowUpInput(input) {
3761
3761
  if (hasPrompt === hasMessage) return null;
3762
3762
  const raw = hasPrompt ? o.prompt : o.message;
3763
3763
  if (typeof raw !== "string") return null;
3764
- const text = raw.trim();
3764
+ const text2 = raw.trim();
3765
3765
  const max = hasPrompt ? THREAD_FOLLOW_UP_LIMITS.promptMax : THREAD_FOLLOW_UP_LIMITS.messageMax;
3766
- if (text.length === 0 || text.length > max) return null;
3766
+ if (text2.length === 0 || text2.length > max) return null;
3767
3767
  if (o.idempotencyKey !== void 0 && !isValidCallerDedupeKey(o.idempotencyKey)) return null;
3768
3768
  return {
3769
3769
  mode: hasPrompt ? "turn" : "message",
3770
- text,
3770
+ text: text2,
3771
3771
  ...o.idempotencyKey !== void 0 ? {
3772
3772
  idempotencyKey: o.idempotencyKey
3773
3773
  } : {}
@@ -4710,8 +4710,8 @@ function withOverride(def, override) {
4710
4710
  "effect",
4711
4711
  "confirm"
4712
4712
  ]) {
4713
- const text = stored[field];
4714
- if (typeof text === "string" && text.trim()) next[field] = text;
4713
+ const text2 = stored[field];
4714
+ if (typeof text2 === "string" && text2.trim()) next[field] = text2;
4715
4715
  }
4716
4716
  if (def.tunableDefault && stored.default !== void 0) {
4717
4717
  const check = validateChannelSettingValue(def, stored.default);
@@ -4836,26 +4836,26 @@ function validateChannelSettingValue(def, value3, channel) {
4836
4836
  ok: false,
4837
4837
  error: "Must not be empty"
4838
4838
  };
4839
- const text = value3.trim();
4840
- if (rules.maxLength !== void 0 && text.length > rules.maxLength) {
4839
+ const text2 = value3.trim();
4840
+ if (rules.maxLength !== void 0 && text2.length > rules.maxLength) {
4841
4841
  return {
4842
4842
  ok: false,
4843
4843
  error: `Must be at most ${rules.maxLength} characters`
4844
4844
  };
4845
4845
  }
4846
- if (UNSAFE_TEXT.test(text)) return {
4846
+ if (UNSAFE_TEXT.test(text2)) return {
4847
4847
  ok: false,
4848
4848
  error: 'Must not contain <, > or " characters'
4849
4849
  };
4850
- if (rules.format === "slackReaction" && resolveSlackReactionName(text) === void 0) {
4850
+ if (rules.format === "slackReaction" && resolveSlackReactionName(text2) === void 0) {
4851
4851
  return {
4852
4852
  ok: false,
4853
- error: `${text} is not an emoji Slack can react with; use a common emoji or a :shortcode:`
4853
+ error: `${text2} is not an emoji Slack can react with; use a common emoji or a :shortcode:`
4854
4854
  };
4855
4855
  }
4856
4856
  return {
4857
4857
  ok: true,
4858
- value: text
4858
+ value: text2
4859
4859
  };
4860
4860
  }
4861
4861
  case "enum": {
@@ -5290,11 +5290,11 @@ function transformChatHistoryContentParts(parts) {
5290
5290
  mediaType: videoMatch[1]
5291
5291
  });
5292
5292
  } else {
5293
- let text = rawText.replace(/\\\\\\n/g, "\n");
5294
- text = removeNavigateBlock(text);
5293
+ let text2 = rawText.replace(/\\\\\\n/g, "\n");
5294
+ text2 = removeNavigateBlock(text2);
5295
5295
  content.push({
5296
5296
  type: "text",
5297
- text
5297
+ text: text2
5298
5298
  });
5299
5299
  }
5300
5300
  } else if (part.type === "file") {
@@ -5425,6 +5425,102 @@ function foldRichPartsIntoMessages(messages, records, makeMessage, sameTurnGroup
5425
5425
  }
5426
5426
  __name(foldRichPartsIntoMessages, "foldRichPartsIntoMessages");
5427
5427
  __name3(foldRichPartsIntoMessages, "foldRichPartsIntoMessages");
5428
+ var WORK_ITEMS_KEY = "_luaWorkItems";
5429
+ var MAX_WORK_ITEMS = 100;
5430
+ var LIMITS = {
5431
+ id: 200,
5432
+ title: 120,
5433
+ group: 40,
5434
+ status: 40,
5435
+ action: 200
5436
+ };
5437
+ function text(item, field, index, required) {
5438
+ const value3 = item[field];
5439
+ if (value3 === void 0 && !required) return void 0;
5440
+ if (typeof value3 !== "string" || required && value3.trim().length === 0) {
5441
+ throw new Error(`Work item ${index}: \`${field}\` must be a ${required ? "non-empty " : ""}string`);
5442
+ }
5443
+ if ([
5444
+ ...value3
5445
+ ].length > LIMITS[field]) {
5446
+ throw new Error(`Work item ${index}: \`${field}\` is longer than ${LIMITS[field]} characters`);
5447
+ }
5448
+ return value3;
5449
+ }
5450
+ __name(text, "text");
5451
+ __name3(text, "text");
5452
+ function normalizeWorkItems(items) {
5453
+ if (!Array.isArray(items)) throw new Error("Work items must be an array");
5454
+ if (items.length > MAX_WORK_ITEMS) {
5455
+ throw new Error(`At most ${MAX_WORK_ITEMS} work items can be published (got ${items.length})`);
5456
+ }
5457
+ const seen = /* @__PURE__ */ new Set();
5458
+ return items.map((raw, index) => {
5459
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
5460
+ throw new Error(`Work item ${index} must be an object`);
5461
+ }
5462
+ const item = raw;
5463
+ const id2 = text(item, "id", index, true);
5464
+ if (seen.has(id2)) throw new Error(`Work item ${index}: \`id\` "${id2}" is used more than once`);
5465
+ seen.add(id2);
5466
+ const title = text(item, "title", index, true);
5467
+ const group = text(item, "group", index, true);
5468
+ const action = text(item, "action", index, true);
5469
+ const status = text(item, "status", index, false);
5470
+ if (item.needsAction !== void 0 && typeof item.needsAction !== "boolean") {
5471
+ throw new Error(`Work item ${index}: \`needsAction\` must be a boolean`);
5472
+ }
5473
+ const when = item.updatedAt;
5474
+ const date = when instanceof Date ? when : typeof when === "string" ? new Date(when) : null;
5475
+ if (!date || Number.isNaN(date.getTime())) {
5476
+ throw new Error(`Work item ${index}: \`updatedAt\` must be a valid date`);
5477
+ }
5478
+ return {
5479
+ id: id2,
5480
+ title,
5481
+ group,
5482
+ ...item.needsAction !== void 0 ? {
5483
+ needsAction: item.needsAction
5484
+ } : {},
5485
+ ...status !== void 0 ? {
5486
+ status
5487
+ } : {},
5488
+ updatedAt: date.toISOString(),
5489
+ action
5490
+ };
5491
+ });
5492
+ }
5493
+ __name(normalizeWorkItems, "normalizeWorkItems");
5494
+ __name3(normalizeWorkItems, "normalizeWorkItems");
5495
+ function workItemsRecord(items, now = /* @__PURE__ */ new Date()) {
5496
+ return {
5497
+ v: 1,
5498
+ items: normalizeWorkItems(items),
5499
+ updatedAt: now.toISOString()
5500
+ };
5501
+ }
5502
+ __name(workItemsRecord, "workItemsRecord");
5503
+ __name3(workItemsRecord, "workItemsRecord");
5504
+ function withoutWorkItems(data) {
5505
+ if (!data || typeof data !== "object" || !(WORK_ITEMS_KEY in data)) return data;
5506
+ const { [WORK_ITEMS_KEY]: _list, ...rest } = data;
5507
+ return rest;
5508
+ }
5509
+ __name(withoutWorkItems, "withoutWorkItems");
5510
+ __name3(withoutWorkItems, "withoutWorkItems");
5511
+ function mutationWithoutWorkItems(mutation) {
5512
+ return {
5513
+ ...mutation,
5514
+ ...mutation.set ? {
5515
+ set: withoutWorkItems(mutation.set)
5516
+ } : {},
5517
+ ...mutation.unset ? {
5518
+ unset: mutation.unset.filter((field) => field !== WORK_ITEMS_KEY)
5519
+ } : {}
5520
+ };
5521
+ }
5522
+ __name(mutationWithoutWorkItems, "mutationWithoutWorkItems");
5523
+ __name3(mutationWithoutWorkItems, "mutationWithoutWorkItems");
5428
5524
  var BROWSER_COMMANDS = [
5429
5525
  // health + lifecycle / navigation
5430
5526
  {
@@ -8641,17 +8737,17 @@ var MAX_KEY_CHARS = 64;
8641
8737
  var KEY_SCRUB_INPUT_MAX_CHARS = 256;
8642
8738
  var STRING_SCRUB_INPUT_MAX_CHARS = 4 * APPROVAL_ARG_STRING_MAX_CHARS;
8643
8739
  var ELLIPSIS = "\u2026";
8644
- function cut(text, max) {
8645
- if (text.length <= max) return text;
8740
+ function cut(text2, max) {
8741
+ if (text2.length <= max) return text2;
8646
8742
  let end = Math.max(0, max - 1);
8647
- const last = text.charCodeAt(end - 1);
8743
+ const last = text2.charCodeAt(end - 1);
8648
8744
  if (last >= 55296 && last <= 56319) end -= 1;
8649
- return `${text.slice(0, end)}${ELLIPSIS}`;
8745
+ return `${text2.slice(0, end)}${ELLIPSIS}`;
8650
8746
  }
8651
8747
  __name(cut, "cut");
8652
8748
  __name3(cut, "cut");
8653
- function scrubString(text, state3) {
8654
- const scrubbed = scrubSecretText(boundScrubInput(text, STRING_SCRUB_INPUT_MAX_CHARS));
8749
+ function scrubString(text2, state3) {
8750
+ const scrubbed = scrubSecretText(boundScrubInput(text2, STRING_SCRUB_INPUT_MAX_CHARS));
8655
8751
  if (scrubbed.length > APPROVAL_ARG_STRING_MAX_CHARS) state3.truncated = true;
8656
8752
  return cut(scrubbed, APPROVAL_ARG_STRING_MAX_CHARS);
8657
8753
  }
@@ -8743,10 +8839,10 @@ function walkObject(obj, depth, state3) {
8743
8839
  }
8744
8840
  __name(walkObject, "walkObject");
8745
8841
  __name3(walkObject, "walkObject");
8746
- function fitString(text, room) {
8747
- let n2 = Math.min(text.length, room - 3);
8842
+ function fitString(text2, room) {
8843
+ let n2 = Math.min(text2.length, room - 3);
8748
8844
  while (n2 >= 16) {
8749
- const candidate = cut(text, n2);
8845
+ const candidate = cut(text2, n2);
8750
8846
  if (JSON.stringify(candidate).length <= room) return candidate;
8751
8847
  n2 = Math.floor(n2 * 0.8);
8752
8848
  }
@@ -8845,9 +8941,9 @@ function createPersistScrubber(maxChars = PERSIST_SCRUB_MAX_CHARS) {
8845
8941
  const bounded = boundScrubInput(value3, remaining);
8846
8942
  if (bounded !== value3) state3.truncated = true;
8847
8943
  remaining -= bounded.length;
8848
- const { text, redactions } = scrubSecretTextCounted(bounded);
8944
+ const { text: text2, redactions } = scrubSecretTextCounted(bounded);
8849
8945
  state3.redactions += redactions;
8850
- return text;
8946
+ return text2;
8851
8947
  }, "scrub");
8852
8948
  return {
8853
8949
  scrub,
@@ -8859,9 +8955,9 @@ __name3(createPersistScrubber, "createPersistScrubber");
8859
8955
  function scrubMessageContentForPersist(content, maxChars = PERSIST_SCRUB_MAX_CHARS) {
8860
8956
  const { scrub, state: state3 } = createPersistScrubber(maxChars);
8861
8957
  if (typeof content === "string") {
8862
- const text = scrub(content);
8958
+ const text2 = scrub(content);
8863
8959
  return {
8864
- content: text !== content ? text : content,
8960
+ content: text2 !== content ? text2 : content,
8865
8961
  ...state3
8866
8962
  };
8867
8963
  }
@@ -8873,19 +8969,19 @@ function scrubMessageContentForPersist(content, maxChars = PERSIST_SCRUB_MAX_CHA
8873
8969
  let changed = false;
8874
8970
  const parts = content.map((part) => {
8875
8971
  if (typeof part === "string") {
8876
- const text = scrub(part);
8877
- if (text === part) return part;
8972
+ const text2 = scrub(part);
8973
+ if (text2 === part) return part;
8878
8974
  changed = true;
8879
- return text;
8975
+ return text2;
8880
8976
  }
8881
8977
  if (part && typeof part === "object" && part.type === "text" && typeof part.text === "string") {
8882
8978
  const original = part.text;
8883
- const text = scrub(original);
8884
- if (text === original) return part;
8979
+ const text2 = scrub(original);
8980
+ if (text2 === original) return part;
8885
8981
  changed = true;
8886
8982
  return {
8887
8983
  ...part,
8888
- text
8984
+ text: text2
8889
8985
  };
8890
8986
  }
8891
8987
  return part;
@@ -9210,11 +9306,11 @@ __name3(workflowApprovalDecisionOf, "workflowApprovalDecisionOf");
9210
9306
  function workflowApprovalOutput(resumeData) {
9211
9307
  const decision = typeof resumeData.decision === "string" ? resumeData.decision : workflowApprovalDecisionOf(resumeData);
9212
9308
  const note = typeof resumeData.note === "string" && resumeData.note.trim() !== "" ? resumeData.note : void 0;
9213
- const text = typeof resumeData.text === "string" ? resumeData.text : note ?? decision;
9309
+ const text2 = typeof resumeData.text === "string" ? resumeData.text : note ?? decision;
9214
9310
  return {
9215
9311
  ...resumeData,
9216
9312
  decision,
9217
- text
9313
+ text: text2
9218
9314
  };
9219
9315
  }
9220
9316
  __name(workflowApprovalOutput, "workflowApprovalOutput");
@@ -9227,8 +9323,8 @@ function isWorkflowApprovalOutput(value3) {
9227
9323
  __name(isWorkflowApprovalOutput, "isWorkflowApprovalOutput");
9228
9324
  __name3(isWorkflowApprovalOutput, "isWorkflowApprovalOutput");
9229
9325
  var JSON_FENCE_RE = /```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```/g;
9230
- function extractSingleJsonValue(text) {
9231
- const trimmed = (text ?? "").trim();
9326
+ function extractSingleJsonValue(text2) {
9327
+ const trimmed = (text2 ?? "").trim();
9232
9328
  if (!trimmed) return {
9233
9329
  reason: "reply is empty"
9234
9330
  };
@@ -9773,8 +9869,8 @@ var ATTACHMENT_LINES = [
9773
9869
  (m) => `[File: ${m[1]}]`
9774
9870
  ]
9775
9871
  ];
9776
- function evidenceDisplayText(text) {
9777
- const raw = typeof text === "string" ? text : "";
9872
+ function evidenceDisplayText(text2) {
9873
+ const raw = typeof text2 === "string" ? text2 : "";
9778
9874
  if (!raw.trim()) return "";
9779
9875
  const lines = removeHiddenBlocks(raw).split(/\r?\n/).map((line) => {
9780
9876
  const t = line.trim();
@@ -9789,15 +9885,15 @@ function evidenceDisplayText(text) {
9789
9885
  }
9790
9886
  __name(evidenceDisplayText, "evidenceDisplayText");
9791
9887
  __name3(evidenceDisplayText, "evidenceDisplayText");
9792
- function evidenceSnippet(text) {
9793
- const flat = evidenceDisplayText(text);
9888
+ function evidenceSnippet(text2) {
9889
+ const flat = evidenceDisplayText(text2);
9794
9890
  return flat.length <= EVIDENCE_SNIPPET_MAX_CHARS ? flat : `${flat.slice(0, EVIDENCE_SNIPPET_MAX_CHARS - 1)}\u2026`;
9795
9891
  }
9796
9892
  __name(evidenceSnippet, "evidenceSnippet");
9797
9893
  __name3(evidenceSnippet, "evidenceSnippet");
9798
- function evidenceWordCount(text) {
9799
- if (typeof text !== "string") return 0;
9800
- const t = text.trim();
9894
+ function evidenceWordCount(text2) {
9895
+ if (typeof text2 !== "string") return 0;
9896
+ const t = text2.trim();
9801
9897
  return t ? t.split(/\s+/).length : 0;
9802
9898
  }
9803
9899
  __name(evidenceWordCount, "evidenceWordCount");
@@ -9807,10 +9903,10 @@ function evidenceKey(label) {
9807
9903
  }
9808
9904
  __name(evidenceKey, "evidenceKey");
9809
9905
  __name3(evidenceKey, "evidenceKey");
9810
- function evidenceOpaqueKey(text) {
9906
+ function evidenceOpaqueKey(text2) {
9811
9907
  let h = 0xcbf29ce484222325n;
9812
9908
  const prime = 0x100000001b3n;
9813
- for (const ch of evidenceKey(text)) {
9909
+ for (const ch of evidenceKey(text2)) {
9814
9910
  h ^= BigInt(ch.codePointAt(0) ?? 0);
9815
9911
  h = h * prime & 0xffffffffffffffffn;
9816
9912
  }
@@ -10690,16 +10786,16 @@ function slashDecodedPath(path) {
10690
10786
  }
10691
10787
  __name(slashDecodedPath, "slashDecodedPath");
10692
10788
  __name3(slashDecodedPath, "slashDecodedPath");
10693
- function jsonHasDuplicateKey(text) {
10789
+ function jsonHasDuplicateKey(text2) {
10694
10790
  const stack = [];
10695
- for (let i = 0; i < text.length; i++) {
10696
- const c = text[i];
10791
+ for (let i = 0; i < text2.length; i++) {
10792
+ const c = text2[i];
10697
10793
  if (c === '"') {
10698
10794
  let j = i + 1;
10699
- while (j < text.length && text[j] !== '"') j += text[j] === "\\" ? 2 : 1;
10795
+ while (j < text2.length && text2[j] !== '"') j += text2[j] === "\\" ? 2 : 1;
10700
10796
  const top = stack[stack.length - 1];
10701
10797
  if (top && top.expectKey) {
10702
- const key = JSON.parse(text.slice(i, j + 1));
10798
+ const key = JSON.parse(text2.slice(i, j + 1));
10703
10799
  if (top.keys.has(key)) return true;
10704
10800
  top.keys.add(key);
10705
10801
  top.expectKey = false;
@@ -12189,17 +12285,17 @@ function firstAskDeadline(node) {
12189
12285
  __name(firstAskDeadline, "firstAskDeadline");
12190
12286
  __name4(firstAskDeadline, "firstAskDeadline");
12191
12287
  function liftRenderedApprover(row, rendered) {
12192
- const text = (rendered ?? "").trim();
12193
- if (!text) return null;
12288
+ const text2 = (rendered ?? "").trim();
12289
+ if (!text2) return null;
12194
12290
  if (row === "users") {
12195
12291
  let members = null;
12196
- if (text.startsWith("[")) {
12292
+ if (text2.startsWith("[")) {
12197
12293
  try {
12198
- members = JSON.parse(text);
12294
+ members = JSON.parse(text2);
12199
12295
  } catch {
12200
12296
  return null;
12201
12297
  }
12202
- } else members = text.split(",").map((s) => s.trim());
12298
+ } else members = text2.split(",").map((s) => s.trim());
12203
12299
  if (!Array.isArray(members) || members.length === 0 || members.length > APPROVER_SPEC_MAX_USERS) return null;
12204
12300
  if (!members.every((m) => typeof m === "string" && m.length > 0 && m.length <= 128)) return null;
12205
12301
  return {
@@ -12208,11 +12304,11 @@ function liftRenderedApprover(row, rendered) {
12208
12304
  ].sort()
12209
12305
  };
12210
12306
  }
12211
- if (text.length > 128 || text.startsWith("[") || text.startsWith("{")) return null;
12307
+ if (text2.length > 128 || text2.startsWith("[") || text2.startsWith("{")) return null;
12212
12308
  return row === "role" ? {
12213
- role: text
12309
+ role: text2
12214
12310
  } : {
12215
- group: text
12311
+ group: text2
12216
12312
  };
12217
12313
  }
12218
12314
  __name(liftRenderedApprover, "liftRenderedApprover");
@@ -12459,9 +12555,9 @@ var isSingleStep = /* @__PURE__ */ __name4((n2) => !isHitlNode(n2), "isSingleSte
12459
12555
  var singleId = /* @__PURE__ */ __name4((s) => s.type === "step" ? s.step.id : s.id, "singleId");
12460
12556
  var armId = /* @__PURE__ */ __name4((a) => a.type === "mapping" ? a.id : singleId(a), "armId");
12461
12557
  var TEMPLATE_STEP_REF = /\$\{\s*stepResults\.([A-Za-z0-9_\-]+)/g;
12462
- function templateStepRefs(text) {
12558
+ function templateStepRefs(text2) {
12463
12559
  const ids = [];
12464
- for (const m of text.matchAll(TEMPLATE_STEP_REF)) ids.push(m[1]);
12560
+ for (const m of text2.matchAll(TEMPLATE_STEP_REF)) ids.push(m[1]);
12465
12561
  return ids;
12466
12562
  }
12467
12563
  __name(templateStepRefs, "templateStepRefs");