lua-cli 3.36.0 → 3.37.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
@@ -1767,6 +1767,9 @@ function workflowOccurrenceId(lineageId, stepId) {
1767
1767
  function workflowOrgSlotKey(orgId, kind) {
1768
1768
  return `wf:org:${orgId}:${kind}`;
1769
1769
  }
1770
+ function workflowJobModelSourceLabel(source) {
1771
+ return WORKFLOW_JOB_MODEL_SOURCE_LABELS[source];
1772
+ }
1770
1773
  function scheduledTimeKey(scheduledTime) {
1771
1774
  return scheduledTime.replace(/[^0-9TZ]/g, "");
1772
1775
  }
@@ -2077,7 +2080,7 @@ function effectiveAgentFeatures(base, override, rule) {
2077
2080
  if (rule === "wholesale") return override || base || void 0;
2078
2081
  return effectiveAgentFeatureRows(base, override).rows;
2079
2082
  }
2080
- var __defProp2, __name2, 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, 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, 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_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, WORKFLOW_GOAL_JUDGE_SELF, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES, SUBAGENT_PER_KEY_FLAG_ENV, PER_KEY_FLAG_VALUES;
2083
+ var __defProp2, __name2, 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, 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, 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_RESOLVE_OUTPUT_MAX_BYTES, WORKFLOW_GOAL_JUDGE_SELF, REDACTED_PLACEHOLDER, PROVIDER_MESSAGE_MAX_CHARS, ERROR_MESSAGE_MAX_CHARS, SECRET_LITERAL_PATTERNS, SECRET_NAME, SECRET_PAIR_PATTERNS, GROUP_COUNT, WORKFLOW_SECRET_KEY_RE, WORKFLOW_RESERVED_SECRET_KEYS, SCRUB_INPUT_MAX_CHARS, SCRUB_CUT_BACKOFF_CHARS, WORKFLOW_AUDIT_EVENTS, WORKFLOW_AUDIT_METADATA_MAX_BYTES, INDENT, WRAP_WIDTH, NOUNS, GET_TOOL_NAMES, PREAMBLE, WORKFLOW_APPROVAL_OUTPUT_DECISIONS, WORKFLOW_APPROVAL_OUTPUT_SCHEMA, JSON_FENCE_RE, DEFAULT_ON_AGENT_FEATURES, SUBAGENT_PER_KEY_FLAG_ENV, PER_KEY_FLAG_VALUES;
2081
2084
  var init_dist = __esm({
2082
2085
  "../shared-types/dist/index.mjs"() {
2083
2086
  "use strict";
@@ -3520,6 +3523,16 @@ This text is who you are for this person. As you learn them, their name, their w
3520
3523
  __name2(workflowOrgSlotKey, "workflowOrgSlotKey");
3521
3524
  WORKFLOW_JOURNAL_PROTOCOL_VERSION = 1;
3522
3525
  WORKFLOW_CONNECTION_KEY_RE = /^[a-z][a-z0-9_-]{0,63}$/;
3526
+ WORKFLOW_JOB_MODEL_SOURCE_LABELS = {
3527
+ stamp: "lease stamp",
3528
+ initData: "run input",
3529
+ default: "placeholder default",
3530
+ node: "node.model",
3531
+ env: "platform default",
3532
+ org: "org default"
3533
+ };
3534
+ __name(workflowJobModelSourceLabel, "workflowJobModelSourceLabel");
3535
+ __name2(workflowJobModelSourceLabel, "workflowJobModelSourceLabel");
3523
3536
  __name(scheduledTimeKey, "scheduledTimeKey");
3524
3537
  __name2(scheduledTimeKey, "scheduledTimeKey");
3525
3538
  __name(scheduledWorkflowRunIdForTime, "scheduledWorkflowRunIdForTime");
@@ -3753,7 +3766,23 @@ This text is who you are for this person. As you learn them, their name, their w
3753
3766
  * gated and nobody approved it, and conflating the two would make "who approved this run"
3754
3767
  * unanswerable for every run of either kind (§H2 "Audit").
3755
3768
  */
3756
- "workflow.run.autonomy_applied"
3769
+ "workflow.run.autonomy_applied",
3770
+ // --- run budget cap enforcement (Job-tier billing plan D4; BAC-677) ---
3771
+ /**
3772
+ * The audit twin of the `run.budget_exceeded` run event (WJB-B2a): the run overshot its
3773
+ * `budget.maxCredits` on its LAST step and completed anyway, `budget.exceeded: true`. The budget family
3774
+ * already mirrors run events here — `workflow.run.budget_parked` / `workflow.run.budget_raised` are the
3775
+ * twins of `run.budget_parked` / `run.budget_raised` — and an organisation reviewing what it was charged
3776
+ * needs the overshoot in the audit store beside the raise that preceded it, not only in the run's own
3777
+ * event stream.
3778
+ *
3779
+ * Declared with the run event rather than after it because the emitter port
3780
+ * (`WorkflowAuditPort.action`, typed `workflow.run.${string}`) does not check against this tuple: a name
3781
+ * that is NOT declared here is written to the audit store all the same and no compiler says so.
3782
+ * Declaring it is what makes the later emitter checkable. `workflow.run.budget_parked` is likewise
3783
+ * declared and not yet emitted.
3784
+ */
3785
+ "workflow.run.budget_exceeded"
3757
3786
  ];
3758
3787
  WORKFLOW_AUDIT_METADATA_MAX_BYTES = 4 * 1024;
3759
3788
  __name(isWorkflowAuditEvent, "isWorkflowAuditEvent");
@@ -7992,6 +8021,49 @@ function graphHasJobTierStep(envelopeOrGraph) {
7992
8021
  const graph = Array.isArray(envelopeOrGraph) ? envelopeOrGraph : env.definition?.graph ?? [];
7993
8022
  return Array.isArray(graph) && graph.some(entryHasJobTier);
7994
8023
  }
8024
+ function jobTierSteps(envelopeOrGraph) {
8025
+ const out = [];
8026
+ if (!envelopeOrGraph || typeof envelopeOrGraph !== "object") return out;
8027
+ const env = envelopeOrGraph;
8028
+ const graph = Array.isArray(envelopeOrGraph) ? envelopeOrGraph : env.definition?.graph ?? [];
8029
+ if (!Array.isArray(graph)) return out;
8030
+ for (const entry of graph) collectJobTierSteps(entry, out);
8031
+ return out;
8032
+ }
8033
+ function jobTierStepIds(envelopeOrGraph) {
8034
+ return jobTierSteps(envelopeOrGraph).map((s) => s.stepId);
8035
+ }
8036
+ function collectJobTierSteps(entry, out) {
8037
+ const n2 = armEntry2(entry);
8038
+ if (!n2 || typeof n2 !== "object") return;
8039
+ const node = n2;
8040
+ const ws = node.workspace;
8041
+ if (node.tier === "job" || ws !== void 0 && ws !== "inherit") {
8042
+ const stepId = typeof node.id === "string" && node.id ? node.id : "(unnamed)";
8043
+ const model = typeof node.model === "string" && node.model.trim() ? node.model.trim() : void 0;
8044
+ out.push(model === void 0 ? {
8045
+ stepId
8046
+ } : {
8047
+ stepId,
8048
+ model
8049
+ });
8050
+ }
8051
+ switch (node.type) {
8052
+ case "parallel":
8053
+ if (Array.isArray(node.steps)) for (const s of node.steps) collectJobTierSteps(s, out);
8054
+ return;
8055
+ case "conditional":
8056
+ if (Array.isArray(node.steps)) for (const s of node.steps) collectJobTierSteps(s, out);
8057
+ if (node.otherwise !== void 0) collectJobTierSteps(node.otherwise, out);
8058
+ return;
8059
+ case "foreach":
8060
+ case "loop":
8061
+ collectJobTierSteps(node.step, out);
8062
+ return;
8063
+ default:
8064
+ return;
8065
+ }
8066
+ }
7995
8067
  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, WORKSPACE_TEMPLATE_EXPR_RE, SLEEP_UNTIL_REPLACEMENT, 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_HOURS, 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, 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;
7996
8068
  var init_dist2 = __esm({
7997
8069
  "../workflow-graph/dist/index.mjs"() {
@@ -8796,6 +8868,12 @@ var init_dist2 = __esm({
8796
8868
  __name4(entryHasJobTier, "entryHasJobTier");
8797
8869
  __name(graphHasJobTierStep, "graphHasJobTierStep");
8798
8870
  __name4(graphHasJobTierStep, "graphHasJobTierStep");
8871
+ __name(jobTierSteps, "jobTierSteps");
8872
+ __name4(jobTierSteps, "jobTierSteps");
8873
+ __name(jobTierStepIds, "jobTierStepIds");
8874
+ __name4(jobTierStepIds, "jobTierStepIds");
8875
+ __name(collectJobTierSteps, "collectJobTierSteps");
8876
+ __name4(collectJobTierSteps, "collectJobTierSteps");
8799
8877
  }
8800
8878
  });
8801
8879
 
@@ -53102,31 +53180,58 @@ function runMetering(run) {
53102
53180
  return run.usage?.metering === "priced" ? "priced" : "flat";
53103
53181
  }
53104
53182
  __name(runMetering, "runMetering");
53183
+ var SEAT_COPY = "charged like chat \u2014 actions = the call's price band \xD7 the model's multiplier per model call; cached tokens count at the provider's ratio";
53105
53184
  function budgetCopy(run) {
53106
53185
  if (runMetering(run) === "priced") {
53107
- if (run.usage?.engine === "seat") return "charged like chat \u2014 actions (tier \xD7 model multiplier) per model call on your seat plan";
53108
- if (run.usage?.engine === "legacy") return "charged like chat \u2014 one credit per model call on the legacy plan";
53109
- return "charged like chat \u2014 one credit per model call on the legacy plan, or actions (tier \xD7 model multiplier) on a seat plan";
53186
+ const engine = budgetEngineOf(run);
53187
+ if (engine === "seat") return SEAT_COPY;
53188
+ if (engine === "legacy") return "charged like chat \u2014 a credit is one model reply on a Job step, one agent step otherwise; tokens are never metered";
53189
+ return "charged like chat \u2014 a credit is one model reply on a Job step (one agent step otherwise) on the legacy plan, or actions = price band \xD7 the model's multiplier per model call on a seat plan";
53110
53190
  }
53191
+ if (run.budget?.unit === "actions") return SEAT_COPY;
53111
53192
  return "a credit is one agent step; a Job-tier attempt is 4 \u2014 tokens are never metered";
53112
53193
  }
53113
53194
  __name(budgetCopy, "budgetCopy");
53195
+ function budgetEngineOf(run) {
53196
+ const engine = run.usage?.engine;
53197
+ if (engine === "seat" || engine === "legacy") return engine;
53198
+ const unit = run.budget?.unit;
53199
+ return unit === "actions" ? "seat" : unit === "credits" ? "legacy" : void 0;
53200
+ }
53201
+ __name(budgetEngineOf, "budgetEngineOf");
53114
53202
  var fmtNum = /* @__PURE__ */ __name((v) => v.toLocaleString("en-US"), "fmtNum");
53115
53203
  function budgetLine(run) {
53116
53204
  const u = run.usage;
53117
53205
  const b = run.budget;
53118
53206
  if (!u && !b) return void 0;
53119
- const seat = u?.engine === "seat" || b?.unit === "actions";
53207
+ const seat = budgetEngineOf(run) === "seat";
53120
53208
  const spent = seat ? u?.actionsUsed ?? b?.spent?.actionsEstimate ?? 0 : u?.creditsUsed ?? b?.spent?.credits ?? 0;
53121
53209
  const cap = runBudgetCap(b);
53122
53210
  const parts = [
53123
53211
  `${fmtNum(spent)}${cap !== void 0 ? ` of ${fmtNum(cap)}` : ""} ${seat ? "actions" : "credits"} spent`,
53124
53212
  b?.remaining !== void 0 ? `${fmtNum(b.remaining)} remaining` : void 0,
53125
- seat && u?.creditsUsed ? `${fmtNum(u.creditsUsed)} flat credits` : void 0
53213
+ seat && u?.creditsUsed ? `${fmtNum(u.creditsUsed)} flat credits` : void 0,
53214
+ // [WJB-B5] (BAC-677 / plan D4): the run's own `budget.exceeded` stamp — the last step crossed the cap and
53215
+ // the run finished rather than parking for a raise nobody could act on. Printed only when the server
53216
+ // stamped it (never `false`, never inferred from `spent > cap`, which a concurrent settle can show for a
53217
+ // run that parked legitimately).
53218
+ b?.exceeded === true ? "finished past the cap" : void 0
53126
53219
  ].filter((p) => !!p);
53127
53220
  return `${parts.join(" \xB7 ")} (${budgetCopy(run)})`;
53128
53221
  }
53129
53222
  __name(budgetLine, "budgetLine");
53223
+ function tokensLine(run) {
53224
+ const t = run.usage?.tokens;
53225
+ if (!t) return void 0;
53226
+ const parts = [
53227
+ typeof t.inputTokens === "number" ? `${fmtNum(t.inputTokens)} uncached in` : void 0,
53228
+ typeof t.cacheReadTokens === "number" ? `${fmtNum(t.cacheReadTokens)} cache read` : void 0,
53229
+ typeof t.cacheCreationTokens === "number" ? `${fmtNum(t.cacheCreationTokens)} cache write` : void 0,
53230
+ typeof t.outputTokens === "number" ? `${fmtNum(t.outputTokens)} out` : void 0
53231
+ ].filter((p) => !!p);
53232
+ return parts.length ? parts.join(" \xB7 ") : void 0;
53233
+ }
53234
+ __name(tokensLine, "tokensLine");
53130
53235
  function autonomyDurationLabel(seconds) {
53131
53236
  if (!Number.isFinite(seconds) || seconds < 0) return `${seconds} s`;
53132
53237
  if (seconds >= 86400 && seconds % 86400 === 0) return `${fmtNum(seconds / 86400)} d`;
@@ -53265,6 +53370,8 @@ function printRun(run, withSteps) {
53265
53370
  if (consent) console.log(` Consent: ${consent}`);
53266
53371
  const budget = budgetLine(run);
53267
53372
  if (budget) console.log(` Budget: ${budget}`);
53373
+ const tokens = tokensLine(run);
53374
+ if (tokens) console.log(` Tokens: ${tokens}`);
53268
53375
  if (run.cancel) console.log(` Cancel: ${formatRunCancel(run.cancel)}`);
53269
53376
  if (run.gate) {
53270
53377
  const kind = run.gate.kind;
@@ -53275,7 +53382,7 @@ function printRun(run, withSteps) {
53275
53382
  } else if (kind === "budget") {
53276
53383
  console.log(`
53277
53384
  \u23F8\uFE0F Paused \u2014 run budget reached (${budgetCopy(run)}):`);
53278
- console.log(` lua workflows raise-budget ${id} --credits <n>`);
53385
+ console.log(` lua workflows raise-budget ${id} --credits <n> (<n> is the new cap in ${budgetEngineOf(run) === "seat" ? "actions" : "credits"})`);
53279
53386
  } else if (kind === "billing") {
53280
53387
  for (const line of billingParkLines(run)) console.log(line);
53281
53388
  } else if (kind === "model_policy") {
@@ -53309,11 +53416,17 @@ function printRun(run, withSteps) {
53309
53416
  else {
53310
53417
  console.log("");
53311
53418
  const withChildren = steps.some((s) => typeof s.childRunId === "string");
53419
+ const withTokens = steps.some((s) => !!s.tokens);
53312
53420
  console.log(renderTable([
53313
53421
  "Step",
53314
53422
  "Kind",
53315
53423
  "Status",
53316
53424
  "Attempt",
53425
+ ...withTokens ? [
53426
+ "Uncached",
53427
+ "Cached",
53428
+ "Output"
53429
+ ] : [],
53317
53430
  "Error",
53318
53431
  ...withChildren ? [
53319
53432
  "Child run"
@@ -53323,6 +53436,7 @@ function printRun(run, withSteps) {
53323
53436
  s.kind ?? "\u2014",
53324
53437
  s.status,
53325
53438
  stepAttemptCell(s),
53439
+ ...withTokens ? stepTokenCells(s) : [],
53326
53440
  stepErrorCell(s.error),
53327
53441
  ...withChildren ? [
53328
53442
  s.childRunId ?? ""
@@ -53352,6 +53466,22 @@ function billingParkLines(run) {
53352
53466
  return out;
53353
53467
  }
53354
53468
  __name(billingParkLines, "billingParkLines");
53469
+ function stepTokenCells(s) {
53470
+ const t = s.tokens;
53471
+ const cell = /* @__PURE__ */ __name((v) => typeof v === "number" && Number.isFinite(v) ? fmtNum(v) : "\u2014", "cell");
53472
+ if (!t) return [
53473
+ "\u2014",
53474
+ "\u2014",
53475
+ "\u2014"
53476
+ ];
53477
+ const cached = typeof t.cacheReadTokens === "number" || typeof t.cacheCreationTokens === "number" ? (t.cacheReadTokens ?? 0) + (t.cacheCreationTokens ?? 0) : void 0;
53478
+ return [
53479
+ cell(t.inputTokens),
53480
+ cell(cached),
53481
+ cell(t.outputTokens)
53482
+ ];
53483
+ }
53484
+ __name(stepTokenCells, "stepTokenCells");
53355
53485
  function stepAttemptLines(s) {
53356
53486
  const out = [];
53357
53487
  const cause = stepFailureLine(s.error);
@@ -53360,6 +53490,8 @@ function stepAttemptLines(s) {
53360
53490
  if (burned) out.push(` \u03A3 ${s.stepId}: attempt ${s.attempt ?? 1} ${s.status}: ${burned}`);
53361
53491
  const billed = stepBillingLine(s.billing);
53362
53492
  if (billed) out.push(` $ ${s.stepId}: attempt ${s.billing?.attempt ?? s.attempt ?? 1} billed: ${billed}`);
53493
+ const jobModel = stepJobModelLine(s);
53494
+ if (jobModel) out.push(` \u2699 ${s.stepId}: ${jobModel}`);
53363
53495
  const fetchable = outputRefLine(s.outputRef);
53364
53496
  if (fetchable) out.push(` \u21E9 ${s.stepId}: ${fetchable}`);
53365
53497
  const escalated = approverFallbackLine(s);
@@ -53373,6 +53505,22 @@ function stepAttemptLines(s) {
53373
53505
  return out;
53374
53506
  }
53375
53507
  __name(stepAttemptLines, "stepAttemptLines");
53508
+ function stepJobModelLine(s) {
53509
+ const j = s.job;
53510
+ if (!j) return void 0;
53511
+ const parts = [
53512
+ j.model ? `model ${j.model}` : void 0,
53513
+ typeof j.multiplier === "number" ? `\xD7${fmtNum(j.multiplier)}` : void 0,
53514
+ j.modelSource ? `chosen by ${jobModelSourceWord(j.modelSource)}` : void 0
53515
+ ].filter((p) => !!p);
53516
+ return parts.length ? parts.join(" \xB7 ") : void 0;
53517
+ }
53518
+ __name(stepJobModelLine, "stepJobModelLine");
53519
+ function jobModelSourceWord(source) {
53520
+ const labels = WORKFLOW_JOB_MODEL_SOURCE_LABELS;
53521
+ return labels[source] ?? source;
53522
+ }
53523
+ __name(jobModelSourceWord, "jobModelSourceWord");
53376
53524
  function approverFallbackLine(s) {
53377
53525
  const f = s.suspend?.approverFallback;
53378
53526
  if (!f?.from || !f.to) return void 0;
@@ -53683,7 +53831,7 @@ async function boundaryVerdict(runId, ev, state3, boundary) {
53683
53831
  return boundary(`\u23F8\uFE0F run parked on a billing gate \u2014 top up the workspace; it resumes within a few minutes (right away: lua workflows retry-step ${runId} --step ${stepId ?? "<stepId>"})`, WORKFLOW_EXIT.RUN_PARKED);
53684
53832
  }
53685
53833
  if (gate === "budget") {
53686
- return boundary(`\u23F8\uFE0F run budget reached \u2014 lua workflows raise-budget ${runId} --credits <n> (lua workflows status ${runId} says what a credit buys)`, WORKFLOW_EXIT.RUN_PARKED);
53834
+ return boundary(`\u23F8\uFE0F run budget reached \u2014 lua workflows raise-budget ${runId} --credits <n> (the cap is in this run's own budget unit \u2014 credits, or actions on a seat plan; lua workflows status ${runId} says which)`, WORKFLOW_EXIT.RUN_PARKED);
53687
53835
  }
53688
53836
  return boundary(`\u23F8\uFE0F run gated (${gate ?? "consent"}) \u2014 approve it from the desktop; then: lua workflows watch ${runId}`, WORKFLOW_EXIT.RUN_GATED);
53689
53837
  }
@@ -53700,7 +53848,7 @@ async function boundaryVerdict(runId, ev, state3, boundary) {
53700
53848
  }
53701
53849
  }
53702
53850
  if (type === "run.budget_parked") {
53703
- return boundary(`\u23F8\uFE0F run budget reached \u2014 lua workflows raise-budget ${runId} --credits <n> (lua workflows status ${runId} says what a credit buys)`, WORKFLOW_EXIT.RUN_PARKED);
53851
+ return boundary(`\u23F8\uFE0F run budget reached \u2014 lua workflows raise-budget ${runId} --credits <n> (the cap is in this run's own budget unit \u2014 credits, or actions on a seat plan; lua workflows status ${runId} says which)`, WORKFLOW_EXIT.RUN_PARKED);
53704
53852
  }
53705
53853
  if (type === "run.completed") return WORKFLOW_EXIT.OK;
53706
53854
  if (type === "run.failed" || type === "run.timed_out") return WORKFLOW_EXIT.RUN_FAILED;
@@ -53930,10 +54078,10 @@ function budgetCapFlag(cap) {
53930
54078
  return "--credits";
53931
54079
  }
53932
54080
  __name(budgetCapFlag, "budgetCapFlag");
53933
- function budgetCapsLabel(b) {
54081
+ function budgetCapsLabel(b, unit) {
53934
54082
  if (!b) return "";
53935
54083
  const parts = [];
53936
- if (b.maxCredits !== void 0) parts.push(`${b.maxCredits} credits`);
54084
+ if (b.maxCredits !== void 0) parts.push(`${b.maxCredits} ${unit ?? "credits"}`);
53937
54085
  if (b.maxSteps !== void 0) parts.push(`${b.maxSteps} steps`);
53938
54086
  if (b.maxJobSeconds !== void 0) parts.push(`${b.maxJobSeconds}s job`);
53939
54087
  if (b.maxDurationSeconds !== void 0) parts.push(`${b.maxDurationSeconds}s wall`);
@@ -53999,9 +54147,10 @@ async function raiseBudgetCore(ctx, runId, o) {
53999
54147
  emitJson(ctx, res);
54000
54148
  if (!ctx.json) {
54001
54149
  const d = res.data;
54002
- const caps = budgetCapsLabel(d.budget ?? d.to);
54150
+ const unit = d.unit === "actions" ? "actions" : "credits";
54151
+ const caps = budgetCapsLabel(d.budget ?? d.to, unit);
54003
54152
  if (d.raised) {
54004
- const delta = d.from && d.to ? ` (${budgetCapsLabel(d.from)} \u2192 ${budgetCapsLabel(d.to)})` : caps ? ` to ${caps}` : "";
54153
+ const delta = d.from && d.to ? ` (${budgetCapsLabel(d.from, unit)} \u2192 ${budgetCapsLabel(d.to, unit)})` : caps ? ` to ${caps}` : "";
54005
54154
  writeSuccess(`\u2705 budget raised${delta}${d.runStatus ? ` \xB7 run is ${d.runStatus}` : ""}`);
54006
54155
  if (d.resumed === false) writeInfo(`\u2139\uFE0F the run did not resume on this raise \u2014 the next step's reserve is still short (raise again), or nothing was parked: lua workflows status ${runId}`);
54007
54156
  else if (d.resumed) writeInfo(`\u{1F4A1} Follow it: lua workflows watch ${runId}`);
@@ -54346,8 +54495,62 @@ async function replayChildRun(ctx, childRunId) {
54346
54495
  };
54347
54496
  }
54348
54497
  __name(replayChildRun, "replayChildRun");
54349
- var WORKFLOW_LOG_EVENT_PATTERN = /progress|log|started|completed|failed|skipped|model_resolved|model_policy_warning/;
54498
+ var WORKFLOW_LOG_EVENT_PATTERN = /progress|log|started|completed|failed|skipped|model_resolved|model_policy_warning|budget_parked|budget_raised|budget_exceeded/;
54499
+ function jobModelEventDetail(data) {
54500
+ const d = data ?? {};
54501
+ const nested = d.detail && typeof d.detail === "object" ? d.detail : {};
54502
+ const pick = /* @__PURE__ */ __name((key) => d[key] !== void 0 ? d[key] : nested[key], "pick");
54503
+ const model = typeof pick("model") === "string" ? pick("model") : void 0;
54504
+ const raw = pick("multiplier");
54505
+ const multiplier = typeof raw === "number" && Number.isFinite(raw) ? raw : void 0;
54506
+ const source = typeof pick("source") === "string" ? pick("source") : void 0;
54507
+ const calibrated = pick("calibrated");
54508
+ if (!model && multiplier === void 0 && !source) return void 0;
54509
+ const tail = [
54510
+ multiplier !== void 0 ? `\xD7${fmtNum(multiplier)}` : void 0,
54511
+ source ? `(${jobModelSourceWord(source)})` : void 0,
54512
+ calibrated === false ? "\u2014 uncalibrated model, fallback rate" : void 0
54513
+ ].filter((p) => !!p);
54514
+ return `job model \u2192 ${model ?? "?"}${tail.length ? ` ${tail.join(" ")}` : ""}`;
54515
+ }
54516
+ __name(jobModelEventDetail, "jobModelEventDetail");
54517
+ function budgetEventDetail(type, data) {
54518
+ if (type !== "run.budget_parked" && type !== "run.budget_raised" && type !== "run.budget_exceeded") return void 0;
54519
+ const d = data ?? {};
54520
+ const nested = d.detail && typeof d.detail === "object" ? d.detail : {};
54521
+ const pick = /* @__PURE__ */ __name((key) => d[key] !== void 0 ? d[key] : nested[key], "pick");
54522
+ const numberOf = /* @__PURE__ */ __name((key) => {
54523
+ const v = pick(key);
54524
+ return typeof v === "number" && Number.isFinite(v) ? v : void 0;
54525
+ }, "numberOf");
54526
+ const stringOf = /* @__PURE__ */ __name((key) => {
54527
+ const v = pick(key);
54528
+ return typeof v === "string" && v ? v : void 0;
54529
+ }, "stringOf");
54530
+ const stepId = stringOf("stepId");
54531
+ const step3 = stepId ? ` (step ${stepId})` : "";
54532
+ if (type === "run.budget_raised") {
54533
+ const from = numberOf("from");
54534
+ const to = numberOf("to");
54535
+ const move = from !== void 0 && to !== void 0 ? `cap ${fmtNum(from)} \u2192 ${fmtNum(to)}` : "cap raised";
54536
+ const by = stringOf("by");
54537
+ const resumed = pick("resumed") === true ? " \u2014 run resumed" : "";
54538
+ return `${move}${by ? ` by ${by}` : ""}${resumed}`;
54539
+ }
54540
+ const dimension = stringOf("dimension");
54541
+ const spent = numberOf("spent");
54542
+ const cap = numberOf("cap");
54543
+ const figures = spent !== void 0 && cap !== void 0 ? `${fmtNum(spent)} of ${fmtNum(cap)}${dimension ? ` ${dimension}` : ""}` : dimension;
54544
+ const lead = type === "run.budget_exceeded" ? "finished past the cap" : "paused on its run budget";
54545
+ const detail = [
54546
+ figures,
54547
+ stringOf("engine")
54548
+ ].filter((p) => !!p).join(", ");
54549
+ return `${lead}${detail ? ` \u2014 ${detail}` : ""}${step3}`;
54550
+ }
54551
+ __name(budgetEventDetail, "budgetEventDetail");
54350
54552
  function modelEventDetail(type, data) {
54553
+ if (type === "step.job_model_resolved") return jobModelEventDetail(data);
54351
54554
  if (type !== "step.model_resolved" && type !== "step.model_policy_warning") return void 0;
54352
54555
  const d = data ?? {};
54353
54556
  const nested = d.detail ?? {};
@@ -54378,7 +54581,9 @@ async function logsCore(ctx, runId, o) {
54378
54581
  if (events.length === 0) console.log("(no log events yet)");
54379
54582
  for (const e of events) {
54380
54583
  const data = scrubEventData(e.data);
54381
- const msg = modelEventDetail(e.type, data) ?? data?.message ?? subrunEventDetail(e);
54584
+ const msg = modelEventDetail(e.type, data) ?? // [WJB-B5]: the budget events carry no `message` of their own — without a renderer they would print as a
54585
+ // bare type, which is why the pattern admitting them and this line land together.
54586
+ budgetEventDetail(e.type, data) ?? data?.message ?? subrunEventDetail(e);
54382
54587
  console.log(`[${clockOf(e.ts)}] ${e.type}${e.stepId ? ` \xB7 ${e.stepId}` : ""}${msg ? ` \xB7 ${msg}` : ""}`);
54383
54588
  }
54384
54589
  return WORKFLOW_EXIT.OK;
@@ -67808,7 +68013,7 @@ Examples:
67808
68013
  $ lua jobs versions -i myJob View job versions
67809
68014
  $ lua jobs history -i myJob View execution history
67810
68015
  `).action(jobsCommand);
67811
- 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 credit cap of a budget-parked run (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: approval 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: 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", `
68016
+ 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: approval 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: 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", `
67812
68017
  Arguments:
67813
68018
  action list \xB7 view \xB7 versions \xB7 deploy \xB7 activate \xB7 deactivate \xB7 start \xB7 run \xB7 runs \xB7 status \xB7
67814
68019
  watch \xB7 cancel \xB7 resume \xB7 retry-step \xB7 resolve-step \xB7 raise-budget \xB7 approve \xB7 approval-payload \xB7