lua-cli 3.43.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) {
@@ -17839,6 +18073,19 @@ var init_types = __esm({
17839
18073
 
17840
18074
  // src/api/http.client.ts
17841
18075
  import { randomUUID as randomUUID3 } from "crypto";
18076
+ function abortedResponse() {
18077
+ return {
18078
+ success: false,
18079
+ error: {
18080
+ message: "Request aborted",
18081
+ code: REQUEST_ABORTED_CODE,
18082
+ statusCode: 0
18083
+ }
18084
+ };
18085
+ }
18086
+ function isAborted(signal) {
18087
+ return !!signal && signal.aborted === true;
18088
+ }
17842
18089
  async function classifyErrorResponse(response) {
17843
18090
  let errorData;
17844
18091
  try {
@@ -17994,7 +18241,7 @@ function coreDrainApiRetryDelayMs(error) {
17994
18241
  const delayMs = retryAfterSeconds * 1e3;
17995
18242
  return Math.min(Math.max(0, delayMs), CORE_DRAINING_MAX_RETRY_MS);
17996
18243
  }
17997
- var DEFAULT_REQUEST_TIMEOUT_MS, HttpClient;
18244
+ var DEFAULT_REQUEST_TIMEOUT_MS, REQUEST_ABORTED_CODE, HttpClient;
17998
18245
  var init_http_client = __esm({
17999
18246
  "src/api/http.client.ts"() {
18000
18247
  "use strict";
@@ -18005,6 +18252,9 @@ var init_http_client = __esm({
18005
18252
  init_lua_fetch();
18006
18253
  init_request_credential();
18007
18254
  DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
18255
+ REQUEST_ABORTED_CODE = "REQUEST_ABORTED";
18256
+ __name(abortedResponse, "abortedResponse");
18257
+ __name(isAborted, "isAborted");
18008
18258
  HttpClient = class {
18009
18259
  static {
18010
18260
  __name(this, "HttpClient");
@@ -18027,9 +18277,17 @@ var init_http_client = __esm({
18027
18277
  * @private
18028
18278
  */
18029
18279
  async request(url, options = {}, overrides) {
18280
+ const callerSignal = overrides?.signal;
18281
+ if (isAborted(callerSignal)) return abortedResponse();
18030
18282
  const controller = new AbortController();
18031
18283
  const timeoutMs = overrides?.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
18032
18284
  const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
18285
+ const onCallerAbort = /* @__PURE__ */ __name(() => controller.abort(), "onCallerAbort");
18286
+ if (typeof callerSignal?.addEventListener === "function") {
18287
+ callerSignal.addEventListener("abort", onCallerAbort, {
18288
+ once: true
18289
+ });
18290
+ }
18033
18291
  try {
18034
18292
  const authorization = this.requestCredential ? `Bearer ${await bearerFor(this.requestCredential)}` : void 0;
18035
18293
  const response = await luaFetch(url, {
@@ -18051,6 +18309,7 @@ var init_http_client = __esm({
18051
18309
  try {
18052
18310
  data = await response.json();
18053
18311
  } catch (jsonError) {
18312
+ if (isAborted(callerSignal)) throw jsonError;
18054
18313
  data = {};
18055
18314
  }
18056
18315
  if (typeof data === "object" && data !== null && "success" in data) {
@@ -18068,6 +18327,9 @@ var init_http_client = __esm({
18068
18327
  if (isAccessDeniedError(error)) {
18069
18328
  throw error;
18070
18329
  }
18330
+ if (isAborted(callerSignal)) {
18331
+ return abortedResponse();
18332
+ }
18071
18333
  if (error instanceof DOMException && error.name === "AbortError") {
18072
18334
  return {
18073
18335
  success: false,
@@ -18084,9 +18346,36 @@ var init_http_client = __esm({
18084
18346
  statusCode: 0
18085
18347
  }
18086
18348
  };
18349
+ } finally {
18350
+ clearTimeout(timeoutId);
18351
+ if (typeof callerSignal?.removeEventListener === "function") {
18352
+ callerSignal.removeEventListener("abort", onCallerAbort);
18353
+ }
18087
18354
  }
18088
18355
  }
18089
18356
  /**
18357
+ * A backoff wait the caller's signal can cut short (BAC-1097): resolves at `ms` or on abort, whichever is
18358
+ * first, and never leaves the timer or the listener behind. The caller re-checks `signal.aborted` afterwards.
18359
+ * @private
18360
+ */
18361
+ sleep(ms, signal) {
18362
+ if (isAborted(signal)) return Promise.resolve();
18363
+ const listenable = typeof signal?.addEventListener === "function";
18364
+ return new Promise((resolve7) => {
18365
+ const onAbort = /* @__PURE__ */ __name(() => {
18366
+ clearTimeout(timer);
18367
+ resolve7();
18368
+ }, "onAbort");
18369
+ const timer = setTimeout(() => {
18370
+ if (listenable) signal.removeEventListener("abort", onAbort);
18371
+ resolve7();
18372
+ }, ms);
18373
+ if (listenable) signal.addEventListener("abort", onAbort, {
18374
+ once: true
18375
+ });
18376
+ });
18377
+ }
18378
+ /**
18090
18379
  * Non-2xx classification shared by `request` and `httpStream` (WF-204): 401s become
18091
18380
  * `AuthenticationError` (ownership vs credential), 403s throw, everything else returns the
18092
18381
  * `{ success:false, error }` envelope with the server body spread in.
@@ -18154,19 +18443,22 @@ var init_http_client = __esm({
18154
18443
  }
18155
18444
  }
18156
18445
  let lastResult = null;
18446
+ const signal = overrides?.signal;
18157
18447
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
18448
+ if (isAborted(signal)) return abortedResponse();
18158
18449
  try {
18159
18450
  const result = await this.request(url, options, overrides);
18160
18451
  if (result.success || !result.error || !this.isRetryableStatus(result.error.statusCode || 0)) {
18161
18452
  return result;
18162
18453
  }
18454
+ if (isAborted(signal)) return result;
18163
18455
  lastResult = result;
18164
18456
  } catch (error) {
18165
18457
  throw error;
18166
18458
  }
18167
18459
  if (attempt < maxRetries) {
18168
18460
  const backoff = this.retryDelayMs(attempt, lastResult?.error, options.method);
18169
- await new Promise((resolve7) => setTimeout(resolve7, backoff));
18461
+ await this.sleep(backoff, signal);
18170
18462
  }
18171
18463
  }
18172
18464
  return lastResult;
@@ -18215,7 +18507,8 @@ var init_http_client = __esm({
18215
18507
  async httpPostCoreDrainRetry(url, data, headers, overrides) {
18216
18508
  const first = await this.httpPostOnce(url, data, headers, overrides);
18217
18509
  if (!isCoreDrainApiError(first.error)) return first;
18218
- await new Promise((resolve7) => setTimeout(resolve7, coreDrainApiRetryDelayMs(first.error)));
18510
+ await this.sleep(coreDrainApiRetryDelayMs(first.error), overrides?.signal);
18511
+ if (isAborted(overrides?.signal)) return abortedResponse();
18219
18512
  return this.httpPostOnce(url, data, headers, overrides);
18220
18513
  }
18221
18514
  /**
@@ -20702,6 +20995,23 @@ function setCiMode(enabled) {
20702
20995
  function isCiModeEnabled() {
20703
20996
  return isCiMode;
20704
20997
  }
20998
+ function setJsonOutputRequested(enabled) {
20999
+ jsonOutputRequested = enabled;
21000
+ }
21001
+ function isJsonOutputRequested() {
21002
+ return jsonOutputRequested;
21003
+ }
21004
+ function commandRequestedJson(command) {
21005
+ for (let current = command; current; current = current.parent) {
21006
+ if (current.getOptionValueSource("json") === "cli" && current.getOptionValue("json")) return true;
21007
+ }
21008
+ return false;
21009
+ }
21010
+ function registerJsonErrorEnvelope(program2) {
21011
+ program2.hook("preAction", (_thisCommand, actionCommand) => {
21012
+ setJsonOutputRequested(commandRequestedJson(actionCommand));
21013
+ });
21014
+ }
20705
21015
  async function showUpdateWarningIfNeeded(versionCheckPromise) {
20706
21016
  try {
20707
21017
  const result = await versionCheckPromise;
@@ -20777,7 +21087,8 @@ async function withErrorHandling(commandFn, commandName, opts) {
20777
21087
  }
20778
21088
  let json2 = false;
20779
21089
  try {
20780
- json2 = typeof opts?.json === "function" ? !!opts.json() : !!opts?.json;
21090
+ if (opts?.json === void 0) json2 = isJsonOutputRequested();
21091
+ else json2 = typeof opts.json === "function" ? !!opts.json() : !!opts.json;
20781
21092
  } catch {
20782
21093
  }
20783
21094
  const reported = reportCliError(error, {
@@ -20801,7 +21112,7 @@ function writeSuccess(message) {
20801
21112
  function writeError(message) {
20802
21113
  process.stderr.write("\r\x1B[K" + message + "\n");
20803
21114
  }
20804
- var isCiMode;
21115
+ var isCiMode, jsonOutputRequested;
20805
21116
  var init_cli = __esm({
20806
21117
  "src/utils/cli.ts"() {
20807
21118
  "use strict";
@@ -20815,6 +21126,11 @@ var init_cli = __esm({
20815
21126
  isCiMode = false;
20816
21127
  __name(setCiMode, "setCiMode");
20817
21128
  __name(isCiModeEnabled, "isCiModeEnabled");
21129
+ jsonOutputRequested = false;
21130
+ __name(setJsonOutputRequested, "setJsonOutputRequested");
21131
+ __name(isJsonOutputRequested, "isJsonOutputRequested");
21132
+ __name(commandRequestedJson, "commandRequestedJson");
21133
+ __name(registerJsonErrorEnvelope, "registerJsonErrorEnvelope");
20818
21134
  __name(showUpdateWarningIfNeeded, "showUpdateWarningIfNeeded");
20819
21135
  __name(withErrorHandling, "withErrorHandling");
20820
21136
  __name(clearPromptLines, "clearPromptLines");
@@ -20932,6 +21248,10 @@ var init_cli_credentials_api_service = __esm({
20932
21248
  async createCliCredential(firebaseIdToken, request2) {
20933
21249
  return this.httpPostOnce("/admin/users/me/credentials/cli", request2, bearerHeaders(firebaseIdToken));
20934
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
+ }
20935
21255
  };
20936
21256
  }
20937
21257
  });
@@ -29005,15 +29325,15 @@ function parseWorkflowScript(script, fileName) {
29005
29325
  if (ts4.isNewExpression(node)) {
29006
29326
  const callee = node.expression;
29007
29327
  if (ts4.isIdentifier(callee) && callee.text === "Function") nondeterminism(node, "Function", "`new Function` is forbidden");
29008
- 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()");
29009
29329
  }
29010
29330
  if (ts4.isCallExpression(node)) {
29011
29331
  const callee = node.expression;
29012
29332
  if (ts4.isPropertyAccessExpression(callee) && ts4.isIdentifier(callee.expression)) {
29013
29333
  const root = callee.expression.text;
29014
29334
  const member = callee.name.text;
29015
- if (root === "Date" && member === "now") nondeterminism(node, "Date.now", "`Date.now()` \u2014 use env.now()");
29016
- 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()");
29017
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"));
29018
29338
  }
29019
29339
  if (ts4.isIdentifier(callee) && callee.text === "Function") nondeterminism(node, "Function", "`Function()` is forbidden");
@@ -32961,10 +33281,15 @@ var init_webhook_api_service = __esm({
32961
33281
  });
32962
33282
 
32963
33283
  // src/instances/user.instance.ts
33284
+ function omit(source, key) {
33285
+ const { [key]: _dropped, ...rest } = source;
33286
+ return rest;
33287
+ }
32964
33288
  var UserDataInstance;
32965
33289
  var init_user_instance = __esm({
32966
33290
  "src/instances/user.instance.ts"() {
32967
33291
  "use strict";
33292
+ __name(omit, "omit");
32968
33293
  UserDataInstance = class {
32969
33294
  static {
32970
33295
  __name(this, "UserDataInstance");
@@ -32980,7 +33305,12 @@ var init_user_instance = __esm({
32980
33305
  * @returns Proxied instance that allows direct access to data properties
32981
33306
  */
32982
33307
  constructor(api, data, profile) {
32983
- this.data = data && typeof data === "object" ? data : {};
33308
+ Object.defineProperty(this, "data", {
33309
+ value: data && typeof data === "object" ? data : {},
33310
+ writable: true,
33311
+ enumerable: false,
33312
+ configurable: true
33313
+ });
32984
33314
  Object.defineProperty(this, "userAPI", {
32985
33315
  value: api,
32986
33316
  writable: true,
@@ -33092,7 +33422,8 @@ var init_user_instance = __esm({
33092
33422
  */
33093
33423
  async update(data) {
33094
33424
  try {
33095
- const response = await this.userAPI.update(data);
33425
+ const payload = data && data.data === this.data ? omit(data, "data") : data;
33426
+ const response = await this.userAPI.update(payload);
33096
33427
  this.data = response;
33097
33428
  return this.data;
33098
33429
  } catch (error) {
@@ -34993,6 +35324,29 @@ var init_ai_api_service = __esm({
34993
35324
  }
34994
35325
  return result.data;
34995
35326
  }
35327
+ async image(body) {
35328
+ return this.httpPost(`/developer/ai/${this.agentId}/image`, body, {});
35329
+ }
35330
+ /**
35331
+ * Handles the simplified-vs-full-options branching for `AI.image`.
35332
+ * Simplified (`AI.image(prompt, options?)`) returns the hosted CDN url string; the options overload
35333
+ * (`AI.image({ prompt, ... })`) returns the full `{ url, model, provider }`.
35334
+ */
35335
+ async imageForSandbox(promptOrOptions, options) {
35336
+ const simplified = typeof promptOrOptions === "string";
35337
+ const body = simplified ? {
35338
+ prompt: promptOrOptions,
35339
+ ...options
35340
+ } : promptOrOptions;
35341
+ const result = await this.image(body);
35342
+ if (!result.success) {
35343
+ throw new Error(result.error?.message || "AI image generation failed");
35344
+ }
35345
+ if (!result.data) {
35346
+ throw new Error("AI image generation failed: empty response");
35347
+ }
35348
+ return simplified ? result.data.url : result.data;
35349
+ }
34996
35350
  };
34997
35351
  }
34998
35352
  });
@@ -35379,6 +35733,12 @@ var init_connection_requests_api_service = __esm({
35379
35733
  });
35380
35734
 
35381
35735
  // src/api/agents.api.service.ts
35736
+ function isAborted2(signal) {
35737
+ return !!signal && signal.aborted === true;
35738
+ }
35739
+ function abortReason2(signal) {
35740
+ return signal.reason ?? new DOMException("The operation was aborted", "AbortError");
35741
+ }
35382
35742
  function toInvocationOutput(data, callerThreadId) {
35383
35743
  const toolNames = /* @__PURE__ */ new Set();
35384
35744
  for (const step3 of Array.isArray(data.steps) ? data.steps : []) {
@@ -35464,9 +35824,15 @@ var init_agents_api_service = __esm({
35464
35824
  });
35465
35825
  if (body.identifier) query.set("identifier", body.identifier);
35466
35826
  const chatBody = this.toChatGenerateBody(body);
35467
- return this.httpPostCoreDrainRetry(`/chat/generate/${targetAgentId}?${query.toString()}`, chatBody, {}, typeof body.timeoutMs === "number" ? {
35468
- timeoutMs: body.timeoutMs
35469
- } : void 0);
35827
+ const overrides = {
35828
+ ...typeof body.timeoutMs === "number" ? {
35829
+ timeoutMs: body.timeoutMs
35830
+ } : {},
35831
+ ...body.signal ? {
35832
+ signal: body.signal
35833
+ } : {}
35834
+ };
35835
+ return this.httpPostCoreDrainRetry(`/chat/generate/${targetAgentId}?${query.toString()}`, chatBody, {}, Object.keys(overrides).length > 0 ? overrides : void 0);
35470
35836
  }
35471
35837
  /**
35472
35838
  * Sandbox overload: mirrors the `AI.generate` pattern where the simplified
@@ -35477,15 +35843,29 @@ var init_agents_api_service = __esm({
35477
35843
  const input = typeof promptOrInput === "string" ? {
35478
35844
  prompt: promptOrInput
35479
35845
  } : promptOrInput;
35846
+ if (isAborted2(input.signal)) throw abortReason2(input.signal);
35480
35847
  const result = await this.invoke(targetAgentId, input);
35481
35848
  if (!result.success) {
35849
+ if (isAborted2(input.signal)) throw abortReason2(input.signal);
35482
35850
  throw new Error(result.error?.message || "Agent invocation failed");
35483
35851
  }
35484
35852
  if (!result.data) {
35485
35853
  throw new Error("Agent invocation failed: empty response");
35486
35854
  }
35487
- if (typeof promptOrInput === "string") return result.data.text ?? "";
35488
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
+ }
35489
35869
  if (data?.type === "preprocessor_blocked") {
35490
35870
  throw Object.assign(new Error(data.text || "Agent invocation blocked by preprocessor"), {
35491
35871
  name: "AgentInvocationError",
@@ -35500,6 +35880,7 @@ var init_agents_api_service = __esm({
35500
35880
  stage: data.governanceBlock?.stage
35501
35881
  });
35502
35882
  }
35883
+ if (typeof promptOrInput === "string") return data.text ?? "";
35503
35884
  return toInvocationOutput(data, input.threadId);
35504
35885
  }
35505
35886
  /**
@@ -35520,7 +35901,8 @@ var init_agents_api_service = __esm({
35520
35901
  code
35521
35902
  });
35522
35903
  }, "refuse");
35523
- 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") {
35524
35906
  refuse("supervision_release_offline_refused", `${op} is refused offline: a local test never changes a live agent`);
35525
35907
  }
35526
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.
@@ -35688,6 +36070,8 @@ var init_agents_api_service = __esm({
35688
36070
  case "evals.cancel":
35689
36071
  case "owner.notify":
35690
36072
  case "connections.assign":
36073
+ // SV (LUA-1080) — the live pointers are not exposed on a developer route: platform only.
36074
+ case "primitives.deployed":
35691
36075
  return refuse("supervision_offline_unsupported", `${op} is not available offline; run it on the platform`);
35692
36076
  default:
35693
36077
  return refuse("supervision_unknown_op", `Unknown supervision operation ${String(op)}`);
@@ -35724,6 +36108,8 @@ var init_agents_api_service = __esm({
35724
36108
  };
35725
36109
  }
35726
36110
  };
36111
+ __name(isAborted2, "isAborted");
36112
+ __name(abortReason2, "abortReason");
35727
36113
  __name(toInvocationOutput, "toInvocationOutput");
35728
36114
  __name(runSummary, "runSummary");
35729
36115
  __name(supervisedCheck, "supervisedCheck");
@@ -36363,9 +36749,22 @@ function createWorkflowsRuntime(getApi) {
36363
36749
  },
36364
36750
  async list(opts = {}) {
36365
36751
  const api = await getApi();
36366
- 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
+ }
36367
36766
  const page = unwrap(await api.getRuns({
36368
- workflowId: ref.workflowId,
36767
+ workflowId,
36369
36768
  status: opts.status,
36370
36769
  limit: opts.limit,
36371
36770
  correlationKey: opts.correlationKey,
@@ -36403,7 +36802,10 @@ function createWorkflowsRuntime(getApi) {
36403
36802
  ...opts
36404
36803
  }), "Workflows.signalByKey");
36405
36804
  },
36406
- 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
+ },
36407
36809
  // Goals are scoped to the bound agent: the IF-21 `agentId` argument is parity with the HTTP twin
36408
36810
  // (`/workflows/:agentId/goals`), never a way to reach another agent's goals (403 otherwise).
36409
36811
  async setGoal(agentId, goal) {
@@ -36446,7 +36848,7 @@ function createWorkflowsRuntime(getApi) {
36446
36848
  }
36447
36849
  };
36448
36850
  }
36449
- 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;
36450
36852
  var init_workflow_api_service = __esm({
36451
36853
  "src/api/workflow.api.service.ts"() {
36452
36854
  "use strict";
@@ -36492,15 +36894,13 @@ var init_workflow_api_service = __esm({
36492
36894
  }
36493
36895
  return res.data;
36494
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");
36495
36898
  assertBoundAgent = /* @__PURE__ */ __name((api, agentId, member) => {
36496
36899
  if (agentId && agentId !== api.agentId) {
36497
36900
  throw new WorkflowApiError("FORBIDDEN", `Workflows.${member}: goals are scoped to the bound agent ${api.agentId}`, 403);
36498
36901
  }
36499
36902
  }, "assertBoundAgent");
36500
36903
  pathId = /* @__PURE__ */ __name((id2) => encodeURIComponent(id2), "pathId");
36501
- unavailable = /* @__PURE__ */ __name((member, route) => async () => {
36502
- throw new WorkflowApiError("WORKFLOWS_API_UNAVAILABLE", `Workflows.${member} is not available in this runtime yet (${route} lands with a later wave)`, 501);
36503
- }, "unavailable");
36504
36904
  __name(createWorkflowsRuntime, "createWorkflowsRuntime");
36505
36905
  WorkflowApi = class extends HttpClient {
36506
36906
  static {
@@ -36940,20 +37340,35 @@ var init_device_api_service = __esm({
36940
37340
  return this.httpDelete(`/developer/devices/${this.agentId}/${deviceId}`, {});
36941
37341
  }
36942
37342
  async sendCommand(deviceName, command, payload, timeout) {
36943
- return this.httpPost(`/developer/devices/${this.agentId}/${deviceName}/command`, {
37343
+ return this.httpPost(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/command`, {
36944
37344
  command,
36945
37345
  payload,
36946
37346
  timeout: timeout || 3e4
36947
37347
  }, {});
36948
37348
  }
36949
37349
  async getDeviceStatus(deviceName) {
36950
- return this.httpGet(`/developer/devices/${this.agentId}/${deviceName}/status`, {});
37350
+ return this.httpGet(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/status`, {});
36951
37351
  }
36952
37352
  async enableDevice(deviceName) {
36953
- return this.httpPatch(`/developer/devices/${this.agentId}/${deviceName}/enable`, {}, {});
37353
+ return this.httpPatch(`/developer/devices/${this.agentId}/${encodeURIComponent(deviceName)}/enable`, {}, {});
36954
37354
  }
36955
37355
  async disableDevice(deviceName) {
36956
- 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`, {});
36957
37372
  }
36958
37373
  };
36959
37374
  }
@@ -38417,7 +38832,6 @@ init_credential_operational_context();
38417
38832
  init_command_utils();
38418
38833
  init_cli_error();
38419
38834
  init_cli();
38420
- import inquirer3 from "inquirer";
38421
38835
  import { writeFileSync as writeFileSync7, existsSync as existsSync8 } from "fs";
38422
38836
  import { join as join8 } from "path";
38423
38837
 
@@ -38538,7 +38952,7 @@ __name(injectGovernanceIntoAgent, "injectGovernanceIntoAgent");
38538
38952
  import inquirer2 from "inquirer";
38539
38953
  import chalk from "chalk";
38540
38954
  async function promptAgentChoice() {
38541
- const { agentChoice } = await inquirer2.prompt([
38955
+ const { agentChoice } = await safePrompt([
38542
38956
  {
38543
38957
  type: "list",
38544
38958
  name: "agentChoice",
@@ -38567,7 +38981,7 @@ async function promptOrganizationSelection(orgs) {
38567
38981
  name: org.registeredName || org.name || "Unknown Organization",
38568
38982
  value: org
38569
38983
  }));
38570
- const { selectedOrg } = await inquirer2.prompt([
38984
+ const { selectedOrg } = await safePrompt([
38571
38985
  {
38572
38986
  type: "list",
38573
38987
  name: "selectedOrg",
@@ -38586,7 +39000,7 @@ async function promptAgentSelection(org) {
38586
39000
  name: agent.name,
38587
39001
  value: agent
38588
39002
  }));
38589
- const { selectedAgent } = await inquirer2.prompt([
39003
+ const { selectedAgent } = await safePrompt([
38590
39004
  {
38591
39005
  type: "list",
38592
39006
  name: "selectedAgent",
@@ -38600,7 +39014,7 @@ __name(promptAgentSelection, "promptAgentSelection");
38600
39014
  async function promptMetadataCollection(requiredFields) {
38601
39015
  const metadata = {};
38602
39016
  for (const field of requiredFields) {
38603
- const { [field]: value3 } = await inquirer2.prompt([
39017
+ const { [field]: value3 } = await safePrompt([
38604
39018
  {
38605
39019
  type: "input",
38606
39020
  name: field,
@@ -38614,7 +39028,7 @@ async function promptMetadataCollection(requiredFields) {
38614
39028
  }
38615
39029
  __name(promptMetadataCollection, "promptMetadataCollection");
38616
39030
  async function promptAgentName() {
38617
- const { agentName } = await inquirer2.prompt([
39031
+ const { agentName } = await safePrompt([
38618
39032
  {
38619
39033
  type: "input",
38620
39034
  name: "agentName",
@@ -38650,7 +39064,7 @@ async function promptModelSelection(models) {
38650
39064
  });
38651
39065
  }
38652
39066
  }
38653
- const { selectedModel } = await inquirer2.prompt([
39067
+ const { selectedModel } = await safePrompt([
38654
39068
  {
38655
39069
  type: "list",
38656
39070
  name: "selectedModel",
@@ -38683,7 +39097,7 @@ __name(displayPersonaInstructions, "displayPersonaInstructions");
38683
39097
  async function promptDuplicateOptions(sourceOrg, allOrgs, sourceAgentName) {
38684
39098
  let targetOrg = sourceOrg;
38685
39099
  if (allOrgs.length > 1) {
38686
- const { sameOrg } = await inquirer2.prompt([
39100
+ const { sameOrg } = await safePrompt([
38687
39101
  {
38688
39102
  type: "list",
38689
39103
  name: "sameOrg",
@@ -38707,7 +39121,7 @@ async function promptDuplicateOptions(sourceOrg, allOrgs, sourceAgentName) {
38707
39121
  }
38708
39122
  }
38709
39123
  const defaultName = `${sourceAgentName} (Copy)`;
38710
- const { newName } = await inquirer2.prompt([
39124
+ const { newName } = await safePrompt([
38711
39125
  {
38712
39126
  type: "input",
38713
39127
  name: "newName",
@@ -38716,7 +39130,7 @@ async function promptDuplicateOptions(sourceOrg, allOrgs, sourceAgentName) {
38716
39130
  validate: /* @__PURE__ */ __name((input) => input.trim().length > 0 || "Name is required", "validate")
38717
39131
  }
38718
39132
  ]);
38719
- const { includedBuckets } = await inquirer2.prompt([
39133
+ const { includedBuckets } = await safePrompt([
38720
39134
  {
38721
39135
  type: "checkbox",
38722
39136
  name: "includedBuckets",
@@ -38760,7 +39174,7 @@ async function promptDuplicateOptions(sourceOrg, allOrgs, sourceAgentName) {
38760
39174
  console.log(chalk.white(` Including: ${includedBuckets.length > 0 ? includedBuckets.join(", ") : "core agent definition only"}`));
38761
39175
  console.log(chalk.cyan("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"));
38762
39176
  console.log("");
38763
- const { confirmed } = await inquirer2.prompt([
39177
+ const { confirmed } = await safePrompt([
38764
39178
  {
38765
39179
  type: "confirm",
38766
39180
  name: "confirmed",
@@ -41035,7 +41449,7 @@ async function initCommand(options = {}) {
41035
41449
  writeError("\n\u26A0\uFE0F You don't have access to the agent in this project");
41036
41450
  writeInfo(` Agent ID: ${existingAgentId}
41037
41451
  `);
41038
- const { action } = await inquirer3.prompt([
41452
+ const { action } = await safePrompt([
41039
41453
  {
41040
41454
  type: "list",
41041
41455
  name: "action",
@@ -41072,7 +41486,7 @@ async function initCommand(options = {}) {
41072
41486
  writeInfo("\n\u{1F4CB} Found existing project configuration");
41073
41487
  writeInfo(` Current Agent ID: ${existingAgentId}
41074
41488
  `);
41075
- const { wantSwitch } = await inquirer3.prompt([
41489
+ const { wantSwitch } = await safePrompt([
41076
41490
  {
41077
41491
  type: "list",
41078
41492
  name: "wantSwitch",
@@ -41359,7 +41773,7 @@ __name(createNewAgentNonInteractive, "createNewAgentNonInteractive");
41359
41773
  async function createNewAgentFlow(apiKey, organizations, promoCode) {
41360
41774
  const agentTypes = await fetchAgentTypes(apiKey);
41361
41775
  const selectedAgentType = selectBaseAgentType(agentTypes);
41362
- const { orgChoice } = await inquirer3.prompt([
41776
+ const { orgChoice } = await safePrompt([
41363
41777
  {
41364
41778
  type: "list",
41365
41779
  name: "orgChoice",
@@ -41390,7 +41804,7 @@ async function createNewAgentFlow(apiKey, organizations, promoCode) {
41390
41804
  }
41391
41805
  }
41392
41806
  if (!orgId) {
41393
- const { organizationName } = await inquirer3.prompt([
41807
+ const { organizationName } = await safePrompt([
41394
41808
  {
41395
41809
  type: "input",
41396
41810
  name: "organizationName",
@@ -41518,7 +41932,7 @@ async function promptPersonaReplacement(existingYaml, newPersona) {
41518
41932
  }
41519
41933
  writeInfo("\n\u{1F4DD} Persona Configuration:");
41520
41934
  writeInfo(" Existing persona found in project");
41521
- const { replacePersona } = await inquirer3.prompt([
41935
+ const { replacePersona } = await safePrompt([
41522
41936
  {
41523
41937
  type: "confirm",
41524
41938
  name: "replacePersona",
@@ -41538,7 +41952,7 @@ async function checkAndRestoreBackup(apiKey, agentId, options) {
41538
41952
  }
41539
41953
  const conflicts = checkRestoreConflicts(manifest, targetDir);
41540
41954
  if (!options.autoRestore && conflicts.existingFiles.length > 0) {
41541
- const { confirm } = await inquirer3.prompt([
41955
+ const { confirm } = await safePrompt([
41542
41956
  {
41543
41957
  type: "confirm",
41544
41958
  name: "confirm",
@@ -41587,7 +42001,7 @@ __name(checkAndRestoreBackup, "checkAndRestoreBackup");
41587
42001
  init_request_credential();
41588
42002
  init_cli();
41589
42003
  init_analytics();
41590
- import inquirer4 from "inquirer";
42004
+ import inquirer3 from "inquirer";
41591
42005
  function report(result, requested) {
41592
42006
  const deleted = result.sessionCleared || result.apiKeyCleared;
41593
42007
  if (!deleted) {
@@ -41621,7 +42035,7 @@ async function destroyCommand(options) {
41621
42035
  });
41622
42036
  return;
41623
42037
  }
41624
- const { confirm } = await inquirer4.prompt([
42038
+ const { confirm } = await inquirer3.prompt([
41625
42039
  {
41626
42040
  type: "confirm",
41627
42041
  name: "confirm",
@@ -41770,7 +42184,7 @@ async function sessionsRevokeCommand(sessionId) {
41770
42184
  __name(sessionsRevokeCommand, "sessionsRevokeCommand");
41771
42185
 
41772
42186
  // src/commands/apiKey.ts
41773
- import inquirer5 from "inquirer";
42187
+ import inquirer4 from "inquirer";
41774
42188
  init_request_credential();
41775
42189
  init_cli();
41776
42190
  init_analytics();
@@ -41796,7 +42210,7 @@ async function apiKeyCommand(options) {
41796
42210
  });
41797
42211
  return;
41798
42212
  }
41799
- const { confirm } = await inquirer5.prompt([
42213
+ const { confirm } = await inquirer4.prompt([
41800
42214
  {
41801
42215
  type: "confirm",
41802
42216
  name: "confirm",
@@ -43847,6 +44261,14 @@ function requireExpectActiveId(opts, what) {
43847
44261
  }
43848
44262
  __name(requireExpectActiveId, "requireExpectActiveId");
43849
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");
43850
44272
  function approvalIdsOf(approval) {
43851
44273
  if (approval === void 0 || approval === null) return void 0;
43852
44274
  if (typeof approval !== "object" || Array.isArray(approval)) return {
@@ -43925,6 +44347,20 @@ function buildSupervisionAgentsApi(call2) {
43925
44347
  delete: /* @__PURE__ */ __name8((version) => call2("versions.delete", agentId, {
43926
44348
  version
43927
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"),
43928
44364
  // wave 2 U11
43929
44365
  /**
43930
44366
  * U11 (DOC2 §6.1) — open a TEST SESSION on staged `opts.version`: multi-turn `chat`, `fire`, `effects()` and
@@ -43962,11 +44398,18 @@ function buildSupervisionAgentsApi(call2) {
43962
44398
  }
43963
44399
  }), "push"),
43964
44400
  /** Publish workflow `version`. Compare-and-swap: refused unless `expectActive` is the live version id. */
43965
- deploy: /* @__PURE__ */ __name8(async (workflowId, version, opts) => call2("workflows.deploy", agentId, {
43966
- workflowId,
43967
- version,
43968
- expectActive: requireExpectActiveId(opts, "workflows.deploy")
43969
- }), "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")
43970
44413
  }), "workflows"),
43971
44414
  persona: /* @__PURE__ */ __name8((agentId) => ({
43972
44415
  versions: /* @__PURE__ */ __name8(() => call2("persona.versions", agentId), "versions"),
@@ -43987,6 +44430,12 @@ function buildSupervisionAgentsApi(call2) {
43987
44430
  keys: /* @__PURE__ */ __name8(() => call2("env.keys", agentId), "keys")
43988
44431
  }), "env"),
43989
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
+ /**
43990
44439
  * U25 — supervision events of the target (`observe`): each event of a subscribed kind starts
43991
44440
  * one of the CALLER's own triggers (`triggerName`) with a `source: 'supervision'` body.
43992
44441
  */
@@ -44603,20 +45052,20 @@ init_artifact_loader();
44603
45052
 
44604
45053
  // src/api/threads.offline.ts
44605
45054
  init_dist();
44606
- function unavailable2(member) {
45055
+ function unavailable(member) {
44607
45056
  return Object.assign(new Error(`Threads.${member} only runs on the Lua platform (deployed or sandbox agents), not in lua test / lua dev`), {
44608
45057
  name: "ThreadFollowUpError",
44609
45058
  code: THREAD_FOLLOW_UP_ERRORS.UNAVAILABLE
44610
45059
  });
44611
45060
  }
44612
- __name(unavailable2, "unavailable");
45061
+ __name(unavailable, "unavailable");
44613
45062
  function createOfflineThreadsApi() {
44614
45063
  return {
44615
45064
  open: /* @__PURE__ */ __name(async () => {
44616
- throw unavailable2("open");
45065
+ throw unavailable("open");
44617
45066
  }, "open"),
44618
45067
  followUp: /* @__PURE__ */ __name(async () => {
44619
- throw unavailable2("followUp");
45068
+ throw unavailable("followUp");
44620
45069
  }, "followUp")
44621
45070
  };
44622
45071
  }
@@ -45755,13 +46204,13 @@ async function runWorkflowLocallyInner(rawOpts) {
45755
46204
  let artefactSeq = 0;
45756
46205
  const artefactsApi = /* @__PURE__ */ __name((stepId) => {
45757
46206
  const dir = opts.artefactsDir;
45758
- const unavailable3 = /* @__PURE__ */ __name(() => {
46207
+ const unavailable2 = /* @__PURE__ */ __name(() => {
45759
46208
  throw new StepFailure("ARTEFACTS_NOT_AVAILABLE_OFFLINE", "ctx.artefacts needs --artefacts-dir (03 \xA73.9 step 7)");
45760
46209
  }, "unavailable");
45761
46210
  if (!dir) {
45762
46211
  return {
45763
- put: /* @__PURE__ */ __name(async () => unavailable3(), "put"),
45764
- get: /* @__PURE__ */ __name(async () => unavailable3(), "get"),
46212
+ put: /* @__PURE__ */ __name(async () => unavailable2(), "put"),
46213
+ get: /* @__PURE__ */ __name(async () => unavailable2(), "get"),
45765
46214
  list: /* @__PURE__ */ __name(async () => [], "list")
45766
46215
  };
45767
46216
  }
@@ -46969,39 +47418,52 @@ function createSandbox(options) {
46969
47418
  Workflows: createWorkflowsRuntime(async () => workflowService),
46970
47419
  // wave 2 U13b — `Threads` never posts into a real conversation offline: typed `thread_follow_up_unavailable`.
46971
47420
  Threads: createOfflineThreadsApi(),
46972
- // Device API (for sandbox — commands route through lua-api developer endpoint)
46973
- Device: {
46974
- sendCommand: /* @__PURE__ */ __name(async (deviceName, command, payload, timeout) => {
46975
- const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
46976
- const deviceApi = await getDeviceInstance2();
46977
- const response = await deviceApi.sendCommand(deviceName, command, payload, timeout || 3e4);
46978
- if (!response.success) throw new Error(response.error?.message || "Device command failed");
46979
- return response.data;
46980
- }, "sendCommand"),
46981
- listDevices: /* @__PURE__ */ __name(async () => {
46982
- const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
46983
- const deviceApi = await getDeviceInstance2();
46984
- const response = await deviceApi.getDevices();
46985
- return response.data?.devices || response.data || [];
46986
- }, "listDevices"),
46987
- getStatus: /* @__PURE__ */ __name(async (deviceName) => {
46988
- const { getDeviceInstance: getDeviceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
46989
- const deviceApi = await getDeviceInstance2();
46990
- const response = await deviceApi.getDeviceStatus(deviceName);
46991
- return response.data;
46992
- }, "getStatus")
46993
- },
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
+ })(),
46994
47456
  // Legacy `env('FOO')` getter — kept for backwards compatibility with skills
46995
47457
  // that use it instead of `process.env.FOO`. Both work.
46996
47458
  // LUA-751: `env.template(KEY)` too — a graph-form workflow file calls it at MODULE scope (`schedule.timezone:
46997
47459
  // env.template('FINANCE_TZ')`, the shipped `vendor-invoices`), `env` is not one of the builder names esbuild
46998
47460
  // injects (`WORKFLOW_SHIM_NAMES`), so the artifact resolves it against THIS global when `lua workflows run`
46999
47461
  // loads it — and threw `env.template is not a function`. The placeholder is the SDK's (`types/skill.ts`) and the
47000
- // 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.
47001
47465
  env: Object.assign((key) => envVars[key], {
47002
- template: /* @__PURE__ */ __name((key) => ({
47003
- __envRef: key
47004
- }), "template")
47466
+ template: envTemplatePlaceholder
47005
47467
  }),
47006
47468
  // K1a (PRO-2142) — the `log` global, so `lua test` runs the same code
47007
47469
  // production runs. There is no `VmLogSink` here, so the line goes to the
@@ -47083,7 +47545,7 @@ function createSandbox(options) {
47083
47545
  return getConnectionRequestsInstance2();
47084
47546
  })
47085
47547
  },
47086
- // 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
47087
47549
  // bearer-auth developer endpoint the lua-cli `Voice.call` namespace uses
47088
47550
  // — keeps the surface byte-equivalent to the lua-core production VM
47089
47551
  // (which routes through `/internal/voice-dispatch/:agentId` instead).
@@ -47092,17 +47554,27 @@ function createSandbox(options) {
47092
47554
  const { getVoiceInstance: getVoiceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47093
47555
  const voice = await getVoiceInstance2();
47094
47556
  return voice.dispatchForSandbox(input);
47095
- }, "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")
47096
47563
  },
47097
47564
  // Lowercase alias matching lua-core's sandbox: `this.voice.call(...)` works
47098
47565
  // at the script top level (where `this === globalThis`), and arrow bodies
47099
- // can use `voice.call(...)` directly.
47566
+ // can use `voice.call(...)` / `voice.createSession(...)` directly.
47100
47567
  voice: {
47101
47568
  call: /* @__PURE__ */ __name(async (input) => {
47102
47569
  const { getVoiceInstance: getVoiceInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
47103
47570
  const voice = await getVoiceInstance2();
47104
47571
  return voice.dispatchForSandbox(input);
47105
- }, "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")
47106
47578
  },
47107
47579
  // Outbound channel send (PRO-93). Proxied via the lua-cli developer
47108
47580
  // endpoint (Bearer auth) — keeps lua test byte-equivalent to the lua-core
@@ -48428,7 +48900,7 @@ async function compileCommand(options) {
48428
48900
  __name(compileCommand, "compileCommand");
48429
48901
 
48430
48902
  // src/commands/test.ts
48431
- import inquirer6 from "inquirer";
48903
+ import inquirer5 from "inquirer";
48432
48904
 
48433
48905
  // src/commands/test-output.helpers.ts
48434
48906
  import { inspect } from "util";
@@ -49487,7 +49959,8 @@ var ALIAS_MAP = {
49487
49959
  "disable",
49488
49960
  "remove",
49489
49961
  "test",
49490
- "test-trigger"
49962
+ "test-trigger",
49963
+ "credential"
49491
49964
  ],
49492
49965
  aliases: lowerKeys({
49493
49966
  ls: "list",
@@ -49503,7 +49976,9 @@ var ALIAS_MAP = {
49503
49976
  del: "remove",
49504
49977
  run: "test",
49505
49978
  exec: "test",
49506
- test_trigger: "test-trigger"
49979
+ test_trigger: "test-trigger",
49980
+ credentials: "credential",
49981
+ key: "credential"
49507
49982
  })
49508
49983
  },
49509
49984
  "features.action": {
@@ -50975,6 +51450,9 @@ async function loadSeedFromRun(runId, wf, apiKey, agentId) {
50975
51450
  console.error(`\u274C Run ${runId} not found: ${run.error?.message ?? "unknown error"}`);
50976
51451
  return void 0;
50977
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
+ }
50978
51456
  const plan = compilePlan(wf.graph);
50979
51457
  const rows3 = [];
50980
51458
  for (const stepId of plan.order) {
@@ -51096,7 +51574,7 @@ async function promptToolSelection(tools) {
51096
51574
  name: tool.skillName ? `${tool.name} (${tool.skillName}) - ${tool.description}` : `${tool.name} - ${tool.description}`,
51097
51575
  value: tool
51098
51576
  }));
51099
- const { selectedTool } = await inquirer6.prompt([
51577
+ const { selectedTool } = await inquirer5.prompt([
51100
51578
  {
51101
51579
  type: "list",
51102
51580
  name: "selectedTool",
@@ -54892,7 +55370,7 @@ __name(deployAllCommand, "deployAllCommand");
54892
55370
  // src/commands/chat.ts
54893
55371
  init_cli();
54894
55372
  import * as readline from "readline";
54895
- import inquirer7 from "inquirer";
55373
+ import inquirer6 from "inquirer";
54896
55374
 
54897
55375
  // src/api/chat.api.service.ts
54898
55376
  init_http_client();
@@ -55050,21 +55528,25 @@ init_cli();
55050
55528
  init_constants();
55051
55529
  import { readFileSync as readFileSync12, writeFileSync as writeFileSync9, mkdirSync as mkdirSync7 } from "fs";
55052
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");
55053
55535
  function readStore2() {
55054
55536
  try {
55055
55537
  const raw = readFileSync12(SANDBOX_STORAGE_FILE, "utf8");
55056
55538
  const parsed = JSON.parse(raw);
55057
55539
  return {
55058
55540
  skills: parsed.skills ?? {},
55059
- preprocessors: parsed.preprocessors ?? {},
55060
- postprocessors: parsed.postprocessors ?? {},
55541
+ preprocessorsById: isPlainObject3(parsed.preprocessorsById) ? parsed.preprocessorsById : {},
55542
+ postprocessorsById: isPlainObject3(parsed.postprocessorsById) ? parsed.postprocessorsById : {},
55061
55543
  devices: parsed.devices ?? {}
55062
55544
  };
55063
55545
  } catch {
55064
55546
  return {
55065
55547
  skills: {},
55066
- preprocessors: {},
55067
- postprocessors: {},
55548
+ preprocessorsById: {},
55549
+ postprocessorsById: {},
55068
55550
  devices: {}
55069
55551
  };
55070
55552
  }
@@ -55115,14 +55597,14 @@ async function getAllSandboxSkillIds(yamlConfig) {
55115
55597
  }
55116
55598
  }
55117
55599
  __name(getAllSandboxSkillIds, "getAllSandboxSkillIds");
55118
- async function getSandboxPreProcessorId(preprocessorName) {
55600
+ async function getSandboxPreProcessorId(preprocessorId) {
55119
55601
  const store = readStore2();
55120
- return store.preprocessors[preprocessorName] ?? null;
55602
+ return store.preprocessorsById[preprocessorId] ?? null;
55121
55603
  }
55122
55604
  __name(getSandboxPreProcessorId, "getSandboxPreProcessorId");
55123
- async function setSandboxPreProcessorId(sandboxId, preprocessorName) {
55605
+ async function setSandboxPreProcessorId(sandboxId, preprocessorId) {
55124
55606
  const store = readStore2();
55125
- store.preprocessors[preprocessorName] = sandboxId;
55607
+ store.preprocessorsById[preprocessorId] = sandboxId;
55126
55608
  writeStore2(store);
55127
55609
  }
55128
55610
  __name(setSandboxPreProcessorId, "setSandboxPreProcessorId");
@@ -55131,8 +55613,8 @@ async function getAllSandboxPreProcessorIds(config) {
55131
55613
  try {
55132
55614
  const preprocessors = preprocessorHandler.getFromYaml(config);
55133
55615
  for (const preprocessor of preprocessors) {
55134
- if (preprocessor.preprocessorId && preprocessor.name) {
55135
- const sandboxId = await getSandboxPreProcessorId(preprocessor.name);
55616
+ if (preprocessor.preprocessorId) {
55617
+ const sandboxId = await getSandboxPreProcessorId(preprocessor.preprocessorId);
55136
55618
  if (sandboxId) {
55137
55619
  overrides.push({
55138
55620
  preprocessorId: preprocessor.preprocessorId,
@@ -55147,14 +55629,14 @@ async function getAllSandboxPreProcessorIds(config) {
55147
55629
  return overrides;
55148
55630
  }
55149
55631
  __name(getAllSandboxPreProcessorIds, "getAllSandboxPreProcessorIds");
55150
- async function getSandboxPostProcessorId(postprocessorName) {
55632
+ async function getSandboxPostProcessorId(postprocessorId) {
55151
55633
  const store = readStore2();
55152
- return store.postprocessors[postprocessorName] ?? null;
55634
+ return store.postprocessorsById[postprocessorId] ?? null;
55153
55635
  }
55154
55636
  __name(getSandboxPostProcessorId, "getSandboxPostProcessorId");
55155
- async function setSandboxPostProcessorId(sandboxId, postprocessorName) {
55637
+ async function setSandboxPostProcessorId(sandboxId, postprocessorId) {
55156
55638
  const store = readStore2();
55157
- store.postprocessors[postprocessorName] = sandboxId;
55639
+ store.postprocessorsById[postprocessorId] = sandboxId;
55158
55640
  writeStore2(store);
55159
55641
  }
55160
55642
  __name(setSandboxPostProcessorId, "setSandboxPostProcessorId");
@@ -55163,8 +55645,8 @@ async function getAllSandboxPostProcessorIds(config) {
55163
55645
  try {
55164
55646
  const postprocessors = postprocessorHandler.getFromYaml(config);
55165
55647
  for (const postprocessor of postprocessors) {
55166
- if (postprocessor.postprocessorId && postprocessor.name) {
55167
- const sandboxId = await getSandboxPostProcessorId(postprocessor.name);
55648
+ if (postprocessor.postprocessorId) {
55649
+ const sandboxId = await getSandboxPostProcessorId(postprocessor.postprocessorId);
55168
55650
  if (sandboxId) {
55169
55651
  overrides.push({
55170
55652
  postprocessorId: postprocessor.postprocessorId,
@@ -55251,17 +55733,15 @@ __name(pushDevVersion, "pushDevVersion");
55251
55733
  async function pushSingleSkillToSandbox(apiKey, agentId, skillId, skillData, isInitial = false) {
55252
55734
  const skillName = skillData.name || "Unknown Skill";
55253
55735
  const sandboxSkillId = await getSandboxSkillId(skillName);
55254
- const envVars = loadEnvironmentVariables2();
55255
- const payloadWithNameAndEnv = {
55736
+ const payload = {
55256
55737
  ...skillData,
55257
- name: skillName,
55258
- env: envVars
55738
+ name: skillName
55259
55739
  };
55260
55740
  if (sandboxSkillId) {
55261
55741
  if (!isInitial) {
55262
55742
  writeProgress("\u{1F504} Updating existing sandbox version...");
55263
55743
  }
55264
- const updateResult = await updateDevVersion(apiKey, agentId, skillId, sandboxSkillId, payloadWithNameAndEnv);
55744
+ const updateResult = await updateDevVersion(apiKey, agentId, skillId, sandboxSkillId, payload);
55265
55745
  if (updateResult.success && updateResult.data) {
55266
55746
  if (!isInitial) {
55267
55747
  }
@@ -55281,7 +55761,7 @@ async function pushSingleSkillToSandbox(apiKey, agentId, skillId, skillData, isI
55281
55761
  if (!isInitial) {
55282
55762
  writeProgress("\u{1F504} Creating new sandbox version...");
55283
55763
  }
55284
- const result = await pushDevVersion(apiKey, agentId, skillId, payloadWithNameAndEnv);
55764
+ const result = await pushDevVersion(apiKey, agentId, skillId, payload);
55285
55765
  if (result.success && result.data) {
55286
55766
  await setSandboxSkillId(result.data.skillId, skillName);
55287
55767
  if (!isInitial) {
@@ -55359,7 +55839,7 @@ async function pushSkillsToSandbox(apiKey, agentId, manifest, yamlConfig, isInit
55359
55839
  __name(pushSkillsToSandbox, "pushSkillsToSandbox");
55360
55840
  async function pushSinglePreProcessorToSandbox(apiKey, agentId, preprocessorId, preprocessorData, isInitial = false) {
55361
55841
  const preprocessorName = preprocessorData.name || "Unknown PreProcessor";
55362
- const sandboxPreProcessorId = await getSandboxPreProcessorId(preprocessorName);
55842
+ const sandboxPreProcessorId = await getSandboxPreProcessorId(preprocessorId);
55363
55843
  const baseVersion = preprocessorData.version || "1.0.0";
55364
55844
  const sandboxVersion = baseVersion.endsWith("-sandbox") ? baseVersion : `${baseVersion}-sandbox`;
55365
55845
  const payload = {
@@ -55393,7 +55873,7 @@ async function pushSinglePreProcessorToSandbox(apiKey, agentId, preprocessorId,
55393
55873
  const api = new PreProcessorApi(BASE_URLS.API, apiKey, agentId);
55394
55874
  const result = await api.pushDevPreProcessor(preprocessorId, payload);
55395
55875
  if (result.success && result.data) {
55396
- await setSandboxPreProcessorId(result.data.versionId, preprocessorName);
55876
+ await setSandboxPreProcessorId(result.data.versionId, preprocessorId);
55397
55877
  return true;
55398
55878
  } else if (result.error) {
55399
55879
  console.error(`\u274C PreProcessor sandbox push failed: ${result.error.message}`);
@@ -55404,7 +55884,7 @@ async function pushSinglePreProcessorToSandbox(apiKey, agentId, preprocessorId,
55404
55884
  __name(pushSinglePreProcessorToSandbox, "pushSinglePreProcessorToSandbox");
55405
55885
  async function pushSinglePostProcessorToSandbox(apiKey, agentId, postprocessorId, postprocessorData, isInitial = false) {
55406
55886
  const postprocessorName = postprocessorData.name || "Unknown PostProcessor";
55407
- const sandboxPostProcessorId = await getSandboxPostProcessorId(postprocessorName);
55887
+ const sandboxPostProcessorId = await getSandboxPostProcessorId(postprocessorId);
55408
55888
  const baseVersion = postprocessorData.version || "1.0.0";
55409
55889
  const sandboxVersion = baseVersion.endsWith("-sandbox") ? baseVersion : `${baseVersion}-sandbox`;
55410
55890
  const payload = {
@@ -55437,7 +55917,7 @@ async function pushSinglePostProcessorToSandbox(apiKey, agentId, postprocessorId
55437
55917
  const api = new PostProcessorApi(BASE_URLS.API, apiKey, agentId);
55438
55918
  const result = await api.pushDevPostProcessor(postprocessorId, payload);
55439
55919
  if (result.success && result.data) {
55440
- await setSandboxPostProcessorId(result.data.versionId, postprocessorName);
55920
+ await setSandboxPostProcessorId(result.data.versionId, postprocessorId);
55441
55921
  return true;
55442
55922
  } else if (result.error) {
55443
55923
  console.error(`\u274C PostProcessor sandbox push failed: ${result.error.message}`);
@@ -55993,7 +56473,7 @@ async function chatCommand(cmdObj) {
55993
56473
  selectedEnvironment = envResolution.environment;
55994
56474
  break;
55995
56475
  case "prompt": {
55996
- const { environment } = await inquirer7.prompt([
56476
+ const { environment } = await inquirer6.prompt([
55997
56477
  {
55998
56478
  type: "list",
55999
56479
  name: "environment",
@@ -56572,7 +57052,7 @@ init_command_utils();
56572
57052
  init_developer_api_service();
56573
57053
  import fs19 from "fs";
56574
57054
  import path27 from "path";
56575
- import inquirer8 from "inquirer";
57055
+ import inquirer7 from "inquirer";
56576
57056
  init_analytics();
56577
57057
  init_cli_error();
56578
57058
  function resolveEnvironment(env, hasNonInteractiveFlags) {
@@ -56669,7 +57149,7 @@ async function envCommand(env, cmdObj) {
56669
57149
  selectedEnvironment = envResolution.environment;
56670
57150
  break;
56671
57151
  case "prompt":
56672
- const { environment } = await inquirer8.prompt([
57152
+ const { environment } = await inquirer7.prompt([
56673
57153
  {
56674
57154
  type: "list",
56675
57155
  name: "environment",
@@ -56859,7 +57339,7 @@ async function manageEnvironmentVariables(context) {
56859
57339
  const variables = await loadEnvironmentVariables(context);
56860
57340
  console.log("\n" + "=".repeat(60));
56861
57341
  displayVariables(variables, context, true);
56862
- const { action } = await inquirer8.prompt([
57342
+ const { action } = await inquirer7.prompt([
56863
57343
  {
56864
57344
  type: "list",
56865
57345
  name: "action",
@@ -56954,7 +57434,7 @@ async function saveProductionEnvVariables(context, variables) {
56954
57434
  }
56955
57435
  __name(saveProductionEnvVariables, "saveProductionEnvVariables");
56956
57436
  async function addVariable(context, currentVariables) {
56957
- const answers = await inquirer8.prompt([
57437
+ const answers = await inquirer7.prompt([
56958
57438
  {
56959
57439
  type: "input",
56960
57440
  name: "key",
@@ -56995,7 +57475,7 @@ async function updateVariable(context, currentVariables) {
56995
57475
  console.log("\n\u2139\uFE0F No variables to update.\n");
56996
57476
  return;
56997
57477
  }
56998
- const { selectedKey } = await inquirer8.prompt([
57478
+ const { selectedKey } = await inquirer7.prompt([
56999
57479
  {
57000
57480
  type: "list",
57001
57481
  name: "selectedKey",
@@ -57007,7 +57487,7 @@ async function updateVariable(context, currentVariables) {
57007
57487
  }
57008
57488
  ]);
57009
57489
  const currentVariable = currentVariables.find((v) => v.key === selectedKey);
57010
- const { newValue } = await inquirer8.prompt([
57490
+ const { newValue } = await inquirer7.prompt([
57011
57491
  {
57012
57492
  type: "input",
57013
57493
  name: "newValue",
@@ -57036,7 +57516,7 @@ async function deleteVariable(context, currentVariables) {
57036
57516
  console.log("\n\u2139\uFE0F No variables to delete.\n");
57037
57517
  return;
57038
57518
  }
57039
- const { selectedKey } = await inquirer8.prompt([
57519
+ const { selectedKey } = await inquirer7.prompt([
57040
57520
  {
57041
57521
  type: "list",
57042
57522
  name: "selectedKey",
@@ -57047,7 +57527,7 @@ async function deleteVariable(context, currentVariables) {
57047
57527
  }))
57048
57528
  }
57049
57529
  ]);
57050
- const { confirm } = await inquirer8.prompt([
57530
+ const { confirm } = await inquirer7.prompt([
57051
57531
  {
57052
57532
  type: "confirm",
57053
57533
  name: "confirm",
@@ -57080,7 +57560,7 @@ async function viewVariable(currentVariables) {
57080
57560
  console.log("\n\u2139\uFE0F No variables to view.\n");
57081
57561
  return;
57082
57562
  }
57083
- const { selectedKey } = await inquirer8.prompt([
57563
+ const { selectedKey } = await inquirer7.prompt([
57084
57564
  {
57085
57565
  type: "list",
57086
57566
  name: "selectedKey",
@@ -57097,7 +57577,7 @@ async function viewVariable(currentVariables) {
57097
57577
  console.log("=".repeat(60));
57098
57578
  console.log(variable.value);
57099
57579
  console.log("=".repeat(60) + "\n");
57100
- await inquirer8.prompt([
57580
+ await inquirer7.prompt([
57101
57581
  {
57102
57582
  type: "input",
57103
57583
  name: "continue",
@@ -57111,7 +57591,6 @@ __name(viewVariable, "viewVariable");
57111
57591
  init_dist();
57112
57592
  init_cli();
57113
57593
  init_constants();
57114
- import inquirer9 from "inquirer";
57115
57594
  init_command_utils();
57116
57595
  init_compiler2();
57117
57596
  init_artifact_loader();
@@ -57413,7 +57892,7 @@ async function viewPersonaInteractive(persona) {
57413
57892
  console.log("No persona configured.");
57414
57893
  }
57415
57894
  console.log("=".repeat(60) + "\n");
57416
- await inquirer9.prompt([
57895
+ await safePrompt([
57417
57896
  {
57418
57897
  type: "input",
57419
57898
  name: "continue",
@@ -57537,7 +58016,7 @@ async function viewVersionDetailsInteractive(version) {
57537
58016
  console.log("=".repeat(60) + "\n");
57538
58017
  console.log(version.persona);
57539
58018
  console.log("\n" + "=".repeat(60) + "\n");
57540
- await inquirer9.prompt([
58019
+ await safePrompt([
57541
58020
  {
57542
58021
  type: "input",
57543
58022
  name: "continue",
@@ -58781,6 +59260,7 @@ var EvalsApi = class extends HttpClient {
58781
59260
  };
58782
59261
 
58783
59262
  // src/commands/evals.ts
59263
+ var EVALS_DASHBOARD_URL = "https://evals.heylua.ai";
58784
59264
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
58785
59265
  "completed",
58786
59266
  "failed",
@@ -58927,16 +59407,22 @@ async function pushSuites(api, options) {
58927
59407
  });
58928
59408
  }
58929
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");
58930
59416
  async function openDashboard() {
58931
59417
  writeProgress("Opening Lua Evaluations Dashboard...");
58932
- const { agentId, apiKey } = await initializeCommand({
59418
+ const { agentId } = await initializeCommand({
58933
59419
  showProgress: false
58934
59420
  });
58935
- const evalsUrl = `https://evals.heylua.ai?apiKey=${apiKey}&agentID=${agentId}`;
58936
- await open3(evalsUrl);
59421
+ await open3(buildEvalsDashboardUrl(agentId));
58937
59422
  writeSuccess("Lua Evaluations Dashboard opened in your browser");
59423
+ console.log(" The dashboard will ask you to sign in if needed.");
58938
59424
  console.log(`
58939
- Dashboard URL: https://evals.heylua.ai`);
59425
+ Dashboard URL: ${EVALS_DASHBOARD_URL}`);
58940
59426
  console.log(` Agent ID: ${agentId}
58941
59427
  `);
58942
59428
  trackEvent("cli_evals_opened");
@@ -59094,7 +59580,7 @@ async function docsCommand() {
59094
59580
  __name(docsCommand, "docsCommand");
59095
59581
 
59096
59582
  // src/commands/channels.ts
59097
- import inquirer10 from "inquirer";
59583
+ import inquirer8 from "inquirer";
59098
59584
  import open5 from "open";
59099
59585
  init_cli();
59100
59586
  init_command_utils();
@@ -59607,7 +60093,7 @@ async function executeNonInteractive3(agentApi, agentId, action) {
59607
60093
  }
59608
60094
  __name(executeNonInteractive3, "executeNonInteractive");
59609
60095
  async function channelsInteractive(agentApi, agentId, apiKey, config) {
59610
- const { operation } = await inquirer10.prompt([
60096
+ const { operation } = await inquirer8.prompt([
59611
60097
  {
59612
60098
  type: "list",
59613
60099
  name: "operation",
@@ -59693,7 +60179,7 @@ async function listChannelsInteractive(agentApi, agentId, config) {
59693
60179
  name: "\u2190 Back to main menu",
59694
60180
  value: -1
59695
60181
  });
59696
- const { selectedIndex } = await inquirer10.prompt([
60182
+ const { selectedIndex } = await inquirer8.prompt([
59697
60183
  {
59698
60184
  type: "list",
59699
60185
  name: "selectedIndex",
@@ -59870,7 +60356,7 @@ function displayEmailDetails(channel) {
59870
60356
  }
59871
60357
  __name(displayEmailDetails, "displayEmailDetails");
59872
60358
  async function createChannel(agentApi, agentId) {
59873
- const { channelType } = await inquirer10.prompt([
60359
+ const { channelType } = await inquirer8.prompt([
59874
60360
  {
59875
60361
  type: "list",
59876
60362
  name: "channelType",
@@ -59924,7 +60410,7 @@ async function createChannel(agentApi, agentId) {
59924
60410
  __name(createChannel, "createChannel");
59925
60411
  async function createWhatsAppChannel(agentApi, agentId) {
59926
60412
  writeInfo("\u{1F4F1} Creating WhatsApp Channel\n");
59927
- const answers = await inquirer10.prompt([
60413
+ const answers = await inquirer8.prompt([
59928
60414
  {
59929
60415
  type: "input",
59930
60416
  name: "phoneNumberId",
@@ -59976,7 +60462,7 @@ async function createWhatsAppChannel(agentApi, agentId) {
59976
60462
  __name(createWhatsAppChannel, "createWhatsAppChannel");
59977
60463
  async function createFacebookChannel(agentApi, agentId) {
59978
60464
  writeInfo("\u{1F4AC} Creating Facebook Messenger Channel\n");
59979
- const answers = await inquirer10.prompt([
60465
+ const answers = await inquirer8.prompt([
59980
60466
  {
59981
60467
  type: "password",
59982
60468
  name: "accessToken",
@@ -60018,7 +60504,7 @@ async function createFacebookChannel(agentApi, agentId) {
60018
60504
  __name(createFacebookChannel, "createFacebookChannel");
60019
60505
  async function createEmailChannel(agentApi, agentId) {
60020
60506
  writeInfo("\u{1F4E7} Creating Email Channel\n");
60021
- const { mode } = await inquirer10.prompt([
60507
+ const { mode } = await inquirer8.prompt([
60022
60508
  {
60023
60509
  type: "list",
60024
60510
  name: "mode",
@@ -60036,7 +60522,7 @@ async function createEmailChannel(agentApi, agentId) {
60036
60522
  }
60037
60523
  ]);
60038
60524
  clearPromptLines(2);
60039
- const { displayName } = await inquirer10.prompt([
60525
+ const { displayName } = await inquirer8.prompt([
60040
60526
  {
60041
60527
  type: "input",
60042
60528
  name: "displayName",
@@ -60054,7 +60540,7 @@ async function createEmailChannel(agentApi, agentId) {
60054
60540
  }
60055
60541
  };
60056
60542
  if (mode === "existing") {
60057
- const { email } = await inquirer10.prompt([
60543
+ const { email } = await inquirer8.prompt([
60058
60544
  {
60059
60545
  type: "input",
60060
60546
  name: "email",
@@ -60150,7 +60636,7 @@ var SLACK_AGENT_PROMPTS_MAX = 4;
60150
60636
  var SLACK_AGENT_PROMPT_TITLE_MAX = 75;
60151
60637
  var SLACK_AGENT_PROMPT_MESSAGE_MAX = 2e3;
60152
60638
  async function promptSlackAgentMode(current) {
60153
- const { enabled } = await inquirer10.prompt([
60639
+ const { enabled } = await inquirer8.prompt([
60154
60640
  {
60155
60641
  type: "confirm",
60156
60642
  name: "enabled",
@@ -60159,7 +60645,7 @@ async function promptSlackAgentMode(current) {
60159
60645
  }
60160
60646
  ]);
60161
60647
  if (!enabled) return null;
60162
- const { description } = await inquirer10.prompt([
60648
+ const { description } = await inquirer8.prompt([
60163
60649
  {
60164
60650
  type: "input",
60165
60651
  name: "description",
@@ -60176,7 +60662,7 @@ async function promptSlackAgentMode(current) {
60176
60662
  }
60177
60663
  const prompts = [];
60178
60664
  while (prompts.length < SLACK_AGENT_PROMPTS_MAX) {
60179
- const { title } = await inquirer10.prompt([
60665
+ const { title } = await inquirer8.prompt([
60180
60666
  {
60181
60667
  type: "input",
60182
60668
  name: "title",
@@ -60185,7 +60671,7 @@ async function promptSlackAgentMode(current) {
60185
60671
  }
60186
60672
  ]);
60187
60673
  if (!title.trim()) break;
60188
- const { message } = await inquirer10.prompt([
60674
+ const { message } = await inquirer8.prompt([
60189
60675
  {
60190
60676
  type: "input",
60191
60677
  name: "message",
@@ -60208,7 +60694,7 @@ async function promptSlackAgentMode(current) {
60208
60694
  }
60209
60695
  __name(promptSlackAgentMode, "promptSlackAgentMode");
60210
60696
  async function offerToOpen(url, question) {
60211
- const { openIt } = await inquirer10.prompt([
60697
+ const { openIt } = await inquirer8.prompt([
60212
60698
  {
60213
60699
  type: "confirm",
60214
60700
  name: "openIt",
@@ -60220,7 +60706,7 @@ async function offerToOpen(url, question) {
60220
60706
  }
60221
60707
  __name(offerToOpen, "offerToOpen");
60222
60708
  async function startSlackApp(agentApi, agentId, kind) {
60223
- const { source } = await inquirer10.prompt([
60709
+ const { source } = await inquirer8.prompt([
60224
60710
  {
60225
60711
  type: "list",
60226
60712
  name: "source",
@@ -60280,7 +60766,7 @@ __name(printManifestUpdate, "printManifestUpdate");
60280
60766
  async function createSlackPrivateChannel(agentApi, agentId) {
60281
60767
  writeInfo("\u{1F512} Creating Private Slack Channel\n");
60282
60768
  const { existingApp, agentMode } = await startSlackApp(agentApi, agentId, "private");
60283
- const answers = await inquirer10.prompt([
60769
+ const answers = await inquirer8.prompt([
60284
60770
  {
60285
60771
  type: "password",
60286
60772
  name: "accessToken",
@@ -60325,7 +60811,7 @@ __name(createSlackPrivateChannel, "createSlackPrivateChannel");
60325
60811
  async function createSlackPublicChannel(agentApi, agentId) {
60326
60812
  writeInfo("\u{1F310} Creating Public Slack Channel\n");
60327
60813
  const { existingApp, agentMode } = await startSlackApp(agentApi, agentId, "public");
60328
- const answers = await inquirer10.prompt([
60814
+ const answers = await inquirer8.prompt([
60329
60815
  {
60330
60816
  type: "input",
60331
60817
  name: "appId",
@@ -60409,7 +60895,7 @@ async function slackConnectionActions(agentApi, agentId, channel) {
60409
60895
  name: "\u2190 Back",
60410
60896
  value: "back"
60411
60897
  });
60412
- const { action } = await inquirer10.prompt([
60898
+ const { action } = await inquirer8.prompt([
60413
60899
  {
60414
60900
  type: "list",
60415
60901
  name: "action",
@@ -60441,7 +60927,7 @@ async function slackConnectionActions(agentApi, agentId, channel) {
60441
60927
  writeSuccess(`\u2705 Agent mode ${agentMode ? "saved" : "turned off"}. It takes effect once Slack has the new manifest:`);
60442
60928
  printManifestUpdate(response.data.manifestUrl ?? slackManifestEditorUrl(channel.data.appId, channel.data.teamId), response.data.manifest);
60443
60929
  } else if (action === "secret") {
60444
- const { signingSecret } = await inquirer10.prompt([
60930
+ const { signingSecret } = await inquirer8.prompt([
60445
60931
  slackSigningSecretPrompt()
60446
60932
  ]);
60447
60933
  const response = await agentApi.saveSlackSigningSecret(agentId, channel.identifier, signingSecret.trim());
@@ -60478,7 +60964,7 @@ __name(slackConnectionActions, "slackConnectionActions");
60478
60964
  // src/commands/logs.ts
60479
60965
  init_cli();
60480
60966
  init_command_utils();
60481
- import inquirer11 from "inquirer";
60967
+ import inquirer9 from "inquirer";
60482
60968
  import chalk2 from "chalk";
60483
60969
  init_device_api_service();
60484
60970
  init_constants();
@@ -60978,7 +61464,7 @@ async function nonInteractiveLogs(logsApi, agentId, apiKey, options) {
60978
61464
  }
60979
61465
  __name(nonInteractiveLogs, "nonInteractiveLogs");
60980
61466
  async function interactiveLogs(logsApi, agentId, apiKey) {
60981
- const { viewType } = await inquirer11.prompt([
61467
+ const { viewType } = await inquirer9.prompt([
60982
61468
  {
60983
61469
  type: "list",
60984
61470
  name: "viewType",
@@ -61006,7 +61492,7 @@ __name(interactiveLogs, "interactiveLogs");
61006
61492
  async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61007
61493
  let keepFiltering = true;
61008
61494
  while (keepFiltering) {
61009
- const { filterType } = await inquirer11.prompt([
61495
+ const { filterType } = await inquirer9.prompt([
61010
61496
  {
61011
61497
  type: "list",
61012
61498
  name: "filterType",
@@ -61016,7 +61502,7 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61016
61502
  name: "\u{1F4CB} All logs",
61017
61503
  value: "all"
61018
61504
  },
61019
- new inquirer11.Separator(),
61505
+ new inquirer9.Separator(),
61020
61506
  {
61021
61507
  name: "Skills",
61022
61508
  value: "skill"
@@ -61041,7 +61527,7 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61041
61527
  name: "Devices",
61042
61528
  value: "device"
61043
61529
  },
61044
- new inquirer11.Separator(),
61530
+ new inquirer9.Separator(),
61045
61531
  {
61046
61532
  name: "\u{1F4AC} User Messages",
61047
61533
  value: "user_message"
@@ -61074,12 +61560,12 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61074
61560
  name: "\u{1F4DE} Voice Calls",
61075
61561
  value: "calls"
61076
61562
  },
61077
- new inquirer11.Separator(),
61563
+ new inquirer9.Separator(),
61078
61564
  {
61079
61565
  name: "\u2190 Back",
61080
61566
  value: "back"
61081
61567
  },
61082
- new inquirer11.Separator()
61568
+ new inquirer9.Separator()
61083
61569
  ]
61084
61570
  }
61085
61571
  ]);
@@ -61112,7 +61598,7 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61112
61598
  `);
61113
61599
  continue;
61114
61600
  }
61115
- const { selectedId } = await inquirer11.prompt([
61601
+ const { selectedId } = await inquirer9.prompt([
61116
61602
  {
61117
61603
  type: "list",
61118
61604
  name: "selectedId",
@@ -61122,17 +61608,17 @@ async function filterAndShowLogsInteractive(logsApi, agentId, apiKey) {
61122
61608
  name: `All ${capitalizedType}s`,
61123
61609
  value: "all"
61124
61610
  },
61125
- new inquirer11.Separator(),
61611
+ new inquirer9.Separator(),
61126
61612
  ...items.map((item) => ({
61127
61613
  name: item.name,
61128
61614
  value: item.id
61129
61615
  })),
61130
- new inquirer11.Separator(),
61616
+ new inquirer9.Separator(),
61131
61617
  {
61132
61618
  name: "\u2190 Back",
61133
61619
  value: "back"
61134
61620
  },
61135
- new inquirer11.Separator()
61621
+ new inquirer9.Separator()
61136
61622
  ]
61137
61623
  }
61138
61624
  ]);
@@ -61161,7 +61647,7 @@ async function viewAgentLogsInteractive(logsApi, agentId, filters = {}) {
61161
61647
  }
61162
61648
  const data = response.data;
61163
61649
  displayLogsCore(data.logs, data.pagination, "All Agent Logs", true);
61164
- const { action } = await inquirer11.prompt([
61650
+ const { action } = await inquirer9.prompt([
61165
61651
  {
61166
61652
  type: "list",
61167
61653
  name: "action",
@@ -61216,7 +61702,7 @@ async function handleNavigation(action, pagination, setPage) {
61216
61702
  if (pagination.hasNextPage) setPage(pagination.nextPage);
61217
61703
  return true;
61218
61704
  case "goto":
61219
- const { page } = await inquirer11.prompt({
61705
+ const { page } = await inquirer9.prompt({
61220
61706
  type: "number",
61221
61707
  name: "page",
61222
61708
  message: `Enter page number (1-${pagination.totalPages}):`,
@@ -66357,13 +66843,23 @@ init_constants();
66357
66843
  init_command_utils();
66358
66844
  init_device_api_service();
66359
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";
66360
66851
  async function devicesCommand(action, cmdObj) {
66361
66852
  return withErrorHandling(async () => {
66362
66853
  const options = {
66363
66854
  deviceName: cmdObj?.deviceName || null,
66364
66855
  group: cmdObj?.group || null,
66365
66856
  payload: cmdObj?.payload || "{}",
66366
- 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
66367
66863
  };
66368
66864
  const { apiKey, agentId } = await initializeCommand();
66369
66865
  const api = new DeviceApi(BASE_URLS.API, apiKey, agentId);
@@ -66404,6 +66900,10 @@ async function devicesCommand(action, cmdObj) {
66404
66900
  {
66405
66901
  name: "\u{1F514} Test trigger",
66406
66902
  value: "test-trigger"
66903
+ },
66904
+ {
66905
+ name: "\u{1F511} Issue a device credential",
66906
+ value: "credential"
66407
66907
  }
66408
66908
  ]
66409
66909
  }
@@ -66433,6 +66933,9 @@ async function devicesCommand(action, cmdObj) {
66433
66933
  case "test-trigger":
66434
66934
  await testTrigger(api, options);
66435
66935
  break;
66936
+ case "credential":
66937
+ await issueDeviceCredential(apiKey, agentId, options);
66938
+ break;
66436
66939
  }
66437
66940
  trackEvent("cli_devices_completed", {
66438
66941
  action: selectedAction,
@@ -66444,33 +66947,25 @@ async function devicesCommand(action, cmdObj) {
66444
66947
  __name(devicesCommand, "devicesCommand");
66445
66948
  async function listDevices(api, options) {
66446
66949
  writeProgress("Fetching devices...");
66447
- const response = await api.getDevices();
66448
- if (!response.success || !response.data) {
66449
- throw new Error(response.error?.message || "Failed to fetch devices");
66450
- }
66451
- const devices = response.data.devices || response.data;
66452
- if (!Array.isArray(devices) || devices.length === 0) {
66453
- 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`.");
66454
66954
  return;
66455
66955
  }
66456
- let filtered = devices;
66457
- if (options.group) {
66458
- filtered = devices.filter((d) => d.group === options.group);
66459
- if (filtered.length === 0) {
66460
- writeInfo(`No devices found in group '${options.group}'.`);
66461
- return;
66462
- }
66463
- }
66464
66956
  console.log(`
66465
- Devices (${filtered.length}):
66957
+ Devices (${devices.length}):
66466
66958
  `);
66467
- for (const d of filtered) {
66468
- const statusIcon = d.active === false ? "\u26D4" : "\u{1F4E1}";
66469
- console.log(` ${statusIcon} ${d.name}${d.group ? ` [${d.group}]` : ""}`);
66470
- 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}` : ""}`);
66471
66965
  if (d.description) console.log(` ${d.description}`);
66472
- console.log("");
66966
+ if (d.lastSeenAt && d.status !== "online") console.log(` Last seen ${d.lastSeenAt}`);
66473
66967
  }
66968
+ console.log("");
66474
66969
  }
66475
66970
  __name(listDevices, "listDevices");
66476
66971
  async function deviceStatus(api, options) {
@@ -66481,8 +66976,14 @@ async function deviceStatus(api, options) {
66481
66976
  throw new Error(response.error?.message || "Failed to get device status");
66482
66977
  }
66483
66978
  const status = response.data.status;
66484
- const icon = status === "online" ? "\u{1F7E2}" : status === "disabled" ? "\u26D4" : "\u{1F534}";
66485
- 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
+ }
66486
66987
  }
66487
66988
  __name(deviceStatus, "deviceStatus");
66488
66989
  async function enableDevice(api, options) {
@@ -66493,6 +66994,7 @@ async function enableDevice(api, options) {
66493
66994
  throw new Error(response.error?.message || "Failed to enable device");
66494
66995
  }
66495
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).");
66496
66998
  }
66497
66999
  __name(enableDevice, "enableDevice");
66498
67000
  async function disableDevice(api, options) {
@@ -66502,11 +67004,15 @@ async function disableDevice(api, options) {
66502
67004
  if (!response.success) {
66503
67005
  throw new Error(response.error?.message || "Failed to disable device");
66504
67006
  }
66505
- writeSuccess(`Device '${name}' disabled`);
67007
+ writeSuccess(`Device '${name}' disabled. It is disconnected and refused until you enable it.`);
66506
67008
  }
66507
67009
  __name(disableDevice, "disableDevice");
66508
67010
  async function removeDevice(api, options, force) {
66509
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
+ }
66510
67016
  if (!force) {
66511
67017
  const confirm = await safePrompt([
66512
67018
  {
@@ -66522,35 +67028,25 @@ async function removeDevice(api, options, force) {
66522
67028
  }
66523
67029
  }
66524
67030
  writeProgress(`Removing '${name}'...`);
66525
- const response = await api.deleteDevice(name);
66526
- if (!response.success) {
66527
- 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");
66528
67038
  }
66529
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
+ }
66530
67043
  }
66531
67044
  __name(removeDevice, "removeDevice");
66532
67045
  async function testCommand2(api, options) {
66533
67046
  const name = await resolveDeviceName(api, options.deviceName, "Test command on");
66534
- let command;
66535
- if (cmdHasPositionalCommand(options)) {
66536
- command = options.command;
66537
- } else {
66538
- const answer = await safePrompt([
66539
- {
66540
- type: "input",
66541
- name: "command",
66542
- message: "Command name:"
66543
- }
66544
- ]);
66545
- if (!answer?.command) return;
66546
- command = answer.command;
66547
- }
66548
- let payload;
66549
- try {
66550
- payload = JSON.parse(options.payload || "{}");
66551
- } catch {
66552
- throw new Error(`Invalid JSON payload: ${options.payload}`);
66553
- }
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);
66554
67050
  const timeout = parseInt(options.timeout || "30000");
66555
67051
  console.log(`
66556
67052
  Sending '${command}' to device '${name}'...`);
@@ -66561,62 +67057,173 @@ async function testCommand2(api, options) {
66561
67057
  const data = response.data;
66562
67058
  if (data.success !== false) {
66563
67059
  writeSuccess(`Response received (${latency}ms):`);
66564
- console.log(JSON.stringify(data.data || data, null, 2));
66565
- } else {
66566
- console.log(`
66567
- \u274C Device returned error (${latency}ms):`);
66568
- console.log(` ${data.error || "Unknown error"}`);
66569
- }
66570
- } else {
66571
- const msg = response.error?.message || "Command failed";
66572
- if (msg.includes("offline")) {
66573
- console.log(`
66574
- \u274C Device '${name}' is offline`);
66575
- } else if (msg.includes("timed out")) {
66576
- console.log(`
66577
- \u274C Command timed out after ${timeout}ms`);
66578
- } else {
66579
- throw new Error(msg);
67060
+ console.log(JSON.stringify(data.data ?? data, null, 2));
67061
+ return;
66580
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`);
66581
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.`);
67079
+ }
67080
+ if (status === 429) throw new Error("Too many commands in flight for this agent; try again shortly");
67081
+ throw new Error(msg);
66582
67082
  }
66583
67083
  __name(testCommand2, "testCommand");
66584
67084
  async function testTrigger(api, options) {
66585
67085
  const name = await resolveDeviceName(api, options.deviceName, "Test trigger on");
66586
- let triggerName;
66587
- const answer = await safePrompt([
66588
- {
66589
- type: "input",
66590
- name: "trigger",
66591
- 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.");
66592
67094
  }
66593
- ]);
66594
- if (!answer?.trigger) return;
66595
- triggerName = answer.trigger;
66596
- let payload;
66597
- try {
66598
- payload = JSON.parse(options.payload || "{}");
66599
- } catch {
66600
- throw new Error(`Invalid JSON payload: ${options.payload}`);
67095
+ throw new Error(response.error?.message || "Failed to fire the trigger");
66601
67096
  }
66602
- console.log(`
66603
- Simulating trigger '${triggerName}' on device '${name}'...`);
66604
- writeInfo("Note: This sends the trigger through the full execution pipeline on the server.");
66605
- const response = await api.sendCommand(name, `__test_trigger__${triggerName}`, payload, parseInt(options.timeout || "30000"));
66606
- if (response.success) {
66607
- 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})`);
66608
67148
  } else {
67149
+ writeSuccess(`Device credential for '${deviceName}' (id ${issued.id}). It is shown only once:`);
66609
67150
  console.log(`
66610
- \u274C ${response.error?.message || "Failed to send trigger"}`);
67151
+ ${secret}
67152
+ `);
66611
67153
  }
67154
+ writeInfo(`Connect with agent ${agentId}, device name '${deviceName}', and this secret as the device credential.`);
66612
67155
  }
66613
- __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");
66614
67222
  async function resolveDeviceName(api, name, actionLabel) {
66615
67223
  if (name) return name;
66616
- const response = await api.getDevices();
66617
- const devices = response.data?.devices || response.data || [];
66618
- if (!Array.isArray(devices) || devices.length === 0) {
66619
- 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>");
66620
67227
  }
66621
67228
  const answer = await safePrompt([
66622
67229
  {
@@ -66624,19 +67231,34 @@ async function resolveDeviceName(api, name, actionLabel) {
66624
67231
  name: "device",
66625
67232
  message: `${actionLabel} which device?`,
66626
67233
  choices: devices.map((d) => ({
66627
- name: `${d.name}${d.group ? ` [${d.group}]` : ""}`,
67234
+ name: `${STATUS_ICON[d.status]} ${d.name}${d.group ? ` [${d.group}]` : ""}`,
66628
67235
  value: d.name
66629
67236
  }))
66630
67237
  }
66631
67238
  ]);
66632
- if (!answer?.device) throw new Error("No device selected.");
67239
+ if (!answer?.device) throw CliError.usage("No device selected.", "Pass --device-name <name>");
66633
67240
  return answer.device;
66634
67241
  }
66635
67242
  __name(resolveDeviceName, "resolveDeviceName");
66636
- function cmdHasPositionalCommand(options) {
66637
- 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;
67252
+ }
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
+ }
66638
67260
  }
66639
- __name(cmdHasPositionalCommand, "cmdHasPositionalCommand");
67261
+ __name(parsePayload, "parsePayload");
66640
67262
 
66641
67263
  // src/commands/jobs.ts
66642
67264
  init_cli();
@@ -68123,9 +68745,7 @@ __name(startResultLine, "startResultLine");
68123
68745
  async function startCore(ctx, name, o) {
68124
68746
  const input = parsedOrUsage(() => o.input ? parseJsonOrFile(o.input, "--input") : {});
68125
68747
  const waitSeconds = parsedOrUsage(() => parseIntFlag(o.wait, "--wait"));
68126
- const budgetCredits = parsedOrUsage(() => parseIntegerFlag(o.budgetCredits, "--budget-credits", {
68127
- min: 1
68128
- }));
68748
+ const budgetCredits = parsedOrUsage(() => parseCapFlag(o.budgetCredits, o.budgetActions, "--budget-credits", "--budget-actions"));
68129
68749
  if (waitSeconds !== void 0 && (waitSeconds < 0 || waitSeconds > 55)) {
68130
68750
  throw CliError.usage("--wait must be 0..55 (a server long-poll; the CLI raises its own deadline to wait+10 s)");
68131
68751
  }
@@ -68846,6 +69466,21 @@ function priorAttemptTail(a) {
68846
69466
  return `${parts.length ? ` \u2014 ${parts.join(" \xB7 ")}` : ""}${e?.providerMessage ? ` \u2014 ${e.providerMessage}` : ""}`;
68847
69467
  }
68848
69468
  __name(priorAttemptTail, "priorAttemptTail");
69469
+ function budgetTokensParts(b) {
69470
+ const n2 = /* @__PURE__ */ __name((v) => v.toLocaleString("en-US"), "n");
69471
+ const split = [
69472
+ typeof b.uncachedInputTokens === "number" ? `${n2(b.uncachedInputTokens)} uncached` : void 0,
69473
+ typeof b.cachedInputTokens === "number" ? `${n2(b.cachedInputTokens)} cached` : void 0
69474
+ ].filter((p) => !!p);
69475
+ const input = `${n2(b.inputTokens)}${b.maxInputTokens !== void 0 ? ` of ${n2(b.maxInputTokens)}` : ""} input tokens${split.length ? ` (${split.join(" / ")})` : ""}`;
69476
+ return typeof b.outputTokens === "number" ? [
69477
+ input,
69478
+ `${n2(b.outputTokens)} output tokens`
69479
+ ] : [
69480
+ input
69481
+ ];
69482
+ }
69483
+ __name(budgetTokensParts, "budgetTokensParts");
68849
69484
  function stepFailureLine(e) {
68850
69485
  if (!e || !e.reason && e.providerStatus === void 0 && !e.providerMessage) return void 0;
68851
69486
  const b = e.budget;
@@ -68854,7 +69489,7 @@ function stepFailureLine(e) {
68854
69489
  e.providerStatus !== void 0 ? `HTTP ${e.providerStatus}` : void 0,
68855
69490
  e.model ? `model ${e.model}` : void 0,
68856
69491
  e.turnIndex !== void 0 ? `message ${e.turnIndex}${e.assistantTurns !== void 0 ? ` (${e.assistantTurns} replies)` : ""}${b?.maxMessages !== void 0 ? ` of ${b.maxMessages}` : ""}` : void 0,
68857
- b ? `${b.inputTokens.toLocaleString("en-US")}${b.maxInputTokens !== void 0 ? ` of ${b.maxInputTokens.toLocaleString("en-US")}` : ""} input tokens` : void 0,
69492
+ ...b ? budgetTokensParts(b) : [],
68858
69493
  e.providerRetries ? `${e.providerRetries} provider ${e.providerRetries === 1 ? "retry" : "retries"}` : void 0
68859
69494
  ].filter((p) => !!p);
68860
69495
  return `${parts.join(" \xB7 ")}${e.providerMessage ? `${parts.length ? " \u2014 " : ""}${e.providerMessage}` : ""}`;
@@ -68867,7 +69502,7 @@ function attemptCountersLine(c) {
68867
69502
  const replies = c.assistantTurns ?? b?.assistantTurns;
68868
69503
  const parts = [
68869
69504
  messages !== void 0 ? `message ${messages}${replies !== void 0 ? ` (${replies} replies)` : ""}${b?.maxMessages !== void 0 ? ` of ${b.maxMessages}` : ""}` : void 0,
68870
- b ? `${b.inputTokens.toLocaleString("en-US")}${b.maxInputTokens !== void 0 ? ` of ${b.maxInputTokens.toLocaleString("en-US")}` : ""} input tokens` : void 0,
69505
+ ...b ? budgetTokensParts(b) : [],
68871
69506
  c.repairRounds ? `${c.repairRounds} repair ${c.repairRounds === 1 ? "round" : "rounds"}` : void 0,
68872
69507
  c.providerRetries ? `${c.providerRetries} provider ${c.providerRetries === 1 ? "retry" : "retries"}` : void 0
68873
69508
  ].filter((p) => !!p);
@@ -69338,9 +69973,7 @@ async function raiseBudgetCore(ctx, runId, o) {
69338
69973
  let dto;
69339
69974
  try {
69340
69975
  dto = {};
69341
- const credits = parseIntegerFlag(o.credits, "--credits", {
69342
- min: 1
69343
- });
69976
+ const credits = parseCapFlag(o.credits, o.actions, "--credits", "--actions");
69344
69977
  if (credits !== void 0) dto.maxCredits = credits;
69345
69978
  const steps = parseIntegerFlag(o.maxSteps, "--max-steps", {
69346
69979
  min: 1
@@ -70591,6 +71224,17 @@ function parseIntegerFlag(v, flag, range2 = {}) {
70591
71224
  return n2;
70592
71225
  }
70593
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");
70594
71238
  var GOAL_LIVE_STATUSES = /* @__PURE__ */ new Set([
70595
71239
  "active",
70596
71240
  "paused"
@@ -71180,9 +71824,7 @@ async function goalsCreateCore(ctx, o, positional) {
71180
71824
  }
71181
71825
  const cadence = parseCadenceFlag(o.cadence, o.timezone);
71182
71826
  const input = o.input ? parseJsonOrFile(o.input, "--input") : void 0;
71183
- const budgetCredits = parseIntegerFlag(o.budgetCredits, "--budget-credits", {
71184
- min: 1
71185
- });
71827
+ const budgetCredits = parseCapFlag(o.budgetCredits, o.budgetActions, "--budget-credits", "--budget-actions");
71186
71828
  const maxTotalCredits = parseIntegerFlag(o.maxTotalCredits, "--max-total-credits", {
71187
71829
  min: 1
71188
71830
  });
@@ -71392,9 +72034,7 @@ async function schedulesCreateCore(ctx, o, positional) {
71392
72034
  if (!SCHEDULE_NOTIFY.includes(o.notify)) throw usage(`--notify: expected ${SCHEDULE_NOTIFY.join("|")} (got "${o.notify}")`);
71393
72035
  draft.notify = o.notify;
71394
72036
  }
71395
- const credits = parseIntegerFlag(o.budgetCredits, "--budget-credits", {
71396
- min: 1
71397
- });
72037
+ const credits = parseCapFlag(o.budgetCredits, o.budgetActions, "--budget-credits", "--budget-actions");
71398
72038
  if (credits !== void 0) draft.budget = {
71399
72039
  maxCredits: credits
71400
72040
  };
@@ -71810,12 +72450,13 @@ async function recomposeCore(ctx, name, _o) {
71810
72450
  return WORKFLOW_EXIT.OK;
71811
72451
  }
71812
72452
  const saved = d.composed?.saved;
71813
- const version = saved?.version ?? saved?.versionId ?? "(new)";
72453
+ const savedVersion = saved?.version ?? saved?.versionId;
72454
+ const version = savedVersion ?? "(new)";
71814
72455
  writeSuccess(`\u2705 ${wf.name} recomposed \u2192 version ${version} \xB7 ${rewrittenCount} agent step${rewrittenCount === 1 ? "" : "s"} rewritten`);
71815
72456
  if (saved?.supersededBy) {
71816
72457
  writeInfo(`\u2139\uFE0F a concurrent recompose already holds the pin at version ${saved.supersededBy} \u2014 that is what runs.`);
71817
72458
  }
71818
- for (const line of recomposeNextSteps(wf, version)) console.log(line);
72459
+ for (const line of recomposeNextSteps(wf, savedVersion)) console.log(line);
71819
72460
  return WORKFLOW_EXIT.OK;
71820
72461
  }
71821
72462
  __name(recomposeCore, "recomposeCore");
@@ -73623,7 +74264,7 @@ init_skills_api_service();
73623
74264
  init_developer_api_service();
73624
74265
  init_semver();
73625
74266
  init_analytics();
73626
- import inquirer12 from "inquirer";
74267
+ import inquirer10 from "inquirer";
73627
74268
 
73628
74269
  // src/commands/template.ts
73629
74270
  init_cli();
@@ -73751,6 +74392,54 @@ init_command_utils();
73751
74392
  init_analytics();
73752
74393
  init_files();
73753
74394
  init_cli_error();
74395
+
74396
+ // src/commands/template-install-flags.ts
74397
+ init_cli_error();
74398
+ var PERSONA_HINT = "Use --persona-vars NAME=value[,NAME=value...] (repeatable)";
74399
+ var ACCEPT_HINT = "e.g. skills/refund-skill (the primitives named in the 409 MODIFIED_SINCE_INSTALL response)";
74400
+ function parsePersonaVars(raw) {
74401
+ if (!raw || raw.length === 0) return void 0;
74402
+ const result = {};
74403
+ for (const entry of raw) {
74404
+ for (const pair of entry.split(/,(?=\s*[A-Za-z_][A-Za-z0-9_]*\s*=)/)) {
74405
+ const trimmed2 = pair.trim();
74406
+ if (!trimmed2) continue;
74407
+ const eqIdx = trimmed2.indexOf("=");
74408
+ if (eqIdx === -1) {
74409
+ throw CliError.usage(`Invalid --persona-vars entry "${trimmed2}": expected KEY=value`, PERSONA_HINT);
74410
+ }
74411
+ const key = trimmed2.slice(0, eqIdx).trim();
74412
+ if (!key) {
74413
+ throw CliError.usage(`Invalid --persona-vars entry "${trimmed2}": the variable name is empty`, PERSONA_HINT);
74414
+ }
74415
+ if (Object.prototype.hasOwnProperty.call(result, key)) {
74416
+ throw CliError.usage(`Duplicate --persona-vars key "${key}"`, PERSONA_HINT);
74417
+ }
74418
+ result[key] = trimmed2.slice(eqIdx + 1).trim();
74419
+ }
74420
+ }
74421
+ return Object.keys(result).length > 0 ? result : void 0;
74422
+ }
74423
+ __name(parsePersonaVars, "parsePersonaVars");
74424
+ function parseAcceptModified(raw) {
74425
+ if (!raw || raw.length === 0) return void 0;
74426
+ const result = [];
74427
+ for (const entry of raw) {
74428
+ for (const part of entry.split(",")) {
74429
+ const trimmed2 = part.trim();
74430
+ if (!trimmed2) continue;
74431
+ const slash = trimmed2.indexOf("/");
74432
+ if (slash <= 0 || slash === trimmed2.length - 1) {
74433
+ throw CliError.usage(`Invalid --accept-modified entry "${trimmed2}": expected kind/key`, ACCEPT_HINT);
74434
+ }
74435
+ if (!result.includes(trimmed2)) result.push(trimmed2);
74436
+ }
74437
+ }
74438
+ return result.length > 0 ? result : void 0;
74439
+ }
74440
+ __name(parseAcceptModified, "parseAcceptModified");
74441
+
74442
+ // src/commands/template.ts
73754
74443
  function showTemplateUsage() {
73755
74444
  console.log("\nUsage:");
73756
74445
  console.log(" lua marketplace template Interactive mode");
@@ -73761,7 +74450,7 @@ function showTemplateUsage() {
73761
74450
  console.log(" publish --template-id <id> [--source-version <n>] [--changelog <text>] [--env-contract KEY=desc,...] [--skip-auto-apply]");
73762
74451
  console.log(" view --template-id <id> [--version <n>] [--json]");
73763
74452
  console.log(" versions --template-id <id> [--json]");
73764
- console.log(" install --template-id <id> [--version <n>] [--env-vars k=v,...] --force");
74453
+ console.log(" install --template-id <id> [--version <n>] [--env-vars k=v,...] [--persona-vars K=v,...] [--accept-modified kind/key,...] --force");
73765
74454
  console.log(" apply --template-id <id> [--version <n>] (--agents a,b | --file <path> | --all-installed) --force [--no-wait]");
73766
74455
  console.log(" status --template-id <id> [--json]");
73767
74456
  console.log(" health --template-id <id> [--window-days <n>] [--json] Fleet workflow health per install (R46)");
@@ -74175,6 +74864,12 @@ var TEMPLATE_SECTION_KEYS = [
74175
74864
  "onUninstall",
74176
74865
  "installPolicy"
74177
74866
  ];
74867
+ var HOOK_KEYS = [
74868
+ "tool",
74869
+ "instruction",
74870
+ "startWorkflow",
74871
+ "firstProof"
74872
+ ];
74178
74873
  function sectionKeys(section2, value3) {
74179
74874
  if (value3 === void 0 || value3 === null) return [];
74180
74875
  if (section2 === "connections") return (value3 ?? []).map((entry) => entry.key);
@@ -74184,14 +74879,7 @@ function sectionKeys(section2, value3) {
74184
74879
  }
74185
74880
  if (section2 === "onInstall" || section2 === "onUninstall") {
74186
74881
  const hook = value3;
74187
- return [
74188
- ...hook.tool ? [
74189
- "tool"
74190
- ] : [],
74191
- ...hook.instruction ? [
74192
- "instruction"
74193
- ] : []
74194
- ];
74882
+ return HOOK_KEYS.filter((key) => Boolean(hook[key]));
74195
74883
  }
74196
74884
  return Object.keys(value3);
74197
74885
  }
@@ -74377,6 +75065,8 @@ async function templateInstallAction(templateApi, config, options) {
74377
75065
  const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to install?", false);
74378
75066
  const version = options.version ? Number.parseInt(options.version, 10) : void 0;
74379
75067
  const envValues = options.envVars ? parseKeyValuePairs(options.envVars) : void 0;
75068
+ const personaVars = parsePersonaVars(options.personaVars);
75069
+ const acceptModifiedPrimitives = parseAcceptModified(options.acceptModified);
74380
75070
  if (!options.force) {
74381
75071
  writeInfo("\n\u{1F4CB} Install Summary:");
74382
75072
  writeInfo(` Template: ${templateId}`);
@@ -74385,6 +75075,12 @@ async function templateInstallAction(templateApi, config, options) {
74385
75075
  if (envValues && Object.keys(envValues).length > 0) {
74386
75076
  writeInfo(` Env values: ${Object.keys(envValues).length} configured`);
74387
75077
  }
75078
+ if (personaVars) {
75079
+ writeInfo(` Persona vars: ${Object.keys(personaVars).length} configured`);
75080
+ }
75081
+ if (acceptModifiedPrimitives) {
75082
+ writeInfo(` Accepting modified: ${acceptModifiedPrimitives.join(", ")}`);
75083
+ }
74388
75084
  throw CliError.usage("This action requires --force to confirm", "Use --force to confirm installation");
74389
75085
  }
74390
75086
  if (options.skipEnvCheck) {
@@ -74394,7 +75090,9 @@ async function templateInstallAction(templateApi, config, options) {
74394
75090
  const install = await templateApi.install(templateId, agentId, {
74395
75091
  version,
74396
75092
  envValues,
74397
- allowCreatorUpdates: options.allowCreatorUpdates
75093
+ allowCreatorUpdates: options.allowCreatorUpdates,
75094
+ personaVars,
75095
+ acceptModifiedPrimitives
74398
75096
  });
74399
75097
  if (options.json) {
74400
75098
  console.log(JSON.stringify(install, null, 2));
@@ -75076,12 +75774,12 @@ __name(transferOwnershipNonInteractive, "transferOwnershipNonInteractive");
75076
75774
  async function viewListedSkillsNonInteractive(marketplaceApi, options, mode) {
75077
75775
  writeProgress(mode === "authored" ? "\u{1F504} Loading skills you authored..." : "\u{1F504} Loading this organization's skills...");
75078
75776
  const skills = mode === "authored" ? await marketplaceApi.getCreatorSkills() : await marketplaceApi.getOrgSkills();
75079
- if (!skills || skills.length === 0) {
75080
- writeInfo(mode === "authored" ? "\u{1F4E6} You haven't authored any marketplace skills yet." : "\u{1F4E6} This organization doesn't own any marketplace skills yet.");
75777
+ if (options.json) {
75778
+ console.log(JSON.stringify(skills ?? [], null, 2));
75081
75779
  return;
75082
75780
  }
75083
- if (options.json) {
75084
- console.log(JSON.stringify(skills, null, 2));
75781
+ if (!skills || skills.length === 0) {
75782
+ writeInfo(mode === "authored" ? "\u{1F4E6} You haven't authored any marketplace skills yet." : "\u{1F4E6} This organization doesn't own any marketplace skills yet.");
75085
75783
  return;
75086
75784
  }
75087
75785
  console.log(mode === "authored" ? `
@@ -75310,12 +76008,12 @@ async function listInstalledSkillsNonInteractive(marketplaceApi, config, options
75310
76008
  }
75311
76009
  writeProgress("\u{1F504} Loading installed marketplace skills...");
75312
76010
  const skills = await marketplaceApi.getInstalledSkills(agentId);
75313
- if (!skills || skills.length === 0) {
75314
- writeInfo("\u{1F4E6} No marketplace skills installed on this agent.");
76011
+ if (options.json) {
76012
+ console.log(JSON.stringify(skills ?? [], null, 2));
75315
76013
  return;
75316
76014
  }
75317
- if (options.json) {
75318
- console.log(JSON.stringify(skills, null, 2));
76015
+ if (!skills || skills.length === 0) {
76016
+ writeInfo("\u{1F4E6} No marketplace skills installed on this agent.");
75319
76017
  return;
75320
76018
  }
75321
76019
  console.log(`
@@ -75918,7 +76616,7 @@ async function handleEnvVarConfiguration(initialEnvVars) {
75918
76616
  name: "Delete a variable",
75919
76617
  value: "delete"
75920
76618
  },
75921
- new inquirer12.Separator(),
76619
+ new inquirer10.Separator(),
75922
76620
  {
75923
76621
  name: "Finish and continue",
75924
76622
  value: "done"
@@ -75955,7 +76653,7 @@ async function handleEnvVarAction(action, envVars, detectedKeys) {
75955
76653
  name: `From .env file: ${key}`,
75956
76654
  value: key
75957
76655
  })),
75958
- new inquirer12.Separator(),
76656
+ new inquirer10.Separator(),
75959
76657
  {
75960
76658
  name: "Manually enter a variable name",
75961
76659
  value: "manual"
@@ -76000,7 +76698,7 @@ async function handleEnvVarAction(action, envVars, detectedKeys) {
76000
76698
  message: "Which variable do you want to edit?",
76001
76699
  choices: [
76002
76700
  ...keys,
76003
- new inquirer12.Separator(),
76701
+ new inquirer10.Separator(),
76004
76702
  {
76005
76703
  name: "Back",
76006
76704
  value: "back"
@@ -76022,7 +76720,7 @@ async function handleEnvVarAction(action, envVars, detectedKeys) {
76022
76720
  message: "Which variable do you want to delete?",
76023
76721
  choices: [
76024
76722
  ...keys,
76025
- new inquirer12.Separator(),
76723
+ new inquirer10.Separator(),
76026
76724
  {
76027
76725
  name: "Back",
76028
76726
  value: "back"
@@ -76125,7 +76823,7 @@ async function browseAndSelectSkill(marketplaceApi, purpose, publishedVersionsOn
76125
76823
  }))
76126
76824
  ];
76127
76825
  if (hasNextPage || hasPrevPage) {
76128
- choices.push(new inquirer12.Separator());
76826
+ choices.push(new inquirer10.Separator());
76129
76827
  if (hasPrevPage) {
76130
76828
  choices.push({
76131
76829
  name: `\u2190 Previous page (${currentPage - 1}/${totalPages})`,
@@ -76143,7 +76841,7 @@ async function browseAndSelectSkill(marketplaceApi, purpose, publishedVersionsOn
76143
76841
  });
76144
76842
  }
76145
76843
  }
76146
- choices.push(new inquirer12.Separator());
76844
+ choices.push(new inquirer10.Separator());
76147
76845
  choices.push({
76148
76846
  name: "\u2190 Back to menu",
76149
76847
  value: {
@@ -77493,6 +78191,11 @@ var CALLBACK_PORT = 19837;
77493
78191
  var CALLBACK_HOST = "127.0.0.1";
77494
78192
  var CALLBACK_URL = `http://${CALLBACK_HOST}:${CALLBACK_PORT}/callback`;
77495
78193
  var AGENT_WEBHOOK_URL = `${BASE_URLS.API}/webhook/unifiedto/data`;
78194
+ var DEFAULT_HIDE_SENSITIVE = false;
78195
+ function coerceHideSensitive(raw) {
78196
+ return raw === "true";
78197
+ }
78198
+ __name(coerceHideSensitive, "coerceHideSensitive");
77496
78199
  var DEFAULT_VIRTUAL_WEBHOOK_INTERVAL = 1;
77497
78200
  var VIRTUAL_WEBHOOK_INTERVAL_CHOICES = [
77498
78201
  {
@@ -77719,7 +78422,7 @@ async function executeNonInteractive12(context, action, cmdOptions) {
77719
78422
  connectionId: cmdOptions?.connectionId,
77720
78423
  authMethod: cmdOptions?.authMethod,
77721
78424
  scopes: cmdOptions?.scopes,
77722
- hideSensitive: cmdOptions?.hideSensitive === "true",
78425
+ hideSensitive: coerceHideSensitive(cmdOptions?.hideSensitive),
77723
78426
  hideSensitiveProvided: cmdOptions?.hideSensitive !== void 0,
77724
78427
  accountLabel: cmdOptions?.accountLabel,
77725
78428
  scope: cmdOptions?.scope,
@@ -78325,7 +79028,7 @@ async function connectIntegrationFlow(context, options = {}) {
78325
79028
  });
78326
79029
  console.log("\nYou will enter these on the Unified.to authorization page.\n");
78327
79030
  }
78328
- let hideSensitive = false;
79031
+ let hideSensitive = DEFAULT_HIDE_SENSITIVE;
78329
79032
  if (userScope) {
78330
79033
  } else if (options.hideSensitive !== void 0) {
78331
79034
  hideSensitive = options.hideSensitive;
@@ -78335,7 +79038,7 @@ async function connectIntegrationFlow(context, options = {}) {
78335
79038
  type: "confirm",
78336
79039
  name: "hide",
78337
79040
  message: "Hide sensitive data (PII) from MCP tools?",
78338
- default: false
79041
+ default: DEFAULT_HIDE_SENSITIVE
78339
79042
  }
78340
79043
  ]);
78341
79044
  if (sensitiveAnswer) {
@@ -78550,7 +79253,7 @@ Integration: ${selectedIntegration.name}`);
78550
79253
  }
78551
79254
  }
78552
79255
  __name(connectIntegrationFlow, "connectIntegrationFlow");
78553
- async function finalizeConnection(context, integration, connectionId, scopes, hideSensitive = false, webhookConfig = {
79256
+ async function finalizeConnection(context, integration, connectionId, scopes, hideSensitive = DEFAULT_HIDE_SENSITIVE, webhookConfig = {
78554
79257
  triggers: [],
78555
79258
  webhookUrl: "",
78556
79259
  isCustomWebhook: false
@@ -79134,7 +79837,7 @@ async function updateConnectionFlow(context, options = {}) {
79134
79837
  console.log(`
79135
79838
  \u2713 Will request ${selectedScopes.length} scope(s)`);
79136
79839
  }
79137
- let hideSensitive = false;
79840
+ let hideSensitive = DEFAULT_HIDE_SENSITIVE;
79138
79841
  if (options.hideSensitive !== void 0) {
79139
79842
  hideSensitive = options.hideSensitive;
79140
79843
  } else {
@@ -79143,7 +79846,7 @@ async function updateConnectionFlow(context, options = {}) {
79143
79846
  type: "confirm",
79144
79847
  name: "hide",
79145
79848
  message: "Hide sensitive data (PII) from MCP tools?",
79146
- default: false
79849
+ default: DEFAULT_HIDE_SENSITIVE
79147
79850
  }
79148
79851
  ]);
79149
79852
  if (sensitiveAnswer) {
@@ -80631,7 +81334,7 @@ __name(telemetryCommand, "telemetryCommand");
80631
81334
  init_cli();
80632
81335
  init_command_utils();
80633
81336
  init_analytics();
80634
- 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";
80635
81338
  import { resolve as resolve5, join as join11 } from "path";
80636
81339
  init_artifact_loader();
80637
81340
  init_types();
@@ -80655,9 +81358,9 @@ async function governanceCommand(action) {
80655
81358
  return;
80656
81359
  }
80657
81360
  const srcDir = resolve5(process.cwd(), "src");
80658
- const targetDir = existsSync11(srcDir) ? srcDir : process.cwd();
81361
+ const targetDir = existsSync12(srcDir) ? srcDir : process.cwd();
80659
81362
  const filePath = join11(targetDir, "governance.ts");
80660
- if (existsSync11(filePath)) {
81363
+ if (existsSync12(filePath)) {
80661
81364
  const { overwrite } = await safePrompt([
80662
81365
  {
80663
81366
  type: "confirm",
@@ -80748,7 +81451,7 @@ async function governanceCommand(action) {
80748
81451
  }
80749
81452
  }
80750
81453
  const content = generateGovernanceFile(setup);
80751
- writeFileSync11(filePath, content, "utf-8");
81454
+ writeFileSync12(filePath, content, "utf-8");
80752
81455
  const relativePath = filePath.replace(process.cwd() + "/", "");
80753
81456
  writeSuccess(`Created ${relativePath}`);
80754
81457
  console.log("");
@@ -80786,9 +81489,9 @@ async function governanceCommand(action) {
80786
81489
  __name(governanceCommand, "governanceCommand");
80787
81490
  async function governanceRemove() {
80788
81491
  const srcDir = resolve5(process.cwd(), "src");
80789
- const targetDir = existsSync11(srcDir) ? srcDir : process.cwd();
81492
+ const targetDir = existsSync12(srcDir) ? srcDir : process.cwd();
80790
81493
  const filePath = join11(targetDir, "governance.ts");
80791
- const hasLocal = existsSync11(filePath);
81494
+ const hasLocal = existsSync12(filePath);
80792
81495
  const { confirm } = await safePrompt([
80793
81496
  {
80794
81497
  type: "confirm",
@@ -81139,7 +81842,7 @@ init_command_utils();
81139
81842
  init_artifact_loader();
81140
81843
  init_types();
81141
81844
  import { spawn as spawn3 } from "child_process";
81142
- 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";
81143
81846
  import { join as join12, relative as relative2, resolve as resolve6 } from "path";
81144
81847
  init_voice_api_service();
81145
81848
  init_constants();
@@ -81729,7 +82432,7 @@ function escapeRegex(s) {
81729
82432
  __name(escapeRegex, "escapeRegex");
81730
82433
  function detectRunner(cwd) {
81731
82434
  const pkgPath = join12(cwd, "package.json");
81732
- if (!existsSync12(pkgPath)) return null;
82435
+ if (!existsSync13(pkgPath)) return null;
81733
82436
  try {
81734
82437
  const pkg2 = JSON.parse(__require("fs").readFileSync(pkgPath, "utf8"));
81735
82438
  const deps = {
@@ -82126,7 +82829,7 @@ init_command_utils();
82126
82829
  init_files();
82127
82830
  init_cli();
82128
82831
  init_constants();
82129
- import inquirer13 from "inquirer";
82832
+ import inquirer11 from "inquirer";
82130
82833
  init_lua_fetch();
82131
82834
  init_request_credential();
82132
82835
  async function sourceListCommand(opts) {
@@ -82172,7 +82875,7 @@ async function sourceRollbackCommand(opts) {
82172
82875
  const dlBlobs = opts.downloadBlobs ?? downloadBlobsParallel;
82173
82876
  const restore = opts.restoreFiles ?? defaultRestore;
82174
82877
  if (!opts.force) {
82175
- const { confirm } = await inquirer13.prompt([
82878
+ const { confirm } = await inquirer11.prompt([
82176
82879
  {
82177
82880
  type: "confirm",
82178
82881
  name: "confirm",
@@ -82500,6 +83203,8 @@ async function versionListCommand(options = {}) {
82500
83203
  createdByEmail: v.createdByEmail,
82501
83204
  createdAt: v.createdAt,
82502
83205
  commitHash: v.commitHash,
83206
+ commitHashSource: v.commitHashSource,
83207
+ commitHashMissingReason: v.commitHashMissingReason,
82503
83208
  sourceManifestVersion: v.sourceManifestVersion,
82504
83209
  sourceDigest: v.sourceDigest
82505
83210
  }));
@@ -82542,6 +83247,7 @@ async function versionShowCommand(versionArg, options = {}) {
82542
83247
  console.log(` Created: ${v.createdAt} by ${v.createdBy}`);
82543
83248
  if (v.message) console.log(` Message: ${v.message}`);
82544
83249
  if (v.commitHash) console.log(` Commit: ${v.commitHash}`);
83250
+ else if (v.commitHashMissingReason) console.log(` Commit missing: ${v.commitHashMissingReason}`);
82545
83251
  console.log(` Model: ${v.snapshot.model}`);
82546
83252
  console.log(` Snapshot:`);
82547
83253
  console.log(` Skills: ${v.snapshot.skills.length}`);
@@ -83681,7 +84387,13 @@ function setupMarketplaceCommands(program2) {
83681
84387
  program2.command("marketplace [noun] [action]").description("\u{1F6CD}\uFE0F Browse, install, and manage marketplace skills and agent templates").option("--skill-name <name>", "Skill name (for skill list/update/uninstall)").option("--marketplace-id <id>", "Marketplace skill ID").option("--new-org-id <id>", "Destination organization ID (for skill transfer)").option("--version-id <id>", "Version ID (for skill publish/install)").option("--env-vars-json <json>", "JSON string with env var metadata (for skill publish)").option("--query <text>", "Search query (for skill search)").option("--page <n>", "Page number (for skill search)").option("--limit <n>", "Results per page (for skill search)").option("--name <name>", "Template name, an internal identifier (for template create)").option("--description <text>", "Description (for template create)").option("--template-id <id>", "Template ID").option("--window-days <n>", "Fleet-health window in days (template health, R46)").option("--source-version <n>", "Agent version to freeze into this template version (default: active) (for template publish)").option("--env-contract <pair>", "KEY=description env contract entry, repeatable; use KEY?=description for optional (for template publish)", (val, previous) => [
83682
84388
  ...previous,
83683
84389
  val
83684
- ], []).option("--skip-auto-apply", "Publish without auto-updating the installs that consented to creator updates (for template publish)").option("--version <n>", "Template version (for template view/install/apply)").option("--allow-creator-updates", "Allow the template creator to push future updates onto this install").option("--skip-env-check", "Deprecated no-op: the env-contract check is server-enforced; use `lua env` to satisfy the contract (for template install/apply)").option("--agents <ids>", "Comma-separated target agent IDs (for template apply)").option("--file <path>", "Path to a file with one target agent ID per line (for template apply)").option("--all-installed", "Target every agent that already has this template installed (for template apply)").option("--no-wait", "Print the apply runId immediately instead of polling for completion (for template apply)").option("--display-name <name>", "Display name (for skill list/edit, template create)").option("--visibility <visibility>", "Who can see and install it: public or private (for skill list, template create)").option("--changelog <text>", "Changelog for this version (for skill/template publish)").option("--env-vars <pairs>", "Comma-separated key=value pairs (for skill/template install/update)").option("--json", "Output as JSON").option("--force", "Skip confirmation prompts").option("--yes", "Auto-confirm ONLY the template-publish consequence prompt (section clear/narrow); unlike --force it skips no other confirmation").addHelpText("after", `
84390
+ ], []).option("--skip-auto-apply", "Publish without auto-updating the installs that consented to creator updates (for template publish)").option("--version <n>", "Template version (for template view/install/apply)").option("--allow-creator-updates", "Allow the template creator to push future updates onto this install").option("--persona-vars <pairs>", "Comma-separated KEY=value answers for the template's persona {{vars}}; repeatable, put a value containing ',KEY=' in its own occurrence (for template install)", (val, previous) => [
84391
+ ...previous ?? [],
84392
+ val
84393
+ ]).option("--accept-modified <entries>", "Comma-separated kind/key primitives you allow the install to overwrite after a 409 MODIFIED_SINCE_INSTALL; repeatable (for template install)", (val, previous) => [
84394
+ ...previous ?? [],
84395
+ val
84396
+ ]).option("--skip-env-check", "Deprecated no-op: the env-contract check is server-enforced; use `lua env` to satisfy the contract (for template install/apply)").option("--agents <ids>", "Comma-separated target agent IDs (for template apply)").option("--file <path>", "Path to a file with one target agent ID per line (for template apply)").option("--all-installed", "Target every agent that already has this template installed (for template apply)").option("--no-wait", "Print the apply runId immediately instead of polling for completion (for template apply)").option("--display-name <name>", "Display name (for skill list/edit, template create)").option("--visibility <visibility>", "Who can see and install it: public or private (for skill list, template create)").option("--changelog <text>", "Changelog for this version (for skill/template publish)").option("--env-vars <pairs>", "Comma-separated key=value pairs (for skill/template install/update)").option("--json", "Output as JSON").option("--force", "Skip confirmation prompts").option("--yes", "Auto-confirm ONLY the template-publish consequence prompt (section clear/narrow); unlike --force it skips no other confirmation").addHelpText("after", `
83685
84397
  Arguments:
83686
84398
  noun Optional: 'skill' or 'template' (prompts if not provided)
83687
84399
  action Optional: specific action for non-interactive mode
@@ -83707,7 +84419,7 @@ Template Actions:
83707
84419
  publish --template-id <id> [--source-version <n>] [--changelog <text>] [--env-contract KEY=desc,...]
83708
84420
  view --template-id <id> [--version <n>] [--json]
83709
84421
  versions --template-id <id> [--json]
83710
- install --template-id <id> [--version <n>] [--env-vars <k=v,...>] --force
84422
+ install --template-id <id> [--version <n>] [--env-vars <k=v,...>] [--persona-vars <K=v,...>] [--accept-modified <kind/key,...>] --force
83711
84423
  apply --template-id <id> [--version <n>] (--agents <a,b,c> | --file <path> | --all-installed) --force [--no-wait]
83712
84424
  status --template-id <id> [--json]
83713
84425
  installed [--json]
@@ -83729,6 +84441,7 @@ Examples:
83729
84441
  $ lua marketplace template Template action menu
83730
84442
  $ lua marketplace template create --name support-bot --display-name "Support Bot"
83731
84443
  $ lua marketplace template publish --template-id xyz --changelog "Add refund skill"
84444
+ $ lua marketplace template install --template-id xyz --persona-vars COMPANY_NAME=Acme,TONE=warm --force
83732
84445
  $ lua marketplace template apply --template-id xyz --all-installed --force
83733
84446
  `).action(marketplaceCommand);
83734
84447
  }
@@ -83792,7 +84505,7 @@ Examples:
83792
84505
  ...opts,
83793
84506
  accept: opts.pull || opts.accept
83794
84507
  }));
83795
- 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", `
83796
84509
  Arguments:
83797
84510
  type Optional: 'skill', 'webhook', 'job' or 'workflow' (prompts if not provided)
83798
84511
 
@@ -84125,28 +84838,36 @@ Notes:
84125
84838
  read it back, 'lua drains verify' finishes on its own; if it is write-only \u2014 the grant we
84126
84839
  recommend \u2014 list your prefix, find the object, and run 'lua drains confirm <id> --token <token>'.
84127
84840
  `).action(drainsCommand);
84128
- 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", `
84129
84842
  Arguments:
84130
- action Optional: list, status, enable, disable, remove, test, test-trigger
84843
+ action Optional: list, status, enable, disable, remove, test, test-trigger, credential
84131
84844
 
84132
84845
  Options:
84133
84846
  --device-name <name> Device name (required for most actions, prompted if not provided)
84134
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)
84135
84850
  --payload <json> JSON payload for test command or test-trigger
84136
84851
  --timeout <ms> Command timeout in milliseconds (default: 30000)
84137
- --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)
84138
84855
 
84139
84856
  Examples:
84140
84857
  $ lua devices Interactive management
84141
- $ lua devices list List all devices
84858
+ $ lua devices list List declared and connected devices, with status
84142
84859
  $ lua devices list --group printers List devices in group
84143
84860
  $ lua devices status --device-name label-printer Check device status
84144
84861
  $ lua devices enable --device-name label-printer Enable a device
84145
84862
  $ lua devices disable --device-name label-printer Disable a device
84146
84863
  $ lua devices remove --device-name label-printer Remove a device
84147
84864
  $ lua devices remove --device-name label-printer --force Remove without confirmation
84148
- $ lua devices test --device-name label-printer Test a command interactively
84149
- $ 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
84150
84871
  `).action(devicesCommand);
84151
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", `
84152
84873
  Arguments:
@@ -84168,7 +84889,7 @@ Examples:
84168
84889
  $ lua jobs versions -i myJob View job versions
84169
84890
  $ lua jobs history -i myJob View execution history
84170
84891
  `).action(jobsCommand);
84171
- 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", `
84172
84893
  Arguments:
84173
84894
  action list \xB7 view \xB7 versions \xB7 deploy \xB7 activate \xB7 deactivate \xB7 start \xB7 run \xB7 runs \xB7 status \xB7
84174
84895
  watch \xB7 cancel \xB7 resume \xB7 retry-step \xB7 resolve-step \xB7 raise-budget \xB7 approve \xB7 approval-payload \xB7
@@ -84303,7 +85024,7 @@ Examples:
84303
85024
  $ lua mcp deactivate --server-name api-server Deactivate a server
84304
85025
  $ lua mcp delete --server-name old-server Delete a server
84305
85026
  `).action(mcpCommand);
84306
- program2.command("integrations [action] [subaction]").description("\u{1F517} Connect third-party integrations via Unified.to").option("--integration <type>", "Integration type (e.g., linear, googlecalendar)").option("--auth-method <method>", "Authentication method: 'oauth' or 'token'").option("--scopes <scopes>", "Comma-separated OAuth scopes (or 'all' for all scopes)").option("--hide-sensitive <bool>", "Hide sensitive data from MCP tools (default: true)").option("--account-label <label>", "Account label used to distinguish multiple connected accounts").option("--scope <scope>", "Who owns the connection: 'agent' (default) or 'user'").option("--force", "Skip the confirmation prompt (for convert)").option("--forget", "Also forget what a personal connection (--scope user) added to memory on disconnect (default: false, memories kept)").option("--connection-id <id>", "Exact connection ID to update, disconnect, convert or pause/resume").option("--connection <id>", "Connection ID for trigger").option("--webhook-id <id>", "Trigger ID to delete/pause/resume").option("--object <type>", "Object type for webhook (e.g., task_task, calendar_event)").option("--event <type>", "Event type for webhook: created, updated, or deleted").option("--hook-url <url>", "Custom webhook URL (default: agent trigger)").option("--interval <minutes>", "Polling interval in minutes for virtual webhooks, 1-2880 (default 1; e.g. 1, 5, 15, 60, 1440, 2880)").option("--triggers <events>", "Comma-separated triggers (e.g., task_task.created,task_task.updated)").option("--custom-webhook", "Use custom webhook URL instead of agent trigger").option("--json", "Output as JSON (for list, info, requests and webhooks list/events commands)").option("--reason <text>", "Optional reason for pausing a trigger").addHelpText("after", `
85027
+ program2.command("integrations [action] [subaction]").description("\u{1F517} Connect third-party integrations via Unified.to").option("--integration <type>", "Integration type (e.g., linear, googlecalendar)").option("--auth-method <method>", "Authentication method: 'oauth' or 'token'").option("--scopes <scopes>", "Comma-separated OAuth scopes (or 'all' for all scopes)").option("--hide-sensitive <bool>", "Hide sensitive data from MCP tools (default: false; pass 'true' to hide)").option("--account-label <label>", "Account label used to distinguish multiple connected accounts").option("--scope <scope>", "Who owns the connection: 'agent' (default) or 'user'").option("--force", "Skip the confirmation prompt (for convert)").option("--forget", "Also forget what a personal connection (--scope user) added to memory on disconnect (default: false, memories kept)").option("--connection-id <id>", "Exact connection ID to update, disconnect, convert or pause/resume").option("--connection <id>", "Connection ID for trigger").option("--webhook-id <id>", "Trigger ID to delete/pause/resume").option("--object <type>", "Object type for webhook (e.g., task_task, calendar_event)").option("--event <type>", "Event type for webhook: created, updated, or deleted").option("--hook-url <url>", "Custom webhook URL (default: agent trigger)").option("--interval <minutes>", "Polling interval in minutes for virtual webhooks, 1-2880 (default 1; e.g. 1, 5, 15, 60, 1440, 2880)").option("--triggers <events>", "Comma-separated triggers (e.g., task_task.created,task_task.updated)").option("--custom-webhook", "Use custom webhook URL instead of agent trigger").option("--json", "Output as JSON (for list, info, requests and webhooks list/events commands)").option("--reason <text>", "Optional reason for pausing a trigger").addHelpText("after", `
84307
85028
  Arguments:
84308
85029
  action Optional: 'connect', 'update', 'list', 'available', 'info', 'disconnect',
84309
85030
  'convert', 'webhooks' (alias: 'triggers'), or 'mcp'
@@ -84318,7 +85039,7 @@ Options:
84318
85039
  create later. Publishing an agent removes its access.
84319
85040
  --auth-method <method> Authentication method: 'oauth' or 'token'
84320
85041
  --scopes <scopes> Comma-separated OAuth scopes, or 'all' for all available scopes
84321
- --hide-sensitive <bool> Hide sensitive data from MCP tools (default: true, use 'false' to show)
85042
+ --hide-sensitive <bool> Hide sensitive data from MCP tools (default: false, use 'true' to hide)
84322
85043
  --triggers <events> Comma-separated triggers to enable (e.g., task_task.created,task_task.updated)
84323
85044
  --custom-webhook Use custom webhook URL instead of agent trigger
84324
85045
  --hook-url <url> Custom webhook URL (use with --custom-webhook)
@@ -84711,6 +85432,7 @@ program.hook("preAction", (thisCommand) => {
84711
85432
  setCiMode(true);
84712
85433
  }
84713
85434
  });
85435
+ registerJsonErrorEnvelope(program);
84714
85436
  setupAuthCommands(program);
84715
85437
  setupSkillCommands(program);
84716
85438
  setupMarketplaceCommands(program);