lua-cli 3.34.0 → 3.36.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.
@@ -359,10 +359,113 @@ function isDesktopFileCommandName(value3) {
359
359
  function isDesktopFileSessionId(value3) {
360
360
  return typeof value3 === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value3);
361
361
  }
362
+ function workflowRetryMaxAttemptsMessage(got) {
363
+ const tail = got === void 0 ? "" : ` (got ${JSON.stringify(got)})`;
364
+ return `\`retry.maxAttempts\` must be an integer ${WORKFLOW_RETRY_MIN_ATTEMPTS}..${WORKFLOW_RETRY_MAX_ATTEMPTS}${tail}`;
365
+ }
366
+ function isWithinWorkflowRetryAttempts(value3) {
367
+ return typeof value3 === "number" && Number.isInteger(value3) && value3 >= WORKFLOW_RETRY_MIN_ATTEMPTS && value3 <= WORKFLOW_RETRY_MAX_ATTEMPTS;
368
+ }
369
+ function workflowRetryUnknownMembersMessage(keys) {
370
+ const named = keys.map((k) => {
371
+ const engine = WORKFLOW_RETRY_ENGINE_KEYS.includes(k);
372
+ return `\`${k}\`${engine ? " (engine-owned \u2014 stamped by resetAttempts, never authored)" : ""}`;
373
+ });
374
+ return `\`retry\` has no member ${named.join(", ")}; members: ${WORKFLOW_RETRY_POLICY_KEYS.join(", ")}`;
375
+ }
376
+ function unknownWorkflowRetryMembers(retry) {
377
+ if (!retry || typeof retry !== "object" || Array.isArray(retry)) return [];
378
+ return Object.keys(retry).filter((k) => !WORKFLOW_RETRY_POLICY_KEYS.includes(k));
379
+ }
380
+ function authoredRetryPolicy(retry) {
381
+ if (!retry || typeof retry !== "object" || Array.isArray(retry)) return void 0;
382
+ const src = retry;
383
+ const out = {};
384
+ for (const k of WORKFLOW_RETRY_POLICY_KEYS) if (src[k] !== void 0) out[k] = src[k];
385
+ return Object.keys(out).length ? out : void 0;
386
+ }
387
+ function retryBudgetBaseAttempt(row) {
388
+ const base = row.retry?.budgetBaseAttempt;
389
+ return typeof base === "number" && Number.isSafeInteger(base) && base > 0 ? base : 0;
390
+ }
391
+ function retryBudgetAttempt(row) {
392
+ return Math.max(0, row.attempt - retryBudgetBaseAttempt(row));
393
+ }
394
+ function retryBudgetMaxAttempts(row) {
395
+ const max = row.retry?.maxAttempts;
396
+ return typeof max === "number" && Number.isFinite(max) && max >= 1 ? max : 1;
397
+ }
398
+ function retryBudgetRemaining(row) {
399
+ return retryBudgetAttempt(row) < retryBudgetMaxAttempts(row);
400
+ }
401
+ function retriesRemaining(row) {
402
+ return Math.max(0, retryBudgetMaxAttempts(row) - retryBudgetAttempt(row));
403
+ }
404
+ function workflowModelCostComparison(estimate, onAgentModel, agentModel) {
405
+ if (agentModel === void 0 || onAgentModel === void 0 || !(onAgentModel > 0)) return void 0;
406
+ const ratio = Math.round(estimate / onAgentModel * 10) / 10;
407
+ return `\u2248 ${ratio}\xD7 the cost of running every step on ${agentModel}`;
408
+ }
409
+ function modelClassRank(modelClass) {
410
+ return WORKFLOW_MODEL_CLASSES.indexOf(modelClass);
411
+ }
412
+ function modelClassesAtOrBelow(maxClass) {
413
+ const ceiling = modelClassRank(maxClass);
414
+ return WORKFLOW_MODEL_CLASSES.filter((c) => modelClassRank(c) <= ceiling);
415
+ }
416
+ function workflowAutonomyMaxRunsPerHourCeiling(env2) {
417
+ const raw = Number((env2 ?? process.env)[WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_ENV]);
418
+ return Number.isFinite(raw) && raw > 0 ? raw : WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_CEILING;
419
+ }
420
+ function isWithinWorkflowAutonomyRange(value3, ceiling) {
421
+ return typeof value3 === "number" && Number.isInteger(value3) && value3 >= WORKFLOW_AUTONOMY_MIN_VALUE && value3 <= ceiling;
422
+ }
423
+ function workflowAutonomyRangeMessage(key, ceiling) {
424
+ return `\`${key}\` must be an integer ${WORKFLOW_AUTONOMY_MIN_VALUE}..${ceiling}`;
425
+ }
426
+ function isWithinWorkflowJobRange(member, value3) {
427
+ const { min, max } = WORKFLOW_JOB_RANGES[member];
428
+ return typeof value3 === "number" && Number.isInteger(value3) && value3 >= min && value3 <= max;
429
+ }
430
+ function workflowJobRangeMessage(member) {
431
+ const { min, max } = WORKFLOW_JOB_RANGES[member];
432
+ return `\`${member}\` must be an integer ${min}..${max}`;
433
+ }
434
+ function isWorkflowSingleStepType(type) {
435
+ return typeof type === "string" && WORKFLOW_SINGLE_STEP_TYPES.includes(type);
436
+ }
437
+ function isWorkflowHitlEntryType(type) {
438
+ return typeof type === "string" && WORKFLOW_HITL_ENTRY_TYPES.includes(type);
439
+ }
440
+ function isWorkflowArmEntryType(type) {
441
+ return typeof type === "string" && WORKFLOW_ARM_ENTRY_TYPES.includes(type);
442
+ }
443
+ function workflowContainerRunsHitlArm(container) {
444
+ return typeof container === "string" && WORKFLOW_HITL_ARM_CONTAINERS.includes(container);
445
+ }
446
+ function workflowHitlArmUnsupportedMessage(type, id, container) {
447
+ const legal = WORKFLOW_HITL_ARM_CONTAINERS.map((c) => `\`${c}\``).join(" / ");
448
+ return `the engine does not run \`${type}\` inside a \`${container}\` yet (node "${id}") \u2014 place it at the top level, as a ${legal} arm, or inside a child \`workflow\``;
449
+ }
450
+ function workflowHitlArmShapeMessage(type, id, shape) {
451
+ return shape === "mapped-arm" ? `\`${type}\` arm "${id}" takes the previous output as its payload \u2014 it cannot head a [mapping, step] chain; map before the container instead` : `a chunked foreach hands each child a slice of items, not one \u2014 \`${type}\` body "${id}" takes one item; drop \`chunk\``;
452
+ }
362
453
  function isModelIdSentinel(input) {
363
454
  const lower = (input ?? "").trim().toLowerCase();
364
455
  return lower === "auto" || lower.startsWith("auto/");
365
456
  }
457
+ function isModelClassRef(input) {
458
+ return modelClassOf(input) !== void 0;
459
+ }
460
+ function modelClassOf(input) {
461
+ const lower = (input ?? "").trim().toLowerCase();
462
+ if (!lower.startsWith(MODEL_CLASS_REF_PREFIX)) return void 0;
463
+ const c = lower.slice(MODEL_CLASS_REF_PREFIX.length);
464
+ return WORKFLOW_MODEL_CLASSES.includes(c) ? c : void 0;
465
+ }
466
+ function modelClassRef(modelClass) {
467
+ return `${MODEL_CLASS_REF_PREFIX}${modelClass}`;
468
+ }
366
469
  function normalizeModelId(input, registry) {
367
470
  const requested = typeof input === "string" ? input.trim() : "";
368
471
  if (!requested) return {
@@ -377,6 +480,11 @@ function normalizeModelId(input, registry) {
377
480
  id: lower,
378
481
  form: "sentinel"
379
482
  };
483
+ if (modelClassOf(lower) !== void 0) return {
484
+ ok: true,
485
+ id: lower,
486
+ form: "class"
487
+ };
380
488
  const slash = requested.indexOf("/");
381
489
  const malformed = slash === 0;
382
490
  const provider = slash > 0 ? lower.slice(0, slash) : void 0;
@@ -437,6 +545,9 @@ function modelUnresolvedMessage(r) {
437
545
  }
438
546
  return r.candidates.length ? `model "${r.requested}" does not resolve to an approved model \u2014 accepted forms: ${r.candidates.join(", ")}` : `model "${r.requested}" does not resolve to an approved model \u2014 accepted forms are the registry's provider-prefixed ids (provider/model) or a bare id that names exactly one of them`;
439
547
  }
548
+ function modelClassUnresolvedMessage(ref) {
549
+ return `model "${ref.trim()}" is a model-class request that was not resolved before dispatch \u2014 a class is resolved to a concrete approved model by the class map at dispatch, and is never sent to a provider as written; this step refuses rather than run on a substituted model`;
550
+ }
440
551
  function providerModelId(code) {
441
552
  const requested = typeof code === "string" ? code.trim() : "";
442
553
  if (!requested || isModelIdSentinel(requested)) return requested;
@@ -839,75 +950,6 @@ function scheduledTimeKey(scheduledTime) {
839
950
  function scheduledWorkflowRunIdForTime(jobId, scheduledTime) {
840
951
  return scheduledWorkflowRunId(jobId, scheduledTime);
841
952
  }
842
- function workflowRetryMaxAttemptsMessage(got) {
843
- const tail = got === void 0 ? "" : ` (got ${JSON.stringify(got)})`;
844
- return `\`retry.maxAttempts\` must be an integer ${WORKFLOW_RETRY_MIN_ATTEMPTS}..${WORKFLOW_RETRY_MAX_ATTEMPTS}${tail}`;
845
- }
846
- function isWithinWorkflowRetryAttempts(value3) {
847
- return typeof value3 === "number" && Number.isInteger(value3) && value3 >= WORKFLOW_RETRY_MIN_ATTEMPTS && value3 <= WORKFLOW_RETRY_MAX_ATTEMPTS;
848
- }
849
- function workflowRetryUnknownMembersMessage(keys) {
850
- const named = keys.map((k) => {
851
- const engine = WORKFLOW_RETRY_ENGINE_KEYS.includes(k);
852
- return `\`${k}\`${engine ? " (engine-owned \u2014 stamped by resetAttempts, never authored)" : ""}`;
853
- });
854
- return `\`retry\` has no member ${named.join(", ")}; members: ${WORKFLOW_RETRY_POLICY_KEYS.join(", ")}`;
855
- }
856
- function unknownWorkflowRetryMembers(retry) {
857
- if (!retry || typeof retry !== "object" || Array.isArray(retry)) return [];
858
- return Object.keys(retry).filter((k) => !WORKFLOW_RETRY_POLICY_KEYS.includes(k));
859
- }
860
- function authoredRetryPolicy(retry) {
861
- if (!retry || typeof retry !== "object" || Array.isArray(retry)) return void 0;
862
- const src = retry;
863
- const out = {};
864
- for (const k of WORKFLOW_RETRY_POLICY_KEYS) if (src[k] !== void 0) out[k] = src[k];
865
- return Object.keys(out).length ? out : void 0;
866
- }
867
- function retryBudgetBaseAttempt(row) {
868
- const base = row.retry?.budgetBaseAttempt;
869
- return typeof base === "number" && Number.isSafeInteger(base) && base > 0 ? base : 0;
870
- }
871
- function retryBudgetAttempt(row) {
872
- return Math.max(0, row.attempt - retryBudgetBaseAttempt(row));
873
- }
874
- function retryBudgetMaxAttempts(row) {
875
- const max = row.retry?.maxAttempts;
876
- return typeof max === "number" && Number.isFinite(max) && max >= 1 ? max : 1;
877
- }
878
- function retryBudgetRemaining(row) {
879
- return retryBudgetAttempt(row) < retryBudgetMaxAttempts(row);
880
- }
881
- function retriesRemaining(row) {
882
- return Math.max(0, retryBudgetMaxAttempts(row) - retryBudgetAttempt(row));
883
- }
884
- function isWithinWorkflowJobRange(member, value3) {
885
- const { min, max } = WORKFLOW_JOB_RANGES[member];
886
- return typeof value3 === "number" && Number.isInteger(value3) && value3 >= min && value3 <= max;
887
- }
888
- function workflowJobRangeMessage(member) {
889
- const { min, max } = WORKFLOW_JOB_RANGES[member];
890
- return `\`${member}\` must be an integer ${min}..${max}`;
891
- }
892
- function isWorkflowSingleStepType(type) {
893
- return typeof type === "string" && WORKFLOW_SINGLE_STEP_TYPES.includes(type);
894
- }
895
- function isWorkflowHitlEntryType(type) {
896
- return typeof type === "string" && WORKFLOW_HITL_ENTRY_TYPES.includes(type);
897
- }
898
- function isWorkflowArmEntryType(type) {
899
- return typeof type === "string" && WORKFLOW_ARM_ENTRY_TYPES.includes(type);
900
- }
901
- function workflowContainerRunsHitlArm(container) {
902
- return typeof container === "string" && WORKFLOW_HITL_ARM_CONTAINERS.includes(container);
903
- }
904
- function workflowHitlArmUnsupportedMessage(type, id, container) {
905
- const legal = WORKFLOW_HITL_ARM_CONTAINERS.map((c) => `\`${c}\``).join(" / ");
906
- return `the engine does not run \`${type}\` inside a \`${container}\` yet (node "${id}") \u2014 place it at the top level, as a ${legal} arm, or inside a child \`workflow\``;
907
- }
908
- function workflowHitlArmShapeMessage(type, id, shape) {
909
- return shape === "mapped-arm" ? `\`${type}\` arm "${id}" takes the previous output as its payload \u2014 it cannot head a [mapping, step] chain; map before the container instead` : `a chunked foreach hands each child a slice of items, not one \u2014 \`${type}\` body "${id}" takes one item; drop \`chunk\``;
910
- }
911
953
  function workflowGoalJudgeKind(judge) {
912
954
  return judge && typeof judge === "object" && judge.predicate !== void 0 ? "predicate" : "agent";
913
955
  }
@@ -1212,7 +1254,7 @@ function effectiveAgentFeatures(base, override, rule) {
1212
1254
  if (rule === "wholesale") return override || base || void 0;
1213
1255
  return effectiveAgentFeatureRows(base, override).rows;
1214
1256
  }
1215
- var __defProp2, __name2, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, MODEL_ID_BYOK_PROVIDERS, MODEL_SNAPSHOT_SUFFIX, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, KEYS, MAX_BODY_BYTES, MAX_ID_LENGTH, UTC_ISO, TEMPLATE_TRIGGER_URL_ENV_PREFIX, TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, LUA_SESSION_ID_CLAIM, SESSION_REVOKED_CODE, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_RUN_GATE_KINDS, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, WORKFLOW_SIGNAL_EVENT_SITES, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_SUSPEND_KINDS, WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS, WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES, WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES, 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_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, 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;
1257
+ var __defProp2, __name2, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_STANDING_START_TOOLS, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, WORKFLOW_RETRY_BACKOFFS, WORKFLOW_RETRY_MIN_ATTEMPTS, WORKFLOW_RETRY_POLICY_KEYS, WORKFLOW_RETRY_MAX_ATTEMPTS, WORKFLOW_RETRY_ENGINE_KEYS, WORKFLOW_JOB_RESOURCES, WORKFLOW_SIDE_EFFECTS, WORKFLOW_MODEL_CLASSES, WORKFLOW_DEFAULT_TASK_CLASS_MAP, WORKFLOW_MODELS_MAX_CLASS_DEFAULT, WORKFLOW_AUTONOMY_NUMERIC_KEYS, WORKFLOW_AUTONOMY_ENVELOPE_KEYS, WORKFLOW_AUTONOMY_DEFAULTS, WORKFLOW_AUTONOMY_CEILINGS, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_ENV, WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_CEILING, WORKFLOW_AUTONOMY_FORMS_DEFAULT, WORKFLOW_AUTONOMY_MIN_VALUE, WORKFLOW_JOB_RANGES, WORKFLOW_JOB_RANGE_MEMBERS, WORKFLOW_SINGLE_STEP_TYPES, WORKFLOW_HITL_ENTRY_TYPES, WORKFLOW_ARM_ENTRY_TYPES, WORKFLOW_HITL_ARM_CONTAINERS, WORKFLOW_GRAPH_ENTRY_STEP_KINDS, WORKFLOW_ARM_ENTRY_STEP_KINDS, WORKFLOW_BUDGET_MAX_DURATION_SECONDS, MODEL_ID_BYOK_PROVIDERS, MODEL_CLASS_REF_PREFIX, MODEL_SNAPSHOT_SUFFIX, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, PLATFORM_FALLBACK_MODEL_SOURCE, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, CORE_DRAINING_CODE, CORE_DRAINING_DEFAULT_RETRY_MS, CORE_DRAINING_MAX_RETRY_MS, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS, KEYS, MAX_BODY_BYTES, MAX_ID_LENGTH, UTC_ISO, TEMPLATE_TRIGGER_URL_ENV_PREFIX, TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES, SUBJECT_TYPES, SubjectTypeSchema, CREDENTIAL_TYPES, CredentialTypeSchema, DEVICE_OPERATIONS, DeviceOperationSchema, DEVICE_SCOPE_BY_OPERATION, DeviceBindingSchema, IdSchema, SESSION_AUTH_TIME_MAX_S, PrincipalDescriptorSchema, ActorDescriptorSchema, PrincipalOwnerSchema, CredentialLifecycleSchema, GeneralCredentialDescriptorSchema, DeviceCredentialDescriptorSchema, GeneralPrincipalContextSchema, DeviceCredentialPrincipalContextSchema, RawPrincipalContextSchema, PrincipalContextSchema, DeviceCredentialClaimSchema, LUA_CLIENT_HEADER, LUA_CLIENT_APPS, SEMVER_PATTERN, WEB_RELEASE_PATTERN, CLIENT_HEADER_PATTERN, LUA_SESSION_ID_CLAIM, SESSION_REVOKED_CODE, AUTHZ_PROJECTION_VERSION, ProjectedScopeSchema, DisplayRoleSchema, AuthorizationPrincipalSchema, CredentialContextSchema, ProjectionAnomalySchema, ProjectedOrgSchema, ProjectedResourceSchema, CapabilityProfilesSchema, RoleCatalogSchema, EffectiveAuthorizationSchema, ResourcePageSchema, SYSTEM_USER_PREFIX, WORKFLOW_RUN_IN_FLIGHT, WORKFLOW_RUN_IDLE, WORKFLOW_RUN_TERMINAL, WORKFLOW_RUN_STATUSES, WORKFLOW_RUN_GATE_KINDS, WORKFLOW_STEP_STATUSES, WORKFLOW_STEP_IN_FLIGHT, WORKFLOW_SIGNAL_EVENT_SITES, ARCHIVE_WINDOW_MARGIN_DAYS, WORKFLOW_ORG_PURGING_TTL_S, WORKFLOW_ORG_PURGE_FORCE_AFTER_MS, IDEMPOTENCY_HOLDING_STATUSES, WORKFLOW_SCHEDULED_RUN_ID_PREFIX, CLOUD_TASK_RUN_ID_PREFIX, WORKFLOW_SCHEDULE_KEY_MAX, WORKFLOW_SCHEDULE_IDEMPOTENCY_KEY_PREFIX, WORKFLOW_OPERATION_ID_PREFIX, WORKFLOW_CONNECTION_KEY_RE, WORKFLOW_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;
1216
1258
  var init_dist = __esm({
1217
1259
  "../shared-types/dist/index.mjs"() {
1218
1260
  "use strict";
@@ -1534,16 +1576,202 @@ var init_dist = __esm({
1534
1576
  __name2(isDesktopFileCommandName, "isDesktopFileCommandName");
1535
1577
  __name(isDesktopFileSessionId, "isDesktopFileSessionId");
1536
1578
  __name2(isDesktopFileSessionId, "isDesktopFileSessionId");
1579
+ WORKFLOW_RETRY_BACKOFFS = [
1580
+ "fixed",
1581
+ "exponential"
1582
+ ];
1583
+ WORKFLOW_RETRY_MIN_ATTEMPTS = 1;
1584
+ WORKFLOW_RETRY_POLICY_KEYS = [
1585
+ "maxAttempts",
1586
+ "backoffSeconds",
1587
+ "backoff",
1588
+ "maxBackoffSeconds"
1589
+ ];
1590
+ WORKFLOW_RETRY_MAX_ATTEMPTS = 20;
1591
+ __name(workflowRetryMaxAttemptsMessage, "workflowRetryMaxAttemptsMessage");
1592
+ __name2(workflowRetryMaxAttemptsMessage, "workflowRetryMaxAttemptsMessage");
1593
+ __name(isWithinWorkflowRetryAttempts, "isWithinWorkflowRetryAttempts");
1594
+ __name2(isWithinWorkflowRetryAttempts, "isWithinWorkflowRetryAttempts");
1595
+ WORKFLOW_RETRY_ENGINE_KEYS = [
1596
+ "budgetBaseAttempt"
1597
+ ];
1598
+ __name(workflowRetryUnknownMembersMessage, "workflowRetryUnknownMembersMessage");
1599
+ __name2(workflowRetryUnknownMembersMessage, "workflowRetryUnknownMembersMessage");
1600
+ __name(unknownWorkflowRetryMembers, "unknownWorkflowRetryMembers");
1601
+ __name2(unknownWorkflowRetryMembers, "unknownWorkflowRetryMembers");
1602
+ __name(authoredRetryPolicy, "authoredRetryPolicy");
1603
+ __name2(authoredRetryPolicy, "authoredRetryPolicy");
1604
+ __name(retryBudgetBaseAttempt, "retryBudgetBaseAttempt");
1605
+ __name2(retryBudgetBaseAttempt, "retryBudgetBaseAttempt");
1606
+ __name(retryBudgetAttempt, "retryBudgetAttempt");
1607
+ __name2(retryBudgetAttempt, "retryBudgetAttempt");
1608
+ __name(retryBudgetMaxAttempts, "retryBudgetMaxAttempts");
1609
+ __name2(retryBudgetMaxAttempts, "retryBudgetMaxAttempts");
1610
+ __name(retryBudgetRemaining, "retryBudgetRemaining");
1611
+ __name2(retryBudgetRemaining, "retryBudgetRemaining");
1612
+ __name(retriesRemaining, "retriesRemaining");
1613
+ __name2(retriesRemaining, "retriesRemaining");
1614
+ WORKFLOW_JOB_RESOURCES = [
1615
+ "small",
1616
+ "medium",
1617
+ "large"
1618
+ ];
1619
+ WORKFLOW_SIDE_EFFECTS = [
1620
+ "none",
1621
+ "external"
1622
+ ];
1623
+ WORKFLOW_MODEL_CLASSES = [
1624
+ "fast",
1625
+ "balanced",
1626
+ "strong"
1627
+ ];
1628
+ __name(workflowModelCostComparison, "workflowModelCostComparison");
1629
+ __name2(workflowModelCostComparison, "workflowModelCostComparison");
1630
+ WORKFLOW_DEFAULT_TASK_CLASS_MAP = Object.freeze({
1631
+ classify: "fast",
1632
+ extract: "fast",
1633
+ transform: "fast",
1634
+ draft: "balanced",
1635
+ research: "balanced",
1636
+ judge: "balanced",
1637
+ reason: "strong",
1638
+ code: "strong"
1639
+ });
1640
+ WORKFLOW_MODELS_MAX_CLASS_DEFAULT = WORKFLOW_MODEL_CLASSES[WORKFLOW_MODEL_CLASSES.length - 1];
1641
+ __name(modelClassRank, "modelClassRank");
1642
+ __name2(modelClassRank, "modelClassRank");
1643
+ __name(modelClassesAtOrBelow, "modelClassesAtOrBelow");
1644
+ __name2(modelClassesAtOrBelow, "modelClassesAtOrBelow");
1645
+ WORKFLOW_AUTONOMY_NUMERIC_KEYS = [
1646
+ "maxCredits",
1647
+ "maxSteps",
1648
+ "maxDurationSeconds",
1649
+ "maxActions",
1650
+ "maxRunsPerHour"
1651
+ ];
1652
+ WORKFLOW_AUTONOMY_ENVELOPE_KEYS = [
1653
+ "enabled",
1654
+ ...WORKFLOW_AUTONOMY_NUMERIC_KEYS,
1655
+ "forms"
1656
+ ];
1657
+ WORKFLOW_AUTONOMY_DEFAULTS = Object.freeze({
1658
+ maxCredits: 20,
1659
+ maxSteps: 15,
1660
+ maxDurationSeconds: 86400,
1661
+ maxRunsPerHour: 20
1662
+ });
1663
+ WORKFLOW_AUTONOMY_CEILINGS = Object.freeze({
1664
+ maxSteps: 40,
1665
+ maxDurationSeconds: 604800
1666
+ });
1667
+ WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_ENV = "LUA_WF_AUTONOMY_MAX_RUNS_PER_HOUR";
1668
+ WORKFLOW_AUTONOMY_MAX_RUNS_PER_HOUR_CEILING = 200;
1669
+ __name(workflowAutonomyMaxRunsPerHourCeiling, "workflowAutonomyMaxRunsPerHourCeiling");
1670
+ __name2(workflowAutonomyMaxRunsPerHourCeiling, "workflowAutonomyMaxRunsPerHourCeiling");
1671
+ WORKFLOW_AUTONOMY_FORMS_DEFAULT = Object.freeze([
1672
+ "graph",
1673
+ "static"
1674
+ ]);
1675
+ WORKFLOW_AUTONOMY_MIN_VALUE = 1;
1676
+ __name(isWithinWorkflowAutonomyRange, "isWithinWorkflowAutonomyRange");
1677
+ __name2(isWithinWorkflowAutonomyRange, "isWithinWorkflowAutonomyRange");
1678
+ __name(workflowAutonomyRangeMessage, "workflowAutonomyRangeMessage");
1679
+ __name2(workflowAutonomyRangeMessage, "workflowAutonomyRangeMessage");
1680
+ WORKFLOW_JOB_RANGES = Object.freeze({
1681
+ /** Coding-turn cap (`claude -p --max-turns`); absent ⇒ the cluster default (LUA_WF_JOB_MAX_TURNS). */
1682
+ maxTurns: Object.freeze({
1683
+ min: 1,
1684
+ max: 500
1685
+ }),
1686
+ /** Harness messages per attempt (one per content block); absent ⇒ the cluster default (400). */
1687
+ maxMessages: Object.freeze({
1688
+ min: 1,
1689
+ max: 5e3
1690
+ }),
1691
+ /** Input-side tokens per attempt (prompt + cache); absent ⇒ the cluster default (4M — LUA-708, was 30M). */
1692
+ maxInputTokens: Object.freeze({
1693
+ min: 1e6,
1694
+ max: 5e8
1695
+ })
1696
+ });
1697
+ WORKFLOW_JOB_RANGE_MEMBERS = Object.keys(WORKFLOW_JOB_RANGES);
1698
+ __name(isWithinWorkflowJobRange, "isWithinWorkflowJobRange");
1699
+ __name2(isWithinWorkflowJobRange, "isWithinWorkflowJobRange");
1700
+ __name(workflowJobRangeMessage, "workflowJobRangeMessage");
1701
+ __name2(workflowJobRangeMessage, "workflowJobRangeMessage");
1702
+ WORKFLOW_SINGLE_STEP_TYPES = [
1703
+ "agent",
1704
+ "tool",
1705
+ "workflow",
1706
+ "step"
1707
+ ];
1708
+ WORKFLOW_HITL_ENTRY_TYPES = [
1709
+ "approval",
1710
+ "waitForSignal"
1711
+ ];
1712
+ WORKFLOW_ARM_ENTRY_TYPES = [
1713
+ ...WORKFLOW_SINGLE_STEP_TYPES,
1714
+ ...WORKFLOW_HITL_ENTRY_TYPES
1715
+ ];
1716
+ WORKFLOW_HITL_ARM_CONTAINERS = [
1717
+ "parallel",
1718
+ "conditional",
1719
+ "foreach"
1720
+ ];
1721
+ __name(isWorkflowSingleStepType, "isWorkflowSingleStepType");
1722
+ __name2(isWorkflowSingleStepType, "isWorkflowSingleStepType");
1723
+ __name(isWorkflowHitlEntryType, "isWorkflowHitlEntryType");
1724
+ __name2(isWorkflowHitlEntryType, "isWorkflowHitlEntryType");
1725
+ __name(isWorkflowArmEntryType, "isWorkflowArmEntryType");
1726
+ __name2(isWorkflowArmEntryType, "isWorkflowArmEntryType");
1727
+ __name(workflowContainerRunsHitlArm, "workflowContainerRunsHitlArm");
1728
+ __name2(workflowContainerRunsHitlArm, "workflowContainerRunsHitlArm");
1729
+ __name(workflowHitlArmUnsupportedMessage, "workflowHitlArmUnsupportedMessage");
1730
+ __name2(workflowHitlArmUnsupportedMessage, "workflowHitlArmUnsupportedMessage");
1731
+ __name(workflowHitlArmShapeMessage, "workflowHitlArmShapeMessage");
1732
+ __name2(workflowHitlArmShapeMessage, "workflowHitlArmShapeMessage");
1733
+ WORKFLOW_GRAPH_ENTRY_STEP_KINDS = Object.freeze({
1734
+ agent: "agent",
1735
+ tool: "tool",
1736
+ workflow: "subrun",
1737
+ step: "code",
1738
+ mapping: "map",
1739
+ sleep: "sleep",
1740
+ sleepUntil: "sleepUntil",
1741
+ parallel: null,
1742
+ conditional: "branch",
1743
+ foreach: "foreach",
1744
+ loop: "loop",
1745
+ approval: "approval",
1746
+ waitForSignal: "signal"
1747
+ });
1748
+ WORKFLOW_ARM_ENTRY_STEP_KINDS = Object.freeze(Object.fromEntries(WORKFLOW_ARM_ENTRY_TYPES.map((t) => [
1749
+ t,
1750
+ WORKFLOW_GRAPH_ENTRY_STEP_KINDS[t]
1751
+ ])));
1752
+ WORKFLOW_BUDGET_MAX_DURATION_SECONDS = Object.freeze({
1753
+ min: 60,
1754
+ max: 2592e3
1755
+ });
1537
1756
  MODEL_ID_BYOK_PROVIDERS = [
1538
1757
  "azure",
1539
1758
  "bedrock"
1540
1759
  ];
1541
1760
  __name(isModelIdSentinel, "isModelIdSentinel");
1542
1761
  __name2(isModelIdSentinel, "isModelIdSentinel");
1762
+ MODEL_CLASS_REF_PREFIX = "class/";
1763
+ __name(isModelClassRef, "isModelClassRef");
1764
+ __name2(isModelClassRef, "isModelClassRef");
1765
+ __name(modelClassOf, "modelClassOf");
1766
+ __name2(modelClassOf, "modelClassOf");
1767
+ __name(modelClassRef, "modelClassRef");
1768
+ __name2(modelClassRef, "modelClassRef");
1543
1769
  __name(normalizeModelId, "normalizeModelId");
1544
1770
  __name2(normalizeModelId, "normalizeModelId");
1545
1771
  __name(modelUnresolvedMessage, "modelUnresolvedMessage");
1546
1772
  __name2(modelUnresolvedMessage, "modelUnresolvedMessage");
1773
+ __name(modelClassUnresolvedMessage, "modelClassUnresolvedMessage");
1774
+ __name2(modelClassUnresolvedMessage, "modelClassUnresolvedMessage");
1547
1775
  __name(providerModelId, "providerModelId");
1548
1776
  __name2(providerModelId, "providerModelId");
1549
1777
  MODEL_SNAPSHOT_SUFFIX = /(?:[-@](?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])|-(?:19|20)\d{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]))$/;
@@ -2175,7 +2403,15 @@ This text is who you are for this person. As you learn them, their name, their w
2175
2403
  "org-grant",
2176
2404
  "agent-grant-only"
2177
2405
  ]).describe("For user and staff principals, grant provenance: org-grant means a stored org grant produced the row. For owner-ceiling API keys, effective provenance: org-grant means the credential-owner intersection has org-level capability; agent-grant-only means the intersection reaches only an exact agent inside the org."),
2178
- anomalies: z3.array(ProjectionAnomalySchema).optional()
2406
+ anomalies: z3.array(ProjectionAnomalySchema).optional(),
2407
+ /**
2408
+ * How many agents and Spaces in this org the caller can read — the size of
2409
+ * the org's resource page under the same discovery rule, without paging it.
2410
+ */
2411
+ resourceCounts: z3.object({
2412
+ agents: z3.number().int().nonnegative(),
2413
+ spaces: z3.number().int().nonnegative()
2414
+ }).optional()
2179
2415
  }).passthrough();
2180
2416
  ProjectedResourceSchema = z3.object({
2181
2417
  resourceType: z3.literal("agent"),
@@ -2214,7 +2450,21 @@ This text is who you are for this person. As you learn them, their name, their w
2214
2450
  id: z3.string().min(1).max(256),
2215
2451
  name: z3.string().optional(),
2216
2452
  email: z3.string().optional()
2217
- }).optional()
2453
+ }).optional(),
2454
+ /**
2455
+ * Presentation enrichment (PRO-1994), product data only — never influences
2456
+ * discovery. These moved off the O(orgs) `/context` roster onto the bounded
2457
+ * per-active-org resource page so Desktop stops paying an org-count-scaled
2458
+ * cost at sign-in. `persona`/`avatar` are loose (`PersonaText` / `AgentAvatar`
2459
+ * are structured-or-string), `platform` marks the org's Designer agent
2460
+ * (previously stamped only by `/context`; retires with PRO-1657).
2461
+ */
2462
+ persona: z3.unknown().optional(),
2463
+ description: z3.string().optional(),
2464
+ avatar: z3.unknown().nullish(),
2465
+ platform: z3.boolean().optional(),
2466
+ /** A Space's supervised agent ids (`kind: 'space'` rows only). */
2467
+ supervisedAgents: z3.array(z3.string()).optional()
2218
2468
  }).passthrough();
2219
2469
  CapabilityProfilesSchema = z3.record(z3.string().min(1).max(64), z3.array(ProjectedScopeSchema));
2220
2470
  RoleCatalogSchema = z3.record(z3.string().min(1).max(128), z3.object({
@@ -2304,7 +2554,8 @@ This text is who you are for this person. As you learn them, their name, their w
2304
2554
  "org_archived",
2305
2555
  "disabled",
2306
2556
  "exception",
2307
- "budget"
2557
+ "budget",
2558
+ "model_policy"
2308
2559
  ];
2309
2560
  WORKFLOW_STEP_STATUSES = [
2310
2561
  "pending",
@@ -2388,126 +2639,6 @@ This text is who you are for this person. As you learn them, their name, their w
2388
2639
  ];
2389
2640
  WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES = 64 * 1024;
2390
2641
  WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES = 256 * 1024;
2391
- WORKFLOW_RETRY_BACKOFFS = [
2392
- "fixed",
2393
- "exponential"
2394
- ];
2395
- WORKFLOW_RETRY_MIN_ATTEMPTS = 1;
2396
- WORKFLOW_RETRY_POLICY_KEYS = [
2397
- "maxAttempts",
2398
- "backoffSeconds",
2399
- "backoff",
2400
- "maxBackoffSeconds"
2401
- ];
2402
- WORKFLOW_RETRY_MAX_ATTEMPTS = 20;
2403
- __name(workflowRetryMaxAttemptsMessage, "workflowRetryMaxAttemptsMessage");
2404
- __name2(workflowRetryMaxAttemptsMessage, "workflowRetryMaxAttemptsMessage");
2405
- __name(isWithinWorkflowRetryAttempts, "isWithinWorkflowRetryAttempts");
2406
- __name2(isWithinWorkflowRetryAttempts, "isWithinWorkflowRetryAttempts");
2407
- WORKFLOW_RETRY_ENGINE_KEYS = [
2408
- "budgetBaseAttempt"
2409
- ];
2410
- __name(workflowRetryUnknownMembersMessage, "workflowRetryUnknownMembersMessage");
2411
- __name2(workflowRetryUnknownMembersMessage, "workflowRetryUnknownMembersMessage");
2412
- __name(unknownWorkflowRetryMembers, "unknownWorkflowRetryMembers");
2413
- __name2(unknownWorkflowRetryMembers, "unknownWorkflowRetryMembers");
2414
- __name(authoredRetryPolicy, "authoredRetryPolicy");
2415
- __name2(authoredRetryPolicy, "authoredRetryPolicy");
2416
- __name(retryBudgetBaseAttempt, "retryBudgetBaseAttempt");
2417
- __name2(retryBudgetBaseAttempt, "retryBudgetBaseAttempt");
2418
- __name(retryBudgetAttempt, "retryBudgetAttempt");
2419
- __name2(retryBudgetAttempt, "retryBudgetAttempt");
2420
- __name(retryBudgetMaxAttempts, "retryBudgetMaxAttempts");
2421
- __name2(retryBudgetMaxAttempts, "retryBudgetMaxAttempts");
2422
- __name(retryBudgetRemaining, "retryBudgetRemaining");
2423
- __name2(retryBudgetRemaining, "retryBudgetRemaining");
2424
- __name(retriesRemaining, "retriesRemaining");
2425
- __name2(retriesRemaining, "retriesRemaining");
2426
- WORKFLOW_JOB_RESOURCES = [
2427
- "small",
2428
- "medium",
2429
- "large"
2430
- ];
2431
- WORKFLOW_SIDE_EFFECTS = [
2432
- "none",
2433
- "external"
2434
- ];
2435
- WORKFLOW_JOB_RANGES = Object.freeze({
2436
- /** Coding-turn cap (`claude -p --max-turns`); absent ⇒ the cluster default (LUA_WF_JOB_MAX_TURNS). */
2437
- maxTurns: Object.freeze({
2438
- min: 1,
2439
- max: 500
2440
- }),
2441
- /** Harness messages per attempt (one per content block); absent ⇒ the cluster default (400). */
2442
- maxMessages: Object.freeze({
2443
- min: 1,
2444
- max: 5e3
2445
- }),
2446
- /** Input-side tokens per attempt (prompt + cache); absent ⇒ the cluster default (4M — LUA-708, was 30M). */
2447
- maxInputTokens: Object.freeze({
2448
- min: 1e6,
2449
- max: 5e8
2450
- })
2451
- });
2452
- WORKFLOW_JOB_RANGE_MEMBERS = Object.keys(WORKFLOW_JOB_RANGES);
2453
- __name(isWithinWorkflowJobRange, "isWithinWorkflowJobRange");
2454
- __name2(isWithinWorkflowJobRange, "isWithinWorkflowJobRange");
2455
- __name(workflowJobRangeMessage, "workflowJobRangeMessage");
2456
- __name2(workflowJobRangeMessage, "workflowJobRangeMessage");
2457
- WORKFLOW_SINGLE_STEP_TYPES = [
2458
- "agent",
2459
- "tool",
2460
- "workflow",
2461
- "step"
2462
- ];
2463
- WORKFLOW_HITL_ENTRY_TYPES = [
2464
- "approval",
2465
- "waitForSignal"
2466
- ];
2467
- WORKFLOW_ARM_ENTRY_TYPES = [
2468
- ...WORKFLOW_SINGLE_STEP_TYPES,
2469
- ...WORKFLOW_HITL_ENTRY_TYPES
2470
- ];
2471
- WORKFLOW_HITL_ARM_CONTAINERS = [
2472
- "parallel",
2473
- "conditional",
2474
- "foreach"
2475
- ];
2476
- __name(isWorkflowSingleStepType, "isWorkflowSingleStepType");
2477
- __name2(isWorkflowSingleStepType, "isWorkflowSingleStepType");
2478
- __name(isWorkflowHitlEntryType, "isWorkflowHitlEntryType");
2479
- __name2(isWorkflowHitlEntryType, "isWorkflowHitlEntryType");
2480
- __name(isWorkflowArmEntryType, "isWorkflowArmEntryType");
2481
- __name2(isWorkflowArmEntryType, "isWorkflowArmEntryType");
2482
- __name(workflowContainerRunsHitlArm, "workflowContainerRunsHitlArm");
2483
- __name2(workflowContainerRunsHitlArm, "workflowContainerRunsHitlArm");
2484
- __name(workflowHitlArmUnsupportedMessage, "workflowHitlArmUnsupportedMessage");
2485
- __name2(workflowHitlArmUnsupportedMessage, "workflowHitlArmUnsupportedMessage");
2486
- __name(workflowHitlArmShapeMessage, "workflowHitlArmShapeMessage");
2487
- __name2(workflowHitlArmShapeMessage, "workflowHitlArmShapeMessage");
2488
- WORKFLOW_GRAPH_ENTRY_STEP_KINDS = Object.freeze({
2489
- agent: "agent",
2490
- tool: "tool",
2491
- workflow: "subrun",
2492
- step: "code",
2493
- mapping: "map",
2494
- sleep: "sleep",
2495
- sleepUntil: "sleepUntil",
2496
- parallel: null,
2497
- conditional: "branch",
2498
- foreach: "foreach",
2499
- loop: "loop",
2500
- approval: "approval",
2501
- waitForSignal: "signal"
2502
- });
2503
- WORKFLOW_ARM_ENTRY_STEP_KINDS = Object.freeze(Object.fromEntries(WORKFLOW_ARM_ENTRY_TYPES.map((t) => [
2504
- t,
2505
- WORKFLOW_GRAPH_ENTRY_STEP_KINDS[t]
2506
- ])));
2507
- WORKFLOW_BUDGET_MAX_DURATION_SECONDS = Object.freeze({
2508
- min: 60,
2509
- max: 2592e3
2510
- });
2511
2642
  WORKFLOW_GOAL_JUDGE_SELF = "$self";
2512
2643
  __name(workflowGoalJudgeKind, "workflowGoalJudgeKind");
2513
2644
  __name2(workflowGoalJudgeKind, "workflowGoalJudgeKind");
@@ -2712,7 +2843,20 @@ This text is who you are for this person. As you learn them, their name, their w
2712
2843
  "workflow.export.auto_pushed",
2713
2844
  "workflow.retention.restamped",
2714
2845
  "workflow.retention.reaped",
2715
- "workflow.run.schema_migrated"
2846
+ "workflow.run.schema_migrated",
2847
+ // --- per-step model selection (Workflow Model Selection plan 6.5 / Appendix C.4) ---
2848
+ /** A `PATCH /admin/orgs/:orgId/workflow-policy` that changed the `models` block (who, what moved). */
2849
+ "workflow.policy.models_changed",
2850
+ /** A step's invocation hopped to another leg of its class — `{from, to, reason}`, priced at the served model. */
2851
+ "workflow.step.model_fallback",
2852
+ // --- autonomy envelope (Workflow autonomy plan A1; research/consent-gates.md §H2) ---
2853
+ /**
2854
+ * A start the consent ladder would have PARKED was admitted by `workflowPolicy.autonomy` instead —
2855
+ * `WorkflowRunAutonomyAppliedPayload`. Deliberately NOT `workflow.run.gate_cleared`: nothing was
2856
+ * gated and nobody approved it, and conflating the two would make "who approved this run"
2857
+ * unanswerable for every run of either kind (§H2 "Audit").
2858
+ */
2859
+ "workflow.run.autonomy_applied"
2716
2860
  ];
2717
2861
  WORKFLOW_AUDIT_METADATA_MAX_BYTES = 4 * 1024;
2718
2862
  __name(isWorkflowAuditEvent, "isWorkflowAuditEvent");
@@ -3172,7 +3316,7 @@ function modelTemplateInvalidMessage(model, why) {
3172
3316
  return `model "${model.trim()}" is not a valid run-input-bound model placeholder \u2014 ${why}; the forms are \${initData.<path>} and \${initData.<path>|<provider/model default>}`;
3173
3317
  }
3174
3318
  function modelTemplateDefaultRequiredMessage(model) {
3175
- return `model "${model}" runs on the Job tier, so its placeholder needs a default \u2014 the harness / provider gates (harness:'claude-code' needs an Anthropic model) classify it at push; write ${model.replace(/\}$/, "|<provider/model>}")}`;
3319
+ return `model "${model}" runs on the Job tier, so its placeholder needs a default \u2014 the harness / provider gates (harness:'claude-code' needs an Anthropic model) classify it at push; write ${model.replace(/\}$/, "|<provider/model>}")} or a class reference (|class/fast, |class/balanced, |class/strong)`;
3176
3320
  }
3177
3321
  function staticModelPin(model) {
3178
3322
  if (typeof model !== "string") return void 0;
@@ -3764,6 +3908,21 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3764
3908
  err("required-connection-unknown", `requiredConnections ${JSON.stringify(unknown)} are neither declared connections[].key values nor connections the owner can mount`, `${path3}.requiredConnections`, singleId(node));
3765
3909
  }
3766
3910
  }, "checkRequiredConnections");
3911
+ const jobClassifiablePin = /* @__PURE__ */ __name4((model) => {
3912
+ const pin = staticModelPin(model);
3913
+ const modelClass = modelClassOf(pin);
3914
+ if (modelClass === void 0) return pin;
3915
+ const codes = opts.classMap?.[modelClass];
3916
+ if (!codes) return void 0;
3917
+ const jobProviders = opts.policy?.jobProviders;
3918
+ for (const code of codes) {
3919
+ const p = classifyModelProvider(code);
3920
+ if (p === null) continue;
3921
+ if (jobProviders && !jobProviders.includes(p)) continue;
3922
+ return code;
3923
+ }
3924
+ return void 0;
3925
+ }, "jobClassifiablePin");
3767
3926
  const checkTier = /* @__PURE__ */ __name4((node, path3) => {
3768
3927
  const id = singleId(node);
3769
3928
  if (node.workspace && node.workspace !== "inherit" && node.tier !== void 0 && node.tier !== "job") {
@@ -3772,7 +3931,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3772
3931
  if (node.harness !== void 0 && node.tier !== "job") {
3773
3932
  err("harness-requires-job-tier", "`harness` is only legal on a tier:'job' agent step", `${path3}.harness`, id);
3774
3933
  }
3775
- const provider = node.type === "agent" ? classifyModelProvider(staticModelPin(node.model)) : null;
3934
+ const provider = node.type === "agent" ? classifyModelProvider(jobClassifiablePin(node.model)) : null;
3776
3935
  if (node.harness === "claude-code" && provider !== null && provider !== "anthropic") {
3777
3936
  err("harness-provider-mismatch", `harness:'claude-code' needs an Anthropic model (model "${node.type === "agent" ? node.model : ""}" is ${provider})`, `${path3}.harness`, id);
3778
3937
  }
@@ -3796,6 +3955,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3796
3955
  }
3797
3956
  const pin = parsed.kind === "template" ? parsed.template.default : node.model;
3798
3957
  if (pin === void 0) return;
3958
+ if (isModelClassRef(pin)) return;
3799
3959
  const inContext = /* @__PURE__ */ __name4((message) => parsed.kind === "template" ? `${message} (the default of ${parsed.template.placeholder})` : message, "inContext");
3800
3960
  const registry = opts.approvedModels;
3801
3961
  if (registry === void 0) return;
@@ -3809,6 +3969,12 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3809
3969
  const resolved = normalizeModelId(pin, registry);
3810
3970
  if (!resolved.ok) err("model-unresolved", inContext(modelUnresolvedMessage(resolved)), `${path3}.model`, id);
3811
3971
  }, "checkModel");
3972
+ const checkTaskClass = /* @__PURE__ */ __name4((node, path3) => {
3973
+ if (node.type !== "agent" || node.taskClass === void 0) return;
3974
+ if (!opts.static) return;
3975
+ if (typeof node.model === "string" && node.model.trim()) return;
3976
+ err("task-class-without-model", `taskClass '${String(node.taskClass)}' needs a \`model\` on a pushed definition \u2014 write a class (model: 'class/fast' | 'class/balanced' | 'class/strong') or an approved provider/model code; nothing maps a task class to a model at dispatch, so a step with neither would run on the agent\u2019s own model`, `${path3}.taskClass`, singleId(node));
3977
+ }, "checkTaskClass");
3812
3978
  const checkWorkspace = /* @__PURE__ */ __name4((node, path3) => {
3813
3979
  const id = singleId(node);
3814
3980
  const ws = workspaceOf(node);
@@ -3895,6 +4061,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3895
4061
  checkTimeout(node, path3);
3896
4062
  checkTier(node, path3);
3897
4063
  checkModel(node, path3);
4064
+ checkTaskClass(node, path3);
3898
4065
  checkRetry(node, path3);
3899
4066
  checkWorkspace(node, path3);
3900
4067
  if (!opts.static) {
@@ -7461,6 +7628,10 @@ var init_workflow = __esm({
7461
7628
  maxDurationSeconds: cfg.budget?.maxDurationSeconds ?? (hitl ? WORKFLOW_HITL_MAX_DURATION_SECONDS : WORKFLOW_DEFAULT_MAX_DURATION_SECONDS)
7462
7629
  });
7463
7630
  const envelope = {
7631
+ // A plain build/push is ALWAYS marker 1 (plan 6.4's compatibility row: "a CLI test that a plain push of
7632
+ // such a definition stays at 1"). Moving a definition to 2 — the effort marker — is an explicit act
7633
+ // (`lua push --apply-effort`, or a new compose while assignment is on), never a side effect of the SDK
7634
+ // gaining an `effort` member.
7464
7635
  luaWorkflow: 1,
7465
7636
  budget,
7466
7637
  definition: defined({
@@ -7781,6 +7952,10 @@ var init_workflow = __esm({
7781
7952
  promptTemplate: templateText(opts.prompt),
7782
7953
  outputSchema: schemaToJson(opts.outputSchema),
7783
7954
  model: opts.model,
7955
+ taskClass: opts.taskClass,
7956
+ requires: opts.requires,
7957
+ modelReason: opts.modelReason,
7958
+ effort: opts.effort,
7784
7959
  toolScope: opts.toolScope,
7785
7960
  systemPrompt: opts.systemPrompt,
7786
7961
  timeoutSeconds: opts.timeoutSeconds,
@@ -14992,6 +15167,68 @@ var init_workflow_api_service = __esm({
14992
15167
  const qs = query.toString();
14993
15168
  return this.httpGet(`${this.runs}/${runId}/steps/${pathId(stepId)}/job${qs ? `?${qs}` : ""}`, await this.auth());
14994
15169
  }
15170
+ // ─── [WMC-E7] Per-step model selection (§6.5, §6.7) ───
15171
+ /**
15172
+ * §6.5 — the organization's workflow policy, `models` block included. The route is the organization's, not
15173
+ * the agent's, so the orgId comes from the project config rather than from `this.agentId`.
15174
+ */
15175
+ async getWorkflowPolicy(orgId, opts = {}) {
15176
+ const qs = opts.effective ? "?effective=true" : "";
15177
+ return this.httpGet(`/admin/orgs/${encodeURIComponent(orgId)}/workflow-policy${qs}`, await this.auth());
15178
+ }
15179
+ /**
15180
+ * §6.5 — PATCH the `models` block. Only the members the caller named are sent, so a `set` of one field
15181
+ * never clears the rest; the server validates against the organization's effective model set and refuses
15182
+ * with a code the CLI prints verbatim (a class with no eligible row, a cap the raise would exceed).
15183
+ */
15184
+ async patchWorkflowPolicyModels(orgId, models) {
15185
+ return this.httpPatch(`/admin/orgs/${encodeURIComponent(orgId)}/workflow-policy`, {
15186
+ models
15187
+ }, await this.auth());
15188
+ }
15189
+ // ─── [WMC-A6] Autonomy — the pre-consented envelope (research §H3) ───
15190
+ /**
15191
+ * PATCH the `autonomy` block of the ORGANIZATION's policy — the same R23 route the `models` block uses, and
15192
+ * a sibling of it in the body, so one PATCH never has to carry two blocks it did not mean to touch.
15193
+ *
15194
+ * A member sent as `null` is CLEARED (`--clear`); a member omitted is left exactly as it was. That
15195
+ * distinction is the route's, not the CLI's — which is why the patch type carries `null` rather than the CLI
15196
+ * collapsing it to an absent key on the way out.
15197
+ *
15198
+ * Every ceiling is the server's: `caps.maxCreditsPerRun`, the organization's own `models.consentActions` and
15199
+ * the platform's runs-per-hour env are all figures this client has never seen, so a value above one comes
15200
+ * back as a typed 400 and is printed verbatim.
15201
+ */
15202
+ async patchWorkflowPolicyAutonomy(orgId, autonomy) {
15203
+ return this.httpPatch(`/admin/orgs/${encodeURIComponent(orgId)}/workflow-policy`, {
15204
+ autonomy
15205
+ }, await this.auth());
15206
+ }
15207
+ /*
15208
+ * There is deliberately NO per-agent writer here. `SubAgentWorkflowSettings.autonomy` is read by
15209
+ * `effectiveWorkflowAutonomy`, but no HTTP surface writes it: `UpdateSubAgentRequestDto` has no
15210
+ * `workflows` member, so a PATCH carrying one is accepted and DISCARDED. A client method that posted a
15211
+ * narrowing into that hole would return 200 and change nothing, and the CLI would print a success line
15212
+ * over it — on a consent surface, a false confirmation is worse than a missing feature. The read half
15213
+ * already works: `?effective=true` shows a per-agent narrowing when the projection carries one.
15214
+ */
15215
+ /**
15216
+ * §6.5 — clear a run gate by kind. `model_policy` is the kind a class request that could not be resolved
15217
+ * parks on; the sweep clears it on its own when the switch returns, and this is the by-hand path.
15218
+ */
15219
+ async clearRunGate(runId, kind) {
15220
+ return this.httpPost(`${this.runs}/${runId}/clear-gate`, {
15221
+ kind
15222
+ }, await this.auth());
15223
+ }
15224
+ /**
15225
+ * §6.4 (Q19) — the deterministic rewrite of a dynamic parent's stored task classes into `class/<c>`.
15226
+ * Not a fresh model composition: the server rewrites and publishes a NEW version on the immutable parent,
15227
+ * and answers with it, so the CLI only has to print the version it got back.
15228
+ */
15229
+ async recomposeWorkflow(workflowId) {
15230
+ return this.httpPost(`${this.base}/${workflowId}/recompose`, {}, await this.auth());
15231
+ }
14995
15232
  };
14996
15233
  }
14997
15234
  });
@@ -16106,8 +16343,11 @@ var User = {
16106
16343
  },
16107
16344
  /**
16108
16345
  * PRO-1208 (B7) — push an approve/redirect/fix card to YOUR OWN inbox.
16109
- * Capped (5/day per agent), urgent-clamped, same-`key` deduped (revise in
16110
- * place). Cap-hit resolves to `{outcome: 'capped'}` — never throws.
16346
+ * Capped per kind at 500/day per agent per end-user by default
16347
+ * (`LUA_INBOX_AGENT_DEPOSIT_DAILY_CAP`); `priority: 'urgent'` is limited to
16348
+ * 5/day by default (`LUA_INBOX_URGENT_PUSH_DAILY_CAP`) and lands demoted to
16349
+ * `high` when over budget — never dropped. Same-`key` pushes revise in place.
16350
+ * Cap-hit resolves to `{outcome: 'capped'}` — never throws.
16111
16351
  *
16112
16352
  * @example
16113
16353
  * const receipt = await User.Inbox.push({