lua-cli 3.45.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,8 +157,8 @@ function isUnsafeConnectionPathPart(pathPart) {
156
157
  function isPlatformInvocationCaller(v) {
157
158
  return typeof v === "string" && PLATFORM_INVOCATION_CALLERS.includes(v);
158
159
  }
159
- function supervisionSubjectId(agentId) {
160
- return `agent:${agentId}`;
160
+ function supervisionSubjectId(agentId2) {
161
+ return `agent:${agentId2}`;
161
162
  }
162
163
  function isSupervisionOp(op) {
163
164
  return typeof op === "string" && Object.prototype.hasOwnProperty.call(SUPERVISION_OPS, op);
@@ -851,9 +852,9 @@ function isAgentConnectionBindingLoosening(previous, next) {
851
852
  function isAgentConnectionMountMode(value3) {
852
853
  return typeof value3 === "string" && AGENT_CONNECTION_MOUNT_MODES.includes(value3);
853
854
  }
854
- function agentConnectionBindingFor(bindings, agentId) {
855
- if (!Array.isArray(bindings) || !agentId) return void 0;
856
- return bindings.find((entry) => !!entry && typeof entry === "object" && entry.agentId === agentId);
855
+ function agentConnectionBindingFor(bindings, agentId2) {
856
+ if (!Array.isArray(bindings) || !agentId2) return void 0;
857
+ return bindings.find((entry) => !!entry && typeof entry === "object" && entry.agentId === agentId2);
857
858
  }
858
859
  function agentConnectionBindingRefusal(binding, operation) {
859
860
  if (binding === void 0 || binding === null) return null;
@@ -1136,8 +1137,8 @@ function describeConnectionRequest(input) {
1136
1137
  return `Something went wrong connecting ${what}. Ask ${who} to try again with a new request.`;
1137
1138
  }
1138
1139
  }
1139
- function operationDailyCapKey(agentId, connectionId, currency, utcDay) {
1140
- return `opcap:${agentId}:${connectionId}:${currency.toUpperCase()}:${utcDay}`;
1140
+ function operationDailyCapKey(agentId2, connectionId, currency, utcDay) {
1141
+ return `opcap:${agentId2}:${connectionId}:${currency.toUpperCase()}:${utcDay}`;
1141
1142
  }
1142
1143
  function isPlainObject(value3) {
1143
1144
  return typeof value3 === "object" && value3 !== null && !Array.isArray(value3);
@@ -1163,7 +1164,7 @@ function parseCapAmount(value3) {
1163
1164
  if (typeof value3 !== "number" || !Number.isFinite(value3) || value3 < 0) return null;
1164
1165
  return value3;
1165
1166
  }
1166
- function parseAgentConnectionOperationLimits(agentId, value3) {
1167
+ function parseAgentConnectionOperationLimits(agentId2, value3) {
1167
1168
  if (!isPlainObject(value3)) return {
1168
1169
  ok: false,
1169
1170
  error: "limits must be an object"
@@ -1176,7 +1177,7 @@ function parseAgentConnectionOperationLimits(agentId, value3) {
1176
1177
  };
1177
1178
  }
1178
1179
  const limits = {
1179
- agentId
1180
+ agentId: agentId2
1180
1181
  };
1181
1182
  if (value3.caps !== void 0 && value3.caps !== null) {
1182
1183
  const caps = value3.caps;
@@ -1262,17 +1263,17 @@ function parseAgentConnectionOperationLimits(agentId, value3) {
1262
1263
  limits
1263
1264
  };
1264
1265
  }
1265
- function findAgentConnectionOperationLimits(stored, agentId) {
1266
- if (!agentId || stored === void 0 || stored === null) return void 0;
1266
+ function findAgentConnectionOperationLimits(stored, agentId2) {
1267
+ if (!agentId2 || stored === void 0 || stored === null) return void 0;
1267
1268
  if (!Array.isArray(stored)) return {
1268
- agentId,
1269
+ agentId: agentId2,
1269
1270
  unreadable: true
1270
1271
  };
1271
- const entry = stored.find((row) => isPlainObject(row) && row.agentId === agentId);
1272
+ const entry = stored.find((row) => isPlainObject(row) && row.agentId === agentId2);
1272
1273
  if (!entry) return void 0;
1273
- const parsed = parseAgentConnectionOperationLimits(agentId, entry);
1274
+ const parsed = parseAgentConnectionOperationLimits(agentId2, entry);
1274
1275
  return parsed.ok ? parsed.limits : {
1275
- agentId,
1276
+ agentId: agentId2,
1276
1277
  unreadable: true
1277
1278
  };
1278
1279
  }
@@ -1784,9 +1785,9 @@ function isEvalReservedDoubleId(double) {
1784
1785
  function evalCaseThreadId(runId, caseId) {
1785
1786
  return `evalrun:${runId}:${caseId}`;
1786
1787
  }
1787
- function evalMonthlyCapKey(agentId, at = /* @__PURE__ */ new Date()) {
1788
+ function evalMonthlyCapKey(agentId2, at = /* @__PURE__ */ new Date()) {
1788
1789
  const yyyymm = `${at.getUTCFullYear()}${String(at.getUTCMonth() + 1).padStart(2, "0")}`;
1789
- return `evalcap:${agentId}:${yyyymm}`;
1790
+ return `evalcap:${agentId2}:${yyyymm}`;
1790
1791
  }
1791
1792
  function isUnprovenUserSite(site) {
1792
1793
  return typeof site === "string" && (site === "job" || site === "workflow" || site.startsWith("workflow-"));
@@ -1855,8 +1856,8 @@ function hasFormatCharacters(text) {
1855
1856
  function normalizedHandoverName(name) {
1856
1857
  return oneLine(name.normalize("NFKC")).toLowerCase();
1857
1858
  }
1858
- function handoverAgentIdSuffix(agentId) {
1859
- return agentId.slice(-6);
1859
+ function handoverAgentIdSuffix(agentId2) {
1860
+ return agentId2.slice(-6);
1860
1861
  }
1861
1862
  function parseConnectionHandoverApprovalPayload(payload) {
1862
1863
  if (!payload || typeof payload !== "object" || Array.isArray(payload)) return null;
@@ -2148,11 +2149,11 @@ function parseThreadFollowUpInput(input) {
2148
2149
  } : {}
2149
2150
  };
2150
2151
  }
2151
- function threadFollowUpRateKeys(agentId, threadId, nowMs) {
2152
+ function threadFollowUpRateKeys(agentId2, threadId, nowMs) {
2152
2153
  const hour = Math.floor(nowMs / 36e5);
2153
2154
  return {
2154
- perThread: `thread-followup:${agentId}:${threadId}:${hour}`,
2155
- perAgent: `thread-followup:${agentId}:${hour}`
2155
+ perThread: `thread-followup:${agentId2}:${threadId}:${hour}`,
2156
+ perAgent: `thread-followup:${agentId2}:${hour}`
2156
2157
  };
2157
2158
  }
2158
2159
  function progressFractionToPercent(fraction) {
@@ -4731,8 +4732,8 @@ function scheduleHealthView(health, state3) {
4731
4732
  } : {}
4732
4733
  };
4733
4734
  }
4734
- function scheduleHealthSourceId(agentId, jobId) {
4735
- return `schedule-health:${agentId}:${jobId}`;
4735
+ function scheduleHealthSourceId(agentId2, jobId) {
4736
+ return `schedule-health:${agentId2}:${jobId}`;
4736
4737
  }
4737
4738
  function workflowGoalJudgeKind(judge) {
4738
4739
  return judge && typeof judge === "object" && judge.predicate !== void 0 ? "predicate" : "agent";
@@ -5401,7 +5402,7 @@ function evidenceDays(from, to) {
5401
5402
  return out;
5402
5403
  }
5403
5404
  function summarizeEvidence(input) {
5404
- const { agentId, from, to } = input;
5405
+ const { agentId: agentId2, from, to } = input;
5405
5406
  const windowDays = evidenceDays(from, to);
5406
5407
  const readable = /* @__PURE__ */ __name3((s) => s === "ok" || s === "empty", "readable");
5407
5408
  const covered = /* @__PURE__ */ __name3((d) => readable(d.sources?.messages) && readable(d.sources?.analyses), "covered");
@@ -5475,7 +5476,7 @@ function summarizeEvidence(input) {
5475
5476
  const short = wordRows.reduce((a, h) => a + h.short, 0);
5476
5477
  const long = wordRows.reduce((a, h) => a + h.long, 0);
5477
5478
  return {
5478
- agentId,
5479
+ agentId: agentId2,
5479
5480
  window: {
5480
5481
  from,
5481
5482
  to,
@@ -6033,7 +6034,7 @@ function classifyConnectionOperation(op) {
6033
6034
  return NOT_SEND;
6034
6035
  }
6035
6036
  function connectionSendPolicyIsActive(policy) {
6036
- return Boolean(policy) && (policy.allowSend === false || Array.isArray(policy.recipientAllowlist));
6037
+ return !!policy && (policy.allowSend === false || Array.isArray(policy.recipientAllowlist));
6037
6038
  }
6038
6039
  function allowlistAdmits(entries, email) {
6039
6040
  const domain = email.slice(email.lastIndexOf("@") + 1);
@@ -6063,8 +6064,9 @@ function evaluateConnectionSendPolicy(policy, op) {
6063
6064
  classification
6064
6065
  };
6065
6066
  }
6066
- if (Array.isArray(policy.recipientAllowlist)) {
6067
- 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));
6068
6070
  if (denied.length > 0 || classification.recipientsUnknown) {
6069
6071
  return {
6070
6072
  allowed: false,
@@ -6106,7 +6108,111 @@ function isPaymentRequiredChatErrorEnvelope(data) {
6106
6108
  if (d.type !== "error") return false;
6107
6109
  return d.textDelta === BILLING_REJECTION_TEXT_CREDITS || d.textDelta === BILLING_REJECTION_TEXT_SEAT || d.textDelta === BILLING_REJECTION_TEXT_USER_QUOTA;
6108
6110
  }
6109
- var __defProp3, __name3, PLUMBING_THREAD_CHANNELS, CHANNEL_CONVERSATION_CHANNELS, HIDDEN_THREAD_CHANNELS, CHOICE_PERSON_TURN_CHANNELS, CHOICE_REPLAY_CLIENT_CAPABILITIES, CHOICE_REPLAY_CLIENT_SURFACES, INTEGRATION_PASSTHROUGH_READ_METHODS, URL_REINTERPRETED_PATH_CHARACTERS, PERCENT_ENCODED_DOT, PERCENT_ESCAPE, DECODED_PATH_SEPARATORS, DECODED_LEADING_SEPARATOR, MAX_PERCENT_DECODE_ROUNDS, URL_RESOLUTION_PROBE_BASE, PLATFORM_INVOCATION_CALLERS, SUPERVISION_OPS, SUPERVISION_OPS_WAVE2, SUPERVISION_WATCHDOG_OPS, SUPERVISION_WATCHDOG_ERRORS, SUPERVISION_ROLLBACK_REFUSAL_CODES, SUPERVISION_ROLLBACK_LINEAGE_MAX, SUPERVISION_UNTARGETED_OPS, SUPERVISED_WORKFLOW_VERSIONS_MAX, SUPERVISION_EVENT_KINDS, AGENT_PROVISIONING_LIMITS, AGENT_PROVISIONING_APPROVAL_PAYLOAD_KEY, AGENT_PROVISIONING_ERRORS, PROVISIONED_SUPERVISION_ACTIONS, isNonEmptyString, uniqueStrings, sameSet, AGENT_PROVISIONING_APPROVAL_CARD_MAX_CHARS, APPROVAL_PAYLOAD_MEMBERS, AGENT_CONNECTION_POLICIES, AGENT_CONNECTION_POLICY_DEFAULT, AGENT_CONNECTION_MOUNT_MODES, AGENT_CONNECTION_GOVERNANCE_ERRORS, AGENT_CONNECTION_OPERATION_RULES_MAX, AGENT_CONNECTION_OPERATION_PATTERN_MAX_LENGTH, OPERATION_RULE_METHODS, PATH_SEPARATOR, PATH_SINGLE_SEGMENT_WILDCARD, PATH_REST_WILDCARD, METHOD_OVERRIDE_HEADER_NAMES, METHOD_OVERRIDE_QUERY_NAMES, ODATA_BATCH_SEGMENT, GOOGLE_BATCH_FIRST_SEGMENT, CONNECTION_CHECK_RESULTS, CONNECTION_CHECK_CATALOGUE_V1, CONNECTION_CHECK_NAME_PATTERN, CONNECTION_CHECK_NAME_MAX, CONNECT_OUTCOME_STATUSES, SECRET_TEST_RESULTS, SECRET_DATADOG_REGIONS, SECRET_PROVIDER_CATALOGUE_V1, SECRET_TEST_MAX_RESPONSE_BYTES, SECRET_ENV_KEY_PATTERN, SECRET_REQUEST_ERRORS, SECRET_OUTCOME_STATUSES, CLIENT_OUTCOME_TURNS_MAX, SHORT_TEXT_MAX, SLUG_MAX, shortText, optionalShortText, CONNECTION_REQUEST_TERMINAL_STATES, CONNECTION_USE_ORIGINS, AGENT_CONNECTION_OPERATION_LIMITS_BOUNDS, CURRENCY_CODE, LIMITS_KEYS, CAPS_KEYS, EXCLUSIONS_KEYS, EMAIL_IN_TEXT, MAX_EXCLUSION_DEPTH, PROJECTION_PARAMETER_KEYS, CHANNEL_PARAMETER_KEYS, GMAIL_SYSTEM_LABEL_IDS, ZERO_DECIMAL_CURRENCIES, THREE_DECIMAL_CURRENCIES, DECIMAL_AMOUNT, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, TEST_SESSION_ID_PATTERN, TEST_SESSION_COLLECTION_PREFIX, TEST_EFFECT_BODY_MAX_BYTES, TEST_EFFECT_DROPPED_HEADERS, EVAL_CREDITS_PER_1K_TOKENS, EVAL_RESERVED_TOOL_ID_PREFIXES, CONNECTION_HANDOVER_APPROVAL_PAYLOAD_KEY, CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS, CONNECTION_HANDOVER_LIMITS, MEMBERS, FORMAT_CHARS, oneLine, boundedString, AGENT_METRIC_NAME_PATTERN, AGENT_METRIC_LIMITS, AGENT_OBJECTIVE_ERRORS, CHANGE_LEASE_TTL_MINUTES_MIN, CHANGE_LEASE_TTL_MINUTES_MAX, CHANGE_LEASE_REASON_MAX, CHANGE_LEASE_ERRORS, AGENT_CONFIG_SET_LIMITS, SECRET_ENV_KEY_SUFFIXES, DEFAULT_OWNER_DEPARTURE_POLICY, AGENT_LIFECYCLE_ERRORS, USER_COST_COUNTER_TTL_SECONDS, USER_COST_ATTRIBUTION_CHANNELS, CALLER_DEDUPE_KEY_MAX, FOLLOW_UP_IDEMPOTENCY_TTL_SECONDS, THREAD_FOLLOW_UP_LIMITS, THREAD_FOLLOW_UP_ERRORS, PROGRESS_UPDATE_LIMITS, PAUSABLE_CAPABILITY_KINDS, UNIFIED_CATCH_UP_MAX_WINDOW_HOURS, UNIFIED_CATCH_UP_EVENTS, UNIFIED_CATCH_UP_FILTERABLE_OBJECT_TYPES, AGENT_NEVER_RULES_MAX, AGENT_NEVER_RULE_FIELD_MAX, AGENT_NEVER_RULE_INPUT_MATCH_MAX, NEVER_RULE_ID_PATTERN, NEVER_RULE_HTTP_METHODS, TEMPLATE_DISTRIBUTION_MODES, CHANNEL_SEND_CHANNELS, TAKEOVER_MAX_IDLE_MINUTES, MINUTES_PER_DAY, DEFAULT_IDLE_RELEASE_MINUTES, FALLBACK_IDLE_RELEASE_MINUTES, VARIATION_SELECTORS, SLACK_EMOJI_NAMES, SLACK_SHORTCODE, PLAIN_EMAIL_ADDRESS, DOMAIN, UNSAFE_TEXT, SLACK_CONVERSATION_ID, CHANNEL_SETTING_GROUPS, THREAD_SCOPING_NOUN, TAKEOVER_CHANNEL_TYPES, EMAIL_SETTINGS, SLACK_SETTING_DEFAULTS, SLACK_REACTION_MAX, SLACK_INTRO_MAX, SLACK_EXAMPLE_PROMPTS_MAX, SLACK_EXAMPLE_PROMPT_MAX, SLACK_SUPPORT_CONTACT_MAX, SLACK_SETTINGS, CHANNEL_SETTINGS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, LOG_FIELDS_MAX_KEYS, LOG_FIELD_MAX_VALUE_BYTES, LOG_FIELDS_MAX_BYTES, LOG_FIELD_KEY_PATTERN, LOG_FIELD_SECRET_SHAPED_KEY_PATTERNS, LOG_FIELDS_CLAMPED_KEY, LOG_FIELD_ARRAY_COUNT_SUFFIX, LuaLogFieldsError, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_MODEL_CLASSES, WORKFLOW_DEFAULT_TASK_CLASS_MAP, WORKFLOW_MODELS_MAX_CLASS_DEFAULT, WORKFLOW_AUTONOMY_NUMERIC_KEYS, WORKFLOW_AUTONOMY_ENVELOPE_KEYS, WORKFLOW_AUTONOMY_DEFAULTS, WORKFLOW_AUTONOMY_CEILINGS, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_ENV, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_CEILING, WORKFLOW_AUTONOMY_FORMS_DEFAULT, WORKFLOW_AUTONOMY_MIN_VALUE, WORKFLOW_JOB_RANGES, WORKFLOW_JOB_RANGE_MEMBERS, WORKFLOW_SINGLE_STEP_TYPES, WORKFLOW_HITL_ENTRY_TYPES, WORKFLOW_ARM_ENTRY_TYPES, WORKFLOW_HITL_ARM_CONTAINERS, WORKFLOW_GRAPH_ENTRY_STEP_KINDS, WORKFLOW_ARM_ENTRY_STEP_KINDS, WORKFLOW_BUDGET_MAX_DURATION_SECONDS, MODEL_ID_BYOK_PROVIDERS, MODEL_CLASS_REF_PREFIX, MODEL_SNAPSHOT_SUFFIX, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, AGENT_LOG_SOURCES, AGENT_LOG_FIELDS_MAX_WIRE_KEYS, LOG_DRAIN_TYPES_PHASE1, LOG_DRAIN_TYPES_PHASE2, LOG_DRAIN_TYPES_IMPLEMENTED, LOG_DRAIN_SOURCES, LOG_DRAIN_MAX_PER_ORG, LOG_DRAIN_MAX_PER_ORG_ENTERPRISE, LOG_DRAIN_DATADOG_SITES, LOG_DRAIN_NEWRELIC_SITES, LOG_DRAIN_ENDPOINT_TEMPLATES, LOG_DRAIN_PRESET_SITES, LOG_DRAIN_BUCKET_NAME_PATTERN, LOG_DRAIN_BUCKET_HOST_PATTERNS, LOG_DRAIN_PRESET_HOST_SUFFIXES, DRAIN_CONTENT_ACK_ERROR_CODE, DRAIN_CONTENT_ACK_FIELD, DrainContentAckRequiredError, LOG_DRAIN_PRESET_PATHS, PRESET_SEGMENT_RE, LOG_DRAIN_QUOTAS, LOG_DRAIN_QUOTA_WARN_RATIO, LOG_DRAIN_QUOTA_DROP_DEBUG_RATIO, LOG_DRAIN_QUOTA_DROP_INFO_RATIO, LOG_DRAIN_QUOTA_PAUSE_RATIO, LOG_EXPORT_SOURCES, LOG_EXPORT_MAX_WINDOW_DAYS, LOG_EXPORT_MAX_WINDOW_MS, LOG_EXPORT_URL_TTL_SECONDS, LOG_EXPORT_FILE_RETENTION_DAYS, LOG_EXPORT_FILE_RETENTION_MS, LOG_EXPORT_PART_MAX_BYTES, LOG_DRAIN_NOTICE_RATE_LIMIT_MS, LOG_DRAIN_VERIFICATION_STALE_MS, LOG_DRAIN_DIGEST_INTERVAL_MS, LOG_DRAIN_DIGEST_MAX_ENTRIES, LOG_DRAIN_NOTICE_ERROR_MAX_CHARS, LOG_DRAIN_USAGE_LINE_ITEM, LOG_DRAIN_BYTES_PER_GIB, DEFAULT_LOG_DRAIN_PLAN_CONFIG, TIERS, LOG_CURSOR_MAX_LENGTH, LOG_CURSOR_MAX_ID_LENGTH, LOG_RELATIVE_TIME_PATTERN, LOG_ISO_TIME_PATTERN, RELATIVE_UNIT_MS, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, KEYS, MAX_BODY_BYTES, MAX_ID_LENGTH, UTC_ISO, TEMPLATE_TRIGGER_URL_ENV_PREFIX, TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, LUA_SESSION_ID_CLAIM, SESSION_REVOKED_CODE, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_RUN_GATE_KINDS, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, WORKFLOW_SIGNAL_EVENT_SITES, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_AGENT_APP_CONNECTION_PREFIX, WORKFLOW_JOB_MODEL_SOURCE_LABELS, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_SIGNAL_NAME_RE, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, SCHEDULE_HEALTH_NOTIFY_CHANNELS, SCHEDULE_HEALTH_DEFAULT_NOTIFY, SCHEDULE_HEALTH_LIMITS, KNOWN_KEYS, WORKFLOW_GOAL_JUDGE_SELF, APPROVAL_ARGS_MAX_CHARS, APPROVAL_ARG_STRING_MAX_CHARS, APPROVAL_ARGS_SUMMARY_MAX_CHARS, MAX_DEPTH, MAX_KEYS, MAX_ITEMS, MAX_NODES, MAX_KEY_CHARS, KEY_SCRUB_INPUT_MAX_CHARS, STRING_SCRUB_INPUT_MAX_CHARS, ELLIPSIS, SKIP, SCRUB_SECRETS_BEFORE_PERSIST_ENV, PERSIST_SCRUB_MAX_CHARS, PERSIST_SCRUB_REF_MAX_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES, SUBAGENT_PER_KEY_FLAG_ENV, PER_KEY_FLAG_VALUES, ONBOARDING_FLOW_KEY, ONBOARDING_SCHEMA_VERSION, id, copy, onboardingHeadingSchema, onboardingRichTextInlineSchema, onboardingRichTextSchema, onboardingDestinationSchema, onboardingArtworkSchema, onboardingAnswerSchema, onboardingQuestionSchema, onboardingTemplateSectionSchema, onboardingInstallScreenSchema, onboardingResultScreenSchema, onboardingConnectScreenSchema, onboardingTemplateContentSchema, onboardingUnavailableOutcomeSchema, onboardingFlowSchema, onboardingActorSchema, onboardingEditorSchema, onboardingPublicationSummarySchema, onboardingValidationIssueSchema, onboardingValidationResponseSchema, onboardingAssetSchema, onboardingPublicAssetSchema, getOnboardingConfigResponseSchema, saveOnboardingDraftRequestSchema, validateOnboardingRequestSchema, publishOnboardingRequestSchema, rollbackOnboardingRequestSchema, onboardingTemplateCatalogItemSchema, getPublishedOnboardingResponseSchema, WEB_ROUTE_PROTOCOL_VERSION, WEB_ROUTE_METHODS, WEB_ROUTE_REQUEST_HEADER_ALLOWLIST, WEB_ROUTE_RESPONSE_HEADER_ALLOWLIST, WEB_ROUTE_MAX_REQUEST_BODY_BYTES, WEB_ROUTE_MAX_RESPONSE_BYTES, WEB_APP_NAME_PATTERN, WEB_APP_ENTRY_HTML_MAX_CHARS, WEB_APP_MAX_ASSET_BYTES, EVIDENCE_SESSION_IDLE_MS, EVIDENCE_MIN_CONVERSATIONS, EVIDENCE_LOW_CONFIDENCE_N, EVIDENCE_SNIPPET_MAX_CHARS, EVIDENCE_EXAMPLES_PER_ITEM, EVIDENCE_SHOWN_ITEMS, EVIDENCE_LATENCY_BOUNDS_MS, EVIDENCE_WORD_BOUNDS, BAD_CONVERSATION_REASONS, ATTACHMENT_LINES, REVIEW_VERDICT_REASON_ORDER, ENV_TEMPLATE_SECRET_KEY_RE, CONNECTION_SEND_NOT_ALLOWED, CONNECTION_RECIPIENT_NOT_ALLOWED, NOT_SEND, PLAIN_ADDRESS, RecipientSet, MCP_MESSAGING_CREATE, MCP_CALENDAR_EVENT_WRITE, REPLY_KEYS, DEDICATED_MAIL_SLUGS, FULL_SUITE_SLUGS, WELL_KNOWN_MAIL_FOLDERS, MEMBER_KEYS, CANONICAL_ORIGIN, CANONICAL_PREFIX, STRICT_BASE64, GMAIL_PREFIX, GMAIL_MESSAGES_SEND, GMAIL_DRAFTS_SEND, GOOGLE_BATCH, GRAPH_VERSION, GRAPH_PRINCIPAL, GRAPH_SEND_MAIL, GRAPH_MESSAGE_ACTION, GRAPH_OWNER, GRAPH_EVENTS, GRAPH_EVENT_COLLECTION, GRAPH_EVENT_ID, GRAPH_EVENT_ITEM, GRAPH_EVENT_ACTION, GRAPH_BATCH, GRAPH_TEAMS_MESSAGE, GRAPH_ACTIVITY_NOTIFICATION, GRAPH_GROUP_CONVERSATION, GCAL_EVENTS, GRAPH_READ_KEYS, MALFORMED_POLICY, BILLING_REJECTION_TEXT_CREDITS, BILLING_REJECTION_TEXT_SEAT, BILLING_REJECTION_TEXT_USER_QUOTA;
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;
6110
6216
  var init_dist = __esm({
6111
6217
  "../shared-types/dist/index.mjs"() {
6112
6218
  "use strict";
@@ -6335,7 +6441,14 @@ var init_dist = __esm({
6335
6441
  * that was ACTIVE before, is OLDER than the active one and was active within the last 7 days. CAS on the active
6336
6442
  * version; only from a workflow step the watchdog grant names. Held only by a watchdog grant.
6337
6443
  */
6338
- "versions.rollback": "rollback"
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"
6339
6452
  };
6340
6453
  __name(isSupervisionOp, "isSupervisionOp");
6341
6454
  __name3(isSupervisionOp, "isSupervisionOp");
@@ -6525,6 +6638,12 @@ var init_dist = __esm({
6525
6638
  gate: "rollback",
6526
6639
  targeted: true,
6527
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"
6528
6647
  }
6529
6648
  };
6530
6649
  SUPERVISION_WATCHDOG_OPS = {
@@ -10737,6 +10856,497 @@ listed here; never invent a target.`;
10737
10856
  BILLING_REJECTION_TEXT_USER_QUOTA = "You've reached your monthly usage limit in this workspace. Ask a workspace admin to raise it.";
10738
10857
  __name(isPaymentRequiredChatErrorEnvelope, "isPaymentRequiredChatErrorEnvelope");
10739
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");
10740
11350
  }
10741
11351
  });
10742
11352
 
@@ -11397,7 +12007,7 @@ var init_constants = __esm({
11397
12007
  });
11398
12008
 
11399
12009
  // src/services/firebase-session.ts
11400
- import { z as z5 } from "zod";
12010
+ import { z as z6 } from "zod";
11401
12011
  function rejectedRefreshReason(message) {
11402
12012
  const normalised = message.toUpperCase();
11403
12013
  return REJECTED_REFRESH_REASONS.find((reason) => normalised.includes(reason));
@@ -11543,20 +12153,20 @@ var init_firebase_session = __esm({
11543
12153
  this.name = "FirebaseSessionRejectedError";
11544
12154
  }
11545
12155
  };
11546
- customTokenResponseSchema = z5.object({
11547
- idToken: z5.string().min(1),
11548
- refreshToken: z5.string().min(1),
11549
- expiresIn: z5.coerce.number().positive().finite(),
11550
- localId: z5.string().min(1).optional()
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()
11551
12161
  });
11552
- refreshResponseSchema = z5.object({
11553
- id_token: z5.string().min(1),
11554
- refresh_token: z5.string().min(1),
11555
- expires_in: z5.coerce.number().positive().finite(),
11556
- user_id: z5.string().min(1)
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)
11557
12167
  });
11558
- firebaseIdTokenPayloadSchema = z5.object({
11559
- sub: z5.string().min(1)
12168
+ firebaseIdTokenPayloadSchema = z6.object({
12169
+ sub: z6.string().min(1)
11560
12170
  });
11561
12171
  __name(requireFirebaseWebApiKey, "requireFirebaseWebApiKey");
11562
12172
  __name(claimsOfFirebaseIdToken, "claimsOfFirebaseIdToken");
@@ -11573,7 +12183,7 @@ var init_firebase_session = __esm({
11573
12183
  import { createHash, randomUUID } from "crypto";
11574
12184
  import { mkdir, open, readFile, rename, rm, stat, unlink, writeFile } from "fs/promises";
11575
12185
  import { join as join3 } from "path";
11576
- import { z as z6 } from "zod";
12186
+ import { z as z7 } from "zod";
11577
12187
  function environmentKey(environment) {
11578
12188
  return createHash("sha256").update(`${environment.apiUrl}
11579
12189
  ${environment.authUrl}
@@ -11590,15 +12200,15 @@ var init_firebase_session_store = __esm({
11590
12200
  "src/services/firebase-session-store.ts"() {
11591
12201
  "use strict";
11592
12202
  init_constants();
11593
- storedFirebaseSessionSchema = z6.object({
11594
- version: z6.literal(1),
11595
- kind: z6.literal("firebase-session"),
11596
- generation: z6.string().min(1),
11597
- refreshToken: z6.string().min(1),
11598
- firebaseUid: z6.string().min(1),
11599
- apiUrl: z6.string().url(),
11600
- authUrl: z6.string().url(),
11601
- firebaseWebApiKey: z6.string().min(1)
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)
11602
12212
  });
11603
12213
  currentFirebaseSessionEnvironment = /* @__PURE__ */ __name(() => ({
11604
12214
  apiUrl: BASE_URLS.API,
@@ -12267,14 +12877,15 @@ var init_http_client = __esm({
12267
12877
  * Performs an HTTP GET request
12268
12878
  * @param url - The relative URL path to request (will be appended to baseUrl)
12269
12879
  * @param headers - Optional HTTP headers to include in the request
12880
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12270
12881
  * @returns Promise resolving to an ApiResponse with typed data
12271
12882
  * @protected
12272
12883
  */
12273
- async httpGet(url, headers) {
12884
+ async httpGet(url, headers, overrides) {
12274
12885
  return this.retryableRequest(this.baseUrl + url, {
12275
12886
  method: "GET",
12276
12887
  headers
12277
- });
12888
+ }, 3, overrides);
12278
12889
  }
12279
12890
  /**
12280
12891
  * Performs an HTTP POST request
@@ -12316,43 +12927,46 @@ var init_http_client = __esm({
12316
12927
  * @param url - The relative URL path to request (will be appended to baseUrl)
12317
12928
  * @param data - Optional request body data (will be JSON stringified)
12318
12929
  * @param headers - Optional HTTP headers to include in the request
12930
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12319
12931
  * @returns Promise resolving to an ApiResponse with typed data
12320
12932
  * @protected
12321
12933
  */
12322
- async httpPut(url, data, headers) {
12934
+ async httpPut(url, data, headers, overrides) {
12323
12935
  return this.retryableRequest(this.baseUrl + url, {
12324
12936
  method: "PUT",
12325
12937
  body: data ? JSON.stringify(data) : void 0,
12326
12938
  headers
12327
- });
12939
+ }, 3, overrides);
12328
12940
  }
12329
12941
  /**
12330
12942
  * Performs an HTTP DELETE request
12331
12943
  * @param url - The relative URL path to request (will be appended to baseUrl)
12332
12944
  * @param headers - Optional HTTP headers to include in the request
12945
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12333
12946
  * @returns Promise resolving to an ApiResponse with typed data
12334
12947
  * @protected
12335
12948
  */
12336
- async httpDelete(url, headers) {
12949
+ async httpDelete(url, headers, overrides) {
12337
12950
  return this.retryableRequest(this.baseUrl + url, {
12338
12951
  method: "DELETE",
12339
12952
  headers
12340
- });
12953
+ }, 3, overrides);
12341
12954
  }
12342
12955
  /**
12343
12956
  * Performs an HTTP PATCH request
12344
12957
  * @param url - The relative URL path to request (will be appended to baseUrl)
12345
12958
  * @param data - Optional request body data (will be JSON stringified)
12346
12959
  * @param headers - Optional HTTP headers to include in the request
12960
+ * @param overrides - Optional per-call overrides (timeout, caller AbortSignal)
12347
12961
  * @returns Promise resolving to an ApiResponse with typed data
12348
12962
  * @protected
12349
12963
  */
12350
- async httpPatch(url, data, headers) {
12964
+ async httpPatch(url, data, headers, overrides) {
12351
12965
  return this.retryableRequest(this.baseUrl + url, {
12352
12966
  method: "PATCH",
12353
12967
  body: data ? JSON.stringify(data) : void 0,
12354
12968
  headers
12355
- });
12969
+ }, 3, overrides);
12356
12970
  }
12357
12971
  /**
12358
12972
  * Performs one HTTP PATCH attempt (no client retry).
@@ -12477,8 +13091,8 @@ var init_connection_requests_api_service = __esm({
12477
13091
  __name(this, "ConnectionRequestsApiService");
12478
13092
  }
12479
13093
  agentId;
12480
- constructor(baseUrl, credential, agentId) {
12481
- super(baseUrl, credential), this.agentId = agentId;
13094
+ constructor(baseUrl, credential, agentId2) {
13095
+ super(baseUrl, credential), this.agentId = agentId2;
12482
13096
  }
12483
13097
  query() {
12484
13098
  return `agentId=${encodeURIComponent(this.agentId)}`;
@@ -12560,8 +13174,8 @@ function workflowJobTargetTemplatePath(binding) {
12560
13174
  return m[1].split(".").every((seg) => TARGET_PATH_SEGMENT_RE.test(seg)) ? m[1] : null;
12561
13175
  }
12562
13176
  function isWorkflowJobTargetTemplate(target) {
12563
- const agentId = target?.agentId;
12564
- return !!agentId && typeof agentId === "object";
13177
+ const agentId2 = target?.agentId;
13178
+ return !!agentId2 && typeof agentId2 === "object";
12565
13179
  }
12566
13180
  function workflowJobLuaApiProblem(luaApi, nodeType, tier) {
12567
13181
  if (luaApi === void 0) return null;
@@ -12577,12 +13191,12 @@ function workflowJobTargetProblem(target, plugins, luaApi) {
12577
13191
  if (target === void 0) return null;
12578
13192
  if (!target || typeof target !== "object" || Array.isArray(target)) return "target must be { agentId }";
12579
13193
  const keys = Object.keys(target);
12580
- const agentId = target.agentId;
13194
+ const agentId2 = target.agentId;
12581
13195
  if (keys.length !== 1 || !("agentId" in target)) return "target must be exactly { agentId }";
12582
- if (typeof agentId === "string") {
12583
- if (!agentId.trim() || agentId.length > 256) return "target must be exactly { agentId: <non-empty string> }";
12584
- if (agentId.includes("${")) return "a run-input target is written template('${initData.<path>}'), never a string with ${\u2026}";
12585
- } else if (workflowJobTargetTemplatePath(agentId) === null) {
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) {
12586
13200
  return "target.agentId must be a static id or template('${initData.<path>}') \u2014 exactly one initData placeholder, no default";
12587
13201
  }
12588
13202
  const hasPlugins = Array.isArray(plugins) && plugins.length > 0;
@@ -12606,25 +13220,25 @@ function readInitDataPath(root, path3) {
12606
13220
  return cur;
12607
13221
  }
12608
13222
  function renderWorkflowJobTarget(target, initData) {
12609
- const agentId = target?.agentId;
12610
- 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 {
12611
13225
  ok: true,
12612
13226
  agentId: void 0,
12613
13227
  templated: false
12614
13228
  };
12615
- if (typeof agentId === "string") {
12616
- if (!agentId.trim() || agentId.includes("${")) return {
13229
+ if (typeof agentId2 === "string") {
13230
+ if (!agentId2.trim() || agentId2.includes("${")) return {
12617
13231
  ok: false,
12618
13232
  reason: "invalid",
12619
13233
  message: "target.agentId is invalid"
12620
13234
  };
12621
13235
  return {
12622
13236
  ok: true,
12623
- agentId,
13237
+ agentId: agentId2,
12624
13238
  templated: false
12625
13239
  };
12626
13240
  }
12627
- const path3 = workflowJobTargetTemplatePath(agentId);
13241
+ const path3 = workflowJobTargetTemplatePath(agentId2);
12628
13242
  if (path3 === null) return {
12629
13243
  ok: false,
12630
13244
  reason: "invalid",
@@ -12718,7 +13332,7 @@ var init_workflow_job_tools = __esm({
12718
13332
 
12719
13333
  // ../workflow-graph/dist/index.mjs
12720
13334
  import { createHash as createHash2 } from "crypto";
12721
- import { z as z7 } from "zod";
13335
+ import { z as z8 } from "zod";
12722
13336
  import { z as z22 } from "zod";
12723
13337
  import { createHash as createHash22 } from "crypto";
12724
13338
  function isMapConfigObject(v) {
@@ -16445,8 +17059,8 @@ var init_dist2 = __esm({
16445
17059
  fromKnowledge = /* @__PURE__ */ __name6((k) => ({
16446
17060
  knowledge: k
16447
17061
  }), "fromKnowledge");
16448
- SideEffectsSchema = z7.enum(WORKFLOW_SIDE_EFFECTS);
16449
- JobResourcesSchema = z7.enum(WORKFLOW_JOB_RESOURCES);
17062
+ SideEffectsSchema = z8.enum(WORKFLOW_SIDE_EFFECTS);
17063
+ JobResourcesSchema = z8.enum(WORKFLOW_JOB_RESOURCES);
16450
17064
  WORKFLOW_MODEL_TEMPLATE_ROOT = "initData";
16451
17065
  WORKFLOW_MODEL_TEMPLATE_RE = /^\$\{\s*initData\.([A-Za-z0-9_.\-[\]]+)\s*(?:\|([^}]*))?\}$/;
16452
17066
  PATH_SEGMENT_RE = /^[A-Za-z0-9_-]+(?:\[(?:0|[1-9]\d*)\])*$/;
@@ -18262,9 +18876,9 @@ var init_skills_api_service = __esm({
18262
18876
  * @param credential - The API key for authentication
18263
18877
  * @param agentId - The unique identifier of the agent
18264
18878
  */
18265
- constructor(baseUrl, credential, agentId) {
18879
+ constructor(baseUrl, credential, agentId2) {
18266
18880
  super(baseUrl, credential);
18267
- this.agentId = agentId;
18881
+ this.agentId = agentId2;
18268
18882
  }
18269
18883
  /**
18270
18884
  * Retrieves all skills for the agent
@@ -18774,7 +19388,7 @@ function walk3(root, prefix, out) {
18774
19388
  }
18775
19389
  }
18776
19390
  }
18777
- var __defProp7, __name7, FILE_HASH_LENGTH, SKIP_DIRECTORIES, ARCHIVE_ONLY_SKIP_DIRECTORIES, DEFAULT_MAX_FILE_BYTES, KIND_BY_EXT, CHECK_BLOBS_MAX_HASHES, BackupHttpError, BackupHttpClient, DEFAULT_CONCURRENCY, CREDENTIAL_PATHS, WINDOWS_ABSOLUTE_PATH, ARCHIVE_SCHEMA_VERSION;
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;
18778
19392
  var init_dist3 = __esm({
18779
19393
  "../shared-source-sync/dist/index.mjs"() {
18780
19394
  "use strict";
@@ -18982,6 +19596,7 @@ var init_dist3 = __esm({
18982
19596
  __name7(writeArchiveToWorkspace, "writeArchiveToWorkspace");
18983
19597
  __name(walk3, "walk");
18984
19598
  __name7(walk3, "walk");
19599
+ SKILL_SOURCE_ARCHIVE_MAX_BYTES = 4 * 1024 * 1024;
18985
19600
  }
18986
19601
  });
18987
19602
 
@@ -19125,8 +19740,8 @@ var init_base_handler = __esm({
19125
19740
  * Local items take priority for shared IDs; server-only orphans are appended as minimal
19126
19741
  * cleanItem objects. On server failure, returns local items only with an empty orphan set.
19127
19742
  */
19128
- async fetchMergedForInteraction(apiKey, agentId, config) {
19129
- const serverData = await this.fetchServerState(apiKey, agentId);
19743
+ async fetchMergedForInteraction(apiKey, agentId2, config) {
19744
+ const serverData = await this.fetchServerState(apiKey, agentId2);
19130
19745
  const localItems = this.getFromYaml(config);
19131
19746
  if (!serverData.serverItems) {
19132
19747
  return {
@@ -19153,9 +19768,9 @@ var init_base_handler = __esm({
19153
19768
  };
19154
19769
  }
19155
19770
  /** Phase 1 of parallel sync: fetch server state (HTTP only, no YAML writes) */
19156
- async fetchServerState(apiKey, agentId) {
19771
+ async fetchServerState(apiKey, agentId2) {
19157
19772
  try {
19158
- const api = this.getApi(apiKey, agentId);
19773
+ const api = this.getApi(apiKey, agentId2);
19159
19774
  const serverItems = await this.fetchFromServer(api);
19160
19775
  return {
19161
19776
  serverItems
@@ -19268,11 +19883,11 @@ var init_base_handler = __esm({
19268
19883
  orphanedCount
19269
19884
  };
19270
19885
  }
19271
- async syncWithServer(apiKey, agentId, config, manifest) {
19272
- const serverData = await this.fetchServerState(apiKey, agentId);
19886
+ async syncWithServer(apiKey, agentId2, config, manifest) {
19887
+ const serverData = await this.fetchServerState(apiKey, agentId2);
19273
19888
  return this.applySyncToYaml(serverData, config, manifest, {
19274
19889
  apiKey,
19275
- agentId
19890
+ agentId: agentId2
19276
19891
  });
19277
19892
  }
19278
19893
  /**
@@ -19413,8 +20028,8 @@ var init_base_handler = __esm({
19413
20028
  /**
19414
20029
  * Get the highest version string from the server for conflict avoidance.
19415
20030
  */
19416
- async getHighestServerVersion(apiKey, agentId, entityId) {
19417
- const { serverItems } = await this.fetchServerState(apiKey, agentId);
20031
+ async getHighestServerVersion(apiKey, agentId2, entityId) {
20032
+ const { serverItems } = await this.fetchServerState(apiKey, agentId2);
19418
20033
  if (!serverItems) return null;
19419
20034
  const entity = serverItems.find((item) => item.id === entityId);
19420
20035
  if (!entity?.versions || !Array.isArray(entity.versions)) return null;
@@ -19426,9 +20041,9 @@ var init_base_handler = __esm({
19426
20041
  * Fetch all server items once, extract highest version for each entity ID.
19427
20042
  * More efficient than calling getHighestServerVersion() per entity.
19428
20043
  */
19429
- async batchGetHighestVersions(apiKey, agentId, entityIds) {
20044
+ async batchGetHighestVersions(apiKey, agentId2, entityIds) {
19430
20045
  const result = /* @__PURE__ */ new Map();
19431
- const { serverItems } = await this.fetchServerState(apiKey, agentId);
20046
+ const { serverItems } = await this.fetchServerState(apiKey, agentId2);
19432
20047
  if (!serverItems) {
19433
20048
  entityIds.forEach((id2) => result.set(id2, null));
19434
20049
  return result;
@@ -19554,8 +20169,8 @@ var init_skill_handler = __esm({
19554
20169
  yamlKey: "skills",
19555
20170
  idField: "skillId"
19556
20171
  };
19557
- getApi(apiKey, agentId) {
19558
- return new SkillApi(BASE_URLS.API, apiKey, agentId);
20172
+ getApi(apiKey, agentId2) {
20173
+ return new SkillApi(BASE_URLS.API, apiKey, agentId2);
19559
20174
  }
19560
20175
  async fetchFromServer(api) {
19561
20176
  const response = await api.getSkills();
@@ -19655,8 +20270,8 @@ var init_skill_handler = __esm({
19655
20270
  // ===========================================================================
19656
20271
  // PUSH — custom to include tools array
19657
20272
  // ===========================================================================
19658
- async pushToServer(apiKey, agentId, entityId, pushData) {
19659
- const api = this.getApi(apiKey, agentId);
20273
+ async pushToServer(apiKey, agentId2, entityId, pushData) {
20274
+ const api = this.getApi(apiKey, agentId2);
19660
20275
  const response = await api.pushSkill(entityId, {
19661
20276
  ...pushData,
19662
20277
  skillId: entityId
@@ -19666,8 +20281,8 @@ var init_skill_handler = __esm({
19666
20281
  error: response.error?.message
19667
20282
  };
19668
20283
  }
19669
- async publishVersion(apiKey, agentId, entityId, version) {
19670
- const api = this.getApi(apiKey, agentId);
20284
+ async publishVersion(apiKey, agentId2, entityId, version) {
20285
+ const api = this.getApi(apiKey, agentId2);
19671
20286
  const response = await api.publishSkillVersion(entityId, version);
19672
20287
  return {
19673
20288
  success: response.success,
@@ -20368,9 +20983,9 @@ var init_products_api_service = __esm({
20368
20983
  * @param credential - The API key for authentication
20369
20984
  * @param agentId - The unique identifier of the agent
20370
20985
  */
20371
- constructor(baseUrl, credential, agentId) {
20986
+ constructor(baseUrl, credential, agentId2) {
20372
20987
  super(baseUrl, credential);
20373
- this.agentId = agentId;
20988
+ this.agentId = agentId2;
20374
20989
  }
20375
20990
  async get(pageOrOptions, limitArg) {
20376
20991
  let page;
@@ -20956,9 +21571,9 @@ var init_order_api_service = __esm({
20956
21571
  * @param credential - The API key for authentication
20957
21572
  * @param agentId - The unique identifier of the agent
20958
21573
  */
20959
- constructor(baseUrl, credential, agentId) {
21574
+ constructor(baseUrl, credential, agentId2) {
20960
21575
  super(baseUrl, credential);
20961
- this.agentId = agentId;
21576
+ this.agentId = agentId2;
20962
21577
  }
20963
21578
  /**
20964
21579
  * Creates a new order from a basket
@@ -21053,10 +21668,10 @@ var init_basket_api_service = __esm({
21053
21668
  * @param credential - The API key for authentication
21054
21669
  * @param agentId - The unique identifier of the agent
21055
21670
  */
21056
- constructor(baseUrl, credential, agentId) {
21671
+ constructor(baseUrl, credential, agentId2) {
21057
21672
  super(baseUrl, credential);
21058
21673
  this.credential = credential;
21059
- this.agentId = agentId;
21674
+ this.agentId = agentId2;
21060
21675
  }
21061
21676
  /**
21062
21677
  * Creates a new user basket
@@ -21438,10 +22053,10 @@ var init_user_data_api_service = __esm({
21438
22053
  * @param credential - The API key for authentication
21439
22054
  * @param agentId - The unique identifier of the agent
21440
22055
  */
21441
- constructor(baseUrl, credential, agentId, targetUserId) {
22056
+ constructor(baseUrl, credential, agentId2, targetUserId) {
21442
22057
  super(baseUrl, credential);
21443
22058
  this.credential = credential;
21444
- this.agentId = agentId;
22059
+ this.agentId = agentId2;
21445
22060
  this.targetUserId = targetUserId;
21446
22061
  }
21447
22062
  get dataPath() {
@@ -21840,9 +22455,9 @@ var init_custom_data_api_service = __esm({
21840
22455
  * @param credential - The API key for authentication
21841
22456
  * @param agentId - The unique identifier of the agent
21842
22457
  */
21843
- constructor(baseUrl, credential, agentId) {
22458
+ constructor(baseUrl, credential, agentId2) {
21844
22459
  super(baseUrl, credential);
21845
- this.agentId = agentId;
22460
+ this.agentId = agentId2;
21846
22461
  }
21847
22462
  /**
21848
22463
  * Lists the agent's data collections with entry counts, timestamps, and —
@@ -22050,9 +22665,9 @@ var init_webhook_api_service = __esm({
22050
22665
  * @param credential - The API key for authentication
22051
22666
  * @param agentId - The unique identifier of the agent
22052
22667
  */
22053
- constructor(baseUrl, credential, agentId) {
22668
+ constructor(baseUrl, credential, agentId2) {
22054
22669
  super(baseUrl, credential);
22055
- this.agentId = agentId;
22670
+ this.agentId = agentId2;
22056
22671
  }
22057
22672
  /**
22058
22673
  * Retrieves all webhooks for the agent
@@ -22353,10 +22968,10 @@ var init_job_api_service = __esm({
22353
22968
  * @param credential - The API key for authentication
22354
22969
  * @param agentId - The unique identifier of the agent
22355
22970
  */
22356
- constructor(baseUrl, credential, agentId) {
22971
+ constructor(baseUrl, credential, agentId2) {
22357
22972
  super(baseUrl, credential);
22358
22973
  this.credential = credential;
22359
- this.agentId = agentId;
22974
+ this.agentId = agentId2;
22360
22975
  }
22361
22976
  /**
22362
22977
  * Retrieves all jobs for the agent
@@ -22556,8 +23171,8 @@ var init_ai_api_service = __esm({
22556
23171
  __name(this, "AiApiService");
22557
23172
  }
22558
23173
  agentId;
22559
- constructor(baseUrl, credential, agentId) {
22560
- super(baseUrl, credential), this.agentId = agentId;
23174
+ constructor(baseUrl, credential, agentId2) {
23175
+ super(baseUrl, credential), this.agentId = agentId2;
22561
23176
  }
22562
23177
  async generate(body) {
22563
23178
  return this.httpPost(`/developer/ai/${this.agentId}/generate`, body, {});
@@ -22665,8 +23280,8 @@ var init_integrations_api_service = __esm({
22665
23280
  __name(this, "IntegrationsApiService");
22666
23281
  }
22667
23282
  agentId;
22668
- constructor(baseUrl, credential, agentId) {
22669
- super(baseUrl, credential), this.agentId = agentId;
23283
+ constructor(baseUrl, credential, agentId2) {
23284
+ super(baseUrl, credential), this.agentId = agentId2;
22670
23285
  }
22671
23286
  async passthrough(integrationType, request, options) {
22672
23287
  return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(this.agentId)}/passthrough/${encodeURIComponent(integrationType)}`, options?.connectionId ? {
@@ -22675,12 +23290,12 @@ var init_integrations_api_service = __esm({
22675
23290
  } : request, {});
22676
23291
  }
22677
23292
  /** wave 2 U6 — `GET /developer/unifiedto/connections/:agentId/visible` for `agentId` (default: this agent). */
22678
- async listVisible(agentId = this.agentId) {
22679
- return this.httpGet(`/developer/unifiedto/connections/${encodeURIComponent(agentId)}/visible`);
23293
+ async listVisible(agentId2 = this.agentId) {
23294
+ return this.httpGet(`/developer/unifiedto/connections/${encodeURIComponent(agentId2)}/visible`);
22680
23295
  }
22681
23296
  /** wave 2 U6 — `POST /developer/unifiedto/connections/:agentId/:connectionId/checks`. */
22682
- async runCheck(connectionId, check, options = {}, agentId = this.agentId) {
22683
- return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(agentId)}/${encodeURIComponent(connectionId)}/checks`, {
23297
+ async runCheck(connectionId, check, options = {}, agentId2 = this.agentId) {
23298
+ return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(agentId2)}/${encodeURIComponent(connectionId)}/checks`, {
22684
23299
  check,
22685
23300
  ...options.allowWrite === true ? {
22686
23301
  allowWrite: true
@@ -22822,10 +23437,14 @@ var init_agents_api_service = __esm({
22822
23437
  * `(prompt)` call returns plain text and the `(input)` call returns the
22823
23438
  * full structured output.
22824
23439
  */
22825
- async invokeForSandbox(targetAgentId, promptOrInput) {
22826
- const input = typeof promptOrInput === "string" ? {
23440
+ async invokeForSandbox(targetAgentId, promptOrInput, options) {
23441
+ const base = typeof promptOrInput === "string" ? {
22827
23442
  prompt: promptOrInput
22828
23443
  } : promptOrInput;
23444
+ const input = !base.signal && options?.signal ? {
23445
+ ...base,
23446
+ signal: options.signal
23447
+ } : base;
22829
23448
  if (isAborted2(input.signal)) throw abortReason(input.signal);
22830
23449
  const result = await this.invoke(targetAgentId, input);
22831
23450
  if (!result.success) {
@@ -22867,6 +23486,25 @@ var init_agents_api_service = __esm({
22867
23486
  return toInvocationOutput(data, input.threadId);
22868
23487
  }
22869
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
+ /**
22870
23508
  * EM-WS2 — the offline (`lua test` / `lua dev`) twin of the `Agents.*`
22871
23509
  * supervision members. Read ops go to the developer REST routes with YOUR
22872
23510
  * developer credential (so they return what you can see, not what a
@@ -23117,9 +23755,9 @@ var init_whatsapp_templates_api_service = __esm({
23117
23755
  * @param credential - The API key for authentication
23118
23756
  * @param agentId - The unique identifier of the agent
23119
23757
  */
23120
- constructor(baseUrl, credential, agentId) {
23758
+ constructor(baseUrl, credential, agentId2) {
23121
23759
  super(baseUrl, credential);
23122
- this.agentId = agentId;
23760
+ this.agentId = agentId2;
23123
23761
  }
23124
23762
  /**
23125
23763
  * Lists WhatsApp templates for a channel with optional pagination and search
@@ -23257,9 +23895,9 @@ var init_developer_api_service = __esm({
23257
23895
  * @param credential - The API key for authentication
23258
23896
  * @param agentId - The unique identifier of the agent
23259
23897
  */
23260
- constructor(baseUrl, credential, agentId) {
23898
+ constructor(baseUrl, credential, agentId2) {
23261
23899
  super(baseUrl, credential);
23262
- this.agentId = agentId;
23900
+ this.agentId = agentId2;
23263
23901
  }
23264
23902
  /**
23265
23903
  * Retrieves all environment variables for the agent in production
@@ -23372,9 +24010,9 @@ var init_developer_api_service = __esm({
23372
24010
  * @param email - The email address to look up
23373
24011
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23374
24012
  */
23375
- async getUserProfileByEmail(email, agentId) {
24013
+ async getUserProfileByEmail(email, agentId2) {
23376
24014
  const path3 = `/developer/user/profile/email/${encodeURIComponent(email)}`;
23377
- const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
24015
+ const scopedPath = agentId2 ? `${path3}?agentId=${encodeURIComponent(agentId2)}` : path3;
23378
24016
  return this.httpGet(scopedPath, {});
23379
24017
  }
23380
24018
  /**
@@ -23382,10 +24020,10 @@ var init_developer_api_service = __esm({
23382
24020
  * @param phone - The phone number to look up (with or without + prefix)
23383
24021
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23384
24022
  */
23385
- async getUserProfileByPhone(phone, agentId) {
24023
+ async getUserProfileByPhone(phone, agentId2) {
23386
24024
  const normalizedPhone = phone.replace(/^\+/, "");
23387
24025
  const path3 = `/developer/user/profile/phone/${normalizedPhone}`;
23388
- const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
24026
+ const scopedPath = agentId2 ? `${path3}?agentId=${encodeURIComponent(agentId2)}` : path3;
23389
24027
  return this.httpGet(scopedPath, {});
23390
24028
  }
23391
24029
  /**
@@ -23393,9 +24031,9 @@ var init_developer_api_service = __esm({
23393
24031
  * @param identity - `{ kind, scope, value }`, e.g. from `Lua.request.sender`
23394
24032
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
23395
24033
  */
23396
- async getUserProfileByIdentity(identity, agentId) {
24034
+ async getUserProfileByIdentity(identity, agentId2) {
23397
24035
  const path3 = `/developer/user/profile/identity/${encodeURIComponent(identity.kind)}/${encodeURIComponent(identity.value)}`;
23398
- return this.httpGet(`${path3}?scope=${encodeURIComponent(identity.scope)}&agentId=${encodeURIComponent(agentId)}`, {});
24036
+ return this.httpGet(`${path3}?scope=${encodeURIComponent(identity.scope)}&agentId=${encodeURIComponent(agentId2)}`, {});
23399
24037
  }
23400
24038
  };
23401
24039
  }
@@ -23412,9 +24050,9 @@ var init_voice_api_service = __esm({
23412
24050
  __name(this, "VoiceApi");
23413
24051
  }
23414
24052
  agentId;
23415
- constructor(baseUrl, credential, agentId) {
24053
+ constructor(baseUrl, credential, agentId2) {
23416
24054
  super(baseUrl, credential);
23417
- this.agentId = agentId;
24055
+ this.agentId = agentId2;
23418
24056
  }
23419
24057
  async getVoices() {
23420
24058
  return this.httpGet(`/developer/voice-agents/${this.agentId}`, {});
@@ -23505,8 +24143,8 @@ var init_channels_send_api_service = __esm({
23505
24143
  __name(this, "ChannelsSendApiService");
23506
24144
  }
23507
24145
  agentId;
23508
- constructor(baseUrl, credential, agentId) {
23509
- super(baseUrl, credential), this.agentId = agentId;
24146
+ constructor(baseUrl, credential, agentId2) {
24147
+ super(baseUrl, credential), this.agentId = agentId2;
23510
24148
  }
23511
24149
  /** POST /developer/agents/:agentId/channels/send */
23512
24150
  async send(input) {
@@ -23628,8 +24266,8 @@ var init_inbox_push_api_service = __esm({
23628
24266
  __name(this, "InboxPushApiService");
23629
24267
  }
23630
24268
  agentId;
23631
- constructor(baseUrl, credential, agentId) {
23632
- super(baseUrl, credential), this.agentId = agentId;
24269
+ constructor(baseUrl, credential, agentId2) {
24270
+ super(baseUrl, credential), this.agentId = agentId2;
23633
24271
  }
23634
24272
  /** POST /developer/agents/:agentId/inbox/push */
23635
24273
  async push(input) {
@@ -23650,8 +24288,8 @@ var init_directory_api_service = __esm({
23650
24288
  __name(this, "DirectoryApiService");
23651
24289
  }
23652
24290
  agentId;
23653
- constructor(baseUrl, credential, agentId) {
23654
- super(baseUrl, credential), this.agentId = agentId;
24291
+ constructor(baseUrl, credential, agentId2) {
24292
+ super(baseUrl, credential), this.agentId = agentId2;
23655
24293
  }
23656
24294
  /** POST /developer/agents/:agentId/directory/resolve */
23657
24295
  async resolve(name) {
@@ -23781,9 +24419,9 @@ function createWorkflowsRuntime(getApi) {
23781
24419
  },
23782
24420
  // Goals are scoped to the bound agent: the IF-21 `agentId` argument is parity with the HTTP twin
23783
24421
  // (`/workflows/:agentId/goals`), never a way to reach another agent's goals (403 otherwise).
23784
- async setGoal(agentId, goal) {
24422
+ async setGoal(agentId2, goal) {
23785
24423
  const api = await getApi();
23786
- assertBoundAgent(api, agentId, "setGoal");
24424
+ assertBoundAgent(api, agentId2, "setGoal");
23787
24425
  const g = goal;
23788
24426
  const target = g.workflowId ?? g.workflow;
23789
24427
  const ref = target ? await resolveRef(api, target) : {};
@@ -23793,29 +24431,29 @@ function createWorkflowsRuntime(getApi) {
23793
24431
  }), "Workflows.setGoal");
23794
24432
  },
23795
24433
  goals: {
23796
- async list(agentId, opts = {}) {
24434
+ async list(agentId2, opts = {}) {
23797
24435
  const api = await getApi();
23798
- assertBoundAgent(api, agentId, "goals.list");
24436
+ assertBoundAgent(api, agentId2, "goals.list");
23799
24437
  return unwrap(await api.getGoals(opts), "Workflows.goals.list").items;
23800
24438
  },
23801
- async get(agentId, goalId) {
24439
+ async get(agentId2, goalId) {
23802
24440
  const api = await getApi();
23803
- assertBoundAgent(api, agentId, "goals.get");
24441
+ assertBoundAgent(api, agentId2, "goals.get");
23804
24442
  return unwrap(await api.getGoal(goalId), "Workflows.goals.get");
23805
24443
  },
23806
- async pause(agentId, goalId) {
24444
+ async pause(agentId2, goalId) {
23807
24445
  const api = await getApi();
23808
- assertBoundAgent(api, agentId, "goals.pause");
24446
+ assertBoundAgent(api, agentId2, "goals.pause");
23809
24447
  return unwrap(await api.pauseGoal(goalId), "Workflows.goals.pause");
23810
24448
  },
23811
- async resume(agentId, goalId) {
24449
+ async resume(agentId2, goalId) {
23812
24450
  const api = await getApi();
23813
- assertBoundAgent(api, agentId, "goals.resume");
24451
+ assertBoundAgent(api, agentId2, "goals.resume");
23814
24452
  return unwrap(await api.resumeGoal(goalId), "Workflows.goals.resume");
23815
24453
  },
23816
- async close(agentId, goalId, opts = {}) {
24454
+ async close(agentId2, goalId, opts = {}) {
23817
24455
  const api = await getApi();
23818
- assertBoundAgent(api, agentId, "goals.close");
24456
+ assertBoundAgent(api, agentId2, "goals.close");
23819
24457
  return unwrap(await api.closeGoal(goalId, opts), "Workflows.goals.close");
23820
24458
  }
23821
24459
  }
@@ -23854,8 +24492,8 @@ var init_workflow_api_service = __esm({
23854
24492
  return res.data;
23855
24493
  }, "unwrap");
23856
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");
23857
- assertBoundAgent = /* @__PURE__ */ __name((api, agentId, member) => {
23858
- if (agentId && agentId !== api.agentId) {
24495
+ assertBoundAgent = /* @__PURE__ */ __name((api, agentId2, member) => {
24496
+ if (agentId2 && agentId2 !== api.agentId) {
23859
24497
  throw new WorkflowApiError("FORBIDDEN", `Workflows.${member}: goals are scoped to the bound agent ${api.agentId}`, 403);
23860
24498
  }
23861
24499
  }, "assertBoundAgent");
@@ -23867,10 +24505,10 @@ var init_workflow_api_service = __esm({
23867
24505
  }
23868
24506
  credential;
23869
24507
  agentId;
23870
- constructor(baseUrl, credential, agentId) {
24508
+ constructor(baseUrl, credential, agentId2) {
23871
24509
  super(baseUrl, credential);
23872
24510
  this.credential = credential;
23873
- this.agentId = agentId;
24511
+ this.agentId = agentId2;
23874
24512
  }
23875
24513
  /** PRO-1434 (main sync): auth rides the renewable request credential — resolve a current bearer per call. */
23876
24514
  async auth() {
@@ -24273,9 +24911,9 @@ var init_device_api_service = __esm({
24273
24911
  __name(this, "DeviceApi");
24274
24912
  }
24275
24913
  agentId;
24276
- constructor(baseUrl, credential, agentId) {
24914
+ constructor(baseUrl, credential, agentId2) {
24277
24915
  super(baseUrl, credential);
24278
- this.agentId = agentId;
24916
+ this.agentId = agentId2;
24279
24917
  }
24280
24918
  async getDevices() {
24281
24919
  return this.httpGet(`/developer/devices/${this.agentId}`, {});
@@ -24623,8 +25261,8 @@ var init_secrets_api_service = __esm({
24623
25261
  __name(this, "SecretsApiService");
24624
25262
  }
24625
25263
  agentId;
24626
- constructor(baseUrl, credential, agentId) {
24627
- super(baseUrl, credential), this.agentId = agentId;
25264
+ constructor(baseUrl, credential, agentId2) {
25265
+ super(baseUrl, credential), this.agentId = agentId2;
24628
25266
  }
24629
25267
  unwrap(result, what) {
24630
25268
  if (!result.success || result.data === void 0) {
@@ -24734,26 +25372,26 @@ function buildSupervisionAgentsApi(call2) {
24734
25372
  /** Agents of the caller's own organization, with the supervision actions the caller holds on each. */
24735
25373
  list: /* @__PURE__ */ __name2(() => call2("agents.list"), "list"),
24736
25374
  /** One agent of the caller's organization (not found = other org or no such agent). */
24737
- get: /* @__PURE__ */ __name2((agentId) => call2("agents.get", agentId), "get"),
25375
+ get: /* @__PURE__ */ __name2((agentId2) => call2("agents.get", agentId2), "get"),
24738
25376
  /** Recent execution logs of a supervised agent (metadata + message, no user ids). */
24739
- logs: /* @__PURE__ */ __name2((agentId, opts = {}) => call2("logs", agentId, {
25377
+ logs: /* @__PURE__ */ __name2((agentId2, opts = {}) => call2("logs", agentId2, {
24740
25378
  ...opts
24741
25379
  }), "logs"),
24742
- runs: /* @__PURE__ */ __name2((agentId) => ({
24743
- list: /* @__PURE__ */ __name2((opts = {}) => call2("runs.list", agentId, {
25380
+ runs: /* @__PURE__ */ __name2((agentId2) => ({
25381
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("runs.list", agentId2, {
24744
25382
  ...opts
24745
25383
  }), "list"),
24746
- get: /* @__PURE__ */ __name2((runId) => call2("runs.get", agentId, {
25384
+ get: /* @__PURE__ */ __name2((runId) => call2("runs.get", agentId2, {
24747
25385
  runId
24748
25386
  }), "get")
24749
25387
  }), "runs"),
24750
25388
  /** Read-only, and only the collections the org admin named on the supervision grant. */
24751
- data: /* @__PURE__ */ __name2((agentId) => ({
24752
- get: /* @__PURE__ */ __name2((collection, entryId) => call2("data.get", agentId, {
25389
+ data: /* @__PURE__ */ __name2((agentId2) => ({
25390
+ get: /* @__PURE__ */ __name2((collection, entryId) => call2("data.get", agentId2, {
24753
25391
  collection,
24754
25392
  entryId
24755
25393
  }), "get"),
24756
- query: /* @__PURE__ */ __name2((collection, filter, opts = {}) => call2("data.query", agentId, {
25394
+ query: /* @__PURE__ */ __name2((collection, filter, opts = {}) => call2("data.query", agentId2, {
24757
25395
  collection,
24758
25396
  ...filter ? {
24759
25397
  filter
@@ -24761,19 +25399,19 @@ function buildSupervisionAgentsApi(call2) {
24761
25399
  ...opts
24762
25400
  }), "query")
24763
25401
  }), "data"),
24764
- versions: /* @__PURE__ */ __name2((agentId) => ({
24765
- list: /* @__PURE__ */ __name2((opts = {}) => call2("versions.list", agentId, {
25402
+ versions: /* @__PURE__ */ __name2((agentId2) => ({
25403
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("versions.list", agentId2, {
24766
25404
  ...opts
24767
25405
  }), "list"),
24768
- get: /* @__PURE__ */ __name2((version) => call2("versions.get", agentId, {
25406
+ get: /* @__PURE__ */ __name2((version) => call2("versions.get", agentId2, {
24769
25407
  version
24770
25408
  }), "get"),
24771
- diff: /* @__PURE__ */ __name2((from, to) => call2("versions.diff", agentId, {
25409
+ diff: /* @__PURE__ */ __name2((from, to) => call2("versions.diff", agentId2, {
24772
25410
  from,
24773
25411
  to
24774
25412
  }), "diff"),
24775
25413
  /** Chat a staged version. No tools run unless `opts.toolScope.skillIds` allowlists them. */
24776
- preview: /* @__PURE__ */ __name2((version, prompt, opts = {}) => call2("versions.preview", agentId, {
25414
+ preview: /* @__PURE__ */ __name2((version, prompt, opts = {}) => call2("versions.preview", agentId2, {
24777
25415
  version,
24778
25416
  prompt,
24779
25417
  ...opts.toolScope ? {
@@ -24781,12 +25419,12 @@ function buildSupervisionAgentsApi(call2) {
24781
25419
  } : {}
24782
25420
  }), "preview"),
24783
25421
  /** Make `version` live. Compare-and-swap: refused unless `expectActive` is the live version. */
24784
- promote: /* @__PURE__ */ __name2(async (version, opts) => call2("versions.promote", agentId, {
25422
+ promote: /* @__PURE__ */ __name2(async (version, opts) => call2("versions.promote", agentId2, {
24785
25423
  version,
24786
25424
  expectActive: requireExpectActive(opts, "versions.promote")
24787
25425
  }), "promote"),
24788
25426
  /** Soft-delete a SUPERSEDED version (the active version and the last version are refused). */
24789
- delete: /* @__PURE__ */ __name2((version) => call2("versions.delete", agentId, {
25427
+ delete: /* @__PURE__ */ __name2((version) => call2("versions.delete", agentId2, {
24790
25428
  version
24791
25429
  }), "delete"),
24792
25430
  /**
@@ -24798,7 +25436,7 @@ function buildSupervisionAgentsApi(call2) {
24798
25436
  if (expectActive === null) {
24799
25437
  throw typedError("supervision_expect_active_required", "versions.rollback requires { expectActive } \u2014 the active version number (a rollback needs one)");
24800
25438
  }
24801
- return call2("versions.rollback", agentId, {
25439
+ return call2("versions.rollback", agentId2, {
24802
25440
  version,
24803
25441
  expectActive
24804
25442
  });
@@ -24810,20 +25448,30 @@ function buildSupervisionAgentsApi(call2) {
24810
25448
  * tools) and never gets `egress: 'live'`.
24811
25449
  */
24812
25450
  session: /* @__PURE__ */ __name2(async (opts) => {
24813
- const opened = await call2("versions.session", agentId, {
25451
+ const opened = await call2("versions.session", agentId2, {
24814
25452
  ...opts
24815
25453
  });
24816
- return buildTestSessionHandle(call2, agentId, opened);
25454
+ return buildTestSessionHandle(call2, agentId2, opened);
24817
25455
  }, "session")
24818
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"),
24819
25467
  /** Read (`observe`) and release (`release`) a workflow of a supervised agent. */
24820
- workflows: /* @__PURE__ */ __name2((agentId) => ({
25468
+ workflows: /* @__PURE__ */ __name2((agentId2) => ({
24821
25469
  /** One workflow: its live `activeVersionId` (deploy's `expectActive`) and its latest 20 versions. */
24822
- get: /* @__PURE__ */ __name2((workflowId) => call2("workflows.get", agentId, {
25470
+ get: /* @__PURE__ */ __name2((workflowId) => call2("workflows.get", agentId2, {
24823
25471
  workflowId
24824
25472
  }), "get"),
24825
25473
  /** Create workflow `name` (inert: inactive, no version) or answer the existing one: `{ workflowId, name, created }`. */
24826
- create: /* @__PURE__ */ __name2((name, opts = {}) => call2("workflows.create", agentId, {
25474
+ create: /* @__PURE__ */ __name2((name, opts = {}) => call2("workflows.create", agentId2, {
24827
25475
  name,
24828
25476
  ...opts?.description !== void 0 ? {
24829
25477
  description: opts.description
@@ -24833,7 +25481,7 @@ function buildSupervisionAgentsApi(call2) {
24833
25481
  } : {}
24834
25482
  }), "create"),
24835
25483
  /** Push a new, INACTIVE version (`activate` is always forced off; deploy it with `deploy`). */
24836
- push: /* @__PURE__ */ __name2((workflowId, definition) => call2("workflows.push", agentId, {
25484
+ push: /* @__PURE__ */ __name2((workflowId, definition) => call2("workflows.push", agentId2, {
24837
25485
  workflowId,
24838
25486
  definition: {
24839
25487
  ...definition
@@ -24843,7 +25491,7 @@ function buildSupervisionAgentsApi(call2) {
24843
25491
  deploy: /* @__PURE__ */ __name2(async (workflowId, version, opts) => {
24844
25492
  const expectActive = requireExpectActiveId(opts, "workflows.deploy");
24845
25493
  const commitHash = optionalCommitHash(opts, "workflows.deploy");
24846
- return call2("workflows.deploy", agentId, {
25494
+ return call2("workflows.deploy", agentId2, {
24847
25495
  workflowId,
24848
25496
  version,
24849
25497
  expectActive,
@@ -24853,45 +25501,45 @@ function buildSupervisionAgentsApi(call2) {
24853
25501
  });
24854
25502
  }, "deploy")
24855
25503
  }), "workflows"),
24856
- persona: /* @__PURE__ */ __name2((agentId) => ({
24857
- versions: /* @__PURE__ */ __name2(() => call2("persona.versions", agentId), "versions"),
25504
+ persona: /* @__PURE__ */ __name2((agentId2) => ({
25505
+ versions: /* @__PURE__ */ __name2(() => call2("persona.versions", agentId2), "versions"),
24858
25506
  /** Serve persona `version`. Compare-and-swap on the served persona version. */
24859
- activate: /* @__PURE__ */ __name2(async (version, opts) => call2("persona.activate", agentId, {
25507
+ activate: /* @__PURE__ */ __name2(async (version, opts) => call2("persona.activate", agentId2, {
24860
25508
  version,
24861
25509
  expectActive: requireExpectActive(opts, "persona.activate")
24862
25510
  }), "activate")
24863
25511
  }), "persona"),
24864
- source: /* @__PURE__ */ __name2((agentId) => ({
24865
- list: /* @__PURE__ */ __name2(() => call2("source.list", agentId), "list"),
24866
- 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, {
24867
25515
  path: path3
24868
25516
  }), "get")
24869
25517
  }), "source"),
24870
25518
  /** Environment variable NAMES only — values are never returned. */
24871
- env: /* @__PURE__ */ __name2((agentId) => ({
24872
- keys: /* @__PURE__ */ __name2(() => call2("env.keys", agentId), "keys")
25519
+ env: /* @__PURE__ */ __name2((agentId2) => ({
25520
+ keys: /* @__PURE__ */ __name2(() => call2("env.keys", agentId2), "keys")
24873
25521
  }), "env"),
24874
25522
  /**
24875
25523
  * SV (LUA-1080) — what `agentId` serves RIGHT NOW: its live skills (with tools), the published persona and its
24876
25524
  * pre/postprocessors, each with the version id an agent version snapshot would pin. Works with no promoted agent
24877
25525
  * version, so a release can diff live against a staged version. Metadata and hashes only (`observe`).
24878
25526
  */
24879
- deployed: /* @__PURE__ */ __name2((agentId) => call2("primitives.deployed", agentId), "deployed"),
25527
+ deployed: /* @__PURE__ */ __name2((agentId2) => call2("primitives.deployed", agentId2), "deployed"),
24880
25528
  /**
24881
25529
  * U25 — supervision events of the target (`observe`): each event of a subscribed kind starts
24882
25530
  * one of the CALLER's own triggers (`triggerName`) with a `source: 'supervision'` body.
24883
25531
  */
24884
- events: /* @__PURE__ */ __name2((agentId) => ({
24885
- subscribe: /* @__PURE__ */ __name2((opts) => call2("events.subscribe", agentId, {
25532
+ events: /* @__PURE__ */ __name2((agentId2) => ({
25533
+ subscribe: /* @__PURE__ */ __name2((opts) => call2("events.subscribe", agentId2, {
24886
25534
  kinds: Array.isArray(opts?.kinds) ? [
24887
25535
  ...opts.kinds
24888
25536
  ] : opts?.kinds,
24889
25537
  triggerName: opts?.triggerName
24890
25538
  }), "subscribe"),
24891
- unsubscribe: /* @__PURE__ */ __name2((triggerName) => call2("events.unsubscribe", agentId, {
25539
+ unsubscribe: /* @__PURE__ */ __name2((triggerName) => call2("events.unsubscribe", agentId2, {
24892
25540
  triggerName
24893
25541
  }), "unsubscribe"),
24894
- list: /* @__PURE__ */ __name2(() => call2("events.list", agentId), "list")
25542
+ list: /* @__PURE__ */ __name2(() => call2("events.list", agentId2), "list")
24895
25543
  }), "events"),
24896
25544
  // wave 2 U1
24897
25545
  /**
@@ -24918,26 +25566,26 @@ function buildSupervisionAgentsApi(call2) {
24918
25566
  approval: approvalIdsOf(opts?.approval)
24919
25567
  }), "create"),
24920
25568
  // wave 2 U6 — the target's connections (`observe`): list, and READ catalogue checks only.
24921
- integrations: /* @__PURE__ */ __name2((agentId) => ({
24922
- list: /* @__PURE__ */ __name2(() => call2("integrations.list", agentId), "list"),
24923
- check: /* @__PURE__ */ __name2((connectionId, check) => call2("integrations.check", agentId, {
25569
+ integrations: /* @__PURE__ */ __name2((agentId2) => ({
25570
+ list: /* @__PURE__ */ __name2(() => call2("integrations.list", agentId2), "list"),
25571
+ check: /* @__PURE__ */ __name2((connectionId, check) => call2("integrations.check", agentId2, {
24924
25572
  connectionId,
24925
25573
  check
24926
25574
  }), "check")
24927
25575
  }), "integrations"),
24928
25576
  // wave 2 U30
24929
25577
  /** Recorded metrics of the target (`observe`): by `name` or `objectiveId`, bucketed `1h` / `1d`. */
24930
- metrics: /* @__PURE__ */ __name2((agentId) => ({
24931
- query: /* @__PURE__ */ __name2((q) => call2("metrics.query", agentId, {
25578
+ metrics: /* @__PURE__ */ __name2((agentId2) => ({
25579
+ query: /* @__PURE__ */ __name2((q) => call2("metrics.query", agentId2, {
24932
25580
  ...q
24933
25581
  }), "query")
24934
25582
  }), "metrics"),
24935
25583
  /** Objectives of the target: list (`observe`); propose (`act`) — never effective until the OWNER confirms. */
24936
- objectives: /* @__PURE__ */ __name2((agentId) => ({
24937
- list: /* @__PURE__ */ __name2((opts = {}) => call2("objectives.list", agentId, {
25584
+ objectives: /* @__PURE__ */ __name2((agentId2) => ({
25585
+ list: /* @__PURE__ */ __name2((opts = {}) => call2("objectives.list", agentId2, {
24938
25586
  ...opts
24939
25587
  }), "list"),
24940
- propose: /* @__PURE__ */ __name2((proposal) => call2("objectives.propose", agentId, {
25588
+ propose: /* @__PURE__ */ __name2((proposal) => call2("objectives.propose", agentId2, {
24941
25589
  proposal
24942
25590
  }), "propose")
24943
25591
  }), "objectives"),
@@ -24947,13 +25595,13 @@ function buildSupervisionAgentsApi(call2) {
24947
25595
  * `lastAgentChangeAt`, so a supervisor can back off while a person is working on the agent;
24948
25596
  * `acquire` / `release` (`act`) take, renew or drop the CALLER's own lease (1-240 minutes).
24949
25597
  */
24950
- lease: /* @__PURE__ */ __name2((agentId) => ({
24951
- get: /* @__PURE__ */ __name2(() => call2("lease.get", agentId), "get"),
24952
- 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, {
24953
25601
  ttlMinutes: opts?.ttlMinutes,
24954
25602
  reason: opts?.reason
24955
25603
  }), "acquire"),
24956
- release: /* @__PURE__ */ __name2(() => call2("lease.release", agentId), "release")
25604
+ release: /* @__PURE__ */ __name2(() => call2("lease.release", agentId2), "release")
24957
25605
  }), "lease"),
24958
25606
  // wave 2 U4b
24959
25607
  /**
@@ -24962,15 +25610,15 @@ function buildSupervisionAgentsApi(call2) {
24962
25610
  * and revoke grants on it; external records are kept. `delete` also needs the agent's exact current name and
24963
25611
  * ends the 30-day restore window.
24964
25612
  */
24965
- lifecycle: /* @__PURE__ */ __name2((agentId) => ({
24966
- archive: /* @__PURE__ */ __name2(() => call2("lifecycle.archive", agentId), "archive"),
24967
- 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, {
24968
25616
  confirmName: opts?.confirmName
24969
25617
  }), "delete")
24970
25618
  }), "lifecycle"),
24971
25619
  /** U4b — set the model, the name or NON-secret env keys (`act`); keys ending SECRET/TOKEN/KEY/PASSWORD refuse. */
24972
- config: /* @__PURE__ */ __name2((agentId) => ({
24973
- set: /* @__PURE__ */ __name2((input) => call2("config.set", agentId, {
25620
+ config: /* @__PURE__ */ __name2((agentId2) => ({
25621
+ set: /* @__PURE__ */ __name2((input) => call2("config.set", agentId2, {
24974
25622
  ...input?.model !== void 0 ? {
24975
25623
  model: input.model
24976
25624
  } : {},
@@ -24993,7 +25641,7 @@ function buildSupervisionAgentsApi(call2) {
24993
25641
  * `dataCollections`, and `notifyOwner` (the owner opts in to `notifyOwner` messages by approving it). When the
24994
25642
  * caller already holds a grant, the request upgrades it and the approver sees exactly what is added.
24995
25643
  */
24996
- requestAccess: /* @__PURE__ */ __name2((agentId, opts) => call2("access.request", agentId, {
25644
+ requestAccess: /* @__PURE__ */ __name2((agentId2, opts) => call2("access.request", agentId2, {
24997
25645
  actions: Array.isArray(opts?.actions) ? [
24998
25646
  ...opts.actions
24999
25647
  ] : opts?.actions,
@@ -25026,15 +25674,15 @@ function buildSupervisionAgentsApi(call2) {
25026
25674
  * `'active'` — against a suite the owner defined (needs `supervision:preview` and the preview switch); results
25027
25675
  * are `observe`, transcripts (message bodies) need `observe-content`. `cancel` stops only runs you started.
25028
25676
  */
25029
- evals: /* @__PURE__ */ __name2((agentId) => ({
25677
+ evals: /* @__PURE__ */ __name2((agentId2) => ({
25030
25678
  /** The target's suites (key, revision, case count, pass rate). */
25031
- suites: /* @__PURE__ */ __name2(() => call2("evals.suites.get", agentId, {}), "suites"),
25679
+ suites: /* @__PURE__ */ __name2(() => call2("evals.suites.get", agentId2, {}), "suites"),
25032
25680
  /** One suite with its parsed cases. */
25033
- suite: /* @__PURE__ */ __name2((key) => call2("evals.suites.get", agentId, {
25681
+ suite: /* @__PURE__ */ __name2((key) => call2("evals.suites.get", agentId2, {
25034
25682
  key
25035
25683
  }), "suite"),
25036
25684
  /** Start a run: `{ runId, estimate }`. Bounded by the suite budget, the agent's monthly cap and a daily cap. */
25037
- run: /* @__PURE__ */ __name2((opts) => call2("evals.run", agentId, {
25685
+ run: /* @__PURE__ */ __name2((opts) => call2("evals.run", agentId2, {
25038
25686
  suite: opts?.suite,
25039
25687
  version: opts?.version,
25040
25688
  ...opts?.maxCredits !== void 0 ? {
@@ -25045,20 +25693,20 @@ function buildSupervisionAgentsApi(call2) {
25045
25693
  } : {}
25046
25694
  }), "run"),
25047
25695
  /** Runs, newest first (`suite`, `version`, `status`, `limit` ≤ 50, `before`). */
25048
- runs: /* @__PURE__ */ __name2((opts = {}) => call2("evals.get", agentId, {
25696
+ runs: /* @__PURE__ */ __name2((opts = {}) => call2("evals.get", agentId2, {
25049
25697
  ...opts
25050
25698
  }), "runs"),
25051
25699
  /** One run with its per-case results (check detail and judge reasoning only with observe-content). */
25052
- getRun: /* @__PURE__ */ __name2((runId) => call2("evals.get", agentId, {
25700
+ getRun: /* @__PURE__ */ __name2((runId) => call2("evals.get", agentId2, {
25053
25701
  runId
25054
25702
  }), "getRun"),
25055
25703
  /** One case's transcript (needs observe-content; a holdout case is not found). */
25056
- transcript: /* @__PURE__ */ __name2((runId, caseId) => call2("evals.get", agentId, {
25704
+ transcript: /* @__PURE__ */ __name2((runId, caseId) => call2("evals.get", agentId2, {
25057
25705
  runId,
25058
25706
  caseId
25059
25707
  }), "transcript"),
25060
25708
  /** Cancel a queued or running run YOU started (works with the preview switch off). */
25061
- cancel: /* @__PURE__ */ __name2((runId) => call2("evals.cancel", agentId, {
25709
+ cancel: /* @__PURE__ */ __name2((runId) => call2("evals.cancel", agentId2, {
25062
25710
  runId
25063
25711
  }), "cancel")
25064
25712
  }), "evals"),
@@ -25070,7 +25718,7 @@ function buildSupervisionAgentsApi(call2) {
25070
25718
  * An optional `idempotencyKey` makes a retry answer the first call's receipt instead of posting again; it is
25071
25719
  * forwarded only when present, so a keyless call sends exactly `{ message }`.
25072
25720
  */
25073
- notifyOwner: /* @__PURE__ */ __name2((agentId, input) => call2("owner.notify", agentId, {
25721
+ notifyOwner: /* @__PURE__ */ __name2((agentId2, input) => call2("owner.notify", agentId2, {
25074
25722
  message: input?.message,
25075
25723
  ...input?.idempotencyKey !== void 0 ? {
25076
25724
  idempotencyKey: input.idempotencyKey
@@ -25085,8 +25733,8 @@ function buildSupervisionAgentsApi(call2) {
25085
25733
  * exactly `Give your <integration> connection to "<agentName>"?`, then call this from a code step of THAT run with
25086
25734
  * `{ approval: { runId, stepId } }`. Needs an `act` grant on the agent.
25087
25735
  */
25088
- connections: /* @__PURE__ */ __name2((agentId) => ({
25089
- assign: /* @__PURE__ */ __name2((connectionId, opts) => call2("connections.assign", agentId, {
25736
+ connections: /* @__PURE__ */ __name2((agentId2) => ({
25737
+ assign: /* @__PURE__ */ __name2((connectionId, opts) => call2("connections.assign", agentId2, {
25090
25738
  connectionId,
25091
25739
  approval: opts?.approval && typeof opts.approval === "object" ? {
25092
25740
  ...opts.approval
@@ -25098,8 +25746,8 @@ function buildSupervisionAgentsApi(call2) {
25098
25746
  * Attach requests held for `agentId` to its env (`act`, on the agent owner's own turn; never overwrites a key).
25099
25747
  * Answers the env keys set, never a value.
25100
25748
  */
25101
- secrets: /* @__PURE__ */ __name2((agentId) => ({
25102
- attach: /* @__PURE__ */ __name2((requestIds) => call2("secrets.attach", agentId, {
25749
+ secrets: /* @__PURE__ */ __name2((agentId2) => ({
25750
+ attach: /* @__PURE__ */ __name2((requestIds) => call2("secrets.attach", agentId2, {
25103
25751
  requestIds: copyList(requestIds)
25104
25752
  }), "attach")
25105
25753
  }), "secrets")
@@ -25114,14 +25762,14 @@ function copyList(value3) {
25114
25762
  }
25115
25763
  __name(copyList, "copyList");
25116
25764
  __name2(copyList, "copyList");
25117
- function buildTestSessionHandle(call2, agentId, opened) {
25765
+ function buildTestSessionHandle(call2, agentId2, opened) {
25118
25766
  const sessionId = opened?.id;
25119
25767
  return {
25120
25768
  sessionId,
25121
25769
  version: opened?.version,
25122
25770
  session: opened,
25123
25771
  /** One multi-turn chat turn (same thread unless `threadId` names another key). */
25124
- chat: /* @__PURE__ */ __name2((input) => call2("sessions.chat", agentId, {
25772
+ chat: /* @__PURE__ */ __name2((input) => call2("sessions.chat", agentId2, {
25125
25773
  sessionId,
25126
25774
  ...typeof input === "string" ? {
25127
25775
  prompt: input
@@ -25130,16 +25778,16 @@ function buildTestSessionHandle(call2, agentId, opened) {
25130
25778
  }
25131
25779
  }), "chat"),
25132
25780
  /** Fire one primitive against the staged version: `{ trigger, payload }` in this phase. */
25133
- fire: /* @__PURE__ */ __name2((input) => call2("sessions.fire", agentId, {
25781
+ fire: /* @__PURE__ */ __name2((input) => call2("sessions.fire", agentId2, {
25134
25782
  sessionId,
25135
25783
  ...input
25136
25784
  }), "fire"),
25137
25785
  /** The effects the session recorded instead of executing. */
25138
- effects: /* @__PURE__ */ __name2(() => call2("sessions.effects", agentId, {
25786
+ effects: /* @__PURE__ */ __name2(() => call2("sessions.effects", agentId2, {
25139
25787
  sessionId
25140
25788
  }), "effects"),
25141
25789
  /** Close: purges the session's shadow Data and recorded effects. */
25142
- close: /* @__PURE__ */ __name2(() => call2("sessions.close", agentId, {
25790
+ close: /* @__PURE__ */ __name2(() => call2("sessions.close", agentId2, {
25143
25791
  sessionId
25144
25792
  }), "close")
25145
25793
  };
@@ -25658,7 +26306,7 @@ var LuaMCPServer = class {
25658
26306
  throw new Error("MCP server name is required");
25659
26307
  }
25660
26308
  if (config.transport === "stdio") {
25661
- throw new Error(`stdio transport is not supported yet. Please use 'streamable-http' (recommended) or 'sse' transport instead. See https://docs.heylua.ai/overview/mcp-servers for migration guide.`);
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.`);
25662
26310
  }
25663
26311
  if ((config.transport === "sse" || config.transport === "streamable-http") && !config.url) {
25664
26312
  throw new Error(`URL is required for ${config.transport} transport`);
@@ -26774,7 +27422,14 @@ var Agents = {
26774
27422
  const { getAgentsInstance: getAgentsInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
26775
27423
  const agents = await getAgentsInstance2();
26776
27424
  return agents.superviseForSandbox(op, targetAgentId, args);
26777
- })
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")
26778
27433
  };
26779
27434
  var Voice = {
26780
27435
  async call(input) {