lua-cli 3.39.0 → 3.39.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ var __export = (target, all) => {
18
18
  import { z } from "zod";
19
19
  import { z as z2 } from "zod";
20
20
  import { z as z3 } from "zod";
21
+ import { z as z4 } from "zod";
21
22
  function isChannelConversationChannel(channel) {
22
23
  return !!channel && CHANNEL_CONVERSATION_CHANNELS.includes(channel);
23
24
  }
@@ -114,9 +115,9 @@ function isMcpDraftCreateTool(tool) {
114
115
  function mcpSendSiblingForDraftTool(tool, availableToolIds) {
115
116
  const candidates = [
116
117
  ...availableToolIds
117
- ].filter((id) => id.endsWith(REVIEWABLE_MCP_SEND_TOOL_SUFFIX)).map((id) => ({
118
- id,
119
- serverName: id.slice(0, -REVIEWABLE_MCP_SEND_TOOL_SUFFIX.length)
118
+ ].filter((id2) => id2.endsWith(REVIEWABLE_MCP_SEND_TOOL_SUFFIX)).map((id2) => ({
119
+ id: id2,
120
+ serverName: id2.slice(0, -REVIEWABLE_MCP_SEND_TOOL_SUFFIX.length)
120
121
  })).filter(({ serverName }) => tool.startsWith(`${serverName}_`)).sort((a, b) => b.serverName.length - a.serverName.length);
121
122
  return candidates[0]?.id;
122
123
  }
@@ -277,8 +278,8 @@ function transformChatHistoryContentParts(parts) {
277
278
  }
278
279
  return content;
279
280
  }
280
- function isSyntheticSideRow(id) {
281
- return id.startsWith(SCREENSHOT_MESSAGE_ID_PREFIX) || id.startsWith(RICH_PARTS_MESSAGE_ID_PREFIX);
281
+ function isSyntheticSideRow(id2) {
282
+ return id2.startsWith(SCREENSHOT_MESSAGE_ID_PREFIX) || id2.startsWith(RICH_PARTS_MESSAGE_ID_PREFIX);
282
283
  }
283
284
  function mergeRichPartMirrorMessages(messages, sameTurnGroup) {
284
285
  const merged = [];
@@ -598,12 +599,12 @@ function isWorkflowArmEntryType(type) {
598
599
  function workflowContainerRunsHitlArm(container) {
599
600
  return typeof container === "string" && WORKFLOW_HITL_ARM_CONTAINERS.includes(container);
600
601
  }
601
- function workflowHitlArmUnsupportedMessage(type, id, container) {
602
+ function workflowHitlArmUnsupportedMessage(type, id2, container) {
602
603
  const legal = WORKFLOW_HITL_ARM_CONTAINERS.map((c) => `\`${c}\``).join(" / ");
603
- return `the engine does not run \`${type}\` inside a \`${container}\` yet (node "${id}") \u2014 place it at the top level, as a ${legal} arm, or inside a child \`workflow\``;
604
+ return `the engine does not run \`${type}\` inside a \`${container}\` yet (node "${id2}") \u2014 place it at the top level, as a ${legal} arm, or inside a child \`workflow\``;
604
605
  }
605
- function workflowHitlArmShapeMessage(type, id, shape) {
606
- return shape === "mapped-arm" ? `\`${type}\` arm "${id}" takes the previous output as its payload \u2014 it cannot head a [mapping, step] chain; map before the container instead` : `a chunked foreach hands each child a slice of items, not one \u2014 \`${type}\` body "${id}" takes one item; drop \`chunk\``;
606
+ function workflowHitlArmShapeMessage(type, id2, shape) {
607
+ return shape === "mapped-arm" ? `\`${type}\` arm "${id2}" takes the previous output as its payload \u2014 it cannot head a [mapping, step] chain; map before the container instead` : `a chunked foreach hands each child a slice of items, not one \u2014 \`${type}\` body "${id2}" takes one item; drop \`chunk\``;
607
608
  }
608
609
  function isModelIdSentinel(input) {
609
610
  const lower = (input ?? "").trim().toLowerCase();
@@ -1281,12 +1282,12 @@ function decodeLogCursor(raw) {
1281
1282
  return null;
1282
1283
  }
1283
1284
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
1284
- const { t, id } = parsed;
1285
+ const { t, id: id2 } = parsed;
1285
1286
  if (typeof t !== "number" || !Number.isSafeInteger(t) || t < 0) return null;
1286
- if (typeof id !== "string" || !id || id.length > LOG_CURSOR_MAX_ID_LENGTH) return null;
1287
+ if (typeof id2 !== "string" || !id2 || id2.length > LOG_CURSOR_MAX_ID_LENGTH) return null;
1287
1288
  return {
1288
1289
  t,
1289
- id
1290
+ id: id2
1290
1291
  };
1291
1292
  }
1292
1293
  function parseLogTimeBound(raw, now = /* @__PURE__ */ new Date()) {
@@ -1524,62 +1525,62 @@ function isKnownProfile(profiles, profileId) {
1524
1525
  function hasCapability(profiles, profileId, required) {
1525
1526
  return capabilitiesFor(profiles, profileId).includes(required);
1526
1527
  }
1527
- function workflowJobId(id) {
1528
- switch (id.kind) {
1528
+ function workflowJobId(id2) {
1529
+ switch (id2.kind) {
1529
1530
  case "start":
1530
- return `wft_${id.runId}_0`;
1531
+ return `wft_${id2.runId}_0`;
1531
1532
  case "start-redrive":
1532
- return `wft_${id.runId}_start_r${id.now}`;
1533
+ return `wft_${id2.runId}_start_r${id2.now}`;
1533
1534
  case "tick":
1534
- return `wft_${id.runId}_${id.seq}`;
1535
+ return `wft_${id2.runId}_${id2.seq}`;
1535
1536
  case "timer":
1536
- return `wft_${id.runId}_timer_${id.stepId}_${id.attempt}`;
1537
+ return `wft_${id2.runId}_timer_${id2.stepId}_${id2.attempt}`;
1537
1538
  case "timer-remainder":
1538
- return `wft_${id.runId}_timer_${id.stepId}_${id.attempt}_r${id.now}`;
1539
+ return `wft_${id2.runId}_timer_${id2.stepId}_${id2.attempt}_r${id2.now}`;
1539
1540
  case "timer-deferral":
1540
- return `wft_${id.runId}_timer_${id.stepId}_${id.attempt}_d${id.now}`;
1541
+ return `wft_${id2.runId}_timer_${id2.stepId}_${id2.attempt}_d${id2.now}`;
1541
1542
  case "timer-sibling":
1542
- return `wft_${id.runId}_timer_${id.stepId}_${id.attempt}_w${id.now}`;
1543
+ return `wft_${id2.runId}_timer_${id2.stepId}_${id2.attempt}_w${id2.now}`;
1543
1544
  case "retry":
1544
- return `wft_${id.runId}_retry_${id.stepId}_${id.attempt}`;
1545
+ return `wft_${id2.runId}_retry_${id2.stepId}_${id2.attempt}`;
1545
1546
  case "respawn":
1546
- return `wft_${id.runId}_respawn_${id.stepId}_${id.attempt}_s${id.segment}_r${id.now}`;
1547
+ return `wft_${id2.runId}_respawn_${id2.stepId}_${id2.attempt}_s${id2.segment}_r${id2.now}`;
1547
1548
  case "redrive":
1548
- return `wft_${id.runId}_redrive_${id.stepId}_${id.attempt}_r${id.now}`;
1549
+ return `wft_${id2.runId}_redrive_${id2.stepId}_${id2.attempt}_r${id2.now}`;
1549
1550
  case "redispatch":
1550
- return `wft_${id.runId}_redispatch_${id.stepId}_${id.attempt}_x${id.executionId ?? "none"}_r${id.now}`;
1551
+ return `wft_${id2.runId}_redispatch_${id2.stepId}_${id2.attempt}_x${id2.executionId ?? "none"}_r${id2.now}`;
1551
1552
  case "expiry":
1552
- return `wft_${id.runId}_expire_${id.stepId}_${id.attempt}_t${id.suspendedAt}${id.hop > 0 ? `_h${id.hop}` : ""}`;
1553
+ return `wft_${id2.runId}_expire_${id2.stepId}_${id2.attempt}_t${id2.suspendedAt}${id2.hop > 0 ? `_h${id2.hop}` : ""}`;
1553
1554
  case "step-terminal":
1554
- return `wft_${id.runId}_term_${id.stepId}_${id.attempt}_r${id.now}`;
1555
+ return `wft_${id2.runId}_term_${id2.stepId}_${id2.attempt}_r${id2.now}`;
1555
1556
  case "handback":
1556
- return `wft_${id.runId}_handback_${id.stepId}_${id.attempt}_${id.now}`;
1557
+ return `wft_${id2.runId}_handback_${id2.stepId}_${id2.attempt}_${id2.now}`;
1557
1558
  case "foreach-rate":
1558
- return `wft_${id.runId}_fe_${id.stepId}_${id.attempt}_${id.bucket}`;
1559
+ return `wft_${id2.runId}_fe_${id2.stepId}_${id2.attempt}_${id2.bucket}`;
1559
1560
  case "budget-expiry":
1560
- return `wft_${id.runId}_expiry_budget_r${id.now}`;
1561
+ return `wft_${id2.runId}_expiry_budget_r${id2.now}`;
1561
1562
  case "budget-resume":
1562
- return `wft_${id.runId}_resume_budget_${id.now}`;
1563
+ return `wft_${id2.runId}_resume_budget_${id2.now}`;
1563
1564
  case "deadline":
1564
- return `wft_${id.runId}_deadline_${id.deadlineAt}`;
1565
+ return `wft_${id2.runId}_deadline_${id2.deadlineAt}`;
1565
1566
  case "deadline-remainder":
1566
- return `wft_${id.runId}_deadline_${id.deadlineAt}_r${id.now}`;
1567
+ return `wft_${id2.runId}_deadline_${id2.deadlineAt}_r${id2.now}`;
1567
1568
  case "readmit":
1568
- return `wft_${id.runId}_readmit_${id.now}`;
1569
+ return `wft_${id2.runId}_readmit_${id2.now}`;
1569
1570
  case "cancel":
1570
- return `wft_${id.runId}_cancel`;
1571
+ return `wft_${id2.runId}_cancel`;
1571
1572
  case "reconcile":
1572
- return `wft_${id.runId}_reconcile_${id.now}`;
1573
+ return `wft_${id2.runId}_reconcile_${id2.now}`;
1573
1574
  case "replay":
1574
- return `wft_${id.runId}_replay_g${id.leaseGeneration}`;
1575
+ return `wft_${id2.runId}_replay_g${id2.leaseGeneration}`;
1575
1576
  case "migration":
1576
- return `wfm_${id.migrationId}`;
1577
+ return `wfm_${id2.migrationId}`;
1577
1578
  default:
1578
- return assertNever(id);
1579
+ return assertNever(id2);
1579
1580
  }
1580
1581
  }
1581
- function assertNever(id) {
1582
- throw new Error(`workflowJobId: unknown wake kind ${JSON.stringify(id)}`);
1582
+ function assertNever(id2) {
1583
+ throw new Error(`workflowJobId: unknown wake kind ${JSON.stringify(id2)}`);
1583
1584
  }
1584
1585
  function agentStepJobId(msg) {
1585
1586
  return `${msg.runId}_${msg.stepId}_${msg.attempt}_x${msg.executionId}`;
@@ -1617,11 +1618,11 @@ function isArchiveWindowTooOld(run, retentionDays, now = Date.now(), marginDays
1617
1618
  function workflowOrgPurgingKey(orgId) {
1618
1619
  return `wf:org:${orgId}:purging`;
1619
1620
  }
1620
- function isCloudTaskRunId(id) {
1621
- return id.startsWith(CLOUD_TASK_RUN_ID_PREFIX);
1621
+ function isCloudTaskRunId(id2) {
1622
+ return id2.startsWith(CLOUD_TASK_RUN_ID_PREFIX);
1622
1623
  }
1623
- function isScheduledWorkflowRunId(id) {
1624
- return id.startsWith(WORKFLOW_SCHEDULED_RUN_ID_PREFIX);
1624
+ function isScheduledWorkflowRunId(id2) {
1625
+ return id2.startsWith(WORKFLOW_SCHEDULED_RUN_ID_PREFIX);
1625
1626
  }
1626
1627
  function scheduledWorkflowRunId(jobId, scheduledTime) {
1627
1628
  const key = typeof scheduledTime === "number" ? String(scheduledTime) : scheduledTimeKey(scheduledTime);
@@ -1982,7 +1983,13 @@ function effectiveAgentFeatures(base, override, rule) {
1982
1983
  if (rule === "wholesale") return override || base || void 0;
1983
1984
  return effectiveAgentFeatureRows(base, override).rows;
1984
1985
  }
1985
- var __defProp2, __name2, PLUMBING_THREAD_CHANNELS, CHANNEL_CONVERSATION_CHANNELS, HIDDEN_THREAD_CHANNELS, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, LOG_FIELDS_MAX_KEYS, LOG_FIELD_MAX_VALUE_BYTES, LOG_FIELDS_MAX_BYTES, LOG_FIELD_KEY_PATTERN, LOG_FIELD_SECRET_SHAPED_KEY_PATTERNS, LOG_FIELDS_CLAMPED_KEY, LOG_FIELD_ARRAY_COUNT_SUFFIX, LuaLogFieldsError, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_MODEL_CLASSES, WORKFLOW_DEFAULT_TASK_CLASS_MAP, WORKFLOW_MODELS_MAX_CLASS_DEFAULT, WORKFLOW_AUTONOMY_NUMERIC_KEYS, WORKFLOW_AUTONOMY_ENVELOPE_KEYS, WORKFLOW_AUTONOMY_DEFAULTS, WORKFLOW_AUTONOMY_CEILINGS, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_ENV, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_CEILING, WORKFLOW_AUTONOMY_FORMS_DEFAULT, WORKFLOW_AUTONOMY_MIN_VALUE, WORKFLOW_JOB_RANGES, WORKFLOW_JOB_RANGE_MEMBERS, WORKFLOW_SINGLE_STEP_TYPES, WORKFLOW_HITL_ENTRY_TYPES, WORKFLOW_ARM_ENTRY_TYPES, WORKFLOW_HITL_ARM_CONTAINERS, WORKFLOW_GRAPH_ENTRY_STEP_KINDS, WORKFLOW_ARM_ENTRY_STEP_KINDS, WORKFLOW_BUDGET_MAX_DURATION_SECONDS, MODEL_ID_BYOK_PROVIDERS, MODEL_CLASS_REF_PREFIX, MODEL_SNAPSHOT_SUFFIX, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, AGENT_LOG_SOURCES, AGENT_LOG_FIELDS_MAX_WIRE_KEYS, LOG_DRAIN_TYPES_PHASE1, LOG_DRAIN_TYPES_PHASE2, LOG_DRAIN_TYPES_IMPLEMENTED, LOG_DRAIN_SOURCES, LOG_DRAIN_MAX_PER_ORG, LOG_DRAIN_MAX_PER_ORG_ENTERPRISE, LOG_DRAIN_DATADOG_SITES, LOG_DRAIN_NEWRELIC_SITES, LOG_DRAIN_ENDPOINT_TEMPLATES, LOG_DRAIN_PRESET_SITES, LOG_DRAIN_BUCKET_NAME_PATTERN, LOG_DRAIN_BUCKET_HOST_PATTERNS, LOG_DRAIN_PRESET_HOST_SUFFIXES, DRAIN_CONTENT_ACK_ERROR_CODE, DRAIN_CONTENT_ACK_FIELD, DrainContentAckRequiredError, LOG_DRAIN_PRESET_PATHS, PRESET_SEGMENT_RE, LOG_DRAIN_QUOTAS, LOG_DRAIN_QUOTA_WARN_RATIO, LOG_DRAIN_QUOTA_DROP_DEBUG_RATIO, LOG_DRAIN_QUOTA_DROP_INFO_RATIO, LOG_DRAIN_QUOTA_PAUSE_RATIO, LOG_EXPORT_SOURCES, LOG_EXPORT_MAX_WINDOW_DAYS, LOG_EXPORT_MAX_WINDOW_MS, LOG_EXPORT_URL_TTL_SECONDS, LOG_EXPORT_FILE_RETENTION_DAYS, LOG_EXPORT_FILE_RETENTION_MS, LOG_EXPORT_PART_MAX_BYTES, LOG_DRAIN_NOTICE_RATE_LIMIT_MS, LOG_DRAIN_VERIFICATION_STALE_MS, LOG_DRAIN_DIGEST_INTERVAL_MS, LOG_DRAIN_DIGEST_MAX_ENTRIES, LOG_DRAIN_NOTICE_ERROR_MAX_CHARS, LOG_DRAIN_USAGE_LINE_ITEM, LOG_DRAIN_BYTES_PER_GIB, DEFAULT_LOG_DRAIN_PLAN_CONFIG, TIERS, LOG_CURSOR_MAX_LENGTH, LOG_CURSOR_MAX_ID_LENGTH, LOG_RELATIVE_TIME_PATTERN, LOG_ISO_TIME_PATTERN, RELATIVE_UNIT_MS, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, KEYS, MAX_BODY_BYTES, MAX_ID_LENGTH, UTC_ISO, TEMPLATE_TRIGGER_URL_ENV_PREFIX, TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, LUA_SESSION_ID_CLAIM, SESSION_REVOKED_CODE, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_RUN_GATE_KINDS, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, WORKFLOW_SIGNAL_EVENT_SITES, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_JOB_MODEL_SOURCE_LABELS, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, WORKFLOW_GOAL_JUDGE_SELF, 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, 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;
1986
+ function parseOnboardingFlow(value3) {
1987
+ return onboardingFlowSchema.parse(value3);
1988
+ }
1989
+ function parsePublishedOnboardingResponse(value3) {
1990
+ return getPublishedOnboardingResponseSchema.parse(value3);
1991
+ }
1992
+ var __defProp2, __name2, PLUMBING_THREAD_CHANNELS, CHANNEL_CONVERSATION_CHANNELS, HIDDEN_THREAD_CHANNELS, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, LOG_FIELDS_MAX_KEYS, LOG_FIELD_MAX_VALUE_BYTES, LOG_FIELDS_MAX_BYTES, LOG_FIELD_KEY_PATTERN, LOG_FIELD_SECRET_SHAPED_KEY_PATTERNS, LOG_FIELDS_CLAMPED_KEY, LOG_FIELD_ARRAY_COUNT_SUFFIX, LuaLogFieldsError, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_MODEL_CLASSES, WORKFLOW_DEFAULT_TASK_CLASS_MAP, WORKFLOW_MODELS_MAX_CLASS_DEFAULT, WORKFLOW_AUTONOMY_NUMERIC_KEYS, WORKFLOW_AUTONOMY_ENVELOPE_KEYS, WORKFLOW_AUTONOMY_DEFAULTS, WORKFLOW_AUTONOMY_CEILINGS, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_ENV, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_CEILING, WORKFLOW_AUTONOMY_FORMS_DEFAULT, WORKFLOW_AUTONOMY_MIN_VALUE, WORKFLOW_JOB_RANGES, WORKFLOW_JOB_RANGE_MEMBERS, WORKFLOW_SINGLE_STEP_TYPES, WORKFLOW_HITL_ENTRY_TYPES, WORKFLOW_ARM_ENTRY_TYPES, WORKFLOW_HITL_ARM_CONTAINERS, WORKFLOW_GRAPH_ENTRY_STEP_KINDS, WORKFLOW_ARM_ENTRY_STEP_KINDS, WORKFLOW_BUDGET_MAX_DURATION_SECONDS, MODEL_ID_BYOK_PROVIDERS, MODEL_CLASS_REF_PREFIX, MODEL_SNAPSHOT_SUFFIX, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, AGENT_LOG_SOURCES, AGENT_LOG_FIELDS_MAX_WIRE_KEYS, LOG_DRAIN_TYPES_PHASE1, LOG_DRAIN_TYPES_PHASE2, LOG_DRAIN_TYPES_IMPLEMENTED, LOG_DRAIN_SOURCES, LOG_DRAIN_MAX_PER_ORG, LOG_DRAIN_MAX_PER_ORG_ENTERPRISE, LOG_DRAIN_DATADOG_SITES, LOG_DRAIN_NEWRELIC_SITES, LOG_DRAIN_ENDPOINT_TEMPLATES, LOG_DRAIN_PRESET_SITES, LOG_DRAIN_BUCKET_NAME_PATTERN, LOG_DRAIN_BUCKET_HOST_PATTERNS, LOG_DRAIN_PRESET_HOST_SUFFIXES, DRAIN_CONTENT_ACK_ERROR_CODE, DRAIN_CONTENT_ACK_FIELD, DrainContentAckRequiredError, LOG_DRAIN_PRESET_PATHS, PRESET_SEGMENT_RE, LOG_DRAIN_QUOTAS, LOG_DRAIN_QUOTA_WARN_RATIO, LOG_DRAIN_QUOTA_DROP_DEBUG_RATIO, LOG_DRAIN_QUOTA_DROP_INFO_RATIO, LOG_DRAIN_QUOTA_PAUSE_RATIO, LOG_EXPORT_SOURCES, LOG_EXPORT_MAX_WINDOW_DAYS, LOG_EXPORT_MAX_WINDOW_MS, LOG_EXPORT_URL_TTL_SECONDS, LOG_EXPORT_FILE_RETENTION_DAYS, LOG_EXPORT_FILE_RETENTION_MS, LOG_EXPORT_PART_MAX_BYTES, LOG_DRAIN_NOTICE_RATE_LIMIT_MS, LOG_DRAIN_VERIFICATION_STALE_MS, LOG_DRAIN_DIGEST_INTERVAL_MS, LOG_DRAIN_DIGEST_MAX_ENTRIES, LOG_DRAIN_NOTICE_ERROR_MAX_CHARS, LOG_DRAIN_USAGE_LINE_ITEM, LOG_DRAIN_BYTES_PER_GIB, DEFAULT_LOG_DRAIN_PLAN_CONFIG, TIERS, LOG_CURSOR_MAX_LENGTH, LOG_CURSOR_MAX_ID_LENGTH, LOG_RELATIVE_TIME_PATTERN, LOG_ISO_TIME_PATTERN, RELATIVE_UNIT_MS, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, KEYS, MAX_BODY_BYTES, MAX_ID_LENGTH, UTC_ISO, TEMPLATE_TRIGGER_URL_ENV_PREFIX, TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, LUA_SESSION_ID_CLAIM, SESSION_REVOKED_CODE, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_RUN_GATE_KINDS, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, WORKFLOW_SIGNAL_EVENT_SITES, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_JOB_MODEL_SOURCE_LABELS, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, WORKFLOW_GOAL_JUDGE_SELF, 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, 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, onboardingTemplateContentSchema, onboardingUnavailableOutcomeSchema, onboardingFlowSchema, onboardingActorSchema, onboardingEditorSchema, onboardingPublicationSummarySchema, onboardingValidationIssueSchema, onboardingValidationResponseSchema, onboardingAssetSchema, onboardingPublicAssetSchema, getOnboardingConfigResponseSchema, saveOnboardingDraftRequestSchema, validateOnboardingRequestSchema, publishOnboardingRequestSchema, rollbackOnboardingRequestSchema, onboardingTemplateCatalogItemSchema, getPublishedOnboardingResponseSchema;
1986
1993
  var init_dist = __esm({
1987
1994
  "../shared-types/dist/index.mjs"() {
1988
1995
  "use strict";
@@ -4143,6 +4150,236 @@ listed here; never invent a target.`;
4143
4150
  __name2(agentFeatureMergeRuleFromEnv, "agentFeatureMergeRuleFromEnv");
4144
4151
  __name(effectiveAgentFeatures, "effectiveAgentFeatures");
4145
4152
  __name2(effectiveAgentFeatures, "effectiveAgentFeatures");
4153
+ ONBOARDING_FLOW_KEY = "alpha-choose-meet";
4154
+ ONBOARDING_SCHEMA_VERSION = 1;
4155
+ id = z4.string().min(1).max(80).regex(/^[A-Za-z0-9][A-Za-z0-9_-]*$/);
4156
+ copy = /* @__PURE__ */ __name2((max) => z4.string().max(max), "copy");
4157
+ onboardingHeadingSchema = z4.discriminatedUnion("kind", [
4158
+ z4.object({
4159
+ kind: z4.literal("plain"),
4160
+ text: copy(240)
4161
+ }).strict(),
4162
+ z4.object({
4163
+ kind: z4.literal("highlighted"),
4164
+ before: copy(240),
4165
+ highlight: copy(240),
4166
+ after: copy(240)
4167
+ }).strict()
4168
+ ]);
4169
+ onboardingRichTextInlineSchema = z4.discriminatedUnion("kind", [
4170
+ z4.object({
4171
+ kind: z4.literal("text"),
4172
+ text: copy(2e3),
4173
+ marks: z4.array(z4.enum([
4174
+ "bold",
4175
+ "italic"
4176
+ ])).max(2).refine((marks) => new Set(marks).size === marks.length, "Text marks must be unique").optional()
4177
+ }).strict(),
4178
+ z4.object({
4179
+ kind: z4.literal("lineBreak")
4180
+ }).strict()
4181
+ ]);
4182
+ onboardingRichTextSchema = z4.object({
4183
+ blocks: z4.array(z4.object({
4184
+ kind: z4.literal("paragraph"),
4185
+ content: z4.array(onboardingRichTextInlineSchema).max(100)
4186
+ }).strict()).max(40)
4187
+ }).strict();
4188
+ onboardingDestinationSchema = z4.discriminatedUnion("kind", [
4189
+ z4.object({
4190
+ kind: z4.literal("question"),
4191
+ questionId: id
4192
+ }).strict(),
4193
+ z4.object({
4194
+ kind: z4.literal("template"),
4195
+ templateContentId: id
4196
+ }).strict(),
4197
+ z4.object({
4198
+ kind: z4.literal("unavailable"),
4199
+ unavailableId: id
4200
+ }).strict()
4201
+ ]);
4202
+ onboardingArtworkSchema = z4.discriminatedUnion("kind", [
4203
+ z4.object({
4204
+ kind: z4.literal("builtinRing")
4205
+ }).strict(),
4206
+ z4.object({
4207
+ kind: z4.literal("uploaded"),
4208
+ assetId: id,
4209
+ accessibility: z4.discriminatedUnion("kind", [
4210
+ z4.object({
4211
+ kind: z4.literal("decorative")
4212
+ }).strict(),
4213
+ z4.object({
4214
+ kind: z4.literal("described"),
4215
+ altText: copy(500)
4216
+ }).strict()
4217
+ ])
4218
+ }).strict()
4219
+ ]);
4220
+ onboardingAnswerSchema = z4.object({
4221
+ id,
4222
+ label: copy(160),
4223
+ supportingText: copy(500).optional(),
4224
+ destination: onboardingDestinationSchema.nullable()
4225
+ }).strict();
4226
+ onboardingQuestionSchema = z4.object({
4227
+ id,
4228
+ heading: onboardingHeadingSchema,
4229
+ helperText: onboardingRichTextSchema.optional(),
4230
+ continueButtonLabel: copy(80),
4231
+ answers: z4.array(onboardingAnswerSchema).max(30)
4232
+ }).strict();
4233
+ onboardingTemplateSectionSchema = z4.object({
4234
+ id,
4235
+ label: copy(100),
4236
+ body: onboardingRichTextSchema
4237
+ }).strict();
4238
+ onboardingTemplateContentSchema = z4.object({
4239
+ id,
4240
+ templateId: copy(160),
4241
+ displayName: copy(100),
4242
+ eyebrow: copy(100).optional(),
4243
+ heading: onboardingHeadingSchema,
4244
+ description: onboardingRichTextSchema,
4245
+ badges: z4.array(copy(80)).max(12),
4246
+ sections: z4.array(onboardingTemplateSectionSchema).max(20),
4247
+ artwork: onboardingArtworkSchema,
4248
+ hireButtonLabel: copy(80),
4249
+ changeRoleButtonLabel: copy(80),
4250
+ nextStepText: onboardingRichTextSchema
4251
+ }).strict();
4252
+ onboardingUnavailableOutcomeSchema = z4.object({
4253
+ id,
4254
+ heading: onboardingHeadingSchema,
4255
+ explanation: onboardingRichTextSchema,
4256
+ backButtonLabel: copy(80),
4257
+ alternative: z4.object({
4258
+ templateContentId: id,
4259
+ introduction: onboardingRichTextSchema,
4260
+ buttonLabel: copy(80)
4261
+ }).strict().optional()
4262
+ }).strict();
4263
+ onboardingFlowSchema = z4.object({
4264
+ key: z4.literal(ONBOARDING_FLOW_KEY),
4265
+ schemaVersion: z4.literal(ONBOARDING_SCHEMA_VERSION),
4266
+ entryQuestionId: id.nullable(),
4267
+ questions: z4.array(onboardingQuestionSchema).max(100),
4268
+ templateContents: z4.array(onboardingTemplateContentSchema).max(100),
4269
+ unavailableOutcomes: z4.array(onboardingUnavailableOutcomeSchema).max(100)
4270
+ }).strict();
4271
+ onboardingActorSchema = z4.object({
4272
+ subjectId: z4.string(),
4273
+ email: z4.string().email()
4274
+ }).strict();
4275
+ onboardingEditorSchema = onboardingActorSchema.extend({
4276
+ editedAt: z4.string().datetime({
4277
+ offset: true
4278
+ })
4279
+ }).strict();
4280
+ onboardingPublicationSummarySchema = z4.object({
4281
+ publicationId: id,
4282
+ revision: z4.number().int().positive(),
4283
+ sourceDraftVersion: z4.number().int().nonnegative(),
4284
+ contentHash: z4.string().regex(/^[a-f0-9]{64}$/),
4285
+ publishedAt: z4.string().datetime({
4286
+ offset: true
4287
+ }),
4288
+ publishedBy: onboardingActorSchema,
4289
+ questionCount: z4.number().int().nonnegative(),
4290
+ templateCount: z4.number().int().nonnegative(),
4291
+ unavailableCount: z4.number().int().nonnegative()
4292
+ }).strict();
4293
+ onboardingValidationIssueSchema = z4.object({
4294
+ code: z4.string(),
4295
+ path: z4.string(),
4296
+ message: z4.string()
4297
+ }).strict();
4298
+ onboardingValidationResponseSchema = z4.discriminatedUnion("valid", [
4299
+ z4.object({
4300
+ valid: z4.literal(true),
4301
+ summary: z4.object({
4302
+ questionCount: z4.number().int().nonnegative(),
4303
+ templateCount: z4.number().int().nonnegative(),
4304
+ unavailableCount: z4.number().int().nonnegative()
4305
+ }).strict()
4306
+ }).strict(),
4307
+ z4.object({
4308
+ valid: z4.literal(false),
4309
+ issues: z4.array(onboardingValidationIssueSchema)
4310
+ }).strict()
4311
+ ]);
4312
+ onboardingAssetSchema = z4.object({
4313
+ assetId: id,
4314
+ url: z4.string().url(),
4315
+ width: z4.number().int().positive(),
4316
+ height: z4.number().int().positive(),
4317
+ contentType: z4.enum([
4318
+ "image/png",
4319
+ "image/jpeg",
4320
+ "image/webp"
4321
+ ]),
4322
+ bytes: z4.number().int().positive(),
4323
+ sha256: z4.string().regex(/^[a-f0-9]{64}$/),
4324
+ createdAt: z4.string().datetime({
4325
+ offset: true
4326
+ }),
4327
+ uploadedBy: onboardingActorSchema
4328
+ }).strict();
4329
+ onboardingPublicAssetSchema = onboardingAssetSchema.pick({
4330
+ assetId: true,
4331
+ url: true,
4332
+ width: true,
4333
+ height: true,
4334
+ contentType: true
4335
+ }).strict();
4336
+ getOnboardingConfigResponseSchema = z4.object({
4337
+ flowKey: z4.literal(ONBOARDING_FLOW_KEY),
4338
+ draftVersion: z4.number().int().nonnegative(),
4339
+ draft: onboardingFlowSchema,
4340
+ assets: z4.array(onboardingAssetSchema),
4341
+ lastEditor: onboardingEditorSchema.nullable(),
4342
+ activePublication: onboardingPublicationSummarySchema.nullable()
4343
+ }).strict();
4344
+ saveOnboardingDraftRequestSchema = z4.object({
4345
+ expectedDraftVersion: z4.number().int().nonnegative(),
4346
+ draft: onboardingFlowSchema
4347
+ }).strict();
4348
+ validateOnboardingRequestSchema = z4.object({
4349
+ draft: onboardingFlowSchema
4350
+ }).strict();
4351
+ publishOnboardingRequestSchema = z4.object({
4352
+ expectedDraftVersion: z4.number().int().nonnegative(),
4353
+ expectedActivePublicationId: id.nullable()
4354
+ }).strict();
4355
+ rollbackOnboardingRequestSchema = z4.object({
4356
+ publicationId: id,
4357
+ expectedActivePublicationId: id.nullable()
4358
+ }).strict();
4359
+ onboardingTemplateCatalogItemSchema = z4.object({
4360
+ templateId: z4.string(),
4361
+ name: z4.string(),
4362
+ description: z4.string().optional()
4363
+ }).strict();
4364
+ getPublishedOnboardingResponseSchema = z4.discriminatedUnion("status", [
4365
+ z4.object({
4366
+ status: z4.literal("available"),
4367
+ publicationId: id,
4368
+ revision: z4.number().int().positive(),
4369
+ contentHash: z4.string().regex(/^[a-f0-9]{64}$/),
4370
+ flow: onboardingFlowSchema,
4371
+ assets: z4.array(onboardingPublicAssetSchema)
4372
+ }).strict(),
4373
+ z4.object({
4374
+ status: z4.literal("unavailable"),
4375
+ reason: z4.literal("not_published"),
4376
+ message: z4.string()
4377
+ }).strict()
4378
+ ]);
4379
+ __name(parseOnboardingFlow, "parseOnboardingFlow");
4380
+ __name2(parseOnboardingFlow, "parseOnboardingFlow");
4381
+ __name(parsePublishedOnboardingResponse, "parsePublishedOnboardingResponse");
4382
+ __name2(parsePublishedOnboardingResponse, "parsePublishedOnboardingResponse");
4146
4383
  }
4147
4384
  });
4148
4385
 
@@ -4150,9 +4387,9 @@ listed here; never invent a target.`;
4150
4387
  function effectiveJobTools(jobTools, readOnly) {
4151
4388
  const base = jobTools?.length ? jobTools : WORKFLOW_JOB_DEFAULT_TOOLS;
4152
4389
  const out = [];
4153
- for (const id of base) {
4154
- if (readOnly && WORKFLOW_JOB_READ_ONLY_DROPPED.includes(id)) continue;
4155
- if (!out.includes(id)) out.push(id);
4390
+ for (const id2 of base) {
4391
+ if (readOnly && WORKFLOW_JOB_READ_ONLY_DROPPED.includes(id2)) continue;
4392
+ if (!out.includes(id2)) out.push(id2);
4156
4393
  }
4157
4394
  return out;
4158
4395
  }
@@ -4196,7 +4433,7 @@ var init_workflow_job_tools = __esm({
4196
4433
 
4197
4434
  // ../workflow-graph/dist/index.mjs
4198
4435
  import { createHash } from "crypto";
4199
- import { z as z4 } from "zod";
4436
+ import { z as z5 } from "zod";
4200
4437
  import { z as z22 } from "zod";
4201
4438
  import { createHash as createHash2 } from "crypto";
4202
4439
  function isMapConfigObject(v) {
@@ -4323,9 +4560,9 @@ function malformedMapMembers(cfg) {
4323
4560
  }
4324
4561
  return out;
4325
4562
  }
4326
- function mapMemberMalformedMessage(id, m) {
4563
+ function mapMemberMalformedMessage(id2, m) {
4327
4564
  const keys = m.keys.map((k) => `\`${k}\``).join(", ");
4328
- return `"${id}".${m.member} carries descriptor key${m.keys.length === 1 ? "" : "s"} ${keys} but is not an exact binding form ({initData:true, path} | {step, path[, rows]} | {value} | {template} | {requestContextPath} | {knowledge}) \u2014 it is passed to the step verbatim as a literal; fix the descriptor, or wrap it in {value: \u2026} if the literal is intended`;
4565
+ return `"${id2}".${m.member} carries descriptor key${m.keys.length === 1 ? "" : "s"} ${keys} but is not an exact binding form ({initData:true, path} | {step, path[, rows]} | {value} | {template} | {requestContextPath} | {knowledge}) \u2014 it is passed to the step verbatim as a literal; fix the descriptor, or wrap it in {value: \u2026} if the literal is intended`;
4329
4566
  }
4330
4567
  function resolveDescriptor(key, m, ctx) {
4331
4568
  if (!isMapDescriptor(m)) return {
@@ -4679,11 +4916,11 @@ function retryBackoffs() {
4679
4916
  }
4680
4917
  return WORKFLOW_RETRY_BACKOFFS;
4681
4918
  }
4682
- function sleepUntilUnsupportedMessage(id) {
4683
- return `the engine does not execute \`sleepUntil\` yet (node "${id}") \u2014 replace it with a \`sleep\` node with a \`duration\` in ms, e.g. { type: 'sleep', id: '${id}', duration: ${SLEEP_UNTIL_REPLACEMENT.duration} }`;
4919
+ function sleepUntilUnsupportedMessage(id2) {
4920
+ return `the engine does not execute \`sleepUntil\` yet (node "${id2}") \u2014 replace it with a \`sleep\` node with a \`duration\` in ms, e.g. { type: 'sleep', id: '${id2}', duration: ${SLEEP_UNTIL_REPLACEMENT.duration} }`;
4684
4921
  }
4685
- function armSubrunUnsupportedMessage(id, workflowId) {
4686
- return `the engine does not execute the implicit \`${workflowId}\` arm subrun (node "${id}") \u2014 a [map, step] container arm is the step itself with the map as its \`input\` since lua-cli 3.32.4; re-run \`lua compile\` with the current CLI (a hand-written artifact: put the map on the arm node's \`input\` and drop the \`workflow\` wrapper)`;
4922
+ function armSubrunUnsupportedMessage(id2, workflowId) {
4923
+ return `the engine does not execute the implicit \`${workflowId}\` arm subrun (node "${id2}") \u2014 a [map, step] container arm is the step itself with the map as its \`input\` since lua-cli 3.32.4; re-run \`lua compile\` with the current CLI (a hand-written artifact: put the map on the arm node's \`input\` and drop the \`workflow\` wrapper)`;
4687
4924
  }
4688
4925
  function fillPolicy(node, defaultTimeout) {
4689
4926
  if (node.tier === void 0 && node.workspace !== void 0 && node.workspace !== "inherit") node.tier = "job";
@@ -4943,20 +5180,20 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
4943
5180
  const seen = /* @__PURE__ */ new Map();
4944
5181
  let nodeCount = 0;
4945
5182
  const upstream = /* @__PURE__ */ new Set();
4946
- const checkId = /* @__PURE__ */ __name4((id, path3) => {
5183
+ const checkId = /* @__PURE__ */ __name4((id2, path3) => {
4947
5184
  nodeCount += 1;
4948
- if (seen.has(id)) {
4949
- err("duplicate-step-id", `step id "${id}" is declared twice (first at ${seen.get(id)})`, path3, id);
5185
+ if (seen.has(id2)) {
5186
+ err("duplicate-step-id", `step id "${id2}" is declared twice (first at ${seen.get(id2)})`, path3, id2);
4950
5187
  } else {
4951
- seen.set(id, path3);
5188
+ seen.set(id2, path3);
4952
5189
  }
4953
5190
  }, "checkId");
4954
5191
  const checkPolicyEnums = /* @__PURE__ */ __name4((node, path3) => {
4955
- const id = singleId(node);
5192
+ const id2 = singleId(node);
4956
5193
  const check = /* @__PURE__ */ __name4((member, allowed) => {
4957
5194
  const value22 = node[member];
4958
5195
  if (value22 === void 0 || typeof value22 === "string" && allowed.includes(value22)) return;
4959
- err("invalid-envelope", `\`${member}\` must be ${allowed.map((a) => `'${a}'`).join(" | ")} (got ${JSON.stringify(value22)})`, `${path3}.${member}`, id);
5196
+ err("invalid-envelope", `\`${member}\` must be ${allowed.map((a) => `'${a}'`).join(" | ")} (got ${JSON.stringify(value22)})`, `${path3}.${member}`, id2);
4960
5197
  }, "check");
4961
5198
  check("sideEffects", WORKFLOW_SIDE_EFFECTS);
4962
5199
  check("jobResources", WORKFLOW_JOB_RESOURCES);
@@ -4964,46 +5201,46 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
4964
5201
  const checkRetry = /* @__PURE__ */ __name4((node, path3) => {
4965
5202
  const r = node.retry;
4966
5203
  if (!r) return;
4967
- const id = singleId(node);
5204
+ const id2 = singleId(node);
4968
5205
  const unknown = unknownWorkflowRetryMembers(r);
4969
- if (unknown.length) err("invalid-envelope", workflowRetryUnknownMembersMessage(unknown), `${path3}.retry`, id);
5206
+ if (unknown.length) err("invalid-envelope", workflowRetryUnknownMembersMessage(unknown), `${path3}.retry`, id2);
4970
5207
  if (!isWithinWorkflowRetryAttempts(r.maxAttempts)) {
4971
5208
  const over = typeof r.maxAttempts === "number" && r.maxAttempts > WORKFLOW_RETRY_MAX_ATTEMPTS;
4972
- err(over ? "cap-exceeded" : "invalid-envelope", workflowRetryMaxAttemptsMessage(r.maxAttempts), `${path3}.retry.maxAttempts`, id);
5209
+ err(over ? "cap-exceeded" : "invalid-envelope", workflowRetryMaxAttemptsMessage(r.maxAttempts), `${path3}.retry.maxAttempts`, id2);
4973
5210
  }
4974
5211
  const backoffs = retryBackoffs();
4975
5212
  if (r.backoff !== void 0 && !backoffs.includes(r.backoff)) {
4976
5213
  const list = backoffs.map((b) => `'${b}'`).join(" | ");
4977
- err("backoff-invalid", `retry.backoff must be ${list}`, `${path3}.retry.backoff`, id);
5214
+ err("backoff-invalid", `retry.backoff must be ${list}`, `${path3}.retry.backoff`, id2);
4978
5215
  }
4979
5216
  if (r.backoffSeconds !== void 0 && r.backoffSeconds < 0) {
4980
- err("backoff-invalid", "retry.backoffSeconds must be \u2265 0", `${path3}.retry.backoffSeconds`, id);
5217
+ err("backoff-invalid", "retry.backoffSeconds must be \u2265 0", `${path3}.retry.backoffSeconds`, id2);
4981
5218
  }
4982
5219
  if (r.maxBackoffSeconds !== void 0) {
4983
5220
  if (r.backoff !== "exponential") {
4984
- err("backoff-invalid", "retry.maxBackoffSeconds is only meaningful with backoff:'exponential'", `${path3}.retry`, id);
5221
+ err("backoff-invalid", "retry.maxBackoffSeconds is only meaningful with backoff:'exponential'", `${path3}.retry`, id2);
4985
5222
  } else if (r.maxBackoffSeconds <= 0 || r.backoffSeconds !== void 0 && r.maxBackoffSeconds < r.backoffSeconds) {
4986
- err("backoff-invalid", "retry.maxBackoffSeconds must be > 0 and \u2265 backoffSeconds", `${path3}.retry.maxBackoffSeconds`, id);
5223
+ err("backoff-invalid", "retry.maxBackoffSeconds must be > 0 and \u2265 backoffSeconds", `${path3}.retry.maxBackoffSeconds`, id2);
4987
5224
  }
4988
5225
  }
4989
5226
  }, "checkRetry");
4990
5227
  const checkTimeout = /* @__PURE__ */ __name4((node, path3) => {
4991
5228
  const t = node.timeoutSeconds;
4992
5229
  if (t === void 0) return;
4993
- const id = singleId(node);
5230
+ const id2 = singleId(node);
4994
5231
  if (!Number.isInteger(t) || t < 1) {
4995
- err("timeout-out-of-range", `timeoutSeconds must be an integer \u2265 1 (got ${t})`, `${path3}.timeoutSeconds`, id);
5232
+ err("timeout-out-of-range", `timeoutSeconds must be an integer \u2265 1 (got ${t})`, `${path3}.timeoutSeconds`, id2);
4996
5233
  return;
4997
5234
  }
4998
5235
  if (node.tier === "job") {
4999
5236
  const cap = node.type === "agent" ? caps.maxJobTimeoutSeconds : caps.maxJobSegmentSeconds;
5000
5237
  if (t > cap) {
5001
- err("job-timeout-exceeds-cap", `timeoutSeconds ${t} exceeds the Job-tier cap of ${cap} s`, `${path3}.timeoutSeconds`, id);
5238
+ err("job-timeout-exceeds-cap", `timeoutSeconds ${t} exceeds the Job-tier cap of ${cap} s`, `${path3}.timeoutSeconds`, id2);
5002
5239
  } else if (node.type === "agent" && t > caps.maxJobSegmentSeconds && !node.workspace) {
5003
- err("long-job-requires-workspace", `steps longer than 4 h checkpoint to the run workspace \u2014 add workspace:{mount:'rw'} (and workspace on createWorkflow) or split the step`, `${path3}.timeoutSeconds`, id);
5240
+ err("long-job-requires-workspace", `steps longer than 4 h checkpoint to the run workspace \u2014 add workspace:{mount:'rw'} (and workspace on createWorkflow) or split the step`, `${path3}.timeoutSeconds`, id2);
5004
5241
  }
5005
5242
  } else if (t > caps.maxWorkerTimeoutSeconds) {
5006
- err("timeout-exceeds-tier", `timeoutSeconds ${t} exceeds the worker tier's ${caps.maxWorkerTimeoutSeconds} s \u2014 steps longer than 10 min run on the Job tier: add tier:'job' (up to ${caps.maxJobSegmentSeconds} s)`, `${path3}.timeoutSeconds`, id);
5243
+ err("timeout-exceeds-tier", `timeoutSeconds ${t} exceeds the worker tier's ${caps.maxWorkerTimeoutSeconds} s \u2014 steps longer than 10 min run on the Job tier: add tier:'job' (up to ${caps.maxJobSegmentSeconds} s)`, `${path3}.timeoutSeconds`, id2);
5007
5244
  }
5008
5245
  }, "checkTimeout");
5009
5246
  const checkSpecialistRole = /* @__PURE__ */ __name4((node, path3) => {
@@ -5067,32 +5304,32 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
5067
5304
  return void 0;
5068
5305
  }, "jobClassifiablePin");
5069
5306
  const checkTier = /* @__PURE__ */ __name4((node, path3) => {
5070
- const id = singleId(node);
5307
+ const id2 = singleId(node);
5071
5308
  if (node.workspace && node.workspace !== "inherit" && node.tier !== void 0 && node.tier !== "job") {
5072
- err("workspace-requires-job-tier", "a step mounting a workspace must be tier:'job'", `${path3}.workspace`, id);
5309
+ err("workspace-requires-job-tier", "a step mounting a workspace must be tier:'job'", `${path3}.workspace`, id2);
5073
5310
  }
5074
5311
  if (node.harness !== void 0 && node.tier !== "job") {
5075
- err("harness-requires-job-tier", "`harness` is only legal on a tier:'job' agent step", `${path3}.harness`, id);
5312
+ err("harness-requires-job-tier", "`harness` is only legal on a tier:'job' agent step", `${path3}.harness`, id2);
5076
5313
  }
5077
5314
  const provider = node.type === "agent" ? classifyModelProvider(jobClassifiablePin(node.model)) : null;
5078
5315
  if (node.harness === "claude-code" && provider !== null && provider !== "anthropic") {
5079
- err("harness-provider-mismatch", `harness:'claude-code' needs an Anthropic model (model "${node.type === "agent" ? node.model : ""}" is ${provider})`, `${path3}.harness`, id);
5316
+ err("harness-provider-mismatch", `harness:'claude-code' needs an Anthropic model (model "${node.type === "agent" ? node.model : ""}" is ${provider})`, `${path3}.harness`, id2);
5080
5317
  }
5081
5318
  if (isJobTier(node) && provider !== null && opts.policy?.jobProviders && !opts.policy.jobProviders.includes(provider)) {
5082
- err("job-tier-provider-unsupported", `model provider '${provider}' is outside LUA_WF_JOB_PROVIDERS [${opts.policy.jobProviders.join(", ")}]`, `${path3}.model`, id);
5319
+ err("job-tier-provider-unsupported", `model provider '${provider}' is outside LUA_WF_JOB_PROVIDERS [${opts.policy.jobProviders.join(", ")}]`, `${path3}.model`, id2);
5083
5320
  }
5084
5321
  }, "checkTier");
5085
5322
  const checkModel = /* @__PURE__ */ __name4((node, path3) => {
5086
5323
  if (node.type !== "agent" || typeof node.model !== "string") return;
5087
- const id = singleId(node);
5324
+ const id2 = singleId(node);
5088
5325
  const parsed = parseModelTemplate(node.model);
5089
5326
  if (parsed.kind === "invalid") {
5090
- err("model-template-invalid", parsed.message, `${path3}.model`, id);
5327
+ err("model-template-invalid", parsed.message, `${path3}.model`, id2);
5091
5328
  return;
5092
5329
  }
5093
5330
  if (parsed.kind === "template" && parsed.template.default === void 0) {
5094
5331
  if (isJobTier(node)) {
5095
- err("model-template-default-required", modelTemplateDefaultRequiredMessage(node.model), `${path3}.model`, id);
5332
+ err("model-template-default-required", modelTemplateDefaultRequiredMessage(node.model), `${path3}.model`, id2);
5096
5333
  }
5097
5334
  return;
5098
5335
  }
@@ -5105,12 +5342,12 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
5105
5342
  if (registry === "unavailable") {
5106
5343
  const trimmed = pin.trim();
5107
5344
  if (trimmed && !normalizeModelId(trimmed, []).ok) {
5108
- warn("model-unresolved", inContext(`model "${trimmed}" could not be checked against the approved-model registry (unavailable at push) \u2014 it dispatches only if it resolves there (a provider/model registry code, or a bare id exactly one approved model carries)`), `${path3}.model`, id);
5345
+ warn("model-unresolved", inContext(`model "${trimmed}" could not be checked against the approved-model registry (unavailable at push) \u2014 it dispatches only if it resolves there (a provider/model registry code, or a bare id exactly one approved model carries)`), `${path3}.model`, id2);
5109
5346
  }
5110
5347
  return;
5111
5348
  }
5112
5349
  const resolved = normalizeModelId(pin, registry);
5113
- if (!resolved.ok) err("model-unresolved", inContext(modelUnresolvedMessage(resolved)), `${path3}.model`, id);
5350
+ if (!resolved.ok) err("model-unresolved", inContext(modelUnresolvedMessage(resolved)), `${path3}.model`, id2);
5114
5351
  }, "checkModel");
5115
5352
  const checkTaskClass = /* @__PURE__ */ __name4((node, path3) => {
5116
5353
  if (node.type !== "agent" || node.taskClass === void 0) return;
@@ -5119,46 +5356,46 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
5119
5356
  err("task-class-without-model", `taskClass '${String(node.taskClass)}' needs a \`model\` on a pushed definition \u2014 write a class (model: 'class/fast' | 'class/balanced' | 'class/strong') or an approved provider/model code; nothing maps a task class to a model at dispatch, so a step with neither would run on the agent\u2019s own model`, `${path3}.taskClass`, singleId(node));
5120
5357
  }, "checkTaskClass");
5121
5358
  const checkWorkspace = /* @__PURE__ */ __name4((node, path3) => {
5122
- const id = singleId(node);
5359
+ const id2 = singleId(node);
5123
5360
  const ws = workspaceOf(node);
5124
5361
  if (isJobTier(node) && opts.policy && opts.policy.jobTier !== true) {
5125
- err("job-tier-disabled", `"${id}" runs on the Job tier but the org's workflowPolicy.jobTier is off \u2014 an org admin enables it (lua features workflows.caps.jobTier true)`, `${path3}.tier`, id);
5362
+ err("job-tier-disabled", `"${id2}" runs on the Job tier but the org's workflowPolicy.jobTier is off \u2014 an org admin enables it (lua features workflows.caps.jobTier true)`, `${path3}.tier`, id2);
5126
5363
  }
5127
5364
  const tools = jobToolsOf(node);
5128
5365
  if (tools !== void 0) {
5129
5366
  if (!isJobTier(node)) {
5130
- err("job-tools-require-job-tier", "`jobTools` needs tier:'job'", `${path3}.jobTools`, id);
5367
+ err("job-tools-require-job-tier", "`jobTools` needs tier:'job'", `${path3}.jobTools`, id2);
5131
5368
  }
5132
5369
  const unknown = (Array.isArray(tools) ? tools : [
5133
5370
  tools
5134
5371
  ]).filter((t) => !WORKFLOW_JOB_TOOLS.includes(t));
5135
5372
  if (unknown.length > 0) {
5136
- err("job-tools-unknown", `jobTools ${JSON.stringify(unknown)} outside WORKFLOW_JOB_TOOLS [${WORKFLOW_JOB_TOOLS.join(", ")}]`, `${path3}.jobTools`, id);
5373
+ err("job-tools-unknown", `jobTools ${JSON.stringify(unknown)} outside WORKFLOW_JOB_TOOLS [${WORKFLOW_JOB_TOOLS.join(", ")}]`, `${path3}.jobTools`, id2);
5137
5374
  }
5138
5375
  if (node.type === "agent" && (Array.isArray(tools) ? tools : [
5139
5376
  tools
5140
5377
  ]).includes("gh")) {
5141
- warn("gh-on-coding-turn", `"${id}" grants the gh tool on a coding turn \u2014 the pod can open/merge PRs on the workspace repo (purpose:'gh' token, pull_requests:write + contents:write)`, `${path3}.jobTools`, id);
5378
+ warn("gh-on-coding-turn", `"${id2}" grants the gh tool on a coding turn \u2014 the pod can open/merge PRs on the workspace repo (purpose:'gh' token, pull_requests:write + contents:write)`, `${path3}.jobTools`, id2);
5142
5379
  }
5143
5380
  }
5144
5381
  if (node.type === "agent" && ws && ws !== "inherit" && ws.mount === "ro" && Array.isArray(tools) && effectiveJobTools(tools, true).length === 0) {
5145
- warn("ro-step-has-no-tools", `"${id}" mounts the workspace read-only and every jobTool it declares (${JSON.stringify(tools)}) is one the ro mount drops [${WORKFLOW_JOB_READ_ONLY_DROPPED.join(", ")}] \u2014 the coding turn would run with no tools at all; keep a read-only tool (read/glob/grep, gh) or mount rw`, `${path3}.jobTools`, id);
5382
+ warn("ro-step-has-no-tools", `"${id2}" mounts the workspace read-only and every jobTool it declares (${JSON.stringify(tools)}) is one the ro mount drops [${WORKFLOW_JOB_READ_ONLY_DROPPED.join(", ")}] \u2014 the coding turn would run with no tools at all; keep a read-only tool (read/glob/grep, gh) or mount rw`, `${path3}.jobTools`, id2);
5146
5383
  }
5147
5384
  if (ws && ws !== "inherit") {
5148
5385
  if (!envelopeWorkspace && !opts.mayInherit) {
5149
- err("workspace-not-declared", `"${id}" mounts a workspace but the workflow declares none \u2014 add workspace:{kind, \u2026} on createWorkflow`, `${path3}.workspace`, id);
5386
+ err("workspace-not-declared", `"${id2}" mounts a workspace but the workflow declares none \u2014 add workspace:{kind, \u2026} on createWorkflow`, `${path3}.workspace`, id2);
5150
5387
  }
5151
5388
  if (ws.isolation === "worktree" && envelopeWorkspace?.kind === "empty") {
5152
- err("worktree-requires-git-workspace", `"${id}": isolation:'worktree' needs a kind:'git' workspace (the envelope declares kind:'empty')`, `${path3}.workspace.isolation`, id);
5389
+ err("worktree-requires-git-workspace", `"${id2}": isolation:'worktree' needs a kind:'git' workspace (the envelope declares kind:'empty')`, `${path3}.workspace.isolation`, id2);
5153
5390
  }
5154
5391
  }
5155
5392
  if (node.type === "workflow" && ws === "inherit") {
5156
5393
  if (!envelopeWorkspace) {
5157
- err("workspace-inherit-without-parent-workspace", `"${id}": workspace:'inherit' but the parent workflow declares no workspace \u2014 there is nothing to inherit`, `${path3}.workspace`, id);
5394
+ err("workspace-inherit-without-parent-workspace", `"${id2}": workspace:'inherit' but the parent workflow declares no workspace \u2014 there is nothing to inherit`, `${path3}.workspace`, id2);
5158
5395
  }
5159
5396
  const child = opts.resolveWorkflow?.(node.workflowId);
5160
5397
  if (child?.workspace) {
5161
- err("workspace-inherit-conflict", `"${id}": workspace:'inherit' on "${node.workflowId}", which declares its own workspace`, `${path3}.workspace`, id);
5398
+ err("workspace-inherit-conflict", `"${id2}": workspace:'inherit' on "${node.workflowId}", which declares its own workspace`, `${path3}.workspace`, id2);
5162
5399
  }
5163
5400
  }
5164
5401
  }, "checkWorkspace");
@@ -5167,20 +5404,20 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
5167
5404
  const schema = node.type === "step" ? node.step.outputSchema : node.type === "agent" ? node.outputSchema : void 0;
5168
5405
  if (schema !== void 0) outputSchemas.set(singleId(node), schema);
5169
5406
  }, "recordOutputSchema");
5170
- const checkMapMembers = /* @__PURE__ */ __name4((cfg, basePath, id) => {
5407
+ const checkMapMembers = /* @__PURE__ */ __name4((cfg, basePath, id2) => {
5171
5408
  for (const m of malformedMapMembers(cfg)) {
5172
- warn(MAP_MEMBER_MALFORMED_CODE, mapMemberMalformedMessage(id, m), `${basePath}.${m.member}`, id);
5409
+ warn(MAP_MEMBER_MALFORMED_CODE, mapMemberMalformedMessage(id2, m), `${basePath}.${m.member}`, id2);
5173
5410
  }
5174
5411
  }, "checkMapMembers");
5175
5412
  const checkInputShape = /* @__PURE__ */ __name4((node, path3) => {
5176
5413
  const input = node.input;
5177
5414
  if (input === void 0) return;
5178
- const id = singleId(node);
5415
+ const id2 = singleId(node);
5179
5416
  if (input !== null && typeof input === "object" && !Array.isArray(input)) {
5180
- checkMapMembers(input, `${path3}.input`, id);
5417
+ checkMapMembers(input, `${path3}.input`, id2);
5181
5418
  return;
5182
5419
  }
5183
- err("invalid-envelope", `\`input\` must be an object map \u2014 each member a binding descriptor ({initData:true, path} | {step, path} | {value} | {template} | {requestContextPath}) or a JSON literal (got ${JSON.stringify(input)})`, `${path3}.input`, id);
5420
+ err("invalid-envelope", `\`input\` must be an object map \u2014 each member a binding descriptor ({initData:true, path} | {step, path} | {value} | {template} | {requestContextPath}) or a JSON literal (got ${JSON.stringify(input)})`, `${path3}.input`, id2);
5184
5421
  }, "checkInputShape");
5185
5422
  const checkBodyInput = /* @__PURE__ */ __name4((body, path3, container) => {
5186
5423
  if (body.type === "workflow" || body.input === void 0) return;
@@ -5471,7 +5708,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
5471
5708
  default:
5472
5709
  err("invalid-envelope", `unknown entry type "${entry.type}"`, path3);
5473
5710
  }
5474
- for (const id of declared) upstream.add(id);
5711
+ for (const id2 of declared) upstream.add(id2);
5475
5712
  });
5476
5713
  if (nodeCount > caps.maxNodes) {
5477
5714
  err("cap-exceeded", `${nodeCount} nodes exceeds the static cap of ${caps.maxNodes}`, "definition.graph");
@@ -5546,19 +5783,19 @@ function hashGraph(g) {
5546
5783
  function compilePlan(g) {
5547
5784
  const steps = {};
5548
5785
  const order = [];
5549
- const addNode = /* @__PURE__ */ __name4((id, node) => {
5550
- if (id in steps) {
5551
- throw new WorkflowPlanError("duplicate-step-id", `Duplicate step id "${id}" in definition.graph`);
5786
+ const addNode = /* @__PURE__ */ __name4((id2, node) => {
5787
+ if (id2 in steps) {
5788
+ throw new WorkflowPlanError("duplicate-step-id", `Duplicate step id "${id2}" in definition.graph`);
5552
5789
  }
5553
- steps[id] = node;
5554
- order.push(id);
5790
+ steps[id2] = node;
5791
+ order.push(id2);
5555
5792
  }, "addNode");
5556
5793
  let prevTails = [];
5557
5794
  const foreachJoinToEntry = /* @__PURE__ */ new Map();
5558
5795
  g.definition.graph.forEach((entry, entryIndex) => {
5559
5796
  if (isArmStep(entry)) {
5560
- const id = armStepId(entry);
5561
- addNode(id, {
5797
+ const id2 = armStepId(entry);
5798
+ addNode(id2, {
5562
5799
  kind: armStepKind(entry),
5563
5800
  dependsOn: prevTails,
5564
5801
  downstream: [],
@@ -5566,7 +5803,7 @@ function compilePlan(g) {
5566
5803
  entry
5567
5804
  });
5568
5805
  prevTails = [
5569
- id
5806
+ id2
5570
5807
  ];
5571
5808
  return;
5572
5809
  }
@@ -5705,10 +5942,10 @@ function compilePlan(g) {
5705
5942
  throw new WorkflowPlanError("unknown-entry-type", `Unknown graph entry type "${entry.type}" at definition.graph[${entryIndex}]`);
5706
5943
  }
5707
5944
  });
5708
- for (const id of order) {
5709
- for (const dep of steps[id].dependsOn) {
5945
+ for (const id2 of order) {
5946
+ for (const dep of steps[id2].dependsOn) {
5710
5947
  const target = steps[dep] ?? (foreachJoinToEntry.has(dep) ? steps[foreachJoinToEntry.get(dep)] : void 0);
5711
- target?.downstream.push(id);
5948
+ target?.downstream.push(id2);
5712
5949
  }
5713
5950
  }
5714
5951
  return {
@@ -5874,15 +6111,15 @@ function renderRef(ref) {
5874
6111
  return ref.path;
5875
6112
  }
5876
6113
  function step(s) {
5877
- const id = stepIdOf(s);
6114
+ const id2 = stepIdOf(s);
5878
6115
  return {
5879
6116
  path: /* @__PURE__ */ __name4((p) => ({
5880
- path: p === "" ? `stepResults.${id}` : `stepResults.${id}.${p}`
6117
+ path: p === "" ? `stepResults.${id2}` : `stepResults.${id2}.${p}`
5881
6118
  }), "path")
5882
6119
  };
5883
6120
  }
5884
- function stepOf(id) {
5885
- return step(id);
6121
+ function stepOf(id2) {
6122
+ return step(id2);
5886
6123
  }
5887
6124
  function init(path3) {
5888
6125
  return {
@@ -5964,18 +6201,18 @@ function resolvePlacements(calls) {
5964
6201
  const declared = /* @__PURE__ */ new Map();
5965
6202
  const placedBy = /* @__PURE__ */ new Map();
5966
6203
  const allIds = /* @__PURE__ */ new Map();
5967
- const claimId = /* @__PURE__ */ __name4((id, callIndex) => {
5968
- const first = allIds.get(id);
6204
+ const claimId = /* @__PURE__ */ __name4((id2, callIndex) => {
6205
+ const first = allIds.get(id2);
5969
6206
  if (first !== void 0 && first !== callIndex) {
5970
6207
  issues.push({
5971
6208
  code: "duplicate-step-id",
5972
- message: `step id "${id}" is declared more than once (calls #${first} and #${callIndex})`,
6209
+ message: `step id "${id2}" is declared more than once (calls #${first} and #${callIndex})`,
5973
6210
  callIndex,
5974
- stepId: id
6211
+ stepId: id2
5975
6212
  });
5976
6213
  return;
5977
6214
  }
5978
- allIds.set(id, callIndex);
6215
+ allIds.set(id2, callIndex);
5979
6216
  }, "claimId");
5980
6217
  calls.forEach((call, i) => {
5981
6218
  switch (call.kind) {
@@ -5987,7 +6224,7 @@ function resolvePlacements(calls) {
5987
6224
  });
5988
6225
  break;
5989
6226
  case "entry":
5990
- for (const id of entryIds(call.entry)) claimId(id, i);
6227
+ for (const id2 of entryIds(call.entry)) claimId(id2, i);
5991
6228
  break;
5992
6229
  case "parallel":
5993
6230
  for (const arm of call.arms) if ("node" in arm) claimId(nodeIdOf(arm.node), i);
@@ -6006,42 +6243,42 @@ function resolvePlacements(calls) {
6006
6243
  });
6007
6244
  const armMapPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
6008
6245
  if (!ref.armMap || node.type === "mapping" || isHitlNode2(node)) return void 0;
6009
- const id = nodeIdOf(node);
6246
+ const id2 = nodeIdOf(node);
6010
6247
  if ((container === "foreach" || container === "loop") && node.type !== "workflow") {
6011
6248
  return {
6012
6249
  code: "mapping-placement",
6013
- message: container === "foreach" ? `foreach body "${id}": a [map, step] body is not supported \u2014 the body receives each item as its input; map the items before the foreach instead (foreach(step, { items: \u2026 }) or a .map() before it)` : `loop body "${id}": a [map, step] body is not supported \u2014 the body receives the previous output as its input; put the .map() before the loop instead`,
6250
+ message: container === "foreach" ? `foreach body "${id2}": a [map, step] body is not supported \u2014 the body receives each item as its input; map the items before the foreach instead (foreach(step, { items: \u2026 }) or a .map() before it)` : `loop body "${id2}": a [map, step] body is not supported \u2014 the body receives the previous output as its input; put the .map() before the loop instead`,
6014
6251
  callIndex: i,
6015
- stepId: id
6252
+ stepId: id2
6016
6253
  };
6017
6254
  }
6018
6255
  if (node.input !== void 0) {
6019
6256
  return {
6020
6257
  code: "mapping-placement",
6021
- message: `"${id}": the [map, step] arm mapping and the node's own input map would both bind its input \u2014 keep one (drop the arm map, or the \`input\` on the declaration)`,
6258
+ message: `"${id2}": the [map, step] arm mapping and the node's own input map would both bind its input \u2014 keep one (drop the arm map, or the \`input\` on the declaration)`,
6022
6259
  callIndex: i,
6023
- stepId: id
6260
+ stepId: id2
6024
6261
  };
6025
6262
  }
6026
6263
  return void 0;
6027
6264
  }, "armMapPlacementIssue");
6028
6265
  const hitlPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
6029
6266
  if (!isHitlNode2(node)) return void 0;
6030
- const id = node.id;
6267
+ const id2 = node.id;
6031
6268
  if (ref.armMap) {
6032
6269
  return {
6033
6270
  code: "node-type-unsupported-in-container",
6034
- message: workflowHitlArmShapeMessage(node.type, id, "mapped-arm"),
6271
+ message: workflowHitlArmShapeMessage(node.type, id2, "mapped-arm"),
6035
6272
  callIndex: i,
6036
- stepId: id
6273
+ stepId: id2
6037
6274
  };
6038
6275
  }
6039
6276
  if (container !== "place" && !workflowContainerRunsHitlArm(container)) {
6040
6277
  return {
6041
6278
  code: "node-type-unsupported-in-container",
6042
- message: workflowHitlArmUnsupportedMessage(node.type, id, container),
6279
+ message: workflowHitlArmUnsupportedMessage(node.type, id2, container),
6043
6280
  callIndex: i,
6044
- stepId: id
6281
+ stepId: id2
6045
6282
  };
6046
6283
  }
6047
6284
  return void 0;
@@ -6147,8 +6384,8 @@ function resolvePlacements(calls) {
6147
6384
  graph.push(call.entry);
6148
6385
  return;
6149
6386
  case "declare": {
6150
- const id = nodeIdOf(call.node);
6151
- if (placedBy.has(id)) return;
6387
+ const id2 = nodeIdOf(call.node);
6388
+ if (placedBy.has(id2)) return;
6152
6389
  graph.push(call.node);
6153
6390
  return;
6154
6391
  }
@@ -6279,14 +6516,14 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
6279
6516
  const seeded = [];
6280
6517
  const unseeded = [];
6281
6518
  const known = new Set(Object.keys(targetPlan.steps));
6282
- const parentOf = /* @__PURE__ */ __name4((id) => {
6283
- const m = /^(.*)(\[\d+\]|#\d+)$/.exec(id);
6519
+ const parentOf = /* @__PURE__ */ __name4((id2) => {
6520
+ const m = /^(.*)(\[\d+\]|#\d+)$/.exec(id2);
6284
6521
  return m ? m[1] : void 0;
6285
6522
  }, "parentOf");
6286
- const dependsOf = /* @__PURE__ */ __name4((id) => {
6287
- const node = targetPlan.steps[id];
6523
+ const dependsOf = /* @__PURE__ */ __name4((id2) => {
6524
+ const node = targetPlan.steps[id2];
6288
6525
  if (node) return node.dependsOn;
6289
- const parent = parentOf(id);
6526
+ const parent = parentOf(id2);
6290
6527
  return parent && targetPlan.steps[parent] ? [
6291
6528
  parent
6292
6529
  ] : [];
@@ -6299,23 +6536,23 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
6299
6536
  walk22.push(s.stepId);
6300
6537
  }
6301
6538
  }
6302
- for (const id of walk22) {
6303
- const row = byId.get(id);
6539
+ for (const id2 of walk22) {
6540
+ const row = byId.get(id2);
6304
6541
  if (!row || row.status !== "completed") continue;
6305
- if (!dependsOf(id).every((d) => seededIds.has(d))) {
6306
- unseeded.push(id);
6542
+ if (!dependsOf(id2).every((d) => seededIds.has(d))) {
6543
+ unseeded.push(id2);
6307
6544
  continue;
6308
6545
  }
6309
- seededIds.add(id);
6546
+ seededIds.add(id2);
6310
6547
  seeded.push({
6311
- stepId: id,
6548
+ stepId: id2,
6312
6549
  output: row.output,
6313
6550
  attempt: row.attempt ?? 1,
6314
6551
  effects: row.effects ?? {}
6315
6552
  });
6316
6553
  }
6317
6554
  const dropped = steps.filter((s) => s.status === "completed" && !known.has(s.stepId) && !(parentOf(s.stepId) && known.has(parentOf(s.stepId)))).map((s) => s.stepId);
6318
- const firstPending = targetPlan.order.find((id) => !seededIds.has(id));
6555
+ const firstPending = targetPlan.order.find((id2) => !seededIds.has(id2));
6319
6556
  const graphChanged = !!(opts.targetGraphHash && run.graphHash && opts.targetGraphHash !== run.graphHash);
6320
6557
  return {
6321
6558
  sourceRunId: run.id,
@@ -6370,37 +6607,37 @@ function replayLedger(g, ledger) {
6370
6607
  startedAt: 0,
6371
6608
  ...ledger.requestContext
6372
6609
  };
6373
- const ctxFor = /* @__PURE__ */ __name4((id) => ({
6610
+ const ctxFor = /* @__PURE__ */ __name4((id2) => ({
6374
6611
  initData: ledger.initData,
6375
- stepResults: ancestorResults(plan, id, rows22),
6612
+ stepResults: ancestorResults(plan, id2, rows22),
6376
6613
  state: ledger.state ?? {},
6377
6614
  requestContext
6378
6615
  }), "ctxFor");
6379
6616
  const verdicts = [];
6380
- for (const id of plan.order) {
6381
- const node = plan.steps[id];
6382
- const recorded = rows22.get(id);
6617
+ for (const id2 of plan.order) {
6618
+ const node = plan.steps[id2];
6619
+ const recorded = rows22.get(id2);
6383
6620
  if (!recorded || recorded.status === "pending" || recorded.status === "skipped") continue;
6384
6621
  if (node.kind === "branch") {
6385
6622
  const entry = node.entry;
6386
- const taken = selectBranchArms(branchSpecFromConditional(entry), ctxFor(id));
6623
+ const taken = selectBranchArms(branchSpecFromConditional(entry), ctxFor(id2));
6387
6624
  const recordedTaken = recorded.taken ?? inferTaken(entry, rows22);
6388
6625
  verdicts.push({
6389
- stepId: id,
6626
+ stepId: id2,
6390
6627
  kind: "branch",
6391
6628
  recorded: recordedTaken,
6392
6629
  local: taken,
6393
6630
  diverged: canonical(recordedTaken) !== canonical(taken)
6394
6631
  });
6395
- } else if (node.kind === "map" && !id.endsWith(".join") && recorded.status === "completed") {
6632
+ } else if (node.kind === "map" && !id2.endsWith(".join") && recorded.status === "completed") {
6396
6633
  const entry = node.entry;
6397
- const resolved = resolveMapping(parseMapConfig(entry.mapConfig, id), ctxFor(id));
6634
+ const resolved = resolveMapping(parseMapConfig(entry.mapConfig, id2), ctxFor(id2));
6398
6635
  const local = "error" in resolved ? {
6399
6636
  error: resolved.error,
6400
6637
  key: resolved.key
6401
6638
  } : resolved.value;
6402
6639
  verdicts.push({
6403
- stepId: id,
6640
+ stepId: id2,
6404
6641
  kind: "map",
6405
6642
  recorded: recorded.output,
6406
6643
  local,
@@ -6409,11 +6646,11 @@ function replayLedger(g, ledger) {
6409
6646
  } else if (node.kind === "foreach") {
6410
6647
  const entry = node.entry;
6411
6648
  const source = node.dependsOn[0];
6412
- const items = source ? ctxFor(id).stepResults[source] : void 0;
6649
+ const items = source ? ctxFor(id2).stepResults[source] : void 0;
6413
6650
  const local = Array.isArray(items) ? items.length : void 0;
6414
6651
  const recordedCount = recorded.itemCount ?? countChildren(entry, rows22);
6415
6652
  verdicts.push({
6416
- stepId: id,
6653
+ stepId: id2,
6417
6654
  kind: "foreach",
6418
6655
  recorded: recordedCount,
6419
6656
  local,
@@ -6422,7 +6659,7 @@ function replayLedger(g, ledger) {
6422
6659
  } else if (node.kind === "subrun" && recorded.status === "completed" && recorded.child) {
6423
6660
  const local = subrunSettledOutput(recorded.child);
6424
6661
  verdicts.push({
6425
- stepId: id,
6662
+ stepId: id2,
6426
6663
  kind: "subrun",
6427
6664
  recorded: recorded.output,
6428
6665
  local,
@@ -6448,7 +6685,7 @@ function replayResultOf(row, node) {
6448
6685
  }
6449
6686
  return void 0;
6450
6687
  }
6451
- function ancestorResults(plan, id, rows22) {
6688
+ function ancestorResults(plan, id2, rows22) {
6452
6689
  const out = {};
6453
6690
  const joinAliased = /* @__PURE__ */ new Set();
6454
6691
  const seen = /* @__PURE__ */ new Set();
@@ -6497,7 +6734,7 @@ function ancestorResults(plan, id, rows22) {
6497
6734
  walk22(node.dependsOn);
6498
6735
  }
6499
6736
  }, "walk");
6500
- walk22(plan.steps[id]?.dependsOn ?? []);
6737
+ walk22(plan.steps[id2]?.dependsOn ?? []);
6501
6738
  return out;
6502
6739
  }
6503
6740
  function inferTaken(entry, rows22) {
@@ -6507,15 +6744,15 @@ function inferTaken(entry, rows22) {
6507
6744
  entry.otherwise
6508
6745
  ] : []
6509
6746
  ];
6510
- return arms.map(branchArmId).filter((id) => {
6511
- const r = rows22.get(id);
6747
+ return arms.map(branchArmId).filter((id2) => {
6748
+ const r = rows22.get(id2);
6512
6749
  return r !== void 0 && r.status !== "skipped" && r.status !== "pending";
6513
6750
  });
6514
6751
  }
6515
6752
  function countChildren(entry, rows22) {
6516
6753
  const body = branchArmId(entry.step);
6517
6754
  let n2 = 0;
6518
- for (const id of rows22.keys()) if (id.startsWith(`${body}[`)) n2 += 1;
6755
+ for (const id2 of rows22.keys()) if (id2.startsWith(`${body}[`)) n2 += 1;
6519
6756
  return n2;
6520
6757
  }
6521
6758
  function isTerminalRunStatus(status) {
@@ -7783,8 +8020,8 @@ var init_dist2 = __esm({
7783
8020
  fromKnowledge = /* @__PURE__ */ __name4((k) => ({
7784
8021
  knowledge: k
7785
8022
  }), "fromKnowledge");
7786
- SideEffectsSchema = z4.enum(WORKFLOW_SIDE_EFFECTS);
7787
- JobResourcesSchema = z4.enum(WORKFLOW_JOB_RESOURCES);
8023
+ SideEffectsSchema = z5.enum(WORKFLOW_SIDE_EFFECTS);
8024
+ JobResourcesSchema = z5.enum(WORKFLOW_JOB_RESOURCES);
7788
8025
  WORKFLOW_MODEL_TEMPLATE_ROOT = "initData";
7789
8026
  WORKFLOW_MODEL_TEMPLATE_RE = /^\$\{\s*initData\.([A-Za-z0-9_.\-[\]]+)\s*(?:\|([^}]*))?\}$/;
7790
8027
  PATH_SEGMENT_RE = /^[A-Za-z0-9_-]+(?:\[(?:0|[1-9]\d*)\])*$/;
@@ -8217,7 +8454,7 @@ var init_dist2 = __esm({
8217
8454
  __name(replayLedger, "replayLedger");
8218
8455
  __name4(replayLedger, "replayLedger");
8219
8456
  JOIN = ".join";
8220
- entryOfJoin = /* @__PURE__ */ __name4((id) => id.endsWith(JOIN) ? id.slice(0, -JOIN.length) : void 0, "entryOfJoin");
8457
+ entryOfJoin = /* @__PURE__ */ __name4((id2) => id2.endsWith(JOIN) ? id2.slice(0, -JOIN.length) : void 0, "entryOfJoin");
8221
8458
  __name(replayResultOf, "replayResultOf");
8222
8459
  __name4(replayResultOf, "replayResultOf");
8223
8460
  __name(ancestorResults, "ancestorResults");
@@ -8506,8 +8743,8 @@ function createStep(s) {
8506
8743
  function step2(s) {
8507
8744
  return step(typeof s === "string" ? s : s.id);
8508
8745
  }
8509
- function stepOf2(id) {
8510
- return stepOf(id);
8746
+ function stepOf2(id2) {
8747
+ return stepOf(id2);
8511
8748
  }
8512
8749
  function schemaToJson(schema) {
8513
8750
  if (schema === void 0 || schema === null) return void 0;
@@ -8711,16 +8948,16 @@ var init_workflow = __esm({
8711
8948
  if (!isPredicate(p)) throw new LuaWorkflowBuildError("closure-predicate", `${where}: not a LuaPredicate`, "build predicates with eq/gt/inSet/exists/and/or/not");
8712
8949
  return p;
8713
8950
  }, "assertPredicate");
8714
- assertRetry = /* @__PURE__ */ __name((r, id) => {
8951
+ assertRetry = /* @__PURE__ */ __name((r, id2) => {
8715
8952
  if (!r) return;
8716
8953
  if (!isWithinWorkflowRetryAttempts(r.maxAttempts)) {
8717
8954
  const over = typeof r.maxAttempts === "number" && r.maxAttempts > WORKFLOW_RETRY_MAX_ATTEMPTS;
8718
- throw new LuaWorkflowBuildError(over ? "cap-exceeded" : "invalid-envelope", `"${id}": ${workflowRetryMaxAttemptsMessage(r.maxAttempts)}`);
8955
+ throw new LuaWorkflowBuildError(over ? "cap-exceeded" : "invalid-envelope", `"${id2}": ${workflowRetryMaxAttemptsMessage(r.maxAttempts)}`);
8719
8956
  }
8720
- if (r.backoff !== void 0 && !WORKFLOW_RETRY_BACKOFFS.includes(r.backoff)) throw new LuaWorkflowBuildError("backoff-invalid", `"${id}": retry.backoff must be ${WORKFLOW_RETRY_BACKOFFS.map((b) => `'${b}'`).join(" | ")}`);
8957
+ if (r.backoff !== void 0 && !WORKFLOW_RETRY_BACKOFFS.includes(r.backoff)) throw new LuaWorkflowBuildError("backoff-invalid", `"${id2}": retry.backoff must be ${WORKFLOW_RETRY_BACKOFFS.map((b) => `'${b}'`).join(" | ")}`);
8721
8958
  if (r.maxBackoffSeconds !== void 0) {
8722
- if (r.backoff !== "exponential") throw new LuaWorkflowBuildError("backoff-invalid", `"${id}": retry.maxBackoffSeconds is only meaningful with backoff:'exponential'`);
8723
- if (r.maxBackoffSeconds <= 0 || r.backoffSeconds !== void 0 && r.maxBackoffSeconds < r.backoffSeconds) throw new LuaWorkflowBuildError("backoff-invalid", `"${id}": retry.maxBackoffSeconds must be > 0 and \u2265 backoffSeconds`);
8959
+ if (r.backoff !== "exponential") throw new LuaWorkflowBuildError("backoff-invalid", `"${id2}": retry.maxBackoffSeconds is only meaningful with backoff:'exponential'`);
8960
+ if (r.maxBackoffSeconds <= 0 || r.backoffSeconds !== void 0 && r.maxBackoffSeconds < r.backoffSeconds) throw new LuaWorkflowBuildError("backoff-invalid", `"${id2}": retry.maxBackoffSeconds must be > 0 and \u2265 backoffSeconds`);
8724
8961
  }
8725
8962
  }, "assertRetry");
8726
8963
  assertTimeout = /* @__PURE__ */ __name((node) => {
@@ -8918,8 +9155,8 @@ var init_workflow = __esm({
8918
9155
  ref: arm
8919
9156
  };
8920
9157
  if (arm && typeof arm === "object" && isHitlEntry(arm)) {
8921
- const id = arm.id;
8922
- throw new LuaWorkflowBuildError("invalid-step", `${where}: an approval / waitForSignal arm is placed by id \u2014 declare it with .approval(${JSON.stringify(id ?? "id")}, \u2026) / .waitForSignal(\u2026) and pass the id string`);
9158
+ const id2 = arm.id;
9159
+ throw new LuaWorkflowBuildError("invalid-step", `${where}: an approval / waitForSignal arm is placed by id \u2014 declare it with .approval(${JSON.stringify(id2 ?? "id")}, \u2026) / .waitForSignal(\u2026) and pass the id string`);
8923
9160
  }
8924
9161
  return {
8925
9162
  node: this.registerStep(arm, where)
@@ -9039,14 +9276,14 @@ var init_workflow = __esm({
9039
9276
  assertNoClosure(mapping, "map()");
9040
9277
  this.recordEnvRefs(mapping);
9041
9278
  this.mapCount += 1;
9042
- let id = opts?.id;
9043
- if (id === void 0) {
9279
+ let id2 = opts?.id;
9280
+ if (id2 === void 0) {
9044
9281
  this.unnamedMaps += 1;
9045
- id = `map_${this.mapCount}`;
9282
+ id2 = `map_${this.mapCount}`;
9046
9283
  }
9047
9284
  const node = {
9048
9285
  type: "mapping",
9049
- id,
9286
+ id: id2,
9050
9287
  mapConfig: canonicalJson(mapping)
9051
9288
  };
9052
9289
  return this.push({
@@ -9057,12 +9294,12 @@ var init_workflow = __esm({
9057
9294
  sleep(ms, opts) {
9058
9295
  if (typeof ms !== "number" || !Number.isFinite(ms) || ms < 0) throw new LuaWorkflowBuildError("invalid-envelope", "sleep(ms) takes a literal non-negative number");
9059
9296
  this.sleepCount += 1;
9060
- const id = opts?.id ?? `sleep_${this.sleepCount}`;
9297
+ const id2 = opts?.id ?? `sleep_${this.sleepCount}`;
9061
9298
  return this.push({
9062
9299
  kind: "entry",
9063
9300
  entry: defined({
9064
9301
  type: "sleep",
9065
- id,
9302
+ id: id2,
9066
9303
  duration: ms,
9067
9304
  businessHours: opts?.businessHours
9068
9305
  })
@@ -9070,13 +9307,13 @@ var init_workflow = __esm({
9070
9307
  }
9071
9308
  sleepUntil(iso, opts) {
9072
9309
  this.sleepCount += 1;
9073
- const id = opts?.id ?? `sleep_${this.sleepCount}`;
9310
+ const id2 = opts?.id ?? `sleep_${this.sleepCount}`;
9074
9311
  if (typeof iso === "string") {
9075
9312
  return this.push({
9076
9313
  kind: "entry",
9077
9314
  entry: defined({
9078
9315
  type: "sleepUntil",
9079
- id,
9316
+ id: id2,
9080
9317
  date: iso,
9081
9318
  businessHours: opts?.businessHours,
9082
9319
  round: opts?.round
@@ -9089,7 +9326,7 @@ var init_workflow = __esm({
9089
9326
  kind: "entry",
9090
9327
  entry: {
9091
9328
  type: "mapping",
9092
- id: `${id}_at`,
9329
+ id: `${id2}_at`,
9093
9330
  mapConfig: canonicalJson({
9094
9331
  date: {
9095
9332
  template: iso.template
@@ -9101,9 +9338,9 @@ var init_workflow = __esm({
9101
9338
  kind: "entry",
9102
9339
  entry: defined({
9103
9340
  type: "sleepUntil",
9104
- id,
9341
+ id: id2,
9105
9342
  dateFrom: {
9106
- step: `${id}_at`,
9343
+ step: `${id2}_at`,
9107
9344
  path: "date"
9108
9345
  },
9109
9346
  businessHours: opts?.businessHours,
@@ -9111,35 +9348,35 @@ var init_workflow = __esm({
9111
9348
  })
9112
9349
  });
9113
9350
  }
9114
- agentStep(id, opts) {
9115
- this.assertId(id, "agentStep()");
9351
+ agentStep(id2, opts) {
9352
+ this.assertId(id2, "agentStep()");
9116
9353
  if (!opts || typeof opts.agentId !== "string" && !(opts.agentId && typeof opts.agentId === "object" && "__envRef" in opts.agentId)) {
9117
- throw new LuaWorkflowBuildError("invalid-envelope", `agentStep("${id}") needs an agentId`);
9354
+ throw new LuaWorkflowBuildError("invalid-envelope", `agentStep("${id2}") needs an agentId`);
9118
9355
  }
9119
9356
  const tier = opts.tier ?? (opts.workspace ? "job" : void 0);
9120
- if (opts.workspace && opts.tier !== void 0 && opts.tier !== "job") throw new LuaWorkflowBuildError("workspace-requires-job-tier", `"${id}": a step mounting a workspace must be tier:'job'`);
9121
- if (opts.harness !== void 0 && tier !== "job") throw new LuaWorkflowBuildError("harness-requires-job-tier", `"${id}": harness is only legal on a tier:'job' agent step`);
9122
- if (opts.toolScope?.jobTools && tier !== "job") throw new LuaWorkflowBuildError("cap-exceeded", `"${id}": toolScope.jobTools require tier:'job' (job-tools-require-job-tier)`);
9357
+ if (opts.workspace && opts.tier !== void 0 && opts.tier !== "job") throw new LuaWorkflowBuildError("workspace-requires-job-tier", `"${id2}": a step mounting a workspace must be tier:'job'`);
9358
+ if (opts.harness !== void 0 && tier !== "job") throw new LuaWorkflowBuildError("harness-requires-job-tier", `"${id2}": harness is only legal on a tier:'job' agent step`);
9359
+ if (opts.toolScope?.jobTools && tier !== "job") throw new LuaWorkflowBuildError("cap-exceeded", `"${id2}": toolScope.jobTools require tier:'job' (job-tools-require-job-tier)`);
9123
9360
  for (const m of WORKFLOW_JOB_RANGE_MEMBERS) {
9124
9361
  if (opts[m] === void 0) continue;
9125
- if (tier !== "job") throw new LuaWorkflowBuildError("max-turns-requires-job-tier", `"${id}": ${m} is only legal on a tier:'job' agent step`);
9362
+ if (tier !== "job") throw new LuaWorkflowBuildError("max-turns-requires-job-tier", `"${id2}": ${m} is only legal on a tier:'job' agent step`);
9126
9363
  if (!isWithinWorkflowJobRange(m, opts[m])) {
9127
9364
  const { min, max } = WORKFLOW_JOB_RANGES[m];
9128
- throw new LuaWorkflowBuildError("max-turns-invalid", `"${id}": ${m} must be an integer ${min}..${max}`);
9365
+ throw new LuaWorkflowBuildError("max-turns-invalid", `"${id2}": ${m} must be an integer ${min}..${max}`);
9129
9366
  }
9130
9367
  }
9131
9368
  assertTimeout({
9132
- id,
9369
+ id: id2,
9133
9370
  timeoutSeconds: opts.timeoutSeconds,
9134
9371
  tier,
9135
9372
  workspace: opts.workspace,
9136
9373
  kind: "agent"
9137
9374
  });
9138
- assertRetry(opts.retry, id);
9375
+ assertRetry(opts.retry, id2);
9139
9376
  this.recordEnvRefs(opts.agentId, opts.prompt);
9140
9377
  const node = defined({
9141
9378
  type: "agent",
9142
- id,
9379
+ id: id2,
9143
9380
  agentId: opts.agentId,
9144
9381
  promptTemplate: templateText(opts.prompt),
9145
9382
  outputSchema: schemaToJson(opts.outputSchema),
@@ -9167,30 +9404,30 @@ var init_workflow = __esm({
9167
9404
  node
9168
9405
  });
9169
9406
  }
9170
- specialistStep(id, opts) {
9171
- this.assertId(id, "specialistStep()");
9407
+ specialistStep(id2, opts) {
9408
+ this.assertId(id2, "specialistStep()");
9172
9409
  const role = opts?.role;
9173
- if (!role || typeof role !== "object") throw new LuaWorkflowBuildError("invalid-envelope", `specialistStep("${id}") needs a role`);
9410
+ if (!role || typeof role !== "object") throw new LuaWorkflowBuildError("invalid-envelope", `specialistStep("${id2}") needs a role`);
9174
9411
  if (role.ref !== void 0 && (role.name !== void 0 || role.instructions !== void 0 || role.tools !== void 0)) {
9175
- throw new LuaWorkflowBuildError("role-ref-and-inline", `"${id}": role is EITHER { ref } OR the inline { name, instructions, tools } shape`);
9412
+ throw new LuaWorkflowBuildError("role-ref-and-inline", `"${id2}": role is EITHER { ref } OR the inline { name, instructions, tools } shape`);
9176
9413
  }
9177
9414
  if (role.ref === void 0) {
9178
9415
  if (typeof role.instructions !== "string" || role.instructions.length > WORKFLOW_SPECIALIST_ROLE_MAX_INSTRUCTIONS) {
9179
- throw new LuaWorkflowBuildError("ephemeral-role-too-long", `"${id}": role.instructions must be \u2264 ${WORKFLOW_SPECIALIST_ROLE_MAX_INSTRUCTIONS} chars`);
9416
+ throw new LuaWorkflowBuildError("ephemeral-role-too-long", `"${id2}": role.instructions must be \u2264 ${WORKFLOW_SPECIALIST_ROLE_MAX_INSTRUCTIONS} chars`);
9180
9417
  }
9181
- if (!Array.isArray(role.tools)) throw new LuaWorkflowBuildError("invalid-envelope", `"${id}": role.tools must be an array ([] = no tools)`);
9182
- if (role.tools.length > 64) throw new LuaWorkflowBuildError("cap-exceeded", `"${id}": role.tools exceeds 64 entries`);
9418
+ if (!Array.isArray(role.tools)) throw new LuaWorkflowBuildError("invalid-envelope", `"${id2}": role.tools must be an array ([] = no tools)`);
9419
+ if (role.tools.length > 64) throw new LuaWorkflowBuildError("cap-exceeded", `"${id2}": role.tools exceeds 64 entries`);
9183
9420
  }
9184
9421
  assertTimeout({
9185
- id,
9422
+ id: id2,
9186
9423
  timeoutSeconds: opts.timeoutSeconds,
9187
9424
  kind: "agent"
9188
9425
  });
9189
- assertRetry(opts.retry, id);
9426
+ assertRetry(opts.retry, id2);
9190
9427
  this.recordEnvRefs(opts.prompt);
9191
9428
  const node = defined({
9192
9429
  type: "agent",
9193
- id,
9430
+ id: id2,
9194
9431
  agentId: "$self",
9195
9432
  role: role.ref !== void 0 ? {
9196
9433
  ref: role.ref
@@ -9213,20 +9450,20 @@ var init_workflow = __esm({
9213
9450
  node
9214
9451
  });
9215
9452
  }
9216
- toolStep(id, tool, opts = {}) {
9217
- this.assertId(id, "toolStep()");
9218
- if (!tool || typeof tool !== "object" || typeof tool.name !== "string") throw new LuaWorkflowBuildError("invalid-envelope", `toolStep("${id}") needs a LuaTool`);
9219
- assertNoClosure(opts.input, `toolStep("${id}").input`);
9453
+ toolStep(id2, tool, opts = {}) {
9454
+ this.assertId(id2, "toolStep()");
9455
+ if (!tool || typeof tool !== "object" || typeof tool.name !== "string") throw new LuaWorkflowBuildError("invalid-envelope", `toolStep("${id2}") needs a LuaTool`);
9456
+ assertNoClosure(opts.input, `toolStep("${id2}").input`);
9220
9457
  this.recordEnvRefs(opts.input);
9221
9458
  assertTimeout({
9222
- id,
9459
+ id: id2,
9223
9460
  timeoutSeconds: opts.timeoutSeconds,
9224
9461
  kind: "tool"
9225
9462
  });
9226
- assertRetry(opts.retry, id);
9463
+ assertRetry(opts.retry, id2);
9227
9464
  const node = defined({
9228
9465
  type: "tool",
9229
- id,
9466
+ id: id2,
9230
9467
  toolId: tool.name,
9231
9468
  input: opts.input,
9232
9469
  timeoutSeconds: opts.timeoutSeconds,
@@ -9240,34 +9477,34 @@ var init_workflow = __esm({
9240
9477
  node
9241
9478
  });
9242
9479
  }
9243
- approval(id, opts) {
9244
- this.assertId(id, "approval()");
9245
- if (!opts || typeof opts.title !== "string") throw new LuaWorkflowBuildError("invalid-envelope", `approval("${id}") needs a title`);
9480
+ approval(id2, opts) {
9481
+ this.assertId(id2, "approval()");
9482
+ if (!opts || typeof opts.title !== "string") throw new LuaWorkflowBuildError("invalid-envelope", `approval("${id2}") needs a title`);
9246
9483
  if (opts.approver === "creator" && opts.excludeInitiator === true) {
9247
- throw new LuaWorkflowBuildError("approver-excludes-only-candidate", `"${id}": approver:'creator' with excludeInitiator:true always excludes the only candidate`);
9484
+ throw new LuaWorkflowBuildError("approver-excludes-only-candidate", `"${id2}": approver:'creator' with excludeInitiator:true always excludes the only candidate`);
9248
9485
  }
9249
9486
  const editable = approvalEditable(opts);
9250
- if (opts.fourEyes !== void 0 && !editable) throw new LuaWorkflowBuildError("four-eyes-requires-editable", `"${id}": \`fourEyes\` requires editable:true`);
9487
+ if (opts.fourEyes !== void 0 && !editable) throw new LuaWorkflowBuildError("four-eyes-requires-editable", `"${id2}": \`fourEyes\` requires editable:true`);
9251
9488
  if (opts.editable === false && Array.isArray(opts.editablePaths) && opts.editablePaths.length > 0) {
9252
- throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": \`editablePaths\` beside editable:false is contradictory \u2014 drop the paths or set editable:true`);
9489
+ throw new LuaWorkflowBuildError("editable-path-invalid", `"${id2}": \`editablePaths\` beside editable:false is contradictory \u2014 drop the paths or set editable:true`);
9253
9490
  } else if ((opts.editablePaths !== void 0 || opts.editedPayloadSchema !== void 0) && !editable) {
9254
- throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": \`editablePaths\` / \`editedPayloadSchema\` require editable:true (a non-empty editablePaths implies it)`);
9491
+ throw new LuaWorkflowBuildError("editable-path-invalid", `"${id2}": \`editablePaths\` / \`editedPayloadSchema\` require editable:true (a non-empty editablePaths implies it)`);
9255
9492
  }
9256
9493
  for (const p of opts.editablePaths ?? []) {
9257
- if (!EDITABLE_PATH_RE2.test(p)) throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": editablePaths entry "${p}" is outside the grammar seg(.seg)* with [*]/[n] selectors`);
9494
+ if (!EDITABLE_PATH_RE2.test(p)) throw new LuaWorkflowBuildError("editable-path-invalid", `"${id2}": editablePaths entry "${p}" is outside the grammar seg(.seg)* with [*]/[n] selectors`);
9258
9495
  }
9259
9496
  if (Array.isArray(opts.onTimeout)) {
9260
9497
  const chain = opts.onTimeout;
9261
9498
  const hops = chain.filter((h) => typeof h === "object");
9262
- if (hops.length > 3) throw new LuaWorkflowBuildError("escalation-chain-too-long", `"${id}": an onTimeout chain carries at most 3 escalation hops`);
9499
+ if (hops.length > 3) throw new LuaWorkflowBuildError("escalation-chain-too-long", `"${id2}": an onTimeout chain carries at most 3 escalation hops`);
9263
9500
  const last = chain[chain.length - 1];
9264
- if (last === void 0 || typeof last === "object") throw new LuaWorkflowBuildError("escalation-chain-not-terminal", `"${id}": an onTimeout chain must end in a terminal member`);
9501
+ if (last === void 0 || typeof last === "object") throw new LuaWorkflowBuildError("escalation-chain-not-terminal", `"${id2}": an onTimeout chain must end in a terminal member`);
9265
9502
  }
9266
- if (typeof opts.details === "function") throw new LuaWorkflowBuildError("closure-binding", `approval("${id}").details must be template(...)`);
9503
+ if (typeof opts.details === "function") throw new LuaWorkflowBuildError("closure-binding", `approval("${id2}").details must be template(...)`);
9267
9504
  this.recordEnvRefs(opts.details, opts.timeoutHours, opts.approver);
9268
9505
  const node = defined({
9269
9506
  type: "approval",
9270
- id,
9507
+ id: id2,
9271
9508
  title: opts.title,
9272
9509
  details: opts.details ? templateText(opts.details) : void 0,
9273
9510
  approver: opts.approver,
@@ -9289,13 +9526,13 @@ var init_workflow = __esm({
9289
9526
  node
9290
9527
  });
9291
9528
  }
9292
- waitForSignal(id, opts) {
9293
- this.assertId(id, "waitForSignal()");
9294
- if (!opts || typeof opts.signal !== "string" || opts.signal.length === 0) throw new LuaWorkflowBuildError("invalid-envelope", `waitForSignal("${id}") needs a signal name`);
9529
+ waitForSignal(id2, opts) {
9530
+ this.assertId(id2, "waitForSignal()");
9531
+ if (!opts || typeof opts.signal !== "string" || opts.signal.length === 0) throw new LuaWorkflowBuildError("invalid-envelope", `waitForSignal("${id2}") needs a signal name`);
9295
9532
  this.recordEnvRefs(opts.timeoutHours);
9296
9533
  const node = defined({
9297
9534
  type: "waitForSignal",
9298
- id,
9535
+ id: id2,
9299
9536
  signal: opts.signal,
9300
9537
  schema: schemaToJson(opts.schema),
9301
9538
  timeoutHours: opts.timeoutHours,
@@ -9308,28 +9545,28 @@ var init_workflow = __esm({
9308
9545
  node
9309
9546
  });
9310
9547
  }
9311
- workflow(id, ref, input, opts) {
9312
- this.assertId(id, "workflow()");
9313
- assertRetry(opts?.retry, id);
9548
+ workflow(id2, ref, input, opts) {
9549
+ this.assertId(id2, "workflow()");
9550
+ assertRetry(opts?.retry, id2);
9314
9551
  const name = typeof ref === "string" ? ref : ref instanceof LuaWorkflow ? ref.getName() : void 0;
9315
- if (!name) throw new LuaWorkflowBuildError("invalid-envelope", `workflow("${id}") needs a LuaWorkflow or a workflow name`);
9552
+ if (!name) throw new LuaWorkflowBuildError("invalid-envelope", `workflow("${id2}") needs a LuaWorkflow or a workflow name`);
9316
9553
  if (opts?.workspace === "inherit") {
9317
- if (!this.config.workspace) throw new LuaWorkflowBuildError("workspace-inherit-without-parent-workspace", `"${id}": workspace:'inherit' but the parent createWorkflow declares no workspace`);
9318
- if (ref instanceof LuaWorkflow && ref.getConfig().workspace) throw new LuaWorkflowBuildError("workspace-inherit-conflict", `"${id}": workspace:'inherit' on a workflow that declares its own workspace`);
9554
+ if (!this.config.workspace) throw new LuaWorkflowBuildError("workspace-inherit-without-parent-workspace", `"${id2}": workspace:'inherit' but the parent createWorkflow declares no workspace`);
9555
+ if (ref instanceof LuaWorkflow && ref.getConfig().workspace) throw new LuaWorkflowBuildError("workspace-inherit-conflict", `"${id2}": workspace:'inherit' on a workflow that declares its own workspace`);
9319
9556
  }
9320
- assertNoClosure(input, `workflow("${id}").input`);
9557
+ assertNoClosure(input, `workflow("${id2}").input`);
9321
9558
  this.recordEnvRefs(input);
9322
9559
  this.nestedRefs.push(opts?.workspace === "inherit" ? {
9323
- id,
9560
+ id: id2,
9324
9561
  name,
9325
9562
  workspace: "inherit"
9326
9563
  } : {
9327
- id,
9564
+ id: id2,
9328
9565
  name
9329
9566
  });
9330
9567
  const node = defined({
9331
9568
  type: "workflow",
9332
- id,
9569
+ id: id2,
9333
9570
  workflowId: name,
9334
9571
  input,
9335
9572
  workspace: opts?.workspace,
@@ -9408,8 +9645,8 @@ var init_workflow = __esm({
9408
9645
  });
9409
9646
  }
9410
9647
  }
9411
- assertId(id, where) {
9412
- if (typeof id !== "string" || !STEP_ID_RE.test(id)) throw new LuaWorkflowBuildError("invalid-step-id", `${where}: id "${String(id)}" must match ${STEP_ID_RE}`);
9648
+ assertId(id2, where) {
9649
+ if (typeof id2 !== "string" || !STEP_ID_RE.test(id2)) throw new LuaWorkflowBuildError("invalid-step-id", `${where}: id "${String(id2)}" must match ${STEP_ID_RE}`);
9413
9650
  }
9414
9651
  };
9415
9652
  EDITABLE_PATH_RE2 = /^[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?(\.[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?)*$/;
@@ -9587,7 +9824,7 @@ var init_lua_fetch = __esm({
9587
9824
  });
9588
9825
 
9589
9826
  // src/services/firebase-session.ts
9590
- import { z as z5 } from "zod";
9827
+ import { z as z6 } from "zod";
9591
9828
  function rejectedRefreshReason(message) {
9592
9829
  const normalised = message.toUpperCase();
9593
9830
  return REJECTED_REFRESH_REASONS.find((reason) => normalised.includes(reason));
@@ -9733,20 +9970,20 @@ var init_firebase_session = __esm({
9733
9970
  this.name = "FirebaseSessionRejectedError";
9734
9971
  }
9735
9972
  };
9736
- customTokenResponseSchema = z5.object({
9737
- idToken: z5.string().min(1),
9738
- refreshToken: z5.string().min(1),
9739
- expiresIn: z5.coerce.number().positive().finite(),
9740
- localId: z5.string().min(1).optional()
9973
+ customTokenResponseSchema = z6.object({
9974
+ idToken: z6.string().min(1),
9975
+ refreshToken: z6.string().min(1),
9976
+ expiresIn: z6.coerce.number().positive().finite(),
9977
+ localId: z6.string().min(1).optional()
9741
9978
  });
9742
- refreshResponseSchema = z5.object({
9743
- id_token: z5.string().min(1),
9744
- refresh_token: z5.string().min(1),
9745
- expires_in: z5.coerce.number().positive().finite(),
9746
- user_id: z5.string().min(1)
9979
+ refreshResponseSchema = z6.object({
9980
+ id_token: z6.string().min(1),
9981
+ refresh_token: z6.string().min(1),
9982
+ expires_in: z6.coerce.number().positive().finite(),
9983
+ user_id: z6.string().min(1)
9747
9984
  });
9748
- firebaseIdTokenPayloadSchema = z5.object({
9749
- sub: z5.string().min(1)
9985
+ firebaseIdTokenPayloadSchema = z6.object({
9986
+ sub: z6.string().min(1)
9750
9987
  });
9751
9988
  __name(requireFirebaseWebApiKey, "requireFirebaseWebApiKey");
9752
9989
  __name(claimsOfFirebaseIdToken, "claimsOfFirebaseIdToken");
@@ -9763,7 +10000,7 @@ var init_firebase_session = __esm({
9763
10000
  import { createHash as createHash3, randomUUID } from "crypto";
9764
10001
  import { mkdir, open, readFile, rename, rm, stat, unlink, writeFile } from "fs/promises";
9765
10002
  import { join as join3 } from "path";
9766
- import { z as z6 } from "zod";
10003
+ import { z as z7 } from "zod";
9767
10004
  function environmentKey(environment) {
9768
10005
  return createHash3("sha256").update(`${environment.apiUrl}
9769
10006
  ${environment.authUrl}
@@ -9780,15 +10017,15 @@ var init_firebase_session_store = __esm({
9780
10017
  "src/services/firebase-session-store.ts"() {
9781
10018
  "use strict";
9782
10019
  init_constants();
9783
- storedFirebaseSessionSchema = z6.object({
9784
- version: z6.literal(1),
9785
- kind: z6.literal("firebase-session"),
9786
- generation: z6.string().min(1),
9787
- refreshToken: z6.string().min(1),
9788
- firebaseUid: z6.string().min(1),
9789
- apiUrl: z6.string().url(),
9790
- authUrl: z6.string().url(),
9791
- firebaseWebApiKey: z6.string().min(1)
10020
+ storedFirebaseSessionSchema = z7.object({
10021
+ version: z7.literal(1),
10022
+ kind: z7.literal("firebase-session"),
10023
+ generation: z7.string().min(1),
10024
+ refreshToken: z7.string().min(1),
10025
+ firebaseUid: z7.string().min(1),
10026
+ apiUrl: z7.string().url(),
10027
+ authUrl: z7.string().url(),
10028
+ firebaseWebApiKey: z7.string().min(1)
9792
10029
  });
9793
10030
  currentFirebaseSessionEnvironment = /* @__PURE__ */ __name(() => ({
9794
10031
  apiUrl: BASE_URLS.API,
@@ -10459,7 +10696,7 @@ async function* parseSseStream(body, signal) {
10459
10696
  const decoder = new TextDecoder();
10460
10697
  let buffer = "";
10461
10698
  const flush = /* @__PURE__ */ __name((block) => {
10462
- let id;
10699
+ let id2;
10463
10700
  let event = "message";
10464
10701
  const data = [];
10465
10702
  for (const rawLine of block.split("\n")) {
@@ -10469,11 +10706,11 @@ async function* parseSseStream(body, signal) {
10469
10706
  const field = colon === -1 ? line : line.slice(0, colon);
10470
10707
  let value3 = colon === -1 ? "" : line.slice(colon + 1);
10471
10708
  if (value3.startsWith(" ")) value3 = value3.slice(1);
10472
- if (field === "id") id = value3;
10709
+ if (field === "id") id2 = value3;
10473
10710
  else if (field === "event") event = value3;
10474
10711
  else if (field === "data") data.push(value3);
10475
10712
  }
10476
- if (data.length === 0 && id === void 0 && event === "message") return void 0;
10713
+ if (data.length === 0 && id2 === void 0 && event === "message") return void 0;
10477
10714
  const joined = data.join("\n");
10478
10715
  let parsed = joined;
10479
10716
  try {
@@ -10482,7 +10719,7 @@ async function* parseSseStream(body, signal) {
10482
10719
  parsed = joined;
10483
10720
  }
10484
10721
  return {
10485
- id,
10722
+ id: id2,
10486
10723
  event,
10487
10724
  data: parsed
10488
10725
  };
@@ -11874,11 +12111,17 @@ var init_base_handler = __esm({
11874
12111
  /**
11875
12112
  * Phase 2 of parallel sync: apply fetched data to YAML.
11876
12113
  * Optionally creates missing primitives on server if apiKey+agentId provided.
12114
+ *
12115
+ * PRO-2150 — `apiCredentials.registerOnly` drops the two writes that overwrite what the developer
12116
+ * pinned (the server-only orphan stubs in Part 1, and the version reconciliation half of Part 2)
12117
+ * while keeping id linking and create-on-server. `lua chat` uses it: it needs the skills'/processors'
12118
+ * server ids to exist before the sandbox push, and nothing else.
11877
12119
  */
11878
12120
  async applySyncToYaml(serverData, config, manifest, apiCredentials) {
11879
12121
  const messages = [];
11880
12122
  let yamlUpdated = false;
11881
12123
  let orphanedCount = 0;
12124
+ const registerOnly = apiCredentials?.registerOnly === true;
11882
12125
  try {
11883
12126
  if (!serverData.serverItems) {
11884
12127
  if (serverData.fetchError) {
@@ -11906,10 +12149,10 @@ var init_base_handler = __esm({
11906
12149
  messages.push(msg);
11907
12150
  console.log(msg);
11908
12151
  }
11909
- const orphans = serverData.serverItems.filter((item) => {
11910
- const id = item.id;
12152
+ const orphans = registerOnly ? [] : serverData.serverItems.filter((item) => {
12153
+ const id2 = item.id;
11911
12154
  const name = item.name;
11912
- return !yamlById.has(id) && !yamlByName.has(name) && this.isActive(item) && this.shouldConsiderForOrphan(item);
12155
+ return !yamlById.has(id2) && !yamlByName.has(name) && this.isActive(item) && this.shouldConsiderForOrphan(item);
11913
12156
  });
11914
12157
  if (orphans.length > 0) {
11915
12158
  const stubs = orphans.map((item) => this.cleanItem({
@@ -11933,7 +12176,9 @@ var init_base_handler = __esm({
11933
12176
  `);
11934
12177
  orphanedCount = orphans.length;
11935
12178
  }
11936
- const { items: updatedItems, changed, msgs } = this.syncFromServer(yamlItems, serverByName);
12179
+ const { items: updatedItems, changed, msgs } = this.syncFromServer(yamlItems, serverByName, {
12180
+ syncVersions: !registerOnly
12181
+ });
11937
12182
  messages.push(...msgs);
11938
12183
  if (changed) {
11939
12184
  yamlUpdated = true;
@@ -12125,7 +12370,7 @@ var init_base_handler = __esm({
12125
12370
  const result = /* @__PURE__ */ new Map();
12126
12371
  const { serverItems } = await this.fetchServerState(apiKey, agentId);
12127
12372
  if (!serverItems) {
12128
- entityIds.forEach((id) => result.set(id, null));
12373
+ entityIds.forEach((id2) => result.set(id2, null));
12129
12374
  return result;
12130
12375
  }
12131
12376
  for (const entityId of entityIds) {
@@ -12159,8 +12404,8 @@ var init_base_handler = __esm({
12159
12404
  const yamlById = /* @__PURE__ */ new Map();
12160
12405
  const yamlByName = /* @__PURE__ */ new Map();
12161
12406
  for (const item of yamlItems) {
12162
- const id = this.getItemId(item);
12163
- if (id) yamlById.set(id, item);
12407
+ const id2 = this.getItemId(item);
12408
+ if (id2) yamlById.set(id2, item);
12164
12409
  yamlByName.set(item.name, item);
12165
12410
  }
12166
12411
  const serverByName = /* @__PURE__ */ new Map();
@@ -12176,7 +12421,8 @@ var init_base_handler = __esm({
12176
12421
  /**
12177
12422
  * For each YAML item, match to server by name, populate missing IDs, update versions.
12178
12423
  */
12179
- syncFromServer(yamlItems, serverByName) {
12424
+ syncFromServer(yamlItems, serverByName, options) {
12425
+ const syncVersions = options?.syncVersions !== false;
12180
12426
  const msgs = [];
12181
12427
  let changed = false;
12182
12428
  const idField = this.yamlConfig.idField;
@@ -12197,7 +12443,7 @@ var init_base_handler = __esm({
12197
12443
  };
12198
12444
  }
12199
12445
  const versions = serverItem.versions;
12200
- if (Array.isArray(versions) && versions.length > 0) {
12446
+ if (syncVersions && Array.isArray(versions) && versions.length > 0) {
12201
12447
  const activeVersion = this.getActiveVersion(serverItem);
12202
12448
  const currentVersion = item.version;
12203
12449
  if (activeVersion && activeVersion !== currentVersion) {
@@ -16022,7 +16268,7 @@ var init_workflow_api_service = __esm({
16022
16268
  throw new WorkflowApiError("FORBIDDEN", `Workflows.${member}: goals are scoped to the bound agent ${api.agentId}`, 403);
16023
16269
  }
16024
16270
  }, "assertBoundAgent");
16025
- pathId = /* @__PURE__ */ __name((id) => encodeURIComponent(id), "pathId");
16271
+ pathId = /* @__PURE__ */ __name((id2) => encodeURIComponent(id2), "pathId");
16026
16272
  unavailable = /* @__PURE__ */ __name((member, route) => async () => {
16027
16273
  throw new WorkflowApiError("WORKFLOWS_API_UNAVAILABLE", `Workflows.${member} is not available in this runtime yet (${route} lands with a later wave)`, 501);
16028
16274
  }, "unavailable");
@@ -17732,9 +17978,9 @@ var Products = {
17732
17978
  * @param id - Product ID
17733
17979
  * @returns Promise resolving when deletion is complete
17734
17980
  */
17735
- async delete(id) {
17981
+ async delete(id2) {
17736
17982
  const instance = await getProductsInstance();
17737
- return instance.delete(id);
17983
+ return instance.delete(id2);
17738
17984
  },
17739
17985
  /**
17740
17986
  * Searches products by query string.
@@ -17752,9 +17998,9 @@ var Products = {
17752
17998
  * @param id - Product ID
17753
17999
  * @returns Promise resolving to product data
17754
18000
  */
17755
- async getById(id) {
18001
+ async getById(id2) {
17756
18002
  const instance = await getProductsInstance();
17757
- return instance.getById(id);
18003
+ return instance.getById(id2);
17758
18004
  }
17759
18005
  };
17760
18006
  var Baskets = {