lua-cli 3.44.0 → 3.46.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,12 +157,112 @@ 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);
164
165
  }
166
+ function isSupervisionWatchdogOp(op) {
167
+ return typeof op === "string" && Object.prototype.hasOwnProperty.call(SUPERVISION_WATCHDOG_OPS, op);
168
+ }
169
+ function isSupervisionRollbackRefusalReason(v) {
170
+ return typeof v === "string" && Object.prototype.hasOwnProperty.call(SUPERVISION_ROLLBACK_REFUSAL_CODES, v);
171
+ }
172
+ function supervisionRollbackTargetRefusal(target, expectActive, window) {
173
+ if (target.status !== "superseded" || !target.promotedAt || target.compensationFailed === true) {
174
+ return {
175
+ reason: "never_active",
176
+ message: `Version ${target.version} was never fully the active version (status ${target.status ?? "unknown"})`
177
+ };
178
+ }
179
+ if (typeof expectActive !== "number" || !(target.version < expectActive)) {
180
+ return {
181
+ reason: "not_older",
182
+ message: `Version ${target.version} is not older than the active version ${expectActive ?? "none"}`
183
+ };
184
+ }
185
+ if (window) {
186
+ if (target.supersededVia === "rollback" || target.promotedVia === "rollback") {
187
+ return {
188
+ reason: "after_rollback",
189
+ message: `Version ${target.version} was retired or restored by a rollback`
190
+ };
191
+ }
192
+ if (target.supersededVia !== "promote" && target.supersededVia !== "scoped") {
193
+ return {
194
+ reason: "not_in_lineage",
195
+ message: `Version ${target.version} has no forward-promote history`
196
+ };
197
+ }
198
+ const ended = target.supersededAt ? new Date(target.supersededAt).getTime() : NaN;
199
+ if (!Number.isFinite(ended) || ended < window.now - window.windowMs) {
200
+ return {
201
+ reason: "too_old",
202
+ message: `Version ${target.version} was last active outside the ${Math.round(window.windowMs / 864e5)}-day window`
203
+ };
204
+ }
205
+ }
206
+ return null;
207
+ }
208
+ function supervisionRollbackRefusal(input) {
209
+ const { target, active, lineage, expectActive, windowMs, now } = input;
210
+ const pre = supervisionRollbackTargetRefusal(target, expectActive);
211
+ if (pre) return pre;
212
+ if (!active || active.version !== expectActive) {
213
+ return {
214
+ reason: "not_older",
215
+ message: `Version ${expectActive ?? "none"} is not the active version`
216
+ };
217
+ }
218
+ if (active.promotedVia === "rollback") {
219
+ return {
220
+ reason: "after_rollback",
221
+ message: `The active version ${active.version} was restored by a rollback; a watchdog does not roll back twice in a row`
222
+ };
223
+ }
224
+ let previous = active;
225
+ for (const step3 of lineage.slice(0, SUPERVISION_ROLLBACK_LINEAGE_MAX)) {
226
+ const label = `version ${step3.version}`;
227
+ if (step3.supersededVia === "rollback" || step3.promotedVia === "rollback") {
228
+ return {
229
+ reason: "after_rollback",
230
+ message: `The rollback lineage crosses ${label}, which a rollback retired or restored`
231
+ };
232
+ }
233
+ if (step3.supersededVia !== "promote" && step3.supersededVia !== "scoped") {
234
+ return {
235
+ reason: "not_in_lineage",
236
+ message: `The rollback lineage stops at ${label} (no forward-promote history)`
237
+ };
238
+ }
239
+ if (step3.compensationFailed === true || step3.status !== "superseded" || !step3.promotedAt) {
240
+ return {
241
+ reason: "not_in_lineage",
242
+ message: `The rollback lineage stops at ${label} (not fully served)`
243
+ };
244
+ }
245
+ if (!(step3.version < previous.version)) {
246
+ return {
247
+ reason: "after_backward_promote",
248
+ message: `Version ${previous.version} was promoted BACK over ${label}; a watchdog never reaches behind that`
249
+ };
250
+ }
251
+ const ended = step3.supersededAt ? new Date(step3.supersededAt).getTime() : NaN;
252
+ if (!Number.isFinite(ended) || ended < now - windowMs) {
253
+ return {
254
+ reason: "too_old",
255
+ message: `The rollback lineage reaches ${label}, last active outside the ${Math.round(windowMs / 864e5)}-day window`
256
+ };
257
+ }
258
+ if (step3.version === target.version && (!target.id || !step3.id || step3.id === target.id)) return null;
259
+ previous = step3;
260
+ }
261
+ return {
262
+ reason: "not_in_lineage",
263
+ message: `Version ${target.version} is not in the active version's recent forward-promote lineage`
264
+ };
265
+ }
165
266
  function isUntargetedSupervisionOp(op) {
166
267
  return typeof op === "string" && SUPERVISION_UNTARGETED_OPS.includes(op);
167
268
  }
@@ -751,9 +852,9 @@ function isAgentConnectionBindingLoosening(previous, next) {
751
852
  function isAgentConnectionMountMode(value3) {
752
853
  return typeof value3 === "string" && AGENT_CONNECTION_MOUNT_MODES.includes(value3);
753
854
  }
754
- function agentConnectionBindingFor(bindings, agentId) {
755
- if (!Array.isArray(bindings) || !agentId) return void 0;
756
- 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);
757
858
  }
758
859
  function agentConnectionBindingRefusal(binding, operation) {
759
860
  if (binding === void 0 || binding === null) return null;
@@ -1036,8 +1137,8 @@ function describeConnectionRequest(input) {
1036
1137
  return `Something went wrong connecting ${what}. Ask ${who} to try again with a new request.`;
1037
1138
  }
1038
1139
  }
1039
- function operationDailyCapKey(agentId, connectionId, currency, utcDay) {
1040
- return `opcap:${agentId}:${connectionId}:${currency.toUpperCase()}:${utcDay}`;
1140
+ function operationDailyCapKey(agentId2, connectionId, currency, utcDay) {
1141
+ return `opcap:${agentId2}:${connectionId}:${currency.toUpperCase()}:${utcDay}`;
1041
1142
  }
1042
1143
  function isPlainObject(value3) {
1043
1144
  return typeof value3 === "object" && value3 !== null && !Array.isArray(value3);
@@ -1063,7 +1164,7 @@ function parseCapAmount(value3) {
1063
1164
  if (typeof value3 !== "number" || !Number.isFinite(value3) || value3 < 0) return null;
1064
1165
  return value3;
1065
1166
  }
1066
- function parseAgentConnectionOperationLimits(agentId, value3) {
1167
+ function parseAgentConnectionOperationLimits(agentId2, value3) {
1067
1168
  if (!isPlainObject(value3)) return {
1068
1169
  ok: false,
1069
1170
  error: "limits must be an object"
@@ -1076,7 +1177,7 @@ function parseAgentConnectionOperationLimits(agentId, value3) {
1076
1177
  };
1077
1178
  }
1078
1179
  const limits = {
1079
- agentId
1180
+ agentId: agentId2
1080
1181
  };
1081
1182
  if (value3.caps !== void 0 && value3.caps !== null) {
1082
1183
  const caps = value3.caps;
@@ -1162,17 +1263,17 @@ function parseAgentConnectionOperationLimits(agentId, value3) {
1162
1263
  limits
1163
1264
  };
1164
1265
  }
1165
- function findAgentConnectionOperationLimits(stored, agentId) {
1166
- 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;
1167
1268
  if (!Array.isArray(stored)) return {
1168
- agentId,
1269
+ agentId: agentId2,
1169
1270
  unreadable: true
1170
1271
  };
1171
- const entry = stored.find((row) => isPlainObject(row) && row.agentId === agentId);
1272
+ const entry = stored.find((row) => isPlainObject(row) && row.agentId === agentId2);
1172
1273
  if (!entry) return void 0;
1173
- const parsed = parseAgentConnectionOperationLimits(agentId, entry);
1274
+ const parsed = parseAgentConnectionOperationLimits(agentId2, entry);
1174
1275
  return parsed.ok ? parsed.limits : {
1175
- agentId,
1276
+ agentId: agentId2,
1176
1277
  unreadable: true
1177
1278
  };
1178
1279
  }
@@ -1684,9 +1785,9 @@ function isEvalReservedDoubleId(double) {
1684
1785
  function evalCaseThreadId(runId, caseId) {
1685
1786
  return `evalrun:${runId}:${caseId}`;
1686
1787
  }
1687
- function evalMonthlyCapKey(agentId, at = /* @__PURE__ */ new Date()) {
1788
+ function evalMonthlyCapKey(agentId2, at = /* @__PURE__ */ new Date()) {
1688
1789
  const yyyymm = `${at.getUTCFullYear()}${String(at.getUTCMonth() + 1).padStart(2, "0")}`;
1689
- return `evalcap:${agentId}:${yyyymm}`;
1790
+ return `evalcap:${agentId2}:${yyyymm}`;
1690
1791
  }
1691
1792
  function isUnprovenUserSite(site) {
1692
1793
  return typeof site === "string" && (site === "job" || site === "workflow" || site.startsWith("workflow-"));
@@ -1755,8 +1856,8 @@ function hasFormatCharacters(text) {
1755
1856
  function normalizedHandoverName(name) {
1756
1857
  return oneLine(name.normalize("NFKC")).toLowerCase();
1757
1858
  }
1758
- function handoverAgentIdSuffix(agentId) {
1759
- return agentId.slice(-6);
1859
+ function handoverAgentIdSuffix(agentId2) {
1860
+ return agentId2.slice(-6);
1760
1861
  }
1761
1862
  function parseConnectionHandoverApprovalPayload(payload) {
1762
1863
  if (!payload || typeof payload !== "object" || Array.isArray(payload)) return null;
@@ -2048,11 +2149,11 @@ function parseThreadFollowUpInput(input) {
2048
2149
  } : {}
2049
2150
  };
2050
2151
  }
2051
- function threadFollowUpRateKeys(agentId, threadId, nowMs) {
2152
+ function threadFollowUpRateKeys(agentId2, threadId, nowMs) {
2052
2153
  const hour = Math.floor(nowMs / 36e5);
2053
2154
  return {
2054
- perThread: `thread-followup:${agentId}:${threadId}:${hour}`,
2055
- perAgent: `thread-followup:${agentId}:${hour}`
2155
+ perThread: `thread-followup:${agentId2}:${threadId}:${hour}`,
2156
+ perAgent: `thread-followup:${agentId2}:${hour}`
2056
2157
  };
2057
2158
  }
2058
2159
  function progressFractionToPercent(fraction) {
@@ -2462,6 +2563,19 @@ function resolveSlackReactionName(value3) {
2462
2563
  }
2463
2564
  return slackEmojiName(trimmed);
2464
2565
  }
2566
+ function threadScopingSetting(type) {
2567
+ const noun = THREAD_SCOPING_NOUN[type];
2568
+ return {
2569
+ key: `${type}.threadScoping`,
2570
+ group: "conversations",
2571
+ label: `One conversation per ${noun}`,
2572
+ help: `Each ${noun} is its own conversation with its own history.`,
2573
+ effect: "Off: every message from the same person shares one conversation.",
2574
+ type: "boolean",
2575
+ default: false,
2576
+ confirm: "Changing this starts fresh conversations for ones that are already open. Earlier history isn't carried over."
2577
+ };
2578
+ }
2465
2579
  function takeoverSettings(type) {
2466
2580
  const variants = type === "email" ? [
2467
2581
  "ses"
@@ -2817,13 +2931,13 @@ function channelSettingsGroups(channel, config) {
2817
2931
  const groups = [];
2818
2932
  for (const def of channelSettingDefinitions(channel, config)) {
2819
2933
  const { tunableDefault: _tunable, ...shown } = def;
2820
- const unavailable3 = channelSettingUnavailable(channel, def);
2934
+ const unavailable2 = channelSettingUnavailable(channel, def);
2821
2935
  const view = {
2822
2936
  ...shown,
2823
2937
  ...effectiveChannelSetting(channel, def),
2824
2938
  resettable: channelSettingResettable(def),
2825
- ...unavailable3 && {
2826
- unavailable: unavailable3
2939
+ ...unavailable2 && {
2940
+ unavailable: unavailable2
2827
2941
  }
2828
2942
  };
2829
2943
  const group = groups.find((candidate) => candidate.key === def.group);
@@ -4435,6 +4549,9 @@ function workflowOccurrenceId(lineageId, stepId) {
4435
4549
  function workflowOrgSlotKey(orgId, kind) {
4436
4550
  return `wf:org:${orgId}:${kind}`;
4437
4551
  }
4552
+ function isWorkflowAgentAppConnectionId(id2) {
4553
+ return typeof id2 === "string" && id2.startsWith(WORKFLOW_AGENT_APP_CONNECTION_PREFIX) && /^[A-Za-z0-9_-]{1,128}$/.test(id2);
4554
+ }
4438
4555
  function workflowJobModelSourceLabel(source) {
4439
4556
  return WORKFLOW_JOB_MODEL_SOURCE_LABELS[source];
4440
4557
  }
@@ -4615,8 +4732,8 @@ function scheduleHealthView(health, state3) {
4615
4732
  } : {}
4616
4733
  };
4617
4734
  }
4618
- function scheduleHealthSourceId(agentId, jobId) {
4619
- return `schedule-health:${agentId}:${jobId}`;
4735
+ function scheduleHealthSourceId(agentId2, jobId) {
4736
+ return `schedule-health:${agentId2}:${jobId}`;
4620
4737
  }
4621
4738
  function workflowGoalJudgeKind(judge) {
4622
4739
  return judge && typeof judge === "object" && judge.predicate !== void 0 ? "predicate" : "agent";
@@ -5285,7 +5402,7 @@ function evidenceDays(from, to) {
5285
5402
  return out;
5286
5403
  }
5287
5404
  function summarizeEvidence(input) {
5288
- const { agentId, from, to } = input;
5405
+ const { agentId: agentId2, from, to } = input;
5289
5406
  const windowDays = evidenceDays(from, to);
5290
5407
  const readable = /* @__PURE__ */ __name3((s) => s === "ok" || s === "empty", "readable");
5291
5408
  const covered = /* @__PURE__ */ __name3((d) => readable(d.sources?.messages) && readable(d.sources?.analyses), "covered");
@@ -5359,7 +5476,7 @@ function summarizeEvidence(input) {
5359
5476
  const short = wordRows.reduce((a, h) => a + h.short, 0);
5360
5477
  const long = wordRows.reduce((a, h) => a + h.long, 0);
5361
5478
  return {
5362
- agentId,
5479
+ agentId: agentId2,
5363
5480
  window: {
5364
5481
  from,
5365
5482
  to,
@@ -5917,7 +6034,7 @@ function classifyConnectionOperation(op) {
5917
6034
  return NOT_SEND;
5918
6035
  }
5919
6036
  function connectionSendPolicyIsActive(policy) {
5920
- return Boolean(policy) && (policy.allowSend === false || Array.isArray(policy.recipientAllowlist));
6037
+ return !!policy && (policy.allowSend === false || Array.isArray(policy.recipientAllowlist));
5921
6038
  }
5922
6039
  function allowlistAdmits(entries, email) {
5923
6040
  const domain = email.slice(email.lastIndexOf("@") + 1);
@@ -5947,8 +6064,9 @@ function evaluateConnectionSendPolicy(policy, op) {
5947
6064
  classification
5948
6065
  };
5949
6066
  }
5950
- if (Array.isArray(policy.recipientAllowlist)) {
5951
- const denied = classification.recipients.filter((email) => !allowlistAdmits(policy.recipientAllowlist, email));
6067
+ const allowlist = policy.recipientAllowlist;
6068
+ if (Array.isArray(allowlist)) {
6069
+ const denied = classification.recipients.filter((email) => !allowlistAdmits(allowlist, email));
5952
6070
  if (denied.length > 0 || classification.recipientsUnknown) {
5953
6071
  return {
5954
6072
  allowed: false,
@@ -5990,7 +6108,111 @@ function isPaymentRequiredChatErrorEnvelope(data) {
5990
6108
  if (d.type !== "error") return false;
5991
6109
  return d.textDelta === BILLING_REJECTION_TEXT_CREDITS || d.textDelta === BILLING_REJECTION_TEXT_SEAT || d.textDelta === BILLING_REJECTION_TEXT_USER_QUOTA;
5992
6110
  }
5993
- 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_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, 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_JOB_MODEL_SOURCE_LABELS, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, 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;
6111
+ function isCustomMcpConnectionId(id2) {
6112
+ return typeof id2 === "string" && id2.startsWith(CUSTOM_MCP_CONNECTION_ID_PREFIX);
6113
+ }
6114
+ function isConnectionBackedMcpSource(source) {
6115
+ return typeof source === "string" && CONNECTION_BACKED_MCP_SOURCES.includes(source);
6116
+ }
6117
+ function newCustomMcpReferenceId() {
6118
+ const bytes = globalThis.crypto.getRandomValues(new Uint8Array(6));
6119
+ return `mcpx_${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
6120
+ }
6121
+ function customMcpWorkflowKey(displayName) {
6122
+ const slug = displayName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
6123
+ if (!slug) return `s-${fnv1a32(displayName.trim())}`;
6124
+ return (/^[a-z]/.test(slug) ? slug : `s-${slug}`).slice(0, WORKFLOW_KEY_MAX_LENGTH);
6125
+ }
6126
+ function fnv1a32(value3) {
6127
+ let hash = 2166136261;
6128
+ for (const char of value3) {
6129
+ hash ^= char.codePointAt(0) ?? 0;
6130
+ hash = Math.imul(hash, 16777619) >>> 0;
6131
+ }
6132
+ return hash.toString(16).padStart(8, "0");
6133
+ }
6134
+ function addCaseDuplicateIssues(names, ctx, path3) {
6135
+ const seen = /* @__PURE__ */ new Set();
6136
+ for (const name of names) {
6137
+ const lower2 = name.toLowerCase();
6138
+ if (seen.has(lower2)) {
6139
+ ctx.addIssue({
6140
+ code: z5.ZodIssueCode.custom,
6141
+ path: path3,
6142
+ message: `Header "${name}" is listed twice`
6143
+ });
6144
+ }
6145
+ seen.add(lower2);
6146
+ }
6147
+ }
6148
+ function toCustomMcpToolSnapshot(tools) {
6149
+ const snapshot = [];
6150
+ const seen = /* @__PURE__ */ new Set();
6151
+ for (const tool of tools) {
6152
+ if (snapshot.length >= CUSTOM_MCP_MAX_TOOLS) break;
6153
+ const name = tool.name;
6154
+ if (typeof name !== "string" || !name || name.length > CUSTOM_MCP_TOOL_NAME_MAX_LENGTH || seen.has(name)) continue;
6155
+ seen.add(name);
6156
+ snapshot.push({
6157
+ name,
6158
+ ...typeof tool.title === "string" && tool.title ? {
6159
+ title: tool.title.slice(0, CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH)
6160
+ } : {},
6161
+ ...typeof tool.description === "string" && tool.description ? {
6162
+ description: tool.description.slice(0, CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH)
6163
+ } : {}
6164
+ });
6165
+ }
6166
+ return snapshot;
6167
+ }
6168
+ function customMcpRuntimeToolFilter(selection) {
6169
+ return selection.allowAll ? void 0 : {
6170
+ allow: [
6171
+ ...selection.enabled
6172
+ ]
6173
+ };
6174
+ }
6175
+ function createBody(extra) {
6176
+ return z5.discriminatedUnion("authKind", [
6177
+ z5.object({
6178
+ authKind: z5.literal("none"),
6179
+ ...createFields,
6180
+ ...extra
6181
+ }).strict(),
6182
+ z5.object({
6183
+ authKind: z5.literal("headers"),
6184
+ headers: customMcpHeadersSchema.refine((headers) => Object.keys(headers).length > 0, "Add a header"),
6185
+ ...createFields,
6186
+ ...extra
6187
+ }).strict()
6188
+ ]);
6189
+ }
6190
+ function startBody(extra) {
6191
+ return z5.union([
6192
+ z5.object({
6193
+ url: customMcpUrlInputSchema,
6194
+ displayName: customMcpDisplayNameSchema,
6195
+ ...startFields,
6196
+ ...extra
6197
+ }).strict(),
6198
+ /** Sign in again. `url` only after `REAUTH_REQUIRED`; otherwise the stored URL is used. */
6199
+ z5.object({
6200
+ targetConnectionId: customMcpConnectionIdSchema,
6201
+ url: customMcpUrlInputSchema.optional(),
6202
+ ...startFields
6203
+ }).strict()
6204
+ ]);
6205
+ }
6206
+ function maskMcpServerHeaders(server) {
6207
+ const { headers, ...rest } = server;
6208
+ const headerNames = Object.keys(headers ?? {});
6209
+ return {
6210
+ ...rest,
6211
+ headerNames,
6212
+ headersSet: headerNames.length > 0
6213
+ };
6214
+ }
6215
+ 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, 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;
5994
6216
  var init_dist = __esm({
5995
6217
  "../shared-types/dist/index.mjs"() {
5996
6218
  "use strict";
@@ -6206,7 +6428,27 @@ var init_dist = __esm({
6206
6428
  * agentId }`) to its env. `act`, on a turn whose platform-picked user is the target's owner, never overwriting a
6207
6429
  * key (`LUA_SECRET_ATTACH_EXISTING_ENABLED`).
6208
6430
  */
6209
- "secrets.attach": "act"
6431
+ "secrets.attach": "act",
6432
+ /**
6433
+ * SV (LUA-1080) — `Agents.deployed(id)`: what the target serves RIGHT NOW, read from each primitive's live pointer
6434
+ * (skills with their tools, the published persona, pre/postprocessors), with version ids comparable to an agent
6435
+ * version snapshot. Works whether or not the target has a promoted agent version. Metadata and hashes only.
6436
+ */
6437
+ "primitives.deployed": "observe",
6438
+ // [WD]
6439
+ /**
6440
+ * WD (watchdog grant) — `Agents.versions(id).rollback(version, { expectActive })`: restore a version of the target
6441
+ * that was ACTIVE before, is OLDER than the active one and was active within the last 7 days. CAS on the active
6442
+ * version; only from a workflow step the watchdog grant names. Held only by a watchdog grant.
6443
+ */
6444
+ "versions.rollback": "rollback",
6445
+ // [JR]
6446
+ /**
6447
+ * JR (BAC-2011) — `Agents.jobs(id).register({ versionId, jobId })`: register a job that is pinned in a STAGED version of
6448
+ * the target (`snapshot.jobs[]`) so the promote activates and schedules it. Mongo-only marker write; EventBridge stays
6449
+ * on the post-promote reconcile. Release-class: needs `register-job` AND `release` on the grant, from a signed step.
6450
+ */
6451
+ "jobs.register": "register-job"
6210
6452
  };
6211
6453
  __name(isSupervisionOp, "isSupervisionOp");
6212
6454
  __name3(isSupervisionOp, "isSupervisionOp");
@@ -6384,8 +6626,71 @@ var init_dist = __esm({
6384
6626
  gate: "act",
6385
6627
  targeted: true,
6386
6628
  item: "SV"
6629
+ },
6630
+ /** SV (LUA-1080) — `Agents.deployed(id)`: the target's deployed primitives (live pointers, no agent version needed). */
6631
+ "primitives.deployed": {
6632
+ gate: "observe",
6633
+ targeted: true,
6634
+ item: "SV"
6635
+ },
6636
+ /** WD — `Agents.versions(id).rollback(version, { expectActive })` (watchdog grant only). */
6637
+ "versions.rollback": {
6638
+ gate: "rollback",
6639
+ targeted: true,
6640
+ item: "WD"
6641
+ },
6642
+ /** JR (BAC-2011) — `Agents.jobs(id).register({ versionId, jobId })`: a job pinned in a STAGED version (`register-job`). */
6643
+ "jobs.register": {
6644
+ gate: "register-job",
6645
+ targeted: true,
6646
+ item: "JR"
6387
6647
  }
6388
6648
  };
6649
+ SUPERVISION_WATCHDOG_OPS = {
6650
+ logs: "observe",
6651
+ "runs.list": "observe",
6652
+ "runs.get": "observe",
6653
+ "data.get": "observe",
6654
+ "data.query": "observe",
6655
+ "versions.list": "observe",
6656
+ "versions.get": "observe",
6657
+ "versions.diff": "observe",
6658
+ "versions.rollback": "rollback"
6659
+ };
6660
+ __name(isSupervisionWatchdogOp, "isSupervisionWatchdogOp");
6661
+ __name3(isSupervisionWatchdogOp, "isSupervisionWatchdogOp");
6662
+ SUPERVISION_WATCHDOG_ERRORS = {
6663
+ /** A watchdog holder called an op outside {@link SUPERVISION_WATCHDOG_OPS}. */
6664
+ OP_REFUSED: "supervision_watchdog_op_refused",
6665
+ /** See {@link SupervisionRollbackRefusalReason}. */
6666
+ ROLLBACK_NEVER_ACTIVE: "supervision_rollback_never_active",
6667
+ ROLLBACK_NOT_OLDER: "supervision_rollback_not_older",
6668
+ ROLLBACK_NOT_IN_LINEAGE: "supervision_rollback_not_in_lineage",
6669
+ ROLLBACK_AFTER_ROLLBACK: "supervision_rollback_after_rollback",
6670
+ ROLLBACK_AFTER_BACKWARD_PROMOTE: "supervision_rollback_after_backward_promote",
6671
+ ROLLBACK_TOO_OLD: "supervision_rollback_too_old",
6672
+ /** `expectActive` is not the active version (CAS). */
6673
+ ROLLBACK_CONFLICT: "supervision_rollback_conflict",
6674
+ /** The promote failed part-way and its compensation restored the previous active version. */
6675
+ ROLLBACK_INCOMPLETE: "supervision_rollback_incomplete",
6676
+ /** The promote failed part-way AND its compensation failed: the Agents DB may have moved (manual triage). */
6677
+ ROLLBACK_INCOMPLETE_UNCOMPENSATED: "supervision_rollback_incomplete_uncompensated"
6678
+ };
6679
+ SUPERVISION_ROLLBACK_REFUSAL_CODES = {
6680
+ never_active: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_NEVER_ACTIVE,
6681
+ not_older: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_NOT_OLDER,
6682
+ not_in_lineage: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_NOT_IN_LINEAGE,
6683
+ after_rollback: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_AFTER_ROLLBACK,
6684
+ after_backward_promote: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_AFTER_BACKWARD_PROMOTE,
6685
+ too_old: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_TOO_OLD
6686
+ };
6687
+ __name(isSupervisionRollbackRefusalReason, "isSupervisionRollbackRefusalReason");
6688
+ __name3(isSupervisionRollbackRefusalReason, "isSupervisionRollbackRefusalReason");
6689
+ SUPERVISION_ROLLBACK_LINEAGE_MAX = 25;
6690
+ __name(supervisionRollbackTargetRefusal, "supervisionRollbackTargetRefusal");
6691
+ __name3(supervisionRollbackTargetRefusal, "supervisionRollbackTargetRefusal");
6692
+ __name(supervisionRollbackRefusal, "supervisionRollbackRefusal");
6693
+ __name3(supervisionRollbackRefusal, "supervisionRollbackRefusal");
6389
6694
  SUPERVISION_UNTARGETED_OPS = [
6390
6695
  "agents.list",
6391
6696
  ...Object.entries(SUPERVISION_OPS_WAVE2).filter(([, contract]) => !contract.targeted).map(([op]) => op)
@@ -6821,7 +7126,9 @@ var init_dist = __esm({
6821
7126
  /** `secrets.attach` would set an env key the agent already has: never overwritten (remove or rotate it first). */
6822
7127
  KEY_EXISTS: "secret_key_exists",
6823
7128
  /** A request held for an existing agent submitted on the public token page: its owner submits it signed in. */
6824
- OWNER_SUBMIT_REQUIRED: "secret_submit_requires_owner"
7129
+ OWNER_SUBMIT_REQUIRED: "secret_submit_requires_owner",
7130
+ /** LUA-1079 — `requestSecret` with `pendingFor` on a client that did not declare the pending card capability. */
7131
+ PENDING_CARD_UNSUPPORTED: "secret_pending_card_unsupported"
6825
7132
  };
6826
7133
  SECRET_OUTCOME_STATUSES = [
6827
7134
  ...SECRET_TEST_RESULTS,
@@ -7546,6 +7853,13 @@ var init_dist = __esm({
7546
7853
  welcome: "Welcome and Home page",
7547
7854
  takeover: "Human takeover"
7548
7855
  };
7856
+ THREAD_SCOPING_NOUN = {
7857
+ front: "Front conversation",
7858
+ messagebird: "MessageBird conversation",
7859
+ imessage: "iMessage chat"
7860
+ };
7861
+ __name(threadScopingSetting, "threadScopingSetting");
7862
+ __name3(threadScopingSetting, "threadScopingSetting");
7549
7863
  TAKEOVER_CHANNEL_TYPES = [
7550
7864
  "whatsapp",
7551
7865
  "instagram",
@@ -7819,7 +8133,10 @@ var init_dist = __esm({
7819
8133
  CHANNEL_SETTINGS = {
7820
8134
  ...Object.fromEntries(TAKEOVER_CHANNEL_TYPES.map((type) => [
7821
8135
  type,
7822
- type === "email" ? EMAIL_SETTINGS : takeoverSettings(type)
8136
+ type === "email" ? EMAIL_SETTINGS : type === "front" || type === "messagebird" || type === "imessage" ? [
8137
+ ...takeoverSettings(type),
8138
+ threadScopingSetting(type)
8139
+ ] : takeoverSettings(type)
7823
8140
  ])),
7824
8141
  slack: SLACK_SETTINGS
7825
8142
  };
@@ -9566,6 +9883,9 @@ This text is who you are for this person. As you learn them, their name, their w
9566
9883
  __name(workflowOrgSlotKey, "workflowOrgSlotKey");
9567
9884
  __name3(workflowOrgSlotKey, "workflowOrgSlotKey");
9568
9885
  WORKFLOW_CONNECTION_KEY_RE = /^[a-z][a-z0-9_-]{0,63}$/;
9886
+ WORKFLOW_AGENT_APP_CONNECTION_PREFIX = "agentapp_";
9887
+ __name(isWorkflowAgentAppConnectionId, "isWorkflowAgentAppConnectionId");
9888
+ __name3(isWorkflowAgentAppConnectionId, "isWorkflowAgentAppConnectionId");
9569
9889
  WORKFLOW_JOB_MODEL_SOURCE_LABELS = {
9570
9890
  stamp: "lease stamp",
9571
9891
  initData: "run input",
@@ -9591,6 +9911,7 @@ This text is who you are for this person. As you learn them, their name, their w
9591
9911
  ...WORKFLOW_RUN_GATE_KINDS
9592
9912
  ];
9593
9913
  WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES = 64 * 1024;
9914
+ WORKFLOW_SIGNAL_NAME_RE = /^[a-zA-Z0-9_.-]{1,64}$/;
9594
9915
  WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS = 168;
9595
9916
  WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES = 256 * 1024;
9596
9917
  SCHEDULE_HEALTH_NOTIFY_CHANNELS = [
@@ -10535,6 +10856,497 @@ listed here; never invent a target.`;
10535
10856
  BILLING_REJECTION_TEXT_USER_QUOTA = "You've reached your monthly usage limit in this workspace. Ask a workspace admin to raise it.";
10536
10857
  __name(isPaymentRequiredChatErrorEnvelope, "isPaymentRequiredChatErrorEnvelope");
10537
10858
  __name3(isPaymentRequiredChatErrorEnvelope, "isPaymentRequiredChatErrorEnvelope");
10859
+ CUSTOM_MCP_CONNECTION_ID_PREFIX = "mcp_";
10860
+ CUSTOM_MCP_SOURCE = "custom";
10861
+ CUSTOM_MCP_TRANSPORT = "streamable-http";
10862
+ 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}$/;
10863
+ __name(isCustomMcpConnectionId, "isCustomMcpConnectionId");
10864
+ __name3(isCustomMcpConnectionId, "isCustomMcpConnectionId");
10865
+ customMcpConnectionIdSchema = z5.string().regex(CUSTOM_MCP_CONNECTION_ID_PATTERN);
10866
+ CONNECTION_BACKED_MCP_SOURCES = [
10867
+ "unifiedto",
10868
+ CUSTOM_MCP_SOURCE
10869
+ ];
10870
+ __name(isConnectionBackedMcpSource, "isConnectionBackedMcpSource");
10871
+ __name3(isConnectionBackedMcpSource, "isConnectionBackedMcpSource");
10872
+ CUSTOM_MCP_REFERENCE_ID_PATTERN = /^mcpx_[0-9a-f]{12}$/;
10873
+ customMcpReferenceIdSchema = z5.string().regex(CUSTOM_MCP_REFERENCE_ID_PATTERN);
10874
+ __name(newCustomMcpReferenceId, "newCustomMcpReferenceId");
10875
+ __name3(newCustomMcpReferenceId, "newCustomMcpReferenceId");
10876
+ CUSTOM_MCP_AUTH_KINDS = [
10877
+ "none",
10878
+ "headers",
10879
+ "oauth"
10880
+ ];
10881
+ customMcpAuthKindSchema = z5.enum(CUSTOM_MCP_AUTH_KINDS);
10882
+ CUSTOM_MCP_OAUTH_REGISTRATIONS = [
10883
+ "cimd",
10884
+ "dcr",
10885
+ "manual"
10886
+ ];
10887
+ customMcpOAuthRegistrationSchema = z5.enum(CUSTOM_MCP_OAUTH_REGISTRATIONS);
10888
+ CUSTOM_MCP_HEALTH_STATES = [
10889
+ "ok",
10890
+ "failing",
10891
+ "needs_sign_in",
10892
+ "auth_rejected"
10893
+ ];
10894
+ customMcpHealthStateSchema = z5.enum(CUSTOM_MCP_HEALTH_STATES);
10895
+ CUSTOM_MCP_FAILURE_STEPS = [
10896
+ "url",
10897
+ "reach",
10898
+ "auth_challenge",
10899
+ "resource_metadata",
10900
+ "authorization_server_metadata",
10901
+ "pkce",
10902
+ "client_registration",
10903
+ "authorize",
10904
+ "token_exchange",
10905
+ "list_tools"
10906
+ ];
10907
+ customMcpFailureStepSchema = z5.enum(CUSTOM_MCP_FAILURE_STEPS);
10908
+ CUSTOM_MCP_CONNECT_STEPS = [
10909
+ "url",
10910
+ "reach",
10911
+ "auth_challenge",
10912
+ "list_tools"
10913
+ ];
10914
+ customMcpConnectStepSchema = z5.enum(CUSTOM_MCP_CONNECT_STEPS);
10915
+ customMcpFailureCodeSchema = z5.string().regex(/^[a-z0-9_]{1,64}$/);
10916
+ WORKFLOW_KEY_MAX_LENGTH = 64;
10917
+ __name(customMcpWorkflowKey, "customMcpWorkflowKey");
10918
+ __name3(customMcpWorkflowKey, "customMcpWorkflowKey");
10919
+ __name(fnv1a32, "fnv1a32");
10920
+ __name3(fnv1a32, "fnv1a32");
10921
+ CUSTOM_MCP_URL_MAX_LENGTH = 2048;
10922
+ CUSTOM_MCP_DISPLAY_NAME_MAX_LENGTH = 120;
10923
+ CUSTOM_MCP_MAX_HEADERS = 20;
10924
+ CUSTOM_MCP_HEADER_NAME_MAX_LENGTH = 128;
10925
+ CUSTOM_MCP_HEADER_VALUE_MAX_LENGTH = 8192;
10926
+ CUSTOM_MCP_MAX_TOOLS = 500;
10927
+ CUSTOM_MCP_TOOL_NAME_MAX_LENGTH = 256;
10928
+ CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH = 1024;
10929
+ CUSTOM_MCP_MIN_TIMEOUT_MS = 1e3;
10930
+ CUSTOM_MCP_MAX_TIMEOUT_MS = 12e4;
10931
+ CUSTOM_MCP_OAUTH_PENDING_TTL_MS = 15 * 6e4;
10932
+ isoDateTime = z5.string().datetime({
10933
+ offset: true
10934
+ });
10935
+ agentId = z5.string().min(1).max(128);
10936
+ nonNegativeInt = z5.number().int().min(0);
10937
+ customMcpUrlInputSchema = z5.string().trim().min(1).max(CUSTOM_MCP_URL_MAX_LENGTH);
10938
+ customMcpDisplayNameSchema = z5.string().trim().min(1).max(CUSTOM_MCP_DISPLAY_NAME_MAX_LENGTH);
10939
+ customMcpTimeoutSchema = z5.number().int().min(CUSTOM_MCP_MIN_TIMEOUT_MS).max(CUSTOM_MCP_MAX_TIMEOUT_MS);
10940
+ CUSTOM_MCP_RESERVED_HEADER_NAMES = [
10941
+ "accept",
10942
+ "connection",
10943
+ "content-length",
10944
+ "content-type",
10945
+ "host",
10946
+ "keep-alive",
10947
+ "last-event-id",
10948
+ "mcp-protocol-version",
10949
+ "mcp-session-id",
10950
+ "proxy-authorization",
10951
+ "te",
10952
+ "trailer",
10953
+ "transfer-encoding",
10954
+ "upgrade"
10955
+ ];
10956
+ HEADER_NAME = /^[A-Za-z][A-Za-z0-9!#$%&'*+.^_`|~-]*$/;
10957
+ HEADER_VALUE_FORBIDDEN = /[\u0000-\u0008\u000a-\u001f\u007f]/;
10958
+ 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");
10959
+ 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");
10960
+ __name(addCaseDuplicateIssues, "addCaseDuplicateIssues");
10961
+ __name3(addCaseDuplicateIssues, "addCaseDuplicateIssues");
10962
+ customMcpHeadersSchema = z5.record(customMcpHeaderNameSchema, headerValue).superRefine((headers, ctx) => {
10963
+ const names = Object.keys(headers);
10964
+ if (names.length > CUSTOM_MCP_MAX_HEADERS) {
10965
+ ctx.addIssue({
10966
+ code: z5.ZodIssueCode.custom,
10967
+ message: `At most ${CUSTOM_MCP_MAX_HEADERS} headers`
10968
+ });
10969
+ }
10970
+ addCaseDuplicateIssues(names, ctx, []);
10971
+ });
10972
+ customMcpHeadersPatchSchema = z5.object({
10973
+ set: customMcpHeadersSchema.optional(),
10974
+ remove: z5.array(customMcpHeaderNameSchema).max(CUSTOM_MCP_MAX_HEADERS).optional()
10975
+ }).strict().superRefine((patch, ctx) => {
10976
+ const set = Object.keys(patch.set ?? {});
10977
+ const remove = patch.remove ?? [];
10978
+ if (!set.length && !remove.length) {
10979
+ ctx.addIssue({
10980
+ code: z5.ZodIssueCode.custom,
10981
+ message: "Nothing to change"
10982
+ });
10983
+ }
10984
+ addCaseDuplicateIssues(remove, ctx, [
10985
+ "remove"
10986
+ ]);
10987
+ const setLower = new Set(set.map((name) => name.toLowerCase()));
10988
+ for (const name of remove) {
10989
+ if (setLower.has(name.toLowerCase())) {
10990
+ ctx.addIssue({
10991
+ code: z5.ZodIssueCode.custom,
10992
+ path: [
10993
+ "remove"
10994
+ ],
10995
+ message: `Header "${name}" is both set and removed`
10996
+ });
10997
+ }
10998
+ }
10999
+ });
11000
+ customMcpToolNameSchema = z5.string().min(1).max(CUSTOM_MCP_TOOL_NAME_MAX_LENGTH);
11001
+ customMcpToolSchema = z5.object({
11002
+ name: customMcpToolNameSchema,
11003
+ title: z5.string().max(CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH).optional(),
11004
+ description: z5.string().max(CUSTOM_MCP_TOOL_TEXT_MAX_LENGTH).optional()
11005
+ });
11006
+ customMcpServerInfoSchema = z5.object({
11007
+ name: z5.string().max(CUSTOM_MCP_TOOL_NAME_MAX_LENGTH),
11008
+ version: z5.string().max(128).optional(),
11009
+ title: z5.string().max(CUSTOM_MCP_TOOL_NAME_MAX_LENGTH).optional()
11010
+ });
11011
+ __name(toCustomMcpToolSnapshot, "toCustomMcpToolSnapshot");
11012
+ __name3(toCustomMcpToolSnapshot, "toCustomMcpToolSnapshot");
11013
+ customMcpToolSelectionSchema = z5.object({
11014
+ allowAll: z5.boolean(),
11015
+ enabled: z5.array(customMcpToolNameSchema).max(CUSTOM_MCP_MAX_TOOLS)
11016
+ }).strict().refine((selection) => new Set(selection.enabled).size === selection.enabled.length, {
11017
+ path: [
11018
+ "enabled"
11019
+ ],
11020
+ message: "Tool names must be unique"
11021
+ });
11022
+ __name(customMcpRuntimeToolFilter, "customMcpRuntimeToolFilter");
11023
+ __name3(customMcpRuntimeToolFilter, "customMcpRuntimeToolFilter");
11024
+ customMcpToolsResponseSchema = z5.object({
11025
+ allowAll: z5.boolean(),
11026
+ tools: z5.array(customMcpToolSchema.extend({
11027
+ enabled: z5.boolean()
11028
+ })),
11029
+ serverInfo: customMcpServerInfoSchema.optional(),
11030
+ refreshedAt: isoDateTime.optional()
11031
+ });
11032
+ customMcpFailureSchema = z5.object({
11033
+ step: customMcpFailureStepSchema,
11034
+ code: customMcpFailureCodeSchema,
11035
+ /** Plain words for the person connecting. */
11036
+ message: z5.string().max(500),
11037
+ httpStatus: z5.number().int().min(100).max(599).optional(),
11038
+ referenceId: customMcpReferenceIdSchema
11039
+ });
11040
+ customMcpHealthSchema = z5.object({
11041
+ state: customMcpHealthStateSchema,
11042
+ checkedAt: isoDateTime.optional(),
11043
+ lastOkAt: isoDateTime.optional(),
11044
+ lastFailureAt: isoDateTime.optional(),
11045
+ consecutiveFailures: nonNegativeInt,
11046
+ lastFailure: customMcpFailureSchema.omit({
11047
+ message: true
11048
+ }).optional()
11049
+ });
11050
+ customMcpErrorBodySchema = z5.object({
11051
+ code: z5.string(),
11052
+ message: z5.string(),
11053
+ failure: customMcpFailureSchema.optional(),
11054
+ callbackUrl: z5.string().url().optional(),
11055
+ retryAfterSeconds: z5.number().int().positive().optional()
11056
+ });
11057
+ customMcpConnectionBlockSchema = z5.object({
11058
+ authKind: customMcpAuthKindSchema,
11059
+ /** `URL.host`, port included. */
11060
+ host: z5.string(),
11061
+ /** Host plus a masked path; never the URL. */
11062
+ urlDisplay: z5.string(),
11063
+ /** Names only, for the edit form. Present on `headers` connections. */
11064
+ headerNames: z5.array(z5.string()).optional(),
11065
+ /** The workflow connection key that names this server: {@link customMcpWorkflowKey} of its display name. */
11066
+ workflowKey: z5.string().regex(WORKFLOW_CONNECTION_KEY_RE).optional(),
11067
+ health: customMcpHealthSchema,
11068
+ toolCount: nonNegativeInt,
11069
+ enabledToolCount: nonNegativeInt
11070
+ });
11071
+ customMcpConnectionViewSchema = z5.object({
11072
+ id: customMcpConnectionIdSchema,
11073
+ displayName: z5.string(),
11074
+ ownerType: z5.enum([
11075
+ "user",
11076
+ "agent"
11077
+ ]),
11078
+ agentId: z5.string().optional(),
11079
+ customMcp: customMcpConnectionBlockSchema
11080
+ });
11081
+ customMcpConnectionResponseSchema = z5.object({
11082
+ connection: customMcpConnectionViewSchema
11083
+ });
11084
+ customMcpProbeBodySchema = z5.object({
11085
+ url: customMcpUrlInputSchema,
11086
+ headers: customMcpHeadersSchema.optional()
11087
+ }).strict();
11088
+ customMcpOAuthDiscoverySchema = z5.object({
11089
+ issuer: z5.string().url(),
11090
+ scopes: z5.array(z5.string()),
11091
+ /** `manual_required`: neither CIMD nor DCR; the person registers a client with `callbackUrl`. */
11092
+ registration: z5.enum([
11093
+ "cimd",
11094
+ "dcr",
11095
+ "manual_required"
11096
+ ]),
11097
+ callbackUrl: z5.string().url()
11098
+ });
11099
+ customMcpProbeResponseSchema = z5.discriminatedUnion("outcome", [
11100
+ z5.object({
11101
+ outcome: z5.literal("connected"),
11102
+ authKind: z5.enum([
11103
+ "none",
11104
+ "headers"
11105
+ ]),
11106
+ serverInfo: customMcpServerInfoSchema,
11107
+ tools: z5.array(customMcpToolSchema)
11108
+ }),
11109
+ /** The server challenged and publishes usable OAuth metadata. */
11110
+ z5.object({
11111
+ outcome: z5.literal("sign_in_required"),
11112
+ oauth: customMcpOAuthDiscoverySchema
11113
+ }),
11114
+ /** The server challenged without usable OAuth and no headers were sent. */
11115
+ z5.object({
11116
+ outcome: z5.literal("credentials_required"),
11117
+ httpStatus: z5.number().int()
11118
+ })
11119
+ ]);
11120
+ createFields = {
11121
+ url: customMcpUrlInputSchema,
11122
+ displayName: customMcpDisplayNameSchema,
11123
+ timeout: customMcpTimeoutSchema.optional(),
11124
+ /** Defaults to allow-all. */
11125
+ tools: customMcpToolSelectionSchema.optional()
11126
+ };
11127
+ mountAgentField = {
11128
+ mountAgentId: agentId.optional()
11129
+ };
11130
+ __name(createBody, "createBody");
11131
+ __name3(createBody, "createBody");
11132
+ customMcpCreateAgentBodySchema = createBody({});
11133
+ customMcpCreateUserBodySchema = createBody(mountAgentField);
11134
+ customMcpOAuthClientSchema = z5.object({
11135
+ clientId: z5.string().trim().min(1).max(512),
11136
+ clientSecret: z5.string().min(1).max(2048).optional()
11137
+ }).strict();
11138
+ startFields = {
11139
+ successRedirect: z5.string().max(CUSTOM_MCP_URL_MAX_LENGTH),
11140
+ failureRedirect: z5.string().max(CUSTOM_MCP_URL_MAX_LENGTH),
11141
+ state: z5.string().max(256),
11142
+ client: customMcpOAuthClientSchema.optional()
11143
+ };
11144
+ __name(startBody, "startBody");
11145
+ __name3(startBody, "startBody");
11146
+ customMcpOAuthStartAgentBodySchema = startBody({});
11147
+ customMcpOAuthStartUserBodySchema = startBody(mountAgentField);
11148
+ customMcpOAuthStartResponseSchema = z5.object({
11149
+ authUrl: z5.string().url(),
11150
+ pendingId: z5.string().min(1),
11151
+ expiresAt: isoDateTime,
11152
+ registration: customMcpOAuthRegistrationSchema
11153
+ });
11154
+ nonce = z5.string().regex(/^[A-Za-z0-9_-]{32,128}$/);
11155
+ customMcpOAuthSuccessRedirectQuerySchema = z5.object({
11156
+ state: z5.string(),
11157
+ id: z5.string().min(1),
11158
+ nonce
11159
+ });
11160
+ CUSTOM_MCP_OAUTH_CALLBACK_ERRORS = [
11161
+ "access_denied",
11162
+ "authorize",
11163
+ "token_exchange",
11164
+ "expired"
11165
+ ];
11166
+ customMcpOAuthFailureRedirectQuerySchema = z5.object({
11167
+ state: z5.string(),
11168
+ error: z5.enum(CUSTOM_MCP_OAUTH_CALLBACK_ERRORS),
11169
+ ref: customMcpReferenceIdSchema
11170
+ });
11171
+ customMcpOAuthFinalizeBodySchema = z5.object({
11172
+ pendingId: z5.string().min(1).max(128),
11173
+ nonce,
11174
+ tools: customMcpToolSelectionSchema.optional()
11175
+ }).strict();
11176
+ customMcpCimdDocumentSchema = z5.object({
11177
+ client_id: z5.string().url(),
11178
+ client_name: z5.string(),
11179
+ client_uri: z5.string().url().optional(),
11180
+ logo_uri: z5.string().url().optional(),
11181
+ redirect_uris: z5.array(z5.string().url()).min(1),
11182
+ grant_types: z5.array(z5.enum([
11183
+ "authorization_code",
11184
+ "refresh_token"
11185
+ ])),
11186
+ response_types: z5.array(z5.literal("code")),
11187
+ token_endpoint_auth_method: z5.literal("none")
11188
+ });
11189
+ customMcpPatchBodySchema = z5.object({
11190
+ displayName: customMcpDisplayNameSchema.optional(),
11191
+ url: customMcpUrlInputSchema.optional(),
11192
+ headers: customMcpHeadersPatchSchema.optional(),
11193
+ timeout: customMcpTimeoutSchema.optional()
11194
+ }).strict().refine((body) => Object.values(body).some((value3) => value3 !== void 0), {
11195
+ message: "Nothing to change"
11196
+ });
11197
+ customMcpCredentialRequestSchema = z5.object({
11198
+ mode: z5.enum([
11199
+ "mount",
11200
+ "room_personal"
11201
+ ]),
11202
+ connectionId: customMcpConnectionIdSchema,
11203
+ agentId,
11204
+ /** The server rejected this token version: refresh unless it is already stale. */
11205
+ rejectedTokenVersion: nonNegativeInt.optional()
11206
+ }).strict();
11207
+ customMcpCredentialAuthSchema = z5.discriminatedUnion("kind", [
11208
+ z5.object({
11209
+ kind: z5.literal("none")
11210
+ }),
11211
+ z5.object({
11212
+ kind: z5.literal("headers"),
11213
+ headers: z5.record(z5.string(), z5.string())
11214
+ }),
11215
+ z5.object({
11216
+ kind: z5.literal("oauth"),
11217
+ accessToken: z5.string().min(1),
11218
+ tokenVersion: nonNegativeInt,
11219
+ /** At least {@link CUSTOM_MCP_ACCESS_TOKEN_MIN_REMAINING_MS} away. */
11220
+ expiresAt: isoDateTime
11221
+ })
11222
+ ]);
11223
+ customMcpCredentialResponseSchema = z5.object({
11224
+ connectionId: customMcpConnectionIdSchema,
11225
+ credentialGeneration: nonNegativeInt,
11226
+ url: z5.string().url(),
11227
+ auth: customMcpCredentialAuthSchema
11228
+ });
11229
+ CUSTOM_MCP_CREDENTIAL_ERRORS = {
11230
+ /** 403. Not mounted on this agent, or the room grant is no longer current. */
11231
+ NOT_MOUNTED: "NOT_MOUNTED",
11232
+ /** 404. */
11233
+ NOT_FOUND: "NOT_FOUND",
11234
+ /** 409. Paused by its owner. */
11235
+ PAUSED: "PAUSED",
11236
+ /** 409. The refresh token is gone or was refused; the owner must sign in again. */
11237
+ NEEDS_SIGN_IN: "NEEDS_SIGN_IN",
11238
+ /** 503. The token endpoint failed; retry later. */
11239
+ REFRESH_UNAVAILABLE: "REFRESH_UNAVAILABLE"
11240
+ };
11241
+ customMcpCredentialErrorBodySchema = z5.object({
11242
+ code: z5.nativeEnum(CUSTOM_MCP_CREDENTIAL_ERRORS),
11243
+ message: z5.string()
11244
+ });
11245
+ customMcpHealthReportSchema = z5.object({
11246
+ reports: z5.array(z5.object({
11247
+ connectionId: customMcpConnectionIdSchema,
11248
+ agentId,
11249
+ credentialGeneration: nonNegativeInt,
11250
+ tokenVersion: nonNegativeInt.optional(),
11251
+ outcome: z5.enum([
11252
+ "ok",
11253
+ "failure"
11254
+ ]),
11255
+ failure: z5.object({
11256
+ step: customMcpConnectStepSchema,
11257
+ code: customMcpFailureCodeSchema,
11258
+ httpStatus: z5.number().int().min(100).max(599).optional(),
11259
+ referenceId: customMcpReferenceIdSchema
11260
+ }).strict().optional(),
11261
+ observedAt: isoDateTime
11262
+ }).strict().refine((report) => report.outcome === "failure" === (report.failure !== void 0), {
11263
+ path: [
11264
+ "failure"
11265
+ ],
11266
+ message: "A failure report carries `failure`; an ok report does not"
11267
+ })).min(1).max(50)
11268
+ }).strict();
11269
+ customMcpProbeRequestSchema = z5.object({
11270
+ url: z5.string().url().max(CUSTOM_MCP_URL_MAX_LENGTH),
11271
+ auth: z5.discriminatedUnion("kind", [
11272
+ z5.object({
11273
+ kind: z5.literal("none")
11274
+ }).strict(),
11275
+ z5.object({
11276
+ kind: z5.literal("headers"),
11277
+ headers: customMcpHeadersSchema
11278
+ }).strict(),
11279
+ z5.object({
11280
+ kind: z5.literal("bearer"),
11281
+ accessToken: z5.string().min(1)
11282
+ }).strict()
11283
+ ]),
11284
+ timeout: customMcpTimeoutSchema.optional(),
11285
+ referenceId: customMcpReferenceIdSchema
11286
+ }).strict();
11287
+ customMcpProbeResultSchema = z5.discriminatedUnion("ok", [
11288
+ z5.object({
11289
+ ok: z5.literal(true),
11290
+ serverInfo: customMcpServerInfoSchema,
11291
+ tools: z5.array(customMcpToolSchema).max(CUSTOM_MCP_MAX_TOOLS),
11292
+ protocolVersion: z5.string().optional()
11293
+ }),
11294
+ z5.object({
11295
+ ok: z5.literal(false),
11296
+ step: customMcpConnectStepSchema,
11297
+ code: customMcpFailureCodeSchema,
11298
+ httpStatus: z5.number().int().min(100).max(599).optional(),
11299
+ /** The 401/403 challenge, raw, for lua-api's OAuth discovery. */
11300
+ wwwAuthenticate: z5.string().max(4096).optional()
11301
+ })
11302
+ ]);
11303
+ customMcpOriginUrlSchema = z5.string().url().refine((value3) => {
11304
+ try {
11305
+ const url = new URL(value3);
11306
+ return url.protocol === "https:" && url.pathname === "/" && !url.search && !url.hash && !url.username && !url.password;
11307
+ } catch {
11308
+ return false;
11309
+ }
11310
+ }, "Origin only");
11311
+ customMcpServerProjectionSchema = z5.object({
11312
+ name: z5.string().min(1),
11313
+ runtimeKey: z5.string().min(1),
11314
+ transport: z5.literal(CUSTOM_MCP_TRANSPORT),
11315
+ source: z5.literal(CUSTOM_MCP_SOURCE),
11316
+ url: customMcpOriginUrlSchema,
11317
+ connectionId: customMcpConnectionIdSchema,
11318
+ connectionLabel: z5.string(),
11319
+ /** The connection's owner kind, for the dashboard's "Personal" label. */
11320
+ ownerType: z5.enum([
11321
+ "user",
11322
+ "agent"
11323
+ ]),
11324
+ authKind: customMcpAuthKindSchema,
11325
+ credentialGeneration: nonNegativeInt,
11326
+ tools: z5.object({
11327
+ allow: z5.array(z5.string())
11328
+ }).optional(),
11329
+ timeout: z5.number().int().positive()
11330
+ });
11331
+ customMcpMountUpsertBodySchema = z5.object({
11332
+ source: z5.literal(CUSTOM_MCP_SOURCE),
11333
+ transport: z5.literal(CUSTOM_MCP_TRANSPORT),
11334
+ url: customMcpOriginUrlSchema,
11335
+ connectionId: customMcpConnectionIdSchema,
11336
+ connectionLabel: z5.string(),
11337
+ ownerType: z5.enum([
11338
+ "user",
11339
+ "agent"
11340
+ ]),
11341
+ authKind: customMcpAuthKindSchema,
11342
+ credentialGeneration: nonNegativeInt,
11343
+ tools: z5.object({
11344
+ allow: z5.array(customMcpToolNameSchema).max(CUSTOM_MCP_MAX_TOOLS)
11345
+ }).strict().optional(),
11346
+ timeout: customMcpTimeoutSchema.optional()
11347
+ }).strict();
11348
+ __name(maskMcpServerHeaders, "maskMcpServerHeaders");
11349
+ __name3(maskMcpServerHeaders, "maskMcpServerHeaders");
10538
11350
  }
10539
11351
  });
10540
11352
 
@@ -11195,7 +12007,7 @@ var init_constants = __esm({
11195
12007
  });
11196
12008
 
11197
12009
  // src/services/firebase-session.ts
11198
- import { z as z5 } from "zod";
12010
+ import { z as z6 } from "zod";
11199
12011
  function rejectedRefreshReason(message) {
11200
12012
  const normalised = message.toUpperCase();
11201
12013
  return REJECTED_REFRESH_REASONS.find((reason) => normalised.includes(reason));
@@ -11341,20 +12153,20 @@ var init_firebase_session = __esm({
11341
12153
  this.name = "FirebaseSessionRejectedError";
11342
12154
  }
11343
12155
  };
11344
- customTokenResponseSchema = z5.object({
11345
- idToken: z5.string().min(1),
11346
- refreshToken: z5.string().min(1),
11347
- expiresIn: z5.coerce.number().positive().finite(),
11348
- localId: z5.string().min(1).optional()
12156
+ customTokenResponseSchema = z6.object({
12157
+ idToken: z6.string().min(1),
12158
+ refreshToken: z6.string().min(1),
12159
+ expiresIn: z6.coerce.number().positive().finite(),
12160
+ localId: z6.string().min(1).optional()
11349
12161
  });
11350
- refreshResponseSchema = z5.object({
11351
- id_token: z5.string().min(1),
11352
- refresh_token: z5.string().min(1),
11353
- expires_in: z5.coerce.number().positive().finite(),
11354
- user_id: z5.string().min(1)
12162
+ refreshResponseSchema = z6.object({
12163
+ id_token: z6.string().min(1),
12164
+ refresh_token: z6.string().min(1),
12165
+ expires_in: z6.coerce.number().positive().finite(),
12166
+ user_id: z6.string().min(1)
11355
12167
  });
11356
- firebaseIdTokenPayloadSchema = z5.object({
11357
- sub: z5.string().min(1)
12168
+ firebaseIdTokenPayloadSchema = z6.object({
12169
+ sub: z6.string().min(1)
11358
12170
  });
11359
12171
  __name(requireFirebaseWebApiKey, "requireFirebaseWebApiKey");
11360
12172
  __name(claimsOfFirebaseIdToken, "claimsOfFirebaseIdToken");
@@ -11371,7 +12183,7 @@ var init_firebase_session = __esm({
11371
12183
  import { createHash, randomUUID } from "crypto";
11372
12184
  import { mkdir, open, readFile, rename, rm, stat, unlink, writeFile } from "fs/promises";
11373
12185
  import { join as join3 } from "path";
11374
- import { z as z6 } from "zod";
12186
+ import { z as z7 } from "zod";
11375
12187
  function environmentKey(environment) {
11376
12188
  return createHash("sha256").update(`${environment.apiUrl}
11377
12189
  ${environment.authUrl}
@@ -11388,15 +12200,15 @@ var init_firebase_session_store = __esm({
11388
12200
  "src/services/firebase-session-store.ts"() {
11389
12201
  "use strict";
11390
12202
  init_constants();
11391
- storedFirebaseSessionSchema = z6.object({
11392
- version: z6.literal(1),
11393
- kind: z6.literal("firebase-session"),
11394
- generation: z6.string().min(1),
11395
- refreshToken: z6.string().min(1),
11396
- firebaseUid: z6.string().min(1),
11397
- apiUrl: z6.string().url(),
11398
- authUrl: z6.string().url(),
11399
- firebaseWebApiKey: z6.string().min(1)
12203
+ storedFirebaseSessionSchema = z7.object({
12204
+ version: z7.literal(1),
12205
+ kind: z7.literal("firebase-session"),
12206
+ generation: z7.string().min(1),
12207
+ refreshToken: z7.string().min(1),
12208
+ firebaseUid: z7.string().min(1),
12209
+ apiUrl: z7.string().url(),
12210
+ authUrl: z7.string().url(),
12211
+ firebaseWebApiKey: z7.string().min(1)
11400
12212
  });
11401
12213
  currentFirebaseSessionEnvironment = /* @__PURE__ */ __name(() => ({
11402
12214
  apiUrl: BASE_URLS.API,
@@ -12065,14 +12877,15 @@ var init_http_client = __esm({
12065
12877
  * Performs an HTTP GET request
12066
12878
  * @param url - The relative URL path to request (will be appended to baseUrl)
12067
12879
  * @param headers - Optional HTTP headers to include in the request
12880
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12068
12881
  * @returns Promise resolving to an ApiResponse with typed data
12069
12882
  * @protected
12070
12883
  */
12071
- async httpGet(url, headers) {
12884
+ async httpGet(url, headers, overrides) {
12072
12885
  return this.retryableRequest(this.baseUrl + url, {
12073
12886
  method: "GET",
12074
12887
  headers
12075
- });
12888
+ }, 3, overrides);
12076
12889
  }
12077
12890
  /**
12078
12891
  * Performs an HTTP POST request
@@ -12114,43 +12927,46 @@ var init_http_client = __esm({
12114
12927
  * @param url - The relative URL path to request (will be appended to baseUrl)
12115
12928
  * @param data - Optional request body data (will be JSON stringified)
12116
12929
  * @param headers - Optional HTTP headers to include in the request
12930
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12117
12931
  * @returns Promise resolving to an ApiResponse with typed data
12118
12932
  * @protected
12119
12933
  */
12120
- async httpPut(url, data, headers) {
12934
+ async httpPut(url, data, headers, overrides) {
12121
12935
  return this.retryableRequest(this.baseUrl + url, {
12122
12936
  method: "PUT",
12123
12937
  body: data ? JSON.stringify(data) : void 0,
12124
12938
  headers
12125
- });
12939
+ }, 3, overrides);
12126
12940
  }
12127
12941
  /**
12128
12942
  * Performs an HTTP DELETE request
12129
12943
  * @param url - The relative URL path to request (will be appended to baseUrl)
12130
12944
  * @param headers - Optional HTTP headers to include in the request
12945
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12131
12946
  * @returns Promise resolving to an ApiResponse with typed data
12132
12947
  * @protected
12133
12948
  */
12134
- async httpDelete(url, headers) {
12949
+ async httpDelete(url, headers, overrides) {
12135
12950
  return this.retryableRequest(this.baseUrl + url, {
12136
12951
  method: "DELETE",
12137
12952
  headers
12138
- });
12953
+ }, 3, overrides);
12139
12954
  }
12140
12955
  /**
12141
12956
  * Performs an HTTP PATCH request
12142
12957
  * @param url - The relative URL path to request (will be appended to baseUrl)
12143
12958
  * @param data - Optional request body data (will be JSON stringified)
12144
12959
  * @param headers - Optional HTTP headers to include in the request
12960
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12145
12961
  * @returns Promise resolving to an ApiResponse with typed data
12146
12962
  * @protected
12147
12963
  */
12148
- async httpPatch(url, data, headers) {
12964
+ async httpPatch(url, data, headers, overrides) {
12149
12965
  return this.retryableRequest(this.baseUrl + url, {
12150
12966
  method: "PATCH",
12151
12967
  body: data ? JSON.stringify(data) : void 0,
12152
12968
  headers
12153
- });
12969
+ }, 3, overrides);
12154
12970
  }
12155
12971
  /**
12156
12972
  * Performs one HTTP PATCH attempt (no client retry).
@@ -12275,8 +13091,8 @@ var init_connection_requests_api_service = __esm({
12275
13091
  __name(this, "ConnectionRequestsApiService");
12276
13092
  }
12277
13093
  agentId;
12278
- constructor(baseUrl, credential, agentId) {
12279
- super(baseUrl, credential), this.agentId = agentId;
13094
+ constructor(baseUrl, credential, agentId2) {
13095
+ super(baseUrl, credential), this.agentId = agentId2;
12280
13096
  }
12281
13097
  query() {
12282
13098
  return `agentId=${encodeURIComponent(this.agentId)}`;
@@ -12358,8 +13174,8 @@ function workflowJobTargetTemplatePath(binding) {
12358
13174
  return m[1].split(".").every((seg) => TARGET_PATH_SEGMENT_RE.test(seg)) ? m[1] : null;
12359
13175
  }
12360
13176
  function isWorkflowJobTargetTemplate(target) {
12361
- const agentId = target?.agentId;
12362
- return !!agentId && typeof agentId === "object";
13177
+ const agentId2 = target?.agentId;
13178
+ return !!agentId2 && typeof agentId2 === "object";
12363
13179
  }
12364
13180
  function workflowJobLuaApiProblem(luaApi, nodeType, tier) {
12365
13181
  if (luaApi === void 0) return null;
@@ -12375,12 +13191,12 @@ function workflowJobTargetProblem(target, plugins, luaApi) {
12375
13191
  if (target === void 0) return null;
12376
13192
  if (!target || typeof target !== "object" || Array.isArray(target)) return "target must be { agentId }";
12377
13193
  const keys = Object.keys(target);
12378
- const agentId = target.agentId;
13194
+ const agentId2 = target.agentId;
12379
13195
  if (keys.length !== 1 || !("agentId" in target)) return "target must be exactly { agentId }";
12380
- if (typeof agentId === "string") {
12381
- if (!agentId.trim() || agentId.length > 256) return "target must be exactly { agentId: <non-empty string> }";
12382
- if (agentId.includes("${")) return "a run-input target is written template('${initData.<path>}'), never a string with ${\u2026}";
12383
- } else if (workflowJobTargetTemplatePath(agentId) === null) {
13196
+ if (typeof agentId2 === "string") {
13197
+ if (!agentId2.trim() || agentId2.length > 256) return "target must be exactly { agentId: <non-empty string> }";
13198
+ if (agentId2.includes("${")) return "a run-input target is written template('${initData.<path>}'), never a string with ${\u2026}";
13199
+ } else if (workflowJobTargetTemplatePath(agentId2) === null) {
12384
13200
  return "target.agentId must be a static id or template('${initData.<path>}') \u2014 exactly one initData placeholder, no default";
12385
13201
  }
12386
13202
  const hasPlugins = Array.isArray(plugins) && plugins.length > 0;
@@ -12404,25 +13220,25 @@ function readInitDataPath(root, path3) {
12404
13220
  return cur;
12405
13221
  }
12406
13222
  function renderWorkflowJobTarget(target, initData) {
12407
- const agentId = target?.agentId;
12408
- if (target === void 0 || target === null || agentId === void 0) return {
13223
+ const agentId2 = target?.agentId;
13224
+ if (target === void 0 || target === null || agentId2 === void 0) return {
12409
13225
  ok: true,
12410
13226
  agentId: void 0,
12411
13227
  templated: false
12412
13228
  };
12413
- if (typeof agentId === "string") {
12414
- if (!agentId.trim() || agentId.includes("${")) return {
13229
+ if (typeof agentId2 === "string") {
13230
+ if (!agentId2.trim() || agentId2.includes("${")) return {
12415
13231
  ok: false,
12416
13232
  reason: "invalid",
12417
13233
  message: "target.agentId is invalid"
12418
13234
  };
12419
13235
  return {
12420
13236
  ok: true,
12421
- agentId,
13237
+ agentId: agentId2,
12422
13238
  templated: false
12423
13239
  };
12424
13240
  }
12425
- const path3 = workflowJobTargetTemplatePath(agentId);
13241
+ const path3 = workflowJobTargetTemplatePath(agentId2);
12426
13242
  if (path3 === null) return {
12427
13243
  ok: false,
12428
13244
  reason: "invalid",
@@ -12516,7 +13332,7 @@ var init_workflow_job_tools = __esm({
12516
13332
 
12517
13333
  // ../workflow-graph/dist/index.mjs
12518
13334
  import { createHash as createHash2 } from "crypto";
12519
- import { z as z7 } from "zod";
13335
+ import { z as z8 } from "zod";
12520
13336
  import { z as z22 } from "zod";
12521
13337
  import { createHash as createHash22 } from "crypto";
12522
13338
  function isMapConfigObject(v) {
@@ -12986,6 +13802,19 @@ function validateApprovalReminder(node, path3) {
12986
13802
  }
12987
13803
  return [];
12988
13804
  }
13805
+ function validateHitlTimeoutHours(node, path3) {
13806
+ const h = node.timeoutHours;
13807
+ if (typeof h !== "number") return [];
13808
+ if (Number.isFinite(h) && h >= APPROVAL_TIMEOUT_HOURS_MIN && h <= APPROVAL_TIMEOUT_HOURS_MAX) return [];
13809
+ return [
13810
+ {
13811
+ code: "timeout-hours-out-of-range",
13812
+ path: `${path3}.timeoutHours`,
13813
+ severity: "error",
13814
+ message: `timeoutHours must be a number of hours in [${APPROVAL_TIMEOUT_HOURS_MIN}, ${APPROVAL_TIMEOUT_HOURS_MAX}] (got ${h})`
13815
+ }
13816
+ ];
13817
+ }
12989
13818
  function firstAskDeadline(node) {
12990
13819
  const head = Array.isArray(node.onTimeout) ? node.onTimeout[0] : node.onTimeout;
12991
13820
  if (typeof head === "object" && head !== null && "escalateTo" in head) {
@@ -13057,6 +13886,9 @@ function retryBackoffs() {
13057
13886
  function sleepUntilUnsupportedMessage(id2) {
13058
13887
  return `the engine does not execute \`sleepUntil\` yet (node "${id2}") \u2014 replace it with a \`sleep\` node with a \`duration\` in ms, e.g. { type: 'sleep', id: '${id2}', duration: ${SLEEP_UNTIL_REPLACEMENT.duration} }`;
13059
13888
  }
13889
+ function signalNameInvalidMessage(id2, name) {
13890
+ return `waitForSignal "${id2}" signal "${name}" must match /${WORKFLOW_SIGNAL_NAME_RE.source}/ (the names a delivery accepts)`;
13891
+ }
13060
13892
  function armSubrunUnsupportedMessage(id2, workflowId) {
13061
13893
  return `the engine does not execute the implicit \`${workflowId}\` arm subrun (node "${id2}") \u2014 a [map, step] container arm is the step itself with the map as its \`input\` since lua-cli 3.32.4; re-run \`lua compile\` with the current CLI (a hand-written artifact: put the map on the arm node's \`input\` and drop the \`workflow\` wrapper)`;
13062
13894
  }
@@ -13649,10 +14481,13 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
13649
14481
  const w = node;
13650
14482
  checkId(w.id, path3);
13651
14483
  if (typeof w.signal !== "string" || w.signal.length === 0) err("invalid-envelope", "waitForSignal.signal is required", `${path3}.signal`, w.id);
14484
+ else if (!WORKFLOW_SIGNAL_NAME_RE.test(w.signal)) err("signal-name-invalid", signalNameInvalidMessage(w.id, w.signal), `${path3}.signal`, w.id);
14485
+ for (const r of validateHitlTimeoutHours(w, path3)) err(r.code, r.message, r.path, w.id);
13652
14486
  return;
13653
14487
  }
13654
14488
  const a = node;
13655
14489
  checkId(a.id, path3);
14490
+ for (const r of validateHitlTimeoutHours(a, path3)) err(r.code, r.message, r.path, a.id);
13656
14491
  if ((a.approver ?? "creator") === "creator" && a.excludeInitiator === true) {
13657
14492
  err("approver-excludes-only-candidate", "approver:'creator' with excludeInitiator:true always excludes the only candidate", path3, a.id);
13658
14493
  }
@@ -16120,7 +16955,7 @@ function collectJobTierSteps(entry, out) {
16120
16955
  return;
16121
16956
  }
16122
16957
  }
16123
- var __defProp6, __name6, WorkflowTemplateError, TEMPLATE_PLACEHOLDER, TEMPLATE_NAMESPACES, MAP_DESCRIPTOR_KEYS, MAP_MEMBER_MALFORMED_CODE, fromInit, fromStep, value, template, fromRequest, rows, fromKnowledge, SideEffectsSchema, JobResourcesSchema, WORKFLOW_MODEL_TEMPLATE_ROOT, WORKFLOW_MODEL_TEMPLATE_RE, PATH_SEGMENT_RE, APPROVER_SPEC_MAX_USERS, ESCALATION_MAX_HOPS, TemplateBindingSchema, ApproverSpecSchema, FourEyesSchema, EscalationHopSchema, TerminalOutcomeSchema, ApprovalOnTimeoutSchema, APPROVER_SPEC_SHAPES, APPROVER_WRITTEN_MAX, USER_ID_SHAPED_RE, BINDING_ROOTS, APPROVAL_REMIND_AFTER_HOURS_MIN, APPROVAL_REMIND_AFTER_HOURS_MAX, WORKSPACE_TEMPLATE_EXPR_RE, SLEEP_UNTIL_REPLACEMENT, WORKFLOW_WORKSPACE_TTL_MAX_HOURS_DEFAULT, WORKFLOW_CAPS_DEFAULT, WORKFLOW_STEP_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_AGENT_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_FOREACH_DEFAULT_CONCURRENCY, WORKFLOW_FOREACH_DEFAULT_MAX_ITEMS, WORKFLOW_LOOP_DEFAULT_MAX_ITERATIONS, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS2, WORKFLOW_SIGNAL_DEFAULT_SOURCES, clone, CONNECTION_ID_HEX_RE, WORKFLOW_JOB_MAX_WORKTREE_ARMS, workspaceOf, mountsWorkspace, isJobTier, jobToolsOf, schemaIsArray, isHitlNode, isSingleStep, singleId, armId, TEMPLATE_STEP_REF, EDITABLE_PATH_RE, PREDICATE_OPS, isPredicateScalar, GRAPH_HASH_PREFIX, WorkflowPlanError, isArmStep, armStepId, armStepKind, joinIdOf, containerIdOf, PATH_PLACEHOLDER, MISSING, stepIdOf, cmp, eq, ne, gt, gte, lt, lte, inSet, notIn, exists, notExists, truthy, falsy, and, or, not, CONTINUED_FAILURE_TAG, CONTINUED_FAILURE_DEFAULT_CODE, CONTINUED_FAILURE_OUTPUT_SCHEMA, CONTINUED_FAILURE_LEAF_PATHS, isHitlNode2, nodeIdOf, GOAL_JUDGE_STEP_ID, NON_LEAF_KINDS, CONDITIONAL_JOIN_ID, branchArmId, canonical, sortKeys, JOIN, entryOfJoin, FORCE_CANCEL_STALE_MS, TERMINAL, WORKFLOW_INLINE_RUN_TAG, RUN_ERROR_ISSUES_MAX, IN_FLIGHT, n, SUSPENDED_FOR_DIMENSIONS, STEP_ERROR_DETAIL_KEYS, STEP_ERROR_DETAIL_MAX_BYTES, DETAIL_MAX_DEPTH, DETAIL_MAX_ITEMS, MAX_HOLIDAYS, MAX_WALK_DAYS, HHMM, YMD, MS_PER_MIN, MS_PER_DAY, MON_FRI, supportedTz, fmtCache, WEEKDAYS, JSON_PATCH_OPS, JSON_PATCH_MAX_OPS, JSON_PATCH_MAX_VALUE_BYTES, JSON_PATCH_MAX_TOTAL_BYTES, SEGMENT_RE, WORKFLOW_SCHEDULE_TYPES, WORKFLOW_SCHEDULE_SHAPE_ISSUE, WORKFLOW_SCHEDULE_SHAPES_HINT, WORKFLOW_SCHEDULE_RUN_AS, isObject, WORKFLOW_ENV_OVERLAY_MAX_KEYS, WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES, WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE, isEnvRef, looksLikeEmbeddedJson, ZERO, isRecord2;
16958
+ var __defProp6, __name6, WorkflowTemplateError, TEMPLATE_PLACEHOLDER, TEMPLATE_NAMESPACES, MAP_DESCRIPTOR_KEYS, MAP_MEMBER_MALFORMED_CODE, fromInit, fromStep, value, template, fromRequest, rows, fromKnowledge, SideEffectsSchema, JobResourcesSchema, WORKFLOW_MODEL_TEMPLATE_ROOT, WORKFLOW_MODEL_TEMPLATE_RE, PATH_SEGMENT_RE, APPROVER_SPEC_MAX_USERS, ESCALATION_MAX_HOPS, TemplateBindingSchema, ApproverSpecSchema, FourEyesSchema, EscalationHopSchema, TerminalOutcomeSchema, ApprovalOnTimeoutSchema, APPROVER_SPEC_SHAPES, APPROVER_WRITTEN_MAX, USER_ID_SHAPED_RE, BINDING_ROOTS, APPROVAL_REMIND_AFTER_HOURS_MIN, APPROVAL_REMIND_AFTER_HOURS_MAX, APPROVAL_TIMEOUT_HOURS_MIN, APPROVAL_TIMEOUT_HOURS_MAX, WORKSPACE_TEMPLATE_EXPR_RE, SLEEP_UNTIL_REPLACEMENT, WORKFLOW_WORKSPACE_TTL_MAX_HOURS_DEFAULT, WORKFLOW_CAPS_DEFAULT, WORKFLOW_STEP_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_AGENT_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_FOREACH_DEFAULT_CONCURRENCY, WORKFLOW_FOREACH_DEFAULT_MAX_ITEMS, WORKFLOW_LOOP_DEFAULT_MAX_ITERATIONS, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS2, WORKFLOW_SIGNAL_DEFAULT_SOURCES, clone, CONNECTION_ID_HEX_RE, WORKFLOW_JOB_MAX_WORKTREE_ARMS, workspaceOf, mountsWorkspace, isJobTier, jobToolsOf, schemaIsArray, isHitlNode, isSingleStep, singleId, armId, TEMPLATE_STEP_REF, EDITABLE_PATH_RE, PREDICATE_OPS, isPredicateScalar, GRAPH_HASH_PREFIX, WorkflowPlanError, isArmStep, armStepId, armStepKind, joinIdOf, containerIdOf, PATH_PLACEHOLDER, MISSING, stepIdOf, cmp, eq, ne, gt, gte, lt, lte, inSet, notIn, exists, notExists, truthy, falsy, and, or, not, CONTINUED_FAILURE_TAG, CONTINUED_FAILURE_DEFAULT_CODE, CONTINUED_FAILURE_OUTPUT_SCHEMA, CONTINUED_FAILURE_LEAF_PATHS, isHitlNode2, nodeIdOf, GOAL_JUDGE_STEP_ID, NON_LEAF_KINDS, CONDITIONAL_JOIN_ID, branchArmId, canonical, sortKeys, JOIN, entryOfJoin, FORCE_CANCEL_STALE_MS, TERMINAL, WORKFLOW_INLINE_RUN_TAG, RUN_ERROR_ISSUES_MAX, IN_FLIGHT, n, SUSPENDED_FOR_DIMENSIONS, STEP_ERROR_DETAIL_KEYS, STEP_ERROR_DETAIL_MAX_BYTES, DETAIL_MAX_DEPTH, DETAIL_MAX_ITEMS, MAX_HOLIDAYS, MAX_WALK_DAYS, HHMM, YMD, MS_PER_MIN, MS_PER_DAY, MON_FRI, supportedTz, fmtCache, WEEKDAYS, JSON_PATCH_OPS, JSON_PATCH_MAX_OPS, JSON_PATCH_MAX_VALUE_BYTES, JSON_PATCH_MAX_TOTAL_BYTES, SEGMENT_RE, WORKFLOW_SCHEDULE_TYPES, WORKFLOW_SCHEDULE_SHAPE_ISSUE, WORKFLOW_SCHEDULE_SHAPES_HINT, WORKFLOW_SCHEDULE_RUN_AS, isObject, WORKFLOW_ENV_OVERLAY_MAX_KEYS, WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES, WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE, isEnvRef, looksLikeEmbeddedJson, ZERO, isRecord2;
16124
16959
  var init_dist2 = __esm({
16125
16960
  "../workflow-graph/dist/index.mjs"() {
16126
16961
  "use strict";
@@ -16224,8 +17059,8 @@ var init_dist2 = __esm({
16224
17059
  fromKnowledge = /* @__PURE__ */ __name6((k) => ({
16225
17060
  knowledge: k
16226
17061
  }), "fromKnowledge");
16227
- SideEffectsSchema = z7.enum(WORKFLOW_SIDE_EFFECTS);
16228
- JobResourcesSchema = z7.enum(WORKFLOW_JOB_RESOURCES);
17062
+ SideEffectsSchema = z8.enum(WORKFLOW_SIDE_EFFECTS);
17063
+ JobResourcesSchema = z8.enum(WORKFLOW_JOB_RESOURCES);
16229
17064
  WORKFLOW_MODEL_TEMPLATE_ROOT = "initData";
16230
17065
  WORKFLOW_MODEL_TEMPLATE_RE = /^\$\{\s*initData\.([A-Za-z0-9_.\-[\]]+)\s*(?:\|([^}]*))?\}$/;
16231
17066
  PATH_SEGMENT_RE = /^[A-Za-z0-9_-]+(?:\[(?:0|[1-9]\d*)\])*$/;
@@ -16329,8 +17164,12 @@ var init_dist2 = __esm({
16329
17164
  __name6(validateApproverBlock, "validateApproverBlock");
16330
17165
  APPROVAL_REMIND_AFTER_HOURS_MIN = 1;
16331
17166
  APPROVAL_REMIND_AFTER_HOURS_MAX = 720;
17167
+ APPROVAL_TIMEOUT_HOURS_MIN = 1;
17168
+ APPROVAL_TIMEOUT_HOURS_MAX = 720;
16332
17169
  __name(validateApprovalReminder, "validateApprovalReminder");
16333
17170
  __name6(validateApprovalReminder, "validateApprovalReminder");
17171
+ __name(validateHitlTimeoutHours, "validateHitlTimeoutHours");
17172
+ __name6(validateHitlTimeoutHours, "validateHitlTimeoutHours");
16334
17173
  __name(firstAskDeadline, "firstAskDeadline");
16335
17174
  __name6(firstAskDeadline, "firstAskDeadline");
16336
17175
  __name(liftRenderedApprover, "liftRenderedApprover");
@@ -16348,6 +17187,8 @@ var init_dist2 = __esm({
16348
17187
  });
16349
17188
  __name(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
16350
17189
  __name6(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
17190
+ __name(signalNameInvalidMessage, "signalNameInvalidMessage");
17191
+ __name6(signalNameInvalidMessage, "signalNameInvalidMessage");
16351
17192
  __name(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
16352
17193
  __name6(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
16353
17194
  WORKFLOW_WORKSPACE_TTL_MAX_HOURS_DEFAULT = 168;
@@ -17757,6 +18598,9 @@ var init_workflow = __esm({
17757
18598
  for (const r of validateApprovalReminder(opts, `approval("${id2}")`)) {
17758
18599
  if (r.severity === "error") throw new LuaWorkflowBuildError("remind-after-invalid", `"${id2}": ${r.message}`);
17759
18600
  }
18601
+ for (const r of validateHitlTimeoutHours(opts, `approval("${id2}")`)) {
18602
+ throw new LuaWorkflowBuildError("timeout-hours-out-of-range", `"${id2}": ${r.message}`);
18603
+ }
17760
18604
  if (typeof opts.details === "function") throw new LuaWorkflowBuildError("closure-binding", `approval("${id2}").details must be template(...)`);
17761
18605
  this.recordEnvRefs(opts.details, opts.timeoutHours, opts.approver);
17762
18606
  const node = defined({
@@ -17787,6 +18631,10 @@ var init_workflow = __esm({
17787
18631
  waitForSignal(id2, opts) {
17788
18632
  this.assertId(id2, "waitForSignal()");
17789
18633
  if (!opts || typeof opts.signal !== "string" || opts.signal.length === 0) throw new LuaWorkflowBuildError("invalid-envelope", `waitForSignal("${id2}") needs a signal name`);
18634
+ if (!WORKFLOW_SIGNAL_NAME_RE.test(opts.signal)) throw new LuaWorkflowBuildError("signal-name-invalid", signalNameInvalidMessage(id2, opts.signal));
18635
+ for (const r of validateHitlTimeoutHours(opts, `waitForSignal("${id2}")`)) {
18636
+ throw new LuaWorkflowBuildError("timeout-hours-out-of-range", `"${id2}": ${r.message}`);
18637
+ }
17790
18638
  this.recordEnvRefs(opts.timeoutHours);
17791
18639
  const node = defined({
17792
18640
  type: "waitForSignal",
@@ -17849,7 +18697,7 @@ var init_workflow = __esm({
17849
18697
  if (this.mapCount >= 2 && this.unnamedMaps > 0) {
17850
18698
  this.warnings.push({
17851
18699
  code: "map-id-required",
17852
- message: `${this.unnamedMaps} of ${this.mapCount} map() calls have no explicit id \u2014 positional ids renumber on insert; pass { id } (error at push)`
18700
+ message: `${this.unnamedMaps} of ${this.mapCount} map() calls have no explicit id \u2014 positional ids renumber on insert; pass { id } to every map() to keep step ids stable`
17853
18701
  });
17854
18702
  }
17855
18703
  if (graphHasHitl(graph, this.steps) && this.config.budget?.maxDurationSeconds === void 0) {
@@ -18028,9 +18876,9 @@ var init_skills_api_service = __esm({
18028
18876
  * @param credential - The API key for authentication
18029
18877
  * @param agentId - The unique identifier of the agent
18030
18878
  */
18031
- constructor(baseUrl, credential, agentId) {
18879
+ constructor(baseUrl, credential, agentId2) {
18032
18880
  super(baseUrl, credential);
18033
- this.agentId = agentId;
18881
+ this.agentId = agentId2;
18034
18882
  }
18035
18883
  /**
18036
18884
  * Retrieves all skills for the agent
@@ -18540,7 +19388,7 @@ function walk3(root, prefix, out) {
18540
19388
  }
18541
19389
  }
18542
19390
  }
18543
- 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;
19391
+ 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;
18544
19392
  var init_dist3 = __esm({
18545
19393
  "../shared-source-sync/dist/index.mjs"() {
18546
19394
  "use strict";
@@ -18748,6 +19596,7 @@ var init_dist3 = __esm({
18748
19596
  __name7(writeArchiveToWorkspace, "writeArchiveToWorkspace");
18749
19597
  __name(walk3, "walk");
18750
19598
  __name7(walk3, "walk");
19599
+ SKILL_SOURCE_ARCHIVE_MAX_BYTES = 4 * 1024 * 1024;
18751
19600
  }
18752
19601
  });
18753
19602
 
@@ -18891,8 +19740,8 @@ var init_base_handler = __esm({
18891
19740
  * Local items take priority for shared IDs; server-only orphans are appended as minimal
18892
19741
  * cleanItem objects. On server failure, returns local items only with an empty orphan set.
18893
19742
  */
18894
- async fetchMergedForInteraction(apiKey, agentId, config) {
18895
- const serverData = await this.fetchServerState(apiKey, agentId);
19743
+ async fetchMergedForInteraction(apiKey, agentId2, config) {
19744
+ const serverData = await this.fetchServerState(apiKey, agentId2);
18896
19745
  const localItems = this.getFromYaml(config);
18897
19746
  if (!serverData.serverItems) {
18898
19747
  return {
@@ -18919,9 +19768,9 @@ var init_base_handler = __esm({
18919
19768
  };
18920
19769
  }
18921
19770
  /** Phase 1 of parallel sync: fetch server state (HTTP only, no YAML writes) */
18922
- async fetchServerState(apiKey, agentId) {
19771
+ async fetchServerState(apiKey, agentId2) {
18923
19772
  try {
18924
- const api = this.getApi(apiKey, agentId);
19773
+ const api = this.getApi(apiKey, agentId2);
18925
19774
  const serverItems = await this.fetchFromServer(api);
18926
19775
  return {
18927
19776
  serverItems
@@ -19034,11 +19883,11 @@ var init_base_handler = __esm({
19034
19883
  orphanedCount
19035
19884
  };
19036
19885
  }
19037
- async syncWithServer(apiKey, agentId, config, manifest) {
19038
- const serverData = await this.fetchServerState(apiKey, agentId);
19886
+ async syncWithServer(apiKey, agentId2, config, manifest) {
19887
+ const serverData = await this.fetchServerState(apiKey, agentId2);
19039
19888
  return this.applySyncToYaml(serverData, config, manifest, {
19040
19889
  apiKey,
19041
- agentId
19890
+ agentId: agentId2
19042
19891
  });
19043
19892
  }
19044
19893
  /**
@@ -19179,8 +20028,8 @@ var init_base_handler = __esm({
19179
20028
  /**
19180
20029
  * Get the highest version string from the server for conflict avoidance.
19181
20030
  */
19182
- async getHighestServerVersion(apiKey, agentId, entityId) {
19183
- const { serverItems } = await this.fetchServerState(apiKey, agentId);
20031
+ async getHighestServerVersion(apiKey, agentId2, entityId) {
20032
+ const { serverItems } = await this.fetchServerState(apiKey, agentId2);
19184
20033
  if (!serverItems) return null;
19185
20034
  const entity = serverItems.find((item) => item.id === entityId);
19186
20035
  if (!entity?.versions || !Array.isArray(entity.versions)) return null;
@@ -19192,9 +20041,9 @@ var init_base_handler = __esm({
19192
20041
  * Fetch all server items once, extract highest version for each entity ID.
19193
20042
  * More efficient than calling getHighestServerVersion() per entity.
19194
20043
  */
19195
- async batchGetHighestVersions(apiKey, agentId, entityIds) {
20044
+ async batchGetHighestVersions(apiKey, agentId2, entityIds) {
19196
20045
  const result = /* @__PURE__ */ new Map();
19197
- const { serverItems } = await this.fetchServerState(apiKey, agentId);
20046
+ const { serverItems } = await this.fetchServerState(apiKey, agentId2);
19198
20047
  if (!serverItems) {
19199
20048
  entityIds.forEach((id2) => result.set(id2, null));
19200
20049
  return result;
@@ -19320,8 +20169,8 @@ var init_skill_handler = __esm({
19320
20169
  yamlKey: "skills",
19321
20170
  idField: "skillId"
19322
20171
  };
19323
- getApi(apiKey, agentId) {
19324
- return new SkillApi(BASE_URLS.API, apiKey, agentId);
20172
+ getApi(apiKey, agentId2) {
20173
+ return new SkillApi(BASE_URLS.API, apiKey, agentId2);
19325
20174
  }
19326
20175
  async fetchFromServer(api) {
19327
20176
  const response = await api.getSkills();
@@ -19421,8 +20270,8 @@ var init_skill_handler = __esm({
19421
20270
  // ===========================================================================
19422
20271
  // PUSH — custom to include tools array
19423
20272
  // ===========================================================================
19424
- async pushToServer(apiKey, agentId, entityId, pushData) {
19425
- const api = this.getApi(apiKey, agentId);
20273
+ async pushToServer(apiKey, agentId2, entityId, pushData) {
20274
+ const api = this.getApi(apiKey, agentId2);
19426
20275
  const response = await api.pushSkill(entityId, {
19427
20276
  ...pushData,
19428
20277
  skillId: entityId
@@ -19432,8 +20281,8 @@ var init_skill_handler = __esm({
19432
20281
  error: response.error?.message
19433
20282
  };
19434
20283
  }
19435
- async publishVersion(apiKey, agentId, entityId, version) {
19436
- const api = this.getApi(apiKey, agentId);
20284
+ async publishVersion(apiKey, agentId2, entityId, version) {
20285
+ const api = this.getApi(apiKey, agentId2);
19437
20286
  const response = await api.publishSkillVersion(entityId, version);
19438
20287
  return {
19439
20288
  success: response.success,
@@ -20134,9 +20983,9 @@ var init_products_api_service = __esm({
20134
20983
  * @param credential - The API key for authentication
20135
20984
  * @param agentId - The unique identifier of the agent
20136
20985
  */
20137
- constructor(baseUrl, credential, agentId) {
20986
+ constructor(baseUrl, credential, agentId2) {
20138
20987
  super(baseUrl, credential);
20139
- this.agentId = agentId;
20988
+ this.agentId = agentId2;
20140
20989
  }
20141
20990
  async get(pageOrOptions, limitArg) {
20142
20991
  let page;
@@ -20722,9 +21571,9 @@ var init_order_api_service = __esm({
20722
21571
  * @param credential - The API key for authentication
20723
21572
  * @param agentId - The unique identifier of the agent
20724
21573
  */
20725
- constructor(baseUrl, credential, agentId) {
21574
+ constructor(baseUrl, credential, agentId2) {
20726
21575
  super(baseUrl, credential);
20727
- this.agentId = agentId;
21576
+ this.agentId = agentId2;
20728
21577
  }
20729
21578
  /**
20730
21579
  * Creates a new order from a basket
@@ -20819,10 +21668,10 @@ var init_basket_api_service = __esm({
20819
21668
  * @param credential - The API key for authentication
20820
21669
  * @param agentId - The unique identifier of the agent
20821
21670
  */
20822
- constructor(baseUrl, credential, agentId) {
21671
+ constructor(baseUrl, credential, agentId2) {
20823
21672
  super(baseUrl, credential);
20824
21673
  this.credential = credential;
20825
- this.agentId = agentId;
21674
+ this.agentId = agentId2;
20826
21675
  }
20827
21676
  /**
20828
21677
  * Creates a new user basket
@@ -21204,10 +22053,10 @@ var init_user_data_api_service = __esm({
21204
22053
  * @param credential - The API key for authentication
21205
22054
  * @param agentId - The unique identifier of the agent
21206
22055
  */
21207
- constructor(baseUrl, credential, agentId, targetUserId) {
22056
+ constructor(baseUrl, credential, agentId2, targetUserId) {
21208
22057
  super(baseUrl, credential);
21209
22058
  this.credential = credential;
21210
- this.agentId = agentId;
22059
+ this.agentId = agentId2;
21211
22060
  this.targetUserId = targetUserId;
21212
22061
  }
21213
22062
  get dataPath() {
@@ -21606,9 +22455,9 @@ var init_custom_data_api_service = __esm({
21606
22455
  * @param credential - The API key for authentication
21607
22456
  * @param agentId - The unique identifier of the agent
21608
22457
  */
21609
- constructor(baseUrl, credential, agentId) {
22458
+ constructor(baseUrl, credential, agentId2) {
21610
22459
  super(baseUrl, credential);
21611
- this.agentId = agentId;
22460
+ this.agentId = agentId2;
21612
22461
  }
21613
22462
  /**
21614
22463
  * Lists the agent's data collections with entry counts, timestamps, and —
@@ -21816,9 +22665,9 @@ var init_webhook_api_service = __esm({
21816
22665
  * @param credential - The API key for authentication
21817
22666
  * @param agentId - The unique identifier of the agent
21818
22667
  */
21819
- constructor(baseUrl, credential, agentId) {
22668
+ constructor(baseUrl, credential, agentId2) {
21820
22669
  super(baseUrl, credential);
21821
- this.agentId = agentId;
22670
+ this.agentId = agentId2;
21822
22671
  }
21823
22672
  /**
21824
22673
  * Retrieves all webhooks for the agent
@@ -22119,10 +22968,10 @@ var init_job_api_service = __esm({
22119
22968
  * @param credential - The API key for authentication
22120
22969
  * @param agentId - The unique identifier of the agent
22121
22970
  */
22122
- constructor(baseUrl, credential, agentId) {
22971
+ constructor(baseUrl, credential, agentId2) {
22123
22972
  super(baseUrl, credential);
22124
22973
  this.credential = credential;
22125
- this.agentId = agentId;
22974
+ this.agentId = agentId2;
22126
22975
  }
22127
22976
  /**
22128
22977
  * Retrieves all jobs for the agent
@@ -22322,8 +23171,8 @@ var init_ai_api_service = __esm({
22322
23171
  __name(this, "AiApiService");
22323
23172
  }
22324
23173
  agentId;
22325
- constructor(baseUrl, credential, agentId) {
22326
- super(baseUrl, credential), this.agentId = agentId;
23174
+ constructor(baseUrl, credential, agentId2) {
23175
+ super(baseUrl, credential), this.agentId = agentId2;
22327
23176
  }
22328
23177
  async generate(body) {
22329
23178
  return this.httpPost(`/developer/ai/${this.agentId}/generate`, body, {});
@@ -22431,8 +23280,8 @@ var init_integrations_api_service = __esm({
22431
23280
  __name(this, "IntegrationsApiService");
22432
23281
  }
22433
23282
  agentId;
22434
- constructor(baseUrl, credential, agentId) {
22435
- super(baseUrl, credential), this.agentId = agentId;
23283
+ constructor(baseUrl, credential, agentId2) {
23284
+ super(baseUrl, credential), this.agentId = agentId2;
22436
23285
  }
22437
23286
  async passthrough(integrationType, request, options) {
22438
23287
  return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(this.agentId)}/passthrough/${encodeURIComponent(integrationType)}`, options?.connectionId ? {
@@ -22441,12 +23290,12 @@ var init_integrations_api_service = __esm({
22441
23290
  } : request, {});
22442
23291
  }
22443
23292
  /** wave 2 U6 — `GET /developer/unifiedto/connections/:agentId/visible` for `agentId` (default: this agent). */
22444
- async listVisible(agentId = this.agentId) {
22445
- return this.httpGet(`/developer/unifiedto/connections/${encodeURIComponent(agentId)}/visible`);
23293
+ async listVisible(agentId2 = this.agentId) {
23294
+ return this.httpGet(`/developer/unifiedto/connections/${encodeURIComponent(agentId2)}/visible`);
22446
23295
  }
22447
23296
  /** wave 2 U6 — `POST /developer/unifiedto/connections/:agentId/:connectionId/checks`. */
22448
- async runCheck(connectionId, check, options = {}, agentId = this.agentId) {
22449
- return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(agentId)}/${encodeURIComponent(connectionId)}/checks`, {
23297
+ async runCheck(connectionId, check, options = {}, agentId2 = this.agentId) {
23298
+ return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(agentId2)}/${encodeURIComponent(connectionId)}/checks`, {
22450
23299
  check,
22451
23300
  ...options.allowWrite === true ? {
22452
23301
  allowWrite: true
@@ -22588,10 +23437,14 @@ var init_agents_api_service = __esm({
22588
23437
  * `(prompt)` call returns plain text and the `(input)` call returns the
22589
23438
  * full structured output.
22590
23439
  */
22591
- async invokeForSandbox(targetAgentId, promptOrInput) {
22592
- const input = typeof promptOrInput === "string" ? {
23440
+ async invokeForSandbox(targetAgentId, promptOrInput, options) {
23441
+ const base = typeof promptOrInput === "string" ? {
22593
23442
  prompt: promptOrInput
22594
23443
  } : promptOrInput;
23444
+ const input = !base.signal && options?.signal ? {
23445
+ ...base,
23446
+ signal: options.signal
23447
+ } : base;
22595
23448
  if (isAborted2(input.signal)) throw abortReason(input.signal);
22596
23449
  const result = await this.invoke(targetAgentId, input);
22597
23450
  if (!result.success) {
@@ -22601,8 +23454,20 @@ var init_agents_api_service = __esm({
22601
23454
  if (!result.data) {
22602
23455
  throw new Error("Agent invocation failed: empty response");
22603
23456
  }
22604
- if (typeof promptOrInput === "string") return result.data.text ?? "";
22605
23457
  const data = result.data;
23458
+ if (data?.type === "error") {
23459
+ if (isPaymentRequiredChatErrorEnvelope(data)) {
23460
+ throw Object.assign(new Error(data.error || "Payment required"), {
23461
+ name: "AgentInvocationError",
23462
+ code: "PAYMENT_REQUIRED",
23463
+ statusCode: 402
23464
+ });
23465
+ }
23466
+ throw Object.assign(new Error(data.error || "Agent invocation failed"), {
23467
+ name: "AgentInvocationError",
23468
+ code: "AGENT_ERROR"
23469
+ });
23470
+ }
22606
23471
  if (data?.type === "preprocessor_blocked") {
22607
23472
  throw Object.assign(new Error(data.text || "Agent invocation blocked by preprocessor"), {
22608
23473
  name: "AgentInvocationError",
@@ -22617,9 +23482,29 @@ var init_agents_api_service = __esm({
22617
23482
  stage: data.governanceBlock?.stage
22618
23483
  });
22619
23484
  }
23485
+ if (typeof promptOrInput === "string") return data.text ?? "";
22620
23486
  return toInvocationOutput(data, input.threadId);
22621
23487
  }
22622
23488
  /**
23489
+ * BAC-2154 — the offline twin of `Agents.jobs(agentId).register`. A registration changes what a live agent runs,
23490
+ * like `workflows.deploy`, so it is always refused offline, with no network call. Bad arguments are refused first.
23491
+ * @experimental Gives `lua test` a typed refusal; the live call is served by the platform.
23492
+ */
23493
+ async registerJobForSandbox(targetAgentId, input) {
23494
+ const refuse = /* @__PURE__ */ __name((code, message) => {
23495
+ throw Object.assign(new Error(message), {
23496
+ name: "SupervisionError",
23497
+ code
23498
+ });
23499
+ }, "refuse");
23500
+ if (!targetAgentId) refuse("supervision_no_target", "A target agent id is required");
23501
+ const nonEmpty = /* @__PURE__ */ __name((v) => typeof v === "string" && v.length > 0, "nonEmpty");
23502
+ if (!nonEmpty(input?.versionId) || !nonEmpty(input?.jobId)) {
23503
+ refuse("supervision_bad_args", "jobs.register needs a non-empty versionId and jobId");
23504
+ }
23505
+ return refuse("supervision_release_offline_refused", "jobs.register is refused offline: a local test never changes a live agent");
23506
+ }
23507
+ /**
22623
23508
  * EM-WS2 — the offline (`lua test` / `lua dev`) twin of the `Agents.*`
22624
23509
  * supervision members. Read ops go to the developer REST routes with YOUR
22625
23510
  * developer credential (so they return what you can see, not what a
@@ -22637,7 +23522,8 @@ var init_agents_api_service = __esm({
22637
23522
  code
22638
23523
  });
22639
23524
  }, "refuse");
22640
- if (op === "versions.promote" || op === "persona.activate" || op === "versions.delete" || op === "workflows.create" || op === "workflows.push" || op === "workflows.deploy") {
23525
+ if (op === "versions.promote" || // WD — a watchdog rollback changes what a live agent serves, like a promote.
23526
+ op === "versions.rollback" || op === "persona.activate" || op === "versions.delete" || op === "workflows.create" || op === "workflows.push" || op === "workflows.deploy") {
22641
23527
  refuse("supervision_release_offline_refused", `${op} is refused offline: a local test never changes a live agent`);
22642
23528
  }
22643
23529
  if (op === "versions.preview" || op === "agents.list" || op === "agents.get" || op === "source.get" || // U25 — a subscription is live platform state (it starts a deployed trigger): never from a local test.
@@ -22805,6 +23691,8 @@ var init_agents_api_service = __esm({
22805
23691
  case "evals.cancel":
22806
23692
  case "owner.notify":
22807
23693
  case "connections.assign":
23694
+ // SV (LUA-1080) — the live pointers are not exposed on a developer route: platform only.
23695
+ case "primitives.deployed":
22808
23696
  return refuse("supervision_offline_unsupported", `${op} is not available offline; run it on the platform`);
22809
23697
  default:
22810
23698
  return refuse("supervision_unknown_op", `Unknown supervision operation ${String(op)}`);
@@ -22867,9 +23755,9 @@ var init_whatsapp_templates_api_service = __esm({
22867
23755
  * @param credential - The API key for authentication
22868
23756
  * @param agentId - The unique identifier of the agent
22869
23757
  */
22870
- constructor(baseUrl, credential, agentId) {
23758
+ constructor(baseUrl, credential, agentId2) {
22871
23759
  super(baseUrl, credential);
22872
- this.agentId = agentId;
23760
+ this.agentId = agentId2;
22873
23761
  }
22874
23762
  /**
22875
23763
  * Lists WhatsApp templates for a channel with optional pagination and search
@@ -23007,9 +23895,9 @@ var init_developer_api_service = __esm({
23007
23895
  * @param credential - The API key for authentication
23008
23896
  * @param agentId - The unique identifier of the agent
23009
23897
  */
23010
- constructor(baseUrl, credential, agentId) {
23898
+ constructor(baseUrl, credential, agentId2) {
23011
23899
  super(baseUrl, credential);
23012
- this.agentId = agentId;
23900
+ this.agentId = agentId2;
23013
23901
  }
23014
23902
  /**
23015
23903
  * Retrieves all environment variables for the agent in production
@@ -23122,9 +24010,9 @@ var init_developer_api_service = __esm({
23122
24010
  * @param email - The email address to look up
23123
24011
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23124
24012
  */
23125
- async getUserProfileByEmail(email, agentId) {
24013
+ async getUserProfileByEmail(email, agentId2) {
23126
24014
  const path3 = `/developer/user/profile/email/${encodeURIComponent(email)}`;
23127
- const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
24015
+ const scopedPath = agentId2 ? `${path3}?agentId=${encodeURIComponent(agentId2)}` : path3;
23128
24016
  return this.httpGet(scopedPath, {});
23129
24017
  }
23130
24018
  /**
@@ -23132,10 +24020,10 @@ var init_developer_api_service = __esm({
23132
24020
  * @param phone - The phone number to look up (with or without + prefix)
23133
24021
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23134
24022
  */
23135
- async getUserProfileByPhone(phone, agentId) {
24023
+ async getUserProfileByPhone(phone, agentId2) {
23136
24024
  const normalizedPhone = phone.replace(/^\+/, "");
23137
24025
  const path3 = `/developer/user/profile/phone/${normalizedPhone}`;
23138
- const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
24026
+ const scopedPath = agentId2 ? `${path3}?agentId=${encodeURIComponent(agentId2)}` : path3;
23139
24027
  return this.httpGet(scopedPath, {});
23140
24028
  }
23141
24029
  /**
@@ -23143,9 +24031,9 @@ var init_developer_api_service = __esm({
23143
24031
  * @param identity - `{ kind, scope, value }`, e.g. from `Lua.request.sender`
23144
24032
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23145
24033
  */
23146
- async getUserProfileByIdentity(identity, agentId) {
24034
+ async getUserProfileByIdentity(identity, agentId2) {
23147
24035
  const path3 = `/developer/user/profile/identity/${encodeURIComponent(identity.kind)}/${encodeURIComponent(identity.value)}`;
23148
- return this.httpGet(`${path3}?scope=${encodeURIComponent(identity.scope)}&agentId=${encodeURIComponent(agentId)}`, {});
24036
+ return this.httpGet(`${path3}?scope=${encodeURIComponent(identity.scope)}&agentId=${encodeURIComponent(agentId2)}`, {});
23149
24037
  }
23150
24038
  };
23151
24039
  }
@@ -23162,9 +24050,9 @@ var init_voice_api_service = __esm({
23162
24050
  __name(this, "VoiceApi");
23163
24051
  }
23164
24052
  agentId;
23165
- constructor(baseUrl, credential, agentId) {
24053
+ constructor(baseUrl, credential, agentId2) {
23166
24054
  super(baseUrl, credential);
23167
- this.agentId = agentId;
24055
+ this.agentId = agentId2;
23168
24056
  }
23169
24057
  async getVoices() {
23170
24058
  return this.httpGet(`/developer/voice-agents/${this.agentId}`, {});
@@ -23255,8 +24143,8 @@ var init_channels_send_api_service = __esm({
23255
24143
  __name(this, "ChannelsSendApiService");
23256
24144
  }
23257
24145
  agentId;
23258
- constructor(baseUrl, credential, agentId) {
23259
- super(baseUrl, credential), this.agentId = agentId;
24146
+ constructor(baseUrl, credential, agentId2) {
24147
+ super(baseUrl, credential), this.agentId = agentId2;
23260
24148
  }
23261
24149
  /** POST /developer/agents/:agentId/channels/send */
23262
24150
  async send(input) {
@@ -23378,8 +24266,8 @@ var init_inbox_push_api_service = __esm({
23378
24266
  __name(this, "InboxPushApiService");
23379
24267
  }
23380
24268
  agentId;
23381
- constructor(baseUrl, credential, agentId) {
23382
- super(baseUrl, credential), this.agentId = agentId;
24269
+ constructor(baseUrl, credential, agentId2) {
24270
+ super(baseUrl, credential), this.agentId = agentId2;
23383
24271
  }
23384
24272
  /** POST /developer/agents/:agentId/inbox/push */
23385
24273
  async push(input) {
@@ -23400,8 +24288,8 @@ var init_directory_api_service = __esm({
23400
24288
  __name(this, "DirectoryApiService");
23401
24289
  }
23402
24290
  agentId;
23403
- constructor(baseUrl, credential, agentId) {
23404
- super(baseUrl, credential), this.agentId = agentId;
24291
+ constructor(baseUrl, credential, agentId2) {
24292
+ super(baseUrl, credential), this.agentId = agentId2;
23405
24293
  }
23406
24294
  /** POST /developer/agents/:agentId/directory/resolve */
23407
24295
  async resolve(name) {
@@ -23472,9 +24360,22 @@ function createWorkflowsRuntime(getApi) {
23472
24360
  },
23473
24361
  async list(opts = {}) {
23474
24362
  const api = await getApi();
23475
- const ref = opts.workflow ? await resolveRef(api, opts.workflow) : {};
24363
+ let workflowId;
24364
+ if (opts.workflow) {
24365
+ const v = opts.workflow.trim();
24366
+ const defs = await api.getWorkflows({
24367
+ includeDynamic: true
24368
+ });
24369
+ const hit = defs.success && defs.data ? defs.data.workflows.find((w) => w.name === v) ?? defs.data.workflows.find((w) => w.id === v) : void 0;
24370
+ if (hit) workflowId = hit.id;
24371
+ else if (isWorkflowIdShaped(v)) workflowId = v;
24372
+ else {
24373
+ unwrap(defs, "Workflows.list");
24374
+ return [];
24375
+ }
24376
+ }
23476
24377
  const page = unwrap(await api.getRuns({
23477
- workflowId: ref.workflowId,
24378
+ workflowId,
23478
24379
  status: opts.status,
23479
24380
  limit: opts.limit,
23480
24381
  correlationKey: opts.correlationKey,
@@ -23512,12 +24413,15 @@ function createWorkflowsRuntime(getApi) {
23512
24413
  ...opts
23513
24414
  }), "Workflows.signalByKey");
23514
24415
  },
23515
- raiseBudget: unavailable("raiseBudget", "R45"),
24416
+ async raiseBudget(runId, patch) {
24417
+ const api = await getApi();
24418
+ return unwrap(await api.raiseBudget(runId, patch), "Workflows.raiseBudget");
24419
+ },
23516
24420
  // Goals are scoped to the bound agent: the IF-21 `agentId` argument is parity with the HTTP twin
23517
24421
  // (`/workflows/:agentId/goals`), never a way to reach another agent's goals (403 otherwise).
23518
- async setGoal(agentId, goal) {
24422
+ async setGoal(agentId2, goal) {
23519
24423
  const api = await getApi();
23520
- assertBoundAgent(api, agentId, "setGoal");
24424
+ assertBoundAgent(api, agentId2, "setGoal");
23521
24425
  const g = goal;
23522
24426
  const target = g.workflowId ?? g.workflow;
23523
24427
  const ref = target ? await resolveRef(api, target) : {};
@@ -23527,35 +24431,35 @@ function createWorkflowsRuntime(getApi) {
23527
24431
  }), "Workflows.setGoal");
23528
24432
  },
23529
24433
  goals: {
23530
- async list(agentId, opts = {}) {
24434
+ async list(agentId2, opts = {}) {
23531
24435
  const api = await getApi();
23532
- assertBoundAgent(api, agentId, "goals.list");
24436
+ assertBoundAgent(api, agentId2, "goals.list");
23533
24437
  return unwrap(await api.getGoals(opts), "Workflows.goals.list").items;
23534
24438
  },
23535
- async get(agentId, goalId) {
24439
+ async get(agentId2, goalId) {
23536
24440
  const api = await getApi();
23537
- assertBoundAgent(api, agentId, "goals.get");
24441
+ assertBoundAgent(api, agentId2, "goals.get");
23538
24442
  return unwrap(await api.getGoal(goalId), "Workflows.goals.get");
23539
24443
  },
23540
- async pause(agentId, goalId) {
24444
+ async pause(agentId2, goalId) {
23541
24445
  const api = await getApi();
23542
- assertBoundAgent(api, agentId, "goals.pause");
24446
+ assertBoundAgent(api, agentId2, "goals.pause");
23543
24447
  return unwrap(await api.pauseGoal(goalId), "Workflows.goals.pause");
23544
24448
  },
23545
- async resume(agentId, goalId) {
24449
+ async resume(agentId2, goalId) {
23546
24450
  const api = await getApi();
23547
- assertBoundAgent(api, agentId, "goals.resume");
24451
+ assertBoundAgent(api, agentId2, "goals.resume");
23548
24452
  return unwrap(await api.resumeGoal(goalId), "Workflows.goals.resume");
23549
24453
  },
23550
- async close(agentId, goalId, opts = {}) {
24454
+ async close(agentId2, goalId, opts = {}) {
23551
24455
  const api = await getApi();
23552
- assertBoundAgent(api, agentId, "goals.close");
24456
+ assertBoundAgent(api, agentId2, "goals.close");
23553
24457
  return unwrap(await api.closeGoal(goalId, opts), "Workflows.goals.close");
23554
24458
  }
23555
24459
  }
23556
24460
  };
23557
24461
  }
23558
- var WORKFLOW_START_MAX_WAIT_SECONDS, WORKFLOW_START_CLIENT_DEADLINE_SLACK_MS, WorkflowApiError, unwrap, assertBoundAgent, pathId, unavailable, WorkflowApi;
24462
+ var WORKFLOW_START_MAX_WAIT_SECONDS, WORKFLOW_START_CLIENT_DEADLINE_SLACK_MS, WorkflowApiError, unwrap, isWorkflowIdShaped, assertBoundAgent, pathId, WorkflowApi;
23559
24463
  var init_workflow_api_service = __esm({
23560
24464
  "src/api/workflow.api.service.ts"() {
23561
24465
  "use strict";
@@ -23587,15 +24491,13 @@ var init_workflow_api_service = __esm({
23587
24491
  }
23588
24492
  return res.data;
23589
24493
  }, "unwrap");
23590
- assertBoundAgent = /* @__PURE__ */ __name((api, agentId, member) => {
23591
- if (agentId && agentId !== api.agentId) {
24494
+ 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");
24495
+ assertBoundAgent = /* @__PURE__ */ __name((api, agentId2, member) => {
24496
+ if (agentId2 && agentId2 !== api.agentId) {
23592
24497
  throw new WorkflowApiError("FORBIDDEN", `Workflows.${member}: goals are scoped to the bound agent ${api.agentId}`, 403);
23593
24498
  }
23594
24499
  }, "assertBoundAgent");
23595
24500
  pathId = /* @__PURE__ */ __name((id2) => encodeURIComponent(id2), "pathId");
23596
- unavailable = /* @__PURE__ */ __name((member, route2) => async () => {
23597
- throw new WorkflowApiError("WORKFLOWS_API_UNAVAILABLE", `Workflows.${member} is not available in this runtime yet (${route2} lands with a later wave)`, 501);
23598
- }, "unavailable");
23599
24501
  __name(createWorkflowsRuntime, "createWorkflowsRuntime");
23600
24502
  WorkflowApi = class extends HttpClient {
23601
24503
  static {
@@ -23603,10 +24505,10 @@ var init_workflow_api_service = __esm({
23603
24505
  }
23604
24506
  credential;
23605
24507
  agentId;
23606
- constructor(baseUrl, credential, agentId) {
24508
+ constructor(baseUrl, credential, agentId2) {
23607
24509
  super(baseUrl, credential);
23608
24510
  this.credential = credential;
23609
- this.agentId = agentId;
24511
+ this.agentId = agentId2;
23610
24512
  }
23611
24513
  /** PRO-1434 (main sync): auth rides the renewable request credential — resolve a current bearer per call. */
23612
24514
  async auth() {
@@ -24009,9 +24911,9 @@ var init_device_api_service = __esm({
24009
24911
  __name(this, "DeviceApi");
24010
24912
  }
24011
24913
  agentId;
24012
- constructor(baseUrl, credential, agentId) {
24914
+ constructor(baseUrl, credential, agentId2) {
24013
24915
  super(baseUrl, credential);
24014
- this.agentId = agentId;
24916
+ this.agentId = agentId2;
24015
24917
  }
24016
24918
  async getDevices() {
24017
24919
  return this.httpGet(`/developer/devices/${this.agentId}`, {});
@@ -24035,20 +24937,35 @@ var init_device_api_service = __esm({
24035
24937
  return this.httpDelete(`/developer/devices/${this.agentId}/${deviceId}`, {});
24036
24938
  }
24037
24939
  async sendCommand(deviceName, command, payload, timeout) {
24038
- return this.httpPost(`/developer/devices/${this.agentId}/${deviceName}/command`, {
24940
+ return this.httpPost(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/command`, {
24039
24941
  command,
24040
24942
  payload,
24041
24943
  timeout: timeout || 3e4
24042
24944
  }, {});
24043
24945
  }
24044
24946
  async getDeviceStatus(deviceName) {
24045
- return this.httpGet(`/developer/devices/${this.agentId}/${deviceName}/status`, {});
24947
+ return this.httpGet(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/status`, {});
24046
24948
  }
24047
24949
  async enableDevice(deviceName) {
24048
- return this.httpPatch(`/developer/devices/${this.agentId}/${deviceName}/enable`, {}, {});
24950
+ return this.httpPatch(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/enable`, {}, {});
24049
24951
  }
24050
24952
  async disableDevice(deviceName) {
24051
- return this.httpPatch(`/developer/devices/${this.agentId}/${deviceName}/disable`, {}, {});
24953
+ return this.httpPatch(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/disable`, {}, {});
24954
+ }
24955
+ /** Device instances the agent has seen, with live status; self-describing devices only appear here. */
24956
+ async getConnectedDevices() {
24957
+ return this.httpGet(`/developer/devices/${this.agentId}/connected`, {});
24958
+ }
24959
+ /** Fire a trigger as the named device would; the live handler runs. */
24960
+ async fireTrigger(deviceName, triggerName, payload) {
24961
+ return this.httpPost(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/trigger`, {
24962
+ triggerName,
24963
+ payload
24964
+ }, {});
24965
+ }
24966
+ /** Remove a connected device's instance record (not its definition). */
24967
+ async deleteDeviceInstance(deviceName) {
24968
+ return this.httpDelete(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/instance`, {});
24052
24969
  }
24053
24970
  };
24054
24971
  }
@@ -24344,8 +25261,8 @@ var init_secrets_api_service = __esm({
24344
25261
  __name(this, "SecretsApiService");
24345
25262
  }
24346
25263
  agentId;
24347
- constructor(baseUrl, credential, agentId) {
24348
- super(baseUrl, credential), this.agentId = agentId;
25264
+ constructor(baseUrl, credential, agentId2) {
25265
+ super(baseUrl, credential), this.agentId = agentId2;
24349
25266
  }
24350
25267
  unwrap(result, what) {
24351
25268
  if (!result.success || result.data === void 0) {
@@ -24424,6 +25341,14 @@ function requireExpectActiveId(opts, what) {
24424
25341
  }
24425
25342
  __name(requireExpectActiveId, "requireExpectActiveId");
24426
25343
  __name2(requireExpectActiveId, "requireExpectActiveId");
25344
+ function optionalCommitHash(opts, what) {
25345
+ const commitHash = opts?.commitHash;
25346
+ if (commitHash === void 0) return void 0;
25347
+ if (typeof commitHash === "string" && commitHash.length > 0) return commitHash;
25348
+ throw typedError("supervision_bad_args", `${what} commitHash must be a non-empty string`);
25349
+ }
25350
+ __name(optionalCommitHash, "optionalCommitHash");
25351
+ __name2(optionalCommitHash, "optionalCommitHash");
24427
25352
  function approvalIdsOf(approval) {
24428
25353
  if (approval === void 0 || approval === null) return void 0;
24429
25354
  if (typeof approval !== "object" || Array.isArray(approval)) return {
@@ -24447,26 +25372,26 @@ function buildSupervisionAgentsApi(call2) {
24447
25372
  /** Agents of the caller's own organization, with the supervision actions the caller holds on each. */
24448
25373
  list: /* @__PURE__ */ __name2(() => call2("agents.list"), "list"),
24449
25374
  /** One agent of the caller's organization (not found = other org or no such agent). */
24450
- get: /* @__PURE__ */ __name2((agentId) => call2("agents.get", agentId), "get"),
25375
+ get: /* @__PURE__ */ __name2((agentId2) => call2("agents.get", agentId2), "get"),
24451
25376
  /** Recent execution logs of a supervised agent (metadata + message, no user ids). */
24452
- logs: /* @__PURE__ */ __name2((agentId, opts = {}) => call2("logs", agentId, {
25377
+ logs: /* @__PURE__ */ __name2((agentId2, opts = {}) => call2("logs", agentId2, {
24453
25378
  ...opts
24454
25379
  }), "logs"),
24455
- runs: /* @__PURE__ */ __name2((agentId) => ({
24456
- list: /* @__PURE__ */ __name2((opts = {}) => call2("runs.list", agentId, {
25380
+ runs: /* @__PURE__ */ __name2((agentId2) => ({
25381
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("runs.list", agentId2, {
24457
25382
  ...opts
24458
25383
  }), "list"),
24459
- get: /* @__PURE__ */ __name2((runId) => call2("runs.get", agentId, {
25384
+ get: /* @__PURE__ */ __name2((runId) => call2("runs.get", agentId2, {
24460
25385
  runId
24461
25386
  }), "get")
24462
25387
  }), "runs"),
24463
25388
  /** Read-only, and only the collections the org admin named on the supervision grant. */
24464
- data: /* @__PURE__ */ __name2((agentId) => ({
24465
- get: /* @__PURE__ */ __name2((collection, entryId) => call2("data.get", agentId, {
25389
+ data: /* @__PURE__ */ __name2((agentId2) => ({
25390
+ get: /* @__PURE__ */ __name2((collection, entryId) => call2("data.get", agentId2, {
24466
25391
  collection,
24467
25392
  entryId
24468
25393
  }), "get"),
24469
- query: /* @__PURE__ */ __name2((collection, filter, opts = {}) => call2("data.query", agentId, {
25394
+ query: /* @__PURE__ */ __name2((collection, filter, opts = {}) => call2("data.query", agentId2, {
24470
25395
  collection,
24471
25396
  ...filter ? {
24472
25397
  filter
@@ -24474,19 +25399,19 @@ function buildSupervisionAgentsApi(call2) {
24474
25399
  ...opts
24475
25400
  }), "query")
24476
25401
  }), "data"),
24477
- versions: /* @__PURE__ */ __name2((agentId) => ({
24478
- list: /* @__PURE__ */ __name2((opts = {}) => call2("versions.list", agentId, {
25402
+ versions: /* @__PURE__ */ __name2((agentId2) => ({
25403
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("versions.list", agentId2, {
24479
25404
  ...opts
24480
25405
  }), "list"),
24481
- get: /* @__PURE__ */ __name2((version) => call2("versions.get", agentId, {
25406
+ get: /* @__PURE__ */ __name2((version) => call2("versions.get", agentId2, {
24482
25407
  version
24483
25408
  }), "get"),
24484
- diff: /* @__PURE__ */ __name2((from, to) => call2("versions.diff", agentId, {
25409
+ diff: /* @__PURE__ */ __name2((from, to) => call2("versions.diff", agentId2, {
24485
25410
  from,
24486
25411
  to
24487
25412
  }), "diff"),
24488
25413
  /** Chat a staged version. No tools run unless `opts.toolScope.skillIds` allowlists them. */
24489
- preview: /* @__PURE__ */ __name2((version, prompt, opts = {}) => call2("versions.preview", agentId, {
25414
+ preview: /* @__PURE__ */ __name2((version, prompt, opts = {}) => call2("versions.preview", agentId2, {
24490
25415
  version,
24491
25416
  prompt,
24492
25417
  ...opts.toolScope ? {
@@ -24494,14 +25419,28 @@ function buildSupervisionAgentsApi(call2) {
24494
25419
  } : {}
24495
25420
  }), "preview"),
24496
25421
  /** Make `version` live. Compare-and-swap: refused unless `expectActive` is the live version. */
24497
- promote: /* @__PURE__ */ __name2(async (version, opts) => call2("versions.promote", agentId, {
25422
+ promote: /* @__PURE__ */ __name2(async (version, opts) => call2("versions.promote", agentId2, {
24498
25423
  version,
24499
25424
  expectActive: requireExpectActive(opts, "versions.promote")
24500
25425
  }), "promote"),
24501
25426
  /** Soft-delete a SUPERSEDED version (the active version and the last version are refused). */
24502
- delete: /* @__PURE__ */ __name2((version) => call2("versions.delete", agentId, {
25427
+ delete: /* @__PURE__ */ __name2((version) => call2("versions.delete", agentId2, {
24503
25428
  version
24504
25429
  }), "delete"),
25430
+ /**
25431
+ * WD — restore a previously-active, OLDER `version` (watchdog grant; last 7 days; only from a workflow step the
25432
+ * grant names). Compare-and-swap: `expectActive` is the active version number now (required, never null).
25433
+ */
25434
+ rollback: /* @__PURE__ */ __name2(async (version, opts) => {
25435
+ const expectActive = requireExpectActive(opts, "versions.rollback");
25436
+ if (expectActive === null) {
25437
+ throw typedError("supervision_expect_active_required", "versions.rollback requires { expectActive } \u2014 the active version number (a rollback needs one)");
25438
+ }
25439
+ return call2("versions.rollback", agentId2, {
25440
+ version,
25441
+ expectActive
25442
+ });
25443
+ }, "rollback"),
24505
25444
  // wave 2 U11
24506
25445
  /**
24507
25446
  * U11 (DOC2 §6.1) — open a TEST SESSION on staged `opts.version`: multi-turn `chat`, `fire`, `effects()` and
@@ -24509,20 +25448,30 @@ function buildSupervisionAgentsApi(call2) {
24509
25448
  * tools) and never gets `egress: 'live'`.
24510
25449
  */
24511
25450
  session: /* @__PURE__ */ __name2(async (opts) => {
24512
- const opened = await call2("versions.session", agentId, {
25451
+ const opened = await call2("versions.session", agentId2, {
24513
25452
  ...opts
24514
25453
  });
24515
- return buildTestSessionHandle(call2, agentId, opened);
25454
+ return buildTestSessionHandle(call2, agentId2, opened);
24516
25455
  }, "session")
24517
25456
  }), "versions"),
25457
+ /**
25458
+ * BAC-2011 — register a job pinned in a STAGED `versionId` of the target (`supervision:register-job`, only from a
25459
+ * workflow step the grant names). The job goes live with the ordinary promote of that version.
25460
+ */
25461
+ jobs: /* @__PURE__ */ __name2((agentId2) => ({
25462
+ register: /* @__PURE__ */ __name2((opts) => call2("jobs.register", agentId2, {
25463
+ versionId: opts?.versionId,
25464
+ jobId: opts?.jobId
25465
+ }), "register")
25466
+ }), "jobs"),
24518
25467
  /** Read (`observe`) and release (`release`) a workflow of a supervised agent. */
24519
- workflows: /* @__PURE__ */ __name2((agentId) => ({
25468
+ workflows: /* @__PURE__ */ __name2((agentId2) => ({
24520
25469
  /** One workflow: its live `activeVersionId` (deploy's `expectActive`) and its latest 20 versions. */
24521
- get: /* @__PURE__ */ __name2((workflowId) => call2("workflows.get", agentId, {
25470
+ get: /* @__PURE__ */ __name2((workflowId) => call2("workflows.get", agentId2, {
24522
25471
  workflowId
24523
25472
  }), "get"),
24524
25473
  /** Create workflow `name` (inert: inactive, no version) or answer the existing one: `{ workflowId, name, created }`. */
24525
- create: /* @__PURE__ */ __name2((name, opts = {}) => call2("workflows.create", agentId, {
25474
+ create: /* @__PURE__ */ __name2((name, opts = {}) => call2("workflows.create", agentId2, {
24526
25475
  name,
24527
25476
  ...opts?.description !== void 0 ? {
24528
25477
  description: opts.description
@@ -24532,52 +25481,65 @@ function buildSupervisionAgentsApi(call2) {
24532
25481
  } : {}
24533
25482
  }), "create"),
24534
25483
  /** Push a new, INACTIVE version (`activate` is always forced off; deploy it with `deploy`). */
24535
- push: /* @__PURE__ */ __name2((workflowId, definition) => call2("workflows.push", agentId, {
25484
+ push: /* @__PURE__ */ __name2((workflowId, definition) => call2("workflows.push", agentId2, {
24536
25485
  workflowId,
24537
25486
  definition: {
24538
25487
  ...definition
24539
25488
  }
24540
25489
  }), "push"),
24541
25490
  /** Publish workflow `version`. Compare-and-swap: refused unless `expectActive` is the live version id. */
24542
- deploy: /* @__PURE__ */ __name2(async (workflowId, version, opts) => call2("workflows.deploy", agentId, {
24543
- workflowId,
24544
- version,
24545
- expectActive: requireExpectActiveId(opts, "workflows.deploy")
24546
- }), "deploy")
25491
+ deploy: /* @__PURE__ */ __name2(async (workflowId, version, opts) => {
25492
+ const expectActive = requireExpectActiveId(opts, "workflows.deploy");
25493
+ const commitHash = optionalCommitHash(opts, "workflows.deploy");
25494
+ return call2("workflows.deploy", agentId2, {
25495
+ workflowId,
25496
+ version,
25497
+ expectActive,
25498
+ ...commitHash !== void 0 ? {
25499
+ commitHash
25500
+ } : {}
25501
+ });
25502
+ }, "deploy")
24547
25503
  }), "workflows"),
24548
- persona: /* @__PURE__ */ __name2((agentId) => ({
24549
- versions: /* @__PURE__ */ __name2(() => call2("persona.versions", agentId), "versions"),
25504
+ persona: /* @__PURE__ */ __name2((agentId2) => ({
25505
+ versions: /* @__PURE__ */ __name2(() => call2("persona.versions", agentId2), "versions"),
24550
25506
  /** Serve persona `version`. Compare-and-swap on the served persona version. */
24551
- activate: /* @__PURE__ */ __name2(async (version, opts) => call2("persona.activate", agentId, {
25507
+ activate: /* @__PURE__ */ __name2(async (version, opts) => call2("persona.activate", agentId2, {
24552
25508
  version,
24553
25509
  expectActive: requireExpectActive(opts, "persona.activate")
24554
25510
  }), "activate")
24555
25511
  }), "persona"),
24556
- source: /* @__PURE__ */ __name2((agentId) => ({
24557
- list: /* @__PURE__ */ __name2(() => call2("source.list", agentId), "list"),
24558
- get: /* @__PURE__ */ __name2((path3) => call2("source.get", agentId, {
25512
+ source: /* @__PURE__ */ __name2((agentId2) => ({
25513
+ list: /* @__PURE__ */ __name2(() => call2("source.list", agentId2), "list"),
25514
+ get: /* @__PURE__ */ __name2((path3) => call2("source.get", agentId2, {
24559
25515
  path: path3
24560
25516
  }), "get")
24561
25517
  }), "source"),
24562
25518
  /** Environment variable NAMES only — values are never returned. */
24563
- env: /* @__PURE__ */ __name2((agentId) => ({
24564
- keys: /* @__PURE__ */ __name2(() => call2("env.keys", agentId), "keys")
25519
+ env: /* @__PURE__ */ __name2((agentId2) => ({
25520
+ keys: /* @__PURE__ */ __name2(() => call2("env.keys", agentId2), "keys")
24565
25521
  }), "env"),
24566
25522
  /**
25523
+ * SV (LUA-1080) — what `agentId` serves RIGHT NOW: its live skills (with tools), the published persona and its
25524
+ * pre/postprocessors, each with the version id an agent version snapshot would pin. Works with no promoted agent
25525
+ * version, so a release can diff live against a staged version. Metadata and hashes only (`observe`).
25526
+ */
25527
+ deployed: /* @__PURE__ */ __name2((agentId2) => call2("primitives.deployed", agentId2), "deployed"),
25528
+ /**
24567
25529
  * U25 — supervision events of the target (`observe`): each event of a subscribed kind starts
24568
25530
  * one of the CALLER's own triggers (`triggerName`) with a `source: 'supervision'` body.
24569
25531
  */
24570
- events: /* @__PURE__ */ __name2((agentId) => ({
24571
- subscribe: /* @__PURE__ */ __name2((opts) => call2("events.subscribe", agentId, {
25532
+ events: /* @__PURE__ */ __name2((agentId2) => ({
25533
+ subscribe: /* @__PURE__ */ __name2((opts) => call2("events.subscribe", agentId2, {
24572
25534
  kinds: Array.isArray(opts?.kinds) ? [
24573
25535
  ...opts.kinds
24574
25536
  ] : opts?.kinds,
24575
25537
  triggerName: opts?.triggerName
24576
25538
  }), "subscribe"),
24577
- unsubscribe: /* @__PURE__ */ __name2((triggerName) => call2("events.unsubscribe", agentId, {
25539
+ unsubscribe: /* @__PURE__ */ __name2((triggerName) => call2("events.unsubscribe", agentId2, {
24578
25540
  triggerName
24579
25541
  }), "unsubscribe"),
24580
- list: /* @__PURE__ */ __name2(() => call2("events.list", agentId), "list")
25542
+ list: /* @__PURE__ */ __name2(() => call2("events.list", agentId2), "list")
24581
25543
  }), "events"),
24582
25544
  // wave 2 U1
24583
25545
  /**
@@ -24604,26 +25566,26 @@ function buildSupervisionAgentsApi(call2) {
24604
25566
  approval: approvalIdsOf(opts?.approval)
24605
25567
  }), "create"),
24606
25568
  // wave 2 U6 — the target's connections (`observe`): list, and READ catalogue checks only.
24607
- integrations: /* @__PURE__ */ __name2((agentId) => ({
24608
- list: /* @__PURE__ */ __name2(() => call2("integrations.list", agentId), "list"),
24609
- check: /* @__PURE__ */ __name2((connectionId, check) => call2("integrations.check", agentId, {
25569
+ integrations: /* @__PURE__ */ __name2((agentId2) => ({
25570
+ list: /* @__PURE__ */ __name2(() => call2("integrations.list", agentId2), "list"),
25571
+ check: /* @__PURE__ */ __name2((connectionId, check) => call2("integrations.check", agentId2, {
24610
25572
  connectionId,
24611
25573
  check
24612
25574
  }), "check")
24613
25575
  }), "integrations"),
24614
25576
  // wave 2 U30
24615
25577
  /** Recorded metrics of the target (`observe`): by `name` or `objectiveId`, bucketed `1h` / `1d`. */
24616
- metrics: /* @__PURE__ */ __name2((agentId) => ({
24617
- query: /* @__PURE__ */ __name2((q) => call2("metrics.query", agentId, {
25578
+ metrics: /* @__PURE__ */ __name2((agentId2) => ({
25579
+ query: /* @__PURE__ */ __name2((q) => call2("metrics.query", agentId2, {
24618
25580
  ...q
24619
25581
  }), "query")
24620
25582
  }), "metrics"),
24621
25583
  /** Objectives of the target: list (`observe`); propose (`act`) — never effective until the OWNER confirms. */
24622
- objectives: /* @__PURE__ */ __name2((agentId) => ({
24623
- list: /* @__PURE__ */ __name2((opts = {}) => call2("objectives.list", agentId, {
25584
+ objectives: /* @__PURE__ */ __name2((agentId2) => ({
25585
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("objectives.list", agentId2, {
24624
25586
  ...opts
24625
25587
  }), "list"),
24626
- propose: /* @__PURE__ */ __name2((proposal) => call2("objectives.propose", agentId, {
25588
+ propose: /* @__PURE__ */ __name2((proposal) => call2("objectives.propose", agentId2, {
24627
25589
  proposal
24628
25590
  }), "propose")
24629
25591
  }), "objectives"),
@@ -24633,13 +25595,13 @@ function buildSupervisionAgentsApi(call2) {
24633
25595
  * `lastAgentChangeAt`, so a supervisor can back off while a person is working on the agent;
24634
25596
  * `acquire` / `release` (`act`) take, renew or drop the CALLER's own lease (1-240 minutes).
24635
25597
  */
24636
- lease: /* @__PURE__ */ __name2((agentId) => ({
24637
- get: /* @__PURE__ */ __name2(() => call2("lease.get", agentId), "get"),
24638
- acquire: /* @__PURE__ */ __name2((opts) => call2("lease.acquire", agentId, {
25598
+ lease: /* @__PURE__ */ __name2((agentId2) => ({
25599
+ get: /* @__PURE__ */ __name2(() => call2("lease.get", agentId2), "get"),
25600
+ acquire: /* @__PURE__ */ __name2((opts) => call2("lease.acquire", agentId2, {
24639
25601
  ttlMinutes: opts?.ttlMinutes,
24640
25602
  reason: opts?.reason
24641
25603
  }), "acquire"),
24642
- release: /* @__PURE__ */ __name2(() => call2("lease.release", agentId), "release")
25604
+ release: /* @__PURE__ */ __name2(() => call2("lease.release", agentId2), "release")
24643
25605
  }), "lease"),
24644
25606
  // wave 2 U4b
24645
25607
  /**
@@ -24648,15 +25610,15 @@ function buildSupervisionAgentsApi(call2) {
24648
25610
  * and revoke grants on it; external records are kept. `delete` also needs the agent's exact current name and
24649
25611
  * ends the 30-day restore window.
24650
25612
  */
24651
- lifecycle: /* @__PURE__ */ __name2((agentId) => ({
24652
- archive: /* @__PURE__ */ __name2(() => call2("lifecycle.archive", agentId), "archive"),
24653
- delete: /* @__PURE__ */ __name2((opts) => call2("lifecycle.delete", agentId, {
25613
+ lifecycle: /* @__PURE__ */ __name2((agentId2) => ({
25614
+ archive: /* @__PURE__ */ __name2(() => call2("lifecycle.archive", agentId2), "archive"),
25615
+ delete: /* @__PURE__ */ __name2((opts) => call2("lifecycle.delete", agentId2, {
24654
25616
  confirmName: opts?.confirmName
24655
25617
  }), "delete")
24656
25618
  }), "lifecycle"),
24657
25619
  /** U4b — set the model, the name or NON-secret env keys (`act`); keys ending SECRET/TOKEN/KEY/PASSWORD refuse. */
24658
- config: /* @__PURE__ */ __name2((agentId) => ({
24659
- set: /* @__PURE__ */ __name2((input) => call2("config.set", agentId, {
25620
+ config: /* @__PURE__ */ __name2((agentId2) => ({
25621
+ set: /* @__PURE__ */ __name2((input) => call2("config.set", agentId2, {
24660
25622
  ...input?.model !== void 0 ? {
24661
25623
  model: input.model
24662
25624
  } : {},
@@ -24679,7 +25641,7 @@ function buildSupervisionAgentsApi(call2) {
24679
25641
  * `dataCollections`, and `notifyOwner` (the owner opts in to `notifyOwner` messages by approving it). When the
24680
25642
  * caller already holds a grant, the request upgrades it and the approver sees exactly what is added.
24681
25643
  */
24682
- requestAccess: /* @__PURE__ */ __name2((agentId, opts) => call2("access.request", agentId, {
25644
+ requestAccess: /* @__PURE__ */ __name2((agentId2, opts) => call2("access.request", agentId2, {
24683
25645
  actions: Array.isArray(opts?.actions) ? [
24684
25646
  ...opts.actions
24685
25647
  ] : opts?.actions,
@@ -24712,15 +25674,15 @@ function buildSupervisionAgentsApi(call2) {
24712
25674
  * `'active'` — against a suite the owner defined (needs `supervision:preview` and the preview switch); results
24713
25675
  * are `observe`, transcripts (message bodies) need `observe-content`. `cancel` stops only runs you started.
24714
25676
  */
24715
- evals: /* @__PURE__ */ __name2((agentId) => ({
25677
+ evals: /* @__PURE__ */ __name2((agentId2) => ({
24716
25678
  /** The target's suites (key, revision, case count, pass rate). */
24717
- suites: /* @__PURE__ */ __name2(() => call2("evals.suites.get", agentId, {}), "suites"),
25679
+ suites: /* @__PURE__ */ __name2(() => call2("evals.suites.get", agentId2, {}), "suites"),
24718
25680
  /** One suite with its parsed cases. */
24719
- suite: /* @__PURE__ */ __name2((key) => call2("evals.suites.get", agentId, {
25681
+ suite: /* @__PURE__ */ __name2((key) => call2("evals.suites.get", agentId2, {
24720
25682
  key
24721
25683
  }), "suite"),
24722
25684
  /** Start a run: `{ runId, estimate }`. Bounded by the suite budget, the agent's monthly cap and a daily cap. */
24723
- run: /* @__PURE__ */ __name2((opts) => call2("evals.run", agentId, {
25685
+ run: /* @__PURE__ */ __name2((opts) => call2("evals.run", agentId2, {
24724
25686
  suite: opts?.suite,
24725
25687
  version: opts?.version,
24726
25688
  ...opts?.maxCredits !== void 0 ? {
@@ -24731,20 +25693,20 @@ function buildSupervisionAgentsApi(call2) {
24731
25693
  } : {}
24732
25694
  }), "run"),
24733
25695
  /** Runs, newest first (`suite`, `version`, `status`, `limit` ≤ 50, `before`). */
24734
- runs: /* @__PURE__ */ __name2((opts = {}) => call2("evals.get", agentId, {
25696
+ runs: /* @__PURE__ */ __name2((opts = {}) => call2("evals.get", agentId2, {
24735
25697
  ...opts
24736
25698
  }), "runs"),
24737
25699
  /** One run with its per-case results (check detail and judge reasoning only with observe-content). */
24738
- getRun: /* @__PURE__ */ __name2((runId) => call2("evals.get", agentId, {
25700
+ getRun: /* @__PURE__ */ __name2((runId) => call2("evals.get", agentId2, {
24739
25701
  runId
24740
25702
  }), "getRun"),
24741
25703
  /** One case's transcript (needs observe-content; a holdout case is not found). */
24742
- transcript: /* @__PURE__ */ __name2((runId, caseId) => call2("evals.get", agentId, {
25704
+ transcript: /* @__PURE__ */ __name2((runId, caseId) => call2("evals.get", agentId2, {
24743
25705
  runId,
24744
25706
  caseId
24745
25707
  }), "transcript"),
24746
25708
  /** Cancel a queued or running run YOU started (works with the preview switch off). */
24747
- cancel: /* @__PURE__ */ __name2((runId) => call2("evals.cancel", agentId, {
25709
+ cancel: /* @__PURE__ */ __name2((runId) => call2("evals.cancel", agentId2, {
24748
25710
  runId
24749
25711
  }), "cancel")
24750
25712
  }), "evals"),
@@ -24756,7 +25718,7 @@ function buildSupervisionAgentsApi(call2) {
24756
25718
  * An optional `idempotencyKey` makes a retry answer the first call's receipt instead of posting again; it is
24757
25719
  * forwarded only when present, so a keyless call sends exactly `{ message }`.
24758
25720
  */
24759
- notifyOwner: /* @__PURE__ */ __name2((agentId, input) => call2("owner.notify", agentId, {
25721
+ notifyOwner: /* @__PURE__ */ __name2((agentId2, input) => call2("owner.notify", agentId2, {
24760
25722
  message: input?.message,
24761
25723
  ...input?.idempotencyKey !== void 0 ? {
24762
25724
  idempotencyKey: input.idempotencyKey
@@ -24771,8 +25733,8 @@ function buildSupervisionAgentsApi(call2) {
24771
25733
  * exactly `Give your <integration> connection to "<agentName>"?`, then call this from a code step of THAT run with
24772
25734
  * `{ approval: { runId, stepId } }`. Needs an `act` grant on the agent.
24773
25735
  */
24774
- connections: /* @__PURE__ */ __name2((agentId) => ({
24775
- assign: /* @__PURE__ */ __name2((connectionId, opts) => call2("connections.assign", agentId, {
25736
+ connections: /* @__PURE__ */ __name2((agentId2) => ({
25737
+ assign: /* @__PURE__ */ __name2((connectionId, opts) => call2("connections.assign", agentId2, {
24776
25738
  connectionId,
24777
25739
  approval: opts?.approval && typeof opts.approval === "object" ? {
24778
25740
  ...opts.approval
@@ -24784,8 +25746,8 @@ function buildSupervisionAgentsApi(call2) {
24784
25746
  * Attach requests held for `agentId` to its env (`act`, on the agent owner's own turn; never overwrites a key).
24785
25747
  * Answers the env keys set, never a value.
24786
25748
  */
24787
- secrets: /* @__PURE__ */ __name2((agentId) => ({
24788
- attach: /* @__PURE__ */ __name2((requestIds) => call2("secrets.attach", agentId, {
25749
+ secrets: /* @__PURE__ */ __name2((agentId2) => ({
25750
+ attach: /* @__PURE__ */ __name2((requestIds) => call2("secrets.attach", agentId2, {
24789
25751
  requestIds: copyList(requestIds)
24790
25752
  }), "attach")
24791
25753
  }), "secrets")
@@ -24800,14 +25762,14 @@ function copyList(value3) {
24800
25762
  }
24801
25763
  __name(copyList, "copyList");
24802
25764
  __name2(copyList, "copyList");
24803
- function buildTestSessionHandle(call2, agentId, opened) {
25765
+ function buildTestSessionHandle(call2, agentId2, opened) {
24804
25766
  const sessionId = opened?.id;
24805
25767
  return {
24806
25768
  sessionId,
24807
25769
  version: opened?.version,
24808
25770
  session: opened,
24809
25771
  /** One multi-turn chat turn (same thread unless `threadId` names another key). */
24810
- chat: /* @__PURE__ */ __name2((input) => call2("sessions.chat", agentId, {
25772
+ chat: /* @__PURE__ */ __name2((input) => call2("sessions.chat", agentId2, {
24811
25773
  sessionId,
24812
25774
  ...typeof input === "string" ? {
24813
25775
  prompt: input
@@ -24816,16 +25778,16 @@ function buildTestSessionHandle(call2, agentId, opened) {
24816
25778
  }
24817
25779
  }), "chat"),
24818
25780
  /** Fire one primitive against the staged version: `{ trigger, payload }` in this phase. */
24819
- fire: /* @__PURE__ */ __name2((input) => call2("sessions.fire", agentId, {
25781
+ fire: /* @__PURE__ */ __name2((input) => call2("sessions.fire", agentId2, {
24820
25782
  sessionId,
24821
25783
  ...input
24822
25784
  }), "fire"),
24823
25785
  /** The effects the session recorded instead of executing. */
24824
- effects: /* @__PURE__ */ __name2(() => call2("sessions.effects", agentId, {
25786
+ effects: /* @__PURE__ */ __name2(() => call2("sessions.effects", agentId2, {
24825
25787
  sessionId
24826
25788
  }), "effects"),
24827
25789
  /** Close: purges the session's shadow Data and recorded effects. */
24828
- close: /* @__PURE__ */ __name2(() => call2("sessions.close", agentId, {
25790
+ close: /* @__PURE__ */ __name2(() => call2("sessions.close", agentId2, {
24829
25791
  sessionId
24830
25792
  }), "close")
24831
25793
  };
@@ -25344,7 +26306,7 @@ var LuaMCPServer = class {
25344
26306
  throw new Error("MCP server name is required");
25345
26307
  }
25346
26308
  if (config.transport === "stdio") {
25347
- 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.`);
26309
+ 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.`);
25348
26310
  }
25349
26311
  if ((config.transport === "sse" || config.transport === "streamable-http") && !config.url) {
25350
26312
  throw new Error(`URL is required for ${config.transport} transport`);
@@ -25788,20 +26750,20 @@ init_order_instance();
25788
26750
 
25789
26751
  // src/api/threads.offline.ts
25790
26752
  init_dist();
25791
- function unavailable2(member) {
26753
+ function unavailable(member) {
25792
26754
  return Object.assign(new Error(`Threads.${member} only runs on the Lua platform (deployed or sandbox agents), not in lua test / lua dev`), {
25793
26755
  name: "ThreadFollowUpError",
25794
26756
  code: THREAD_FOLLOW_UP_ERRORS.UNAVAILABLE
25795
26757
  });
25796
26758
  }
25797
- __name(unavailable2, "unavailable");
26759
+ __name(unavailable, "unavailable");
25798
26760
  function createOfflineThreadsApi() {
25799
26761
  return {
25800
26762
  open: /* @__PURE__ */ __name(async () => {
25801
- throw unavailable2("open");
26763
+ throw unavailable("open");
25802
26764
  }, "open"),
25803
26765
  followUp: /* @__PURE__ */ __name(async () => {
25804
- throw unavailable2("followUp");
26766
+ throw unavailable("followUp");
25805
26767
  }, "followUp")
25806
26768
  };
25807
26769
  }
@@ -26460,7 +27422,14 @@ var Agents = {
26460
27422
  const { getAgentsInstance: getAgentsInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
26461
27423
  const agents = await getAgentsInstance2();
26462
27424
  return agents.superviseForSandbox(op, targetAgentId, args);
26463
- })
27425
+ }),
27426
+ jobs: /* @__PURE__ */ __name((agentId2) => ({
27427
+ register: /* @__PURE__ */ __name(async (input) => {
27428
+ const { getAgentsInstance: getAgentsInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
27429
+ const agents = await getAgentsInstance2();
27430
+ return agents.registerJobForSandbox(agentId2, input);
27431
+ }, "register")
27432
+ }), "jobs")
26464
27433
  };
26465
27434
  var Voice = {
26466
27435
  async call(input) {