lua-cli 3.44.0 → 3.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -986,6 +986,106 @@ function supervisionSubjectId(agentId) {
986
986
  function isSupervisionOp(op) {
987
987
  return typeof op === "string" && Object.prototype.hasOwnProperty.call(SUPERVISION_OPS, op);
988
988
  }
989
+ function isSupervisionWatchdogOp(op) {
990
+ return typeof op === "string" && Object.prototype.hasOwnProperty.call(SUPERVISION_WATCHDOG_OPS, op);
991
+ }
992
+ function isSupervisionRollbackRefusalReason(v) {
993
+ return typeof v === "string" && Object.prototype.hasOwnProperty.call(SUPERVISION_ROLLBACK_REFUSAL_CODES, v);
994
+ }
995
+ function supervisionRollbackTargetRefusal(target, expectActive, window) {
996
+ if (target.status !== "superseded" || !target.promotedAt || target.compensationFailed === true) {
997
+ return {
998
+ reason: "never_active",
999
+ message: `Version ${target.version} was never fully the active version (status ${target.status ?? "unknown"})`
1000
+ };
1001
+ }
1002
+ if (typeof expectActive !== "number" || !(target.version < expectActive)) {
1003
+ return {
1004
+ reason: "not_older",
1005
+ message: `Version ${target.version} is not older than the active version ${expectActive ?? "none"}`
1006
+ };
1007
+ }
1008
+ if (window) {
1009
+ if (target.supersededVia === "rollback" || target.promotedVia === "rollback") {
1010
+ return {
1011
+ reason: "after_rollback",
1012
+ message: `Version ${target.version} was retired or restored by a rollback`
1013
+ };
1014
+ }
1015
+ if (target.supersededVia !== "promote" && target.supersededVia !== "scoped") {
1016
+ return {
1017
+ reason: "not_in_lineage",
1018
+ message: `Version ${target.version} has no forward-promote history`
1019
+ };
1020
+ }
1021
+ const ended = target.supersededAt ? new Date(target.supersededAt).getTime() : NaN;
1022
+ if (!Number.isFinite(ended) || ended < window.now - window.windowMs) {
1023
+ return {
1024
+ reason: "too_old",
1025
+ message: `Version ${target.version} was last active outside the ${Math.round(window.windowMs / 864e5)}-day window`
1026
+ };
1027
+ }
1028
+ }
1029
+ return null;
1030
+ }
1031
+ function supervisionRollbackRefusal(input) {
1032
+ const { target, active, lineage, expectActive, windowMs, now } = input;
1033
+ const pre = supervisionRollbackTargetRefusal(target, expectActive);
1034
+ if (pre) return pre;
1035
+ if (!active || active.version !== expectActive) {
1036
+ return {
1037
+ reason: "not_older",
1038
+ message: `Version ${expectActive ?? "none"} is not the active version`
1039
+ };
1040
+ }
1041
+ if (active.promotedVia === "rollback") {
1042
+ return {
1043
+ reason: "after_rollback",
1044
+ message: `The active version ${active.version} was restored by a rollback; a watchdog does not roll back twice in a row`
1045
+ };
1046
+ }
1047
+ let previous = active;
1048
+ for (const step3 of lineage.slice(0, SUPERVISION_ROLLBACK_LINEAGE_MAX)) {
1049
+ const label2 = `version ${step3.version}`;
1050
+ if (step3.supersededVia === "rollback" || step3.promotedVia === "rollback") {
1051
+ return {
1052
+ reason: "after_rollback",
1053
+ message: `The rollback lineage crosses ${label2}, which a rollback retired or restored`
1054
+ };
1055
+ }
1056
+ if (step3.supersededVia !== "promote" && step3.supersededVia !== "scoped") {
1057
+ return {
1058
+ reason: "not_in_lineage",
1059
+ message: `The rollback lineage stops at ${label2} (no forward-promote history)`
1060
+ };
1061
+ }
1062
+ if (step3.compensationFailed === true || step3.status !== "superseded" || !step3.promotedAt) {
1063
+ return {
1064
+ reason: "not_in_lineage",
1065
+ message: `The rollback lineage stops at ${label2} (not fully served)`
1066
+ };
1067
+ }
1068
+ if (!(step3.version < previous.version)) {
1069
+ return {
1070
+ reason: "after_backward_promote",
1071
+ message: `Version ${previous.version} was promoted BACK over ${label2}; a watchdog never reaches behind that`
1072
+ };
1073
+ }
1074
+ const ended = step3.supersededAt ? new Date(step3.supersededAt).getTime() : NaN;
1075
+ if (!Number.isFinite(ended) || ended < now - windowMs) {
1076
+ return {
1077
+ reason: "too_old",
1078
+ message: `The rollback lineage reaches ${label2}, last active outside the ${Math.round(windowMs / 864e5)}-day window`
1079
+ };
1080
+ }
1081
+ if (step3.version === target.version && (!target.id || !step3.id || step3.id === target.id)) return null;
1082
+ previous = step3;
1083
+ }
1084
+ return {
1085
+ reason: "not_in_lineage",
1086
+ message: `Version ${target.version} is not in the active version's recent forward-promote lineage`
1087
+ };
1088
+ }
989
1089
  function isUntargetedSupervisionOp(op) {
990
1090
  return typeof op === "string" && SUPERVISION_UNTARGETED_OPS.includes(op);
991
1091
  }
@@ -3286,6 +3386,19 @@ function resolveSlackReactionName(value3) {
3286
3386
  }
3287
3387
  return slackEmojiName(trimmed2);
3288
3388
  }
3389
+ function threadScopingSetting(type) {
3390
+ const noun = THREAD_SCOPING_NOUN[type];
3391
+ return {
3392
+ key: `${type}.threadScoping`,
3393
+ group: "conversations",
3394
+ label: `One conversation per ${noun}`,
3395
+ help: `Each ${noun} is its own conversation with its own history.`,
3396
+ effect: "Off: every message from the same person shares one conversation.",
3397
+ type: "boolean",
3398
+ default: false,
3399
+ confirm: "Changing this starts fresh conversations for ones that are already open. Earlier history isn't carried over."
3400
+ };
3401
+ }
3289
3402
  function takeoverSettings(type) {
3290
3403
  const variants = type === "email" ? [
3291
3404
  "ses"
@@ -3641,13 +3754,13 @@ function channelSettingsGroups(channel, config) {
3641
3754
  const groups = [];
3642
3755
  for (const def of channelSettingDefinitions(channel, config)) {
3643
3756
  const { tunableDefault: _tunable, ...shown } = def;
3644
- const unavailable3 = channelSettingUnavailable(channel, def);
3757
+ const unavailable2 = channelSettingUnavailable(channel, def);
3645
3758
  const view = {
3646
3759
  ...shown,
3647
3760
  ...effectiveChannelSetting(channel, def),
3648
3761
  resettable: channelSettingResettable(def),
3649
- ...unavailable3 && {
3650
- unavailable: unavailable3
3762
+ ...unavailable2 && {
3763
+ unavailable: unavailable2
3651
3764
  }
3652
3765
  };
3653
3766
  const group = groups.find((candidate) => candidate.key === def.group);
@@ -5259,6 +5372,9 @@ function workflowOccurrenceId(lineageId, stepId) {
5259
5372
  function workflowOrgSlotKey(orgId, kind) {
5260
5373
  return `wf:org:${orgId}:${kind}`;
5261
5374
  }
5375
+ function isWorkflowAgentAppConnectionId(id2) {
5376
+ return typeof id2 === "string" && id2.startsWith(WORKFLOW_AGENT_APP_CONNECTION_PREFIX) && /^[A-Za-z0-9_-]{1,128}$/.test(id2);
5377
+ }
5262
5378
  function workflowJobModelSourceLabel(source) {
5263
5379
  return WORKFLOW_JOB_MODEL_SOURCE_LABELS[source];
5264
5380
  }
@@ -6814,7 +6930,7 @@ function isPaymentRequiredChatErrorEnvelope(data) {
6814
6930
  if (d.type !== "error") return false;
6815
6931
  return d.textDelta === BILLING_REJECTION_TEXT_CREDITS || d.textDelta === BILLING_REJECTION_TEXT_SEAT || d.textDelta === BILLING_REJECTION_TEXT_USER_QUOTA;
6816
6932
  }
6817
- var __defProp2, __name2, PLUMBING_THREAD_CHANNELS, CHANNEL_CONVERSATION_CHANNELS, HIDDEN_THREAD_CHANNELS, CHOICE_PERSON_TURN_CHANNELS, CHOICE_REPLAY_CLIENT_CAPABILITIES, CHOICE_REPLAY_CLIENT_SURFACES, INTEGRATION_PASSTHROUGH_READ_METHODS, URL_REINTERPRETED_PATH_CHARACTERS, PERCENT_ENCODED_DOT, PERCENT_ESCAPE, DECODED_PATH_SEPARATORS, DECODED_LEADING_SEPARATOR, MAX_PERCENT_DECODE_ROUNDS, URL_RESOLUTION_PROBE_BASE, PLATFORM_INVOCATION_CALLERS, SUPERVISION_OPS, SUPERVISION_OPS_WAVE2, SUPERVISION_UNTARGETED_OPS, SUPERVISED_WORKFLOW_VERSIONS_MAX, SUPERVISION_EVENT_KINDS, AGENT_PROVISIONING_LIMITS, AGENT_PROVISIONING_APPROVAL_PAYLOAD_KEY, AGENT_PROVISIONING_ERRORS, PROVISIONED_SUPERVISION_ACTIONS, isNonEmptyString, uniqueStrings, sameSet, AGENT_PROVISIONING_APPROVAL_CARD_MAX_CHARS, APPROVAL_PAYLOAD_MEMBERS, AGENT_CONNECTION_POLICIES, AGENT_CONNECTION_POLICY_DEFAULT, AGENT_CONNECTION_MOUNT_MODES, AGENT_CONNECTION_GOVERNANCE_ERRORS, AGENT_CONNECTION_OPERATION_RULES_MAX, AGENT_CONNECTION_OPERATION_PATTERN_MAX_LENGTH, OPERATION_RULE_METHODS, PATH_SEPARATOR, PATH_SINGLE_SEGMENT_WILDCARD, PATH_REST_WILDCARD, METHOD_OVERRIDE_HEADER_NAMES, METHOD_OVERRIDE_QUERY_NAMES, ODATA_BATCH_SEGMENT, GOOGLE_BATCH_FIRST_SEGMENT, CONNECTION_CHECK_RESULTS, CONNECTION_CHECK_CATALOGUE_V1, CONNECTION_CHECK_NAME_PATTERN, CONNECTION_CHECK_NAME_MAX, CONNECT_OUTCOME_STATUSES, SECRET_TEST_RESULTS, SECRET_DATADOG_REGIONS, SECRET_PROVIDER_CATALOGUE_V1, SECRET_TEST_MAX_RESPONSE_BYTES, SECRET_ENV_KEY_PATTERN, SECRET_REQUEST_ERRORS, SECRET_OUTCOME_STATUSES, CLIENT_OUTCOME_TURNS_MAX, SHORT_TEXT_MAX, SLUG_MAX, shortText, optionalShortText, CONNECTION_REQUEST_TERMINAL_STATES, CONNECTION_USE_ORIGINS, AGENT_CONNECTION_OPERATION_LIMITS_BOUNDS, CURRENCY_CODE, LIMITS_KEYS, CAPS_KEYS, EXCLUSIONS_KEYS, EMAIL_IN_TEXT, MAX_EXCLUSION_DEPTH, PROJECTION_PARAMETER_KEYS, CHANNEL_PARAMETER_KEYS, GMAIL_SYSTEM_LABEL_IDS, ZERO_DECIMAL_CURRENCIES, THREE_DECIMAL_CURRENCIES, DECIMAL_AMOUNT, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, TEST_SESSION_ID_PATTERN, TEST_SESSION_COLLECTION_PREFIX, TEST_EFFECT_BODY_MAX_BYTES, TEST_EFFECT_DROPPED_HEADERS, EVAL_CREDITS_PER_1K_TOKENS, EVAL_RESERVED_TOOL_ID_PREFIXES, CONNECTION_HANDOVER_APPROVAL_PAYLOAD_KEY, CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS, CONNECTION_HANDOVER_LIMITS, MEMBERS, FORMAT_CHARS, oneLine, boundedString, AGENT_METRIC_NAME_PATTERN, AGENT_METRIC_LIMITS, AGENT_OBJECTIVE_ERRORS, CHANGE_LEASE_TTL_MINUTES_MIN, CHANGE_LEASE_TTL_MINUTES_MAX, CHANGE_LEASE_REASON_MAX, CHANGE_LEASE_ERRORS, AGENT_CONFIG_SET_LIMITS, SECRET_ENV_KEY_SUFFIXES, DEFAULT_OWNER_DEPARTURE_POLICY, AGENT_LIFECYCLE_ERRORS, USER_COST_COUNTER_TTL_SECONDS, USER_COST_ATTRIBUTION_CHANNELS, CALLER_DEDUPE_KEY_MAX, FOLLOW_UP_IDEMPOTENCY_TTL_SECONDS, THREAD_FOLLOW_UP_LIMITS, THREAD_FOLLOW_UP_ERRORS, PROGRESS_UPDATE_LIMITS, PAUSABLE_CAPABILITY_KINDS, UNIFIED_CATCH_UP_MAX_WINDOW_HOURS, UNIFIED_CATCH_UP_EVENTS, UNIFIED_CATCH_UP_FILTERABLE_OBJECT_TYPES, AGENT_NEVER_RULES_MAX, AGENT_NEVER_RULE_FIELD_MAX, AGENT_NEVER_RULE_INPUT_MATCH_MAX, NEVER_RULE_ID_PATTERN, NEVER_RULE_HTTP_METHODS, TEMPLATE_DISTRIBUTION_MODES, TAKEOVER_MAX_IDLE_MINUTES, MINUTES_PER_DAY, DEFAULT_IDLE_RELEASE_MINUTES, FALLBACK_IDLE_RELEASE_MINUTES, VARIATION_SELECTORS, SLACK_EMOJI_NAMES, SLACK_SHORTCODE, PLAIN_EMAIL_ADDRESS, DOMAIN, UNSAFE_TEXT, SLACK_CONVERSATION_ID, CHANNEL_SETTING_GROUPS, TAKEOVER_CHANNEL_TYPES, EMAIL_SETTINGS, SLACK_SETTING_DEFAULTS, SLACK_REACTION_MAX, SLACK_INTRO_MAX, SLACK_EXAMPLE_PROMPTS_MAX, SLACK_EXAMPLE_PROMPT_MAX, SLACK_SUPPORT_CONTACT_MAX, SLACK_SETTINGS, CHANNEL_SETTINGS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, LOG_FIELDS_MAX_KEYS, LOG_FIELD_MAX_VALUE_BYTES, LOG_FIELDS_MAX_BYTES, LOG_FIELD_KEY_PATTERN, LOG_FIELD_SECRET_SHAPED_KEY_PATTERNS, LOG_FIELDS_CLAMPED_KEY, LOG_FIELD_ARRAY_COUNT_SUFFIX, LuaLogFieldsError, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_AGENT_EFFORTS, WORKFLOW_MODEL_CLASSES, WORKFLOW_TASK_CLASSES, WORKFLOW_MODEL_TRAITS, WORKFLOW_MODEL_REASON_MAX_LENGTH, WORKFLOW_MODELS_COMPOSE_MODES, WORKFLOW_MODELS_PIN_MODES, WORKFLOW_MODELS_FALLBACK_MODES, WORKFLOW_MODELS_CONSENT_ACTIONS_MIN, WORKFLOW_DEFAULT_TASK_CLASS_MAP, WORKFLOW_MODELS_MAX_CLASS_DEFAULT, WORKFLOW_AUTONOMY_FORMS, WORKFLOW_AUTONOMY_NUMERIC_KEYS, WORKFLOW_AUTONOMY_ENVELOPE_KEYS, WORKFLOW_AUTONOMY_ENABLED_DEFAULT, 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_ENVIRONMENTS, AGENT_LOG_FIELDS_MAX_WIRE_KEYS, LOG_DRAIN_TYPES_PHASE1, LOG_DRAIN_TYPES_PHASE2, LOG_DRAIN_TYPES_IMPLEMENTED, LOG_DRAIN_FORMATS, LOG_DRAIN_SEVERITIES, LOG_DRAIN_SOURCES, LOG_DRAIN_CONTENT_SOURCES, LOG_DRAIN_DEFAULT_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, EventType, 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, TYPED_API_KEY, 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_JOURNAL_PROTOCOL_VERSION, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_JOB_MODEL_SOURCE_LABELS, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, SCHEDULE_HEALTH_NOTIFY_CHANNELS, SCHEDULE_HEALTH_DEFAULT_NOTIFY, SCHEDULE_HEALTH_LIMITS, KNOWN_KEYS, WORKFLOW_GOAL_JUDGE_SELF, APPROVAL_ARGS_MAX_CHARS, APPROVAL_ARG_STRING_MAX_CHARS, APPROVAL_ARGS_SUMMARY_MAX_CHARS, MAX_DEPTH, MAX_KEYS, MAX_ITEMS, MAX_NODES, MAX_KEY_CHARS, KEY_SCRUB_INPUT_MAX_CHARS, STRING_SCRUB_INPUT_MAX_CHARS, ELLIPSIS, SKIP, SCRUB_SECRETS_BEFORE_PERSIST_ENV, PERSIST_SCRUB_MAX_CHARS, PERSIST_SCRUB_REF_MAX_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES, SUBAGENT_PER_KEY_FLAG_ENV, PER_KEY_FLAG_VALUES, ONBOARDING_FLOW_KEY, ONBOARDING_SCHEMA_VERSION, id, copy, onboardingHeadingSchema, onboardingRichTextInlineSchema, onboardingRichTextSchema, onboardingDestinationSchema, onboardingArtworkSchema, onboardingAnswerSchema, onboardingQuestionSchema, onboardingTemplateSectionSchema, onboardingInstallScreenSchema, onboardingResultScreenSchema, onboardingConnectScreenSchema, onboardingTemplateContentSchema, onboardingUnavailableOutcomeSchema, onboardingFlowSchema, onboardingActorSchema, onboardingEditorSchema, onboardingPublicationSummarySchema, onboardingValidationIssueSchema, onboardingValidationResponseSchema, onboardingAssetSchema, onboardingPublicAssetSchema, getOnboardingConfigResponseSchema, saveOnboardingDraftRequestSchema, validateOnboardingRequestSchema, publishOnboardingRequestSchema, rollbackOnboardingRequestSchema, onboardingTemplateCatalogItemSchema, getPublishedOnboardingResponseSchema, WEB_ROUTE_PROTOCOL_VERSION, WEB_ROUTE_METHODS, WEB_ROUTE_REQUEST_HEADER_ALLOWLIST, WEB_ROUTE_RESPONSE_HEADER_ALLOWLIST, WEB_ROUTE_MAX_WALL_MS, WEB_ROUTE_MAX_REQUEST_BODY_BYTES, WEB_ROUTE_MAX_RESPONSE_BYTES, WEB_APP_NAME_PATTERN, WEB_APP_ENTRY_HTML_MAX_CHARS, WEB_APP_MAX_ASSETS, WEB_APP_ASSET_PATH_PATTERN, WEB_APP_ASSET_PATH_MAX_CHARS, WEB_APP_MAX_ROUTES, WEB_APP_MAX_ASSET_BYTES, WEB_APP_CSP_NONCE_PLACEHOLDER, EVIDENCE_SESSION_IDLE_MS, EVIDENCE_MIN_CONVERSATIONS, EVIDENCE_LOW_CONFIDENCE_N, EVIDENCE_SNIPPET_MAX_CHARS, EVIDENCE_EXAMPLES_PER_ITEM, EVIDENCE_SHOWN_ITEMS, EVIDENCE_LATENCY_BOUNDS_MS, EVIDENCE_WORD_BOUNDS, BAD_CONVERSATION_REASONS, ATTACHMENT_LINES, REVIEW_VERDICT_REASON_ORDER, ENV_TEMPLATE_SECRET_KEY_RE, CONNECTION_SEND_NOT_ALLOWED, CONNECTION_RECIPIENT_NOT_ALLOWED, NOT_SEND, PLAIN_ADDRESS, RecipientSet, MCP_MESSAGING_CREATE, MCP_CALENDAR_EVENT_WRITE, REPLY_KEYS, DEDICATED_MAIL_SLUGS, FULL_SUITE_SLUGS, WELL_KNOWN_MAIL_FOLDERS, MEMBER_KEYS, CANONICAL_ORIGIN, CANONICAL_PREFIX, STRICT_BASE64, GMAIL_PREFIX, GMAIL_MESSAGES_SEND, GMAIL_DRAFTS_SEND, GOOGLE_BATCH, GRAPH_VERSION, GRAPH_PRINCIPAL, GRAPH_SEND_MAIL, GRAPH_MESSAGE_ACTION, GRAPH_OWNER, GRAPH_EVENTS, GRAPH_EVENT_COLLECTION, GRAPH_EVENT_ID, GRAPH_EVENT_ITEM, GRAPH_EVENT_ACTION, GRAPH_BATCH, GRAPH_TEAMS_MESSAGE, GRAPH_ACTIVITY_NOTIFICATION, GRAPH_GROUP_CONVERSATION, GCAL_EVENTS, GRAPH_READ_KEYS, MALFORMED_POLICY, BILLING_REJECTION_TEXT_CREDITS, BILLING_REJECTION_TEXT_SEAT, BILLING_REJECTION_TEXT_USER_QUOTA;
6933
+ var __defProp2, __name2, PLUMBING_THREAD_CHANNELS, CHANNEL_CONVERSATION_CHANNELS, HIDDEN_THREAD_CHANNELS, CHOICE_PERSON_TURN_CHANNELS, CHOICE_REPLAY_CLIENT_CAPABILITIES, CHOICE_REPLAY_CLIENT_SURFACES, INTEGRATION_PASSTHROUGH_READ_METHODS, URL_REINTERPRETED_PATH_CHARACTERS, PERCENT_ENCODED_DOT, PERCENT_ESCAPE, DECODED_PATH_SEPARATORS, DECODED_LEADING_SEPARATOR, MAX_PERCENT_DECODE_ROUNDS, URL_RESOLUTION_PROBE_BASE, PLATFORM_INVOCATION_CALLERS, SUPERVISION_OPS, SUPERVISION_OPS_WAVE2, SUPERVISION_WATCHDOG_OPS, SUPERVISION_WATCHDOG_ERRORS, SUPERVISION_ROLLBACK_REFUSAL_CODES, SUPERVISION_ROLLBACK_LINEAGE_MAX, SUPERVISION_UNTARGETED_OPS, SUPERVISED_WORKFLOW_VERSIONS_MAX, SUPERVISION_EVENT_KINDS, AGENT_PROVISIONING_LIMITS, AGENT_PROVISIONING_APPROVAL_PAYLOAD_KEY, AGENT_PROVISIONING_ERRORS, PROVISIONED_SUPERVISION_ACTIONS, isNonEmptyString, uniqueStrings, sameSet, AGENT_PROVISIONING_APPROVAL_CARD_MAX_CHARS, APPROVAL_PAYLOAD_MEMBERS, AGENT_CONNECTION_POLICIES, AGENT_CONNECTION_POLICY_DEFAULT, AGENT_CONNECTION_MOUNT_MODES, AGENT_CONNECTION_GOVERNANCE_ERRORS, AGENT_CONNECTION_OPERATION_RULES_MAX, AGENT_CONNECTION_OPERATION_PATTERN_MAX_LENGTH, OPERATION_RULE_METHODS, PATH_SEPARATOR, PATH_SINGLE_SEGMENT_WILDCARD, PATH_REST_WILDCARD, METHOD_OVERRIDE_HEADER_NAMES, METHOD_OVERRIDE_QUERY_NAMES, ODATA_BATCH_SEGMENT, GOOGLE_BATCH_FIRST_SEGMENT, CONNECTION_CHECK_RESULTS, CONNECTION_CHECK_CATALOGUE_V1, CONNECTION_CHECK_NAME_PATTERN, CONNECTION_CHECK_NAME_MAX, CONNECT_OUTCOME_STATUSES, SECRET_TEST_RESULTS, SECRET_DATADOG_REGIONS, SECRET_PROVIDER_CATALOGUE_V1, SECRET_TEST_MAX_RESPONSE_BYTES, SECRET_ENV_KEY_PATTERN, SECRET_REQUEST_ERRORS, SECRET_OUTCOME_STATUSES, CLIENT_OUTCOME_TURNS_MAX, SHORT_TEXT_MAX, SLUG_MAX, shortText, optionalShortText, CONNECTION_REQUEST_TERMINAL_STATES, CONNECTION_USE_ORIGINS, AGENT_CONNECTION_OPERATION_LIMITS_BOUNDS, CURRENCY_CODE, LIMITS_KEYS, CAPS_KEYS, EXCLUSIONS_KEYS, EMAIL_IN_TEXT, MAX_EXCLUSION_DEPTH, PROJECTION_PARAMETER_KEYS, CHANNEL_PARAMETER_KEYS, GMAIL_SYSTEM_LABEL_IDS, ZERO_DECIMAL_CURRENCIES, THREE_DECIMAL_CURRENCIES, DECIMAL_AMOUNT, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, TEST_SESSION_ID_PATTERN, TEST_SESSION_COLLECTION_PREFIX, TEST_EFFECT_BODY_MAX_BYTES, TEST_EFFECT_DROPPED_HEADERS, EVAL_CREDITS_PER_1K_TOKENS, EVAL_RESERVED_TOOL_ID_PREFIXES, CONNECTION_HANDOVER_APPROVAL_PAYLOAD_KEY, CONNECTION_HANDOVER_APPROVAL_CARD_MAX_CHARS, CONNECTION_HANDOVER_LIMITS, MEMBERS, FORMAT_CHARS, oneLine, boundedString, AGENT_METRIC_NAME_PATTERN, AGENT_METRIC_LIMITS, AGENT_OBJECTIVE_ERRORS, CHANGE_LEASE_TTL_MINUTES_MIN, CHANGE_LEASE_TTL_MINUTES_MAX, CHANGE_LEASE_REASON_MAX, CHANGE_LEASE_ERRORS, AGENT_CONFIG_SET_LIMITS, SECRET_ENV_KEY_SUFFIXES, DEFAULT_OWNER_DEPARTURE_POLICY, AGENT_LIFECYCLE_ERRORS, USER_COST_COUNTER_TTL_SECONDS, USER_COST_ATTRIBUTION_CHANNELS, CALLER_DEDUPE_KEY_MAX, FOLLOW_UP_IDEMPOTENCY_TTL_SECONDS, THREAD_FOLLOW_UP_LIMITS, THREAD_FOLLOW_UP_ERRORS, PROGRESS_UPDATE_LIMITS, PAUSABLE_CAPABILITY_KINDS, UNIFIED_CATCH_UP_MAX_WINDOW_HOURS, UNIFIED_CATCH_UP_EVENTS, UNIFIED_CATCH_UP_FILTERABLE_OBJECT_TYPES, AGENT_NEVER_RULES_MAX, AGENT_NEVER_RULE_FIELD_MAX, AGENT_NEVER_RULE_INPUT_MATCH_MAX, NEVER_RULE_ID_PATTERN, NEVER_RULE_HTTP_METHODS, TEMPLATE_DISTRIBUTION_MODES, TAKEOVER_MAX_IDLE_MINUTES, MINUTES_PER_DAY, DEFAULT_IDLE_RELEASE_MINUTES, FALLBACK_IDLE_RELEASE_MINUTES, VARIATION_SELECTORS, SLACK_EMOJI_NAMES, SLACK_SHORTCODE, PLAIN_EMAIL_ADDRESS, DOMAIN, UNSAFE_TEXT, SLACK_CONVERSATION_ID, CHANNEL_SETTING_GROUPS, THREAD_SCOPING_NOUN, TAKEOVER_CHANNEL_TYPES, EMAIL_SETTINGS, SLACK_SETTING_DEFAULTS, SLACK_REACTION_MAX, SLACK_INTRO_MAX, SLACK_EXAMPLE_PROMPTS_MAX, SLACK_EXAMPLE_PROMPT_MAX, SLACK_SUPPORT_CONTACT_MAX, SLACK_SETTINGS, CHANNEL_SETTINGS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, LOG_FIELDS_MAX_KEYS, LOG_FIELD_MAX_VALUE_BYTES, LOG_FIELDS_MAX_BYTES, LOG_FIELD_KEY_PATTERN, LOG_FIELD_SECRET_SHAPED_KEY_PATTERNS, LOG_FIELDS_CLAMPED_KEY, LOG_FIELD_ARRAY_COUNT_SUFFIX, LuaLogFieldsError, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_AGENT_EFFORTS, WORKFLOW_MODEL_CLASSES, WORKFLOW_TASK_CLASSES, WORKFLOW_MODEL_TRAITS, WORKFLOW_MODEL_REASON_MAX_LENGTH, WORKFLOW_MODELS_COMPOSE_MODES, WORKFLOW_MODELS_PIN_MODES, WORKFLOW_MODELS_FALLBACK_MODES, WORKFLOW_MODELS_CONSENT_ACTIONS_MIN, WORKFLOW_DEFAULT_TASK_CLASS_MAP, WORKFLOW_MODELS_MAX_CLASS_DEFAULT, WORKFLOW_AUTONOMY_FORMS, WORKFLOW_AUTONOMY_NUMERIC_KEYS, WORKFLOW_AUTONOMY_ENVELOPE_KEYS, WORKFLOW_AUTONOMY_ENABLED_DEFAULT, 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_ENVIRONMENTS, AGENT_LOG_FIELDS_MAX_WIRE_KEYS, LOG_DRAIN_TYPES_PHASE1, LOG_DRAIN_TYPES_PHASE2, LOG_DRAIN_TYPES_IMPLEMENTED, LOG_DRAIN_FORMATS, LOG_DRAIN_SEVERITIES, LOG_DRAIN_SOURCES, LOG_DRAIN_CONTENT_SOURCES, LOG_DRAIN_DEFAULT_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, EventType, 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, TYPED_API_KEY, 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_JOURNAL_PROTOCOL_VERSION, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_AGENT_APP_CONNECTION_PREFIX, WORKFLOW_JOB_MODEL_SOURCE_LABELS, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_SIGNAL_NAME_RE, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, SCHEDULE_HEALTH_NOTIFY_CHANNELS, SCHEDULE_HEALTH_DEFAULT_NOTIFY, SCHEDULE_HEALTH_LIMITS, KNOWN_KEYS, WORKFLOW_GOAL_JUDGE_SELF, APPROVAL_ARGS_MAX_CHARS, APPROVAL_ARG_STRING_MAX_CHARS, APPROVAL_ARGS_SUMMARY_MAX_CHARS, MAX_DEPTH, MAX_KEYS, MAX_ITEMS, MAX_NODES, MAX_KEY_CHARS, KEY_SCRUB_INPUT_MAX_CHARS, STRING_SCRUB_INPUT_MAX_CHARS, ELLIPSIS, SKIP, SCRUB_SECRETS_BEFORE_PERSIST_ENV, PERSIST_SCRUB_MAX_CHARS, PERSIST_SCRUB_REF_MAX_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES, SUBAGENT_PER_KEY_FLAG_ENV, PER_KEY_FLAG_VALUES, ONBOARDING_FLOW_KEY, ONBOARDING_SCHEMA_VERSION, id, copy, onboardingHeadingSchema, onboardingRichTextInlineSchema, onboardingRichTextSchema, onboardingDestinationSchema, onboardingArtworkSchema, onboardingAnswerSchema, onboardingQuestionSchema, onboardingTemplateSectionSchema, onboardingInstallScreenSchema, onboardingResultScreenSchema, onboardingConnectScreenSchema, onboardingTemplateContentSchema, onboardingUnavailableOutcomeSchema, onboardingFlowSchema, onboardingActorSchema, onboardingEditorSchema, onboardingPublicationSummarySchema, onboardingValidationIssueSchema, onboardingValidationResponseSchema, onboardingAssetSchema, onboardingPublicAssetSchema, getOnboardingConfigResponseSchema, saveOnboardingDraftRequestSchema, validateOnboardingRequestSchema, publishOnboardingRequestSchema, rollbackOnboardingRequestSchema, onboardingTemplateCatalogItemSchema, getPublishedOnboardingResponseSchema, WEB_ROUTE_PROTOCOL_VERSION, WEB_ROUTE_METHODS, WEB_ROUTE_REQUEST_HEADER_ALLOWLIST, WEB_ROUTE_RESPONSE_HEADER_ALLOWLIST, WEB_ROUTE_MAX_WALL_MS, WEB_ROUTE_MAX_REQUEST_BODY_BYTES, WEB_ROUTE_MAX_RESPONSE_BYTES, WEB_APP_NAME_PATTERN, WEB_APP_ENTRY_HTML_MAX_CHARS, WEB_APP_MAX_ASSETS, WEB_APP_ASSET_PATH_PATTERN, WEB_APP_ASSET_PATH_MAX_CHARS, WEB_APP_MAX_ROUTES, WEB_APP_MAX_ASSET_BYTES, WEB_APP_CSP_NONCE_PLACEHOLDER, EVIDENCE_SESSION_IDLE_MS, EVIDENCE_MIN_CONVERSATIONS, EVIDENCE_LOW_CONFIDENCE_N, EVIDENCE_SNIPPET_MAX_CHARS, EVIDENCE_EXAMPLES_PER_ITEM, EVIDENCE_SHOWN_ITEMS, EVIDENCE_LATENCY_BOUNDS_MS, EVIDENCE_WORD_BOUNDS, BAD_CONVERSATION_REASONS, ATTACHMENT_LINES, REVIEW_VERDICT_REASON_ORDER, ENV_TEMPLATE_SECRET_KEY_RE, CONNECTION_SEND_NOT_ALLOWED, CONNECTION_RECIPIENT_NOT_ALLOWED, NOT_SEND, PLAIN_ADDRESS, RecipientSet, MCP_MESSAGING_CREATE, MCP_CALENDAR_EVENT_WRITE, REPLY_KEYS, DEDICATED_MAIL_SLUGS, FULL_SUITE_SLUGS, WELL_KNOWN_MAIL_FOLDERS, MEMBER_KEYS, CANONICAL_ORIGIN, CANONICAL_PREFIX, STRICT_BASE64, GMAIL_PREFIX, GMAIL_MESSAGES_SEND, GMAIL_DRAFTS_SEND, GOOGLE_BATCH, GRAPH_VERSION, GRAPH_PRINCIPAL, GRAPH_SEND_MAIL, GRAPH_MESSAGE_ACTION, GRAPH_OWNER, GRAPH_EVENTS, GRAPH_EVENT_COLLECTION, GRAPH_EVENT_ID, GRAPH_EVENT_ITEM, GRAPH_EVENT_ACTION, GRAPH_BATCH, GRAPH_TEAMS_MESSAGE, GRAPH_ACTIVITY_NOTIFICATION, GRAPH_GROUP_CONVERSATION, GCAL_EVENTS, GRAPH_READ_KEYS, MALFORMED_POLICY, BILLING_REJECTION_TEXT_CREDITS, BILLING_REJECTION_TEXT_SEAT, BILLING_REJECTION_TEXT_USER_QUOTA;
6818
6934
  var init_dist = __esm({
6819
6935
  "../shared-types/dist/index.mjs"() {
6820
6936
  "use strict";
@@ -7030,7 +7146,20 @@ var init_dist = __esm({
7030
7146
  * agentId }`) to its env. `act`, on a turn whose platform-picked user is the target's owner, never overwriting a
7031
7147
  * key (`LUA_SECRET_ATTACH_EXISTING_ENABLED`).
7032
7148
  */
7033
- "secrets.attach": "act"
7149
+ "secrets.attach": "act",
7150
+ /**
7151
+ * SV (LUA-1080) — `Agents.deployed(id)`: what the target serves RIGHT NOW, read from each primitive's live pointer
7152
+ * (skills with their tools, the published persona, pre/postprocessors), with version ids comparable to an agent
7153
+ * version snapshot. Works whether or not the target has a promoted agent version. Metadata and hashes only.
7154
+ */
7155
+ "primitives.deployed": "observe",
7156
+ // [WD]
7157
+ /**
7158
+ * WD (watchdog grant) — `Agents.versions(id).rollback(version, { expectActive })`: restore a version of the target
7159
+ * that was ACTIVE before, is OLDER than the active one and was active within the last 7 days. CAS on the active
7160
+ * version; only from a workflow step the watchdog grant names. Held only by a watchdog grant.
7161
+ */
7162
+ "versions.rollback": "rollback"
7034
7163
  };
7035
7164
  __name(isSupervisionOp, "isSupervisionOp");
7036
7165
  __name2(isSupervisionOp, "isSupervisionOp");
@@ -7208,8 +7337,65 @@ var init_dist = __esm({
7208
7337
  gate: "act",
7209
7338
  targeted: true,
7210
7339
  item: "SV"
7340
+ },
7341
+ /** SV (LUA-1080) — `Agents.deployed(id)`: the target's deployed primitives (live pointers, no agent version needed). */
7342
+ "primitives.deployed": {
7343
+ gate: "observe",
7344
+ targeted: true,
7345
+ item: "SV"
7346
+ },
7347
+ /** WD — `Agents.versions(id).rollback(version, { expectActive })` (watchdog grant only). */
7348
+ "versions.rollback": {
7349
+ gate: "rollback",
7350
+ targeted: true,
7351
+ item: "WD"
7211
7352
  }
7212
7353
  };
7354
+ SUPERVISION_WATCHDOG_OPS = {
7355
+ logs: "observe",
7356
+ "runs.list": "observe",
7357
+ "runs.get": "observe",
7358
+ "data.get": "observe",
7359
+ "data.query": "observe",
7360
+ "versions.list": "observe",
7361
+ "versions.get": "observe",
7362
+ "versions.diff": "observe",
7363
+ "versions.rollback": "rollback"
7364
+ };
7365
+ __name(isSupervisionWatchdogOp, "isSupervisionWatchdogOp");
7366
+ __name2(isSupervisionWatchdogOp, "isSupervisionWatchdogOp");
7367
+ SUPERVISION_WATCHDOG_ERRORS = {
7368
+ /** A watchdog holder called an op outside {@link SUPERVISION_WATCHDOG_OPS}. */
7369
+ OP_REFUSED: "supervision_watchdog_op_refused",
7370
+ /** See {@link SupervisionRollbackRefusalReason}. */
7371
+ ROLLBACK_NEVER_ACTIVE: "supervision_rollback_never_active",
7372
+ ROLLBACK_NOT_OLDER: "supervision_rollback_not_older",
7373
+ ROLLBACK_NOT_IN_LINEAGE: "supervision_rollback_not_in_lineage",
7374
+ ROLLBACK_AFTER_ROLLBACK: "supervision_rollback_after_rollback",
7375
+ ROLLBACK_AFTER_BACKWARD_PROMOTE: "supervision_rollback_after_backward_promote",
7376
+ ROLLBACK_TOO_OLD: "supervision_rollback_too_old",
7377
+ /** `expectActive` is not the active version (CAS). */
7378
+ ROLLBACK_CONFLICT: "supervision_rollback_conflict",
7379
+ /** The promote failed part-way and its compensation restored the previous active version. */
7380
+ ROLLBACK_INCOMPLETE: "supervision_rollback_incomplete",
7381
+ /** The promote failed part-way AND its compensation failed: the Agents DB may have moved (manual triage). */
7382
+ ROLLBACK_INCOMPLETE_UNCOMPENSATED: "supervision_rollback_incomplete_uncompensated"
7383
+ };
7384
+ SUPERVISION_ROLLBACK_REFUSAL_CODES = {
7385
+ never_active: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_NEVER_ACTIVE,
7386
+ not_older: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_NOT_OLDER,
7387
+ not_in_lineage: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_NOT_IN_LINEAGE,
7388
+ after_rollback: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_AFTER_ROLLBACK,
7389
+ after_backward_promote: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_AFTER_BACKWARD_PROMOTE,
7390
+ too_old: SUPERVISION_WATCHDOG_ERRORS.ROLLBACK_TOO_OLD
7391
+ };
7392
+ __name(isSupervisionRollbackRefusalReason, "isSupervisionRollbackRefusalReason");
7393
+ __name2(isSupervisionRollbackRefusalReason, "isSupervisionRollbackRefusalReason");
7394
+ SUPERVISION_ROLLBACK_LINEAGE_MAX = 25;
7395
+ __name(supervisionRollbackTargetRefusal, "supervisionRollbackTargetRefusal");
7396
+ __name2(supervisionRollbackTargetRefusal, "supervisionRollbackTargetRefusal");
7397
+ __name(supervisionRollbackRefusal, "supervisionRollbackRefusal");
7398
+ __name2(supervisionRollbackRefusal, "supervisionRollbackRefusal");
7213
7399
  SUPERVISION_UNTARGETED_OPS = [
7214
7400
  "agents.list",
7215
7401
  ...Object.entries(SUPERVISION_OPS_WAVE2).filter(([, contract]) => !contract.targeted).map(([op]) => op)
@@ -7645,7 +7831,9 @@ var init_dist = __esm({
7645
7831
  /** `secrets.attach` would set an env key the agent already has: never overwritten (remove or rotate it first). */
7646
7832
  KEY_EXISTS: "secret_key_exists",
7647
7833
  /** A request held for an existing agent submitted on the public token page: its owner submits it signed in. */
7648
- OWNER_SUBMIT_REQUIRED: "secret_submit_requires_owner"
7834
+ OWNER_SUBMIT_REQUIRED: "secret_submit_requires_owner",
7835
+ /** LUA-1079 — `requestSecret` with `pendingFor` on a client that did not declare the pending card capability. */
7836
+ PENDING_CARD_UNSUPPORTED: "secret_pending_card_unsupported"
7649
7837
  };
7650
7838
  SECRET_OUTCOME_STATUSES = [
7651
7839
  ...SECRET_TEST_RESULTS,
@@ -8360,6 +8548,13 @@ var init_dist = __esm({
8360
8548
  welcome: "Welcome and Home page",
8361
8549
  takeover: "Human takeover"
8362
8550
  };
8551
+ THREAD_SCOPING_NOUN = {
8552
+ front: "Front conversation",
8553
+ messagebird: "MessageBird conversation",
8554
+ imessage: "iMessage chat"
8555
+ };
8556
+ __name(threadScopingSetting, "threadScopingSetting");
8557
+ __name2(threadScopingSetting, "threadScopingSetting");
8363
8558
  TAKEOVER_CHANNEL_TYPES = [
8364
8559
  "whatsapp",
8365
8560
  "instagram",
@@ -8633,7 +8828,10 @@ var init_dist = __esm({
8633
8828
  CHANNEL_SETTINGS = {
8634
8829
  ...Object.fromEntries(TAKEOVER_CHANNEL_TYPES.map((type) => [
8635
8830
  type,
8636
- type === "email" ? EMAIL_SETTINGS : takeoverSettings(type)
8831
+ type === "email" ? EMAIL_SETTINGS : type === "front" || type === "messagebird" || type === "imessage" ? [
8832
+ ...takeoverSettings(type),
8833
+ threadScopingSetting(type)
8834
+ ] : takeoverSettings(type)
8637
8835
  ])),
8638
8836
  slack: SLACK_SETTINGS
8639
8837
  };
@@ -10495,6 +10693,9 @@ This text is who you are for this person. As you learn them, their name, their w
10495
10693
  __name2(workflowOrgSlotKey, "workflowOrgSlotKey");
10496
10694
  WORKFLOW_JOURNAL_PROTOCOL_VERSION = 1;
10497
10695
  WORKFLOW_CONNECTION_KEY_RE = /^[a-z][a-z0-9_-]{0,63}$/;
10696
+ WORKFLOW_AGENT_APP_CONNECTION_PREFIX = "agentapp_";
10697
+ __name(isWorkflowAgentAppConnectionId, "isWorkflowAgentAppConnectionId");
10698
+ __name2(isWorkflowAgentAppConnectionId, "isWorkflowAgentAppConnectionId");
10498
10699
  WORKFLOW_JOB_MODEL_SOURCE_LABELS = {
10499
10700
  stamp: "lease stamp",
10500
10701
  initData: "run input",
@@ -10520,6 +10721,7 @@ This text is who you are for this person. As you learn them, their name, their w
10520
10721
  ...WORKFLOW_RUN_GATE_KINDS
10521
10722
  ];
10522
10723
  WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES = 64 * 1024;
10724
+ WORKFLOW_SIGNAL_NAME_RE = /^[a-zA-Z0-9_.-]{1,64}$/;
10523
10725
  WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS = 168;
10524
10726
  WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES = 256 * 1024;
10525
10727
  SCHEDULE_HEALTH_NOTIFY_CHANNELS = [
@@ -12739,6 +12941,19 @@ function validateApprovalReminder(node, path31) {
12739
12941
  }
12740
12942
  return [];
12741
12943
  }
12944
+ function validateHitlTimeoutHours(node, path31) {
12945
+ const h = node.timeoutHours;
12946
+ if (typeof h !== "number") return [];
12947
+ if (Number.isFinite(h) && h >= APPROVAL_TIMEOUT_HOURS_MIN && h <= APPROVAL_TIMEOUT_HOURS_MAX) return [];
12948
+ return [
12949
+ {
12950
+ code: "timeout-hours-out-of-range",
12951
+ path: `${path31}.timeoutHours`,
12952
+ severity: "error",
12953
+ message: `timeoutHours must be a number of hours in [${APPROVAL_TIMEOUT_HOURS_MIN}, ${APPROVAL_TIMEOUT_HOURS_MAX}] (got ${h})`
12954
+ }
12955
+ ];
12956
+ }
12742
12957
  function firstAskDeadline(node) {
12743
12958
  const head = Array.isArray(node.onTimeout) ? node.onTimeout[0] : node.onTimeout;
12744
12959
  if (typeof head === "object" && head !== null && "escalateTo" in head) {
@@ -12810,6 +13025,9 @@ function retryBackoffs() {
12810
13025
  function sleepUntilUnsupportedMessage(id2) {
12811
13026
  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} }`;
12812
13027
  }
13028
+ function signalNameInvalidMessage(id2, name) {
13029
+ return `waitForSignal "${id2}" signal "${name}" must match /${WORKFLOW_SIGNAL_NAME_RE.source}/ (the names a delivery accepts)`;
13030
+ }
12813
13031
  function armSubrunUnsupportedMessage(id2, workflowId) {
12814
13032
  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)`;
12815
13033
  }
@@ -13402,10 +13620,13 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
13402
13620
  const w = node;
13403
13621
  checkId(w.id, path31);
13404
13622
  if (typeof w.signal !== "string" || w.signal.length === 0) err("invalid-envelope", "waitForSignal.signal is required", `${path31}.signal`, w.id);
13623
+ else if (!WORKFLOW_SIGNAL_NAME_RE.test(w.signal)) err("signal-name-invalid", signalNameInvalidMessage(w.id, w.signal), `${path31}.signal`, w.id);
13624
+ for (const r of validateHitlTimeoutHours(w, path31)) err(r.code, r.message, r.path, w.id);
13405
13625
  return;
13406
13626
  }
13407
13627
  const a = node;
13408
13628
  checkId(a.id, path31);
13629
+ for (const r of validateHitlTimeoutHours(a, path31)) err(r.code, r.message, r.path, a.id);
13409
13630
  if ((a.approver ?? "creator") === "creator" && a.excludeInitiator === true) {
13410
13631
  err("approver-excludes-only-candidate", "approver:'creator' with excludeInitiator:true always excludes the only candidate", path31, a.id);
13411
13632
  }
@@ -15873,7 +16094,7 @@ function collectJobTierSteps(entry, out) {
15873
16094
  return;
15874
16095
  }
15875
16096
  }
15876
- var __defProp4, __name4, WorkflowTemplateError, TEMPLATE_PLACEHOLDER, TEMPLATE_NAMESPACES, MAP_DESCRIPTOR_KEYS, MAP_MEMBER_MALFORMED_CODE, fromInit, fromStep, value, template, fromRequest, rows, fromKnowledge, SideEffectsSchema, JobResourcesSchema, WORKFLOW_MODEL_TEMPLATE_ROOT, WORKFLOW_MODEL_TEMPLATE_RE, PATH_SEGMENT_RE, APPROVER_SPEC_MAX_USERS, ESCALATION_MAX_HOPS, TemplateBindingSchema, ApproverSpecSchema, FourEyesSchema, EscalationHopSchema, TerminalOutcomeSchema, ApprovalOnTimeoutSchema, APPROVER_SPEC_SHAPES, APPROVER_WRITTEN_MAX, USER_ID_SHAPED_RE, BINDING_ROOTS, APPROVAL_REMIND_AFTER_HOURS_MIN, APPROVAL_REMIND_AFTER_HOURS_MAX, WORKSPACE_TEMPLATE_EXPR_RE, SLEEP_UNTIL_REPLACEMENT, WORKFLOW_WORKSPACE_TTL_MAX_HOURS_DEFAULT, WORKFLOW_CAPS_DEFAULT, WORKFLOW_STEP_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_AGENT_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_FOREACH_DEFAULT_CONCURRENCY, WORKFLOW_FOREACH_DEFAULT_MAX_ITEMS, WORKFLOW_LOOP_DEFAULT_MAX_ITERATIONS, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS2, WORKFLOW_SIGNAL_DEFAULT_SOURCES, clone, CONNECTION_ID_HEX_RE, WORKFLOW_JOB_MAX_WORKTREE_ARMS, workspaceOf, mountsWorkspace, isJobTier, jobToolsOf, schemaIsArray, isHitlNode, isSingleStep, singleId, armId, TEMPLATE_STEP_REF, EDITABLE_PATH_RE, PREDICATE_OPS, isPredicateScalar, GRAPH_HASH_PREFIX, WorkflowPlanError, isArmStep, armStepId, armStepKind, joinIdOf, containerIdOf, PATH_PLACEHOLDER, MISSING, stepIdOf, cmp, eq, ne, gt, gte, lt, lte, inSet, notIn, exists, notExists, truthy, falsy, and, or, not, CONTINUED_FAILURE_TAG, CONTINUED_FAILURE_DEFAULT_CODE, CONTINUED_FAILURE_OUTPUT_SCHEMA, CONTINUED_FAILURE_LEAF_PATHS, isHitlNode2, nodeIdOf, GOAL_JUDGE_STEP_ID, NON_LEAF_KINDS, CONDITIONAL_JOIN_ID, branchArmId, canonical, sortKeys, JOIN, entryOfJoin, FORCE_CANCEL_STALE_MS, TERMINAL, WORKFLOW_INLINE_RUN_TAG, RUN_ERROR_ISSUES_MAX, IN_FLIGHT, n, SUSPENDED_FOR_DIMENSIONS, STEP_ERROR_DETAIL_KEYS, STEP_ERROR_DETAIL_MAX_BYTES, DETAIL_MAX_DEPTH, DETAIL_MAX_ITEMS, MAX_HOLIDAYS, MAX_WALK_DAYS, HHMM, YMD, MS_PER_MIN, MS_PER_DAY, MON_FRI, supportedTz, fmtCache, WEEKDAYS, JSON_PATCH_OPS, JSON_PATCH_MAX_OPS, JSON_PATCH_MAX_VALUE_BYTES, JSON_PATCH_MAX_TOTAL_BYTES, SEGMENT_RE, WORKFLOW_SCHEDULE_TYPES, WORKFLOW_SCHEDULE_SHAPE_ISSUE, WORKFLOW_SCHEDULE_SHAPES_HINT, WORKFLOW_SCHEDULE_RUN_AS, isObject, WORKFLOW_ENV_OVERLAY_MAX_KEYS, WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES, WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE, isEnvRef, looksLikeEmbeddedJson, ZERO, isRecord2;
16097
+ var __defProp4, __name4, WorkflowTemplateError, TEMPLATE_PLACEHOLDER, TEMPLATE_NAMESPACES, MAP_DESCRIPTOR_KEYS, MAP_MEMBER_MALFORMED_CODE, fromInit, fromStep, value, template, fromRequest, rows, fromKnowledge, SideEffectsSchema, JobResourcesSchema, WORKFLOW_MODEL_TEMPLATE_ROOT, WORKFLOW_MODEL_TEMPLATE_RE, PATH_SEGMENT_RE, APPROVER_SPEC_MAX_USERS, ESCALATION_MAX_HOPS, TemplateBindingSchema, ApproverSpecSchema, FourEyesSchema, EscalationHopSchema, TerminalOutcomeSchema, ApprovalOnTimeoutSchema, APPROVER_SPEC_SHAPES, APPROVER_WRITTEN_MAX, USER_ID_SHAPED_RE, BINDING_ROOTS, APPROVAL_REMIND_AFTER_HOURS_MIN, APPROVAL_REMIND_AFTER_HOURS_MAX, APPROVAL_TIMEOUT_HOURS_MIN, APPROVAL_TIMEOUT_HOURS_MAX, WORKSPACE_TEMPLATE_EXPR_RE, SLEEP_UNTIL_REPLACEMENT, WORKFLOW_WORKSPACE_TTL_MAX_HOURS_DEFAULT, WORKFLOW_CAPS_DEFAULT, WORKFLOW_STEP_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_AGENT_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS, WORKFLOW_FOREACH_DEFAULT_CONCURRENCY, WORKFLOW_FOREACH_DEFAULT_MAX_ITEMS, WORKFLOW_LOOP_DEFAULT_MAX_ITERATIONS, WORKFLOW_SUSPEND_DEFAULT_TIMEOUT_HOURS2, WORKFLOW_SIGNAL_DEFAULT_SOURCES, clone, CONNECTION_ID_HEX_RE, WORKFLOW_JOB_MAX_WORKTREE_ARMS, workspaceOf, mountsWorkspace, isJobTier, jobToolsOf, schemaIsArray, isHitlNode, isSingleStep, singleId, armId, TEMPLATE_STEP_REF, EDITABLE_PATH_RE, PREDICATE_OPS, isPredicateScalar, GRAPH_HASH_PREFIX, WorkflowPlanError, isArmStep, armStepId, armStepKind, joinIdOf, containerIdOf, PATH_PLACEHOLDER, MISSING, stepIdOf, cmp, eq, ne, gt, gte, lt, lte, inSet, notIn, exists, notExists, truthy, falsy, and, or, not, CONTINUED_FAILURE_TAG, CONTINUED_FAILURE_DEFAULT_CODE, CONTINUED_FAILURE_OUTPUT_SCHEMA, CONTINUED_FAILURE_LEAF_PATHS, isHitlNode2, nodeIdOf, GOAL_JUDGE_STEP_ID, NON_LEAF_KINDS, CONDITIONAL_JOIN_ID, branchArmId, canonical, sortKeys, JOIN, entryOfJoin, FORCE_CANCEL_STALE_MS, TERMINAL, WORKFLOW_INLINE_RUN_TAG, RUN_ERROR_ISSUES_MAX, IN_FLIGHT, n, SUSPENDED_FOR_DIMENSIONS, STEP_ERROR_DETAIL_KEYS, STEP_ERROR_DETAIL_MAX_BYTES, DETAIL_MAX_DEPTH, DETAIL_MAX_ITEMS, MAX_HOLIDAYS, MAX_WALK_DAYS, HHMM, YMD, MS_PER_MIN, MS_PER_DAY, MON_FRI, supportedTz, fmtCache, WEEKDAYS, JSON_PATCH_OPS, JSON_PATCH_MAX_OPS, JSON_PATCH_MAX_VALUE_BYTES, JSON_PATCH_MAX_TOTAL_BYTES, SEGMENT_RE, WORKFLOW_SCHEDULE_TYPES, WORKFLOW_SCHEDULE_SHAPE_ISSUE, WORKFLOW_SCHEDULE_SHAPES_HINT, WORKFLOW_SCHEDULE_RUN_AS, isObject, WORKFLOW_ENV_OVERLAY_MAX_KEYS, WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES, WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE, isEnvRef, looksLikeEmbeddedJson, ZERO, isRecord2;
15877
16098
  var init_dist2 = __esm({
15878
16099
  "../workflow-graph/dist/index.mjs"() {
15879
16100
  "use strict";
@@ -16082,8 +16303,12 @@ var init_dist2 = __esm({
16082
16303
  __name4(validateApproverBlock, "validateApproverBlock");
16083
16304
  APPROVAL_REMIND_AFTER_HOURS_MIN = 1;
16084
16305
  APPROVAL_REMIND_AFTER_HOURS_MAX = 720;
16306
+ APPROVAL_TIMEOUT_HOURS_MIN = 1;
16307
+ APPROVAL_TIMEOUT_HOURS_MAX = 720;
16085
16308
  __name(validateApprovalReminder, "validateApprovalReminder");
16086
16309
  __name4(validateApprovalReminder, "validateApprovalReminder");
16310
+ __name(validateHitlTimeoutHours, "validateHitlTimeoutHours");
16311
+ __name4(validateHitlTimeoutHours, "validateHitlTimeoutHours");
16087
16312
  __name(firstAskDeadline, "firstAskDeadline");
16088
16313
  __name4(firstAskDeadline, "firstAskDeadline");
16089
16314
  __name(liftRenderedApprover, "liftRenderedApprover");
@@ -16101,6 +16326,8 @@ var init_dist2 = __esm({
16101
16326
  });
16102
16327
  __name(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
16103
16328
  __name4(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
16329
+ __name(signalNameInvalidMessage, "signalNameInvalidMessage");
16330
+ __name4(signalNameInvalidMessage, "signalNameInvalidMessage");
16104
16331
  __name(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
16105
16332
  __name4(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
16106
16333
  WORKFLOW_WORKSPACE_TTL_MAX_HOURS_DEFAULT = 168;
@@ -17513,6 +17740,9 @@ var init_workflow = __esm({
17513
17740
  for (const r of validateApprovalReminder(opts, `approval("${id2}")`)) {
17514
17741
  if (r.severity === "error") throw new LuaWorkflowBuildError("remind-after-invalid", `"${id2}": ${r.message}`);
17515
17742
  }
17743
+ for (const r of validateHitlTimeoutHours(opts, `approval("${id2}")`)) {
17744
+ throw new LuaWorkflowBuildError("timeout-hours-out-of-range", `"${id2}": ${r.message}`);
17745
+ }
17516
17746
  if (typeof opts.details === "function") throw new LuaWorkflowBuildError("closure-binding", `approval("${id2}").details must be template(...)`);
17517
17747
  this.recordEnvRefs(opts.details, opts.timeoutHours, opts.approver);
17518
17748
  const node = defined({
@@ -17543,6 +17773,10 @@ var init_workflow = __esm({
17543
17773
  waitForSignal(id2, opts) {
17544
17774
  this.assertId(id2, "waitForSignal()");
17545
17775
  if (!opts || typeof opts.signal !== "string" || opts.signal.length === 0) throw new LuaWorkflowBuildError("invalid-envelope", `waitForSignal("${id2}") needs a signal name`);
17776
+ if (!WORKFLOW_SIGNAL_NAME_RE.test(opts.signal)) throw new LuaWorkflowBuildError("signal-name-invalid", signalNameInvalidMessage(id2, opts.signal));
17777
+ for (const r of validateHitlTimeoutHours(opts, `waitForSignal("${id2}")`)) {
17778
+ throw new LuaWorkflowBuildError("timeout-hours-out-of-range", `"${id2}": ${r.message}`);
17779
+ }
17546
17780
  this.recordEnvRefs(opts.timeoutHours);
17547
17781
  const node = defined({
17548
17782
  type: "waitForSignal",
@@ -17605,7 +17839,7 @@ var init_workflow = __esm({
17605
17839
  if (this.mapCount >= 2 && this.unnamedMaps > 0) {
17606
17840
  this.warnings.push({
17607
17841
  code: "map-id-required",
17608
- message: `${this.unnamedMaps} of ${this.mapCount} map() calls have no explicit id \u2014 positional ids renumber on insert; pass { id } (error at push)`
17842
+ message: `${this.unnamedMaps} of ${this.mapCount} map() calls have no explicit id \u2014 positional ids renumber on insert; pass { id } to every map() to keep step ids stable`
17609
17843
  });
17610
17844
  }
17611
17845
  if (graphHasHitl(graph, this.steps) && this.config.budget?.maxDurationSeconds === void 0) {
@@ -21014,6 +21248,10 @@ var init_cli_credentials_api_service = __esm({
21014
21248
  async createCliCredential(firebaseIdToken, request2) {
21015
21249
  return this.httpPostOnce("/admin/users/me/credentials/cli", request2, bearerHeaders(firebaseIdToken));
21016
21250
  }
21251
+ /** Issue a credential bound to one agent and one device name. Needs a first-party session bearer. */
21252
+ async issueDeviceCredential(firebaseIdToken, request2) {
21253
+ return this.httpPostOnce("/admin/users/me/credentials/device", request2, bearerHeaders(firebaseIdToken));
21254
+ }
21017
21255
  };
21018
21256
  }
21019
21257
  });
@@ -29087,15 +29325,15 @@ function parseWorkflowScript(script, fileName) {
29087
29325
  if (ts4.isNewExpression(node)) {
29088
29326
  const callee = node.expression;
29089
29327
  if (ts4.isIdentifier(callee) && callee.text === "Function") nondeterminism(node, "Function", "`new Function` is forbidden");
29090
- if (ts4.isIdentifier(callee) && callee.text === "Date" && (node.arguments?.length ?? 0) === 0) nondeterminism(node, "Date", "`new Date()` with no argument \u2014 use env.now()");
29328
+ if (ts4.isIdentifier(callee) && callee.text === "Date" && (node.arguments?.length ?? 0) === 0) nondeterminism(node, "Date", "`new Date()` with no argument \u2014 use now()");
29091
29329
  }
29092
29330
  if (ts4.isCallExpression(node)) {
29093
29331
  const callee = node.expression;
29094
29332
  if (ts4.isPropertyAccessExpression(callee) && ts4.isIdentifier(callee.expression)) {
29095
29333
  const root = callee.expression.text;
29096
29334
  const member = callee.name.text;
29097
- if (root === "Date" && member === "now") nondeterminism(node, "Date.now", "`Date.now()` \u2014 use env.now()");
29098
- if (root === "Math" && member === "random") nondeterminism(node, "Math.random", "`Math.random()` \u2014 use env.random()");
29335
+ if (root === "Date" && member === "now") nondeterminism(node, "Date.now", "`Date.now()` \u2014 use now()");
29336
+ if (root === "Math" && member === "random") nondeterminism(node, "Math.random", "`Math.random()` \u2014 use random()");
29099
29337
  if (root === "Promise" && member === "race") issues.push(errorAt(sf, file, node, "SCRIPT_NONDETERMINISM", "`Promise.race` \u2014 completion order is journaled but flagged as a coverage risk", "Promise.race", "warning"));
29100
29338
  }
29101
29339
  if (ts4.isIdentifier(callee) && callee.text === "Function") nondeterminism(node, "Function", "`Function()` is forbidden");
@@ -35614,8 +35852,20 @@ var init_agents_api_service = __esm({
35614
35852
  if (!result.data) {
35615
35853
  throw new Error("Agent invocation failed: empty response");
35616
35854
  }
35617
- if (typeof promptOrInput === "string") return result.data.text ?? "";
35618
35855
  const data = result.data;
35856
+ if (data?.type === "error") {
35857
+ if (isPaymentRequiredChatErrorEnvelope(data)) {
35858
+ throw Object.assign(new Error(data.error || "Payment required"), {
35859
+ name: "AgentInvocationError",
35860
+ code: "PAYMENT_REQUIRED",
35861
+ statusCode: 402
35862
+ });
35863
+ }
35864
+ throw Object.assign(new Error(data.error || "Agent invocation failed"), {
35865
+ name: "AgentInvocationError",
35866
+ code: "AGENT_ERROR"
35867
+ });
35868
+ }
35619
35869
  if (data?.type === "preprocessor_blocked") {
35620
35870
  throw Object.assign(new Error(data.text || "Agent invocation blocked by preprocessor"), {
35621
35871
  name: "AgentInvocationError",
@@ -35630,6 +35880,7 @@ var init_agents_api_service = __esm({
35630
35880
  stage: data.governanceBlock?.stage
35631
35881
  });
35632
35882
  }
35883
+ if (typeof promptOrInput === "string") return data.text ?? "";
35633
35884
  return toInvocationOutput(data, input.threadId);
35634
35885
  }
35635
35886
  /**
@@ -35650,7 +35901,8 @@ var init_agents_api_service = __esm({
35650
35901
  code
35651
35902
  });
35652
35903
  }, "refuse");
35653
- if (op === "versions.promote" || op === "persona.activate" || op === "versions.delete" || op === "workflows.create" || op === "workflows.push" || op === "workflows.deploy") {
35904
+ if (op === "versions.promote" || // WD — a watchdog rollback changes what a live agent serves, like a promote.
35905
+ op === "versions.rollback" || op === "persona.activate" || op === "versions.delete" || op === "workflows.create" || op === "workflows.push" || op === "workflows.deploy") {
35654
35906
  refuse("supervision_release_offline_refused", `${op} is refused offline: a local test never changes a live agent`);
35655
35907
  }
35656
35908
  if (op === "versions.preview" || op === "agents.list" || op === "agents.get" || op === "source.get" || // U25 — a subscription is live platform state (it starts a deployed trigger): never from a local test.
@@ -35818,6 +36070,8 @@ var init_agents_api_service = __esm({
35818
36070
  case "evals.cancel":
35819
36071
  case "owner.notify":
35820
36072
  case "connections.assign":
36073
+ // SV (LUA-1080) — the live pointers are not exposed on a developer route: platform only.
36074
+ case "primitives.deployed":
35821
36075
  return refuse("supervision_offline_unsupported", `${op} is not available offline; run it on the platform`);
35822
36076
  default:
35823
36077
  return refuse("supervision_unknown_op", `Unknown supervision operation ${String(op)}`);
@@ -36495,9 +36749,22 @@ function createWorkflowsRuntime(getApi) {
36495
36749
  },
36496
36750
  async list(opts = {}) {
36497
36751
  const api = await getApi();
36498
- const ref = opts.workflow ? await resolveRef(api, opts.workflow) : {};
36752
+ let workflowId;
36753
+ if (opts.workflow) {
36754
+ const v = opts.workflow.trim();
36755
+ const defs = await api.getWorkflows({
36756
+ includeDynamic: true
36757
+ });
36758
+ const hit = defs.success && defs.data ? defs.data.workflows.find((w) => w.name === v) ?? defs.data.workflows.find((w) => w.id === v) : void 0;
36759
+ if (hit) workflowId = hit.id;
36760
+ else if (isWorkflowIdShaped(v)) workflowId = v;
36761
+ else {
36762
+ unwrap(defs, "Workflows.list");
36763
+ return [];
36764
+ }
36765
+ }
36499
36766
  const page = unwrap(await api.getRuns({
36500
- workflowId: ref.workflowId,
36767
+ workflowId,
36501
36768
  status: opts.status,
36502
36769
  limit: opts.limit,
36503
36770
  correlationKey: opts.correlationKey,
@@ -36535,7 +36802,10 @@ function createWorkflowsRuntime(getApi) {
36535
36802
  ...opts
36536
36803
  }), "Workflows.signalByKey");
36537
36804
  },
36538
- raiseBudget: unavailable("raiseBudget", "R45"),
36805
+ async raiseBudget(runId, patch) {
36806
+ const api = await getApi();
36807
+ return unwrap(await api.raiseBudget(runId, patch), "Workflows.raiseBudget");
36808
+ },
36539
36809
  // Goals are scoped to the bound agent: the IF-21 `agentId` argument is parity with the HTTP twin
36540
36810
  // (`/workflows/:agentId/goals`), never a way to reach another agent's goals (403 otherwise).
36541
36811
  async setGoal(agentId, goal) {
@@ -36578,7 +36848,7 @@ function createWorkflowsRuntime(getApi) {
36578
36848
  }
36579
36849
  };
36580
36850
  }
36581
- var WORKFLOW_START_MAX_WAIT_SECONDS, WORKFLOW_START_CLIENT_DEADLINE_SLACK_MS, CONTROL_UNAVAILABLE_HINT, WorkflowApiError, WORKFLOWS_RUNTIME_MEMBERS, unwrap, assertBoundAgent, pathId, unavailable, WorkflowApi;
36851
+ var WORKFLOW_START_MAX_WAIT_SECONDS, WORKFLOW_START_CLIENT_DEADLINE_SLACK_MS, CONTROL_UNAVAILABLE_HINT, WorkflowApiError, WORKFLOWS_RUNTIME_MEMBERS, unwrap, isWorkflowIdShaped, assertBoundAgent, pathId, WorkflowApi;
36582
36852
  var init_workflow_api_service = __esm({
36583
36853
  "src/api/workflow.api.service.ts"() {
36584
36854
  "use strict";
@@ -36624,15 +36894,13 @@ var init_workflow_api_service = __esm({
36624
36894
  }
36625
36895
  return res.data;
36626
36896
  }, "unwrap");
36897
+ isWorkflowIdShaped = /* @__PURE__ */ __name((v) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v) || /^wfc?_[A-Za-z0-9]/.test(v), "isWorkflowIdShaped");
36627
36898
  assertBoundAgent = /* @__PURE__ */ __name((api, agentId, member) => {
36628
36899
  if (agentId && agentId !== api.agentId) {
36629
36900
  throw new WorkflowApiError("FORBIDDEN", `Workflows.${member}: goals are scoped to the bound agent ${api.agentId}`, 403);
36630
36901
  }
36631
36902
  }, "assertBoundAgent");
36632
36903
  pathId = /* @__PURE__ */ __name((id2) => encodeURIComponent(id2), "pathId");
36633
- unavailable = /* @__PURE__ */ __name((member, route) => async () => {
36634
- throw new WorkflowApiError("WORKFLOWS_API_UNAVAILABLE", `Workflows.${member} is not available in this runtime yet (${route} lands with a later wave)`, 501);
36635
- }, "unavailable");
36636
36904
  __name(createWorkflowsRuntime, "createWorkflowsRuntime");
36637
36905
  WorkflowApi = class extends HttpClient {
36638
36906
  static {
@@ -37072,20 +37340,35 @@ var init_device_api_service = __esm({
37072
37340
  return this.httpDelete(`/developer/devices/${this.agentId}/${deviceId}`, {});
37073
37341
  }
37074
37342
  async sendCommand(deviceName, command, payload, timeout) {
37075
- return this.httpPost(`/developer/devices/${this.agentId}/${deviceName}/command`, {
37343
+ return this.httpPost(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/command`, {
37076
37344
  command,
37077
37345
  payload,
37078
37346
  timeout: timeout || 3e4
37079
37347
  }, {});
37080
37348
  }
37081
37349
  async getDeviceStatus(deviceName) {
37082
- return this.httpGet(`/developer/devices/${this.agentId}/${deviceName}/status`, {});
37350
+ return this.httpGet(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/status`, {});
37083
37351
  }
37084
37352
  async enableDevice(deviceName) {
37085
- return this.httpPatch(`/developer/devices/${this.agentId}/${deviceName}/enable`, {}, {});
37353
+ return this.httpPatch(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/enable`, {}, {});
37086
37354
  }
37087
37355
  async disableDevice(deviceName) {
37088
- return this.httpPatch(`/developer/devices/${this.agentId}/${deviceName}/disable`, {}, {});
37356
+ return this.httpPatch(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/disable`, {}, {});
37357
+ }
37358
+ /** Device instances the agent has seen, with live status; self-describing devices only appear here. */
37359
+ async getConnectedDevices() {
37360
+ return this.httpGet(`/developer/devices/${this.agentId}/connected`, {});
37361
+ }
37362
+ /** Fire a trigger as the named device would; the live handler runs. */
37363
+ async fireTrigger(deviceName, triggerName, payload) {
37364
+ return this.httpPost(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/trigger`, {
37365
+ triggerName,
37366
+ payload
37367
+ }, {});
37368
+ }
37369
+ /** Remove a connected device's instance record (not its definition). */
37370
+ async deleteDeviceInstance(deviceName) {
37371
+ return this.httpDelete(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/instance`, {});
37089
37372
  }
37090
37373
  };
37091
37374
  }
@@ -43978,6 +44261,14 @@ function requireExpectActiveId(opts, what) {
43978
44261
  }
43979
44262
  __name(requireExpectActiveId, "requireExpectActiveId");
43980
44263
  __name8(requireExpectActiveId, "requireExpectActiveId");
44264
+ function optionalCommitHash(opts, what) {
44265
+ const commitHash = opts?.commitHash;
44266
+ if (commitHash === void 0) return void 0;
44267
+ if (typeof commitHash === "string" && commitHash.length > 0) return commitHash;
44268
+ throw typedError("supervision_bad_args", `${what} commitHash must be a non-empty string`);
44269
+ }
44270
+ __name(optionalCommitHash, "optionalCommitHash");
44271
+ __name8(optionalCommitHash, "optionalCommitHash");
43981
44272
  function approvalIdsOf(approval) {
43982
44273
  if (approval === void 0 || approval === null) return void 0;
43983
44274
  if (typeof approval !== "object" || Array.isArray(approval)) return {
@@ -44056,6 +44347,20 @@ function buildSupervisionAgentsApi(call2) {
44056
44347
  delete: /* @__PURE__ */ __name8((version) => call2("versions.delete", agentId, {
44057
44348
  version
44058
44349
  }), "delete"),
44350
+ /**
44351
+ * WD — restore a previously-active, OLDER `version` (watchdog grant; last 7 days; only from a workflow step the
44352
+ * grant names). Compare-and-swap: `expectActive` is the active version number now (required, never null).
44353
+ */
44354
+ rollback: /* @__PURE__ */ __name8(async (version, opts) => {
44355
+ const expectActive = requireExpectActive(opts, "versions.rollback");
44356
+ if (expectActive === null) {
44357
+ throw typedError("supervision_expect_active_required", "versions.rollback requires { expectActive } \u2014 the active version number (a rollback needs one)");
44358
+ }
44359
+ return call2("versions.rollback", agentId, {
44360
+ version,
44361
+ expectActive
44362
+ });
44363
+ }, "rollback"),
44059
44364
  // wave 2 U11
44060
44365
  /**
44061
44366
  * U11 (DOC2 §6.1) — open a TEST SESSION on staged `opts.version`: multi-turn `chat`, `fire`, `effects()` and
@@ -44093,11 +44398,18 @@ function buildSupervisionAgentsApi(call2) {
44093
44398
  }
44094
44399
  }), "push"),
44095
44400
  /** Publish workflow `version`. Compare-and-swap: refused unless `expectActive` is the live version id. */
44096
- deploy: /* @__PURE__ */ __name8(async (workflowId, version, opts) => call2("workflows.deploy", agentId, {
44097
- workflowId,
44098
- version,
44099
- expectActive: requireExpectActiveId(opts, "workflows.deploy")
44100
- }), "deploy")
44401
+ deploy: /* @__PURE__ */ __name8(async (workflowId, version, opts) => {
44402
+ const expectActive = requireExpectActiveId(opts, "workflows.deploy");
44403
+ const commitHash = optionalCommitHash(opts, "workflows.deploy");
44404
+ return call2("workflows.deploy", agentId, {
44405
+ workflowId,
44406
+ version,
44407
+ expectActive,
44408
+ ...commitHash !== void 0 ? {
44409
+ commitHash
44410
+ } : {}
44411
+ });
44412
+ }, "deploy")
44101
44413
  }), "workflows"),
44102
44414
  persona: /* @__PURE__ */ __name8((agentId) => ({
44103
44415
  versions: /* @__PURE__ */ __name8(() => call2("persona.versions", agentId), "versions"),
@@ -44118,6 +44430,12 @@ function buildSupervisionAgentsApi(call2) {
44118
44430
  keys: /* @__PURE__ */ __name8(() => call2("env.keys", agentId), "keys")
44119
44431
  }), "env"),
44120
44432
  /**
44433
+ * SV (LUA-1080) — what `agentId` serves RIGHT NOW: its live skills (with tools), the published persona and its
44434
+ * pre/postprocessors, each with the version id an agent version snapshot would pin. Works with no promoted agent
44435
+ * version, so a release can diff live against a staged version. Metadata and hashes only (`observe`).
44436
+ */
44437
+ deployed: /* @__PURE__ */ __name8((agentId) => call2("primitives.deployed", agentId), "deployed"),
44438
+ /**
44121
44439
  * U25 — supervision events of the target (`observe`): each event of a subscribed kind starts
44122
44440
  * one of the CALLER's own triggers (`triggerName`) with a `source: 'supervision'` body.
44123
44441
  */
@@ -44734,20 +45052,20 @@ init_artifact_loader();
44734
45052
 
44735
45053
  // src/api/threads.offline.ts
44736
45054
  init_dist();
44737
- function unavailable2(member) {
45055
+ function unavailable(member) {
44738
45056
  return Object.assign(new Error(`Threads.${member} only runs on the Lua platform (deployed or sandbox agents), not in lua test / lua dev`), {
44739
45057
  name: "ThreadFollowUpError",
44740
45058
  code: THREAD_FOLLOW_UP_ERRORS.UNAVAILABLE
44741
45059
  });
44742
45060
  }
44743
- __name(unavailable2, "unavailable");
45061
+ __name(unavailable, "unavailable");
44744
45062
  function createOfflineThreadsApi() {
44745
45063
  return {
44746
45064
  open: /* @__PURE__ */ __name(async () => {
44747
- throw unavailable2("open");
45065
+ throw unavailable("open");
44748
45066
  }, "open"),
44749
45067
  followUp: /* @__PURE__ */ __name(async () => {
44750
- throw unavailable2("followUp");
45068
+ throw unavailable("followUp");
44751
45069
  }, "followUp")
44752
45070
  };
44753
45071
  }
@@ -45886,13 +46204,13 @@ async function runWorkflowLocallyInner(rawOpts) {
45886
46204
  let artefactSeq = 0;
45887
46205
  const artefactsApi = /* @__PURE__ */ __name((stepId) => {
45888
46206
  const dir = opts.artefactsDir;
45889
- const unavailable3 = /* @__PURE__ */ __name(() => {
46207
+ const unavailable2 = /* @__PURE__ */ __name(() => {
45890
46208
  throw new StepFailure("ARTEFACTS_NOT_AVAILABLE_OFFLINE", "ctx.artefacts needs --artefacts-dir (03 \xA73.9 step 7)");
45891
46209
  }, "unavailable");
45892
46210
  if (!dir) {
45893
46211
  return {
45894
- put: /* @__PURE__ */ __name(async () => unavailable3(), "put"),
45895
- get: /* @__PURE__ */ __name(async () => unavailable3(), "get"),
46212
+ put: /* @__PURE__ */ __name(async () => unavailable2(), "put"),
46213
+ get: /* @__PURE__ */ __name(async () => unavailable2(), "get"),
45896
46214
  list: /* @__PURE__ */ __name(async () => [], "list")
45897
46215
  };
45898
46216
  }
@@ -47100,39 +47418,52 @@ function createSandbox(options) {
47100
47418
  Workflows: createWorkflowsRuntime(async () => workflowService),
47101
47419
  // wave 2 U13b — `Threads` never posts into a real conversation offline: typed `thread_follow_up_unavailable`.
47102
47420
  Threads: createOfflineThreadsApi(),
47103
- // Device API (for sandbox — commands route through lua-api developer endpoint)
47104
- Device: {
47105
- sendCommand: /* @__PURE__ */ __name(async (deviceName, command, payload, timeout) => {
47106
- const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47107
- const deviceApi = await getDeviceInstance2();
47108
- const response = await deviceApi.sendCommand(deviceName, command, payload, timeout || 3e4);
47109
- if (!response.success) throw new Error(response.error?.message || "Device command failed");
47110
- return response.data;
47111
- }, "sendCommand"),
47112
- listDevices: /* @__PURE__ */ __name(async () => {
47113
- const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47114
- const deviceApi = await getDeviceInstance2();
47115
- const response = await deviceApi.getDevices();
47116
- return response.data?.devices || response.data || [];
47117
- }, "listDevices"),
47118
- getStatus: /* @__PURE__ */ __name(async (deviceName) => {
47119
- const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47120
- const deviceApi = await getDeviceInstance2();
47121
- const response = await deviceApi.getDeviceStatus(deviceName);
47122
- return response.data;
47123
- }, "getStatus")
47124
- },
47421
+ // Device API (offline only — commands route through the lua-api developer endpoint). The deployed runtime
47422
+ // has NO `Device` global, so code using it passes `lua test` and fails once deployed: it keeps working here
47423
+ // and warns once, naming the supported routes (an agent step, or `Agents.invoke` from a code step).
47424
+ Device: /* @__PURE__ */ (() => {
47425
+ let warned2 = false;
47426
+ const warnOnce2 = /* @__PURE__ */ __name(() => {
47427
+ if (warned2) return;
47428
+ warned2 = true;
47429
+ console.warn("\u26A0\uFE0F Device.* works only in local tests: the Lua platform has no Device global. Call a device from an agent step (its commands are tools) or from code with Agents.invoke(agentId, prompt).");
47430
+ }, "warnOnce");
47431
+ return {
47432
+ sendCommand: /* @__PURE__ */ __name(async (deviceName, command, payload, timeout) => {
47433
+ warnOnce2();
47434
+ const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47435
+ const deviceApi = await getDeviceInstance2();
47436
+ const response = await deviceApi.sendCommand(deviceName, command, payload, timeout || 3e4);
47437
+ if (!response.success) throw new Error(response.error?.message || "Device command failed");
47438
+ return response.data;
47439
+ }, "sendCommand"),
47440
+ listDevices: /* @__PURE__ */ __name(async () => {
47441
+ warnOnce2();
47442
+ const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47443
+ const deviceApi = await getDeviceInstance2();
47444
+ const response = await deviceApi.getDevices();
47445
+ return response.data?.devices || response.data || [];
47446
+ }, "listDevices"),
47447
+ getStatus: /* @__PURE__ */ __name(async (deviceName) => {
47448
+ warnOnce2();
47449
+ const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47450
+ const deviceApi = await getDeviceInstance2();
47451
+ const response = await deviceApi.getDeviceStatus(deviceName);
47452
+ return response.data;
47453
+ }, "getStatus")
47454
+ };
47455
+ })(),
47125
47456
  // Legacy `env('FOO')` getter — kept for backwards compatibility with skills
47126
47457
  // that use it instead of `process.env.FOO`. Both work.
47127
47458
  // LUA-751: `env.template(KEY)` too — a graph-form workflow file calls it at MODULE scope (`schedule.timezone:
47128
47459
  // env.template('FINANCE_TZ')`, the shipped `vendor-invoices`), `env` is not one of the builder names esbuild
47129
47460
  // injects (`WORKFLOW_SHIM_NAMES`), so the artifact resolves it against THIS global when `lua workflows run`
47130
47461
  // loads it — and threw `env.template is not a function`. The placeholder is the SDK's (`types/skill.ts`) and the
47131
- // compiler's tier-1 stub's (`graph-serializer.ts`); the local `--env` overlay substitutes it on the graph.
47462
+ // compiler's tier-1 stub's (`graph-serializer.ts`) — the shared `envTemplatePlaceholder`, so the secret-key
47463
+ // guard (`env-template-secret-key`) matches the SDK and the deployed runtime; the local `--env` overlay
47464
+ // substitutes it on the graph.
47132
47465
  env: Object.assign((key) => envVars[key], {
47133
- template: /* @__PURE__ */ __name((key) => ({
47134
- __envRef: key
47135
- }), "template")
47466
+ template: envTemplatePlaceholder
47136
47467
  }),
47137
47468
  // K1a (PRO-2142) — the `log` global, so `lua test` runs the same code
47138
47469
  // production runs. There is no `VmLogSink` here, so the line goes to the
@@ -47214,7 +47545,7 @@ function createSandbox(options) {
47214
47545
  return getConnectionRequestsInstance2();
47215
47546
  })
47216
47547
  },
47217
- // Outbound voice dispatch (BAC-212). `lua test` proxies via the same
47548
+ // Voice: outbound dispatch (BAC-212) and web session creation (BAC-552). `lua test` proxies via the same
47218
47549
  // bearer-auth developer endpoint the lua-cli `Voice.call` namespace uses
47219
47550
  // — keeps the surface byte-equivalent to the lua-core production VM
47220
47551
  // (which routes through `/internal/voice-dispatch/:agentId` instead).
@@ -47223,17 +47554,27 @@ function createSandbox(options) {
47223
47554
  const { getVoiceInstance: getVoiceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47224
47555
  const voice = await getVoiceInstance2();
47225
47556
  return voice.dispatchForSandbox(input);
47226
- }, "call")
47557
+ }, "call"),
47558
+ createSession: /* @__PURE__ */ __name(async (input) => {
47559
+ const { getVoiceInstance: getVoiceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47560
+ const voice = await getVoiceInstance2();
47561
+ return voice.createSessionForSandbox(input ?? {});
47562
+ }, "createSession")
47227
47563
  },
47228
47564
  // Lowercase alias matching lua-core's sandbox: `this.voice.call(...)` works
47229
47565
  // at the script top level (where `this === globalThis`), and arrow bodies
47230
- // can use `voice.call(...)` directly.
47566
+ // can use `voice.call(...)` / `voice.createSession(...)` directly.
47231
47567
  voice: {
47232
47568
  call: /* @__PURE__ */ __name(async (input) => {
47233
47569
  const { getVoiceInstance: getVoiceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47234
47570
  const voice = await getVoiceInstance2();
47235
47571
  return voice.dispatchForSandbox(input);
47236
- }, "call")
47572
+ }, "call"),
47573
+ createSession: /* @__PURE__ */ __name(async (input) => {
47574
+ const { getVoiceInstance: getVoiceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47575
+ const voice = await getVoiceInstance2();
47576
+ return voice.createSessionForSandbox(input ?? {});
47577
+ }, "createSession")
47237
47578
  },
47238
47579
  // Outbound channel send (PRO-93). Proxied via the lua-cli developer
47239
47580
  // endpoint (Bearer auth) — keeps lua test byte-equivalent to the lua-core
@@ -49618,7 +49959,8 @@ var ALIAS_MAP = {
49618
49959
  "disable",
49619
49960
  "remove",
49620
49961
  "test",
49621
- "test-trigger"
49962
+ "test-trigger",
49963
+ "credential"
49622
49964
  ],
49623
49965
  aliases: lowerKeys({
49624
49966
  ls: "list",
@@ -49634,7 +49976,9 @@ var ALIAS_MAP = {
49634
49976
  del: "remove",
49635
49977
  run: "test",
49636
49978
  exec: "test",
49637
- test_trigger: "test-trigger"
49979
+ test_trigger: "test-trigger",
49980
+ credentials: "credential",
49981
+ key: "credential"
49638
49982
  })
49639
49983
  },
49640
49984
  "features.action": {
@@ -51106,6 +51450,9 @@ async function loadSeedFromRun(runId, wf, apiKey, agentId) {
51106
51450
  console.error(`\u274C Run ${runId} not found: ${run.error?.message ?? "unknown error"}`);
51107
51451
  return void 0;
51108
51452
  }
51453
+ if (!run.data.graphHash) {
51454
+ console.error("[from-run] source run carries no graphHash \u2014 graph drift cannot be detected; seeding by step id only (steps absent from the current graph are reported as dropped)");
51455
+ }
51109
51456
  const plan = compilePlan(wf.graph);
51110
51457
  const rows3 = [];
51111
51458
  for (const stepId of plan.order) {
@@ -55181,21 +55528,25 @@ init_cli();
55181
55528
  init_constants();
55182
55529
  import { readFileSync as readFileSync12, writeFileSync as writeFileSync9, mkdirSync as mkdirSync7 } from "fs";
55183
55530
  import { dirname as dirname6 } from "path";
55531
+ function isPlainObject3(value3) {
55532
+ return typeof value3 === "object" && value3 !== null && !Array.isArray(value3);
55533
+ }
55534
+ __name(isPlainObject3, "isPlainObject");
55184
55535
  function readStore2() {
55185
55536
  try {
55186
55537
  const raw = readFileSync12(SANDBOX_STORAGE_FILE, "utf8");
55187
55538
  const parsed = JSON.parse(raw);
55188
55539
  return {
55189
55540
  skills: parsed.skills ?? {},
55190
- preprocessors: parsed.preprocessors ?? {},
55191
- postprocessors: parsed.postprocessors ?? {},
55541
+ preprocessorsById: isPlainObject3(parsed.preprocessorsById) ? parsed.preprocessorsById : {},
55542
+ postprocessorsById: isPlainObject3(parsed.postprocessorsById) ? parsed.postprocessorsById : {},
55192
55543
  devices: parsed.devices ?? {}
55193
55544
  };
55194
55545
  } catch {
55195
55546
  return {
55196
55547
  skills: {},
55197
- preprocessors: {},
55198
- postprocessors: {},
55548
+ preprocessorsById: {},
55549
+ postprocessorsById: {},
55199
55550
  devices: {}
55200
55551
  };
55201
55552
  }
@@ -55246,14 +55597,14 @@ async function getAllSandboxSkillIds(yamlConfig) {
55246
55597
  }
55247
55598
  }
55248
55599
  __name(getAllSandboxSkillIds, "getAllSandboxSkillIds");
55249
- async function getSandboxPreProcessorId(preprocessorName) {
55600
+ async function getSandboxPreProcessorId(preprocessorId) {
55250
55601
  const store = readStore2();
55251
- return store.preprocessors[preprocessorName] ?? null;
55602
+ return store.preprocessorsById[preprocessorId] ?? null;
55252
55603
  }
55253
55604
  __name(getSandboxPreProcessorId, "getSandboxPreProcessorId");
55254
- async function setSandboxPreProcessorId(sandboxId, preprocessorName) {
55605
+ async function setSandboxPreProcessorId(sandboxId, preprocessorId) {
55255
55606
  const store = readStore2();
55256
- store.preprocessors[preprocessorName] = sandboxId;
55607
+ store.preprocessorsById[preprocessorId] = sandboxId;
55257
55608
  writeStore2(store);
55258
55609
  }
55259
55610
  __name(setSandboxPreProcessorId, "setSandboxPreProcessorId");
@@ -55262,8 +55613,8 @@ async function getAllSandboxPreProcessorIds(config) {
55262
55613
  try {
55263
55614
  const preprocessors = preprocessorHandler.getFromYaml(config);
55264
55615
  for (const preprocessor of preprocessors) {
55265
- if (preprocessor.preprocessorId && preprocessor.name) {
55266
- const sandboxId = await getSandboxPreProcessorId(preprocessor.name);
55616
+ if (preprocessor.preprocessorId) {
55617
+ const sandboxId = await getSandboxPreProcessorId(preprocessor.preprocessorId);
55267
55618
  if (sandboxId) {
55268
55619
  overrides.push({
55269
55620
  preprocessorId: preprocessor.preprocessorId,
@@ -55278,14 +55629,14 @@ async function getAllSandboxPreProcessorIds(config) {
55278
55629
  return overrides;
55279
55630
  }
55280
55631
  __name(getAllSandboxPreProcessorIds, "getAllSandboxPreProcessorIds");
55281
- async function getSandboxPostProcessorId(postprocessorName) {
55632
+ async function getSandboxPostProcessorId(postprocessorId) {
55282
55633
  const store = readStore2();
55283
- return store.postprocessors[postprocessorName] ?? null;
55634
+ return store.postprocessorsById[postprocessorId] ?? null;
55284
55635
  }
55285
55636
  __name(getSandboxPostProcessorId, "getSandboxPostProcessorId");
55286
- async function setSandboxPostProcessorId(sandboxId, postprocessorName) {
55637
+ async function setSandboxPostProcessorId(sandboxId, postprocessorId) {
55287
55638
  const store = readStore2();
55288
- store.postprocessors[postprocessorName] = sandboxId;
55639
+ store.postprocessorsById[postprocessorId] = sandboxId;
55289
55640
  writeStore2(store);
55290
55641
  }
55291
55642
  __name(setSandboxPostProcessorId, "setSandboxPostProcessorId");
@@ -55294,8 +55645,8 @@ async function getAllSandboxPostProcessorIds(config) {
55294
55645
  try {
55295
55646
  const postprocessors = postprocessorHandler.getFromYaml(config);
55296
55647
  for (const postprocessor of postprocessors) {
55297
- if (postprocessor.postprocessorId && postprocessor.name) {
55298
- const sandboxId = await getSandboxPostProcessorId(postprocessor.name);
55648
+ if (postprocessor.postprocessorId) {
55649
+ const sandboxId = await getSandboxPostProcessorId(postprocessor.postprocessorId);
55299
55650
  if (sandboxId) {
55300
55651
  overrides.push({
55301
55652
  postprocessorId: postprocessor.postprocessorId,
@@ -55382,17 +55733,15 @@ __name(pushDevVersion, "pushDevVersion");
55382
55733
  async function pushSingleSkillToSandbox(apiKey, agentId, skillId, skillData, isInitial = false) {
55383
55734
  const skillName = skillData.name || "Unknown Skill";
55384
55735
  const sandboxSkillId = await getSandboxSkillId(skillName);
55385
- const envVars = loadEnvironmentVariables2();
55386
- const payloadWithNameAndEnv = {
55736
+ const payload = {
55387
55737
  ...skillData,
55388
- name: skillName,
55389
- env: envVars
55738
+ name: skillName
55390
55739
  };
55391
55740
  if (sandboxSkillId) {
55392
55741
  if (!isInitial) {
55393
55742
  writeProgress("\u{1F504} Updating existing sandbox version...");
55394
55743
  }
55395
- const updateResult = await updateDevVersion(apiKey, agentId, skillId, sandboxSkillId, payloadWithNameAndEnv);
55744
+ const updateResult = await updateDevVersion(apiKey, agentId, skillId, sandboxSkillId, payload);
55396
55745
  if (updateResult.success && updateResult.data) {
55397
55746
  if (!isInitial) {
55398
55747
  }
@@ -55412,7 +55761,7 @@ async function pushSingleSkillToSandbox(apiKey, agentId, skillId, skillData, isI
55412
55761
  if (!isInitial) {
55413
55762
  writeProgress("\u{1F504} Creating new sandbox version...");
55414
55763
  }
55415
- const result = await pushDevVersion(apiKey, agentId, skillId, payloadWithNameAndEnv);
55764
+ const result = await pushDevVersion(apiKey, agentId, skillId, payload);
55416
55765
  if (result.success && result.data) {
55417
55766
  await setSandboxSkillId(result.data.skillId, skillName);
55418
55767
  if (!isInitial) {
@@ -55490,7 +55839,7 @@ async function pushSkillsToSandbox(apiKey, agentId, manifest, yamlConfig, isInit
55490
55839
  __name(pushSkillsToSandbox, "pushSkillsToSandbox");
55491
55840
  async function pushSinglePreProcessorToSandbox(apiKey, agentId, preprocessorId, preprocessorData, isInitial = false) {
55492
55841
  const preprocessorName = preprocessorData.name || "Unknown PreProcessor";
55493
- const sandboxPreProcessorId = await getSandboxPreProcessorId(preprocessorName);
55842
+ const sandboxPreProcessorId = await getSandboxPreProcessorId(preprocessorId);
55494
55843
  const baseVersion = preprocessorData.version || "1.0.0";
55495
55844
  const sandboxVersion = baseVersion.endsWith("-sandbox") ? baseVersion : `${baseVersion}-sandbox`;
55496
55845
  const payload = {
@@ -55524,7 +55873,7 @@ async function pushSinglePreProcessorToSandbox(apiKey, agentId, preprocessorId,
55524
55873
  const api = new PreProcessorApi(BASE_URLS.API, apiKey, agentId);
55525
55874
  const result = await api.pushDevPreProcessor(preprocessorId, payload);
55526
55875
  if (result.success && result.data) {
55527
- await setSandboxPreProcessorId(result.data.versionId, preprocessorName);
55876
+ await setSandboxPreProcessorId(result.data.versionId, preprocessorId);
55528
55877
  return true;
55529
55878
  } else if (result.error) {
55530
55879
  console.error(`\u274C PreProcessor sandbox push failed: ${result.error.message}`);
@@ -55535,7 +55884,7 @@ async function pushSinglePreProcessorToSandbox(apiKey, agentId, preprocessorId,
55535
55884
  __name(pushSinglePreProcessorToSandbox, "pushSinglePreProcessorToSandbox");
55536
55885
  async function pushSinglePostProcessorToSandbox(apiKey, agentId, postprocessorId, postprocessorData, isInitial = false) {
55537
55886
  const postprocessorName = postprocessorData.name || "Unknown PostProcessor";
55538
- const sandboxPostProcessorId = await getSandboxPostProcessorId(postprocessorName);
55887
+ const sandboxPostProcessorId = await getSandboxPostProcessorId(postprocessorId);
55539
55888
  const baseVersion = postprocessorData.version || "1.0.0";
55540
55889
  const sandboxVersion = baseVersion.endsWith("-sandbox") ? baseVersion : `${baseVersion}-sandbox`;
55541
55890
  const payload = {
@@ -55568,7 +55917,7 @@ async function pushSinglePostProcessorToSandbox(apiKey, agentId, postprocessorId
55568
55917
  const api = new PostProcessorApi(BASE_URLS.API, apiKey, agentId);
55569
55918
  const result = await api.pushDevPostProcessor(postprocessorId, payload);
55570
55919
  if (result.success && result.data) {
55571
- await setSandboxPostProcessorId(result.data.versionId, postprocessorName);
55920
+ await setSandboxPostProcessorId(result.data.versionId, postprocessorId);
55572
55921
  return true;
55573
55922
  } else if (result.error) {
55574
55923
  console.error(`\u274C PostProcessor sandbox push failed: ${result.error.message}`);
@@ -58911,6 +59260,7 @@ var EvalsApi = class extends HttpClient {
58911
59260
  };
58912
59261
 
58913
59262
  // src/commands/evals.ts
59263
+ var EVALS_DASHBOARD_URL = "https://evals.heylua.ai";
58914
59264
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
58915
59265
  "completed",
58916
59266
  "failed",
@@ -59057,16 +59407,22 @@ async function pushSuites(api, options) {
59057
59407
  });
59058
59408
  }
59059
59409
  __name(pushSuites, "pushSuites");
59410
+ function buildEvalsDashboardUrl(agentId) {
59411
+ const url = new URL(EVALS_DASHBOARD_URL);
59412
+ url.searchParams.set("agentID", agentId);
59413
+ return url.toString();
59414
+ }
59415
+ __name(buildEvalsDashboardUrl, "buildEvalsDashboardUrl");
59060
59416
  async function openDashboard() {
59061
59417
  writeProgress("Opening Lua Evaluations Dashboard...");
59062
- const { agentId, apiKey } = await initializeCommand({
59418
+ const { agentId } = await initializeCommand({
59063
59419
  showProgress: false
59064
59420
  });
59065
- const evalsUrl = `https://evals.heylua.ai?apiKey=${apiKey}&agentID=${agentId}`;
59066
- await open3(evalsUrl);
59421
+ await open3(buildEvalsDashboardUrl(agentId));
59067
59422
  writeSuccess("Lua Evaluations Dashboard opened in your browser");
59423
+ console.log(" The dashboard will ask you to sign in if needed.");
59068
59424
  console.log(`
59069
- Dashboard URL: https://evals.heylua.ai`);
59425
+ Dashboard URL: ${EVALS_DASHBOARD_URL}`);
59070
59426
  console.log(` Agent ID: ${agentId}
59071
59427
  `);
59072
59428
  trackEvent("cli_evals_opened");
@@ -66487,13 +66843,23 @@ init_constants();
66487
66843
  init_command_utils();
66488
66844
  init_device_api_service();
66489
66845
  init_analytics();
66846
+ init_dist();
66847
+ init_cli_credentials_api_service();
66848
+ init_cli_error();
66849
+ init_request_credential();
66850
+ import { chmodSync, existsSync as existsSync11, writeFileSync as writeFileSync11 } from "fs";
66490
66851
  async function devicesCommand(action, cmdObj) {
66491
66852
  return withErrorHandling(async () => {
66492
66853
  const options = {
66493
66854
  deviceName: cmdObj?.deviceName || null,
66494
66855
  group: cmdObj?.group || null,
66495
66856
  payload: cmdObj?.payload || "{}",
66496
- timeout: cmdObj?.timeout || "30000"
66857
+ timeout: cmdObj?.timeout || "30000",
66858
+ command: cmdObj?.command,
66859
+ trigger: cmdObj?.trigger,
66860
+ operations: cmdObj?.operations,
66861
+ out: cmdObj?.out,
66862
+ force: !!cmdObj?.force
66497
66863
  };
66498
66864
  const { apiKey, agentId } = await initializeCommand();
66499
66865
  const api = new DeviceApi(BASE_URLS.API, apiKey, agentId);
@@ -66534,6 +66900,10 @@ async function devicesCommand(action, cmdObj) {
66534
66900
  {
66535
66901
  name: "\u{1F514} Test trigger",
66536
66902
  value: "test-trigger"
66903
+ },
66904
+ {
66905
+ name: "\u{1F511} Issue a device credential",
66906
+ value: "credential"
66537
66907
  }
66538
66908
  ]
66539
66909
  }
@@ -66563,6 +66933,9 @@ async function devicesCommand(action, cmdObj) {
66563
66933
  case "test-trigger":
66564
66934
  await testTrigger(api, options);
66565
66935
  break;
66936
+ case "credential":
66937
+ await issueDeviceCredential(apiKey, agentId, options);
66938
+ break;
66566
66939
  }
66567
66940
  trackEvent("cli_devices_completed", {
66568
66941
  action: selectedAction,
@@ -66574,33 +66947,25 @@ async function devicesCommand(action, cmdObj) {
66574
66947
  __name(devicesCommand, "devicesCommand");
66575
66948
  async function listDevices(api, options) {
66576
66949
  writeProgress("Fetching devices...");
66577
- const response = await api.getDevices();
66578
- if (!response.success || !response.data) {
66579
- throw new Error(response.error?.message || "Failed to fetch devices");
66580
- }
66581
- const devices = response.data.devices || response.data;
66582
- if (!Array.isArray(devices) || devices.length === 0) {
66583
- writeInfo("No devices registered. Connect a device using @lua/device-client.");
66950
+ let devices = await knownDevices(api);
66951
+ if (options.group) devices = devices.filter((d) => d.group === options.group);
66952
+ if (devices.length === 0) {
66953
+ writeInfo(options.group ? `No devices in group '${options.group}'.` : "No devices yet. Connect one with a device client, or declare one with defineDevice and `lua push device`.");
66584
66954
  return;
66585
66955
  }
66586
- let filtered = devices;
66587
- if (options.group) {
66588
- filtered = devices.filter((d) => d.group === options.group);
66589
- if (filtered.length === 0) {
66590
- writeInfo(`No devices found in group '${options.group}'.`);
66591
- return;
66592
- }
66593
- }
66594
66956
  console.log(`
66595
- Devices (${filtered.length}):
66957
+ Devices (${devices.length}):
66596
66958
  `);
66597
- for (const d of filtered) {
66598
- const statusIcon = d.active === false ? "\u26D4" : "\u{1F4E1}";
66599
- console.log(` ${statusIcon} ${d.name}${d.group ? ` [${d.group}]` : ""}`);
66600
- console.log(` ID: ${d.id}`);
66959
+ for (const d of devices) {
66960
+ const tags = [
66961
+ d.group ? `[${d.group}]` : "",
66962
+ d.declared ? "declared" : ""
66963
+ ].filter(Boolean).join(" ");
66964
+ console.log(` ${STATUS_ICON[d.status]} ${d.name} ${d.status}${tags ? ` ${tags}` : ""}`);
66601
66965
  if (d.description) console.log(` ${d.description}`);
66602
- console.log("");
66966
+ if (d.lastSeenAt && d.status !== "online") console.log(` Last seen ${d.lastSeenAt}`);
66603
66967
  }
66968
+ console.log("");
66604
66969
  }
66605
66970
  __name(listDevices, "listDevices");
66606
66971
  async function deviceStatus(api, options) {
@@ -66611,8 +66976,14 @@ async function deviceStatus(api, options) {
66611
66976
  throw new Error(response.error?.message || "Failed to get device status");
66612
66977
  }
66613
66978
  const status = response.data.status;
66614
- const icon = status === "online" ? "\u{1F7E2}" : status === "disabled" ? "\u26D4" : "\u{1F534}";
66615
- writeSuccess(`${icon} Device '${name}' is ${status}`);
66979
+ if (status === "online") {
66980
+ writeSuccess(`\u{1F7E2} Device '${name}' is online`);
66981
+ } else if (status === "disabled") {
66982
+ writeSuccess(`\u26D4 Device '${name}' is disabled. Run \`lua devices enable --device-name ${name}\` to allow it back.`);
66983
+ } else {
66984
+ const known = (await knownDevices(api)).some((d) => d.name === name);
66985
+ writeSuccess(known ? `\u{1F534} Device '${name}' is offline` : `\u{1F534} Device '${name}' has never connected to this agent`);
66986
+ }
66616
66987
  }
66617
66988
  __name(deviceStatus, "deviceStatus");
66618
66989
  async function enableDevice(api, options) {
@@ -66623,6 +66994,7 @@ async function enableDevice(api, options) {
66623
66994
  throw new Error(response.error?.message || "Failed to enable device");
66624
66995
  }
66625
66996
  writeSuccess(`Device '${name}' enabled`);
66997
+ writeInfo("Disabling disconnected it, so it is offline until its client connects again (restart it if it does not retry).");
66626
66998
  }
66627
66999
  __name(enableDevice, "enableDevice");
66628
67000
  async function disableDevice(api, options) {
@@ -66632,11 +67004,15 @@ async function disableDevice(api, options) {
66632
67004
  if (!response.success) {
66633
67005
  throw new Error(response.error?.message || "Failed to disable device");
66634
67006
  }
66635
- writeSuccess(`Device '${name}' disabled`);
67007
+ writeSuccess(`Device '${name}' disabled. It is disconnected and refused until you enable it.`);
66636
67008
  }
66637
67009
  __name(disableDevice, "disableDevice");
66638
67010
  async function removeDevice(api, options, force) {
66639
67011
  const name = await resolveDeviceName(api, options.deviceName, "Remove");
67012
+ const device = (await knownDevices(api)).find((d) => d.name === name);
67013
+ if (!device) {
67014
+ throw CliError.notFound(`No device named '${name}' on this agent.`, "Run `lua devices list` to see its devices");
67015
+ }
66640
67016
  if (!force) {
66641
67017
  const confirm = await safePrompt([
66642
67018
  {
@@ -66652,35 +67028,25 @@ async function removeDevice(api, options, force) {
66652
67028
  }
66653
67029
  }
66654
67030
  writeProgress(`Removing '${name}'...`);
66655
- const response = await api.deleteDevice(name);
66656
- if (!response.success) {
66657
- throw new Error(response.error?.message || "Failed to remove device");
67031
+ if (device.declared) {
67032
+ const response = await api.deleteDevice(name);
67033
+ if (!response.success) throw new Error(response.error?.message || "Failed to remove the device definition");
67034
+ }
67035
+ if (device.connected) {
67036
+ const response = await api.deleteDeviceInstance(name);
67037
+ if (!response.success) throw new Error(response.error?.message || "Failed to remove the device");
66658
67038
  }
66659
67039
  writeSuccess(`Device '${name}' removed`);
67040
+ if (device.status === "online") {
67041
+ writeInfo("It is still connected; it reappears if its client reconnects. Disable it to keep it out.");
67042
+ }
66660
67043
  }
66661
67044
  __name(removeDevice, "removeDevice");
66662
67045
  async function testCommand2(api, options) {
66663
67046
  const name = await resolveDeviceName(api, options.deviceName, "Test command on");
66664
- let command;
66665
- if (cmdHasPositionalCommand(options)) {
66666
- command = options.command;
66667
- } else {
66668
- const answer = await safePrompt([
66669
- {
66670
- type: "input",
66671
- name: "command",
66672
- message: "Command name:"
66673
- }
66674
- ]);
66675
- if (!answer?.command) return;
66676
- command = answer.command;
66677
- }
66678
- let payload;
66679
- try {
66680
- payload = JSON.parse(options.payload || "{}");
66681
- } catch {
66682
- throw new Error(`Invalid JSON payload: ${options.payload}`);
66683
- }
67047
+ const command = options.command || await promptFor("command", "Command name:");
67048
+ if (!command) throw CliError.usage("A command name is required.", "Pass --command <name>");
67049
+ const payload = parsePayload(options.payload);
66684
67050
  const timeout = parseInt(options.timeout || "30000");
66685
67051
  console.log(`
66686
67052
  Sending '${command}' to device '${name}'...`);
@@ -66691,62 +67057,173 @@ async function testCommand2(api, options) {
66691
67057
  const data = response.data;
66692
67058
  if (data.success !== false) {
66693
67059
  writeSuccess(`Response received (${latency}ms):`);
66694
- console.log(JSON.stringify(data.data || data, null, 2));
66695
- } else {
66696
- console.log(`
66697
- \u274C Device returned error (${latency}ms):`);
66698
- console.log(` ${data.error || "Unknown error"}`);
66699
- }
66700
- } else {
66701
- const msg = response.error?.message || "Command failed";
66702
- if (msg.includes("offline")) {
66703
- console.log(`
66704
- \u274C Device '${name}' is offline`);
66705
- } else if (msg.includes("timed out")) {
66706
- console.log(`
66707
- \u274C Command timed out after ${timeout}ms`);
66708
- } else {
66709
- throw new Error(msg);
67060
+ console.log(JSON.stringify(data.data ?? data, null, 2));
67061
+ return;
66710
67062
  }
67063
+ throw new Error(`Device '${name}' returned an error (${latency}ms): ${data.error || data.message || "unknown error"}`);
67064
+ }
67065
+ const deviceError = response.error;
67066
+ if (typeof deviceError === "string") {
67067
+ throw new Error(`Device '${name}' returned an error (${latency}ms): ${deviceError}`);
67068
+ }
67069
+ const status = response.error?.statusCode;
67070
+ const msg = response.error?.message || `Command failed${status ? ` (HTTP ${status})` : ""}`;
67071
+ if (/disabled/i.test(msg)) throw new Error(`Device '${name}' is disabled`);
67072
+ if (/offline|not connected/i.test(msg) || status === 404) {
67073
+ const current = await api.getDeviceStatus(name);
67074
+ const disabled = current.success && current.data?.status === "disabled";
67075
+ throw new Error(disabled ? `Device '${name}' is disabled. Run \`lua devices enable --device-name ${name}\` first.` : `Device '${name}' is offline`);
67076
+ }
67077
+ if (/timed out/i.test(msg) || status === 408) {
67078
+ throw new Error(`No reply within ${timeout}ms. Check that '${command}' is a command the device declares.`);
66711
67079
  }
67080
+ if (status === 429) throw new Error("Too many commands in flight for this agent; try again shortly");
67081
+ throw new Error(msg);
66712
67082
  }
66713
67083
  __name(testCommand2, "testCommand");
66714
67084
  async function testTrigger(api, options) {
66715
67085
  const name = await resolveDeviceName(api, options.deviceName, "Test trigger on");
66716
- let triggerName;
66717
- const answer = await safePrompt([
66718
- {
66719
- type: "input",
66720
- name: "trigger",
66721
- message: "Trigger name:"
67086
+ const trigger = options.trigger || await promptFor("trigger", "Trigger name:");
67087
+ if (!trigger) throw CliError.usage("A trigger name is required.", "Pass --trigger <name>");
67088
+ const payload = parsePayload(options.payload);
67089
+ writeProgress(`Firing trigger '${trigger}' as device '${name}'...`);
67090
+ const response = await api.fireTrigger(name, trigger, payload);
67091
+ if (!response.success) {
67092
+ if (response.error?.statusCode === 404) {
67093
+ throw new Error("This Lua environment does not support test triggers yet.");
66722
67094
  }
66723
- ]);
66724
- if (!answer?.trigger) return;
66725
- triggerName = answer.trigger;
66726
- let payload;
66727
- try {
66728
- payload = JSON.parse(options.payload || "{}");
66729
- } catch {
66730
- throw new Error(`Invalid JSON payload: ${options.payload}`);
67095
+ throw new Error(response.error?.message || "Failed to fire the trigger");
66731
67096
  }
66732
- console.log(`
66733
- Simulating trigger '${triggerName}' on device '${name}'...`);
66734
- writeInfo("Note: This sends the trigger through the full execution pipeline on the server.");
66735
- const response = await api.sendCommand(name, `__test_trigger__${triggerName}`, payload, parseInt(options.timeout || "30000"));
66736
- if (response.success) {
66737
- writeSuccess("Trigger sent successfully. Check agent logs for execution results.");
67097
+ writeSuccess(`Trigger '${trigger}' queued (id ${response.data?.triggerId}). The live handler runs now.`);
67098
+ writeInfo("Read its run with `lua logs --type device-trigger`. A trigger with no live handler is logged as skipped.");
67099
+ }
67100
+ __name(testTrigger, "testTrigger");
67101
+ async function issueDeviceCredential(credential, agentId, options) {
67102
+ if (!isRequestCredential(credential) || credential.descriptor.kind !== "first-party-session") {
67103
+ throw CliError.usage("Issuing a device credential needs an email sign-in; an API key cannot issue one.", "Run `lua auth configure` in your terminal and choose Email");
67104
+ }
67105
+ let deviceName = options.deviceName;
67106
+ if (!deviceName) {
67107
+ const answer = await safePrompt([
67108
+ {
67109
+ type: "input",
67110
+ name: "name",
67111
+ message: "Device name the client will connect with:"
67112
+ }
67113
+ ]);
67114
+ deviceName = answer?.name?.trim();
67115
+ }
67116
+ if (!deviceName) throw CliError.usage("A device name is required.", "Pass --device-name <name>");
67117
+ const operations = (options.operations || "commands,triggers").split(",").map((op) => op.trim()).filter(Boolean);
67118
+ const unknown = operations.filter((op) => !DEVICE_OPERATIONS.includes(op));
67119
+ if (operations.length === 0 || unknown.length > 0) {
67120
+ throw CliError.usage(`Unknown operation${unknown.length === 1 ? "" : "s"}: ${unknown.join(", ") || "(none)"}.`, `--operations takes a comma list of ${DEVICE_OPERATIONS.join(", ")}`);
67121
+ }
67122
+ if (options.out && existsSync11(options.out) && !options.force) {
67123
+ throw CliError.usage(`${options.out} already exists.`, "Pass --force to overwrite it");
67124
+ }
67125
+ writeProgress(`Issuing a credential for '${deviceName}' (${operations.join(", ")})...`);
67126
+ const api = new CliCredentialsApi(BASE_URLS.API);
67127
+ const response = await api.issueDeviceCredential(await credential.bearer(), {
67128
+ agentId,
67129
+ deviceName,
67130
+ operations: [
67131
+ ...new Set(operations)
67132
+ ],
67133
+ name: `lua-cli: ${deviceName}`
67134
+ });
67135
+ if (!response.success || !response.data?.secret) {
67136
+ throw new Error(response.error?.message || "Failed to issue the device credential");
67137
+ }
67138
+ const { secret, credential: issued } = response.data;
67139
+ if (options.out) {
67140
+ writeFileSync11(options.out, `LUA_AGENT_ID=${envValue(agentId)}
67141
+ LUA_DEVICE_NAME=${envValue(deviceName)}
67142
+ LUA_DEVICE_CREDENTIAL=${envValue(secret)}
67143
+ `, {
67144
+ mode: 384
67145
+ });
67146
+ chmodSync(options.out, 384);
67147
+ writeSuccess(`Device credential for '${deviceName}' saved to ${options.out} (id ${issued.id})`);
66738
67148
  } else {
67149
+ writeSuccess(`Device credential for '${deviceName}' (id ${issued.id}). It is shown only once:`);
66739
67150
  console.log(`
66740
- \u274C ${response.error?.message || "Failed to send trigger"}`);
67151
+ ${secret}
67152
+ `);
66741
67153
  }
67154
+ writeInfo(`Connect with agent ${agentId}, device name '${deviceName}', and this secret as the device credential.`);
66742
67155
  }
66743
- __name(testTrigger, "testTrigger");
67156
+ __name(issueDeviceCredential, "issueDeviceCredential");
67157
+ function envValue(value3) {
67158
+ return /^[A-Za-z0-9_.:@-]*$/.test(value3) ? value3 : JSON.stringify(value3);
67159
+ }
67160
+ __name(envValue, "envValue");
67161
+ var STATUS_ICON = {
67162
+ online: "\u{1F7E2}",
67163
+ offline: "\u26AA",
67164
+ disabled: "\u26D4"
67165
+ };
67166
+ function mergeDevices(definitions, connected) {
67167
+ const byName = /* @__PURE__ */ new Map();
67168
+ for (const d of definitions) {
67169
+ if (!d?.name) continue;
67170
+ byName.set(d.name, {
67171
+ name: d.name,
67172
+ status: d.active === false ? "disabled" : "offline",
67173
+ declared: true,
67174
+ connected: false,
67175
+ ...d.group ? {
67176
+ group: d.group
67177
+ } : {},
67178
+ ...d.description ? {
67179
+ description: d.description
67180
+ } : {}
67181
+ });
67182
+ }
67183
+ for (const c of connected) {
67184
+ const existing = byName.get(c.name);
67185
+ byName.set(c.name, {
67186
+ ...existing ?? {
67187
+ declared: false
67188
+ },
67189
+ name: c.name,
67190
+ status: c.status,
67191
+ connected: true,
67192
+ ...c.group ?? existing?.group ? {
67193
+ group: c.group ?? existing?.group
67194
+ } : {},
67195
+ ...c.description || existing?.description ? {
67196
+ description: c.description || existing?.description
67197
+ } : {},
67198
+ lastSeenAt: c.lastSeenAt
67199
+ });
67200
+ }
67201
+ const order = {
67202
+ online: 0,
67203
+ offline: 1,
67204
+ disabled: 2
67205
+ };
67206
+ return [
67207
+ ...byName.values()
67208
+ ].sort((a, b) => order[a.status] - order[b.status] || a.name.localeCompare(b.name));
67209
+ }
67210
+ __name(mergeDevices, "mergeDevices");
67211
+ async function knownDevices(api) {
67212
+ const [definitions, connected] = await Promise.all([
67213
+ api.getDevices(),
67214
+ api.getConnectedDevices()
67215
+ ]);
67216
+ if (!definitions.success) throw new Error(definitions.error?.message || "Failed to fetch devices");
67217
+ const defs = definitions.data?.devices ?? definitions.data ?? [];
67218
+ const live = connected.success ? connected.data?.devices ?? [] : [];
67219
+ return mergeDevices(Array.isArray(defs) ? defs : [], live);
67220
+ }
67221
+ __name(knownDevices, "knownDevices");
66744
67222
  async function resolveDeviceName(api, name, actionLabel) {
66745
67223
  if (name) return name;
66746
- const response = await api.getDevices();
66747
- const devices = response.data?.devices || response.data || [];
66748
- if (!Array.isArray(devices) || devices.length === 0) {
66749
- throw new Error("No devices registered.");
67224
+ const devices = await knownDevices(api);
67225
+ if (devices.length === 0) {
67226
+ throw CliError.notFound("This agent has no devices yet.", "Connect a device, or pass --device-name <name>");
66750
67227
  }
66751
67228
  const answer = await safePrompt([
66752
67229
  {
@@ -66754,19 +67231,34 @@ async function resolveDeviceName(api, name, actionLabel) {
66754
67231
  name: "device",
66755
67232
  message: `${actionLabel} which device?`,
66756
67233
  choices: devices.map((d) => ({
66757
- name: `${d.name}${d.group ? ` [${d.group}]` : ""}`,
67234
+ name: `${STATUS_ICON[d.status]} ${d.name}${d.group ? ` [${d.group}]` : ""}`,
66758
67235
  value: d.name
66759
67236
  }))
66760
67237
  }
66761
67238
  ]);
66762
- if (!answer?.device) throw new Error("No device selected.");
67239
+ if (!answer?.device) throw CliError.usage("No device selected.", "Pass --device-name <name>");
66763
67240
  return answer.device;
66764
67241
  }
66765
67242
  __name(resolveDeviceName, "resolveDeviceName");
66766
- function cmdHasPositionalCommand(options) {
66767
- return !!options.command;
67243
+ async function promptFor(field, message) {
67244
+ const answer = await safePrompt([
67245
+ {
67246
+ type: "input",
67247
+ name: field,
67248
+ message
67249
+ }
67250
+ ]);
67251
+ return answer?.[field]?.trim() || void 0;
66768
67252
  }
66769
- __name(cmdHasPositionalCommand, "cmdHasPositionalCommand");
67253
+ __name(promptFor, "promptFor");
67254
+ function parsePayload(raw) {
67255
+ try {
67256
+ return JSON.parse(raw || "{}");
67257
+ } catch {
67258
+ throw CliError.usage(`Invalid JSON payload: ${raw}`, `Pass --payload '{"key":"value"}'`);
67259
+ }
67260
+ }
67261
+ __name(parsePayload, "parsePayload");
66770
67262
 
66771
67263
  // src/commands/jobs.ts
66772
67264
  init_cli();
@@ -68253,9 +68745,7 @@ __name(startResultLine, "startResultLine");
68253
68745
  async function startCore(ctx, name, o) {
68254
68746
  const input = parsedOrUsage(() => o.input ? parseJsonOrFile(o.input, "--input") : {});
68255
68747
  const waitSeconds = parsedOrUsage(() => parseIntFlag(o.wait, "--wait"));
68256
- const budgetCredits = parsedOrUsage(() => parseIntegerFlag(o.budgetCredits, "--budget-credits", {
68257
- min: 1
68258
- }));
68748
+ const budgetCredits = parsedOrUsage(() => parseCapFlag(o.budgetCredits, o.budgetActions, "--budget-credits", "--budget-actions"));
68259
68749
  if (waitSeconds !== void 0 && (waitSeconds < 0 || waitSeconds > 55)) {
68260
68750
  throw CliError.usage("--wait must be 0..55 (a server long-poll; the CLI raises its own deadline to wait+10 s)");
68261
68751
  }
@@ -69483,9 +69973,7 @@ async function raiseBudgetCore(ctx, runId, o) {
69483
69973
  let dto;
69484
69974
  try {
69485
69975
  dto = {};
69486
- const credits = parseIntegerFlag(o.credits, "--credits", {
69487
- min: 1
69488
- });
69976
+ const credits = parseCapFlag(o.credits, o.actions, "--credits", "--actions");
69489
69977
  if (credits !== void 0) dto.maxCredits = credits;
69490
69978
  const steps = parseIntegerFlag(o.maxSteps, "--max-steps", {
69491
69979
  min: 1
@@ -70736,6 +71224,17 @@ function parseIntegerFlag(v, flag, range2 = {}) {
70736
71224
  return n2;
70737
71225
  }
70738
71226
  __name(parseIntegerFlag, "parseIntegerFlag");
71227
+ function parseCapFlag(primary, alias, primaryFlag, aliasFlag) {
71228
+ if (primary !== void 0 && alias !== void 0) {
71229
+ throw new WorkflowLocalUsageError("usage", `${aliasFlag}: pass either ${primaryFlag} or ${aliasFlag}, not both`);
71230
+ }
71231
+ return alias !== void 0 ? parseIntegerFlag(alias, aliasFlag, {
71232
+ min: 1
71233
+ }) : parseIntegerFlag(primary, primaryFlag, {
71234
+ min: 1
71235
+ });
71236
+ }
71237
+ __name(parseCapFlag, "parseCapFlag");
70739
71238
  var GOAL_LIVE_STATUSES = /* @__PURE__ */ new Set([
70740
71239
  "active",
70741
71240
  "paused"
@@ -71325,9 +71824,7 @@ async function goalsCreateCore(ctx, o, positional) {
71325
71824
  }
71326
71825
  const cadence = parseCadenceFlag(o.cadence, o.timezone);
71327
71826
  const input = o.input ? parseJsonOrFile(o.input, "--input") : void 0;
71328
- const budgetCredits = parseIntegerFlag(o.budgetCredits, "--budget-credits", {
71329
- min: 1
71330
- });
71827
+ const budgetCredits = parseCapFlag(o.budgetCredits, o.budgetActions, "--budget-credits", "--budget-actions");
71331
71828
  const maxTotalCredits = parseIntegerFlag(o.maxTotalCredits, "--max-total-credits", {
71332
71829
  min: 1
71333
71830
  });
@@ -71537,9 +72034,7 @@ async function schedulesCreateCore(ctx, o, positional) {
71537
72034
  if (!SCHEDULE_NOTIFY.includes(o.notify)) throw usage(`--notify: expected ${SCHEDULE_NOTIFY.join("|")} (got "${o.notify}")`);
71538
72035
  draft.notify = o.notify;
71539
72036
  }
71540
- const credits = parseIntegerFlag(o.budgetCredits, "--budget-credits", {
71541
- min: 1
71542
- });
72037
+ const credits = parseCapFlag(o.budgetCredits, o.budgetActions, "--budget-credits", "--budget-actions");
71543
72038
  if (credits !== void 0) draft.budget = {
71544
72039
  maxCredits: credits
71545
72040
  };
@@ -74369,6 +74864,12 @@ var TEMPLATE_SECTION_KEYS = [
74369
74864
  "onUninstall",
74370
74865
  "installPolicy"
74371
74866
  ];
74867
+ var HOOK_KEYS = [
74868
+ "tool",
74869
+ "instruction",
74870
+ "startWorkflow",
74871
+ "firstProof"
74872
+ ];
74372
74873
  function sectionKeys(section2, value3) {
74373
74874
  if (value3 === void 0 || value3 === null) return [];
74374
74875
  if (section2 === "connections") return (value3 ?? []).map((entry) => entry.key);
@@ -74378,14 +74879,7 @@ function sectionKeys(section2, value3) {
74378
74879
  }
74379
74880
  if (section2 === "onInstall" || section2 === "onUninstall") {
74380
74881
  const hook = value3;
74381
- return [
74382
- ...hook.tool ? [
74383
- "tool"
74384
- ] : [],
74385
- ...hook.instruction ? [
74386
- "instruction"
74387
- ] : []
74388
- ];
74882
+ return HOOK_KEYS.filter((key) => Boolean(hook[key]));
74389
74883
  }
74390
74884
  return Object.keys(value3);
74391
74885
  }
@@ -80840,7 +81334,7 @@ __name(telemetryCommand, "telemetryCommand");
80840
81334
  init_cli();
80841
81335
  init_command_utils();
80842
81336
  init_analytics();
80843
- import { writeFileSync as writeFileSync11, existsSync as existsSync11, unlinkSync as unlinkSync3 } from "fs";
81337
+ import { writeFileSync as writeFileSync12, existsSync as existsSync12, unlinkSync as unlinkSync3 } from "fs";
80844
81338
  import { resolve as resolve5, join as join11 } from "path";
80845
81339
  init_artifact_loader();
80846
81340
  init_types();
@@ -80864,9 +81358,9 @@ async function governanceCommand(action) {
80864
81358
  return;
80865
81359
  }
80866
81360
  const srcDir = resolve5(process.cwd(), "src");
80867
- const targetDir = existsSync11(srcDir) ? srcDir : process.cwd();
81361
+ const targetDir = existsSync12(srcDir) ? srcDir : process.cwd();
80868
81362
  const filePath = join11(targetDir, "governance.ts");
80869
- if (existsSync11(filePath)) {
81363
+ if (existsSync12(filePath)) {
80870
81364
  const { overwrite } = await safePrompt([
80871
81365
  {
80872
81366
  type: "confirm",
@@ -80957,7 +81451,7 @@ async function governanceCommand(action) {
80957
81451
  }
80958
81452
  }
80959
81453
  const content = generateGovernanceFile(setup);
80960
- writeFileSync11(filePath, content, "utf-8");
81454
+ writeFileSync12(filePath, content, "utf-8");
80961
81455
  const relativePath = filePath.replace(process.cwd() + "/", "");
80962
81456
  writeSuccess(`Created ${relativePath}`);
80963
81457
  console.log("");
@@ -80995,9 +81489,9 @@ async function governanceCommand(action) {
80995
81489
  __name(governanceCommand, "governanceCommand");
80996
81490
  async function governanceRemove() {
80997
81491
  const srcDir = resolve5(process.cwd(), "src");
80998
- const targetDir = existsSync11(srcDir) ? srcDir : process.cwd();
81492
+ const targetDir = existsSync12(srcDir) ? srcDir : process.cwd();
80999
81493
  const filePath = join11(targetDir, "governance.ts");
81000
- const hasLocal = existsSync11(filePath);
81494
+ const hasLocal = existsSync12(filePath);
81001
81495
  const { confirm } = await safePrompt([
81002
81496
  {
81003
81497
  type: "confirm",
@@ -81348,7 +81842,7 @@ init_command_utils();
81348
81842
  init_artifact_loader();
81349
81843
  init_types();
81350
81844
  import { spawn as spawn3 } from "child_process";
81351
- import { existsSync as existsSync12, readdirSync as readdirSync4, statSync as statSync6 } from "fs";
81845
+ import { existsSync as existsSync13, readdirSync as readdirSync4, statSync as statSync6 } from "fs";
81352
81846
  import { join as join12, relative as relative2, resolve as resolve6 } from "path";
81353
81847
  init_voice_api_service();
81354
81848
  init_constants();
@@ -81938,7 +82432,7 @@ function escapeRegex(s) {
81938
82432
  __name(escapeRegex, "escapeRegex");
81939
82433
  function detectRunner(cwd) {
81940
82434
  const pkgPath = join12(cwd, "package.json");
81941
- if (!existsSync12(pkgPath)) return null;
82435
+ if (!existsSync13(pkgPath)) return null;
81942
82436
  try {
81943
82437
  const pkg2 = JSON.parse(__require("fs").readFileSync(pkgPath, "utf8"));
81944
82438
  const deps = {
@@ -82709,6 +83203,8 @@ async function versionListCommand(options = {}) {
82709
83203
  createdByEmail: v.createdByEmail,
82710
83204
  createdAt: v.createdAt,
82711
83205
  commitHash: v.commitHash,
83206
+ commitHashSource: v.commitHashSource,
83207
+ commitHashMissingReason: v.commitHashMissingReason,
82712
83208
  sourceManifestVersion: v.sourceManifestVersion,
82713
83209
  sourceDigest: v.sourceDigest
82714
83210
  }));
@@ -82751,6 +83247,7 @@ async function versionShowCommand(versionArg, options = {}) {
82751
83247
  console.log(` Created: ${v.createdAt} by ${v.createdBy}`);
82752
83248
  if (v.message) console.log(` Message: ${v.message}`);
82753
83249
  if (v.commitHash) console.log(` Commit: ${v.commitHash}`);
83250
+ else if (v.commitHashMissingReason) console.log(` Commit missing: ${v.commitHashMissingReason}`);
82754
83251
  console.log(` Model: ${v.snapshot.model}`);
82755
83252
  console.log(` Snapshot:`);
82756
83253
  console.log(` Skills: ${v.snapshot.skills.length}`);
@@ -84008,7 +84505,7 @@ Examples:
84008
84505
  ...opts,
84009
84506
  accept: opts.pull || opts.accept
84010
84507
  }));
84011
- program2.command("test [type]").description("\u{1F9EA} Test skills, webhooks, or jobs interactively").option("--name <name>", "Entity name to test").option("--input <json>", "JSON input string for testing").option("--json", "Output result as raw JSON (useful for scripting and piping)").option("--route <route>", "Web app: the route to call, e.g. 'GET /tickets?status=open'").option("--step-output <id=json>", "Workflow: complete a step with this output (repeatable)", collect, []).option("--approve <id[=@payload]>", "Workflow: pre-answer an approval (repeatable)", collect, []).option("--deny <id[=@reason]>", "Workflow: pre-deny an approval (repeatable)", collect, []).option("--signal <name=json>", "Workflow: pre-supply a waitForSignal payload (repeatable)", collect, []).option("--from-run <runId>", "Workflow: seed completed steps from a real run").option("--force", "Workflow: seed from a run whose graph differs").option("--record <dir>", "Workflow: record agent/tool outputs as fixtures").option("--fixtures <dir>", "Workflow: replay recorded fixtures (exit 5 when one is missing)").option("--step-wall <s>", "Workflow: per-step wall in seconds (default 600)").option("--job-wall <s>", "Workflow: virtual wall for tier:'job' steps \u2014 splits at 14400 s segments, > 86400 is exit 2").option("--max-ticks <n>", "Workflow (script form): tick cap before SCRIPT_TICK_LIMIT (default 64)").option("--ledger-out <file>", "Workflow: write the in-memory ledger as JSON").option("--agents <fake|live>", "Workflow: fake agent steps (default) or call the dev API").option("--now <iso>", "Workflow: virtual clock start").option("--park <id>", "Workflow: simulate a platform-fault park of this step (repeatable)", collect, []).option("--fast-retries", "Workflow: collapse retry backoff waits to 0").option("--real-time", "Workflow: actually wait on sleeps/backoffs instead of fast-forwarding").option("--artefacts-dir <dir>", "Workflow: back ctx.artefacts.* on disk").option("--workspace <dir>", "Workflow: the checkout Job-tier code steps run in (ctx.workspace + ctx.exec / ctx.$)").addHelpText("after", `
84508
+ program2.command("test [type]").description("\u{1F9EA} Test skills, webhooks, or jobs interactively").option("--name <name>", "Entity name to test").option("--input <json>", "JSON input string for testing").option("--json", "Output result as raw JSON (useful for scripting and piping)").option("--route <route>", "Web app: the route to call, e.g. 'GET /tickets?status=open'").option("--step-output <id=json>", "Workflow: complete a step with this output (repeatable)", collect, []).option("--approve <id[=@payload]>", "Workflow: pre-answer an approval (repeatable)", collect, []).option("--deny <id[=@reason]>", "Workflow: pre-deny an approval (repeatable)", collect, []).option("--signal <name=json>", "Workflow: pre-supply a waitForSignal payload (repeatable)", collect, []).option("--from-run <runId>", "Workflow: seed completed steps from a real run").option("--force", "Workflow: seed from a run whose graph differs").option("--record <dir>", "Workflow: record live agent replies as fixtures (needs --agents live; tool steps never run offline)").option("--fixtures <dir>", "Workflow: replay recorded fixtures (exit 5 when one is missing)").option("--step-wall <s>", "Workflow: per-step wall in seconds (default 600)").option("--job-wall <s>", "Workflow: virtual wall for tier:'job' steps \u2014 splits at 14400 s segments, > 86400 is exit 2").option("--max-ticks <n>", "Workflow (script form): tick cap before SCRIPT_TICK_LIMIT (default 64)").option("--ledger-out <file>", "Workflow: write the in-memory ledger as JSON").option("--agents <fake|live>", "Workflow: fake agent steps (default) or call the dev API").option("--now <iso>", "Workflow: virtual clock start").option("--park <id>", "Workflow: simulate a platform-fault park of this step (repeatable)", collect, []).option("--fast-retries", "Workflow: collapse retry backoff waits to 0").option("--real-time", "Workflow: actually wait on sleeps/backoffs instead of fast-forwarding").option("--artefacts-dir <dir>", "Workflow: back ctx.artefacts.* on disk").option("--workspace <dir>", "Workflow: the checkout Job-tier code steps run in (ctx.workspace + ctx.exec / ctx.$)").addHelpText("after", `
84012
84509
  Arguments:
84013
84510
  type Optional: 'skill', 'webhook', 'job' or 'workflow' (prompts if not provided)
84014
84511
 
@@ -84341,28 +84838,36 @@ Notes:
84341
84838
  read it back, 'lua drains verify' finishes on its own; if it is write-only \u2014 the grant we
84342
84839
  recommend \u2014 list your prefix, find the object, and run 'lua drains confirm <id> --token <token>'.
84343
84840
  `).action(drainsCommand);
84344
- program2.command("devices [action]").description("\u{1F4E1} Manage connected devices").option("--device-name <name>", "Device name").option("--group <group>", "Filter by device group").option("--payload <json>", "JSON payload for test/test-trigger", "{}").option("--timeout <ms>", "Timeout in milliseconds", "30000").option("--force", "Skip confirmation prompts").addHelpText("after", `
84841
+ program2.command("devices [action]").description("\u{1F4E1} Manage connected devices").option("--device-name <name>", "Device name").option("--group <group>", "Filter by device group").option("--command <name>", "test: the command to send").option("--trigger <name>", "test-trigger: the trigger to fire").option("--payload <json>", "JSON payload for test/test-trigger", "{}").option("--timeout <ms>", "Timeout in milliseconds", "30000").option("--operations <list>", "credential: comma list of commands, triggers, assets.upload", "commands,triggers").option("--out <file>", "credential: write the secret to this file (mode 600) instead of printing it").option("--force", "Skip confirmation prompts").addHelpText("after", `
84345
84842
  Arguments:
84346
- action Optional: list, status, enable, disable, remove, test, test-trigger
84843
+ action Optional: list, status, enable, disable, remove, test, test-trigger, credential
84347
84844
 
84348
84845
  Options:
84349
84846
  --device-name <name> Device name (required for most actions, prompted if not provided)
84350
84847
  --group <group> Filter device list by group
84848
+ --command <name> test: the command to send (prompted if not provided)
84849
+ --trigger <name> test-trigger: the trigger to fire (prompted if not provided)
84351
84850
  --payload <json> JSON payload for test command or test-trigger
84352
84851
  --timeout <ms> Command timeout in milliseconds (default: 30000)
84353
- --force Skip confirmation prompts
84852
+ --operations <list> credential: what the device may do (default: commands,triggers)
84853
+ --out <file> credential: save the secret to a file instead of printing it
84854
+ --force Skip confirmation prompts (credential: overwrite --out)
84354
84855
 
84355
84856
  Examples:
84356
84857
  $ lua devices Interactive management
84357
- $ lua devices list List all devices
84858
+ $ lua devices list List declared and connected devices, with status
84358
84859
  $ lua devices list --group printers List devices in group
84359
84860
  $ lua devices status --device-name label-printer Check device status
84360
84861
  $ lua devices enable --device-name label-printer Enable a device
84361
84862
  $ lua devices disable --device-name label-printer Disable a device
84362
84863
  $ lua devices remove --device-name label-printer Remove a device
84363
84864
  $ lua devices remove --device-name label-printer --force Remove without confirmation
84364
- $ lua devices test --device-name label-printer Test a command interactively
84365
- $ lua devices test-trigger --device-name label-printer Test a trigger
84865
+ $ lua devices test --device-name label-printer --command print_label --payload '{"orderId":"o1"}'
84866
+ Send one command and print the reply
84867
+ $ lua devices test-trigger --device-name bench --trigger too_hot --payload '{"temperature":41}'
84868
+ Fire a trigger; the live handler runs
84869
+ $ lua devices credential --device-name pico-sensor --out .env.device
84870
+ Issue a credential the device connects with
84366
84871
  `).action(devicesCommand);
84367
84872
  program2.command("jobs [action]").description("\u23F0 Manage and view scheduled jobs").option("-i, --job-name <name>", "Job name").option("-v, --job-version <version>", "Version for deploy action (or 'latest')").addHelpText("after", `
84368
84873
  Arguments:
@@ -84384,7 +84889,7 @@ Examples:
84384
84889
  $ lua jobs versions -i myJob View job versions
84385
84890
  $ lua jobs history -i myJob View execution history
84386
84891
  `).action(jobsCommand);
84387
- program2.command("workflows [action] [target] [extra]").description("\u{1F9ED} Manage workflows and their runs (list, start, watch, cancel, resume, retry-step, resolve-step, raise-budget, approve, signal, replay, export, schedules)").option("-i, --workflow-name <name>", "Workflow name (or id)").option("-r, --run-id <id>", "Run id").option("-v, --workflow-version <ver>", "deploy/start/export/goals create/schedules create: a semver, 'latest' (newest push) or a version id").option("--json", "Print the raw {success,data} envelope").option("--all", "list: include dynamic workflows").option("--input <json|@file>", "start/run/goals create/schedules create: run input").option("--idempotency-key <key>", "start: idempotency key").option("--correlation-key <key>", "start/runs: correlation key").option("--tag <tag>", "start/runs/schedules create: tag (repeatable, \u2264 10)", collect, []).option("--budget-credits <n>", "start/schedules create: run budget (credits)").option("--wait <s>", "start: server long-poll \u2264 55 s").option("--follow", "start/logs: attach watch").option("--status <status>", "runs/goals list: filter by status").option("--workflow <name>", "runs: filter by workflow").option("--limit <n>", "runs/goals list/approval-payload --path: page size").option("--cursor <c>", "runs/goals list/approval-payload --path: page cursor").option("--sort <field>", "runs: -createdAt|createdAt|-durationMs|durationMs").option("--steps", "status: per-step table").option("--strict", "status: exit 4/5 by terminal status, 6 for a gated run").option("--compose <on|off>", "policy models set: may the composer be shown the model menu").option("--max-class <fast|balanced|strong>", "policy models set: ceiling for class requests and the class map").option("--consent-actions <n>", "policy models set: estimated actions above which a composed run shows the card").option("--allow <codes>", "policy models set: comma-separated approved codes to narrow the set to").option("--class-fast <codes>", "policy models set: ordered overrides of the fast class (comma-separated)").option("--class-balanced <codes>", "policy models set: ordered overrides of the balanced class (comma-separated)").option("--class-strong <codes>", "policy models set: ordered overrides of the strong class (comma-separated)").option("--class-map <pairs>", "policy models set: comma-separated <taskClass>=<modelClass> pairs").option("--pins <class-only|allowed>", "policy models set: may a composed definition pin a concrete code").option("--fallback <same-class|same-provider>", "policy models set: where a failed leg may hop to").option("--enabled <on|off>", "policy autonomy set: may a start inside the envelope skip the consent card").option("--max-duration <seconds>", "policy autonomy set: the envelope\u2019s duration bound, in seconds").option("--max-actions <n>", "policy autonomy set: the envelope\u2019s estimated-actions bound").option("--max-runs-per-hour <n>", "policy autonomy set: autonomous starts per hour, per agent").option("--forms <list>", "policy autonomy set: comma-separated forms the envelope admits (graph,script,static)").option("--clear <keys>", "policy autonomy set: comma-separated members to clear back to the platform default").option("--agent <agentId>", "policy autonomy: not supported \u2014 no route writes a per-agent envelope (see the refusal)").option("--kind <kind>", "clear-gate: the gate kind to clear (e.g. model_policy)").option("--after <seq>", "watch: replay from seq").option("--timeout <s>", "watch / start --follow: give up after s seconds while the run is still live (exit 7)").option("--events", "watch: print raw frames").option("--wait-for-human", "watch / start --follow: keep following through a human boundary (approval, input, signal, park) instead of exiting 8").option("--reason <text>", "cancel: reason").option("--step <id>", "resume/retry-step/resolve-step/logs: step id").option("--outcome <skip|complete|fail>", "resolve-step: the decision on the parked step (--action is accepted too)").option("--action <skip|complete|fail>", "resolve-step: alias of --outcome").option("--output <json|@file>", "resolve-step: the output a completed step would have produced (required with --outcome complete)").option("--credits <n>", "raise-budget: the new priced cap of a budget-parked run, in the run's own budget unit \u2014 credits, or actions on a seat plan (above the current one)").option("--max-steps <n>", "raise-budget: the new step cap").option("--max-job-seconds <n>", "raise-budget: the new Job-tier seconds cap").option("--max-duration-seconds <n>", "raise-budget: the new wall-clock cap").option("--data <json|@file>", "resume: resumeData").option("--approval <id>", "approve/approval-payload: the wfa_\u2026 approval id (lua workflows status <runId> --steps --json \u2192 suspend.approvalId), not the step id").option("--path <array.path>", "approval-payload: page one array of a large payload (--cursor / --limit inside it)").option("--decision <approve|deny>", "approve: decision (default approve)").option("--note <text>", "approve/retry-step/resolve-step/raise-budget/goals close: note").option("--edit <json|@file>", "approve: edited payload (small inline edits)").option("--fingerprint <f>", "approve: payloadFingerprint (mandatory with --edit)").option("--payload <json|@file>", "signal: payload").option("--dedupe-key <key>", "signal: dedupe key").option("--local", "replay: replay locally against the compiled artifact").option("--since <dur>", "logs: only events at/after this time (Nd/Nh/Nm or ISO) \xB7 archive-runs: window").option("--yes", "delete/delete-run/schedules delete: skip confirmation").option("--force", "delete: cancel in-flight runs first \xB7 run: seed from a changed graph \xB7 export: overwrite files").option("--step-output <id=json>", "run: complete a step with this output (repeatable)", collect, []).option("--approve <id[=@payload]>", "run: pre-answer an approval (repeatable)", collect, []).option("--deny <id[=@reason]>", "run: pre-deny an approval (repeatable)", collect, []).option("--signal <name=json>", "run: pre-supply a waitForSignal payload (repeatable)", collect, []).option("--from-run <runId>", "run: seed completed steps from a real run").option("--record <dir>", "run: record agent/tool outputs as fixtures").option("--fixtures <dir>", "run: replay recorded fixtures").option("--step-wall <s>", "run: per-step wall in seconds (default 600)").option("--job-wall <s>", "run: virtual wall for tier:'job' steps \u2014 splits at 14400 s segments, > 86400 is exit 2").option("--ledger-out <file>", "run: write the in-memory ledger as JSON").option("--agents <fake|live>", "run: fake agent steps (default) or call the dev API").option("--now <iso>", "run: virtual clock start").option("--park <id>", "run: simulate a platform-fault park of this step (repeatable)", collect, []).option("--fast-retries", "run: collapse retry backoff waits to 0").option("--real-time", "run: actually wait on sleeps/backoffs instead of fast-forwarding").option("--artefacts-dir <dir>", "run: back ctx.artefacts.* on disk").option("--workspace <dir>", "run: the checkout Job-tier code steps run in (ctx.workspace + ctx.exec / ctx.$)").option("--env <KEY=value>", "run: local env.template() overlay (repeatable; missing key \u21D2 exit 2)", collect, []).option("--max-ticks <n>", "run (script form): tick cap before SCRIPT_TICK_LIMIT (default 64)").option("--until <iso>", "archive-runs: window end").option("--out <dir>", "archive-runs: destination dir (archive-index.ndjson + <runId>.zip) \xB7 export: target dir").option("--concurrency <n>", "archive-runs: parallel exports (default 2, max 5)").option("--no-inputs", "archive-runs: exclude run inputs from the bundle").option("--no-artefacts", "archive-runs: exclude artefacts from the bundle").option("--retention-days <n>", "archive-runs: org run retention (default 90) \u2014 --since must fit retention \u2212 7 d").option("--connection <id>", "archive-runs: org storage connection for s3:// / gs:// sinks").option("--release", "workspace: release the run workspace (R42)").option("--attempt <n>", "job-logs: attempt (default latest)").option("--tail <n>", "job-logs: log lines (1..2000, default 200)").option("--objective <text>", "goals create: the objective (\u2264 2000 chars)").option("--judge-predicate <spec>", "goals create: deterministic judge \u2014 '<path> <op> [value]' (e.g. 'output.done truthy'), JSON or @file").option("--judge-agent <agentId|'$self'>", "goals create: judge agent \u2014 write '$self' quoted (or self); it needs --judge-role").option("--judge-role <json|@file>", "goals create: D25 role {name,instructions,tools} for a '$self' judge").option("--schema <json|@file>", "goals create: judge output JsonSchema (must declare a boolean `done`)").option("--cadence <cron|json|@file>", "goals create/schedules create: cadence entry (repeatable, \u2264 5); goals: none \u21D2 immediate", collect, []).option("--timezone <tz>", "goals create/edit/schedules create: IANA timezone for bare cron cadences").option("--notify <emailApp|email|app|off>", "schedules create: where each fire notifies").option("--backfill-on-enable <n|none>", "schedules create/patch/resume: replay \u2264 n missed fires on re-enable (patch: none clears it)").option("--backfill-now", "schedules resume (or patch --paused false): one-shot backfill on THIS re-enable").option("--paused <true|false>", "schedules patch: pause (true) or re-enable (false) the schedule").option("--max-runs <n>", "goals create/edit/raise: iteration cap (1..100)").option("--max-total-credits <n>", "goals create: lineage-wide credit gate").option("--max-credits <n|none>", "goals edit/raise: lineage-wide credit gate (edit: none clears it)").option("--every <interval>", "goals edit/schedules create: interval cadence \u2014 900, 15m, 2h (whole minutes, \u2265 60s)").option("--if-match <updatedAt>", "goals edit/raise: refuse the write if the goal changed since this updatedAt").addHelpText("after", `
84892
+ program2.command("workflows [action] [target] [extra]").description("\u{1F9ED} Manage workflows and their runs (list, start, watch, cancel, resume, retry-step, resolve-step, raise-budget, approve, signal, replay, export, schedules)").option("-i, --workflow-name <name>", "Workflow name (or id)").option("-r, --run-id <id>", "Run id").option("-v, --workflow-version <ver>", "deploy/start/export/goals create/schedules create: a semver, 'latest' (newest push) or a version id").option("--json", "Print the raw {success,data} envelope").option("--all", "list: include dynamic workflows").option("--input <json|@file>", "start/run/goals create/schedules create: run input").option("--idempotency-key <key>", "start: idempotency key").option("--correlation-key <key>", "start/runs: correlation key").option("--tag <tag>", "start/runs/schedules create: tag (repeatable, \u2264 10)", collect, []).option("--budget-credits <n>", "start/schedules create/goals create: run budget, in the run's own unit \u2014 credits, or actions on a seat plan").option("--budget-actions <n>", "start/schedules create/goals create: alias of --budget-credits (seat plans)").option("--wait <s>", "start: server long-poll \u2264 55 s").option("--follow", "start/logs: attach watch").option("--status <status>", "runs/goals list: filter by status").option("--workflow <name>", "runs: filter by workflow").option("--limit <n>", "runs/goals list/approval-payload --path: page size").option("--cursor <c>", "runs/goals list/approval-payload --path: page cursor").option("--sort <field>", "runs: -createdAt|createdAt|-durationMs|durationMs").option("--steps", "status: per-step table").option("--strict", "status: exit 4/5 by terminal status, 6 for a gated run").option("--compose <on|off>", "policy models set: may the composer be shown the model menu").option("--max-class <fast|balanced|strong>", "policy models set: ceiling for class requests and the class map").option("--consent-actions <n>", "policy models set: estimated actions above which a composed run shows the card").option("--allow <codes>", "policy models set: comma-separated approved codes to narrow the set to").option("--class-fast <codes>", "policy models set: ordered overrides of the fast class (comma-separated)").option("--class-balanced <codes>", "policy models set: ordered overrides of the balanced class (comma-separated)").option("--class-strong <codes>", "policy models set: ordered overrides of the strong class (comma-separated)").option("--class-map <pairs>", "policy models set: comma-separated <taskClass>=<modelClass> pairs").option("--pins <class-only|allowed>", "policy models set: may a composed definition pin a concrete code").option("--fallback <same-class|same-provider>", "policy models set: where a failed leg may hop to").option("--enabled <on|off>", "policy autonomy set: may a start inside the envelope skip the consent card").option("--max-duration <seconds>", "policy autonomy set: the envelope\u2019s duration bound, in seconds").option("--max-actions <n>", "policy autonomy set: the envelope\u2019s estimated-actions bound").option("--max-runs-per-hour <n>", "policy autonomy set: autonomous starts per hour, per agent").option("--forms <list>", "policy autonomy set: comma-separated forms the envelope admits (graph,script,static)").option("--clear <keys>", "policy autonomy set: comma-separated members to clear back to the platform default").option("--agent <agentId>", "policy autonomy: not supported \u2014 no route writes a per-agent envelope (see the refusal)").option("--kind <kind>", "clear-gate: the gate kind to clear (e.g. model_policy)").option("--after <seq>", "watch: replay from seq").option("--timeout <s>", "watch / start --follow: give up after s seconds while the run is still live (exit 7)").option("--events", "watch: print raw frames").option("--wait-for-human", "watch / start --follow: keep following through a human boundary (approval, input, signal, park) instead of exiting 8").option("--reason <text>", "cancel: reason").option("--step <id>", "resume/retry-step/resolve-step/logs: step id").option("--outcome <skip|complete|fail>", "resolve-step: the decision on the parked step (--action is accepted too)").option("--action <skip|complete|fail>", "resolve-step: alias of --outcome").option("--output <json|@file>", "resolve-step: the output a completed step would have produced (required with --outcome complete)").option("--credits <n>", "raise-budget: the new priced cap of a budget-parked run, in the run's own budget unit \u2014 credits, or actions on a seat plan (above the current one)").option("--actions <n>", "raise-budget: alias of --credits (seat plans)").option("--max-steps <n>", "raise-budget: the new step cap").option("--max-job-seconds <n>", "raise-budget: the new Job-tier seconds cap").option("--max-duration-seconds <n>", "raise-budget: the new wall-clock cap").option("--data <json|@file>", "resume: resumeData").option("--approval <id>", "approve/approval-payload: the wfa_\u2026 approval id (lua workflows status <runId> --steps --json \u2192 suspend.approvalId), not the step id").option("--path <array.path>", "approval-payload: page one array of a large payload (--cursor / --limit inside it)").option("--decision <approve|deny>", "approve: decision (default approve)").option("--note <text>", "approve/retry-step/resolve-step/raise-budget/goals close: note").option("--edit <json|@file>", "approve: edited payload (small inline edits)").option("--fingerprint <f>", "approve: payloadFingerprint (mandatory with --edit)").option("--payload <json|@file>", "signal: payload").option("--dedupe-key <key>", "signal: dedupe key").option("--local", "replay: replay locally against the compiled artifact").option("--since <dur>", "logs: only events at/after this time (Nd/Nh/Nm or ISO) \xB7 archive-runs: window").option("--yes", "delete/delete-run/schedules delete: skip confirmation").option("--force", "delete: cancel in-flight runs first \xB7 run: seed from a changed graph \xB7 export: overwrite files").option("--step-output <id=json>", "run: complete a step with this output (repeatable)", collect, []).option("--approve <id[=@payload]>", "run: pre-answer an approval (repeatable)", collect, []).option("--deny <id[=@reason]>", "run: pre-deny an approval (repeatable)", collect, []).option("--signal <name=json>", "run: pre-supply a waitForSignal payload (repeatable)", collect, []).option("--from-run <runId>", "run: seed completed steps from a real run").option("--record <dir>", "run: record live agent replies as fixtures (needs --agents live; tool steps never run offline)").option("--fixtures <dir>", "run: replay recorded fixtures").option("--step-wall <s>", "run: per-step wall in seconds (default 600)").option("--job-wall <s>", "run: virtual wall for tier:'job' steps \u2014 splits at 14400 s segments, > 86400 is exit 2").option("--ledger-out <file>", "run: write the in-memory ledger as JSON").option("--agents <fake|live>", "run: fake agent steps (default) or call the dev API").option("--now <iso>", "run: virtual clock start").option("--park <id>", "run: simulate a platform-fault park of this step (repeatable)", collect, []).option("--fast-retries", "run: collapse retry backoff waits to 0").option("--real-time", "run: actually wait on sleeps/backoffs instead of fast-forwarding").option("--artefacts-dir <dir>", "run: back ctx.artefacts.* on disk").option("--workspace <dir>", "run: the checkout Job-tier code steps run in (ctx.workspace + ctx.exec / ctx.$)").option("--env <KEY=value>", "run: local env.template() overlay (repeatable; missing key \u21D2 exit 2)", collect, []).option("--max-ticks <n>", "run (script form): tick cap before SCRIPT_TICK_LIMIT (default 64)").option("--until <iso>", "archive-runs: window end").option("--out <dir>", "archive-runs: destination dir (archive-index.ndjson + <runId>.zip) \xB7 export: target dir").option("--concurrency <n>", "archive-runs: parallel exports (default 2, max 5)").option("--no-inputs", "archive-runs: exclude run inputs from the bundle").option("--no-artefacts", "archive-runs: exclude artefacts from the bundle").option("--retention-days <n>", "archive-runs: org run retention (default 90) \u2014 --since must fit retention \u2212 7 d").option("--connection <id>", "archive-runs: org storage connection for s3:// / gs:// sinks").option("--release", "workspace: release the run workspace (R42)").option("--attempt <n>", "job-logs: attempt (default latest)").option("--tail <n>", "job-logs: log lines (1..2000, default 200)").option("--objective <text>", "goals create: the objective (\u2264 2000 chars)").option("--judge-predicate <spec>", "goals create: deterministic judge \u2014 '<path> <op> [value]' (e.g. 'output.done truthy'), JSON or @file").option("--judge-agent <agentId|'$self'>", "goals create: judge agent \u2014 write '$self' quoted (or self); it needs --judge-role").option("--judge-role <json|@file>", "goals create: D25 role {name,instructions,tools} for a '$self' judge").option("--schema <json|@file>", "goals create: judge output JsonSchema (must declare a boolean `done`)").option("--cadence <cron|json|@file>", "goals create/schedules create: cadence entry (repeatable, \u2264 5); goals: none \u21D2 immediate", collect, []).option("--timezone <tz>", "goals create/edit/schedules create: IANA timezone for bare cron cadences").option("--notify <emailApp|email|app|off>", "schedules create: where each fire notifies").option("--backfill-on-enable <n|none>", "schedules create/patch/resume: replay \u2264 n missed fires on re-enable (patch: none clears it)").option("--backfill-now", "schedules resume (or patch --paused false): one-shot backfill on THIS re-enable").option("--paused <true|false>", "schedules patch: pause (true) or re-enable (false) the schedule").option("--max-runs <n>", "goals create/edit/raise: iteration cap (1..100)").option("--max-total-credits <n>", "goals create: lineage-wide credit gate").option("--max-credits <n|none>", "goals edit/raise: lineage-wide credit gate (edit: none clears it)").option("--every <interval>", "goals edit/schedules create: interval cadence \u2014 900, 15m, 2h (whole minutes, \u2265 60s)").option("--if-match <updatedAt>", "goals edit/raise: refuse the write if the goal changed since this updatedAt").addHelpText("after", `
84388
84893
  Arguments:
84389
84894
  action list \xB7 view \xB7 versions \xB7 deploy \xB7 activate \xB7 deactivate \xB7 start \xB7 run \xB7 runs \xB7 status \xB7
84390
84895
  watch \xB7 cancel \xB7 resume \xB7 retry-step \xB7 resolve-step \xB7 raise-budget \xB7 approve \xB7 approval-payload \xB7