lua-cli 3.45.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.
@@ -19,6 +19,7 @@ import { z } from "zod";
19
19
  import { z as z2 } from "zod";
20
20
  import { z as z3 } from "zod";
21
21
  import { z as z4 } from "zod";
22
+ import { z as z5 } from "zod";
22
23
  function isChannelConversationChannel(channel) {
23
24
  return !!channel && CHANNEL_CONVERSATION_CHANNELS.includes(channel);
24
25
  }
@@ -156,8 +157,8 @@ function isUnsafeConnectionPathPart(pathPart) {
156
157
  function isPlatformInvocationCaller(v) {
157
158
  return typeof v === "string" && PLATFORM_INVOCATION_CALLERS.includes(v);
158
159
  }
159
- function supervisionSubjectId(agentId) {
160
- return `agent:${agentId}`;
160
+ function supervisionSubjectId(agentId2) {
161
+ return `agent:${agentId2}`;
161
162
  }
162
163
  function isSupervisionOp(op) {
163
164
  return typeof op === "string" && Object.prototype.hasOwnProperty.call(SUPERVISION_OPS, op);
@@ -851,9 +852,9 @@ function isAgentConnectionBindingLoosening(previous, next) {
851
852
  function isAgentConnectionMountMode(value3) {
852
853
  return typeof value3 === "string" && AGENT_CONNECTION_MOUNT_MODES.includes(value3);
853
854
  }
854
- function agentConnectionBindingFor(bindings, agentId) {
855
- if (!Array.isArray(bindings) || !agentId) return void 0;
856
- return bindings.find((entry) => !!entry && typeof entry === "object" && entry.agentId === agentId);
855
+ function agentConnectionBindingFor(bindings, agentId2) {
856
+ if (!Array.isArray(bindings) || !agentId2) return void 0;
857
+ return bindings.find((entry) => !!entry && typeof entry === "object" && entry.agentId === agentId2);
857
858
  }
858
859
  function agentConnectionBindingRefusal(binding, operation) {
859
860
  if (binding === void 0 || binding === null) return null;
@@ -1004,9 +1005,9 @@ function validSecretOutcome(o) {
1004
1005
  function formatClientOutcomeTurns(outcomes) {
1005
1006
  return outcomes.map((outcome) => JSON.stringify(outcome)).join("\n");
1006
1007
  }
1007
- function parseClientOutcomeTurns(text) {
1008
- if (typeof text !== "string") return null;
1009
- const lines = text.split("\n").map((line) => line.trim()).filter(Boolean);
1008
+ function parseClientOutcomeTurns(text2) {
1009
+ if (typeof text2 !== "string") return null;
1010
+ const lines = text2.split("\n").map((line) => line.trim()).filter(Boolean);
1010
1011
  if (lines.length === 0 || lines.length > CLIENT_OUTCOME_TURNS_MAX) return null;
1011
1012
  const out = [];
1012
1013
  for (const line of lines) {
@@ -1136,8 +1137,8 @@ function describeConnectionRequest(input) {
1136
1137
  return `Something went wrong connecting ${what}. Ask ${who} to try again with a new request.`;
1137
1138
  }
1138
1139
  }
1139
- function operationDailyCapKey(agentId, connectionId, currency, utcDay) {
1140
- return `opcap:${agentId}:${connectionId}:${currency.toUpperCase()}:${utcDay}`;
1140
+ function operationDailyCapKey(agentId2, connectionId, currency, utcDay) {
1141
+ return `opcap:${agentId2}:${connectionId}:${currency.toUpperCase()}:${utcDay}`;
1141
1142
  }
1142
1143
  function isPlainObject(value3) {
1143
1144
  return typeof value3 === "object" && value3 !== null && !Array.isArray(value3);
@@ -1163,7 +1164,7 @@ function parseCapAmount(value3) {
1163
1164
  if (typeof value3 !== "number" || !Number.isFinite(value3) || value3 < 0) return null;
1164
1165
  return value3;
1165
1166
  }
1166
- function parseAgentConnectionOperationLimits(agentId, value3) {
1167
+ function parseAgentConnectionOperationLimits(agentId2, value3) {
1167
1168
  if (!isPlainObject(value3)) return {
1168
1169
  ok: false,
1169
1170
  error: "limits must be an object"
@@ -1176,7 +1177,7 @@ function parseAgentConnectionOperationLimits(agentId, value3) {
1176
1177
  };
1177
1178
  }
1178
1179
  const limits = {
1179
- agentId
1180
+ agentId: agentId2
1180
1181
  };
1181
1182
  if (value3.caps !== void 0 && value3.caps !== null) {
1182
1183
  const caps = value3.caps;
@@ -1262,17 +1263,17 @@ function parseAgentConnectionOperationLimits(agentId, value3) {
1262
1263
  limits
1263
1264
  };
1264
1265
  }
1265
- function findAgentConnectionOperationLimits(stored, agentId) {
1266
- if (!agentId || stored === void 0 || stored === null) return void 0;
1266
+ function findAgentConnectionOperationLimits(stored, agentId2) {
1267
+ if (!agentId2 || stored === void 0 || stored === null) return void 0;
1267
1268
  if (!Array.isArray(stored)) return {
1268
- agentId,
1269
+ agentId: agentId2,
1269
1270
  unreadable: true
1270
1271
  };
1271
- const entry = stored.find((row) => isPlainObject(row) && row.agentId === agentId);
1272
+ const entry = stored.find((row) => isPlainObject(row) && row.agentId === agentId2);
1272
1273
  if (!entry) return void 0;
1273
- const parsed = parseAgentConnectionOperationLimits(agentId, entry);
1274
+ const parsed = parseAgentConnectionOperationLimits(agentId2, entry);
1274
1275
  return parsed.ok ? parsed.limits : {
1275
- agentId,
1276
+ agentId: agentId2,
1276
1277
  unreadable: true
1277
1278
  };
1278
1279
  }
@@ -1323,9 +1324,9 @@ function idOrName(value3) {
1323
1324
  ].filter((v) => Boolean(v));
1324
1325
  return [];
1325
1326
  }
1326
- function addresses(text) {
1327
- if (typeof text !== "string") return [];
1328
- return (text.match(EMAIL_IN_TEXT) ?? []).map((address) => address.toLowerCase());
1327
+ function addresses(text2) {
1328
+ if (typeof text2 !== "string") return [];
1329
+ return (text2.match(EMAIL_IN_TEXT) ?? []).map((address) => address.toLowerCase());
1329
1330
  }
1330
1331
  function recordFacts(value3) {
1331
1332
  const senders = [];
@@ -1470,8 +1471,8 @@ function contentRecordExcluded(record, exclusions) {
1470
1471
  }
1471
1472
  function jsonLookingString(value3) {
1472
1473
  if (typeof value3 !== "string") return false;
1473
- const text = value3.trim();
1474
- return text.startsWith("{") && text.endsWith("}") || text.startsWith("[") && text.endsWith("]");
1474
+ const text2 = value3.trim();
1475
+ return text2.startsWith("{") && text2.endsWith("}") || text2.startsWith("[") && text2.endsWith("]");
1475
1476
  }
1476
1477
  function parseEmbeddedJson(value3) {
1477
1478
  try {
@@ -1491,11 +1492,11 @@ function applyContentExclusions(value3, exclusions) {
1491
1492
  };
1492
1493
  let removed = 0;
1493
1494
  let blocked = false;
1494
- const walkString = /* @__PURE__ */ __name3((text, depth) => {
1495
- const parsed = parseEmbeddedJson(text);
1496
- if (!parsed) return text;
1495
+ const walkString = /* @__PURE__ */ __name3((text2, depth) => {
1496
+ const parsed = parseEmbeddedJson(text2);
1497
+ if (!parsed) return text2;
1497
1498
  const next2 = walk22(parsed.value, depth);
1498
- return next2 === parsed.value ? text : JSON.stringify(next2);
1499
+ return next2 === parsed.value ? text2 : JSON.stringify(next2);
1499
1500
  }, "walkString");
1500
1501
  const walk22 = /* @__PURE__ */ __name3((node, depth) => {
1501
1502
  if (blocked) return node;
@@ -1589,8 +1590,8 @@ function contentProjectionParameters(params) {
1589
1590
  if (PROJECTION_PARAMETER_KEYS.has(name)) {
1590
1591
  found.push(key);
1591
1592
  } else if (name === "expand") {
1592
- const text = typeof value3 === "string" ? value3 : JSON.stringify(value3 ?? "");
1593
- if (/select/i.test(normaliseRequestParameterKey(text))) found.push(key);
1593
+ const text2 = typeof value3 === "string" ? value3 : JSON.stringify(value3 ?? "");
1594
+ if (/select/i.test(normaliseRequestParameterKey(text2))) found.push(key);
1594
1595
  }
1595
1596
  }
1596
1597
  return found;
@@ -1620,9 +1621,9 @@ function currencyMinorUnitExponent(currency) {
1620
1621
  return 2;
1621
1622
  }
1622
1623
  function majorToMinorUnits(amount, currency) {
1623
- const text = typeof amount === "number" ? Number.isFinite(amount) ? String(amount) : "" : typeof amount === "string" ? amount.trim() : "";
1624
- if (/e/i.test(text)) return void 0;
1625
- const match = DECIMAL_AMOUNT.exec(text);
1624
+ const text2 = typeof amount === "number" ? Number.isFinite(amount) ? String(amount) : "" : typeof amount === "string" ? amount.trim() : "";
1625
+ if (/e/i.test(text2)) return void 0;
1626
+ const match = DECIMAL_AMOUNT.exec(text2);
1626
1627
  if (!match) return void 0;
1627
1628
  const exponent = currencyMinorUnitExponent(currency);
1628
1629
  const whole = match[1];
@@ -1634,9 +1635,9 @@ function majorToMinorUnits(amount, currency) {
1634
1635
  return Number.isSafeInteger(minor) ? minor : void 0;
1635
1636
  }
1636
1637
  function readMinorUnits(amount) {
1637
- const text = typeof amount === "number" ? String(amount) : typeof amount === "string" ? amount.trim() : "";
1638
- if (!/^\d+$/.test(text)) return void 0;
1639
- const minor = Number(text);
1638
+ const text2 = typeof amount === "number" ? String(amount) : typeof amount === "string" ? amount.trim() : "";
1639
+ if (!/^\d+$/.test(text2)) return void 0;
1640
+ const minor = Number(text2);
1640
1641
  return Number.isSafeInteger(minor) ? minor : void 0;
1641
1642
  }
1642
1643
  function operationCapUtcDay(now = /* @__PURE__ */ new Date()) {
@@ -1653,8 +1654,8 @@ function groupCount(re) {
1653
1654
  function isWorkflowSecretKey(key) {
1654
1655
  return WORKFLOW_SECRET_KEY_RE.test(key);
1655
1656
  }
1656
- function applyPatterns(text, patterns, counter) {
1657
- let out = text;
1657
+ function applyPatterns(text2, patterns, counter) {
1658
+ let out = text2;
1658
1659
  for (const { re, suffix } of patterns) {
1659
1660
  re.lastIndex = 0;
1660
1661
  if (!re.test(out)) continue;
@@ -1674,30 +1675,30 @@ function applyPatterns(text, patterns, counter) {
1674
1675
  }
1675
1676
  return out;
1676
1677
  }
1677
- function scrubSecretText(text) {
1678
- if (typeof text !== "string" || text.length < 4) return text;
1679
- return applyPatterns(applyPatterns(text, SECRET_LITERAL_PATTERNS), SECRET_PAIR_PATTERNS);
1678
+ function scrubSecretText(text2) {
1679
+ if (typeof text2 !== "string" || text2.length < 4) return text2;
1680
+ return applyPatterns(applyPatterns(text2, SECRET_LITERAL_PATTERNS), SECRET_PAIR_PATTERNS);
1680
1681
  }
1681
- function scrubSecretTextCounted(text) {
1682
- if (typeof text !== "string" || text.length < 4) return {
1683
- text,
1682
+ function scrubSecretTextCounted(text2) {
1683
+ if (typeof text2 !== "string" || text2.length < 4) return {
1684
+ text: text2,
1684
1685
  redactions: 0
1685
1686
  };
1686
1687
  const counter = {
1687
1688
  redactions: 0
1688
1689
  };
1689
- const out = applyPatterns(applyPatterns(text, SECRET_LITERAL_PATTERNS, counter), SECRET_PAIR_PATTERNS, counter);
1690
+ const out = applyPatterns(applyPatterns(text2, SECRET_LITERAL_PATTERNS, counter), SECRET_PAIR_PATTERNS, counter);
1690
1691
  return {
1691
1692
  text: out,
1692
1693
  redactions: counter.redactions
1693
1694
  };
1694
1695
  }
1695
- function boundScrubInput(text, max = SCRUB_INPUT_MAX_CHARS) {
1696
- if (typeof text !== "string" || text.length <= max) return text;
1697
- const window = text.slice(Math.max(0, max - SCRUB_CUT_BACKOFF_CHARS), max);
1696
+ function boundScrubInput(text2, max = SCRUB_INPUT_MAX_CHARS) {
1697
+ if (typeof text2 !== "string" || text2.length <= max) return text2;
1698
+ const window = text2.slice(Math.max(0, max - SCRUB_CUT_BACKOFF_CHARS), max);
1698
1699
  const ws = window.search(/\s\S*$/);
1699
1700
  const cut2 = ws >= 0 ? max - window.length + ws : max;
1700
- return `${text.slice(0, cut2)}\u2026`;
1701
+ return `${text2.slice(0, cut2)}\u2026`;
1701
1702
  }
1702
1703
  function scrubSecretLines(lines) {
1703
1704
  return lines.map((l) => typeof l === "string" ? scrubSecretText(boundScrubInput(l)) : l);
@@ -1717,9 +1718,9 @@ function messageText(value3) {
1717
1718
  return value3 === void 0 || value3 === null ? "" : String(value3);
1718
1719
  }
1719
1720
  function scrubProviderMessage(raw, max = PROVIDER_MESSAGE_MAX_CHARS) {
1720
- const text = boundScrubInput(messageText(raw)).replace(/\s+/g, " ").trim();
1721
- if (!text) return void 0;
1722
- const out = scrubSecretText(text);
1721
+ const text2 = boundScrubInput(messageText(raw)).replace(/\s+/g, " ").trim();
1722
+ if (!text2) return void 0;
1723
+ const out = scrubSecretText(text2);
1723
1724
  return out.length > max ? `${out.slice(0, max - 1)}\u2026` : out;
1724
1725
  }
1725
1726
  function scrubStepErrorMessage(raw) {
@@ -1784,9 +1785,9 @@ function isEvalReservedDoubleId(double) {
1784
1785
  function evalCaseThreadId(runId, caseId) {
1785
1786
  return `evalrun:${runId}:${caseId}`;
1786
1787
  }
1787
- function evalMonthlyCapKey(agentId, at = /* @__PURE__ */ new Date()) {
1788
+ function evalMonthlyCapKey(agentId2, at = /* @__PURE__ */ new Date()) {
1788
1789
  const yyyymm = `${at.getUTCFullYear()}${String(at.getUTCMonth() + 1).padStart(2, "0")}`;
1789
- return `evalcap:${agentId}:${yyyymm}`;
1790
+ return `evalcap:${agentId2}:${yyyymm}`;
1790
1791
  }
1791
1792
  function isUnprovenUserSite(site) {
1792
1793
  return typeof site === "string" && (site === "job" || site === "workflow" || site.startsWith("workflow-"));
@@ -1849,14 +1850,14 @@ function supervisionAccessBindingViolation(merged) {
1849
1850
  }
1850
1851
  return null;
1851
1852
  }
1852
- function hasFormatCharacters(text) {
1853
- return FORMAT_CHARS.test(text);
1853
+ function hasFormatCharacters(text2) {
1854
+ return FORMAT_CHARS.test(text2);
1854
1855
  }
1855
1856
  function normalizedHandoverName(name) {
1856
1857
  return oneLine(name.normalize("NFKC")).toLowerCase();
1857
1858
  }
1858
- function handoverAgentIdSuffix(agentId) {
1859
- return agentId.slice(-6);
1859
+ function handoverAgentIdSuffix(agentId2) {
1860
+ return agentId2.slice(-6);
1860
1861
  }
1861
1862
  function parseConnectionHandoverApprovalPayload(payload) {
1862
1863
  if (!payload || typeof payload !== "object" || Array.isArray(payload)) return null;
@@ -1913,8 +1914,8 @@ function normalizeConnectionHandoverArgs(raw) {
1913
1914
  function approvalPayloadCoversConnectionHandover(payload, stored) {
1914
1915
  const p = parseConnectionHandoverApprovalPayload(payload);
1915
1916
  if (!p) return false;
1916
- const text = describeConnectionHandoverApproval(payload) ?? "";
1917
- if (text.length > CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS || scrubSecretText(text) !== text) return false;
1917
+ const text2 = describeConnectionHandoverApproval(payload) ?? "";
1918
+ if (text2.length > CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS || scrubSecretText(text2) !== text2) return false;
1918
1919
  const storedAccount = stored.account?.trim() || void 0;
1919
1920
  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;
1920
1921
  }
@@ -2136,23 +2137,23 @@ function parseThreadFollowUpInput(input) {
2136
2137
  if (hasPrompt === hasMessage) return null;
2137
2138
  const raw = hasPrompt ? o.prompt : o.message;
2138
2139
  if (typeof raw !== "string") return null;
2139
- const text = raw.trim();
2140
+ const text2 = raw.trim();
2140
2141
  const max = hasPrompt ? THREAD_FOLLOW_UP_LIMITS.promptMax : THREAD_FOLLOW_UP_LIMITS.messageMax;
2141
- if (text.length === 0 || text.length > max) return null;
2142
+ if (text2.length === 0 || text2.length > max) return null;
2142
2143
  if (o.idempotencyKey !== void 0 && !isValidCallerDedupeKey(o.idempotencyKey)) return null;
2143
2144
  return {
2144
2145
  mode: hasPrompt ? "turn" : "message",
2145
- text,
2146
+ text: text2,
2146
2147
  ...o.idempotencyKey !== void 0 ? {
2147
2148
  idempotencyKey: o.idempotencyKey
2148
2149
  } : {}
2149
2150
  };
2150
2151
  }
2151
- function threadFollowUpRateKeys(agentId, threadId, nowMs) {
2152
+ function threadFollowUpRateKeys(agentId2, threadId, nowMs) {
2152
2153
  const hour = Math.floor(nowMs / 36e5);
2153
2154
  return {
2154
- perThread: `thread-followup:${agentId}:${threadId}:${hour}`,
2155
- perAgent: `thread-followup:${agentId}:${hour}`
2155
+ perThread: `thread-followup:${agentId2}:${threadId}:${hour}`,
2156
+ perAgent: `thread-followup:${agentId2}:${hour}`
2156
2157
  };
2157
2158
  }
2158
2159
  function progressFractionToPercent(fraction) {
@@ -2632,8 +2633,8 @@ function withOverride(def, override) {
2632
2633
  "effect",
2633
2634
  "confirm"
2634
2635
  ]) {
2635
- const text = stored[field];
2636
- if (typeof text === "string" && text.trim()) next[field] = text;
2636
+ const text2 = stored[field];
2637
+ if (typeof text2 === "string" && text2.trim()) next[field] = text2;
2637
2638
  }
2638
2639
  if (def.tunableDefault && stored.default !== void 0) {
2639
2640
  const check = validateChannelSettingValue(def, stored.default);
@@ -2742,26 +2743,26 @@ function validateChannelSettingValue(def, value3, channel) {
2742
2743
  ok: false,
2743
2744
  error: "Must not be empty"
2744
2745
  };
2745
- const text = value3.trim();
2746
- if (rules.maxLength !== void 0 && text.length > rules.maxLength) {
2746
+ const text2 = value3.trim();
2747
+ if (rules.maxLength !== void 0 && text2.length > rules.maxLength) {
2747
2748
  return {
2748
2749
  ok: false,
2749
2750
  error: `Must be at most ${rules.maxLength} characters`
2750
2751
  };
2751
2752
  }
2752
- if (UNSAFE_TEXT.test(text)) return {
2753
+ if (UNSAFE_TEXT.test(text2)) return {
2753
2754
  ok: false,
2754
2755
  error: 'Must not contain <, > or " characters'
2755
2756
  };
2756
- if (rules.format === "slackReaction" && resolveSlackReactionName(text) === void 0) {
2757
+ if (rules.format === "slackReaction" && resolveSlackReactionName(text2) === void 0) {
2757
2758
  return {
2758
2759
  ok: false,
2759
- error: `${text} is not an emoji Slack can react with; use a common emoji or a :shortcode:`
2760
+ error: `${text2} is not an emoji Slack can react with; use a common emoji or a :shortcode:`
2760
2761
  };
2761
2762
  }
2762
2763
  return {
2763
2764
  ok: true,
2764
- value: text
2765
+ value: text2
2765
2766
  };
2766
2767
  }
2767
2768
  case "enum": {
@@ -3122,11 +3123,11 @@ function transformChatHistoryContentParts(parts) {
3122
3123
  mediaType: videoMatch[1]
3123
3124
  });
3124
3125
  } else {
3125
- let text = rawText.replace(/\\\\\\n/g, "\n");
3126
- text = removeNavigateBlock(text);
3126
+ let text2 = rawText.replace(/\\\\\\n/g, "\n");
3127
+ text2 = removeNavigateBlock(text2);
3127
3128
  content.push({
3128
3129
  type: "text",
3129
- text
3130
+ text: text2
3130
3131
  });
3131
3132
  }
3132
3133
  } else if (part.type === "file") {
@@ -3245,6 +3246,83 @@ function foldRichPartsIntoMessages(messages, records, makeMessage, sameTurnGroup
3245
3246
  while (next < synthetic.length) combined.push(synthetic[next++].message);
3246
3247
  return mergeRichPartMirrorMessages(combined, sameTurnGroup);
3247
3248
  }
3249
+ function text(item, field, index, required) {
3250
+ const value3 = item[field];
3251
+ if (value3 === void 0 && !required) return void 0;
3252
+ if (typeof value3 !== "string" || required && value3.trim().length === 0) {
3253
+ throw new Error(`Work item ${index}: \`${field}\` must be a ${required ? "non-empty " : ""}string`);
3254
+ }
3255
+ if ([
3256
+ ...value3
3257
+ ].length > LIMITS[field]) {
3258
+ throw new Error(`Work item ${index}: \`${field}\` is longer than ${LIMITS[field]} characters`);
3259
+ }
3260
+ return value3;
3261
+ }
3262
+ function normalizeWorkItems(items) {
3263
+ if (!Array.isArray(items)) throw new Error("Work items must be an array");
3264
+ if (items.length > MAX_WORK_ITEMS) {
3265
+ throw new Error(`At most ${MAX_WORK_ITEMS} work items can be published (got ${items.length})`);
3266
+ }
3267
+ const seen = /* @__PURE__ */ new Set();
3268
+ return items.map((raw, index) => {
3269
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
3270
+ throw new Error(`Work item ${index} must be an object`);
3271
+ }
3272
+ const item = raw;
3273
+ const id2 = text(item, "id", index, true);
3274
+ if (seen.has(id2)) throw new Error(`Work item ${index}: \`id\` "${id2}" is used more than once`);
3275
+ seen.add(id2);
3276
+ const title = text(item, "title", index, true);
3277
+ const group = text(item, "group", index, true);
3278
+ const action = text(item, "action", index, true);
3279
+ const status = text(item, "status", index, false);
3280
+ if (item.needsAction !== void 0 && typeof item.needsAction !== "boolean") {
3281
+ throw new Error(`Work item ${index}: \`needsAction\` must be a boolean`);
3282
+ }
3283
+ const when = item.updatedAt;
3284
+ const date = when instanceof Date ? when : typeof when === "string" ? new Date(when) : null;
3285
+ if (!date || Number.isNaN(date.getTime())) {
3286
+ throw new Error(`Work item ${index}: \`updatedAt\` must be a valid date`);
3287
+ }
3288
+ return {
3289
+ id: id2,
3290
+ title,
3291
+ group,
3292
+ ...item.needsAction !== void 0 ? {
3293
+ needsAction: item.needsAction
3294
+ } : {},
3295
+ ...status !== void 0 ? {
3296
+ status
3297
+ } : {},
3298
+ updatedAt: date.toISOString(),
3299
+ action
3300
+ };
3301
+ });
3302
+ }
3303
+ function workItemsRecord(items, now = /* @__PURE__ */ new Date()) {
3304
+ return {
3305
+ v: 1,
3306
+ items: normalizeWorkItems(items),
3307
+ updatedAt: now.toISOString()
3308
+ };
3309
+ }
3310
+ function withoutWorkItems(data) {
3311
+ if (!data || typeof data !== "object" || !(WORK_ITEMS_KEY in data)) return data;
3312
+ const { [WORK_ITEMS_KEY]: _list, ...rest } = data;
3313
+ return rest;
3314
+ }
3315
+ function mutationWithoutWorkItems(mutation) {
3316
+ return {
3317
+ ...mutation,
3318
+ ...mutation.set ? {
3319
+ set: withoutWorkItems(mutation.set)
3320
+ } : {},
3321
+ ...mutation.unset ? {
3322
+ unset: mutation.unset.filter((field) => field !== WORK_ITEMS_KEY)
3323
+ } : {}
3324
+ };
3325
+ }
3248
3326
  function utf8WidthAt(value3, index) {
3249
3327
  const code = value3.charCodeAt(index);
3250
3328
  if (code < 128) return {
@@ -4731,8 +4809,8 @@ function scheduleHealthView(health, state3) {
4731
4809
  } : {}
4732
4810
  };
4733
4811
  }
4734
- function scheduleHealthSourceId(agentId, jobId) {
4735
- return `schedule-health:${agentId}:${jobId}`;
4812
+ function scheduleHealthSourceId(agentId2, jobId) {
4813
+ return `schedule-health:${agentId2}:${jobId}`;
4736
4814
  }
4737
4815
  function workflowGoalJudgeKind(judge) {
4738
4816
  return judge && typeof judge === "object" && judge.predicate !== void 0 ? "predicate" : "agent";
@@ -4751,15 +4829,15 @@ function normalizeWorkflowGoalJudge(judge) {
4751
4829
  } : {}
4752
4830
  };
4753
4831
  }
4754
- function cut(text, max) {
4755
- if (text.length <= max) return text;
4832
+ function cut(text2, max) {
4833
+ if (text2.length <= max) return text2;
4756
4834
  let end = Math.max(0, max - 1);
4757
- const last = text.charCodeAt(end - 1);
4835
+ const last = text2.charCodeAt(end - 1);
4758
4836
  if (last >= 55296 && last <= 56319) end -= 1;
4759
- return `${text.slice(0, end)}${ELLIPSIS}`;
4837
+ return `${text2.slice(0, end)}${ELLIPSIS}`;
4760
4838
  }
4761
- function scrubString(text, state3) {
4762
- const scrubbed = scrubSecretText(boundScrubInput(text, STRING_SCRUB_INPUT_MAX_CHARS));
4839
+ function scrubString(text2, state3) {
4840
+ const scrubbed = scrubSecretText(boundScrubInput(text2, STRING_SCRUB_INPUT_MAX_CHARS));
4763
4841
  if (scrubbed.length > APPROVAL_ARG_STRING_MAX_CHARS) state3.truncated = true;
4764
4842
  return cut(scrubbed, APPROVAL_ARG_STRING_MAX_CHARS);
4765
4843
  }
@@ -4844,10 +4922,10 @@ function walkObject(obj, depth, state3) {
4844
4922
  }
4845
4923
  return out;
4846
4924
  }
4847
- function fitString(text, room) {
4848
- let n2 = Math.min(text.length, room - 3);
4925
+ function fitString(text2, room) {
4926
+ let n2 = Math.min(text2.length, room - 3);
4849
4927
  while (n2 >= 16) {
4850
- const candidate = cut(text, n2);
4928
+ const candidate = cut(text2, n2);
4851
4929
  if (JSON.stringify(candidate).length <= room) return candidate;
4852
4930
  n2 = Math.floor(n2 * 0.8);
4853
4931
  }
@@ -4931,9 +5009,9 @@ function createPersistScrubber(maxChars = PERSIST_SCRUB_MAX_CHARS) {
4931
5009
  const bounded = boundScrubInput(value3, remaining);
4932
5010
  if (bounded !== value3) state3.truncated = true;
4933
5011
  remaining -= bounded.length;
4934
- const { text, redactions } = scrubSecretTextCounted(bounded);
5012
+ const { text: text2, redactions } = scrubSecretTextCounted(bounded);
4935
5013
  state3.redactions += redactions;
4936
- return text;
5014
+ return text2;
4937
5015
  }, "scrub");
4938
5016
  return {
4939
5017
  scrub,
@@ -4943,9 +5021,9 @@ function createPersistScrubber(maxChars = PERSIST_SCRUB_MAX_CHARS) {
4943
5021
  function scrubMessageContentForPersist(content, maxChars = PERSIST_SCRUB_MAX_CHARS) {
4944
5022
  const { scrub, state: state3 } = createPersistScrubber(maxChars);
4945
5023
  if (typeof content === "string") {
4946
- const text = scrub(content);
5024
+ const text2 = scrub(content);
4947
5025
  return {
4948
- content: text !== content ? text : content,
5026
+ content: text2 !== content ? text2 : content,
4949
5027
  ...state3
4950
5028
  };
4951
5029
  }
@@ -4957,19 +5035,19 @@ function scrubMessageContentForPersist(content, maxChars = PERSIST_SCRUB_MAX_CHA
4957
5035
  let changed = false;
4958
5036
  const parts = content.map((part) => {
4959
5037
  if (typeof part === "string") {
4960
- const text = scrub(part);
4961
- if (text === part) return part;
5038
+ const text2 = scrub(part);
5039
+ if (text2 === part) return part;
4962
5040
  changed = true;
4963
- return text;
5041
+ return text2;
4964
5042
  }
4965
5043
  if (part && typeof part === "object" && part.type === "text" && typeof part.text === "string") {
4966
5044
  const original = part.text;
4967
- const text = scrub(original);
4968
- if (text === original) return part;
5045
+ const text2 = scrub(original);
5046
+ if (text2 === original) return part;
4969
5047
  changed = true;
4970
5048
  return {
4971
5049
  ...part,
4972
- text
5050
+ text: text2
4973
5051
  };
4974
5052
  }
4975
5053
  return part;
@@ -5080,11 +5158,11 @@ function workflowApprovalDecisionOf(resumeData) {
5080
5158
  function workflowApprovalOutput(resumeData) {
5081
5159
  const decision = typeof resumeData.decision === "string" ? resumeData.decision : workflowApprovalDecisionOf(resumeData);
5082
5160
  const note = typeof resumeData.note === "string" && resumeData.note.trim() !== "" ? resumeData.note : void 0;
5083
- const text = typeof resumeData.text === "string" ? resumeData.text : note ?? decision;
5161
+ const text2 = typeof resumeData.text === "string" ? resumeData.text : note ?? decision;
5084
5162
  return {
5085
5163
  ...resumeData,
5086
5164
  decision,
5087
- text
5165
+ text: text2
5088
5166
  };
5089
5167
  }
5090
5168
  function isWorkflowApprovalOutput(value3) {
@@ -5092,8 +5170,8 @@ function isWorkflowApprovalOutput(value3) {
5092
5170
  const v = value3;
5093
5171
  return typeof v.approved === "boolean" && WORKFLOW_APPROVAL_OUTPUT_DECISIONS.includes(v.decision) && typeof v.text === "string";
5094
5172
  }
5095
- function extractSingleJsonValue(text) {
5096
- const trimmed = (text ?? "").trim();
5173
+ function extractSingleJsonValue(text2) {
5174
+ const trimmed = (text2 ?? "").trim();
5097
5175
  if (!trimmed) return {
5098
5176
  reason: "reply is empty"
5099
5177
  };
@@ -5251,8 +5329,8 @@ function isWebRouteInput(value3) {
5251
5329
  if (!app || typeof app.id !== "string" || typeof app.name !== "string" || typeof app.origin !== "string") return false;
5252
5330
  return true;
5253
5331
  }
5254
- function evidenceDisplayText(text) {
5255
- const raw = typeof text === "string" ? text : "";
5332
+ function evidenceDisplayText(text2) {
5333
+ const raw = typeof text2 === "string" ? text2 : "";
5256
5334
  if (!raw.trim()) return "";
5257
5335
  const lines = removeHiddenBlocks(raw).split(/\r?\n/).map((line) => {
5258
5336
  const t = line.trim();
@@ -5265,22 +5343,22 @@ function evidenceDisplayText(text) {
5265
5343
  const out = lines.join(" ").replace(/\s+/g, " ").trim();
5266
5344
  return out || "[Attachment]";
5267
5345
  }
5268
- function evidenceSnippet(text) {
5269
- const flat = evidenceDisplayText(text);
5346
+ function evidenceSnippet(text2) {
5347
+ const flat = evidenceDisplayText(text2);
5270
5348
  return flat.length <= EVIDENCE_SNIPPET_MAX_CHARS ? flat : `${flat.slice(0, EVIDENCE_SNIPPET_MAX_CHARS - 1)}\u2026`;
5271
5349
  }
5272
- function evidenceWordCount(text) {
5273
- if (typeof text !== "string") return 0;
5274
- const t = text.trim();
5350
+ function evidenceWordCount(text2) {
5351
+ if (typeof text2 !== "string") return 0;
5352
+ const t = text2.trim();
5275
5353
  return t ? t.split(/\s+/).length : 0;
5276
5354
  }
5277
5355
  function evidenceKey(label) {
5278
5356
  return label.toLowerCase().replace(/[_\-\s]+/g, " ").trim();
5279
5357
  }
5280
- function evidenceOpaqueKey(text) {
5358
+ function evidenceOpaqueKey(text2) {
5281
5359
  let h = 0xcbf29ce484222325n;
5282
5360
  const prime = 0x100000001b3n;
5283
- for (const ch of evidenceKey(text)) {
5361
+ for (const ch of evidenceKey(text2)) {
5284
5362
  h ^= BigInt(ch.codePointAt(0) ?? 0);
5285
5363
  h = h * prime & 0xffffffffffffffffn;
5286
5364
  }
@@ -5401,7 +5479,7 @@ function evidenceDays(from, to) {
5401
5479
  return out;
5402
5480
  }
5403
5481
  function summarizeEvidence(input) {
5404
- const { agentId, from, to } = input;
5482
+ const { agentId: agentId2, from, to } = input;
5405
5483
  const windowDays = evidenceDays(from, to);
5406
5484
  const readable = /* @__PURE__ */ __name3((s) => s === "ok" || s === "empty", "readable");
5407
5485
  const covered = /* @__PURE__ */ __name3((d) => readable(d.sources?.messages) && readable(d.sources?.analyses), "covered");
@@ -5475,7 +5553,7 @@ function summarizeEvidence(input) {
5475
5553
  const short = wordRows.reduce((a, h) => a + h.short, 0);
5476
5554
  const long = wordRows.reduce((a, h) => a + h.long, 0);
5477
5555
  return {
5478
- agentId,
5556
+ agentId: agentId2,
5479
5557
  window: {
5480
5558
  from,
5481
5559
  to,
@@ -5938,16 +6016,16 @@ function slashDecodedPath(path3) {
5938
6016
  }
5939
6017
  return out.join("/");
5940
6018
  }
5941
- function jsonHasDuplicateKey(text) {
6019
+ function jsonHasDuplicateKey(text2) {
5942
6020
  const stack = [];
5943
- for (let i = 0; i < text.length; i++) {
5944
- const c = text[i];
6021
+ for (let i = 0; i < text2.length; i++) {
6022
+ const c = text2[i];
5945
6023
  if (c === '"') {
5946
6024
  let j = i + 1;
5947
- while (j < text.length && text[j] !== '"') j += text[j] === "\\" ? 2 : 1;
6025
+ while (j < text2.length && text2[j] !== '"') j += text2[j] === "\\" ? 2 : 1;
5948
6026
  const top = stack[stack.length - 1];
5949
6027
  if (top && top.expectKey) {
5950
- const key = JSON.parse(text.slice(i, j + 1));
6028
+ const key = JSON.parse(text2.slice(i, j + 1));
5951
6029
  if (top.keys.has(key)) return true;
5952
6030
  top.keys.add(key);
5953
6031
  top.expectKey = false;
@@ -6033,7 +6111,7 @@ function classifyConnectionOperation(op) {
6033
6111
  return NOT_SEND;
6034
6112
  }
6035
6113
  function connectionSendPolicyIsActive(policy) {
6036
- return Boolean(policy) && (policy.allowSend === false || Array.isArray(policy.recipientAllowlist));
6114
+ return !!policy && (policy.allowSend === false || Array.isArray(policy.recipientAllowlist));
6037
6115
  }
6038
6116
  function allowlistAdmits(entries, email) {
6039
6117
  const domain = email.slice(email.lastIndexOf("@") + 1);
@@ -6063,8 +6141,9 @@ function evaluateConnectionSendPolicy(policy, op) {
6063
6141
  classification
6064
6142
  };
6065
6143
  }
6066
- if (Array.isArray(policy.recipientAllowlist)) {
6067
- const denied = classification.recipients.filter((email) => !allowlistAdmits(policy.recipientAllowlist, email));
6144
+ const allowlist = policy.recipientAllowlist;
6145
+ if (Array.isArray(allowlist)) {
6146
+ const denied = classification.recipients.filter((email) => !allowlistAdmits(allowlist, email));
6068
6147
  if (denied.length > 0 || classification.recipientsUnknown) {
6069
6148
  return {
6070
6149
  allowed: false,
@@ -6106,7 +6185,111 @@ function isPaymentRequiredChatErrorEnvelope(data) {
6106
6185
  if (d.type !== "error") return false;
6107
6186
  return d.textDelta === BILLING_REJECTION_TEXT_CREDITS || d.textDelta === BILLING_REJECTION_TEXT_SEAT || d.textDelta === BILLING_REJECTION_TEXT_USER_QUOTA;
6108
6187
  }
6109
- var __defProp3, __name3, PLUMBING_THREAD_CHANNELS, CHANNEL_CONVERSATION_CHANNELS, HIDDEN_THREAD_CHANNELS, CHOICE_PERSON_TURN_CHANNELS, CHOICE_REPLAY_CLIENT_CAPABILITIES, CHOICE_REPLAY_CLIENT_SURFACES, INTEGRATION_PASSTHROUGH_READ_METHODS, URL_REINTERPRETED_PATH_CHARACTERS, PERCENT_ENCODED_DOT, PERCENT_ESCAPE, DECODED_PATH_SEPARATORS, DECODED_LEADING_SEPARATOR, MAX_PERCENT_DECODE_ROUNDS, URL_RESOLUTION_PROBE_BASE, PLATFORM_INVOCATION_CALLERS, SUPERVISION_OPS, SUPERVISION_OPS_WAVE2, SUPERVISION_WATCHDOG_OPS, SUPERVISION_WATCHDOG_ERRORS, SUPERVISION_ROLLBACK_REFUSAL_CODES, SUPERVISION_ROLLBACK_LINEAGE_MAX, SUPERVISION_UNTARGETED_OPS, SUPERVISED_WORKFLOW_VERSIONS_MAX, SUPERVISION_EVENT_KINDS, AGENT_PROVISIONING_LIMITS, AGENT_PROVISIONING_APPROVAL_PAYLOAD_KEY, AGENT_PROVISIONING_ERRORS, PROVISIONED_SUPERVISION_ACTIONS, isNonEmptyString, uniqueStrings, sameSet, AGENT_PROVISIONING_APPROVAL_CARD_MAX_CHARS, APPROVAL_PAYLOAD_MEMBERS, AGENT_CONNECTION_POLICIES, AGENT_CONNECTION_POLICY_DEFAULT, AGENT_CONNECTION_MOUNT_MODES, AGENT_CONNECTION_GOVERNANCE_ERRORS, AGENT_CONNECTION_OPERATION_RULES_MAX, AGENT_CONNECTION_OPERATION_PATTERN_MAX_LENGTH, OPERATION_RULE_METHODS, PATH_SEPARATOR, PATH_SINGLE_SEGMENT_WILDCARD, PATH_REST_WILDCARD, METHOD_OVERRIDE_HEADER_NAMES, METHOD_OVERRIDE_QUERY_NAMES, ODATA_BATCH_SEGMENT, GOOGLE_BATCH_FIRST_SEGMENT, CONNECTION_CHECK_RESULTS, CONNECTION_CHECK_CATALOGUE_V1, CONNECTION_CHECK_NAME_PATTERN, CONNECTION_CHECK_NAME_MAX, CONNECT_OUTCOME_STATUSES, SECRET_TEST_RESULTS, SECRET_DATADOG_REGIONS, SECRET_PROVIDER_CATALOGUE_V1, SECRET_TEST_MAX_RESPONSE_BYTES, SECRET_ENV_KEY_PATTERN, SECRET_REQUEST_ERRORS, SECRET_OUTCOME_STATUSES, CLIENT_OUTCOME_TURNS_MAX, SHORT_TEXT_MAX, SLUG_MAX, shortText, optionalShortText, CONNECTION_REQUEST_TERMINAL_STATES, CONNECTION_USE_ORIGINS, AGENT_CONNECTION_OPERATION_LIMITS_BOUNDS, CURRENCY_CODE, LIMITS_KEYS, CAPS_KEYS, EXCLUSIONS_KEYS, EMAIL_IN_TEXT, MAX_EXCLUSION_DEPTH, PROJECTION_PARAMETER_KEYS, CHANNEL_PARAMETER_KEYS, GMAIL_SYSTEM_LABEL_IDS, ZERO_DECIMAL_CURRENCIES, THREE_DECIMAL_CURRENCIES, DECIMAL_AMOUNT, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, TEST_SESSION_ID_PATTERN, TEST_SESSION_COLLECTION_PREFIX, TEST_EFFECT_BODY_MAX_BYTES, TEST_EFFECT_DROPPED_HEADERS, EVAL_CREDITS_PER_1K_TOKENS, EVAL_RESERVED_TOOL_ID_PREFIXES, CONNECTION_HANDOVER_APPROVAL_PAYLOAD_KEY, CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS, CONNECTION_HANDOVER_LIMITS, MEMBERS, FORMAT_CHARS, oneLine, boundedString, AGENT_METRIC_NAME_PATTERN, AGENT_METRIC_LIMITS, AGENT_OBJECTIVE_ERRORS, CHANGE_LEASE_TTL_MINUTES_MIN, CHANGE_LEASE_TTL_MINUTES_MAX, CHANGE_LEASE_REASON_MAX, CHANGE_LEASE_ERRORS, AGENT_CONFIG_SET_LIMITS, SECRET_ENV_KEY_SUFFIXES, DEFAULT_OWNER_DEPARTURE_POLICY, AGENT_LIFECYCLE_ERRORS, USER_COST_COUNTER_TTL_SECONDS, USER_COST_ATTRIBUTION_CHANNELS, CALLER_DEDUPE_KEY_MAX, FOLLOW_UP_IDEMPOTENCY_TTL_SECONDS, THREAD_FOLLOW_UP_LIMITS, THREAD_FOLLOW_UP_ERRORS, PROGRESS_UPDATE_LIMITS, PAUSABLE_CAPABILITY_KINDS, UNIFIED_CATCH_UP_MAX_WINDOW_HOURS, UNIFIED_CATCH_UP_EVENTS, UNIFIED_CATCH_UP_FILTERABLE_OBJECT_TYPES, AGENT_NEVER_RULES_MAX, AGENT_NEVER_RULE_FIELD_MAX, AGENT_NEVER_RULE_INPUT_MATCH_MAX, NEVER_RULE_ID_PATTERN, NEVER_RULE_HTTP_METHODS, TEMPLATE_DISTRIBUTION_MODES, CHANNEL_SEND_CHANNELS, TAKEOVER_MAX_IDLE_MINUTES, MINUTES_PER_DAY, DEFAULT_IDLE_RELEASE_MINUTES, FALLBACK_IDLE_RELEASE_MINUTES, VARIATION_SELECTORS, SLACK_EMOJI_NAMES, SLACK_SHORTCODE, PLAIN_EMAIL_ADDRESS, DOMAIN, UNSAFE_TEXT, SLACK_CONVERSATION_ID, CHANNEL_SETTING_GROUPS, THREAD_SCOPING_NOUN, TAKEOVER_CHANNEL_TYPES, EMAIL_SETTINGS, SLACK_SETTING_DEFAULTS, SLACK_REACTION_MAX, SLACK_INTRO_MAX, SLACK_EXAMPLE_PROMPTS_MAX, SLACK_EXAMPLE_PROMPT_MAX, SLACK_SUPPORT_CONTACT_MAX, SLACK_SETTINGS, CHANNEL_SETTINGS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, LOG_FIELDS_MAX_KEYS, LOG_FIELD_MAX_VALUE_BYTES, LOG_FIELDS_MAX_BYTES, LOG_FIELD_KEY_PATTERN, LOG_FIELD_SECRET_SHAPED_KEY_PATTERNS, LOG_FIELDS_CLAMPED_KEY, LOG_FIELD_ARRAY_COUNT_SUFFIX, LuaLogFieldsError, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_MODEL_CLASSES, WORKFLOW_DEFAULT_TASK_CLASS_MAP, WORKFLOW_MODELS_MAX_CLASS_DEFAULT, WORKFLOW_AUTONOMY_NUMERIC_KEYS, WORKFLOW_AUTONOMY_ENVELOPE_KEYS, WORKFLOW_AUTONOMY_DEFAULTS, WORKFLOW_AUTONOMY_CEILINGS, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_ENV, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_CEILING, WORKFLOW_AUTONOMY_FORMS_DEFAULT, WORKFLOW_AUTONOMY_MIN_VALUE, WORKFLOW_JOB_RANGES, WORKFLOW_JOB_RANGE_MEMBERS, WORKFLOW_SINGLE_STEP_TYPES, WORKFLOW_HITL_ENTRY_TYPES, WORKFLOW_ARM_ENTRY_TYPES, WORKFLOW_HITL_ARM_CONTAINERS, WORKFLOW_GRAPH_ENTRY_STEP_KINDS, WORKFLOW_ARM_ENTRY_STEP_KINDS, WORKFLOW_BUDGET_MAX_DURATION_SECONDS, MODEL_ID_BYOK_PROVIDERS, MODEL_CLASS_REF_PREFIX, MODEL_SNAPSHOT_SUFFIX, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, AGENT_LOG_SOURCES, AGENT_LOG_FIELDS_MAX_WIRE_KEYS, LOG_DRAIN_TYPES_PHASE1, LOG_DRAIN_TYPES_PHASE2, LOG_DRAIN_TYPES_IMPLEMENTED, LOG_DRAIN_SOURCES, LOG_DRAIN_MAX_PER_ORG, LOG_DRAIN_MAX_PER_ORG_ENTERPRISE, LOG_DRAIN_DATADOG_SITES, LOG_DRAIN_NEWRELIC_SITES, LOG_DRAIN_ENDPOINT_TEMPLATES, LOG_DRAIN_PRESET_SITES, LOG_DRAIN_BUCKET_NAME_PATTERN, LOG_DRAIN_BUCKET_HOST_PATTERNS, LOG_DRAIN_PRESET_HOST_SUFFIXES, DRAIN_CONTENT_ACK_ERROR_CODE, DRAIN_CONTENT_ACK_FIELD, DrainContentAckRequiredError, LOG_DRAIN_PRESET_PATHS, PRESET_SEGMENT_RE, LOG_DRAIN_QUOTAS, LOG_DRAIN_QUOTA_WARN_RATIO, LOG_DRAIN_QUOTA_DROP_DEBUG_RATIO, LOG_DRAIN_QUOTA_DROP_INFO_RATIO, LOG_DRAIN_QUOTA_PAUSE_RATIO, LOG_EXPORT_SOURCES, LOG_EXPORT_MAX_WINDOW_DAYS, LOG_EXPORT_MAX_WINDOW_MS, LOG_EXPORT_URL_TTL_SECONDS, LOG_EXPORT_FILE_RETENTION_DAYS, LOG_EXPORT_FILE_RETENTION_MS, LOG_EXPORT_PART_MAX_BYTES, LOG_DRAIN_NOTICE_RATE_LIMIT_MS, LOG_DRAIN_VERIFICATION_STALE_MS, LOG_DRAIN_DIGEST_INTERVAL_MS, LOG_DRAIN_DIGEST_MAX_ENTRIES, LOG_DRAIN_NOTICE_ERROR_MAX_CHARS, LOG_DRAIN_USAGE_LINE_ITEM, LOG_DRAIN_BYTES_PER_GIB, DEFAULT_LOG_DRAIN_PLAN_CONFIG, TIERS, LOG_CURSOR_MAX_LENGTH, LOG_CURSOR_MAX_ID_LENGTH, LOG_RELATIVE_TIME_PATTERN, LOG_ISO_TIME_PATTERN, RELATIVE_UNIT_MS, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, KEYS, MAX_BODY_BYTES, MAX_ID_LENGTH, UTC_ISO, TEMPLATE_TRIGGER_URL_ENV_PREFIX, TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, LUA_SESSION_ID_CLAIM, SESSION_REVOKED_CODE, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_RUN_GATE_KINDS, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, WORKFLOW_SIGNAL_EVENT_SITES, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_AGENT_APP_CONNECTION_PREFIX, WORKFLOW_JOB_MODEL_SOURCE_LABELS, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_SIGNAL_NAME_RE, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, SCHEDULE_HEALTH_NOTIFY_CHANNELS, SCHEDULE_HEALTH_DEFAULT_NOTIFY, SCHEDULE_HEALTH_LIMITS, KNOWN_KEYS, WORKFLOW_GOAL_JUDGE_SELF, APPROVAL_ARGS_MAX_CHARS, APPROVAL_ARG_STRING_MAX_CHARS, APPROVAL_ARGS_SUMMARY_MAX_CHARS, MAX_DEPTH, MAX_KEYS, MAX_ITEMS, MAX_NODES, MAX_KEY_CHARS, KEY_SCRUB_INPUT_MAX_CHARS, STRING_SCRUB_INPUT_MAX_CHARS, ELLIPSIS, SKIP, SCRUB_SECRETS_BEFORE_PERSIST_ENV, PERSIST_SCRUB_MAX_CHARS, PERSIST_SCRUB_REF_MAX_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES, SUBAGENT_PER_KEY_FLAG_ENV, PER_KEY_FLAG_VALUES, ONBOARDING_FLOW_KEY, ONBOARDING_SCHEMA_VERSION, id, copy, onboardingHeadingSchema, onboardingRichTextInlineSchema, onboardingRichTextSchema, onboardingDestinationSchema, onboardingArtworkSchema, onboardingAnswerSchema, onboardingQuestionSchema, onboardingTemplateSectionSchema, onboardingInstallScreenSchema, onboardingResultScreenSchema, onboardingConnectScreenSchema, onboardingTemplateContentSchema, onboardingUnavailableOutcomeSchema, onboardingFlowSchema, onboardingActorSchema, onboardingEditorSchema, onboardingPublicationSummarySchema, onboardingValidationIssueSchema, onboardingValidationResponseSchema, onboardingAssetSchema, onboardingPublicAssetSchema, getOnboardingConfigResponseSchema, saveOnboardingDraftRequestSchema, validateOnboardingRequestSchema, publishOnboardingRequestSchema, rollbackOnboardingRequestSchema, onboardingTemplateCatalogItemSchema, getPublishedOnboardingResponseSchema, WEB_ROUTE_PROTOCOL_VERSION, WEB_ROUTE_METHODS, WEB_ROUTE_REQUEST_HEADER_ALLOWLIST, WEB_ROUTE_RESPONSE_HEADER_ALLOWLIST, WEB_ROUTE_MAX_REQUEST_BODY_BYTES, WEB_ROUTE_MAX_RESPONSE_BYTES, WEB_APP_NAME_PATTERN, WEB_APP_ENTRY_HTML_MAX_CHARS, WEB_APP_MAX_ASSET_BYTES, EVIDENCE_SESSION_IDLE_MS, EVIDENCE_MIN_CONVERSATIONS, EVIDENCE_LOW_CONFIDENCE_N, EVIDENCE_SNIPPET_MAX_CHARS, EVIDENCE_EXAMPLES_PER_ITEM, EVIDENCE_SHOWN_ITEMS, EVIDENCE_LATENCY_BOUNDS_MS, EVIDENCE_WORD_BOUNDS, BAD_CONVERSATION_REASONS, ATTACHMENT_LINES, REVIEW_VERDICT_REASON_ORDER, ENV_TEMPLATE_SECRET_KEY_RE, CONNECTION_SEND_NOT_ALLOWED, CONNECTION_RECIPIENT_NOT_ALLOWED, NOT_SEND, PLAIN_ADDRESS, RecipientSet, MCP_MESSAGING_CREATE, MCP_CALENDAR_EVENT_WRITE, REPLY_KEYS, DEDICATED_MAIL_SLUGS, FULL_SUITE_SLUGS, WELL_KNOWN_MAIL_FOLDERS, MEMBER_KEYS, CANONICAL_ORIGIN, CANONICAL_PREFIX, STRICT_BASE64, GMAIL_PREFIX, GMAIL_MESSAGES_SEND, GMAIL_DRAFTS_SEND, GOOGLE_BATCH, GRAPH_VERSION, GRAPH_PRINCIPAL, GRAPH_SEND_MAIL, GRAPH_MESSAGE_ACTION, GRAPH_OWNER, GRAPH_EVENTS, GRAPH_EVENT_COLLECTION, GRAPH_EVENT_ID, GRAPH_EVENT_ITEM, GRAPH_EVENT_ACTION, GRAPH_BATCH, GRAPH_TEAMS_MESSAGE, GRAPH_ACTIVITY_NOTIFICATION, GRAPH_GROUP_CONVERSATION, GCAL_EVENTS, GRAPH_READ_KEYS, MALFORMED_POLICY, BILLING_REJECTION_TEXT_CREDITS, BILLING_REJECTION_TEXT_SEAT, BILLING_REJECTION_TEXT_USER_QUOTA;
6188
+ function isCustomMcpConnectionId(id2) {
6189
+ return typeof id2 === "string" && id2.startsWith(CUSTOM_MCP_CONNECTION_ID_PREFIX);
6190
+ }
6191
+ function isConnectionBackedMcpSource(source) {
6192
+ return typeof source === "string" && CONNECTION_BACKED_MCP_SOURCES.includes(source);
6193
+ }
6194
+ function newCustomMcpReferenceId() {
6195
+ const bytes = globalThis.crypto.getRandomValues(new Uint8Array(6));
6196
+ return `mcpx_${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
6197
+ }
6198
+ function customMcpWorkflowKey(displayName) {
6199
+ const slug = displayName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
6200
+ if (!slug) return `s-${fnv1a32(displayName.trim())}`;
6201
+ return (/^[a-z]/.test(slug) ? slug : `s-${slug}`).slice(0, WORKFLOW_KEY_MAX_LENGTH);
6202
+ }
6203
+ function fnv1a32(value3) {
6204
+ let hash = 2166136261;
6205
+ for (const char of value3) {
6206
+ hash ^= char.codePointAt(0) ?? 0;
6207
+ hash = Math.imul(hash, 16777619) >>> 0;
6208
+ }
6209
+ return hash.toString(16).padStart(8, "0");
6210
+ }
6211
+ function addCaseDuplicateIssues(names, ctx, path3) {
6212
+ const seen = /* @__PURE__ */ new Set();
6213
+ for (const name of names) {
6214
+ const lower2 = name.toLowerCase();
6215
+ if (seen.has(lower2)) {
6216
+ ctx.addIssue({
6217
+ code: z5.ZodIssueCode.custom,
6218
+ path: path3,
6219
+ message: `Header "${name}" is listed twice`
6220
+ });
6221
+ }
6222
+ seen.add(lower2);
6223
+ }
6224
+ }
6225
+ function toCustomMcpToolSnapshot(tools) {
6226
+ const snapshot = [];
6227
+ const seen = /* @__PURE__ */ new Set();
6228
+ for (const tool of tools) {
6229
+ if (snapshot.length >= CUSTOM_MCP_MAX_TOOLS) break;
6230
+ const name = tool.name;
6231
+ if (typeof name !== "string" || !name || name.length > CUSTOM_MCP_TOOL_NAME_MAX_LENGTH || seen.has(name)) continue;
6232
+ seen.add(name);
6233
+ snapshot.push({
6234
+ name,
6235
+ ...typeof tool.title === "string" && tool.title ? {
6236
+ title: tool.title.slice(0, CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH)
6237
+ } : {},
6238
+ ...typeof tool.description === "string" && tool.description ? {
6239
+ description: tool.description.slice(0, CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH)
6240
+ } : {}
6241
+ });
6242
+ }
6243
+ return snapshot;
6244
+ }
6245
+ function customMcpRuntimeToolFilter(selection) {
6246
+ return selection.allowAll ? void 0 : {
6247
+ allow: [
6248
+ ...selection.enabled
6249
+ ]
6250
+ };
6251
+ }
6252
+ function createBody(extra) {
6253
+ return z5.discriminatedUnion("authKind", [
6254
+ z5.object({
6255
+ authKind: z5.literal("none"),
6256
+ ...createFields,
6257
+ ...extra
6258
+ }).strict(),
6259
+ z5.object({
6260
+ authKind: z5.literal("headers"),
6261
+ headers: customMcpHeadersSchema.refine((headers) => Object.keys(headers).length > 0, "Add a header"),
6262
+ ...createFields,
6263
+ ...extra
6264
+ }).strict()
6265
+ ]);
6266
+ }
6267
+ function startBody(extra) {
6268
+ return z5.union([
6269
+ z5.object({
6270
+ url: customMcpUrlInputSchema,
6271
+ displayName: customMcpDisplayNameSchema,
6272
+ ...startFields,
6273
+ ...extra
6274
+ }).strict(),
6275
+ /** Sign in again. `url` only after `REAUTH_REQUIRED`; otherwise the stored URL is used. */
6276
+ z5.object({
6277
+ targetConnectionId: customMcpConnectionIdSchema,
6278
+ url: customMcpUrlInputSchema.optional(),
6279
+ ...startFields
6280
+ }).strict()
6281
+ ]);
6282
+ }
6283
+ function maskMcpServerHeaders(server) {
6284
+ const { headers, ...rest } = server;
6285
+ const headerNames = Object.keys(headers ?? {});
6286
+ return {
6287
+ ...rest,
6288
+ headerNames,
6289
+ headersSet: headerNames.length > 0
6290
+ };
6291
+ }
6292
+ var __defProp3, __name3, PLUMBING_THREAD_CHANNELS, CHANNEL_CONVERSATION_CHANNELS, HIDDEN_THREAD_CHANNELS, CHOICE_PERSON_TURN_CHANNELS, CHOICE_REPLAY_CLIENT_CAPABILITIES, CHOICE_REPLAY_CLIENT_SURFACES, INTEGRATION_PASSTHROUGH_READ_METHODS, URL_REINTERPRETED_PATH_CHARACTERS, PERCENT_ENCODED_DOT, PERCENT_ESCAPE, DECODED_PATH_SEPARATORS, DECODED_LEADING_SEPARATOR, MAX_PERCENT_DECODE_ROUNDS, URL_RESOLUTION_PROBE_BASE, PLATFORM_INVOCATION_CALLERS, SUPERVISION_OPS, SUPERVISION_OPS_WAVE2, SUPERVISION_WATCHDOG_OPS, SUPERVISION_WATCHDOG_ERRORS, SUPERVISION_ROLLBACK_REFUSAL_CODES, SUPERVISION_ROLLBACK_LINEAGE_MAX, SUPERVISION_UNTARGETED_OPS, SUPERVISED_WORKFLOW_VERSIONS_MAX, SUPERVISION_EVENT_KINDS, AGENT_PROVISIONING_LIMITS, AGENT_PROVISIONING_APPROVAL_PAYLOAD_KEY, AGENT_PROVISIONING_ERRORS, PROVISIONED_SUPERVISION_ACTIONS, isNonEmptyString, uniqueStrings, sameSet, AGENT_PROVISIONING_APPROVAL_CARD_MAX_CHARS, APPROVAL_PAYLOAD_MEMBERS, AGENT_CONNECTION_POLICIES, AGENT_CONNECTION_POLICY_DEFAULT, AGENT_CONNECTION_MOUNT_MODES, AGENT_CONNECTION_GOVERNANCE_ERRORS, AGENT_CONNECTION_OPERATION_RULES_MAX, AGENT_CONNECTION_OPERATION_PATTERN_MAX_LENGTH, OPERATION_RULE_METHODS, PATH_SEPARATOR, PATH_SINGLE_SEGMENT_WILDCARD, PATH_REST_WILDCARD, METHOD_OVERRIDE_HEADER_NAMES, METHOD_OVERRIDE_QUERY_NAMES, ODATA_BATCH_SEGMENT, GOOGLE_BATCH_FIRST_SEGMENT, CONNECTION_CHECK_RESULTS, CONNECTION_CHECK_CATALOGUE_V1, CONNECTION_CHECK_NAME_PATTERN, CONNECTION_CHECK_NAME_MAX, CONNECT_OUTCOME_STATUSES, SECRET_TEST_RESULTS, SECRET_DATADOG_REGIONS, SECRET_PROVIDER_CATALOGUE_V1, SECRET_TEST_MAX_RESPONSE_BYTES, SECRET_ENV_KEY_PATTERN, SECRET_REQUEST_ERRORS, SECRET_OUTCOME_STATUSES, CLIENT_OUTCOME_TURNS_MAX, SHORT_TEXT_MAX, SLUG_MAX, shortText, optionalShortText, CONNECTION_REQUEST_TERMINAL_STATES, CONNECTION_USE_ORIGINS, AGENT_CONNECTION_OPERATION_LIMITS_BOUNDS, CURRENCY_CODE, LIMITS_KEYS, CAPS_KEYS, EXCLUSIONS_KEYS, EMAIL_IN_TEXT, MAX_EXCLUSION_DEPTH, PROJECTION_PARAMETER_KEYS, CHANNEL_PARAMETER_KEYS, GMAIL_SYSTEM_LABEL_IDS, ZERO_DECIMAL_CURRENCIES, THREE_DECIMAL_CURRENCIES, DECIMAL_AMOUNT, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, TEST_SESSION_ID_PATTERN, TEST_SESSION_COLLECTION_PREFIX, TEST_EFFECT_BODY_MAX_BYTES, TEST_EFFECT_DROPPED_HEADERS, EVAL_CREDITS_PER_1K_TOKENS, EVAL_RESERVED_TOOL_ID_PREFIXES, CONNECTION_HANDOVER_APPROVAL_PAYLOAD_KEY, CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS, CONNECTION_HANDOVER_LIMITS, MEMBERS, FORMAT_CHARS, oneLine, boundedString, AGENT_METRIC_NAME_PATTERN, AGENT_METRIC_LIMITS, AGENT_OBJECTIVE_ERRORS, CHANGE_LEASE_TTL_MINUTES_MIN, CHANGE_LEASE_TTL_MINUTES_MAX, CHANGE_LEASE_REASON_MAX, CHANGE_LEASE_ERRORS, AGENT_CONFIG_SET_LIMITS, SECRET_ENV_KEY_SUFFIXES, DEFAULT_OWNER_DEPARTURE_POLICY, AGENT_LIFECYCLE_ERRORS, USER_COST_COUNTER_TTL_SECONDS, USER_COST_ATTRIBUTION_CHANNELS, CALLER_DEDUPE_KEY_MAX, FOLLOW_UP_IDEMPOTENCY_TTL_SECONDS, THREAD_FOLLOW_UP_LIMITS, THREAD_FOLLOW_UP_ERRORS, PROGRESS_UPDATE_LIMITS, PAUSABLE_CAPABILITY_KINDS, UNIFIED_CATCH_UP_MAX_WINDOW_HOURS, UNIFIED_CATCH_UP_EVENTS, UNIFIED_CATCH_UP_FILTERABLE_OBJECT_TYPES, AGENT_NEVER_RULES_MAX, AGENT_NEVER_RULE_FIELD_MAX, AGENT_NEVER_RULE_INPUT_MATCH_MAX, NEVER_RULE_ID_PATTERN, NEVER_RULE_HTTP_METHODS, TEMPLATE_DISTRIBUTION_MODES, CHANNEL_SEND_CHANNELS, TAKEOVER_MAX_IDLE_MINUTES, MINUTES_PER_DAY, DEFAULT_IDLE_RELEASE_MINUTES, FALLBACK_IDLE_RELEASE_MINUTES, VARIATION_SELECTORS, SLACK_EMOJI_NAMES, SLACK_SHORTCODE, PLAIN_EMAIL_ADDRESS, DOMAIN, UNSAFE_TEXT, SLACK_CONVERSATION_ID, CHANNEL_SETTING_GROUPS, THREAD_SCOPING_NOUN, TAKEOVER_CHANNEL_TYPES, EMAIL_SETTINGS, SLACK_SETTING_DEFAULTS, SLACK_REACTION_MAX, SLACK_INTRO_MAX, SLACK_EXAMPLE_PROMPTS_MAX, SLACK_EXAMPLE_PROMPT_MAX, SLACK_SUPPORT_CONTACT_MAX, SLACK_SETTINGS, CHANNEL_SETTINGS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, WORK_ITEMS_KEY, MAX_WORK_ITEMS, LIMITS, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, LOG_FIELDS_MAX_KEYS, LOG_FIELD_MAX_VALUE_BYTES, LOG_FIELDS_MAX_BYTES, LOG_FIELD_KEY_PATTERN, LOG_FIELD_SECRET_SHAPED_KEY_PATTERNS, LOG_FIELDS_CLAMPED_KEY, LOG_FIELD_ARRAY_COUNT_SUFFIX, LuaLogFieldsError, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_MODEL_CLASSES, WORKFLOW_DEFAULT_TASK_CLASS_MAP, WORKFLOW_MODELS_MAX_CLASS_DEFAULT, WORKFLOW_AUTONOMY_NUMERIC_KEYS, WORKFLOW_AUTONOMY_ENVELOPE_KEYS, WORKFLOW_AUTONOMY_DEFAULTS, WORKFLOW_AUTONOMY_CEILINGS, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_ENV, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_CEILING, WORKFLOW_AUTONOMY_FORMS_DEFAULT, WORKFLOW_AUTONOMY_MIN_VALUE, WORKFLOW_JOB_RANGES, WORKFLOW_JOB_RANGE_MEMBERS, WORKFLOW_SINGLE_STEP_TYPES, WORKFLOW_HITL_ENTRY_TYPES, WORKFLOW_ARM_ENTRY_TYPES, WORKFLOW_HITL_ARM_CONTAINERS, WORKFLOW_GRAPH_ENTRY_STEP_KINDS, WORKFLOW_ARM_ENTRY_STEP_KINDS, WORKFLOW_BUDGET_MAX_DURATION_SECONDS, MODEL_ID_BYOK_PROVIDERS, MODEL_CLASS_REF_PREFIX, MODEL_SNAPSHOT_SUFFIX, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, AGENT_LOG_SOURCES, AGENT_LOG_FIELDS_MAX_WIRE_KEYS, LOG_DRAIN_TYPES_PHASE1, LOG_DRAIN_TYPES_PHASE2, LOG_DRAIN_TYPES_IMPLEMENTED, LOG_DRAIN_SOURCES, LOG_DRAIN_MAX_PER_ORG, LOG_DRAIN_MAX_PER_ORG_ENTERPRISE, LOG_DRAIN_DATADOG_SITES, LOG_DRAIN_NEWRELIC_SITES, LOG_DRAIN_ENDPOINT_TEMPLATES, LOG_DRAIN_PRESET_SITES, LOG_DRAIN_BUCKET_NAME_PATTERN, LOG_DRAIN_BUCKET_HOST_PATTERNS, LOG_DRAIN_PRESET_HOST_SUFFIXES, DRAIN_CONTENT_ACK_ERROR_CODE, DRAIN_CONTENT_ACK_FIELD, DrainContentAckRequiredError, LOG_DRAIN_PRESET_PATHS, PRESET_SEGMENT_RE, LOG_DRAIN_QUOTAS, LOG_DRAIN_QUOTA_WARN_RATIO, LOG_DRAIN_QUOTA_DROP_DEBUG_RATIO, LOG_DRAIN_QUOTA_DROP_INFO_RATIO, LOG_DRAIN_QUOTA_PAUSE_RATIO, LOG_EXPORT_SOURCES, LOG_EXPORT_MAX_WINDOW_DAYS, LOG_EXPORT_MAX_WINDOW_MS, LOG_EXPORT_URL_TTL_SECONDS, LOG_EXPORT_FILE_RETENTION_DAYS, LOG_EXPORT_FILE_RETENTION_MS, LOG_EXPORT_PART_MAX_BYTES, LOG_DRAIN_NOTICE_RATE_LIMIT_MS, LOG_DRAIN_VERIFICATION_STALE_MS, LOG_DRAIN_DIGEST_INTERVAL_MS, LOG_DRAIN_DIGEST_MAX_ENTRIES, LOG_DRAIN_NOTICE_ERROR_MAX_CHARS, LOG_DRAIN_USAGE_LINE_ITEM, LOG_DRAIN_BYTES_PER_GIB, DEFAULT_LOG_DRAIN_PLAN_CONFIG, TIERS, LOG_CURSOR_MAX_LENGTH, LOG_CURSOR_MAX_ID_LENGTH, LOG_RELATIVE_TIME_PATTERN, LOG_ISO_TIME_PATTERN, RELATIVE_UNIT_MS, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, KEYS, MAX_BODY_BYTES, MAX_ID_LENGTH, UTC_ISO, TEMPLATE_TRIGGER_URL_ENV_PREFIX, TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, LUA_SESSION_ID_CLAIM, SESSION_REVOKED_CODE, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_RUN_GATE_KINDS, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, WORKFLOW_SIGNAL_EVENT_SITES, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_AGENT_APP_CONNECTION_PREFIX, WORKFLOW_JOB_MODEL_SOURCE_LABELS, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_SIGNAL_NAME_RE, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, SCHEDULE_HEALTH_NOTIFY_CHANNELS, SCHEDULE_HEALTH_DEFAULT_NOTIFY, SCHEDULE_HEALTH_LIMITS, KNOWN_KEYS, WORKFLOW_GOAL_JUDGE_SELF, APPROVAL_ARGS_MAX_CHARS, APPROVAL_ARG_STRING_MAX_CHARS, APPROVAL_ARGS_SUMMARY_MAX_CHARS, MAX_DEPTH, MAX_KEYS, MAX_ITEMS, MAX_NODES, MAX_KEY_CHARS, KEY_SCRUB_INPUT_MAX_CHARS, STRING_SCRUB_INPUT_MAX_CHARS, ELLIPSIS, SKIP, SCRUB_SECRETS_BEFORE_PERSIST_ENV, PERSIST_SCRUB_MAX_CHARS, PERSIST_SCRUB_REF_MAX_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES, SUBAGENT_PER_KEY_FLAG_ENV, PER_KEY_FLAG_VALUES, ONBOARDING_FLOW_KEY, ONBOARDING_SCHEMA_VERSION, id, copy, onboardingHeadingSchema, onboardingRichTextInlineSchema, onboardingRichTextSchema, onboardingDestinationSchema, onboardingArtworkSchema, onboardingAnswerSchema, onboardingQuestionSchema, onboardingTemplateSectionSchema, onboardingInstallScreenSchema, onboardingResultScreenSchema, onboardingConnectScreenSchema, onboardingTemplateContentSchema, onboardingUnavailableOutcomeSchema, onboardingFlowSchema, onboardingActorSchema, onboardingEditorSchema, onboardingPublicationSummarySchema, onboardingValidationIssueSchema, onboardingValidationResponseSchema, onboardingAssetSchema, onboardingPublicAssetSchema, getOnboardingConfigResponseSchema, saveOnboardingDraftRequestSchema, validateOnboardingRequestSchema, publishOnboardingRequestSchema, rollbackOnboardingRequestSchema, onboardingTemplateCatalogItemSchema, getPublishedOnboardingResponseSchema, WEB_ROUTE_PROTOCOL_VERSION, WEB_ROUTE_METHODS, WEB_ROUTE_REQUEST_HEADER_ALLOWLIST, WEB_ROUTE_RESPONSE_HEADER_ALLOWLIST, WEB_ROUTE_MAX_REQUEST_BODY_BYTES, WEB_ROUTE_MAX_RESPONSE_BYTES, WEB_APP_NAME_PATTERN, WEB_APP_ENTRY_HTML_MAX_CHARS, WEB_APP_MAX_ASSET_BYTES, EVIDENCE_SESSION_IDLE_MS, EVIDENCE_MIN_CONVERSATIONS, EVIDENCE_LOW_CONFIDENCE_N, EVIDENCE_SNIPPET_MAX_CHARS, EVIDENCE_EXAMPLES_PER_ITEM, EVIDENCE_SHOWN_ITEMS, EVIDENCE_LATENCY_BOUNDS_MS, EVIDENCE_WORD_BOUNDS, BAD_CONVERSATION_REASONS, ATTACHMENT_LINES, REVIEW_VERDICT_REASON_ORDER, ENV_TEMPLATE_SECRET_KEY_RE, CONNECTION_SEND_NOT_ALLOWED, CONNECTION_RECIPIENT_NOT_ALLOWED, NOT_SEND, PLAIN_ADDRESS, RecipientSet, MCP_MESSAGING_CREATE, MCP_CALENDAR_EVENT_WRITE, REPLY_KEYS, DEDICATED_MAIL_SLUGS, FULL_SUITE_SLUGS, WELL_KNOWN_MAIL_FOLDERS, MEMBER_KEYS, CANONICAL_ORIGIN, CANONICAL_PREFIX, STRICT_BASE64, GMAIL_PREFIX, GMAIL_MESSAGES_SEND, GMAIL_DRAFTS_SEND, GOOGLE_BATCH, GRAPH_VERSION, GRAPH_PRINCIPAL, GRAPH_SEND_MAIL, GRAPH_MESSAGE_ACTION, GRAPH_OWNER, GRAPH_EVENTS, GRAPH_EVENT_COLLECTION, GRAPH_EVENT_ID, GRAPH_EVENT_ITEM, GRAPH_EVENT_ACTION, GRAPH_BATCH, GRAPH_TEAMS_MESSAGE, GRAPH_ACTIVITY_NOTIFICATION, GRAPH_GROUP_CONVERSATION, GCAL_EVENTS, GRAPH_READ_KEYS, MALFORMED_POLICY, BILLING_REJECTION_TEXT_CREDITS, BILLING_REJECTION_TEXT_SEAT, BILLING_REJECTION_TEXT_USER_QUOTA, CUSTOM_MCP_CONNECTION_ID_PREFIX, CUSTOM_MCP_SOURCE, CUSTOM_MCP_TRANSPORT, CUSTOM_MCP_CONNECTION_ID_PATTERN, customMcpConnectionIdSchema, CONNECTION_BACKED_MCP_SOURCES, CUSTOM_MCP_REFERENCE_ID_PATTERN, customMcpReferenceIdSchema, CUSTOM_MCP_AUTH_KINDS, customMcpAuthKindSchema, CUSTOM_MCP_OAUTH_REGISTRATIONS, customMcpOAuthRegistrationSchema, CUSTOM_MCP_HEALTH_STATES, customMcpHealthStateSchema, CUSTOM_MCP_FAILURE_STEPS, customMcpFailureStepSchema, CUSTOM_MCP_CONNECT_STEPS, customMcpConnectStepSchema, customMcpFailureCodeSchema, WORKFLOW_KEY_MAX_LENGTH, CUSTOM_MCP_URL_MAX_LENGTH, CUSTOM_MCP_DISPLAY_NAME_MAX_LENGTH, CUSTOM_MCP_MAX_HEADERS, CUSTOM_MCP_HEADER_NAME_MAX_LENGTH, CUSTOM_MCP_HEADER_VALUE_MAX_LENGTH, CUSTOM_MCP_MAX_TOOLS, CUSTOM_MCP_TOOL_NAME_MAX_LENGTH, CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH, CUSTOM_MCP_MIN_TIMEOUT_MS, CUSTOM_MCP_MAX_TIMEOUT_MS, CUSTOM_MCP_OAUTH_PENDING_TTL_MS, isoDateTime, agentId, nonNegativeInt, customMcpUrlInputSchema, customMcpDisplayNameSchema, customMcpTimeoutSchema, CUSTOM_MCP_RESERVED_HEADER_NAMES, HEADER_NAME, HEADER_VALUE_FORBIDDEN, customMcpHeaderNameSchema, headerValue, customMcpHeadersSchema, customMcpHeadersPatchSchema, customMcpToolNameSchema, customMcpToolSchema, customMcpServerInfoSchema, customMcpToolSelectionSchema, customMcpToolsResponseSchema, customMcpFailureSchema, customMcpHealthSchema, customMcpErrorBodySchema, customMcpConnectionBlockSchema, customMcpConnectionViewSchema, customMcpConnectionResponseSchema, customMcpProbeBodySchema, customMcpOAuthDiscoverySchema, customMcpProbeResponseSchema, createFields, mountAgentField, customMcpCreateAgentBodySchema, customMcpCreateUserBodySchema, customMcpOAuthClientSchema, startFields, customMcpOAuthStartAgentBodySchema, customMcpOAuthStartUserBodySchema, customMcpOAuthStartResponseSchema, nonce, customMcpOAuthSuccessRedirectQuerySchema, CUSTOM_MCP_OAUTH_CALLBACK_ERRORS, customMcpOAuthFailureRedirectQuerySchema, customMcpOAuthFinalizeBodySchema, customMcpCimdDocumentSchema, customMcpPatchBodySchema, customMcpCredentialRequestSchema, customMcpCredentialAuthSchema, customMcpCredentialResponseSchema, CUSTOM_MCP_CREDENTIAL_ERRORS, customMcpCredentialErrorBodySchema, customMcpHealthReportSchema, customMcpProbeRequestSchema, customMcpProbeResultSchema, customMcpOriginUrlSchema, customMcpServerProjectionSchema, customMcpMountUpsertBodySchema;
6110
6293
  var init_dist = __esm({
6111
6294
  "../shared-types/dist/index.mjs"() {
6112
6295
  "use strict";
@@ -6335,7 +6518,14 @@ var init_dist = __esm({
6335
6518
  * that was ACTIVE before, is OLDER than the active one and was active within the last 7 days. CAS on the active
6336
6519
  * version; only from a workflow step the watchdog grant names. Held only by a watchdog grant.
6337
6520
  */
6338
- "versions.rollback": "rollback"
6521
+ "versions.rollback": "rollback",
6522
+ // [JR]
6523
+ /**
6524
+ * JR (BAC-2011) — `Agents.jobs(id).register({ versionId, jobId })`: register a job that is pinned in a STAGED version of
6525
+ * the target (`snapshot.jobs[]`) so the promote activates and schedules it. Mongo-only marker write; EventBridge stays
6526
+ * on the post-promote reconcile. Release-class: needs `register-job` AND `release` on the grant, from a signed step.
6527
+ */
6528
+ "jobs.register": "register-job"
6339
6529
  };
6340
6530
  __name(isSupervisionOp, "isSupervisionOp");
6341
6531
  __name3(isSupervisionOp, "isSupervisionOp");
@@ -6525,6 +6715,12 @@ var init_dist = __esm({
6525
6715
  gate: "rollback",
6526
6716
  targeted: true,
6527
6717
  item: "WD"
6718
+ },
6719
+ /** JR (BAC-2011) — `Agents.jobs(id).register({ versionId, jobId })`: a job pinned in a STAGED version (`register-job`). */
6720
+ "jobs.register": {
6721
+ gate: "register-job",
6722
+ targeted: true,
6723
+ item: "JR"
6528
6724
  }
6529
6725
  };
6530
6726
  SUPERVISION_WATCHDOG_OPS = {
@@ -7388,7 +7584,7 @@ var init_dist = __esm({
7388
7584
  FORMAT_CHARS = /[\p{Cf}\u200b-\u200d\u202a-\u202e\u2066-\u2069\ufeff]/u;
7389
7585
  __name(hasFormatCharacters, "hasFormatCharacters");
7390
7586
  __name3(hasFormatCharacters, "hasFormatCharacters");
7391
- oneLine = /* @__PURE__ */ __name3((text) => text.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029"\u201c\u201d]/g, " ").replace(/\s+/g, " ").trim(), "oneLine");
7587
+ oneLine = /* @__PURE__ */ __name3((text2) => text2.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029"\u201c\u201d]/g, " ").replace(/\s+/g, " ").trim(), "oneLine");
7392
7588
  __name(normalizedHandoverName, "normalizedHandoverName");
7393
7589
  __name3(normalizedHandoverName, "normalizedHandoverName");
7394
7590
  __name(handoverAgentIdSuffix, "handoverAgentIdSuffix");
@@ -8127,6 +8323,25 @@ var init_dist = __esm({
8127
8323
  __name3(citationDedupeKeys, "citationDedupeKeys");
8128
8324
  __name(foldRichPartsIntoMessages, "foldRichPartsIntoMessages");
8129
8325
  __name3(foldRichPartsIntoMessages, "foldRichPartsIntoMessages");
8326
+ WORK_ITEMS_KEY = "_luaWorkItems";
8327
+ MAX_WORK_ITEMS = 100;
8328
+ LIMITS = {
8329
+ id: 200,
8330
+ title: 120,
8331
+ group: 40,
8332
+ status: 40,
8333
+ action: 200
8334
+ };
8335
+ __name(text, "text");
8336
+ __name3(text, "text");
8337
+ __name(normalizeWorkItems, "normalizeWorkItems");
8338
+ __name3(normalizeWorkItems, "normalizeWorkItems");
8339
+ __name(workItemsRecord, "workItemsRecord");
8340
+ __name3(workItemsRecord, "workItemsRecord");
8341
+ __name(withoutWorkItems, "withoutWorkItems");
8342
+ __name3(withoutWorkItems, "withoutWorkItems");
8343
+ __name(mutationWithoutWorkItems, "mutationWithoutWorkItems");
8344
+ __name3(mutationWithoutWorkItems, "mutationWithoutWorkItems");
8130
8345
  BROWSER_COMMANDS = [
8131
8346
  // health + lifecycle / navigation
8132
8347
  {
@@ -10737,6 +10952,497 @@ listed here; never invent a target.`;
10737
10952
  BILLING_REJECTION_TEXT_USER_QUOTA = "You've reached your monthly usage limit in this workspace. Ask a workspace admin to raise it.";
10738
10953
  __name(isPaymentRequiredChatErrorEnvelope, "isPaymentRequiredChatErrorEnvelope");
10739
10954
  __name3(isPaymentRequiredChatErrorEnvelope, "isPaymentRequiredChatErrorEnvelope");
10955
+ CUSTOM_MCP_CONNECTION_ID_PREFIX = "mcp_";
10956
+ CUSTOM_MCP_SOURCE = "custom";
10957
+ CUSTOM_MCP_TRANSPORT = "streamable-http";
10958
+ CUSTOM_MCP_CONNECTION_ID_PATTERN = /^mcp_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
10959
+ __name(isCustomMcpConnectionId, "isCustomMcpConnectionId");
10960
+ __name3(isCustomMcpConnectionId, "isCustomMcpConnectionId");
10961
+ customMcpConnectionIdSchema = z5.string().regex(CUSTOM_MCP_CONNECTION_ID_PATTERN);
10962
+ CONNECTION_BACKED_MCP_SOURCES = [
10963
+ "unifiedto",
10964
+ CUSTOM_MCP_SOURCE
10965
+ ];
10966
+ __name(isConnectionBackedMcpSource, "isConnectionBackedMcpSource");
10967
+ __name3(isConnectionBackedMcpSource, "isConnectionBackedMcpSource");
10968
+ CUSTOM_MCP_REFERENCE_ID_PATTERN = /^mcpx_[0-9a-f]{12}$/;
10969
+ customMcpReferenceIdSchema = z5.string().regex(CUSTOM_MCP_REFERENCE_ID_PATTERN);
10970
+ __name(newCustomMcpReferenceId, "newCustomMcpReferenceId");
10971
+ __name3(newCustomMcpReferenceId, "newCustomMcpReferenceId");
10972
+ CUSTOM_MCP_AUTH_KINDS = [
10973
+ "none",
10974
+ "headers",
10975
+ "oauth"
10976
+ ];
10977
+ customMcpAuthKindSchema = z5.enum(CUSTOM_MCP_AUTH_KINDS);
10978
+ CUSTOM_MCP_OAUTH_REGISTRATIONS = [
10979
+ "cimd",
10980
+ "dcr",
10981
+ "manual"
10982
+ ];
10983
+ customMcpOAuthRegistrationSchema = z5.enum(CUSTOM_MCP_OAUTH_REGISTRATIONS);
10984
+ CUSTOM_MCP_HEALTH_STATES = [
10985
+ "ok",
10986
+ "failing",
10987
+ "needs_sign_in",
10988
+ "auth_rejected"
10989
+ ];
10990
+ customMcpHealthStateSchema = z5.enum(CUSTOM_MCP_HEALTH_STATES);
10991
+ CUSTOM_MCP_FAILURE_STEPS = [
10992
+ "url",
10993
+ "reach",
10994
+ "auth_challenge",
10995
+ "resource_metadata",
10996
+ "authorization_server_metadata",
10997
+ "pkce",
10998
+ "client_registration",
10999
+ "authorize",
11000
+ "token_exchange",
11001
+ "list_tools"
11002
+ ];
11003
+ customMcpFailureStepSchema = z5.enum(CUSTOM_MCP_FAILURE_STEPS);
11004
+ CUSTOM_MCP_CONNECT_STEPS = [
11005
+ "url",
11006
+ "reach",
11007
+ "auth_challenge",
11008
+ "list_tools"
11009
+ ];
11010
+ customMcpConnectStepSchema = z5.enum(CUSTOM_MCP_CONNECT_STEPS);
11011
+ customMcpFailureCodeSchema = z5.string().regex(/^[a-z0-9_]{1,64}$/);
11012
+ WORKFLOW_KEY_MAX_LENGTH = 64;
11013
+ __name(customMcpWorkflowKey, "customMcpWorkflowKey");
11014
+ __name3(customMcpWorkflowKey, "customMcpWorkflowKey");
11015
+ __name(fnv1a32, "fnv1a32");
11016
+ __name3(fnv1a32, "fnv1a32");
11017
+ CUSTOM_MCP_URL_MAX_LENGTH = 2048;
11018
+ CUSTOM_MCP_DISPLAY_NAME_MAX_LENGTH = 120;
11019
+ CUSTOM_MCP_MAX_HEADERS = 20;
11020
+ CUSTOM_MCP_HEADER_NAME_MAX_LENGTH = 128;
11021
+ CUSTOM_MCP_HEADER_VALUE_MAX_LENGTH = 8192;
11022
+ CUSTOM_MCP_MAX_TOOLS = 500;
11023
+ CUSTOM_MCP_TOOL_NAME_MAX_LENGTH = 256;
11024
+ CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH = 1024;
11025
+ CUSTOM_MCP_MIN_TIMEOUT_MS = 1e3;
11026
+ CUSTOM_MCP_MAX_TIMEOUT_MS = 12e4;
11027
+ CUSTOM_MCP_OAUTH_PENDING_TTL_MS = 15 * 6e4;
11028
+ isoDateTime = z5.string().datetime({
11029
+ offset: true
11030
+ });
11031
+ agentId = z5.string().min(1).max(128);
11032
+ nonNegativeInt = z5.number().int().min(0);
11033
+ customMcpUrlInputSchema = z5.string().trim().min(1).max(CUSTOM_MCP_URL_MAX_LENGTH);
11034
+ customMcpDisplayNameSchema = z5.string().trim().min(1).max(CUSTOM_MCP_DISPLAY_NAME_MAX_LENGTH);
11035
+ customMcpTimeoutSchema = z5.number().int().min(CUSTOM_MCP_MIN_TIMEOUT_MS).max(CUSTOM_MCP_MAX_TIMEOUT_MS);
11036
+ CUSTOM_MCP_RESERVED_HEADER_NAMES = [
11037
+ "accept",
11038
+ "connection",
11039
+ "content-length",
11040
+ "content-type",
11041
+ "host",
11042
+ "keep-alive",
11043
+ "last-event-id",
11044
+ "mcp-protocol-version",
11045
+ "mcp-session-id",
11046
+ "proxy-authorization",
11047
+ "te",
11048
+ "trailer",
11049
+ "transfer-encoding",
11050
+ "upgrade"
11051
+ ];
11052
+ HEADER_NAME = /^[A-Za-z][A-Za-z0-9!#$%&'*+.^_`|~-]*$/;
11053
+ HEADER_VALUE_FORBIDDEN = /[\u0000-\u0008\u000a-\u001f\u007f]/;
11054
+ customMcpHeaderNameSchema = z5.string().min(1).max(CUSTOM_MCP_HEADER_NAME_MAX_LENGTH).regex(HEADER_NAME, "Not a valid HTTP header name").refine((name) => !CUSTOM_MCP_RESERVED_HEADER_NAMES.includes(name.toLowerCase()), "This header is set by Lua");
11055
+ headerValue = z5.string().min(1).max(CUSTOM_MCP_HEADER_VALUE_MAX_LENGTH).refine((value3) => !HEADER_VALUE_FORBIDDEN.test(value3), "Header values cannot contain line breaks");
11056
+ __name(addCaseDuplicateIssues, "addCaseDuplicateIssues");
11057
+ __name3(addCaseDuplicateIssues, "addCaseDuplicateIssues");
11058
+ customMcpHeadersSchema = z5.record(customMcpHeaderNameSchema, headerValue).superRefine((headers, ctx) => {
11059
+ const names = Object.keys(headers);
11060
+ if (names.length > CUSTOM_MCP_MAX_HEADERS) {
11061
+ ctx.addIssue({
11062
+ code: z5.ZodIssueCode.custom,
11063
+ message: `At most ${CUSTOM_MCP_MAX_HEADERS} headers`
11064
+ });
11065
+ }
11066
+ addCaseDuplicateIssues(names, ctx, []);
11067
+ });
11068
+ customMcpHeadersPatchSchema = z5.object({
11069
+ set: customMcpHeadersSchema.optional(),
11070
+ remove: z5.array(customMcpHeaderNameSchema).max(CUSTOM_MCP_MAX_HEADERS).optional()
11071
+ }).strict().superRefine((patch, ctx) => {
11072
+ const set = Object.keys(patch.set ?? {});
11073
+ const remove = patch.remove ?? [];
11074
+ if (!set.length && !remove.length) {
11075
+ ctx.addIssue({
11076
+ code: z5.ZodIssueCode.custom,
11077
+ message: "Nothing to change"
11078
+ });
11079
+ }
11080
+ addCaseDuplicateIssues(remove, ctx, [
11081
+ "remove"
11082
+ ]);
11083
+ const setLower = new Set(set.map((name) => name.toLowerCase()));
11084
+ for (const name of remove) {
11085
+ if (setLower.has(name.toLowerCase())) {
11086
+ ctx.addIssue({
11087
+ code: z5.ZodIssueCode.custom,
11088
+ path: [
11089
+ "remove"
11090
+ ],
11091
+ message: `Header "${name}" is both set and removed`
11092
+ });
11093
+ }
11094
+ }
11095
+ });
11096
+ customMcpToolNameSchema = z5.string().min(1).max(CUSTOM_MCP_TOOL_NAME_MAX_LENGTH);
11097
+ customMcpToolSchema = z5.object({
11098
+ name: customMcpToolNameSchema,
11099
+ title: z5.string().max(CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH).optional(),
11100
+ description: z5.string().max(CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH).optional()
11101
+ });
11102
+ customMcpServerInfoSchema = z5.object({
11103
+ name: z5.string().max(CUSTOM_MCP_TOOL_NAME_MAX_LENGTH),
11104
+ version: z5.string().max(128).optional(),
11105
+ title: z5.string().max(CUSTOM_MCP_TOOL_NAME_MAX_LENGTH).optional()
11106
+ });
11107
+ __name(toCustomMcpToolSnapshot, "toCustomMcpToolSnapshot");
11108
+ __name3(toCustomMcpToolSnapshot, "toCustomMcpToolSnapshot");
11109
+ customMcpToolSelectionSchema = z5.object({
11110
+ allowAll: z5.boolean(),
11111
+ enabled: z5.array(customMcpToolNameSchema).max(CUSTOM_MCP_MAX_TOOLS)
11112
+ }).strict().refine((selection) => new Set(selection.enabled).size === selection.enabled.length, {
11113
+ path: [
11114
+ "enabled"
11115
+ ],
11116
+ message: "Tool names must be unique"
11117
+ });
11118
+ __name(customMcpRuntimeToolFilter, "customMcpRuntimeToolFilter");
11119
+ __name3(customMcpRuntimeToolFilter, "customMcpRuntimeToolFilter");
11120
+ customMcpToolsResponseSchema = z5.object({
11121
+ allowAll: z5.boolean(),
11122
+ tools: z5.array(customMcpToolSchema.extend({
11123
+ enabled: z5.boolean()
11124
+ })),
11125
+ serverInfo: customMcpServerInfoSchema.optional(),
11126
+ refreshedAt: isoDateTime.optional()
11127
+ });
11128
+ customMcpFailureSchema = z5.object({
11129
+ step: customMcpFailureStepSchema,
11130
+ code: customMcpFailureCodeSchema,
11131
+ /** Plain words for the person connecting. */
11132
+ message: z5.string().max(500),
11133
+ httpStatus: z5.number().int().min(100).max(599).optional(),
11134
+ referenceId: customMcpReferenceIdSchema
11135
+ });
11136
+ customMcpHealthSchema = z5.object({
11137
+ state: customMcpHealthStateSchema,
11138
+ checkedAt: isoDateTime.optional(),
11139
+ lastOkAt: isoDateTime.optional(),
11140
+ lastFailureAt: isoDateTime.optional(),
11141
+ consecutiveFailures: nonNegativeInt,
11142
+ lastFailure: customMcpFailureSchema.omit({
11143
+ message: true
11144
+ }).optional()
11145
+ });
11146
+ customMcpErrorBodySchema = z5.object({
11147
+ code: z5.string(),
11148
+ message: z5.string(),
11149
+ failure: customMcpFailureSchema.optional(),
11150
+ callbackUrl: z5.string().url().optional(),
11151
+ retryAfterSeconds: z5.number().int().positive().optional()
11152
+ });
11153
+ customMcpConnectionBlockSchema = z5.object({
11154
+ authKind: customMcpAuthKindSchema,
11155
+ /** `URL.host`, port included. */
11156
+ host: z5.string(),
11157
+ /** Host plus a masked path; never the URL. */
11158
+ urlDisplay: z5.string(),
11159
+ /** Names only, for the edit form. Present on `headers` connections. */
11160
+ headerNames: z5.array(z5.string()).optional(),
11161
+ /** The workflow connection key that names this server: {@link customMcpWorkflowKey} of its display name. */
11162
+ workflowKey: z5.string().regex(WORKFLOW_CONNECTION_KEY_RE).optional(),
11163
+ health: customMcpHealthSchema,
11164
+ toolCount: nonNegativeInt,
11165
+ enabledToolCount: nonNegativeInt
11166
+ });
11167
+ customMcpConnectionViewSchema = z5.object({
11168
+ id: customMcpConnectionIdSchema,
11169
+ displayName: z5.string(),
11170
+ ownerType: z5.enum([
11171
+ "user",
11172
+ "agent"
11173
+ ]),
11174
+ agentId: z5.string().optional(),
11175
+ customMcp: customMcpConnectionBlockSchema
11176
+ });
11177
+ customMcpConnectionResponseSchema = z5.object({
11178
+ connection: customMcpConnectionViewSchema
11179
+ });
11180
+ customMcpProbeBodySchema = z5.object({
11181
+ url: customMcpUrlInputSchema,
11182
+ headers: customMcpHeadersSchema.optional()
11183
+ }).strict();
11184
+ customMcpOAuthDiscoverySchema = z5.object({
11185
+ issuer: z5.string().url(),
11186
+ scopes: z5.array(z5.string()),
11187
+ /** `manual_required`: neither CIMD nor DCR; the person registers a client with `callbackUrl`. */
11188
+ registration: z5.enum([
11189
+ "cimd",
11190
+ "dcr",
11191
+ "manual_required"
11192
+ ]),
11193
+ callbackUrl: z5.string().url()
11194
+ });
11195
+ customMcpProbeResponseSchema = z5.discriminatedUnion("outcome", [
11196
+ z5.object({
11197
+ outcome: z5.literal("connected"),
11198
+ authKind: z5.enum([
11199
+ "none",
11200
+ "headers"
11201
+ ]),
11202
+ serverInfo: customMcpServerInfoSchema,
11203
+ tools: z5.array(customMcpToolSchema)
11204
+ }),
11205
+ /** The server challenged and publishes usable OAuth metadata. */
11206
+ z5.object({
11207
+ outcome: z5.literal("sign_in_required"),
11208
+ oauth: customMcpOAuthDiscoverySchema
11209
+ }),
11210
+ /** The server challenged without usable OAuth and no headers were sent. */
11211
+ z5.object({
11212
+ outcome: z5.literal("credentials_required"),
11213
+ httpStatus: z5.number().int()
11214
+ })
11215
+ ]);
11216
+ createFields = {
11217
+ url: customMcpUrlInputSchema,
11218
+ displayName: customMcpDisplayNameSchema,
11219
+ timeout: customMcpTimeoutSchema.optional(),
11220
+ /** Defaults to allow-all. */
11221
+ tools: customMcpToolSelectionSchema.optional()
11222
+ };
11223
+ mountAgentField = {
11224
+ mountAgentId: agentId.optional()
11225
+ };
11226
+ __name(createBody, "createBody");
11227
+ __name3(createBody, "createBody");
11228
+ customMcpCreateAgentBodySchema = createBody({});
11229
+ customMcpCreateUserBodySchema = createBody(mountAgentField);
11230
+ customMcpOAuthClientSchema = z5.object({
11231
+ clientId: z5.string().trim().min(1).max(512),
11232
+ clientSecret: z5.string().min(1).max(2048).optional()
11233
+ }).strict();
11234
+ startFields = {
11235
+ successRedirect: z5.string().max(CUSTOM_MCP_URL_MAX_LENGTH),
11236
+ failureRedirect: z5.string().max(CUSTOM_MCP_URL_MAX_LENGTH),
11237
+ state: z5.string().max(256),
11238
+ client: customMcpOAuthClientSchema.optional()
11239
+ };
11240
+ __name(startBody, "startBody");
11241
+ __name3(startBody, "startBody");
11242
+ customMcpOAuthStartAgentBodySchema = startBody({});
11243
+ customMcpOAuthStartUserBodySchema = startBody(mountAgentField);
11244
+ customMcpOAuthStartResponseSchema = z5.object({
11245
+ authUrl: z5.string().url(),
11246
+ pendingId: z5.string().min(1),
11247
+ expiresAt: isoDateTime,
11248
+ registration: customMcpOAuthRegistrationSchema
11249
+ });
11250
+ nonce = z5.string().regex(/^[A-Za-z0-9_-]{32,128}$/);
11251
+ customMcpOAuthSuccessRedirectQuerySchema = z5.object({
11252
+ state: z5.string(),
11253
+ id: z5.string().min(1),
11254
+ nonce
11255
+ });
11256
+ CUSTOM_MCP_OAUTH_CALLBACK_ERRORS = [
11257
+ "access_denied",
11258
+ "authorize",
11259
+ "token_exchange",
11260
+ "expired"
11261
+ ];
11262
+ customMcpOAuthFailureRedirectQuerySchema = z5.object({
11263
+ state: z5.string(),
11264
+ error: z5.enum(CUSTOM_MCP_OAUTH_CALLBACK_ERRORS),
11265
+ ref: customMcpReferenceIdSchema
11266
+ });
11267
+ customMcpOAuthFinalizeBodySchema = z5.object({
11268
+ pendingId: z5.string().min(1).max(128),
11269
+ nonce,
11270
+ tools: customMcpToolSelectionSchema.optional()
11271
+ }).strict();
11272
+ customMcpCimdDocumentSchema = z5.object({
11273
+ client_id: z5.string().url(),
11274
+ client_name: z5.string(),
11275
+ client_uri: z5.string().url().optional(),
11276
+ logo_uri: z5.string().url().optional(),
11277
+ redirect_uris: z5.array(z5.string().url()).min(1),
11278
+ grant_types: z5.array(z5.enum([
11279
+ "authorization_code",
11280
+ "refresh_token"
11281
+ ])),
11282
+ response_types: z5.array(z5.literal("code")),
11283
+ token_endpoint_auth_method: z5.literal("none")
11284
+ });
11285
+ customMcpPatchBodySchema = z5.object({
11286
+ displayName: customMcpDisplayNameSchema.optional(),
11287
+ url: customMcpUrlInputSchema.optional(),
11288
+ headers: customMcpHeadersPatchSchema.optional(),
11289
+ timeout: customMcpTimeoutSchema.optional()
11290
+ }).strict().refine((body) => Object.values(body).some((value3) => value3 !== void 0), {
11291
+ message: "Nothing to change"
11292
+ });
11293
+ customMcpCredentialRequestSchema = z5.object({
11294
+ mode: z5.enum([
11295
+ "mount",
11296
+ "room_personal"
11297
+ ]),
11298
+ connectionId: customMcpConnectionIdSchema,
11299
+ agentId,
11300
+ /** The server rejected this token version: refresh unless it is already stale. */
11301
+ rejectedTokenVersion: nonNegativeInt.optional()
11302
+ }).strict();
11303
+ customMcpCredentialAuthSchema = z5.discriminatedUnion("kind", [
11304
+ z5.object({
11305
+ kind: z5.literal("none")
11306
+ }),
11307
+ z5.object({
11308
+ kind: z5.literal("headers"),
11309
+ headers: z5.record(z5.string(), z5.string())
11310
+ }),
11311
+ z5.object({
11312
+ kind: z5.literal("oauth"),
11313
+ accessToken: z5.string().min(1),
11314
+ tokenVersion: nonNegativeInt,
11315
+ /** At least {@link CUSTOM_MCP_ACCESS_TOKEN_MIN_REMAINING_MS} away. */
11316
+ expiresAt: isoDateTime
11317
+ })
11318
+ ]);
11319
+ customMcpCredentialResponseSchema = z5.object({
11320
+ connectionId: customMcpConnectionIdSchema,
11321
+ credentialGeneration: nonNegativeInt,
11322
+ url: z5.string().url(),
11323
+ auth: customMcpCredentialAuthSchema
11324
+ });
11325
+ CUSTOM_MCP_CREDENTIAL_ERRORS = {
11326
+ /** 403. Not mounted on this agent, or the room grant is no longer current. */
11327
+ NOT_MOUNTED: "NOT_MOUNTED",
11328
+ /** 404. */
11329
+ NOT_FOUND: "NOT_FOUND",
11330
+ /** 409. Paused by its owner. */
11331
+ PAUSED: "PAUSED",
11332
+ /** 409. The refresh token is gone or was refused; the owner must sign in again. */
11333
+ NEEDS_SIGN_IN: "NEEDS_SIGN_IN",
11334
+ /** 503. The token endpoint failed; retry later. */
11335
+ REFRESH_UNAVAILABLE: "REFRESH_UNAVAILABLE"
11336
+ };
11337
+ customMcpCredentialErrorBodySchema = z5.object({
11338
+ code: z5.nativeEnum(CUSTOM_MCP_CREDENTIAL_ERRORS),
11339
+ message: z5.string()
11340
+ });
11341
+ customMcpHealthReportSchema = z5.object({
11342
+ reports: z5.array(z5.object({
11343
+ connectionId: customMcpConnectionIdSchema,
11344
+ agentId,
11345
+ credentialGeneration: nonNegativeInt,
11346
+ tokenVersion: nonNegativeInt.optional(),
11347
+ outcome: z5.enum([
11348
+ "ok",
11349
+ "failure"
11350
+ ]),
11351
+ failure: z5.object({
11352
+ step: customMcpConnectStepSchema,
11353
+ code: customMcpFailureCodeSchema,
11354
+ httpStatus: z5.number().int().min(100).max(599).optional(),
11355
+ referenceId: customMcpReferenceIdSchema
11356
+ }).strict().optional(),
11357
+ observedAt: isoDateTime
11358
+ }).strict().refine((report) => report.outcome === "failure" === (report.failure !== void 0), {
11359
+ path: [
11360
+ "failure"
11361
+ ],
11362
+ message: "A failure report carries `failure`; an ok report does not"
11363
+ })).min(1).max(50)
11364
+ }).strict();
11365
+ customMcpProbeRequestSchema = z5.object({
11366
+ url: z5.string().url().max(CUSTOM_MCP_URL_MAX_LENGTH),
11367
+ auth: z5.discriminatedUnion("kind", [
11368
+ z5.object({
11369
+ kind: z5.literal("none")
11370
+ }).strict(),
11371
+ z5.object({
11372
+ kind: z5.literal("headers"),
11373
+ headers: customMcpHeadersSchema
11374
+ }).strict(),
11375
+ z5.object({
11376
+ kind: z5.literal("bearer"),
11377
+ accessToken: z5.string().min(1)
11378
+ }).strict()
11379
+ ]),
11380
+ timeout: customMcpTimeoutSchema.optional(),
11381
+ referenceId: customMcpReferenceIdSchema
11382
+ }).strict();
11383
+ customMcpProbeResultSchema = z5.discriminatedUnion("ok", [
11384
+ z5.object({
11385
+ ok: z5.literal(true),
11386
+ serverInfo: customMcpServerInfoSchema,
11387
+ tools: z5.array(customMcpToolSchema).max(CUSTOM_MCP_MAX_TOOLS),
11388
+ protocolVersion: z5.string().optional()
11389
+ }),
11390
+ z5.object({
11391
+ ok: z5.literal(false),
11392
+ step: customMcpConnectStepSchema,
11393
+ code: customMcpFailureCodeSchema,
11394
+ httpStatus: z5.number().int().min(100).max(599).optional(),
11395
+ /** The 401/403 challenge, raw, for lua-api's OAuth discovery. */
11396
+ wwwAuthenticate: z5.string().max(4096).optional()
11397
+ })
11398
+ ]);
11399
+ customMcpOriginUrlSchema = z5.string().url().refine((value3) => {
11400
+ try {
11401
+ const url = new URL(value3);
11402
+ return url.protocol === "https:" && url.pathname === "/" && !url.search && !url.hash && !url.username && !url.password;
11403
+ } catch {
11404
+ return false;
11405
+ }
11406
+ }, "Origin only");
11407
+ customMcpServerProjectionSchema = z5.object({
11408
+ name: z5.string().min(1),
11409
+ runtimeKey: z5.string().min(1),
11410
+ transport: z5.literal(CUSTOM_MCP_TRANSPORT),
11411
+ source: z5.literal(CUSTOM_MCP_SOURCE),
11412
+ url: customMcpOriginUrlSchema,
11413
+ connectionId: customMcpConnectionIdSchema,
11414
+ connectionLabel: z5.string(),
11415
+ /** The connection's owner kind, for the dashboard's "Personal" label. */
11416
+ ownerType: z5.enum([
11417
+ "user",
11418
+ "agent"
11419
+ ]),
11420
+ authKind: customMcpAuthKindSchema,
11421
+ credentialGeneration: nonNegativeInt,
11422
+ tools: z5.object({
11423
+ allow: z5.array(z5.string())
11424
+ }).optional(),
11425
+ timeout: z5.number().int().positive()
11426
+ });
11427
+ customMcpMountUpsertBodySchema = z5.object({
11428
+ source: z5.literal(CUSTOM_MCP_SOURCE),
11429
+ transport: z5.literal(CUSTOM_MCP_TRANSPORT),
11430
+ url: customMcpOriginUrlSchema,
11431
+ connectionId: customMcpConnectionIdSchema,
11432
+ connectionLabel: z5.string(),
11433
+ ownerType: z5.enum([
11434
+ "user",
11435
+ "agent"
11436
+ ]),
11437
+ authKind: customMcpAuthKindSchema,
11438
+ credentialGeneration: nonNegativeInt,
11439
+ tools: z5.object({
11440
+ allow: z5.array(customMcpToolNameSchema).max(CUSTOM_MCP_MAX_TOOLS)
11441
+ }).strict().optional(),
11442
+ timeout: customMcpTimeoutSchema.optional()
11443
+ }).strict();
11444
+ __name(maskMcpServerHeaders, "maskMcpServerHeaders");
11445
+ __name3(maskMcpServerHeaders, "maskMcpServerHeaders");
10740
11446
  }
10741
11447
  });
10742
11448
 
@@ -11397,7 +12103,7 @@ var init_constants = __esm({
11397
12103
  });
11398
12104
 
11399
12105
  // src/services/firebase-session.ts
11400
- import { z as z5 } from "zod";
12106
+ import { z as z6 } from "zod";
11401
12107
  function rejectedRefreshReason(message) {
11402
12108
  const normalised = message.toUpperCase();
11403
12109
  return REJECTED_REFRESH_REASONS.find((reason) => normalised.includes(reason));
@@ -11543,20 +12249,20 @@ var init_firebase_session = __esm({
11543
12249
  this.name = "FirebaseSessionRejectedError";
11544
12250
  }
11545
12251
  };
11546
- customTokenResponseSchema = z5.object({
11547
- idToken: z5.string().min(1),
11548
- refreshToken: z5.string().min(1),
11549
- expiresIn: z5.coerce.number().positive().finite(),
11550
- localId: z5.string().min(1).optional()
12252
+ customTokenResponseSchema = z6.object({
12253
+ idToken: z6.string().min(1),
12254
+ refreshToken: z6.string().min(1),
12255
+ expiresIn: z6.coerce.number().positive().finite(),
12256
+ localId: z6.string().min(1).optional()
11551
12257
  });
11552
- refreshResponseSchema = z5.object({
11553
- id_token: z5.string().min(1),
11554
- refresh_token: z5.string().min(1),
11555
- expires_in: z5.coerce.number().positive().finite(),
11556
- user_id: z5.string().min(1)
12258
+ refreshResponseSchema = z6.object({
12259
+ id_token: z6.string().min(1),
12260
+ refresh_token: z6.string().min(1),
12261
+ expires_in: z6.coerce.number().positive().finite(),
12262
+ user_id: z6.string().min(1)
11557
12263
  });
11558
- firebaseIdTokenPayloadSchema = z5.object({
11559
- sub: z5.string().min(1)
12264
+ firebaseIdTokenPayloadSchema = z6.object({
12265
+ sub: z6.string().min(1)
11560
12266
  });
11561
12267
  __name(requireFirebaseWebApiKey, "requireFirebaseWebApiKey");
11562
12268
  __name(claimsOfFirebaseIdToken, "claimsOfFirebaseIdToken");
@@ -11573,7 +12279,7 @@ var init_firebase_session = __esm({
11573
12279
  import { createHash, randomUUID } from "crypto";
11574
12280
  import { mkdir, open, readFile, rename, rm, stat, unlink, writeFile } from "fs/promises";
11575
12281
  import { join as join3 } from "path";
11576
- import { z as z6 } from "zod";
12282
+ import { z as z7 } from "zod";
11577
12283
  function environmentKey(environment) {
11578
12284
  return createHash("sha256").update(`${environment.apiUrl}
11579
12285
  ${environment.authUrl}
@@ -11590,15 +12296,15 @@ var init_firebase_session_store = __esm({
11590
12296
  "src/services/firebase-session-store.ts"() {
11591
12297
  "use strict";
11592
12298
  init_constants();
11593
- storedFirebaseSessionSchema = z6.object({
11594
- version: z6.literal(1),
11595
- kind: z6.literal("firebase-session"),
11596
- generation: z6.string().min(1),
11597
- refreshToken: z6.string().min(1),
11598
- firebaseUid: z6.string().min(1),
11599
- apiUrl: z6.string().url(),
11600
- authUrl: z6.string().url(),
11601
- firebaseWebApiKey: z6.string().min(1)
12299
+ storedFirebaseSessionSchema = z7.object({
12300
+ version: z7.literal(1),
12301
+ kind: z7.literal("firebase-session"),
12302
+ generation: z7.string().min(1),
12303
+ refreshToken: z7.string().min(1),
12304
+ firebaseUid: z7.string().min(1),
12305
+ apiUrl: z7.string().url(),
12306
+ authUrl: z7.string().url(),
12307
+ firebaseWebApiKey: z7.string().min(1)
11602
12308
  });
11603
12309
  currentFirebaseSessionEnvironment = /* @__PURE__ */ __name(() => ({
11604
12310
  apiUrl: BASE_URLS.API,
@@ -12267,14 +12973,15 @@ var init_http_client = __esm({
12267
12973
  * Performs an HTTP GET request
12268
12974
  * @param url - The relative URL path to request (will be appended to baseUrl)
12269
12975
  * @param headers - Optional HTTP headers to include in the request
12976
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12270
12977
  * @returns Promise resolving to an ApiResponse with typed data
12271
12978
  * @protected
12272
12979
  */
12273
- async httpGet(url, headers) {
12980
+ async httpGet(url, headers, overrides) {
12274
12981
  return this.retryableRequest(this.baseUrl + url, {
12275
12982
  method: "GET",
12276
12983
  headers
12277
- });
12984
+ }, 3, overrides);
12278
12985
  }
12279
12986
  /**
12280
12987
  * Performs an HTTP POST request
@@ -12316,43 +13023,46 @@ var init_http_client = __esm({
12316
13023
  * @param url - The relative URL path to request (will be appended to baseUrl)
12317
13024
  * @param data - Optional request body data (will be JSON stringified)
12318
13025
  * @param headers - Optional HTTP headers to include in the request
13026
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12319
13027
  * @returns Promise resolving to an ApiResponse with typed data
12320
13028
  * @protected
12321
13029
  */
12322
- async httpPut(url, data, headers) {
13030
+ async httpPut(url, data, headers, overrides) {
12323
13031
  return this.retryableRequest(this.baseUrl + url, {
12324
13032
  method: "PUT",
12325
13033
  body: data ? JSON.stringify(data) : void 0,
12326
13034
  headers
12327
- });
13035
+ }, 3, overrides);
12328
13036
  }
12329
13037
  /**
12330
13038
  * Performs an HTTP DELETE request
12331
13039
  * @param url - The relative URL path to request (will be appended to baseUrl)
12332
13040
  * @param headers - Optional HTTP headers to include in the request
13041
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12333
13042
  * @returns Promise resolving to an ApiResponse with typed data
12334
13043
  * @protected
12335
13044
  */
12336
- async httpDelete(url, headers) {
13045
+ async httpDelete(url, headers, overrides) {
12337
13046
  return this.retryableRequest(this.baseUrl + url, {
12338
13047
  method: "DELETE",
12339
13048
  headers
12340
- });
13049
+ }, 3, overrides);
12341
13050
  }
12342
13051
  /**
12343
13052
  * Performs an HTTP PATCH request
12344
13053
  * @param url - The relative URL path to request (will be appended to baseUrl)
12345
13054
  * @param data - Optional request body data (will be JSON stringified)
12346
13055
  * @param headers - Optional HTTP headers to include in the request
13056
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12347
13057
  * @returns Promise resolving to an ApiResponse with typed data
12348
13058
  * @protected
12349
13059
  */
12350
- async httpPatch(url, data, headers) {
13060
+ async httpPatch(url, data, headers, overrides) {
12351
13061
  return this.retryableRequest(this.baseUrl + url, {
12352
13062
  method: "PATCH",
12353
13063
  body: data ? JSON.stringify(data) : void 0,
12354
13064
  headers
12355
- });
13065
+ }, 3, overrides);
12356
13066
  }
12357
13067
  /**
12358
13068
  * Performs one HTTP PATCH attempt (no client retry).
@@ -12477,8 +13187,8 @@ var init_connection_requests_api_service = __esm({
12477
13187
  __name(this, "ConnectionRequestsApiService");
12478
13188
  }
12479
13189
  agentId;
12480
- constructor(baseUrl, credential, agentId) {
12481
- super(baseUrl, credential), this.agentId = agentId;
13190
+ constructor(baseUrl, credential, agentId2) {
13191
+ super(baseUrl, credential), this.agentId = agentId2;
12482
13192
  }
12483
13193
  query() {
12484
13194
  return `agentId=${encodeURIComponent(this.agentId)}`;
@@ -12560,8 +13270,8 @@ function workflowJobTargetTemplatePath(binding) {
12560
13270
  return m[1].split(".").every((seg) => TARGET_PATH_SEGMENT_RE.test(seg)) ? m[1] : null;
12561
13271
  }
12562
13272
  function isWorkflowJobTargetTemplate(target) {
12563
- const agentId = target?.agentId;
12564
- return !!agentId && typeof agentId === "object";
13273
+ const agentId2 = target?.agentId;
13274
+ return !!agentId2 && typeof agentId2 === "object";
12565
13275
  }
12566
13276
  function workflowJobLuaApiProblem(luaApi, nodeType, tier) {
12567
13277
  if (luaApi === void 0) return null;
@@ -12577,12 +13287,12 @@ function workflowJobTargetProblem(target, plugins, luaApi) {
12577
13287
  if (target === void 0) return null;
12578
13288
  if (!target || typeof target !== "object" || Array.isArray(target)) return "target must be { agentId }";
12579
13289
  const keys = Object.keys(target);
12580
- const agentId = target.agentId;
13290
+ const agentId2 = target.agentId;
12581
13291
  if (keys.length !== 1 || !("agentId" in target)) return "target must be exactly { agentId }";
12582
- if (typeof agentId === "string") {
12583
- if (!agentId.trim() || agentId.length > 256) return "target must be exactly { agentId: <non-empty string> }";
12584
- if (agentId.includes("${")) return "a run-input target is written template('${initData.<path>}'), never a string with ${\u2026}";
12585
- } else if (workflowJobTargetTemplatePath(agentId) === null) {
13292
+ if (typeof agentId2 === "string") {
13293
+ if (!agentId2.trim() || agentId2.length > 256) return "target must be exactly { agentId: <non-empty string> }";
13294
+ if (agentId2.includes("${")) return "a run-input target is written template('${initData.<path>}'), never a string with ${\u2026}";
13295
+ } else if (workflowJobTargetTemplatePath(agentId2) === null) {
12586
13296
  return "target.agentId must be a static id or template('${initData.<path>}') \u2014 exactly one initData placeholder, no default";
12587
13297
  }
12588
13298
  const hasPlugins = Array.isArray(plugins) && plugins.length > 0;
@@ -12606,25 +13316,25 @@ function readInitDataPath(root, path3) {
12606
13316
  return cur;
12607
13317
  }
12608
13318
  function renderWorkflowJobTarget(target, initData) {
12609
- const agentId = target?.agentId;
12610
- if (target === void 0 || target === null || agentId === void 0) return {
13319
+ const agentId2 = target?.agentId;
13320
+ if (target === void 0 || target === null || agentId2 === void 0) return {
12611
13321
  ok: true,
12612
13322
  agentId: void 0,
12613
13323
  templated: false
12614
13324
  };
12615
- if (typeof agentId === "string") {
12616
- if (!agentId.trim() || agentId.includes("${")) return {
13325
+ if (typeof agentId2 === "string") {
13326
+ if (!agentId2.trim() || agentId2.includes("${")) return {
12617
13327
  ok: false,
12618
13328
  reason: "invalid",
12619
13329
  message: "target.agentId is invalid"
12620
13330
  };
12621
13331
  return {
12622
13332
  ok: true,
12623
- agentId,
13333
+ agentId: agentId2,
12624
13334
  templated: false
12625
13335
  };
12626
13336
  }
12627
- const path3 = workflowJobTargetTemplatePath(agentId);
13337
+ const path3 = workflowJobTargetTemplatePath(agentId2);
12628
13338
  if (path3 === null) return {
12629
13339
  ok: false,
12630
13340
  reason: "invalid",
@@ -12718,7 +13428,7 @@ var init_workflow_job_tools = __esm({
12718
13428
 
12719
13429
  // ../workflow-graph/dist/index.mjs
12720
13430
  import { createHash as createHash2 } from "crypto";
12721
- import { z as z7 } from "zod";
13431
+ import { z as z8 } from "zod";
12722
13432
  import { z as z22 } from "zod";
12723
13433
  import { createHash as createHash22 } from "crypto";
12724
13434
  function isMapConfigObject(v) {
@@ -13221,17 +13931,17 @@ function firstAskDeadline(node) {
13221
13931
  return void 0;
13222
13932
  }
13223
13933
  function liftRenderedApprover(row, rendered) {
13224
- const text = (rendered ?? "").trim();
13225
- if (!text) return null;
13934
+ const text2 = (rendered ?? "").trim();
13935
+ if (!text2) return null;
13226
13936
  if (row === "users") {
13227
13937
  let members = null;
13228
- if (text.startsWith("[")) {
13938
+ if (text2.startsWith("[")) {
13229
13939
  try {
13230
- members = JSON.parse(text);
13940
+ members = JSON.parse(text2);
13231
13941
  } catch {
13232
13942
  return null;
13233
13943
  }
13234
- } else members = text.split(",").map((s) => s.trim());
13944
+ } else members = text2.split(",").map((s) => s.trim());
13235
13945
  if (!Array.isArray(members) || members.length === 0 || members.length > APPROVER_SPEC_MAX_USERS) return null;
13236
13946
  if (!members.every((m) => typeof m === "string" && m.length > 0 && m.length <= 128)) return null;
13237
13947
  return {
@@ -13240,11 +13950,11 @@ function liftRenderedApprover(row, rendered) {
13240
13950
  ].sort()
13241
13951
  };
13242
13952
  }
13243
- if (text.length > 128 || text.startsWith("[") || text.startsWith("{")) return null;
13953
+ if (text2.length > 128 || text2.startsWith("[") || text2.startsWith("{")) return null;
13244
13954
  return row === "role" ? {
13245
- role: text
13955
+ role: text2
13246
13956
  } : {
13247
- group: text
13957
+ group: text2
13248
13958
  };
13249
13959
  }
13250
13960
  function approverUsersOf(users) {
@@ -13401,9 +14111,9 @@ function schemaAtPath(schema, path3) {
13401
14111
  }
13402
14112
  return cur;
13403
14113
  }
13404
- function templateStepRefs(text) {
14114
+ function templateStepRefs(text2) {
13405
14115
  const ids = [];
13406
- for (const m of text.matchAll(TEMPLATE_STEP_REF)) ids.push(m[1]);
14116
+ for (const m of text2.matchAll(TEMPLATE_STEP_REF)) ids.push(m[1]);
13407
14117
  return ids;
13408
14118
  }
13409
14119
  function readMapConfig(raw) {
@@ -16445,8 +17155,8 @@ var init_dist2 = __esm({
16445
17155
  fromKnowledge = /* @__PURE__ */ __name6((k) => ({
16446
17156
  knowledge: k
16447
17157
  }), "fromKnowledge");
16448
- SideEffectsSchema = z7.enum(WORKFLOW_SIDE_EFFECTS);
16449
- JobResourcesSchema = z7.enum(WORKFLOW_JOB_RESOURCES);
17158
+ SideEffectsSchema = z8.enum(WORKFLOW_SIDE_EFFECTS);
17159
+ JobResourcesSchema = z8.enum(WORKFLOW_JOB_RESOURCES);
16450
17160
  WORKFLOW_MODEL_TEMPLATE_ROOT = "initData";
16451
17161
  WORKFLOW_MODEL_TEMPLATE_RE = /^\$\{\s*initData\.([A-Za-z0-9_.\-[\]]+)\s*(?:\|([^}]*))?\}$/;
16452
17162
  PATH_SEGMENT_RE = /^[A-Za-z0-9_-]+(?:\[(?:0|[1-9]\d*)\])*$/;
@@ -18262,9 +18972,9 @@ var init_skills_api_service = __esm({
18262
18972
  * @param credential - The API key for authentication
18263
18973
  * @param agentId - The unique identifier of the agent
18264
18974
  */
18265
- constructor(baseUrl, credential, agentId) {
18975
+ constructor(baseUrl, credential, agentId2) {
18266
18976
  super(baseUrl, credential);
18267
- this.agentId = agentId;
18977
+ this.agentId = agentId2;
18268
18978
  }
18269
18979
  /**
18270
18980
  * Retrieves all skills for the agent
@@ -18774,7 +19484,7 @@ function walk3(root, prefix, out) {
18774
19484
  }
18775
19485
  }
18776
19486
  }
18777
- var __defProp7, __name7, FILE_HASH_LENGTH, SKIP_DIRECTORIES, ARCHIVE_ONLY_SKIP_DIRECTORIES, DEFAULT_MAX_FILE_BYTES, KIND_BY_EXT, CHECK_BLOBS_MAX_HASHES, BackupHttpError, BackupHttpClient, DEFAULT_CONCURRENCY, CREDENTIAL_PATHS, WINDOWS_ABSOLUTE_PATH, ARCHIVE_SCHEMA_VERSION;
19487
+ var __defProp7, __name7, FILE_HASH_LENGTH, SKIP_DIRECTORIES, ARCHIVE_ONLY_SKIP_DIRECTORIES, DEFAULT_MAX_FILE_BYTES, KIND_BY_EXT, CHECK_BLOBS_MAX_HASHES, BackupHttpError, BackupHttpClient, DEFAULT_CONCURRENCY, CREDENTIAL_PATHS, WINDOWS_ABSOLUTE_PATH, ARCHIVE_SCHEMA_VERSION, SKILL_SOURCE_ARCHIVE_MAX_BYTES;
18778
19488
  var init_dist3 = __esm({
18779
19489
  "../shared-source-sync/dist/index.mjs"() {
18780
19490
  "use strict";
@@ -18869,17 +19579,17 @@ var init_dist3 = __esm({
18869
19579
  body: body !== void 0 ? JSON.stringify(body) : void 0
18870
19580
  });
18871
19581
  if (!res.ok) {
18872
- let text2;
19582
+ let text22;
18873
19583
  try {
18874
- text2 = await res.text();
19584
+ text22 = await res.text();
18875
19585
  } catch {
18876
- text2 = void 0;
19586
+ text22 = void 0;
18877
19587
  }
18878
- throw new BackupHttpError(`Backup request failed: ${method} ${path3} \u2192 ${res.status} ${res.statusText}`, res.status, endpoint, text2);
19588
+ throw new BackupHttpError(`Backup request failed: ${method} ${path3} \u2192 ${res.status} ${res.statusText}`, res.status, endpoint, text22);
18879
19589
  }
18880
- const text = await res.text();
18881
- if (!text) return void 0;
18882
- return JSON.parse(text);
19590
+ const text2 = await res.text();
19591
+ if (!text2) return void 0;
19592
+ return JSON.parse(text2);
18883
19593
  }
18884
19594
  /**
18885
19595
  * `POST /backup/check-blobs` — returns existing vs missing partition.
@@ -18982,6 +19692,7 @@ var init_dist3 = __esm({
18982
19692
  __name7(writeArchiveToWorkspace, "writeArchiveToWorkspace");
18983
19693
  __name(walk3, "walk");
18984
19694
  __name7(walk3, "walk");
19695
+ SKILL_SOURCE_ARCHIVE_MAX_BYTES = 4 * 1024 * 1024;
18985
19696
  }
18986
19697
  });
18987
19698
 
@@ -19125,8 +19836,8 @@ var init_base_handler = __esm({
19125
19836
  * Local items take priority for shared IDs; server-only orphans are appended as minimal
19126
19837
  * cleanItem objects. On server failure, returns local items only with an empty orphan set.
19127
19838
  */
19128
- async fetchMergedForInteraction(apiKey, agentId, config) {
19129
- const serverData = await this.fetchServerState(apiKey, agentId);
19839
+ async fetchMergedForInteraction(apiKey, agentId2, config) {
19840
+ const serverData = await this.fetchServerState(apiKey, agentId2);
19130
19841
  const localItems = this.getFromYaml(config);
19131
19842
  if (!serverData.serverItems) {
19132
19843
  return {
@@ -19153,9 +19864,9 @@ var init_base_handler = __esm({
19153
19864
  };
19154
19865
  }
19155
19866
  /** Phase 1 of parallel sync: fetch server state (HTTP only, no YAML writes) */
19156
- async fetchServerState(apiKey, agentId) {
19867
+ async fetchServerState(apiKey, agentId2) {
19157
19868
  try {
19158
- const api = this.getApi(apiKey, agentId);
19869
+ const api = this.getApi(apiKey, agentId2);
19159
19870
  const serverItems = await this.fetchFromServer(api);
19160
19871
  return {
19161
19872
  serverItems
@@ -19268,11 +19979,11 @@ var init_base_handler = __esm({
19268
19979
  orphanedCount
19269
19980
  };
19270
19981
  }
19271
- async syncWithServer(apiKey, agentId, config, manifest) {
19272
- const serverData = await this.fetchServerState(apiKey, agentId);
19982
+ async syncWithServer(apiKey, agentId2, config, manifest) {
19983
+ const serverData = await this.fetchServerState(apiKey, agentId2);
19273
19984
  return this.applySyncToYaml(serverData, config, manifest, {
19274
19985
  apiKey,
19275
- agentId
19986
+ agentId: agentId2
19276
19987
  });
19277
19988
  }
19278
19989
  /**
@@ -19413,8 +20124,8 @@ var init_base_handler = __esm({
19413
20124
  /**
19414
20125
  * Get the highest version string from the server for conflict avoidance.
19415
20126
  */
19416
- async getHighestServerVersion(apiKey, agentId, entityId) {
19417
- const { serverItems } = await this.fetchServerState(apiKey, agentId);
20127
+ async getHighestServerVersion(apiKey, agentId2, entityId) {
20128
+ const { serverItems } = await this.fetchServerState(apiKey, agentId2);
19418
20129
  if (!serverItems) return null;
19419
20130
  const entity = serverItems.find((item) => item.id === entityId);
19420
20131
  if (!entity?.versions || !Array.isArray(entity.versions)) return null;
@@ -19426,9 +20137,9 @@ var init_base_handler = __esm({
19426
20137
  * Fetch all server items once, extract highest version for each entity ID.
19427
20138
  * More efficient than calling getHighestServerVersion() per entity.
19428
20139
  */
19429
- async batchGetHighestVersions(apiKey, agentId, entityIds) {
20140
+ async batchGetHighestVersions(apiKey, agentId2, entityIds) {
19430
20141
  const result = /* @__PURE__ */ new Map();
19431
- const { serverItems } = await this.fetchServerState(apiKey, agentId);
20142
+ const { serverItems } = await this.fetchServerState(apiKey, agentId2);
19432
20143
  if (!serverItems) {
19433
20144
  entityIds.forEach((id2) => result.set(id2, null));
19434
20145
  return result;
@@ -19554,8 +20265,8 @@ var init_skill_handler = __esm({
19554
20265
  yamlKey: "skills",
19555
20266
  idField: "skillId"
19556
20267
  };
19557
- getApi(apiKey, agentId) {
19558
- return new SkillApi(BASE_URLS.API, apiKey, agentId);
20268
+ getApi(apiKey, agentId2) {
20269
+ return new SkillApi(BASE_URLS.API, apiKey, agentId2);
19559
20270
  }
19560
20271
  async fetchFromServer(api) {
19561
20272
  const response = await api.getSkills();
@@ -19655,8 +20366,8 @@ var init_skill_handler = __esm({
19655
20366
  // ===========================================================================
19656
20367
  // PUSH — custom to include tools array
19657
20368
  // ===========================================================================
19658
- async pushToServer(apiKey, agentId, entityId, pushData) {
19659
- const api = this.getApi(apiKey, agentId);
20369
+ async pushToServer(apiKey, agentId2, entityId, pushData) {
20370
+ const api = this.getApi(apiKey, agentId2);
19660
20371
  const response = await api.pushSkill(entityId, {
19661
20372
  ...pushData,
19662
20373
  skillId: entityId
@@ -19666,8 +20377,8 @@ var init_skill_handler = __esm({
19666
20377
  error: response.error?.message
19667
20378
  };
19668
20379
  }
19669
- async publishVersion(apiKey, agentId, entityId, version) {
19670
- const api = this.getApi(apiKey, agentId);
20380
+ async publishVersion(apiKey, agentId2, entityId, version) {
20381
+ const api = this.getApi(apiKey, agentId2);
19671
20382
  const response = await api.publishSkillVersion(entityId, version);
19672
20383
  return {
19673
20384
  success: response.success,
@@ -20368,9 +21079,9 @@ var init_products_api_service = __esm({
20368
21079
  * @param credential - The API key for authentication
20369
21080
  * @param agentId - The unique identifier of the agent
20370
21081
  */
20371
- constructor(baseUrl, credential, agentId) {
21082
+ constructor(baseUrl, credential, agentId2) {
20372
21083
  super(baseUrl, credential);
20373
- this.agentId = agentId;
21084
+ this.agentId = agentId2;
20374
21085
  }
20375
21086
  async get(pageOrOptions, limitArg) {
20376
21087
  let page;
@@ -20956,9 +21667,9 @@ var init_order_api_service = __esm({
20956
21667
  * @param credential - The API key for authentication
20957
21668
  * @param agentId - The unique identifier of the agent
20958
21669
  */
20959
- constructor(baseUrl, credential, agentId) {
21670
+ constructor(baseUrl, credential, agentId2) {
20960
21671
  super(baseUrl, credential);
20961
- this.agentId = agentId;
21672
+ this.agentId = agentId2;
20962
21673
  }
20963
21674
  /**
20964
21675
  * Creates a new order from a basket
@@ -21053,10 +21764,10 @@ var init_basket_api_service = __esm({
21053
21764
  * @param credential - The API key for authentication
21054
21765
  * @param agentId - The unique identifier of the agent
21055
21766
  */
21056
- constructor(baseUrl, credential, agentId) {
21767
+ constructor(baseUrl, credential, agentId2) {
21057
21768
  super(baseUrl, credential);
21058
21769
  this.credential = credential;
21059
- this.agentId = agentId;
21770
+ this.agentId = agentId2;
21060
21771
  }
21061
21772
  /**
21062
21773
  * Creates a new user basket
@@ -21198,6 +21909,7 @@ var UserDataInstance;
21198
21909
  var init_user_instance = __esm({
21199
21910
  "src/instances/user.instance.ts"() {
21200
21911
  "use strict";
21912
+ init_dist();
21201
21913
  __name(omit, "omit");
21202
21914
  UserDataInstance = class {
21203
21915
  static {
@@ -21258,6 +21970,8 @@ var init_user_instance = __esm({
21258
21970
  "patch",
21259
21971
  "unset",
21260
21972
  "clear",
21973
+ "setWorkItems",
21974
+ "clearWorkItems",
21261
21975
  "toJSON",
21262
21976
  "_luaProfile"
21263
21977
  ];
@@ -21358,7 +22072,40 @@ var init_user_instance = __esm({
21358
22072
  });
21359
22073
  }
21360
22074
  /**
21361
- * Clears all user data for the current user
22075
+ * Publishes this user's My work list (LUA-1028): the open work they see in Frontline's "My work",
22076
+ * replacing the previous list. Publish whenever the work changes, for everyone it affects.
22077
+ * @param items - At most 100 items; each `action` is the message sent when the user taps it
22078
+ * @throws Error naming the first invalid item (nothing is sent), or if the write fails
22079
+ *
22080
+ * @example
22081
+ * const technician = await User.get({ phone: '+254700000000' });
22082
+ * await technician?.setWorkItems([
22083
+ * { id: 'MNT-00123', title: 'MNT-00123 · Fryer not heating', group: 'Assigned to you',
22084
+ * status: 'In progress', updatedAt: new Date(), action: 'Show MNT-00123' },
22085
+ * ]);
22086
+ */
22087
+ async setWorkItems(items) {
22088
+ normalizeWorkItems(items);
22089
+ try {
22090
+ this.data = await this.userAPI.setWorkItems(items);
22091
+ } catch (error) {
22092
+ throw new Error("Failed to set work items", {
22093
+ cause: error
22094
+ });
22095
+ }
22096
+ }
22097
+ /** Removes this user's My work list. */
22098
+ async clearWorkItems() {
22099
+ try {
22100
+ this.data = await this.userAPI.clearWorkItems();
22101
+ } catch (error) {
22102
+ throw new Error("Failed to clear work items", {
22103
+ cause: error
22104
+ });
22105
+ }
22106
+ }
22107
+ /**
22108
+ * Clears all user data for the current user (the My work list included)
21362
22109
  * @returns Promise resolving to `{ success: true }` if clearing was successful
21363
22110
  * @throws Error if the clear operation fails
21364
22111
  */
@@ -21425,6 +22172,7 @@ var init_user_data_api_service = __esm({
21425
22172
  init_http_client();
21426
22173
  init_user_instance();
21427
22174
  init_lazy_instances();
22175
+ init_dist();
21428
22176
  UserDataApi = class _UserDataApi extends HttpClient {
21429
22177
  static {
21430
22178
  __name(this, "UserDataApi");
@@ -21438,10 +22186,10 @@ var init_user_data_api_service = __esm({
21438
22186
  * @param credential - The API key for authentication
21439
22187
  * @param agentId - The unique identifier of the agent
21440
22188
  */
21441
- constructor(baseUrl, credential, agentId, targetUserId) {
22189
+ constructor(baseUrl, credential, agentId2, targetUserId) {
21442
22190
  super(baseUrl, credential);
21443
22191
  this.credential = credential;
21444
- this.agentId = agentId;
22192
+ this.agentId = agentId2;
21445
22193
  this.targetUserId = targetUserId;
21446
22194
  }
21447
22195
  get dataPath() {
@@ -21472,7 +22220,7 @@ var init_user_data_api_service = __esm({
21472
22220
  throw new Error(response.error?.message || "Failed to get user data");
21473
22221
  }
21474
22222
  const profile = response.data?._luaProfile;
21475
- const { _luaProfile, ...data } = response.data || {};
22223
+ const { _luaProfile, ...data } = withoutWorkItems(response.data || {});
21476
22224
  const scopedApi = userId ? new _UserDataApi(this.baseUrl, this.credential, this.agentId, userId) : this;
21477
22225
  return new UserDataInstance(scopedApi, data, profile);
21478
22226
  }
@@ -21511,19 +22259,41 @@ var init_user_data_api_service = __esm({
21511
22259
  * @throws Error if the update fails or the request is unsuccessful
21512
22260
  */
21513
22261
  async update(data) {
21514
- const response = await this.httpPut(this.dataPath, data, {});
22262
+ const response = await this.httpPut(this.dataPath, withoutWorkItems(data), {});
21515
22263
  if (!response.success) {
21516
22264
  throw new Error(response.error?.message || "Failed to update user data");
21517
22265
  }
21518
- const { _luaProfile, ...cleanData } = response.data || {};
22266
+ const { _luaProfile, ...cleanData } = withoutWorkItems(response.data || {});
21519
22267
  return cleanData;
21520
22268
  }
21521
22269
  async patch(mutation) {
22270
+ return this.sendPatch(mutationWithoutWorkItems(mutation));
22271
+ }
22272
+ /**
22273
+ * Publishes the user's My work list (LUA-1028), replacing the previous one. Validated first;
22274
+ * a wrong shape throws before anything is sent.
22275
+ */
22276
+ async setWorkItems(items) {
22277
+ return this.sendPatch({
22278
+ set: {
22279
+ [WORK_ITEMS_KEY]: workItemsRecord(items)
22280
+ }
22281
+ });
22282
+ }
22283
+ /** Removes the user's My work list. */
22284
+ async clearWorkItems() {
22285
+ return this.sendPatch({
22286
+ unset: [
22287
+ WORK_ITEMS_KEY
22288
+ ]
22289
+ });
22290
+ }
22291
+ async sendPatch(mutation) {
21522
22292
  const response = await this.httpPatch(this.dataPath, mutation, {});
21523
22293
  if (!response.success) {
21524
22294
  throw new Error(response.error?.message || "Failed to patch user data");
21525
22295
  }
21526
- const { _luaProfile, ...cleanData } = response.data || {};
22296
+ const { _luaProfile, ...cleanData } = withoutWorkItems(response.data || {});
21527
22297
  return cleanData;
21528
22298
  }
21529
22299
  /**
@@ -21840,9 +22610,9 @@ var init_custom_data_api_service = __esm({
21840
22610
  * @param credential - The API key for authentication
21841
22611
  * @param agentId - The unique identifier of the agent
21842
22612
  */
21843
- constructor(baseUrl, credential, agentId) {
22613
+ constructor(baseUrl, credential, agentId2) {
21844
22614
  super(baseUrl, credential);
21845
- this.agentId = agentId;
22615
+ this.agentId = agentId2;
21846
22616
  }
21847
22617
  /**
21848
22618
  * Lists the agent's data collections with entry counts, timestamps, and —
@@ -22050,9 +22820,9 @@ var init_webhook_api_service = __esm({
22050
22820
  * @param credential - The API key for authentication
22051
22821
  * @param agentId - The unique identifier of the agent
22052
22822
  */
22053
- constructor(baseUrl, credential, agentId) {
22823
+ constructor(baseUrl, credential, agentId2) {
22054
22824
  super(baseUrl, credential);
22055
- this.agentId = agentId;
22825
+ this.agentId = agentId2;
22056
22826
  }
22057
22827
  /**
22058
22828
  * Retrieves all webhooks for the agent
@@ -22353,10 +23123,10 @@ var init_job_api_service = __esm({
22353
23123
  * @param credential - The API key for authentication
22354
23124
  * @param agentId - The unique identifier of the agent
22355
23125
  */
22356
- constructor(baseUrl, credential, agentId) {
23126
+ constructor(baseUrl, credential, agentId2) {
22357
23127
  super(baseUrl, credential);
22358
23128
  this.credential = credential;
22359
- this.agentId = agentId;
23129
+ this.agentId = agentId2;
22360
23130
  }
22361
23131
  /**
22362
23132
  * Retrieves all jobs for the agent
@@ -22556,8 +23326,8 @@ var init_ai_api_service = __esm({
22556
23326
  __name(this, "AiApiService");
22557
23327
  }
22558
23328
  agentId;
22559
- constructor(baseUrl, credential, agentId) {
22560
- super(baseUrl, credential), this.agentId = agentId;
23329
+ constructor(baseUrl, credential, agentId2) {
23330
+ super(baseUrl, credential), this.agentId = agentId2;
22561
23331
  }
22562
23332
  async generate(body) {
22563
23333
  return this.httpPost(`/developer/ai/${this.agentId}/generate`, body, {});
@@ -22665,8 +23435,8 @@ var init_integrations_api_service = __esm({
22665
23435
  __name(this, "IntegrationsApiService");
22666
23436
  }
22667
23437
  agentId;
22668
- constructor(baseUrl, credential, agentId) {
22669
- super(baseUrl, credential), this.agentId = agentId;
23438
+ constructor(baseUrl, credential, agentId2) {
23439
+ super(baseUrl, credential), this.agentId = agentId2;
22670
23440
  }
22671
23441
  async passthrough(integrationType, request, options) {
22672
23442
  return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(this.agentId)}/passthrough/${encodeURIComponent(integrationType)}`, options?.connectionId ? {
@@ -22675,12 +23445,12 @@ var init_integrations_api_service = __esm({
22675
23445
  } : request, {});
22676
23446
  }
22677
23447
  /** wave 2 U6 — `GET /developer/unifiedto/connections/:agentId/visible` for `agentId` (default: this agent). */
22678
- async listVisible(agentId = this.agentId) {
22679
- return this.httpGet(`/developer/unifiedto/connections/${encodeURIComponent(agentId)}/visible`);
23448
+ async listVisible(agentId2 = this.agentId) {
23449
+ return this.httpGet(`/developer/unifiedto/connections/${encodeURIComponent(agentId2)}/visible`);
22680
23450
  }
22681
23451
  /** wave 2 U6 — `POST /developer/unifiedto/connections/:agentId/:connectionId/checks`. */
22682
- async runCheck(connectionId, check, options = {}, agentId = this.agentId) {
22683
- return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(agentId)}/${encodeURIComponent(connectionId)}/checks`, {
23452
+ async runCheck(connectionId, check, options = {}, agentId2 = this.agentId) {
23453
+ return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(agentId2)}/${encodeURIComponent(connectionId)}/checks`, {
22684
23454
  check,
22685
23455
  ...options.allowWrite === true ? {
22686
23456
  allowWrite: true
@@ -22822,10 +23592,14 @@ var init_agents_api_service = __esm({
22822
23592
  * `(prompt)` call returns plain text and the `(input)` call returns the
22823
23593
  * full structured output.
22824
23594
  */
22825
- async invokeForSandbox(targetAgentId, promptOrInput) {
22826
- const input = typeof promptOrInput === "string" ? {
23595
+ async invokeForSandbox(targetAgentId, promptOrInput, options) {
23596
+ const base = typeof promptOrInput === "string" ? {
22827
23597
  prompt: promptOrInput
22828
23598
  } : promptOrInput;
23599
+ const input = !base.signal && options?.signal ? {
23600
+ ...base,
23601
+ signal: options.signal
23602
+ } : base;
22829
23603
  if (isAborted2(input.signal)) throw abortReason(input.signal);
22830
23604
  const result = await this.invoke(targetAgentId, input);
22831
23605
  if (!result.success) {
@@ -22867,6 +23641,25 @@ var init_agents_api_service = __esm({
22867
23641
  return toInvocationOutput(data, input.threadId);
22868
23642
  }
22869
23643
  /**
23644
+ * BAC-2154 — the offline twin of `Agents.jobs(agentId).register`. A registration changes what a live agent runs,
23645
+ * like `workflows.deploy`, so it is always refused offline, with no network call. Bad arguments are refused first.
23646
+ * @experimental Gives `lua test` a typed refusal; the live call is served by the platform.
23647
+ */
23648
+ async registerJobForSandbox(targetAgentId, input) {
23649
+ const refuse = /* @__PURE__ */ __name((code, message) => {
23650
+ throw Object.assign(new Error(message), {
23651
+ name: "SupervisionError",
23652
+ code
23653
+ });
23654
+ }, "refuse");
23655
+ if (!targetAgentId) refuse("supervision_no_target", "A target agent id is required");
23656
+ const nonEmpty = /* @__PURE__ */ __name((v) => typeof v === "string" && v.length > 0, "nonEmpty");
23657
+ if (!nonEmpty(input?.versionId) || !nonEmpty(input?.jobId)) {
23658
+ refuse("supervision_bad_args", "jobs.register needs a non-empty versionId and jobId");
23659
+ }
23660
+ return refuse("supervision_release_offline_refused", "jobs.register is refused offline: a local test never changes a live agent");
23661
+ }
23662
+ /**
22870
23663
  * EM-WS2 — the offline (`lua test` / `lua dev`) twin of the `Agents.*`
22871
23664
  * supervision members. Read ops go to the developer REST routes with YOUR
22872
23665
  * developer credential (so they return what you can see, not what a
@@ -23117,9 +23910,9 @@ var init_whatsapp_templates_api_service = __esm({
23117
23910
  * @param credential - The API key for authentication
23118
23911
  * @param agentId - The unique identifier of the agent
23119
23912
  */
23120
- constructor(baseUrl, credential, agentId) {
23913
+ constructor(baseUrl, credential, agentId2) {
23121
23914
  super(baseUrl, credential);
23122
- this.agentId = agentId;
23915
+ this.agentId = agentId2;
23123
23916
  }
23124
23917
  /**
23125
23918
  * Lists WhatsApp templates for a channel with optional pagination and search
@@ -23257,9 +24050,9 @@ var init_developer_api_service = __esm({
23257
24050
  * @param credential - The API key for authentication
23258
24051
  * @param agentId - The unique identifier of the agent
23259
24052
  */
23260
- constructor(baseUrl, credential, agentId) {
24053
+ constructor(baseUrl, credential, agentId2) {
23261
24054
  super(baseUrl, credential);
23262
- this.agentId = agentId;
24055
+ this.agentId = agentId2;
23263
24056
  }
23264
24057
  /**
23265
24058
  * Retrieves all environment variables for the agent in production
@@ -23372,9 +24165,9 @@ var init_developer_api_service = __esm({
23372
24165
  * @param email - The email address to look up
23373
24166
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23374
24167
  */
23375
- async getUserProfileByEmail(email, agentId) {
24168
+ async getUserProfileByEmail(email, agentId2) {
23376
24169
  const path3 = `/developer/user/profile/email/${encodeURIComponent(email)}`;
23377
- const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
24170
+ const scopedPath = agentId2 ? `${path3}?agentId=${encodeURIComponent(agentId2)}` : path3;
23378
24171
  return this.httpGet(scopedPath, {});
23379
24172
  }
23380
24173
  /**
@@ -23382,10 +24175,10 @@ var init_developer_api_service = __esm({
23382
24175
  * @param phone - The phone number to look up (with or without + prefix)
23383
24176
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23384
24177
  */
23385
- async getUserProfileByPhone(phone, agentId) {
24178
+ async getUserProfileByPhone(phone, agentId2) {
23386
24179
  const normalizedPhone = phone.replace(/^\+/, "");
23387
24180
  const path3 = `/developer/user/profile/phone/${normalizedPhone}`;
23388
- const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
24181
+ const scopedPath = agentId2 ? `${path3}?agentId=${encodeURIComponent(agentId2)}` : path3;
23389
24182
  return this.httpGet(scopedPath, {});
23390
24183
  }
23391
24184
  /**
@@ -23393,9 +24186,9 @@ var init_developer_api_service = __esm({
23393
24186
  * @param identity - `{ kind, scope, value }`, e.g. from `Lua.request.sender`
23394
24187
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23395
24188
  */
23396
- async getUserProfileByIdentity(identity, agentId) {
24189
+ async getUserProfileByIdentity(identity, agentId2) {
23397
24190
  const path3 = `/developer/user/profile/identity/${encodeURIComponent(identity.kind)}/${encodeURIComponent(identity.value)}`;
23398
- return this.httpGet(`${path3}?scope=${encodeURIComponent(identity.scope)}&agentId=${encodeURIComponent(agentId)}`, {});
24191
+ return this.httpGet(`${path3}?scope=${encodeURIComponent(identity.scope)}&agentId=${encodeURIComponent(agentId2)}`, {});
23399
24192
  }
23400
24193
  };
23401
24194
  }
@@ -23412,9 +24205,9 @@ var init_voice_api_service = __esm({
23412
24205
  __name(this, "VoiceApi");
23413
24206
  }
23414
24207
  agentId;
23415
- constructor(baseUrl, credential, agentId) {
24208
+ constructor(baseUrl, credential, agentId2) {
23416
24209
  super(baseUrl, credential);
23417
- this.agentId = agentId;
24210
+ this.agentId = agentId2;
23418
24211
  }
23419
24212
  async getVoices() {
23420
24213
  return this.httpGet(`/developer/voice-agents/${this.agentId}`, {});
@@ -23505,8 +24298,8 @@ var init_channels_send_api_service = __esm({
23505
24298
  __name(this, "ChannelsSendApiService");
23506
24299
  }
23507
24300
  agentId;
23508
- constructor(baseUrl, credential, agentId) {
23509
- super(baseUrl, credential), this.agentId = agentId;
24301
+ constructor(baseUrl, credential, agentId2) {
24302
+ super(baseUrl, credential), this.agentId = agentId2;
23510
24303
  }
23511
24304
  /** POST /developer/agents/:agentId/channels/send */
23512
24305
  async send(input) {
@@ -23628,8 +24421,8 @@ var init_inbox_push_api_service = __esm({
23628
24421
  __name(this, "InboxPushApiService");
23629
24422
  }
23630
24423
  agentId;
23631
- constructor(baseUrl, credential, agentId) {
23632
- super(baseUrl, credential), this.agentId = agentId;
24424
+ constructor(baseUrl, credential, agentId2) {
24425
+ super(baseUrl, credential), this.agentId = agentId2;
23633
24426
  }
23634
24427
  /** POST /developer/agents/:agentId/inbox/push */
23635
24428
  async push(input) {
@@ -23650,8 +24443,8 @@ var init_directory_api_service = __esm({
23650
24443
  __name(this, "DirectoryApiService");
23651
24444
  }
23652
24445
  agentId;
23653
- constructor(baseUrl, credential, agentId) {
23654
- super(baseUrl, credential), this.agentId = agentId;
24446
+ constructor(baseUrl, credential, agentId2) {
24447
+ super(baseUrl, credential), this.agentId = agentId2;
23655
24448
  }
23656
24449
  /** POST /developer/agents/:agentId/directory/resolve */
23657
24450
  async resolve(name) {
@@ -23781,9 +24574,9 @@ function createWorkflowsRuntime(getApi) {
23781
24574
  },
23782
24575
  // Goals are scoped to the bound agent: the IF-21 `agentId` argument is parity with the HTTP twin
23783
24576
  // (`/workflows/:agentId/goals`), never a way to reach another agent's goals (403 otherwise).
23784
- async setGoal(agentId, goal) {
24577
+ async setGoal(agentId2, goal) {
23785
24578
  const api = await getApi();
23786
- assertBoundAgent(api, agentId, "setGoal");
24579
+ assertBoundAgent(api, agentId2, "setGoal");
23787
24580
  const g = goal;
23788
24581
  const target = g.workflowId ?? g.workflow;
23789
24582
  const ref = target ? await resolveRef(api, target) : {};
@@ -23793,29 +24586,29 @@ function createWorkflowsRuntime(getApi) {
23793
24586
  }), "Workflows.setGoal");
23794
24587
  },
23795
24588
  goals: {
23796
- async list(agentId, opts = {}) {
24589
+ async list(agentId2, opts = {}) {
23797
24590
  const api = await getApi();
23798
- assertBoundAgent(api, agentId, "goals.list");
24591
+ assertBoundAgent(api, agentId2, "goals.list");
23799
24592
  return unwrap(await api.getGoals(opts), "Workflows.goals.list").items;
23800
24593
  },
23801
- async get(agentId, goalId) {
24594
+ async get(agentId2, goalId) {
23802
24595
  const api = await getApi();
23803
- assertBoundAgent(api, agentId, "goals.get");
24596
+ assertBoundAgent(api, agentId2, "goals.get");
23804
24597
  return unwrap(await api.getGoal(goalId), "Workflows.goals.get");
23805
24598
  },
23806
- async pause(agentId, goalId) {
24599
+ async pause(agentId2, goalId) {
23807
24600
  const api = await getApi();
23808
- assertBoundAgent(api, agentId, "goals.pause");
24601
+ assertBoundAgent(api, agentId2, "goals.pause");
23809
24602
  return unwrap(await api.pauseGoal(goalId), "Workflows.goals.pause");
23810
24603
  },
23811
- async resume(agentId, goalId) {
24604
+ async resume(agentId2, goalId) {
23812
24605
  const api = await getApi();
23813
- assertBoundAgent(api, agentId, "goals.resume");
24606
+ assertBoundAgent(api, agentId2, "goals.resume");
23814
24607
  return unwrap(await api.resumeGoal(goalId), "Workflows.goals.resume");
23815
24608
  },
23816
- async close(agentId, goalId, opts = {}) {
24609
+ async close(agentId2, goalId, opts = {}) {
23817
24610
  const api = await getApi();
23818
- assertBoundAgent(api, agentId, "goals.close");
24611
+ assertBoundAgent(api, agentId2, "goals.close");
23819
24612
  return unwrap(await api.closeGoal(goalId, opts), "Workflows.goals.close");
23820
24613
  }
23821
24614
  }
@@ -23854,8 +24647,8 @@ var init_workflow_api_service = __esm({
23854
24647
  return res.data;
23855
24648
  }, "unwrap");
23856
24649
  isWorkflowIdShaped = /* @__PURE__ */ __name((v) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v) || /^wfc?_[A-Za-z0-9]/.test(v), "isWorkflowIdShaped");
23857
- assertBoundAgent = /* @__PURE__ */ __name((api, agentId, member) => {
23858
- if (agentId && agentId !== api.agentId) {
24650
+ assertBoundAgent = /* @__PURE__ */ __name((api, agentId2, member) => {
24651
+ if (agentId2 && agentId2 !== api.agentId) {
23859
24652
  throw new WorkflowApiError("FORBIDDEN", `Workflows.${member}: goals are scoped to the bound agent ${api.agentId}`, 403);
23860
24653
  }
23861
24654
  }, "assertBoundAgent");
@@ -23867,10 +24660,10 @@ var init_workflow_api_service = __esm({
23867
24660
  }
23868
24661
  credential;
23869
24662
  agentId;
23870
- constructor(baseUrl, credential, agentId) {
24663
+ constructor(baseUrl, credential, agentId2) {
23871
24664
  super(baseUrl, credential);
23872
24665
  this.credential = credential;
23873
- this.agentId = agentId;
24666
+ this.agentId = agentId2;
23874
24667
  }
23875
24668
  /** PRO-1434 (main sync): auth rides the renewable request credential — resolve a current bearer per call. */
23876
24669
  async auth() {
@@ -24273,9 +25066,9 @@ var init_device_api_service = __esm({
24273
25066
  __name(this, "DeviceApi");
24274
25067
  }
24275
25068
  agentId;
24276
- constructor(baseUrl, credential, agentId) {
25069
+ constructor(baseUrl, credential, agentId2) {
24277
25070
  super(baseUrl, credential);
24278
- this.agentId = agentId;
25071
+ this.agentId = agentId2;
24279
25072
  }
24280
25073
  async getDevices() {
24281
25074
  return this.httpGet(`/developer/devices/${this.agentId}`, {});
@@ -24623,8 +25416,8 @@ var init_secrets_api_service = __esm({
24623
25416
  __name(this, "SecretsApiService");
24624
25417
  }
24625
25418
  agentId;
24626
- constructor(baseUrl, credential, agentId) {
24627
- super(baseUrl, credential), this.agentId = agentId;
25419
+ constructor(baseUrl, credential, agentId2) {
25420
+ super(baseUrl, credential), this.agentId = agentId2;
24628
25421
  }
24629
25422
  unwrap(result, what) {
24630
25423
  if (!result.success || result.data === void 0) {
@@ -24734,26 +25527,26 @@ function buildSupervisionAgentsApi(call2) {
24734
25527
  /** Agents of the caller's own organization, with the supervision actions the caller holds on each. */
24735
25528
  list: /* @__PURE__ */ __name2(() => call2("agents.list"), "list"),
24736
25529
  /** One agent of the caller's organization (not found = other org or no such agent). */
24737
- get: /* @__PURE__ */ __name2((agentId) => call2("agents.get", agentId), "get"),
25530
+ get: /* @__PURE__ */ __name2((agentId2) => call2("agents.get", agentId2), "get"),
24738
25531
  /** Recent execution logs of a supervised agent (metadata + message, no user ids). */
24739
- logs: /* @__PURE__ */ __name2((agentId, opts = {}) => call2("logs", agentId, {
25532
+ logs: /* @__PURE__ */ __name2((agentId2, opts = {}) => call2("logs", agentId2, {
24740
25533
  ...opts
24741
25534
  }), "logs"),
24742
- runs: /* @__PURE__ */ __name2((agentId) => ({
24743
- list: /* @__PURE__ */ __name2((opts = {}) => call2("runs.list", agentId, {
25535
+ runs: /* @__PURE__ */ __name2((agentId2) => ({
25536
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("runs.list", agentId2, {
24744
25537
  ...opts
24745
25538
  }), "list"),
24746
- get: /* @__PURE__ */ __name2((runId) => call2("runs.get", agentId, {
25539
+ get: /* @__PURE__ */ __name2((runId) => call2("runs.get", agentId2, {
24747
25540
  runId
24748
25541
  }), "get")
24749
25542
  }), "runs"),
24750
25543
  /** Read-only, and only the collections the org admin named on the supervision grant. */
24751
- data: /* @__PURE__ */ __name2((agentId) => ({
24752
- get: /* @__PURE__ */ __name2((collection, entryId) => call2("data.get", agentId, {
25544
+ data: /* @__PURE__ */ __name2((agentId2) => ({
25545
+ get: /* @__PURE__ */ __name2((collection, entryId) => call2("data.get", agentId2, {
24753
25546
  collection,
24754
25547
  entryId
24755
25548
  }), "get"),
24756
- query: /* @__PURE__ */ __name2((collection, filter, opts = {}) => call2("data.query", agentId, {
25549
+ query: /* @__PURE__ */ __name2((collection, filter, opts = {}) => call2("data.query", agentId2, {
24757
25550
  collection,
24758
25551
  ...filter ? {
24759
25552
  filter
@@ -24761,19 +25554,19 @@ function buildSupervisionAgentsApi(call2) {
24761
25554
  ...opts
24762
25555
  }), "query")
24763
25556
  }), "data"),
24764
- versions: /* @__PURE__ */ __name2((agentId) => ({
24765
- list: /* @__PURE__ */ __name2((opts = {}) => call2("versions.list", agentId, {
25557
+ versions: /* @__PURE__ */ __name2((agentId2) => ({
25558
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("versions.list", agentId2, {
24766
25559
  ...opts
24767
25560
  }), "list"),
24768
- get: /* @__PURE__ */ __name2((version) => call2("versions.get", agentId, {
25561
+ get: /* @__PURE__ */ __name2((version) => call2("versions.get", agentId2, {
24769
25562
  version
24770
25563
  }), "get"),
24771
- diff: /* @__PURE__ */ __name2((from, to) => call2("versions.diff", agentId, {
25564
+ diff: /* @__PURE__ */ __name2((from, to) => call2("versions.diff", agentId2, {
24772
25565
  from,
24773
25566
  to
24774
25567
  }), "diff"),
24775
25568
  /** Chat a staged version. No tools run unless `opts.toolScope.skillIds` allowlists them. */
24776
- preview: /* @__PURE__ */ __name2((version, prompt, opts = {}) => call2("versions.preview", agentId, {
25569
+ preview: /* @__PURE__ */ __name2((version, prompt, opts = {}) => call2("versions.preview", agentId2, {
24777
25570
  version,
24778
25571
  prompt,
24779
25572
  ...opts.toolScope ? {
@@ -24781,12 +25574,12 @@ function buildSupervisionAgentsApi(call2) {
24781
25574
  } : {}
24782
25575
  }), "preview"),
24783
25576
  /** Make `version` live. Compare-and-swap: refused unless `expectActive` is the live version. */
24784
- promote: /* @__PURE__ */ __name2(async (version, opts) => call2("versions.promote", agentId, {
25577
+ promote: /* @__PURE__ */ __name2(async (version, opts) => call2("versions.promote", agentId2, {
24785
25578
  version,
24786
25579
  expectActive: requireExpectActive(opts, "versions.promote")
24787
25580
  }), "promote"),
24788
25581
  /** Soft-delete a SUPERSEDED version (the active version and the last version are refused). */
24789
- delete: /* @__PURE__ */ __name2((version) => call2("versions.delete", agentId, {
25582
+ delete: /* @__PURE__ */ __name2((version) => call2("versions.delete", agentId2, {
24790
25583
  version
24791
25584
  }), "delete"),
24792
25585
  /**
@@ -24798,7 +25591,7 @@ function buildSupervisionAgentsApi(call2) {
24798
25591
  if (expectActive === null) {
24799
25592
  throw typedError("supervision_expect_active_required", "versions.rollback requires { expectActive } \u2014 the active version number (a rollback needs one)");
24800
25593
  }
24801
- return call2("versions.rollback", agentId, {
25594
+ return call2("versions.rollback", agentId2, {
24802
25595
  version,
24803
25596
  expectActive
24804
25597
  });
@@ -24810,20 +25603,30 @@ function buildSupervisionAgentsApi(call2) {
24810
25603
  * tools) and never gets `egress: 'live'`.
24811
25604
  */
24812
25605
  session: /* @__PURE__ */ __name2(async (opts) => {
24813
- const opened = await call2("versions.session", agentId, {
25606
+ const opened = await call2("versions.session", agentId2, {
24814
25607
  ...opts
24815
25608
  });
24816
- return buildTestSessionHandle(call2, agentId, opened);
25609
+ return buildTestSessionHandle(call2, agentId2, opened);
24817
25610
  }, "session")
24818
25611
  }), "versions"),
25612
+ /**
25613
+ * BAC-2011 — register a job pinned in a STAGED `versionId` of the target (`supervision:register-job`, only from a
25614
+ * workflow step the grant names). The job goes live with the ordinary promote of that version.
25615
+ */
25616
+ jobs: /* @__PURE__ */ __name2((agentId2) => ({
25617
+ register: /* @__PURE__ */ __name2((opts) => call2("jobs.register", agentId2, {
25618
+ versionId: opts?.versionId,
25619
+ jobId: opts?.jobId
25620
+ }), "register")
25621
+ }), "jobs"),
24819
25622
  /** Read (`observe`) and release (`release`) a workflow of a supervised agent. */
24820
- workflows: /* @__PURE__ */ __name2((agentId) => ({
25623
+ workflows: /* @__PURE__ */ __name2((agentId2) => ({
24821
25624
  /** One workflow: its live `activeVersionId` (deploy's `expectActive`) and its latest 20 versions. */
24822
- get: /* @__PURE__ */ __name2((workflowId) => call2("workflows.get", agentId, {
25625
+ get: /* @__PURE__ */ __name2((workflowId) => call2("workflows.get", agentId2, {
24823
25626
  workflowId
24824
25627
  }), "get"),
24825
25628
  /** Create workflow `name` (inert: inactive, no version) or answer the existing one: `{ workflowId, name, created }`. */
24826
- create: /* @__PURE__ */ __name2((name, opts = {}) => call2("workflows.create", agentId, {
25629
+ create: /* @__PURE__ */ __name2((name, opts = {}) => call2("workflows.create", agentId2, {
24827
25630
  name,
24828
25631
  ...opts?.description !== void 0 ? {
24829
25632
  description: opts.description
@@ -24833,7 +25636,7 @@ function buildSupervisionAgentsApi(call2) {
24833
25636
  } : {}
24834
25637
  }), "create"),
24835
25638
  /** Push a new, INACTIVE version (`activate` is always forced off; deploy it with `deploy`). */
24836
- push: /* @__PURE__ */ __name2((workflowId, definition) => call2("workflows.push", agentId, {
25639
+ push: /* @__PURE__ */ __name2((workflowId, definition) => call2("workflows.push", agentId2, {
24837
25640
  workflowId,
24838
25641
  definition: {
24839
25642
  ...definition
@@ -24843,7 +25646,7 @@ function buildSupervisionAgentsApi(call2) {
24843
25646
  deploy: /* @__PURE__ */ __name2(async (workflowId, version, opts) => {
24844
25647
  const expectActive = requireExpectActiveId(opts, "workflows.deploy");
24845
25648
  const commitHash = optionalCommitHash(opts, "workflows.deploy");
24846
- return call2("workflows.deploy", agentId, {
25649
+ return call2("workflows.deploy", agentId2, {
24847
25650
  workflowId,
24848
25651
  version,
24849
25652
  expectActive,
@@ -24853,45 +25656,45 @@ function buildSupervisionAgentsApi(call2) {
24853
25656
  });
24854
25657
  }, "deploy")
24855
25658
  }), "workflows"),
24856
- persona: /* @__PURE__ */ __name2((agentId) => ({
24857
- versions: /* @__PURE__ */ __name2(() => call2("persona.versions", agentId), "versions"),
25659
+ persona: /* @__PURE__ */ __name2((agentId2) => ({
25660
+ versions: /* @__PURE__ */ __name2(() => call2("persona.versions", agentId2), "versions"),
24858
25661
  /** Serve persona `version`. Compare-and-swap on the served persona version. */
24859
- activate: /* @__PURE__ */ __name2(async (version, opts) => call2("persona.activate", agentId, {
25662
+ activate: /* @__PURE__ */ __name2(async (version, opts) => call2("persona.activate", agentId2, {
24860
25663
  version,
24861
25664
  expectActive: requireExpectActive(opts, "persona.activate")
24862
25665
  }), "activate")
24863
25666
  }), "persona"),
24864
- source: /* @__PURE__ */ __name2((agentId) => ({
24865
- list: /* @__PURE__ */ __name2(() => call2("source.list", agentId), "list"),
24866
- get: /* @__PURE__ */ __name2((path3) => call2("source.get", agentId, {
25667
+ source: /* @__PURE__ */ __name2((agentId2) => ({
25668
+ list: /* @__PURE__ */ __name2(() => call2("source.list", agentId2), "list"),
25669
+ get: /* @__PURE__ */ __name2((path3) => call2("source.get", agentId2, {
24867
25670
  path: path3
24868
25671
  }), "get")
24869
25672
  }), "source"),
24870
25673
  /** Environment variable NAMES only — values are never returned. */
24871
- env: /* @__PURE__ */ __name2((agentId) => ({
24872
- keys: /* @__PURE__ */ __name2(() => call2("env.keys", agentId), "keys")
25674
+ env: /* @__PURE__ */ __name2((agentId2) => ({
25675
+ keys: /* @__PURE__ */ __name2(() => call2("env.keys", agentId2), "keys")
24873
25676
  }), "env"),
24874
25677
  /**
24875
25678
  * SV (LUA-1080) — what `agentId` serves RIGHT NOW: its live skills (with tools), the published persona and its
24876
25679
  * pre/postprocessors, each with the version id an agent version snapshot would pin. Works with no promoted agent
24877
25680
  * version, so a release can diff live against a staged version. Metadata and hashes only (`observe`).
24878
25681
  */
24879
- deployed: /* @__PURE__ */ __name2((agentId) => call2("primitives.deployed", agentId), "deployed"),
25682
+ deployed: /* @__PURE__ */ __name2((agentId2) => call2("primitives.deployed", agentId2), "deployed"),
24880
25683
  /**
24881
25684
  * U25 — supervision events of the target (`observe`): each event of a subscribed kind starts
24882
25685
  * one of the CALLER's own triggers (`triggerName`) with a `source: 'supervision'` body.
24883
25686
  */
24884
- events: /* @__PURE__ */ __name2((agentId) => ({
24885
- subscribe: /* @__PURE__ */ __name2((opts) => call2("events.subscribe", agentId, {
25687
+ events: /* @__PURE__ */ __name2((agentId2) => ({
25688
+ subscribe: /* @__PURE__ */ __name2((opts) => call2("events.subscribe", agentId2, {
24886
25689
  kinds: Array.isArray(opts?.kinds) ? [
24887
25690
  ...opts.kinds
24888
25691
  ] : opts?.kinds,
24889
25692
  triggerName: opts?.triggerName
24890
25693
  }), "subscribe"),
24891
- unsubscribe: /* @__PURE__ */ __name2((triggerName) => call2("events.unsubscribe", agentId, {
25694
+ unsubscribe: /* @__PURE__ */ __name2((triggerName) => call2("events.unsubscribe", agentId2, {
24892
25695
  triggerName
24893
25696
  }), "unsubscribe"),
24894
- list: /* @__PURE__ */ __name2(() => call2("events.list", agentId), "list")
25697
+ list: /* @__PURE__ */ __name2(() => call2("events.list", agentId2), "list")
24895
25698
  }), "events"),
24896
25699
  // wave 2 U1
24897
25700
  /**
@@ -24918,26 +25721,26 @@ function buildSupervisionAgentsApi(call2) {
24918
25721
  approval: approvalIdsOf(opts?.approval)
24919
25722
  }), "create"),
24920
25723
  // wave 2 U6 — the target's connections (`observe`): list, and READ catalogue checks only.
24921
- integrations: /* @__PURE__ */ __name2((agentId) => ({
24922
- list: /* @__PURE__ */ __name2(() => call2("integrations.list", agentId), "list"),
24923
- check: /* @__PURE__ */ __name2((connectionId, check) => call2("integrations.check", agentId, {
25724
+ integrations: /* @__PURE__ */ __name2((agentId2) => ({
25725
+ list: /* @__PURE__ */ __name2(() => call2("integrations.list", agentId2), "list"),
25726
+ check: /* @__PURE__ */ __name2((connectionId, check) => call2("integrations.check", agentId2, {
24924
25727
  connectionId,
24925
25728
  check
24926
25729
  }), "check")
24927
25730
  }), "integrations"),
24928
25731
  // wave 2 U30
24929
25732
  /** Recorded metrics of the target (`observe`): by `name` or `objectiveId`, bucketed `1h` / `1d`. */
24930
- metrics: /* @__PURE__ */ __name2((agentId) => ({
24931
- query: /* @__PURE__ */ __name2((q) => call2("metrics.query", agentId, {
25733
+ metrics: /* @__PURE__ */ __name2((agentId2) => ({
25734
+ query: /* @__PURE__ */ __name2((q) => call2("metrics.query", agentId2, {
24932
25735
  ...q
24933
25736
  }), "query")
24934
25737
  }), "metrics"),
24935
25738
  /** Objectives of the target: list (`observe`); propose (`act`) — never effective until the OWNER confirms. */
24936
- objectives: /* @__PURE__ */ __name2((agentId) => ({
24937
- list: /* @__PURE__ */ __name2((opts = {}) => call2("objectives.list", agentId, {
25739
+ objectives: /* @__PURE__ */ __name2((agentId2) => ({
25740
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("objectives.list", agentId2, {
24938
25741
  ...opts
24939
25742
  }), "list"),
24940
- propose: /* @__PURE__ */ __name2((proposal) => call2("objectives.propose", agentId, {
25743
+ propose: /* @__PURE__ */ __name2((proposal) => call2("objectives.propose", agentId2, {
24941
25744
  proposal
24942
25745
  }), "propose")
24943
25746
  }), "objectives"),
@@ -24947,13 +25750,13 @@ function buildSupervisionAgentsApi(call2) {
24947
25750
  * `lastAgentChangeAt`, so a supervisor can back off while a person is working on the agent;
24948
25751
  * `acquire` / `release` (`act`) take, renew or drop the CALLER's own lease (1-240 minutes).
24949
25752
  */
24950
- lease: /* @__PURE__ */ __name2((agentId) => ({
24951
- get: /* @__PURE__ */ __name2(() => call2("lease.get", agentId), "get"),
24952
- acquire: /* @__PURE__ */ __name2((opts) => call2("lease.acquire", agentId, {
25753
+ lease: /* @__PURE__ */ __name2((agentId2) => ({
25754
+ get: /* @__PURE__ */ __name2(() => call2("lease.get", agentId2), "get"),
25755
+ acquire: /* @__PURE__ */ __name2((opts) => call2("lease.acquire", agentId2, {
24953
25756
  ttlMinutes: opts?.ttlMinutes,
24954
25757
  reason: opts?.reason
24955
25758
  }), "acquire"),
24956
- release: /* @__PURE__ */ __name2(() => call2("lease.release", agentId), "release")
25759
+ release: /* @__PURE__ */ __name2(() => call2("lease.release", agentId2), "release")
24957
25760
  }), "lease"),
24958
25761
  // wave 2 U4b
24959
25762
  /**
@@ -24962,15 +25765,15 @@ function buildSupervisionAgentsApi(call2) {
24962
25765
  * and revoke grants on it; external records are kept. `delete` also needs the agent's exact current name and
24963
25766
  * ends the 30-day restore window.
24964
25767
  */
24965
- lifecycle: /* @__PURE__ */ __name2((agentId) => ({
24966
- archive: /* @__PURE__ */ __name2(() => call2("lifecycle.archive", agentId), "archive"),
24967
- delete: /* @__PURE__ */ __name2((opts) => call2("lifecycle.delete", agentId, {
25768
+ lifecycle: /* @__PURE__ */ __name2((agentId2) => ({
25769
+ archive: /* @__PURE__ */ __name2(() => call2("lifecycle.archive", agentId2), "archive"),
25770
+ delete: /* @__PURE__ */ __name2((opts) => call2("lifecycle.delete", agentId2, {
24968
25771
  confirmName: opts?.confirmName
24969
25772
  }), "delete")
24970
25773
  }), "lifecycle"),
24971
25774
  /** U4b — set the model, the name or NON-secret env keys (`act`); keys ending SECRET/TOKEN/KEY/PASSWORD refuse. */
24972
- config: /* @__PURE__ */ __name2((agentId) => ({
24973
- set: /* @__PURE__ */ __name2((input) => call2("config.set", agentId, {
25775
+ config: /* @__PURE__ */ __name2((agentId2) => ({
25776
+ set: /* @__PURE__ */ __name2((input) => call2("config.set", agentId2, {
24974
25777
  ...input?.model !== void 0 ? {
24975
25778
  model: input.model
24976
25779
  } : {},
@@ -24993,7 +25796,7 @@ function buildSupervisionAgentsApi(call2) {
24993
25796
  * `dataCollections`, and `notifyOwner` (the owner opts in to `notifyOwner` messages by approving it). When the
24994
25797
  * caller already holds a grant, the request upgrades it and the approver sees exactly what is added.
24995
25798
  */
24996
- requestAccess: /* @__PURE__ */ __name2((agentId, opts) => call2("access.request", agentId, {
25799
+ requestAccess: /* @__PURE__ */ __name2((agentId2, opts) => call2("access.request", agentId2, {
24997
25800
  actions: Array.isArray(opts?.actions) ? [
24998
25801
  ...opts.actions
24999
25802
  ] : opts?.actions,
@@ -25026,15 +25829,15 @@ function buildSupervisionAgentsApi(call2) {
25026
25829
  * `'active'` — against a suite the owner defined (needs `supervision:preview` and the preview switch); results
25027
25830
  * are `observe`, transcripts (message bodies) need `observe-content`. `cancel` stops only runs you started.
25028
25831
  */
25029
- evals: /* @__PURE__ */ __name2((agentId) => ({
25832
+ evals: /* @__PURE__ */ __name2((agentId2) => ({
25030
25833
  /** The target's suites (key, revision, case count, pass rate). */
25031
- suites: /* @__PURE__ */ __name2(() => call2("evals.suites.get", agentId, {}), "suites"),
25834
+ suites: /* @__PURE__ */ __name2(() => call2("evals.suites.get", agentId2, {}), "suites"),
25032
25835
  /** One suite with its parsed cases. */
25033
- suite: /* @__PURE__ */ __name2((key) => call2("evals.suites.get", agentId, {
25836
+ suite: /* @__PURE__ */ __name2((key) => call2("evals.suites.get", agentId2, {
25034
25837
  key
25035
25838
  }), "suite"),
25036
25839
  /** Start a run: `{ runId, estimate }`. Bounded by the suite budget, the agent's monthly cap and a daily cap. */
25037
- run: /* @__PURE__ */ __name2((opts) => call2("evals.run", agentId, {
25840
+ run: /* @__PURE__ */ __name2((opts) => call2("evals.run", agentId2, {
25038
25841
  suite: opts?.suite,
25039
25842
  version: opts?.version,
25040
25843
  ...opts?.maxCredits !== void 0 ? {
@@ -25045,20 +25848,20 @@ function buildSupervisionAgentsApi(call2) {
25045
25848
  } : {}
25046
25849
  }), "run"),
25047
25850
  /** Runs, newest first (`suite`, `version`, `status`, `limit` ≤ 50, `before`). */
25048
- runs: /* @__PURE__ */ __name2((opts = {}) => call2("evals.get", agentId, {
25851
+ runs: /* @__PURE__ */ __name2((opts = {}) => call2("evals.get", agentId2, {
25049
25852
  ...opts
25050
25853
  }), "runs"),
25051
25854
  /** One run with its per-case results (check detail and judge reasoning only with observe-content). */
25052
- getRun: /* @__PURE__ */ __name2((runId) => call2("evals.get", agentId, {
25855
+ getRun: /* @__PURE__ */ __name2((runId) => call2("evals.get", agentId2, {
25053
25856
  runId
25054
25857
  }), "getRun"),
25055
25858
  /** One case's transcript (needs observe-content; a holdout case is not found). */
25056
- transcript: /* @__PURE__ */ __name2((runId, caseId) => call2("evals.get", agentId, {
25859
+ transcript: /* @__PURE__ */ __name2((runId, caseId) => call2("evals.get", agentId2, {
25057
25860
  runId,
25058
25861
  caseId
25059
25862
  }), "transcript"),
25060
25863
  /** Cancel a queued or running run YOU started (works with the preview switch off). */
25061
- cancel: /* @__PURE__ */ __name2((runId) => call2("evals.cancel", agentId, {
25864
+ cancel: /* @__PURE__ */ __name2((runId) => call2("evals.cancel", agentId2, {
25062
25865
  runId
25063
25866
  }), "cancel")
25064
25867
  }), "evals"),
@@ -25070,7 +25873,7 @@ function buildSupervisionAgentsApi(call2) {
25070
25873
  * An optional `idempotencyKey` makes a retry answer the first call's receipt instead of posting again; it is
25071
25874
  * forwarded only when present, so a keyless call sends exactly `{ message }`.
25072
25875
  */
25073
- notifyOwner: /* @__PURE__ */ __name2((agentId, input) => call2("owner.notify", agentId, {
25876
+ notifyOwner: /* @__PURE__ */ __name2((agentId2, input) => call2("owner.notify", agentId2, {
25074
25877
  message: input?.message,
25075
25878
  ...input?.idempotencyKey !== void 0 ? {
25076
25879
  idempotencyKey: input.idempotencyKey
@@ -25085,8 +25888,8 @@ function buildSupervisionAgentsApi(call2) {
25085
25888
  * exactly `Give your <integration> connection to "<agentName>"?`, then call this from a code step of THAT run with
25086
25889
  * `{ approval: { runId, stepId } }`. Needs an `act` grant on the agent.
25087
25890
  */
25088
- connections: /* @__PURE__ */ __name2((agentId) => ({
25089
- assign: /* @__PURE__ */ __name2((connectionId, opts) => call2("connections.assign", agentId, {
25891
+ connections: /* @__PURE__ */ __name2((agentId2) => ({
25892
+ assign: /* @__PURE__ */ __name2((connectionId, opts) => call2("connections.assign", agentId2, {
25090
25893
  connectionId,
25091
25894
  approval: opts?.approval && typeof opts.approval === "object" ? {
25092
25895
  ...opts.approval
@@ -25098,8 +25901,8 @@ function buildSupervisionAgentsApi(call2) {
25098
25901
  * Attach requests held for `agentId` to its env (`act`, on the agent owner's own turn; never overwrites a key).
25099
25902
  * Answers the env keys set, never a value.
25100
25903
  */
25101
- secrets: /* @__PURE__ */ __name2((agentId) => ({
25102
- attach: /* @__PURE__ */ __name2((requestIds) => call2("secrets.attach", agentId, {
25904
+ secrets: /* @__PURE__ */ __name2((agentId2) => ({
25905
+ attach: /* @__PURE__ */ __name2((requestIds) => call2("secrets.attach", agentId2, {
25103
25906
  requestIds: copyList(requestIds)
25104
25907
  }), "attach")
25105
25908
  }), "secrets")
@@ -25114,14 +25917,14 @@ function copyList(value3) {
25114
25917
  }
25115
25918
  __name(copyList, "copyList");
25116
25919
  __name2(copyList, "copyList");
25117
- function buildTestSessionHandle(call2, agentId, opened) {
25920
+ function buildTestSessionHandle(call2, agentId2, opened) {
25118
25921
  const sessionId = opened?.id;
25119
25922
  return {
25120
25923
  sessionId,
25121
25924
  version: opened?.version,
25122
25925
  session: opened,
25123
25926
  /** One multi-turn chat turn (same thread unless `threadId` names another key). */
25124
- chat: /* @__PURE__ */ __name2((input) => call2("sessions.chat", agentId, {
25927
+ chat: /* @__PURE__ */ __name2((input) => call2("sessions.chat", agentId2, {
25125
25928
  sessionId,
25126
25929
  ...typeof input === "string" ? {
25127
25930
  prompt: input
@@ -25130,16 +25933,16 @@ function buildTestSessionHandle(call2, agentId, opened) {
25130
25933
  }
25131
25934
  }), "chat"),
25132
25935
  /** Fire one primitive against the staged version: `{ trigger, payload }` in this phase. */
25133
- fire: /* @__PURE__ */ __name2((input) => call2("sessions.fire", agentId, {
25936
+ fire: /* @__PURE__ */ __name2((input) => call2("sessions.fire", agentId2, {
25134
25937
  sessionId,
25135
25938
  ...input
25136
25939
  }), "fire"),
25137
25940
  /** The effects the session recorded instead of executing. */
25138
- effects: /* @__PURE__ */ __name2(() => call2("sessions.effects", agentId, {
25941
+ effects: /* @__PURE__ */ __name2(() => call2("sessions.effects", agentId2, {
25139
25942
  sessionId
25140
25943
  }), "effects"),
25141
25944
  /** Close: purges the session's shadow Data and recorded effects. */
25142
- close: /* @__PURE__ */ __name2(() => call2("sessions.close", agentId, {
25945
+ close: /* @__PURE__ */ __name2(() => call2("sessions.close", agentId2, {
25143
25946
  sessionId
25144
25947
  }), "close")
25145
25948
  };
@@ -25230,10 +26033,10 @@ var log = Object.freeze({
25230
26033
  });
25231
26034
  function emitLocalLog(level, message, fields) {
25232
26035
  const normalized = normalizeLogFields(fields);
25233
- const text = typeof message === "object" && message !== null ? JSON.stringify(message) : String(message);
26036
+ const text2 = typeof message === "object" && message !== null ? JSON.stringify(message) : String(message);
25234
26037
  const write = level === "error" ? console.error : level === "warn" ? console.warn : level === "info" ? console.info : console.debug;
25235
- if (normalized) write(text, JSON.stringify(normalized));
25236
- else write(text);
26038
+ if (normalized) write(text2, JSON.stringify(normalized));
26039
+ else write(text2);
25237
26040
  }
25238
26041
  __name(emitLocalLog, "emitLocalLog");
25239
26042
  var ToolFlag = /* @__PURE__ */ (function(ToolFlag2) {
@@ -25658,7 +26461,7 @@ var LuaMCPServer = class {
25658
26461
  throw new Error("MCP server name is required");
25659
26462
  }
25660
26463
  if (config.transport === "stdio") {
25661
- throw new Error(`stdio transport is not supported yet. Please use 'streamable-http' (recommended) or 'sse' transport instead. See https://docs.heylua.ai/overview/mcp-servers for migration guide.`);
26464
+ throw new Error(`stdio transport is not supported. Please use 'streamable-http' (recommended) or 'sse' transport instead. See https://docs.heylua.ai/overview/mcp-servers for migration guide.`);
25662
26465
  }
25663
26466
  if ((config.transport === "sse" || config.transport === "streamable-http") && !config.url) {
25664
26467
  throw new Error(`URL is required for ${config.transport} transport`);
@@ -26774,7 +27577,14 @@ var Agents = {
26774
27577
  const { getAgentsInstance: getAgentsInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
26775
27578
  const agents = await getAgentsInstance2();
26776
27579
  return agents.superviseForSandbox(op, targetAgentId, args);
26777
- })
27580
+ }),
27581
+ jobs: /* @__PURE__ */ __name((agentId2) => ({
27582
+ register: /* @__PURE__ */ __name(async (input) => {
27583
+ const { getAgentsInstance: getAgentsInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
27584
+ const agents = await getAgentsInstance2();
27585
+ return agents.registerJobForSandbox(agentId2, input);
27586
+ }, "register")
27587
+ }), "jobs")
26778
27588
  };
26779
27589
  var Voice = {
26780
27590
  async call(input) {