lua-cli 3.32.5 → 3.33.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.
@@ -735,6 +735,23 @@ function modelUnresolvedMessage(r) {
735
735
  }
736
736
  __name(modelUnresolvedMessage, "modelUnresolvedMessage");
737
737
  __name2(modelUnresolvedMessage, "modelUnresolvedMessage");
738
+ function providerModelId(code) {
739
+ const requested = typeof code === "string" ? code.trim() : "";
740
+ if (!requested || isModelIdSentinel(requested)) return requested;
741
+ const slash = requested.indexOf("/");
742
+ if (slash <= 0) return requested;
743
+ const provider = requested.slice(0, slash).toLowerCase();
744
+ if (MODEL_ID_BYOK_PROVIDERS.includes(provider)) return requested;
745
+ return requested.slice(slash + 1);
746
+ }
747
+ __name(providerModelId, "providerModelId");
748
+ __name2(providerModelId, "providerModelId");
749
+ var 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]))$/;
750
+ function providerModelFamily(code) {
751
+ return providerModelId(code).toLowerCase().replace(MODEL_SNAPSHOT_SUFFIX, "");
752
+ }
753
+ __name(providerModelFamily, "providerModelFamily");
754
+ __name2(providerModelFamily, "providerModelFamily");
738
755
  var IMPLICIT_MODEL_SELECTION_SOURCES = [
739
756
  "workspace-default",
740
757
  "platform-default"
@@ -1196,6 +1213,10 @@ function triggerUrlEnvKey(triggerKey) {
1196
1213
  }
1197
1214
  __name(triggerUrlEnvKey, "triggerUrlEnvKey");
1198
1215
  __name2(triggerUrlEnvKey, "triggerUrlEnvKey");
1216
+ var TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES = Object.freeze([
1217
+ "single",
1218
+ "multiple"
1219
+ ]);
1199
1220
  var SUBJECT_TYPES = [
1200
1221
  "user",
1201
1222
  "apiKey",
@@ -1708,6 +1729,15 @@ var WORKFLOW_RUN_STATUSES = [
1708
1729
  ...WORKFLOW_RUN_IDLE,
1709
1730
  ...WORKFLOW_RUN_TERMINAL
1710
1731
  ];
1732
+ var WORKFLOW_RUN_GATE_KINDS = [
1733
+ "start-consent",
1734
+ "quota",
1735
+ "billing",
1736
+ "org_archived",
1737
+ "disabled",
1738
+ "exception",
1739
+ "budget"
1740
+ ];
1711
1741
  var WORKFLOW_STEP_STATUSES = [
1712
1742
  "pending",
1713
1743
  "ready",
@@ -1729,6 +1759,16 @@ var WORKFLOW_STEP_IN_FLIGHT = [
1729
1759
  "running",
1730
1760
  "cancellation_requested"
1731
1761
  ];
1762
+ var WORKFLOW_SIGNAL_EVENT_SITES = [
1763
+ "webhook",
1764
+ "trigger",
1765
+ "device-trigger"
1766
+ ];
1767
+ function isWorkflowSignalEventSite(value3) {
1768
+ return typeof value3 === "string" && WORKFLOW_SIGNAL_EVENT_SITES.includes(value3);
1769
+ }
1770
+ __name(isWorkflowSignalEventSite, "isWorkflowSignalEventSite");
1771
+ __name2(isWorkflowSignalEventSite, "isWorkflowSignalEventSite");
1732
1772
  var ARCHIVE_WINDOW_MARGIN_DAYS = 7;
1733
1773
  function shouldSkipArchive(run, manifestSha256, sinkSha256) {
1734
1774
  if (!run.completedAt || !run.exportedAt || run.exportedAt < run.completedAt) return false;
@@ -1841,6 +1881,16 @@ function scheduledWorkflowRunIdForTime(jobId, scheduledTime) {
1841
1881
  }
1842
1882
  __name(scheduledWorkflowRunIdForTime, "scheduledWorkflowRunIdForTime");
1843
1883
  __name2(scheduledWorkflowRunIdForTime, "scheduledWorkflowRunIdForTime");
1884
+ var WORKFLOW_SUSPEND_KINDS = [
1885
+ "input",
1886
+ "approval",
1887
+ "signal",
1888
+ "gate"
1889
+ ];
1890
+ var WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS = [
1891
+ ...WORKFLOW_SUSPEND_KINDS,
1892
+ ...WORKFLOW_RUN_GATE_KINDS
1893
+ ];
1844
1894
  var WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES = 64 * 1024;
1845
1895
  var WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES = 256 * 1024;
1846
1896
  var WORKFLOW_RETRY_BACKOFFS = [
@@ -2032,6 +2082,30 @@ var WORKFLOW_BUDGET_MAX_DURATION_SECONDS = Object.freeze({
2032
2082
  min: 60,
2033
2083
  max: 2592e3
2034
2084
  });
2085
+ var WORKFLOW_GOAL_JUDGE_SELF = "$self";
2086
+ function workflowGoalJudgeKind(judge) {
2087
+ return judge && typeof judge === "object" && judge.predicate !== void 0 ? "predicate" : "agent";
2088
+ }
2089
+ __name(workflowGoalJudgeKind, "workflowGoalJudgeKind");
2090
+ __name2(workflowGoalJudgeKind, "workflowGoalJudgeKind");
2091
+ function isWorkflowGoalJudgeComplete(judge) {
2092
+ if (workflowGoalJudgeKind(judge) === "predicate") return true;
2093
+ return typeof judge.agentId === "string" && judge.agentId.length > 0 && !!judge.schema && typeof judge.schema === "object" && !Array.isArray(judge.schema);
2094
+ }
2095
+ __name(isWorkflowGoalJudgeComplete, "isWorkflowGoalJudgeComplete");
2096
+ __name2(isWorkflowGoalJudgeComplete, "isWorkflowGoalJudgeComplete");
2097
+ function normalizeWorkflowGoalJudge(judge) {
2098
+ if (workflowGoalJudgeKind(judge) === "agent") return judge;
2099
+ return {
2100
+ agentId: judge.agentId ?? WORKFLOW_GOAL_JUDGE_SELF,
2101
+ predicate: judge.predicate,
2102
+ ...judge.schema ? {
2103
+ schema: judge.schema
2104
+ } : {}
2105
+ };
2106
+ }
2107
+ __name(normalizeWorkflowGoalJudge, "normalizeWorkflowGoalJudge");
2108
+ __name2(normalizeWorkflowGoalJudge, "normalizeWorkflowGoalJudge");
2035
2109
  var REDACTED_PLACEHOLDER = "[REDACTED]";
2036
2110
  var PROVIDER_MESSAGE_MAX_CHARS = 300;
2037
2111
  var ERROR_MESSAGE_MAX_CHARS = 2e3;
@@ -2595,21 +2669,31 @@ function resolveEffectiveFeature(row, catalogDefault) {
2595
2669
  }
2596
2670
  __name(resolveEffectiveFeature, "resolveEffectiveFeature");
2597
2671
  __name2(resolveEffectiveFeature, "resolveEffectiveFeature");
2598
- function isFeatureRow(value3) {
2599
- return typeof value3 === "object" && value3 !== null;
2672
+ function asFeatureRow(value3) {
2673
+ if (value3 === false) return {
2674
+ active: false
2675
+ };
2676
+ return typeof value3 === "object" && value3 !== null && !Array.isArray(value3) ? value3 : void 0;
2677
+ }
2678
+ __name(asFeatureRow, "asFeatureRow");
2679
+ __name2(asFeatureRow, "asFeatureRow");
2680
+ function agentFeatureBagCarries(bag, name) {
2681
+ return bag != null && Object.prototype.hasOwnProperty.call(bag, name) && asFeatureRow(bag[name]) !== void 0;
2600
2682
  }
2601
- __name(isFeatureRow, "isFeatureRow");
2602
- __name2(isFeatureRow, "isFeatureRow");
2683
+ __name(agentFeatureBagCarries, "agentFeatureBagCarries");
2684
+ __name2(agentFeatureBagCarries, "agentFeatureBagCarries");
2603
2685
  function effectiveAgentFeatureRows(base, override) {
2604
2686
  const merged = /* @__PURE__ */ new Map();
2605
- for (const [name, row] of Object.entries(base ?? {})) {
2606
- if (isFeatureRow(row)) merged.set(name, {
2687
+ for (const [name, value3] of Object.entries(base ?? {})) {
2688
+ const row = asFeatureRow(value3);
2689
+ if (row) merged.set(name, {
2607
2690
  row,
2608
2691
  origin: "baseAgent"
2609
2692
  });
2610
2693
  }
2611
- for (const [name, row] of Object.entries(override ?? {})) {
2612
- if (isFeatureRow(row)) merged.set(name, {
2694
+ for (const [name, value3] of Object.entries(override ?? {})) {
2695
+ const row = asFeatureRow(value3);
2696
+ if (row) merged.set(name, {
2613
2697
  row,
2614
2698
  origin: "subAgent"
2615
2699
  });
@@ -2631,20 +2715,83 @@ function effectiveAgentFeatureRows(base, override) {
2631
2715
  }
2632
2716
  __name(effectiveAgentFeatureRows, "effectiveAgentFeatureRows");
2633
2717
  __name2(effectiveAgentFeatureRows, "effectiveAgentFeatureRows");
2718
+ var SUBAGENT_PER_KEY_FLAG_ENV = "LUA_SUBAGENT_FEATURES_PER_KEY";
2719
+ var PER_KEY_FLAG_VALUES = /* @__PURE__ */ new Set([
2720
+ "1",
2721
+ "true",
2722
+ "on",
2723
+ "yes"
2724
+ ]);
2725
+ function agentFeatureMergeRuleFromEnv(env) {
2726
+ const raw = env[SUBAGENT_PER_KEY_FLAG_ENV];
2727
+ return typeof raw === "string" && PER_KEY_FLAG_VALUES.has(raw.trim().toLowerCase()) ? "per-key" : "wholesale";
2728
+ }
2729
+ __name(agentFeatureMergeRuleFromEnv, "agentFeatureMergeRuleFromEnv");
2730
+ __name2(agentFeatureMergeRuleFromEnv, "agentFeatureMergeRuleFromEnv");
2731
+ function effectiveAgentFeatures(base, override, rule) {
2732
+ if (rule === "wholesale") return override || base || void 0;
2733
+ return effectiveAgentFeatureRows(base, override).rows;
2734
+ }
2735
+ __name(effectiveAgentFeatures, "effectiveAgentFeatures");
2736
+ __name2(effectiveAgentFeatures, "effectiveAgentFeatures");
2634
2737
 
2635
2738
  // ../workflow-graph/dist/index.mjs
2636
2739
  import { createHash } from "crypto";
2637
2740
  import { z as z4 } from "zod";
2638
2741
  import { z as z22 } from "zod";
2639
- import { createHash as createHash2 } from "crypto";
2742
+
2743
+ // ../shared-types/dist/workflow-job-tools.mjs
2640
2744
  var __defProp3 = Object.defineProperty;
2641
- var __name3 = /* @__PURE__ */ __name((target, value22) => __defProp3(target, "name", { value: value22, configurable: true }), "__name");
2745
+ var __name3 = /* @__PURE__ */ __name((target, value3) => __defProp3(target, "name", { value: value3, configurable: true }), "__name");
2746
+ var WORKFLOW_JOB_TOOLS = [
2747
+ "shell",
2748
+ "read",
2749
+ "write",
2750
+ "edit",
2751
+ "glob",
2752
+ "grep",
2753
+ "git",
2754
+ "gh",
2755
+ "fetch",
2756
+ "ripwire"
2757
+ ];
2758
+ var WORKFLOW_JOB_READ_ONLY_DROPPED = [
2759
+ "write",
2760
+ "edit",
2761
+ "git",
2762
+ "shell"
2763
+ ];
2764
+ var WORKFLOW_JOB_DEFAULT_TOOLS = [
2765
+ "shell",
2766
+ "read",
2767
+ "write",
2768
+ "edit",
2769
+ "glob",
2770
+ "grep",
2771
+ "git"
2772
+ ];
2773
+ function effectiveJobTools(jobTools, readOnly) {
2774
+ const base = jobTools?.length ? jobTools : WORKFLOW_JOB_DEFAULT_TOOLS;
2775
+ const out = [];
2776
+ for (const id of base) {
2777
+ if (readOnly && WORKFLOW_JOB_READ_ONLY_DROPPED.includes(id)) continue;
2778
+ if (!out.includes(id)) out.push(id);
2779
+ }
2780
+ return out;
2781
+ }
2782
+ __name(effectiveJobTools, "effectiveJobTools");
2783
+ __name3(effectiveJobTools, "effectiveJobTools");
2784
+
2785
+ // ../workflow-graph/dist/index.mjs
2786
+ import { createHash as createHash2 } from "crypto";
2787
+ var __defProp4 = Object.defineProperty;
2788
+ var __name4 = /* @__PURE__ */ __name((target, value22) => __defProp4(target, "name", { value: value22, configurable: true }), "__name");
2642
2789
  var WorkflowTemplateError = class extends Error {
2643
2790
  static {
2644
2791
  __name(this, "WorkflowTemplateError");
2645
2792
  }
2646
2793
  static {
2647
- __name3(this, "WorkflowTemplateError");
2794
+ __name4(this, "WorkflowTemplateError");
2648
2795
  }
2649
2796
  placeholder;
2650
2797
  constructor(message, placeholder) {
@@ -2656,7 +2803,7 @@ function isMapConfigObject(v) {
2656
2803
  return typeof v === "object" && v !== null && !Array.isArray(v);
2657
2804
  }
2658
2805
  __name(isMapConfigObject, "isMapConfigObject");
2659
- __name3(isMapConfigObject, "isMapConfigObject");
2806
+ __name4(isMapConfigObject, "isMapConfigObject");
2660
2807
  function parseMapConfig(raw, stepId) {
2661
2808
  if (isMapConfigObject(raw)) return raw;
2662
2809
  if (typeof raw !== "string") {
@@ -2669,14 +2816,14 @@ function parseMapConfig(raw, stepId) {
2669
2816
  }
2670
2817
  }
2671
2818
  __name(parseMapConfig, "parseMapConfig");
2672
- __name3(parseMapConfig, "parseMapConfig");
2819
+ __name4(parseMapConfig, "parseMapConfig");
2673
2820
  function mapConfigWire(raw) {
2674
2821
  if (typeof raw === "string") return raw;
2675
2822
  if (isMapConfigObject(raw)) return canonicalJson(raw);
2676
2823
  return void 0;
2677
2824
  }
2678
2825
  __name(mapConfigWire, "mapConfigWire");
2679
- __name3(mapConfigWire, "mapConfigWire");
2826
+ __name4(mapConfigWire, "mapConfigWire");
2680
2827
  var TEMPLATE_PLACEHOLDER = /\$\{([^}]*)\}/g;
2681
2828
  var TEMPLATE_NAMESPACES = [
2682
2829
  "initData",
@@ -2688,7 +2835,7 @@ function describeBadPlaceholder(template22, idx, rawExpr) {
2688
2835
  return `Template placeholder #${idx} (\${${rawExpr}}) in '${template22}'`;
2689
2836
  }
2690
2837
  __name(describeBadPlaceholder, "describeBadPlaceholder");
2691
- __name3(describeBadPlaceholder, "describeBadPlaceholder");
2838
+ __name4(describeBadPlaceholder, "describeBadPlaceholder");
2692
2839
  function parseTemplatePlaceholder(rawExpr) {
2693
2840
  const dot = rawExpr.indexOf(".");
2694
2841
  return {
@@ -2697,7 +2844,7 @@ function parseTemplatePlaceholder(rawExpr) {
2697
2844
  };
2698
2845
  }
2699
2846
  __name(parseTemplatePlaceholder, "parseTemplatePlaceholder");
2700
- __name3(parseTemplatePlaceholder, "parseTemplatePlaceholder");
2847
+ __name4(parseTemplatePlaceholder, "parseTemplatePlaceholder");
2701
2848
  function traverseMappingPath(root, path, errorLabel) {
2702
2849
  if (path === "" || path === ".") return root;
2703
2850
  const parts = path.split(".");
@@ -2709,7 +2856,7 @@ function traverseMappingPath(root, path, errorLabel) {
2709
2856
  return value22;
2710
2857
  }
2711
2858
  __name(traverseMappingPath, "traverseMappingPath");
2712
- __name3(traverseMappingPath, "traverseMappingPath");
2859
+ __name4(traverseMappingPath, "traverseMappingPath");
2713
2860
  function stringifyTemplateValue(v, template22, idx, rawExpr) {
2714
2861
  if (v === null || v === void 0) return "";
2715
2862
  if (typeof v === "object") {
@@ -2722,17 +2869,17 @@ function stringifyTemplateValue(v, template22, idx, rawExpr) {
2722
2869
  return String(v);
2723
2870
  }
2724
2871
  __name(stringifyTemplateValue, "stringifyTemplateValue");
2725
- __name3(stringifyTemplateValue, "stringifyTemplateValue");
2872
+ __name4(stringifyTemplateValue, "stringifyTemplateValue");
2726
2873
  function escapeFence(content) {
2727
2874
  return content.replace(/<\/lua-data/g, "<\\/lua-data");
2728
2875
  }
2729
2876
  __name(escapeFence, "escapeFence");
2730
- __name3(escapeFence, "escapeFence");
2877
+ __name4(escapeFence, "escapeFence");
2731
2878
  function fenceBlock(name, source, content) {
2732
2879
  return `<lua-data name="${name}" source="${source}" untrusted="true">${escapeFence(content)}</lua-data>`;
2733
2880
  }
2734
2881
  __name(fenceBlock, "fenceBlock");
2735
- __name3(fenceBlock, "fenceBlock");
2882
+ __name4(fenceBlock, "fenceBlock");
2736
2883
  function renderTemplate(template22, ctx, opts) {
2737
2884
  let idx = 0;
2738
2885
  return template22.replace(TEMPLATE_PLACEHOLDER, (_match, rawExpr) => {
@@ -2773,12 +2920,12 @@ function renderTemplate(template22, ctx, opts) {
2773
2920
  });
2774
2921
  }
2775
2922
  __name(renderTemplate, "renderTemplate");
2776
- __name3(renderTemplate, "renderTemplate");
2923
+ __name4(renderTemplate, "renderTemplate");
2777
2924
  function isMapDescriptor(v) {
2778
2925
  if (v === null || typeof v !== "object" || Array.isArray(v)) return false;
2779
2926
  const d = v;
2780
2927
  const keys = Object.keys(d);
2781
- const only = /* @__PURE__ */ __name3((...allowed) => keys.every((k) => allowed.includes(k)), "only");
2928
+ const only = /* @__PURE__ */ __name4((...allowed) => keys.every((k) => allowed.includes(k)), "only");
2782
2929
  if ("value" in d) return keys.length === 1;
2783
2930
  if ("template" in d) return keys.length === 1 && typeof d.template === "string";
2784
2931
  if ("requestContextPath" in d) return keys.length === 1 && typeof d.requestContextPath === "string";
@@ -2791,7 +2938,7 @@ function isMapDescriptor(v) {
2791
2938
  return false;
2792
2939
  }
2793
2940
  __name(isMapDescriptor, "isMapDescriptor");
2794
- __name3(isMapDescriptor, "isMapDescriptor");
2941
+ __name4(isMapDescriptor, "isMapDescriptor");
2795
2942
  var MAP_DESCRIPTOR_KEYS = [
2796
2943
  "step",
2797
2944
  "path",
@@ -2816,13 +2963,13 @@ function malformedMapMembers(cfg) {
2816
2963
  return out;
2817
2964
  }
2818
2965
  __name(malformedMapMembers, "malformedMapMembers");
2819
- __name3(malformedMapMembers, "malformedMapMembers");
2966
+ __name4(malformedMapMembers, "malformedMapMembers");
2820
2967
  function mapMemberMalformedMessage(id, m) {
2821
2968
  const keys = m.keys.map((k) => `\`${k}\``).join(", ");
2822
2969
  return `"${id}".${m.member} carries descriptor key${m.keys.length === 1 ? "" : "s"} ${keys} but is not an exact binding form ({initData:true, path} | {step, path[, rows]} | {value} | {template} | {requestContextPath} | {knowledge}) \u2014 it is passed to the step verbatim as a literal; fix the descriptor, or wrap it in {value: \u2026} if the literal is intended`;
2823
2970
  }
2824
2971
  __name(mapMemberMalformedMessage, "mapMemberMalformedMessage");
2825
- __name3(mapMemberMalformedMessage, "mapMemberMalformedMessage");
2972
+ __name4(mapMemberMalformedMessage, "mapMemberMalformedMessage");
2826
2973
  function resolveDescriptor(key, m, ctx) {
2827
2974
  if (!isMapDescriptor(m)) return {
2828
2975
  value: m
@@ -2883,7 +3030,7 @@ function resolveDescriptor(key, m, ctx) {
2883
3030
  }
2884
3031
  }
2885
3032
  __name(resolveDescriptor, "resolveDescriptor");
2886
- __name3(resolveDescriptor, "resolveDescriptor");
3033
+ __name4(resolveDescriptor, "resolveDescriptor");
2887
3034
  function resolveMapping(cfg, ctx) {
2888
3035
  const keys = Object.keys(cfg);
2889
3036
  if (keys.length === 1 && keys[0] === "") {
@@ -2900,33 +3047,33 @@ function resolveMapping(cfg, ctx) {
2900
3047
  };
2901
3048
  }
2902
3049
  __name(resolveMapping, "resolveMapping");
2903
- __name3(resolveMapping, "resolveMapping");
2904
- var fromInit = /* @__PURE__ */ __name3((path) => ({
3050
+ __name4(resolveMapping, "resolveMapping");
3051
+ var fromInit = /* @__PURE__ */ __name4((path) => ({
2905
3052
  initData: true,
2906
3053
  path
2907
3054
  }), "fromInit");
2908
- var fromStep = /* @__PURE__ */ __name3((s, path = "") => {
2909
- const idOf = /* @__PURE__ */ __name3((x) => typeof x === "string" ? x : x.id, "idOf");
3055
+ var fromStep = /* @__PURE__ */ __name4((s, path = "") => {
3056
+ const idOf = /* @__PURE__ */ __name4((x) => typeof x === "string" ? x : x.id, "idOf");
2910
3057
  return {
2911
3058
  step: Array.isArray(s) ? s.map(idOf) : idOf(s),
2912
3059
  path
2913
3060
  };
2914
3061
  }, "fromStep");
2915
- var value = /* @__PURE__ */ __name3((v) => ({
3062
+ var value = /* @__PURE__ */ __name4((v) => ({
2916
3063
  value: v
2917
3064
  }), "value");
2918
- var template = /* @__PURE__ */ __name3((s) => ({
3065
+ var template = /* @__PURE__ */ __name4((s) => ({
2919
3066
  template: s
2920
3067
  }), "template");
2921
- var fromRequest = /* @__PURE__ */ __name3((path) => ({
3068
+ var fromRequest = /* @__PURE__ */ __name4((path) => ({
2922
3069
  requestContextPath: path
2923
3070
  }), "fromRequest");
2924
- var rows = /* @__PURE__ */ __name3((s, path, page) => ({
3071
+ var rows = /* @__PURE__ */ __name4((s, path, page) => ({
2925
3072
  step: typeof s === "string" ? s : s.id,
2926
3073
  path,
2927
3074
  rows: page
2928
3075
  }), "rows");
2929
- var fromKnowledge = /* @__PURE__ */ __name3((k) => ({
3076
+ var fromKnowledge = /* @__PURE__ */ __name4((k) => ({
2930
3077
  knowledge: k
2931
3078
  }), "fromKnowledge");
2932
3079
  var SideEffectsSchema = z4.enum(WORKFLOW_SIDE_EFFECTS);
@@ -3012,7 +3159,7 @@ function describeApproverSpecRefusal(spec) {
3012
3159
  };
3013
3160
  }
3014
3161
  __name(describeApproverSpecRefusal, "describeApproverSpecRefusal");
3015
- __name3(describeApproverSpecRefusal, "describeApproverSpecRefusal");
3162
+ __name4(describeApproverSpecRefusal, "describeApproverSpecRefusal");
3016
3163
  var BINDING_ROOTS = [
3017
3164
  "initData",
3018
3165
  "stepResults",
@@ -3026,30 +3173,30 @@ function bindingRootsOk(template22) {
3026
3173
  return refs.length > 0 && refs.every((r) => BINDING_ROOTS.includes(r));
3027
3174
  }
3028
3175
  __name(bindingRootsOk, "bindingRootsOk");
3029
- __name3(bindingRootsOk, "bindingRootsOk");
3176
+ __name4(bindingRootsOk, "bindingRootsOk");
3030
3177
  function isTemplateBinding(v) {
3031
3178
  return typeof v === "object" && v !== null && typeof v.template === "string";
3032
3179
  }
3033
3180
  __name(isTemplateBinding, "isTemplateBinding");
3034
- __name3(isTemplateBinding, "isTemplateBinding");
3181
+ __name4(isTemplateBinding, "isTemplateBinding");
3035
3182
  function approvalEditable(node) {
3036
3183
  if (node.editable === true) return true;
3037
3184
  if (node.editable === false) return false;
3038
3185
  return Array.isArray(node.editablePaths) && node.editablePaths.length > 0;
3039
3186
  }
3040
3187
  __name(approvalEditable, "approvalEditable");
3041
- __name3(approvalEditable, "approvalEditable");
3188
+ __name4(approvalEditable, "approvalEditable");
3042
3189
  function validateApproverBlock(node, opts = {
3043
3190
  path: "approval"
3044
3191
  }) {
3045
3192
  const issues = [];
3046
- const push = /* @__PURE__ */ __name3((code, path, message, severity = "error") => issues.push({
3193
+ const push = /* @__PURE__ */ __name4((code, path, message, severity = "error") => issues.push({
3047
3194
  code,
3048
3195
  path,
3049
3196
  severity,
3050
3197
  message
3051
3198
  }), "push");
3052
- const checkSpec = /* @__PURE__ */ __name3((spec, path) => {
3199
+ const checkSpec = /* @__PURE__ */ __name4((spec, path) => {
3053
3200
  const r = ApproverSpecSchema.safeParse(spec);
3054
3201
  if (!r.success) {
3055
3202
  const users = spec?.users;
@@ -3106,7 +3253,7 @@ function validateApproverBlock(node, opts = {
3106
3253
  return issues;
3107
3254
  }
3108
3255
  __name(validateApproverBlock, "validateApproverBlock");
3109
- __name3(validateApproverBlock, "validateApproverBlock");
3256
+ __name4(validateApproverBlock, "validateApproverBlock");
3110
3257
  function liftRenderedApprover(row, rendered) {
3111
3258
  const text = (rendered ?? "").trim();
3112
3259
  if (!text) return null;
@@ -3135,7 +3282,7 @@ function liftRenderedApprover(row, rendered) {
3135
3282
  };
3136
3283
  }
3137
3284
  __name(liftRenderedApprover, "liftRenderedApprover");
3138
- __name3(liftRenderedApprover, "liftRenderedApprover");
3285
+ __name4(liftRenderedApprover, "liftRenderedApprover");
3139
3286
  var WORKSPACE_TEMPLATE_EXPR_RE = /^\$\{\s*(?:initData|input)\.([^}]+?)\s*\}$/;
3140
3287
  function workspaceTemplatePath(template22) {
3141
3288
  const key = template22.trim();
@@ -3145,7 +3292,7 @@ function workspaceTemplatePath(template22) {
3145
3292
  return key.replace(/^(?:input|initData)\./, "").split(".");
3146
3293
  }
3147
3294
  __name(workspaceTemplatePath, "workspaceTemplatePath");
3148
- __name3(workspaceTemplatePath, "workspaceTemplatePath");
3295
+ __name4(workspaceTemplatePath, "workspaceTemplatePath");
3149
3296
  function retryBackoffs() {
3150
3297
  if (!Array.isArray(WORKFLOW_RETRY_BACKOFFS)) {
3151
3298
  throw new Error("@lua/shared-types.WORKFLOW_RETRY_BACKOFFS is not a tuple \u2014 a jest.mock('@lua/shared-types') must spread jest.requireActual('@lua/shared-types')");
@@ -3153,7 +3300,7 @@ function retryBackoffs() {
3153
3300
  return WORKFLOW_RETRY_BACKOFFS;
3154
3301
  }
3155
3302
  __name(retryBackoffs, "retryBackoffs");
3156
- __name3(retryBackoffs, "retryBackoffs");
3303
+ __name4(retryBackoffs, "retryBackoffs");
3157
3304
  var SLEEP_UNTIL_REPLACEMENT = Object.freeze({
3158
3305
  type: "sleep",
3159
3306
  duration: 6e4
@@ -3162,12 +3309,12 @@ function sleepUntilUnsupportedMessage(id) {
3162
3309
  return `the engine does not execute \`sleepUntil\` yet (node "${id}") \u2014 replace it with a \`sleep\` node with a \`duration\` in ms, e.g. { type: 'sleep', id: '${id}', duration: ${SLEEP_UNTIL_REPLACEMENT.duration} }`;
3163
3310
  }
3164
3311
  __name(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
3165
- __name3(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
3312
+ __name4(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
3166
3313
  function armSubrunUnsupportedMessage(id, workflowId) {
3167
3314
  return `the engine does not execute the implicit \`${workflowId}\` arm subrun (node "${id}") \u2014 a [map, step] container arm is the step itself with the map as its \`input\` since lua-cli 3.32.4; re-run \`lua compile\` with the current CLI (a hand-written artifact: put the map on the arm node's \`input\` and drop the \`workflow\` wrapper)`;
3168
3315
  }
3169
3316
  __name(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
3170
- __name3(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
3317
+ __name4(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
3171
3318
  var WORKFLOW_CAPS_DEFAULT = Object.freeze({
3172
3319
  maxParallelArms: 16,
3173
3320
  maxForeachConcurrency: 16,
@@ -3192,7 +3339,7 @@ var WORKFLOW_SIGNAL_DEFAULT_SOURCES = [
3192
3339
  "api",
3193
3340
  "user"
3194
3341
  ];
3195
- var clone = /* @__PURE__ */ __name3((v) => JSON.parse(JSON.stringify(v)), "clone");
3342
+ var clone = /* @__PURE__ */ __name4((v) => JSON.parse(JSON.stringify(v)), "clone");
3196
3343
  function fillPolicy(node, defaultTimeout) {
3197
3344
  if (node.tier === void 0 && node.workspace !== void 0 && node.workspace !== "inherit") node.tier = "job";
3198
3345
  if (node.timeoutSeconds === void 0) node.timeoutSeconds = node.tier === "job" ? WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS : defaultTimeout;
@@ -3203,7 +3350,7 @@ function fillPolicy(node, defaultTimeout) {
3203
3350
  if ((node.type === "step" || node.type === "tool") && node.sideEffects === void 0) node.sideEffects = "none";
3204
3351
  }
3205
3352
  __name(fillPolicy, "fillPolicy");
3206
- __name3(fillPolicy, "fillPolicy");
3353
+ __name4(fillPolicy, "fillPolicy");
3207
3354
  function fillSingle(node) {
3208
3355
  switch (node.type) {
3209
3356
  case "step": {
@@ -3224,7 +3371,7 @@ function fillSingle(node) {
3224
3371
  }
3225
3372
  }
3226
3373
  __name(fillSingle, "fillSingle");
3227
- __name3(fillSingle, "fillSingle");
3374
+ __name4(fillSingle, "fillSingle");
3228
3375
  function fillHitl(node) {
3229
3376
  if (node.type === "approval") {
3230
3377
  const a = node;
@@ -3233,7 +3380,7 @@ function fillHitl(node) {
3233
3380
  if (a.onTimeout === void 0) a.onTimeout = "deny";
3234
3381
  if (a.onDeny === void 0) a.onDeny = "continue";
3235
3382
  if (a.excludeInitiator === void 0) a.excludeInitiator = false;
3236
- if (a.editable === void 0) a.editable = false;
3383
+ if (a.editable === void 0) a.editable = approvalEditable(a);
3237
3384
  return;
3238
3385
  }
3239
3386
  const w = node;
@@ -3244,14 +3391,14 @@ function fillHitl(node) {
3244
3391
  ];
3245
3392
  }
3246
3393
  __name(fillHitl, "fillHitl");
3247
- __name3(fillHitl, "fillHitl");
3394
+ __name4(fillHitl, "fillHitl");
3248
3395
  function fillArm(arm) {
3249
3396
  if (arm.type === "mapping") return;
3250
3397
  if (isHitlNode(arm)) fillHitl(arm);
3251
3398
  else fillSingle(arm);
3252
3399
  }
3253
3400
  __name(fillArm, "fillArm");
3254
- __name3(fillArm, "fillArm");
3401
+ __name4(fillArm, "fillArm");
3255
3402
  function fillEntry(entry) {
3256
3403
  switch (entry.type) {
3257
3404
  case "step":
@@ -3295,36 +3442,25 @@ function fillEntry(entry) {
3295
3442
  }
3296
3443
  }
3297
3444
  __name(fillEntry, "fillEntry");
3298
- __name3(fillEntry, "fillEntry");
3445
+ __name4(fillEntry, "fillEntry");
3299
3446
  function withDefaultsFilled(g) {
3300
3447
  const out = clone(g);
3301
3448
  out.definition.graph.forEach(fillEntry);
3302
3449
  return out;
3303
3450
  }
3304
3451
  __name(withDefaultsFilled, "withDefaultsFilled");
3305
- __name3(withDefaultsFilled, "withDefaultsFilled");
3452
+ __name4(withDefaultsFilled, "withDefaultsFilled");
3306
3453
  var CONNECTION_ID_HEX_RE = /^[0-9a-f]{24}$/;
3307
3454
  function isConnectionKeyShaped(value22) {
3308
3455
  return WORKFLOW_CONNECTION_KEY_RE.test(value22) && !CONNECTION_ID_HEX_RE.test(value22);
3309
3456
  }
3310
3457
  __name(isConnectionKeyShaped, "isConnectionKeyShaped");
3311
- __name3(isConnectionKeyShaped, "isConnectionKeyShaped");
3458
+ __name4(isConnectionKeyShaped, "isConnectionKeyShaped");
3312
3459
  function connectionKeyUndeclaredMessage(path, key) {
3313
3460
  return `${path} '${key}' is neither a connection id nor a declared connections[].key \u2014 declare it: connections: [{ key: '${key}', integrationType: '<catalog slug, e.g. github>' }] and it resolves on any agent`;
3314
3461
  }
3315
3462
  __name(connectionKeyUndeclaredMessage, "connectionKeyUndeclaredMessage");
3316
- __name3(connectionKeyUndeclaredMessage, "connectionKeyUndeclaredMessage");
3317
- var WORKFLOW_JOB_TOOLS = [
3318
- "shell",
3319
- "read",
3320
- "write",
3321
- "edit",
3322
- "glob",
3323
- "grep",
3324
- "git",
3325
- "gh",
3326
- "fetch"
3327
- ];
3463
+ __name4(connectionKeyUndeclaredMessage, "connectionKeyUndeclaredMessage");
3328
3464
  var WORKFLOW_JOB_MAX_WORKTREE_ARMS = 8;
3329
3465
  function classifyModelProvider(model) {
3330
3466
  const m = (model ?? "").trim().toLowerCase();
@@ -3335,14 +3471,14 @@ function classifyModelProvider(model) {
3335
3471
  return null;
3336
3472
  }
3337
3473
  __name(classifyModelProvider, "classifyModelProvider");
3338
- __name3(classifyModelProvider, "classifyModelProvider");
3339
- var workspaceOf = /* @__PURE__ */ __name3((node) => node.workspace, "workspaceOf");
3340
- var mountsWorkspace = /* @__PURE__ */ __name3((node) => {
3474
+ __name4(classifyModelProvider, "classifyModelProvider");
3475
+ var workspaceOf = /* @__PURE__ */ __name4((node) => node.workspace, "workspaceOf");
3476
+ var mountsWorkspace = /* @__PURE__ */ __name4((node) => {
3341
3477
  const w = workspaceOf(node);
3342
3478
  return w !== void 0 && w !== "inherit";
3343
3479
  }, "mountsWorkspace");
3344
- var isJobTier = /* @__PURE__ */ __name3((node) => node.tier === "job" || mountsWorkspace(node), "isJobTier");
3345
- var jobToolsOf = /* @__PURE__ */ __name3((node) => {
3480
+ var isJobTier = /* @__PURE__ */ __name4((node) => node.tier === "job" || mountsWorkspace(node), "isJobTier");
3481
+ var jobToolsOf = /* @__PURE__ */ __name4((node) => {
3346
3482
  if (node.type === "agent") return node.toolScope?.jobTools;
3347
3483
  return node.jobTools;
3348
3484
  }, "jobToolsOf");
@@ -3358,17 +3494,17 @@ function schemaAtPath(schema, path) {
3358
3494
  return cur;
3359
3495
  }
3360
3496
  __name(schemaAtPath, "schemaAtPath");
3361
- __name3(schemaAtPath, "schemaAtPath");
3362
- var schemaIsArray = /* @__PURE__ */ __name3((schema) => {
3497
+ __name4(schemaAtPath, "schemaAtPath");
3498
+ var schemaIsArray = /* @__PURE__ */ __name4((schema) => {
3363
3499
  if (!schema) return void 0;
3364
3500
  const t = schema.type;
3365
3501
  if (t === void 0) return void 0;
3366
3502
  return Array.isArray(t) ? t.includes("array") : t === "array";
3367
3503
  }, "schemaIsArray");
3368
- var isHitlNode = /* @__PURE__ */ __name3((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
3369
- var isSingleStep = /* @__PURE__ */ __name3((n2) => !isHitlNode(n2), "isSingleStep");
3370
- var singleId = /* @__PURE__ */ __name3((s) => s.type === "step" ? s.step.id : s.id, "singleId");
3371
- var armId = /* @__PURE__ */ __name3((a) => a.type === "mapping" ? a.id : singleId(a), "armId");
3504
+ var isHitlNode = /* @__PURE__ */ __name4((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
3505
+ var isSingleStep = /* @__PURE__ */ __name4((n2) => !isHitlNode(n2), "isSingleStep");
3506
+ var singleId = /* @__PURE__ */ __name4((s) => s.type === "step" ? s.step.id : s.id, "singleId");
3507
+ var armId = /* @__PURE__ */ __name4((a) => a.type === "mapping" ? a.id : singleId(a), "armId");
3372
3508
  var TEMPLATE_STEP_REF = /\$\{\s*stepResults\.([A-Za-z0-9_\-]+)/g;
3373
3509
  function templateStepRefs(text) {
3374
3510
  const ids = [];
@@ -3376,7 +3512,7 @@ function templateStepRefs(text) {
3376
3512
  return ids;
3377
3513
  }
3378
3514
  __name(templateStepRefs, "templateStepRefs");
3379
- __name3(templateStepRefs, "templateStepRefs");
3515
+ __name4(templateStepRefs, "templateStepRefs");
3380
3516
  function readMapConfig(raw) {
3381
3517
  if (!raw) return void 0;
3382
3518
  if (typeof raw !== "string") return raw;
@@ -3388,7 +3524,7 @@ function readMapConfig(raw) {
3388
3524
  }
3389
3525
  }
3390
3526
  __name(readMapConfig, "readMapConfig");
3391
- __name3(readMapConfig, "readMapConfig");
3527
+ __name4(readMapConfig, "readMapConfig");
3392
3528
  function mapConfigStepRefs(raw) {
3393
3529
  const cfg = readMapConfig(raw);
3394
3530
  if (!cfg) return [];
@@ -3403,7 +3539,7 @@ function mapConfigStepRefs(raw) {
3403
3539
  return ids;
3404
3540
  }
3405
3541
  __name(mapConfigStepRefs, "mapConfigStepRefs");
3406
- __name3(mapConfigStepRefs, "mapConfigStepRefs");
3542
+ __name4(mapConfigStepRefs, "mapConfigStepRefs");
3407
3543
  function nodeStepRefs(entry) {
3408
3544
  switch (entry.type) {
3409
3545
  case "agent": {
@@ -3432,12 +3568,12 @@ function nodeStepRefs(entry) {
3432
3568
  }
3433
3569
  }
3434
3570
  __name(nodeStepRefs, "nodeStepRefs");
3435
- __name3(nodeStepRefs, "nodeStepRefs");
3571
+ __name4(nodeStepRefs, "nodeStepRefs");
3436
3572
  function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3437
3573
  static: true
3438
3574
  }) {
3439
3575
  const issues = [];
3440
- const err = /* @__PURE__ */ __name3((code, message, path, stepId) => {
3576
+ const err = /* @__PURE__ */ __name4((code, message, path, stepId) => {
3441
3577
  issues.push({
3442
3578
  code,
3443
3579
  message,
@@ -3446,7 +3582,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3446
3582
  stepId
3447
3583
  });
3448
3584
  }, "err");
3449
- const warn = /* @__PURE__ */ __name3((code, message, path, stepId) => {
3585
+ const warn = /* @__PURE__ */ __name4((code, message, path, stepId) => {
3450
3586
  issues.push({
3451
3587
  code,
3452
3588
  message,
@@ -3503,7 +3639,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3503
3639
  }
3504
3640
  declaredKeys.add(key);
3505
3641
  });
3506
- const undeclaredKey = /* @__PURE__ */ __name3((ref) => typeof ref === "string" && !declaredKeys.has(ref) && isConnectionKeyShaped(ref) && opts.connectionIds?.has(ref) !== true, "undeclaredKey");
3642
+ const undeclaredKey = /* @__PURE__ */ __name4((ref) => typeof ref === "string" && !declaredKeys.has(ref) && isConnectionKeyShaped(ref) && opts.connectionIds?.has(ref) !== true, "undeclaredKey");
3507
3643
  const credentialsRef = envelopeWorkspace?.credentialsRef;
3508
3644
  if (undeclaredKey(credentialsRef)) {
3509
3645
  err("connection-key-undeclared", connectionKeyUndeclaredMessage("workspace.credentialsRef", credentialsRef), "workspace.credentialsRef");
@@ -3511,7 +3647,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3511
3647
  const seen = /* @__PURE__ */ new Map();
3512
3648
  let nodeCount = 0;
3513
3649
  const upstream = /* @__PURE__ */ new Set();
3514
- const checkId = /* @__PURE__ */ __name3((id, path) => {
3650
+ const checkId = /* @__PURE__ */ __name4((id, path) => {
3515
3651
  nodeCount += 1;
3516
3652
  if (seen.has(id)) {
3517
3653
  err("duplicate-step-id", `step id "${id}" is declared twice (first at ${seen.get(id)})`, path, id);
@@ -3519,9 +3655,9 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3519
3655
  seen.set(id, path);
3520
3656
  }
3521
3657
  }, "checkId");
3522
- const checkPolicyEnums = /* @__PURE__ */ __name3((node, path) => {
3658
+ const checkPolicyEnums = /* @__PURE__ */ __name4((node, path) => {
3523
3659
  const id = singleId(node);
3524
- const check = /* @__PURE__ */ __name3((member, allowed) => {
3660
+ const check = /* @__PURE__ */ __name4((member, allowed) => {
3525
3661
  const value22 = node[member];
3526
3662
  if (value22 === void 0 || typeof value22 === "string" && allowed.includes(value22)) return;
3527
3663
  err("invalid-envelope", `\`${member}\` must be ${allowed.map((a) => `'${a}'`).join(" | ")} (got ${JSON.stringify(value22)})`, `${path}.${member}`, id);
@@ -3529,7 +3665,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3529
3665
  check("sideEffects", WORKFLOW_SIDE_EFFECTS);
3530
3666
  check("jobResources", WORKFLOW_JOB_RESOURCES);
3531
3667
  }, "checkPolicyEnums");
3532
- const checkRetry = /* @__PURE__ */ __name3((node, path) => {
3668
+ const checkRetry = /* @__PURE__ */ __name4((node, path) => {
3533
3669
  const r = node.retry;
3534
3670
  if (!r) return;
3535
3671
  const id = singleId(node);
@@ -3555,7 +3691,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3555
3691
  }
3556
3692
  }
3557
3693
  }, "checkRetry");
3558
- const checkTimeout = /* @__PURE__ */ __name3((node, path) => {
3694
+ const checkTimeout = /* @__PURE__ */ __name4((node, path) => {
3559
3695
  const t = node.timeoutSeconds;
3560
3696
  if (t === void 0) return;
3561
3697
  const id = singleId(node);
@@ -3574,7 +3710,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3574
3710
  err("timeout-exceeds-tier", `timeoutSeconds ${t} exceeds the worker tier's ${caps.maxWorkerTimeoutSeconds} s \u2014 steps longer than 10 min run on the Job tier: add tier:'job' (up to ${caps.maxJobSegmentSeconds} s)`, `${path}.timeoutSeconds`, id);
3575
3711
  }
3576
3712
  }, "checkTimeout");
3577
- const checkSpecialistRole = /* @__PURE__ */ __name3((node, path) => {
3713
+ const checkSpecialistRole = /* @__PURE__ */ __name4((node, path) => {
3578
3714
  const role = node.role;
3579
3715
  const hasRef = typeof role.ref === "string";
3580
3716
  const hasInline = role.name !== void 0 || role.instructions !== void 0 || Array.isArray(role.tools) && role.tools.length > 0;
@@ -3606,7 +3742,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3606
3742
  }
3607
3743
  }
3608
3744
  }, "checkSpecialistRole");
3609
- const checkRequiredConnections = /* @__PURE__ */ __name3((node, path) => {
3745
+ const checkRequiredConnections = /* @__PURE__ */ __name4((node, path) => {
3610
3746
  const required = node.requiredConnections;
3611
3747
  if (!Array.isArray(required)) return;
3612
3748
  const undeclared = required.filter(undeclaredKey);
@@ -3619,7 +3755,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3619
3755
  err("required-connection-unknown", `requiredConnections ${JSON.stringify(unknown)} are neither declared connections[].key values nor connections the owner can mount`, `${path}.requiredConnections`, singleId(node));
3620
3756
  }
3621
3757
  }, "checkRequiredConnections");
3622
- const checkTier = /* @__PURE__ */ __name3((node, path) => {
3758
+ const checkTier = /* @__PURE__ */ __name4((node, path) => {
3623
3759
  const id = singleId(node);
3624
3760
  if (node.workspace && node.workspace !== "inherit" && node.tier !== void 0 && node.tier !== "job") {
3625
3761
  err("workspace-requires-job-tier", "a step mounting a workspace must be tier:'job'", `${path}.workspace`, id);
@@ -3635,7 +3771,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3635
3771
  err("job-tier-provider-unsupported", `model provider '${provider}' is outside LUA_WF_JOB_PROVIDERS [${opts.policy.jobProviders.join(", ")}]`, `${path}.model`, id);
3636
3772
  }
3637
3773
  }, "checkTier");
3638
- const checkModel = /* @__PURE__ */ __name3((node, path) => {
3774
+ const checkModel = /* @__PURE__ */ __name4((node, path) => {
3639
3775
  if (node.type !== "agent" || typeof node.model !== "string") return;
3640
3776
  const registry = opts.approvedModels;
3641
3777
  if (registry === void 0) return;
@@ -3650,7 +3786,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3650
3786
  const resolved = normalizeModelId(node.model, registry);
3651
3787
  if (!resolved.ok) err("model-unresolved", modelUnresolvedMessage(resolved), `${path}.model`, id);
3652
3788
  }, "checkModel");
3653
- const checkWorkspace = /* @__PURE__ */ __name3((node, path) => {
3789
+ const checkWorkspace = /* @__PURE__ */ __name4((node, path) => {
3654
3790
  const id = singleId(node);
3655
3791
  const ws = workspaceOf(node);
3656
3792
  if (isJobTier(node) && opts.policy && opts.policy.jobTier !== true) {
@@ -3673,6 +3809,9 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3673
3809
  warn("gh-on-coding-turn", `"${id}" grants the gh tool on a coding turn \u2014 the pod can open/merge PRs on the workspace repo (purpose:'gh' token, pull_requests:write + contents:write)`, `${path}.jobTools`, id);
3674
3810
  }
3675
3811
  }
3812
+ if (node.type === "agent" && ws && ws !== "inherit" && ws.mount === "ro" && Array.isArray(tools) && effectiveJobTools(tools, true).length === 0) {
3813
+ warn("ro-step-has-no-tools", `"${id}" mounts the workspace read-only and every jobTool it declares (${JSON.stringify(tools)}) is one the ro mount drops [${WORKFLOW_JOB_READ_ONLY_DROPPED.join(", ")}] \u2014 the coding turn would run with no tools at all; keep a read-only tool (read/glob/grep, gh) or mount rw`, `${path}.jobTools`, id);
3814
+ }
3676
3815
  if (ws && ws !== "inherit") {
3677
3816
  if (!envelopeWorkspace && !opts.mayInherit) {
3678
3817
  err("workspace-not-declared", `"${id}" mounts a workspace but the workflow declares none \u2014 add workspace:{kind, \u2026} on createWorkflow`, `${path}.workspace`, id);
@@ -3692,16 +3831,16 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3692
3831
  }
3693
3832
  }, "checkWorkspace");
3694
3833
  const outputSchemas = /* @__PURE__ */ new Map();
3695
- const recordOutputSchema = /* @__PURE__ */ __name3((node) => {
3834
+ const recordOutputSchema = /* @__PURE__ */ __name4((node) => {
3696
3835
  const schema = node.type === "step" ? node.step.outputSchema : node.type === "agent" ? node.outputSchema : void 0;
3697
3836
  if (schema !== void 0) outputSchemas.set(singleId(node), schema);
3698
3837
  }, "recordOutputSchema");
3699
- const checkMapMembers = /* @__PURE__ */ __name3((cfg, basePath, id) => {
3838
+ const checkMapMembers = /* @__PURE__ */ __name4((cfg, basePath, id) => {
3700
3839
  for (const m of malformedMapMembers(cfg)) {
3701
3840
  warn(MAP_MEMBER_MALFORMED_CODE, mapMemberMalformedMessage(id, m), `${basePath}.${m.member}`, id);
3702
3841
  }
3703
3842
  }, "checkMapMembers");
3704
- const checkInputShape = /* @__PURE__ */ __name3((node, path) => {
3843
+ const checkInputShape = /* @__PURE__ */ __name4((node, path) => {
3705
3844
  const input = node.input;
3706
3845
  if (input === void 0) return;
3707
3846
  const id = singleId(node);
@@ -3711,11 +3850,11 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3711
3850
  }
3712
3851
  err("invalid-envelope", `\`input\` must be an object map \u2014 each member a binding descriptor ({initData:true, path} | {step, path} | {value} | {template} | {requestContextPath}) or a JSON literal (got ${JSON.stringify(input)})`, `${path}.input`, id);
3713
3852
  }, "checkInputShape");
3714
- const checkBodyInput = /* @__PURE__ */ __name3((body, path, container) => {
3853
+ const checkBodyInput = /* @__PURE__ */ __name4((body, path, container) => {
3715
3854
  if (body.type === "workflow" || body.input === void 0) return;
3716
3855
  err("arm-input-unsupported", container === "foreach" ? `a foreach body receives each item as its input \u2014 drop \`input\` on "${singleId(body)}" and map the items before the foreach instead` : `a loop body receives the previous output as its input \u2014 drop \`input\` on "${singleId(body)}" and put the map before the loop instead`, `${path}.input`, singleId(body));
3717
3856
  }, "checkBodyInput");
3718
- const checkSingle = /* @__PURE__ */ __name3((node, path, depth) => {
3857
+ const checkSingle = /* @__PURE__ */ __name4((node, path, depth) => {
3719
3858
  recordOutputSchema(node);
3720
3859
  if (node.type === "workflow" && (typeof node.workflowId !== "string" || node.workflowId.length === 0)) {
3721
3860
  checkId(node.id, path);
@@ -3764,7 +3903,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3764
3903
  }
3765
3904
  }
3766
3905
  }, "checkSingle");
3767
- const checkHitl = /* @__PURE__ */ __name3((node, path) => {
3906
+ const checkHitl = /* @__PURE__ */ __name4((node, path) => {
3768
3907
  if (node.type === "waitForSignal") {
3769
3908
  const w = node;
3770
3909
  checkId(w.id, path);
@@ -3773,7 +3912,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3773
3912
  }
3774
3913
  const a = node;
3775
3914
  checkId(a.id, path);
3776
- if (a.approver === "creator" && a.excludeInitiator === true) {
3915
+ if ((a.approver ?? "creator") === "creator" && a.excludeInitiator === true) {
3777
3916
  err("approver-excludes-only-candidate", "approver:'creator' with excludeInitiator:true always excludes the only candidate", path, a.id);
3778
3917
  }
3779
3918
  const editable = approvalEditable(a);
@@ -3803,7 +3942,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3803
3942
  }
3804
3943
  }
3805
3944
  }, "checkHitl");
3806
- const checkHitlArm = /* @__PURE__ */ __name3((node, path, container) => {
3945
+ const checkHitlArm = /* @__PURE__ */ __name4((node, path, container) => {
3807
3946
  if (!workflowContainerRunsHitlArm(container)) {
3808
3947
  checkId(node.id, path);
3809
3948
  err("node-type-unsupported-in-container", workflowHitlArmUnsupportedMessage(node.type, node.id, container), path, node.id);
@@ -3811,7 +3950,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3811
3950
  }
3812
3951
  checkHitl(node, path);
3813
3952
  }, "checkHitlArm");
3814
- const checkArm = /* @__PURE__ */ __name3((arm, path, depth, container) => {
3953
+ const checkArm = /* @__PURE__ */ __name4((arm, path, depth, container) => {
3815
3954
  if (arm.type === "mapping") {
3816
3955
  checkId(arm.id, path);
3817
3956
  checkMapMembers(readMapConfig(arm.mapConfig), `${path}.mapConfig`, arm.id);
@@ -4008,7 +4147,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
4008
4147
  return issues;
4009
4148
  }
4010
4149
  __name(validateLuaExtensions, "validateLuaExtensions");
4011
- __name3(validateLuaExtensions, "validateLuaExtensions");
4150
+ __name4(validateLuaExtensions, "validateLuaExtensions");
4012
4151
  var EDITABLE_PATH_RE = /^[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?(\.[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?)*$/;
4013
4152
  var PREDICATE_OPS = /* @__PURE__ */ new Set([
4014
4153
  "eq",
@@ -4031,8 +4170,8 @@ function isPredicate(p) {
4031
4170
  return typeof p === "object" && p !== null && typeof p.op === "string" && PREDICATE_OPS.has(p.op);
4032
4171
  }
4033
4172
  __name(isPredicate, "isPredicate");
4034
- __name3(isPredicate, "isPredicate");
4035
- var isPredicateScalar = /* @__PURE__ */ __name3((v) => v === null || typeof v === "string" || typeof v === "number" || typeof v === "boolean", "isPredicateScalar");
4173
+ __name4(isPredicate, "isPredicate");
4174
+ var isPredicateScalar = /* @__PURE__ */ __name4((v) => v === null || typeof v === "string" || typeof v === "number" || typeof v === "boolean", "isPredicateScalar");
4036
4175
  function isPathOrLiteral(v) {
4037
4176
  if (typeof v !== "object" || v === null) return false;
4038
4177
  const r = v;
@@ -4040,7 +4179,7 @@ function isPathOrLiteral(v) {
4040
4179
  return "literal" in r && isPredicateScalar(r.literal);
4041
4180
  }
4042
4181
  __name(isPathOrLiteral, "isPathOrLiteral");
4043
- __name3(isPathOrLiteral, "isPathOrLiteral");
4182
+ __name4(isPathOrLiteral, "isPathOrLiteral");
4044
4183
  function isWellFormedPredicate(p) {
4045
4184
  if (!isPredicate(p)) return false;
4046
4185
  const r = p;
@@ -4071,11 +4210,11 @@ function isWellFormedPredicate(p) {
4071
4210
  }
4072
4211
  }
4073
4212
  __name(isWellFormedPredicate, "isWellFormedPredicate");
4074
- __name3(isWellFormedPredicate, "isWellFormedPredicate");
4213
+ __name4(isWellFormedPredicate, "isWellFormedPredicate");
4075
4214
  var GRAPH_HASH_PREFIX = "sha256-cj1:";
4076
4215
  function canonicalJson(value22) {
4077
4216
  const seen = /* @__PURE__ */ new WeakSet();
4078
- const encode = /* @__PURE__ */ __name3((v) => {
4217
+ const encode = /* @__PURE__ */ __name4((v) => {
4079
4218
  if (v === null || typeof v === "number" || typeof v === "boolean") return JSON.stringify(v);
4080
4219
  if (typeof v === "string") return JSON.stringify(v);
4081
4220
  if (typeof v === "bigint") return JSON.stringify(`${v}n`);
@@ -4096,19 +4235,19 @@ function canonicalJson(value22) {
4096
4235
  return encode(value22);
4097
4236
  }
4098
4237
  __name(canonicalJson, "canonicalJson");
4099
- __name3(canonicalJson, "canonicalJson");
4238
+ __name4(canonicalJson, "canonicalJson");
4100
4239
  function hashGraph(g) {
4101
4240
  const { metadata: _provenance, ...definition } = withDefaultsFilled(g).definition;
4102
4241
  return GRAPH_HASH_PREFIX + createHash("sha256").update(canonicalJson(definition)).digest("hex");
4103
4242
  }
4104
4243
  __name(hashGraph, "hashGraph");
4105
- __name3(hashGraph, "hashGraph");
4244
+ __name4(hashGraph, "hashGraph");
4106
4245
  var WorkflowPlanError = class extends Error {
4107
4246
  static {
4108
4247
  __name(this, "WorkflowPlanError");
4109
4248
  }
4110
4249
  static {
4111
- __name3(this, "WorkflowPlanError");
4250
+ __name4(this, "WorkflowPlanError");
4112
4251
  }
4113
4252
  code;
4114
4253
  constructor(code, message) {
@@ -4116,15 +4255,15 @@ var WorkflowPlanError = class extends Error {
4116
4255
  this.name = "WorkflowPlanError";
4117
4256
  }
4118
4257
  };
4119
- var isArmStep = /* @__PURE__ */ __name3((e) => isWorkflowArmEntryType(e.type), "isArmStep");
4120
- var armStepId = /* @__PURE__ */ __name3((e) => e.type === "step" ? e.step.id : e.id, "armStepId");
4121
- var armStepKind = /* @__PURE__ */ __name3((e) => WORKFLOW_ARM_ENTRY_STEP_KINDS[e.type], "armStepKind");
4122
- var joinIdOf = /* @__PURE__ */ __name3((entryId) => `${entryId}.join`, "joinIdOf");
4123
- var containerIdOf = /* @__PURE__ */ __name3((type, entryIndex) => `${type}@${entryIndex}`, "containerIdOf");
4258
+ var isArmStep = /* @__PURE__ */ __name4((e) => isWorkflowArmEntryType(e.type), "isArmStep");
4259
+ var armStepId = /* @__PURE__ */ __name4((e) => e.type === "step" ? e.step.id : e.id, "armStepId");
4260
+ var armStepKind = /* @__PURE__ */ __name4((e) => WORKFLOW_ARM_ENTRY_STEP_KINDS[e.type], "armStepKind");
4261
+ var joinIdOf = /* @__PURE__ */ __name4((entryId) => `${entryId}.join`, "joinIdOf");
4262
+ var containerIdOf = /* @__PURE__ */ __name4((type, entryIndex) => `${type}@${entryIndex}`, "containerIdOf");
4124
4263
  function compilePlan(g) {
4125
4264
  const steps = {};
4126
4265
  const order = [];
4127
- const addNode = /* @__PURE__ */ __name3((id, node) => {
4266
+ const addNode = /* @__PURE__ */ __name4((id, node) => {
4128
4267
  if (id in steps) {
4129
4268
  throw new WorkflowPlanError("duplicate-step-id", `Duplicate step id "${id}" in definition.graph`);
4130
4269
  }
@@ -4295,7 +4434,7 @@ function compilePlan(g) {
4295
4434
  };
4296
4435
  }
4297
4436
  __name(compilePlan, "compilePlan");
4298
- __name3(compilePlan, "compilePlan");
4437
+ __name4(compilePlan, "compilePlan");
4299
4438
  var PATH_PLACEHOLDER = /^\$\{([^}]+)\}$/;
4300
4439
  var MISSING = /* @__PURE__ */ Symbol("predicate.missing");
4301
4440
  function resolvePath(rawPath, ctx) {
@@ -4339,7 +4478,7 @@ function resolvePath(rawPath, ctx) {
4339
4478
  return walk(root, rest);
4340
4479
  }
4341
4480
  __name(resolvePath, "resolvePath");
4342
- __name3(resolvePath, "resolvePath");
4481
+ __name4(resolvePath, "resolvePath");
4343
4482
  function walk(root, path) {
4344
4483
  if (path === "") return root;
4345
4484
  const parts = path.split(".");
@@ -4354,13 +4493,13 @@ function walk(root, path) {
4354
4493
  return value22;
4355
4494
  }
4356
4495
  __name(walk, "walk");
4357
- __name3(walk, "walk");
4496
+ __name4(walk, "walk");
4358
4497
  function resolveValue(ref, ctx) {
4359
4498
  if ("literal" in ref) return ref.literal;
4360
4499
  return resolvePath(ref.path, ctx);
4361
4500
  }
4362
4501
  __name(resolveValue, "resolveValue");
4363
- __name3(resolveValue, "resolveValue");
4502
+ __name4(resolveValue, "resolveValue");
4364
4503
  function evaluatePredicate(pred, ctx) {
4365
4504
  switch (pred.op) {
4366
4505
  case "and":
@@ -4400,7 +4539,7 @@ function evaluatePredicate(pred, ctx) {
4400
4539
  }
4401
4540
  }
4402
4541
  __name(evaluatePredicate, "evaluatePredicate");
4403
- __name3(evaluatePredicate, "evaluatePredicate");
4542
+ __name4(evaluatePredicate, "evaluatePredicate");
4404
4543
  function compare(op, left, right) {
4405
4544
  if (op === "eq") return left === right;
4406
4545
  if (op === "ne") return left !== right;
@@ -4419,14 +4558,14 @@ function compare(op, left, right) {
4419
4558
  return false;
4420
4559
  }
4421
4560
  __name(compare, "compare");
4422
- __name3(compare, "compare");
4561
+ __name4(compare, "compare");
4423
4562
  function derivePredicateLabel(pred, maxLength = 80) {
4424
4563
  const raw = renderPredicate(pred);
4425
4564
  if (raw.length <= maxLength) return raw;
4426
4565
  return raw.slice(0, maxLength - 1) + "\u2026";
4427
4566
  }
4428
4567
  __name(derivePredicateLabel, "derivePredicateLabel");
4429
- __name3(derivePredicateLabel, "derivePredicateLabel");
4568
+ __name4(derivePredicateLabel, "derivePredicateLabel");
4430
4569
  function renderPredicate(pred) {
4431
4570
  switch (pred.op) {
4432
4571
  case "and":
@@ -4461,55 +4600,55 @@ function renderPredicate(pred) {
4461
4600
  }
4462
4601
  }
4463
4602
  __name(renderPredicate, "renderPredicate");
4464
- __name3(renderPredicate, "renderPredicate");
4603
+ __name4(renderPredicate, "renderPredicate");
4465
4604
  function wrapLabel(child, rendered) {
4466
4605
  return child.op === "and" || child.op === "or" || child.op === "not" ? `(${rendered})` : rendered;
4467
4606
  }
4468
4607
  __name(wrapLabel, "wrapLabel");
4469
- __name3(wrapLabel, "wrapLabel");
4608
+ __name4(wrapLabel, "wrapLabel");
4470
4609
  function renderRef(ref) {
4471
4610
  if ("literal" in ref) return JSON.stringify(ref.literal);
4472
4611
  return ref.path;
4473
4612
  }
4474
4613
  __name(renderRef, "renderRef");
4475
- __name3(renderRef, "renderRef");
4476
- var stepIdOf = /* @__PURE__ */ __name3((s) => typeof s === "string" ? s : s.id, "stepIdOf");
4614
+ __name4(renderRef, "renderRef");
4615
+ var stepIdOf = /* @__PURE__ */ __name4((s) => typeof s === "string" ? s : s.id, "stepIdOf");
4477
4616
  function step(s) {
4478
4617
  const id = stepIdOf(s);
4479
4618
  return {
4480
- path: /* @__PURE__ */ __name3((p) => ({
4619
+ path: /* @__PURE__ */ __name4((p) => ({
4481
4620
  path: p === "" ? `stepResults.${id}` : `stepResults.${id}.${p}`
4482
4621
  }), "path")
4483
4622
  };
4484
4623
  }
4485
4624
  __name(step, "step");
4486
- __name3(step, "step");
4625
+ __name4(step, "step");
4487
4626
  function stepOf(id) {
4488
4627
  return step(id);
4489
4628
  }
4490
4629
  __name(stepOf, "stepOf");
4491
- __name3(stepOf, "stepOf");
4630
+ __name4(stepOf, "stepOf");
4492
4631
  function init(path) {
4493
4632
  return {
4494
4633
  path: path === "" ? "initData" : `initData.${path}`
4495
4634
  };
4496
4635
  }
4497
4636
  __name(init, "init");
4498
- __name3(init, "init");
4637
+ __name4(init, "init");
4499
4638
  function state(path) {
4500
4639
  return {
4501
4640
  path: path === "" ? "state" : `state.${path}`
4502
4641
  };
4503
4642
  }
4504
4643
  __name(state, "state");
4505
- __name3(state, "state");
4644
+ __name4(state, "state");
4506
4645
  function lit(v) {
4507
4646
  return {
4508
4647
  literal: v
4509
4648
  };
4510
4649
  }
4511
4650
  __name(lit, "lit");
4512
- __name3(lit, "lit");
4651
+ __name4(lit, "lit");
4513
4652
  function toPathOrLiteral(v) {
4514
4653
  if (typeof v === "object" && v !== null) {
4515
4654
  if ("path" in v) return {
@@ -4524,8 +4663,8 @@ function toPathOrLiteral(v) {
4524
4663
  };
4525
4664
  }
4526
4665
  __name(toPathOrLiteral, "toPathOrLiteral");
4527
- __name3(toPathOrLiteral, "toPathOrLiteral");
4528
- var cmp = /* @__PURE__ */ __name3((op) => (l, r) => ({
4666
+ __name4(toPathOrLiteral, "toPathOrLiteral");
4667
+ var cmp = /* @__PURE__ */ __name4((op) => (l, r) => ({
4529
4668
  op,
4530
4669
  left: toPathOrLiteral(l),
4531
4670
  right: toPathOrLiteral(r)
@@ -4536,49 +4675,49 @@ var gt = cmp("gt");
4536
4675
  var gte = cmp("gte");
4537
4676
  var lt = cmp("lt");
4538
4677
  var lte = cmp("lte");
4539
- var inSet = /* @__PURE__ */ __name3((v, set) => ({
4678
+ var inSet = /* @__PURE__ */ __name4((v, set) => ({
4540
4679
  op: "in",
4541
4680
  value: {
4542
4681
  path: v.path
4543
4682
  },
4544
4683
  set
4545
4684
  }), "inSet");
4546
- var notIn = /* @__PURE__ */ __name3((v, set) => ({
4685
+ var notIn = /* @__PURE__ */ __name4((v, set) => ({
4547
4686
  op: "notIn",
4548
4687
  value: {
4549
4688
  path: v.path
4550
4689
  },
4551
4690
  set
4552
4691
  }), "notIn");
4553
- var exists = /* @__PURE__ */ __name3((ref) => ({
4692
+ var exists = /* @__PURE__ */ __name4((ref) => ({
4554
4693
  op: "exists",
4555
4694
  path: ref.path
4556
4695
  }), "exists");
4557
- var notExists = /* @__PURE__ */ __name3((ref) => ({
4696
+ var notExists = /* @__PURE__ */ __name4((ref) => ({
4558
4697
  op: "notExists",
4559
4698
  path: ref.path
4560
4699
  }), "notExists");
4561
- var truthy = /* @__PURE__ */ __name3((ref) => ({
4700
+ var truthy = /* @__PURE__ */ __name4((ref) => ({
4562
4701
  op: "truthy",
4563
4702
  value: {
4564
4703
  path: ref.path
4565
4704
  }
4566
4705
  }), "truthy");
4567
- var falsy = /* @__PURE__ */ __name3((ref) => ({
4706
+ var falsy = /* @__PURE__ */ __name4((ref) => ({
4568
4707
  op: "falsy",
4569
4708
  value: {
4570
4709
  path: ref.path
4571
4710
  }
4572
4711
  }), "falsy");
4573
- var and = /* @__PURE__ */ __name3((...args) => ({
4712
+ var and = /* @__PURE__ */ __name4((...args) => ({
4574
4713
  op: "and",
4575
4714
  args
4576
4715
  }), "and");
4577
- var or = /* @__PURE__ */ __name3((...args) => ({
4716
+ var or = /* @__PURE__ */ __name4((...args) => ({
4578
4717
  op: "or",
4579
4718
  args
4580
4719
  }), "or");
4581
- var not = /* @__PURE__ */ __name3((arg) => ({
4720
+ var not = /* @__PURE__ */ __name4((arg) => ({
4582
4721
  op: "not",
4583
4722
  arg
4584
4723
  }), "not");
@@ -4643,7 +4782,7 @@ function continuedFailureValue(error, killReason) {
4643
4782
  };
4644
4783
  }
4645
4784
  __name(continuedFailureValue, "continuedFailureValue");
4646
- __name3(continuedFailureValue, "continuedFailureValue");
4785
+ __name4(continuedFailureValue, "continuedFailureValue");
4647
4786
  function isContinuedFailureValue(v) {
4648
4787
  if (v === null || typeof v !== "object" || Array.isArray(v)) return false;
4649
4788
  const o = v;
@@ -4651,8 +4790,8 @@ function isContinuedFailureValue(v) {
4651
4790
  return o.__lua_workflow === CONTINUED_FAILURE_TAG && o.failed === true && o.text === "" && err !== null && typeof err === "object" && typeof err.code === "string" && typeof err.message === "string";
4652
4791
  }
4653
4792
  __name(isContinuedFailureValue, "isContinuedFailureValue");
4654
- __name3(isContinuedFailureValue, "isContinuedFailureValue");
4655
- var isHitlNode2 = /* @__PURE__ */ __name3((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
4793
+ __name4(isContinuedFailureValue, "isContinuedFailureValue");
4794
+ var isHitlNode2 = /* @__PURE__ */ __name4((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
4656
4795
  function inlineContainerArm(mapping, step22) {
4657
4796
  return {
4658
4797
  ...step22,
@@ -4660,8 +4799,8 @@ function inlineContainerArm(mapping, step22) {
4660
4799
  };
4661
4800
  }
4662
4801
  __name(inlineContainerArm, "inlineContainerArm");
4663
- __name3(inlineContainerArm, "inlineContainerArm");
4664
- var nodeIdOf = /* @__PURE__ */ __name3((n2) => n2.type === "step" ? n2.step.id : n2.id, "nodeIdOf");
4802
+ __name4(inlineContainerArm, "inlineContainerArm");
4803
+ var nodeIdOf = /* @__PURE__ */ __name4((n2) => n2.type === "step" ? n2.step.id : n2.id, "nodeIdOf");
4665
4804
  function entryIds(entry) {
4666
4805
  switch (entry.type) {
4667
4806
  case "parallel":
@@ -4685,13 +4824,13 @@ function entryIds(entry) {
4685
4824
  }
4686
4825
  }
4687
4826
  __name(entryIds, "entryIds");
4688
- __name3(entryIds, "entryIds");
4827
+ __name4(entryIds, "entryIds");
4689
4828
  function resolvePlacements(calls) {
4690
4829
  const issues = [];
4691
4830
  const declared = /* @__PURE__ */ new Map();
4692
4831
  const placedBy = /* @__PURE__ */ new Map();
4693
4832
  const allIds = /* @__PURE__ */ new Map();
4694
- const claimId = /* @__PURE__ */ __name3((id, callIndex) => {
4833
+ const claimId = /* @__PURE__ */ __name4((id, callIndex) => {
4695
4834
  const first = allIds.get(id);
4696
4835
  if (first !== void 0 && first !== callIndex) {
4697
4836
  issues.push({
@@ -4731,7 +4870,7 @@ function resolvePlacements(calls) {
4731
4870
  break;
4732
4871
  }
4733
4872
  });
4734
- const armMapPlacementIssue = /* @__PURE__ */ __name3((node, ref, i, container) => {
4873
+ const armMapPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
4735
4874
  if (!ref.armMap || node.type === "mapping" || isHitlNode2(node)) return void 0;
4736
4875
  const id = nodeIdOf(node);
4737
4876
  if ((container === "foreach" || container === "loop") && node.type !== "workflow") {
@@ -4752,7 +4891,7 @@ function resolvePlacements(calls) {
4752
4891
  }
4753
4892
  return void 0;
4754
4893
  }, "armMapPlacementIssue");
4755
- const hitlPlacementIssue = /* @__PURE__ */ __name3((node, ref, i, container) => {
4894
+ const hitlPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
4756
4895
  if (!isHitlNode2(node)) return void 0;
4757
4896
  const id = node.id;
4758
4897
  if (ref.armMap) {
@@ -4773,7 +4912,7 @@ function resolvePlacements(calls) {
4773
4912
  }
4774
4913
  return void 0;
4775
4914
  }, "hitlPlacementIssue");
4776
- const resolve = /* @__PURE__ */ __name3((ref, i, allowMapping, container) => {
4915
+ const resolve = /* @__PURE__ */ __name4((ref, i, allowMapping, container) => {
4777
4916
  if ("node" in ref) {
4778
4917
  if (ref.node.type === "mapping" && !allowMapping) {
4779
4918
  issues.push({
@@ -4828,7 +4967,7 @@ function resolvePlacements(calls) {
4828
4967
  placedBy.set(ref.ref, i);
4829
4968
  return d.node;
4830
4969
  }, "resolve");
4831
- const claim = /* @__PURE__ */ __name3((ref, i, allowMapping, container) => {
4970
+ const claim = /* @__PURE__ */ __name4((ref, i, allowMapping, container) => {
4832
4971
  if ("ref" in ref) {
4833
4972
  resolve(ref, i, allowMapping, container);
4834
4973
  return;
@@ -4863,7 +5002,7 @@ function resolvePlacements(calls) {
4863
5002
  }
4864
5003
  });
4865
5004
  const graph = [];
4866
- const lookup = /* @__PURE__ */ __name3((ref) => {
5005
+ const lookup = /* @__PURE__ */ __name4((ref) => {
4867
5006
  const n2 = "node" in ref ? ref.node : declared.get(ref.ref)?.node;
4868
5007
  if (!n2 || !ref.armMap || n2.type === "mapping" || isHitlNode2(n2)) return n2;
4869
5008
  return inlineContainerArm(ref.armMap, n2);
@@ -4946,7 +5085,7 @@ function resolvePlacements(calls) {
4946
5085
  };
4947
5086
  }
4948
5087
  __name(resolvePlacements, "resolvePlacements");
4949
- __name3(resolvePlacements, "resolvePlacements");
5088
+ __name4(resolvePlacements, "resolvePlacements");
4950
5089
  var GOAL_JUDGE_STEP_ID = "__goal_judge";
4951
5090
  var NON_LEAF_KINDS = /* @__PURE__ */ new Set([
4952
5091
  "foreach",
@@ -4957,18 +5096,18 @@ function isConditionalJoinId(stepId) {
4957
5096
  return CONDITIONAL_JOIN_ID.test(stepId);
4958
5097
  }
4959
5098
  __name(isConditionalJoinId, "isConditionalJoinId");
4960
- __name3(isConditionalJoinId, "isConditionalJoinId");
5099
+ __name4(isConditionalJoinId, "isConditionalJoinId");
4961
5100
  function isPlainObject(v) {
4962
5101
  return typeof v === "object" && v !== null && !Array.isArray(v);
4963
5102
  }
4964
5103
  __name(isPlainObject, "isPlainObject");
4965
- __name3(isPlainObject, "isPlainObject");
5104
+ __name4(isPlainObject, "isPlainObject");
4966
5105
  function leafValue(row) {
4967
5106
  if (row.status === "completed") return row.output === void 0 ? null : row.output;
4968
5107
  return continuedFailureValue(row.error, row.killReason);
4969
5108
  }
4970
5109
  __name(leafValue, "leafValue");
4971
- __name3(leafValue, "leafValue");
5110
+ __name4(leafValue, "leafValue");
4972
5111
  function runOutputLeaves(steps) {
4973
5112
  const dependedOn = /* @__PURE__ */ new Set();
4974
5113
  for (const s of steps) {
@@ -4978,7 +5117,7 @@ function runOutputLeaves(steps) {
4978
5117
  return steps.filter((s) => s.stepId !== GOAL_JUDGE_STEP_ID && !NON_LEAF_KINDS.has(s.kind ?? "") && s.foreachIndex === void 0 && s.loopParentId === void 0 && s.status !== "skipped" && !dependedOn.has(s.stepId));
4979
5118
  }
4980
5119
  __name(runOutputLeaves, "runOutputLeaves");
4981
- __name3(runOutputLeaves, "runOutputLeaves");
5120
+ __name4(runOutputLeaves, "runOutputLeaves");
4982
5121
  function deriveRunOutput(steps) {
4983
5122
  const leaves = runOutputLeaves(steps);
4984
5123
  if (leaves.length === 0) return void 0;
@@ -5009,13 +5148,13 @@ function deriveRunOutput(steps) {
5009
5148
  };
5010
5149
  }
5011
5150
  __name(deriveRunOutput, "deriveRunOutput");
5012
- __name3(deriveRunOutput, "deriveRunOutput");
5151
+ __name4(deriveRunOutput, "deriveRunOutput");
5013
5152
  function subrunSettledOutput(child) {
5014
5153
  if (child.output !== void 0) return child.output;
5015
5154
  return deriveRunOutput(child.steps ?? [])?.output ?? null;
5016
5155
  }
5017
5156
  __name(subrunSettledOutput, "subrunSettledOutput");
5018
- __name3(subrunSettledOutput, "subrunSettledOutput");
5157
+ __name4(subrunSettledOutput, "subrunSettledOutput");
5019
5158
  function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
5020
5159
  const byId = /* @__PURE__ */ new Map();
5021
5160
  for (const s of steps) {
@@ -5026,11 +5165,11 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
5026
5165
  const seeded = [];
5027
5166
  const unseeded = [];
5028
5167
  const known = new Set(Object.keys(targetPlan.steps));
5029
- const parentOf = /* @__PURE__ */ __name3((id) => {
5168
+ const parentOf = /* @__PURE__ */ __name4((id) => {
5030
5169
  const m = /^(.*)(\[\d+\]|#\d+)$/.exec(id);
5031
5170
  return m ? m[1] : void 0;
5032
5171
  }, "parentOf");
5033
- const dependsOf = /* @__PURE__ */ __name3((id) => {
5172
+ const dependsOf = /* @__PURE__ */ __name4((id) => {
5034
5173
  const node = targetPlan.steps[id];
5035
5174
  if (node) return node.dependsOn;
5036
5175
  const parent = parentOf(id);
@@ -5076,8 +5215,8 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
5076
5215
  };
5077
5216
  }
5078
5217
  __name(seedLedgerFromRun, "seedLedgerFromRun");
5079
- __name3(seedLedgerFromRun, "seedLedgerFromRun");
5080
- var branchArmId = /* @__PURE__ */ __name3((arm) => arm.type === "step" ? arm.step.id : arm.id, "branchArmId");
5218
+ __name4(seedLedgerFromRun, "seedLedgerFromRun");
5219
+ var branchArmId = /* @__PURE__ */ __name4((arm) => arm.type === "step" ? arm.step.id : arm.id, "branchArmId");
5081
5220
  function branchSpecFromConditional(entry) {
5082
5221
  return {
5083
5222
  arms: entry.steps.map((arm, i) => ({
@@ -5093,7 +5232,7 @@ function branchSpecFromConditional(entry) {
5093
5232
  };
5094
5233
  }
5095
5234
  __name(branchSpecFromConditional, "branchSpecFromConditional");
5096
- __name3(branchSpecFromConditional, "branchSpecFromConditional");
5235
+ __name4(branchSpecFromConditional, "branchSpecFromConditional");
5097
5236
  function selectBranchArms(spec, ctx) {
5098
5237
  const taken = [];
5099
5238
  for (const arm of spec.arms) {
@@ -5105,9 +5244,9 @@ function selectBranchArms(spec, ctx) {
5105
5244
  return taken;
5106
5245
  }
5107
5246
  __name(selectBranchArms, "selectBranchArms");
5108
- __name3(selectBranchArms, "selectBranchArms");
5109
- var canonical = /* @__PURE__ */ __name3((v) => JSON.stringify(sortKeys(v)), "canonical");
5110
- var sortKeys = /* @__PURE__ */ __name3((v) => {
5247
+ __name4(selectBranchArms, "selectBranchArms");
5248
+ var canonical = /* @__PURE__ */ __name4((v) => JSON.stringify(sortKeys(v)), "canonical");
5249
+ var sortKeys = /* @__PURE__ */ __name4((v) => {
5111
5250
  if (Array.isArray(v)) return v.map(sortKeys);
5112
5251
  if (v && typeof v === "object") {
5113
5252
  return Object.fromEntries(Object.keys(v).sort().map((k) => [
@@ -5135,7 +5274,7 @@ function replayLedger(g, ledger) {
5135
5274
  startedAt: 0,
5136
5275
  ...ledger.requestContext
5137
5276
  };
5138
- const ctxFor = /* @__PURE__ */ __name3((id) => ({
5277
+ const ctxFor = /* @__PURE__ */ __name4((id) => ({
5139
5278
  initData: ledger.initData,
5140
5279
  stepResults: ancestorResults(plan, id, rows22),
5141
5280
  state: ledger.state ?? {},
@@ -5201,9 +5340,9 @@ function replayLedger(g, ledger) {
5201
5340
  };
5202
5341
  }
5203
5342
  __name(replayLedger, "replayLedger");
5204
- __name3(replayLedger, "replayLedger");
5343
+ __name4(replayLedger, "replayLedger");
5205
5344
  var JOIN = ".join";
5206
- var entryOfJoin = /* @__PURE__ */ __name3((id) => id.endsWith(JOIN) ? id.slice(0, -JOIN.length) : void 0, "entryOfJoin");
5345
+ var entryOfJoin = /* @__PURE__ */ __name4((id) => id.endsWith(JOIN) ? id.slice(0, -JOIN.length) : void 0, "entryOfJoin");
5207
5346
  function replayResultOf(row, node) {
5208
5347
  if (!row) return void 0;
5209
5348
  if (row.status === "completed") return {
@@ -5218,12 +5357,12 @@ function replayResultOf(row, node) {
5218
5357
  return void 0;
5219
5358
  }
5220
5359
  __name(replayResultOf, "replayResultOf");
5221
- __name3(replayResultOf, "replayResultOf");
5360
+ __name4(replayResultOf, "replayResultOf");
5222
5361
  function ancestorResults(plan, id, rows22) {
5223
5362
  const out = {};
5224
5363
  const joinAliased = /* @__PURE__ */ new Set();
5225
5364
  const seen = /* @__PURE__ */ new Set();
5226
- const take = /* @__PURE__ */ __name3((rowId) => {
5365
+ const take = /* @__PURE__ */ __name4((rowId) => {
5227
5366
  const hit = replayResultOf(rows22.get(rowId), plan.steps[rowId]);
5228
5367
  if (!hit) return void 0;
5229
5368
  if (!joinAliased.has(rowId)) out[rowId] = hit.value;
@@ -5240,7 +5379,7 @@ function ancestorResults(plan, id, rows22) {
5240
5379
  }
5241
5380
  return hit;
5242
5381
  }, "take");
5243
- const walk2 = /* @__PURE__ */ __name3((ids) => {
5382
+ const walk2 = /* @__PURE__ */ __name4((ids) => {
5244
5383
  for (const dep of ids) {
5245
5384
  if (seen.has(dep)) continue;
5246
5385
  seen.add(dep);
@@ -5272,7 +5411,7 @@ function ancestorResults(plan, id, rows22) {
5272
5411
  return out;
5273
5412
  }
5274
5413
  __name(ancestorResults, "ancestorResults");
5275
- __name3(ancestorResults, "ancestorResults");
5414
+ __name4(ancestorResults, "ancestorResults");
5276
5415
  function inferTaken(entry, rows22) {
5277
5416
  const arms = [
5278
5417
  ...entry.steps,
@@ -5286,7 +5425,7 @@ function inferTaken(entry, rows22) {
5286
5425
  });
5287
5426
  }
5288
5427
  __name(inferTaken, "inferTaken");
5289
- __name3(inferTaken, "inferTaken");
5428
+ __name4(inferTaken, "inferTaken");
5290
5429
  function countChildren(entry, rows22) {
5291
5430
  const body = branchArmId(entry.step);
5292
5431
  let n2 = 0;
@@ -5294,19 +5433,19 @@ function countChildren(entry, rows22) {
5294
5433
  return n2;
5295
5434
  }
5296
5435
  __name(countChildren, "countChildren");
5297
- __name3(countChildren, "countChildren");
5436
+ __name4(countChildren, "countChildren");
5298
5437
  var FORCE_CANCEL_STALE_MS = 10 * 60 * 1e3;
5299
5438
  var TERMINAL = new Set(WORKFLOW_RUN_TERMINAL);
5300
5439
  function isTerminalRunStatus(status) {
5301
5440
  return TERMINAL.has(status);
5302
5441
  }
5303
5442
  __name(isTerminalRunStatus, "isTerminalRunStatus");
5304
- __name3(isTerminalRunStatus, "isTerminalRunStatus");
5443
+ __name4(isTerminalRunStatus, "isTerminalRunStatus");
5305
5444
  function pruneUndefined(o) {
5306
5445
  return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
5307
5446
  }
5308
5447
  __name(pruneUndefined, "pruneUndefined");
5309
- __name3(pruneUndefined, "pruneUndefined");
5448
+ __name4(pruneUndefined, "pruneUndefined");
5310
5449
  var WORKFLOW_INLINE_RUN_TAG = "inline";
5311
5450
  function runOrigin(run) {
5312
5451
  if (run.goalId) return "goal";
@@ -5315,7 +5454,7 @@ function runOrigin(run) {
5315
5454
  return "definition";
5316
5455
  }
5317
5456
  __name(runOrigin, "runOrigin");
5318
- __name3(runOrigin, "runOrigin");
5457
+ __name4(runOrigin, "runOrigin");
5319
5458
  var RUN_ERROR_ISSUES_MAX = 20;
5320
5459
  function runErrorIssues(issues) {
5321
5460
  if (!Array.isArray(issues)) return void 0;
@@ -5333,7 +5472,7 @@ function runErrorIssues(issues) {
5333
5472
  return out.length ? out : void 0;
5334
5473
  }
5335
5474
  __name(runErrorIssues, "runErrorIssues");
5336
- __name3(runErrorIssues, "runErrorIssues");
5475
+ __name4(runErrorIssues, "runErrorIssues");
5337
5476
  function runNextAction(run) {
5338
5477
  if (isTerminalRunStatus(run.status)) return "none";
5339
5478
  if (run.status === "suspended" && run.gate?.kind === "budget") return "raise_budget";
@@ -5343,7 +5482,7 @@ function runNextAction(run) {
5343
5482
  return Date.now() >= forceAt ? "force" : "cancel_again";
5344
5483
  }
5345
5484
  __name(runNextAction, "runNextAction");
5346
- __name3(runNextAction, "runNextAction");
5485
+ __name4(runNextAction, "runNextAction");
5347
5486
  var IN_FLIGHT = new Set(WORKFLOW_STEP_IN_FLIGHT);
5348
5487
  function emptyRunCounts() {
5349
5488
  const out = {
@@ -5354,7 +5493,7 @@ function emptyRunCounts() {
5354
5493
  return out;
5355
5494
  }
5356
5495
  __name(emptyRunCounts, "emptyRunCounts");
5357
- __name3(emptyRunCounts, "emptyRunCounts");
5496
+ __name4(emptyRunCounts, "emptyRunCounts");
5358
5497
  function runCountsFromStatusTally(tally) {
5359
5498
  const out = emptyRunCounts();
5360
5499
  for (const [status, n2] of Object.entries(tally)) {
@@ -5366,25 +5505,25 @@ function runCountsFromStatusTally(tally) {
5366
5505
  return out;
5367
5506
  }
5368
5507
  __name(runCountsFromStatusTally, "runCountsFromStatusTally");
5369
- __name3(runCountsFromStatusTally, "runCountsFromStatusTally");
5508
+ __name4(runCountsFromStatusTally, "runCountsFromStatusTally");
5370
5509
  function runCountsFromStepStatuses(statuses) {
5371
5510
  const tally = {};
5372
5511
  for (const s of statuses) tally[s] = (tally[s] ?? 0) + 1;
5373
5512
  return runCountsFromStatusTally(tally);
5374
5513
  }
5375
5514
  __name(runCountsFromStepStatuses, "runCountsFromStepStatuses");
5376
- __name3(runCountsFromStepStatuses, "runCountsFromStepStatuses");
5515
+ __name4(runCountsFromStepStatuses, "runCountsFromStepStatuses");
5377
5516
  function isBillingHeldStep(row) {
5378
5517
  return row.status === "ready" && row.billingHold === true;
5379
5518
  }
5380
5519
  __name(isBillingHeldStep, "isBillingHeldStep");
5381
- __name3(isBillingHeldStep, "isBillingHeldStep");
5520
+ __name4(isBillingHeldStep, "isBillingHeldStep");
5382
5521
  function stepEffectiveStatus(row) {
5383
5522
  return isBillingHeldStep(row) ? "suspended" : row.status;
5384
5523
  }
5385
5524
  __name(stepEffectiveStatus, "stepEffectiveStatus");
5386
- __name3(stepEffectiveStatus, "stepEffectiveStatus");
5387
- var n = /* @__PURE__ */ __name3((v) => typeof v === "number" && Number.isFinite(v) ? v : 0, "n");
5525
+ __name4(stepEffectiveStatus, "stepEffectiveStatus");
5526
+ var n = /* @__PURE__ */ __name4((v) => typeof v === "number" && Number.isFinite(v) ? v : 0, "n");
5388
5527
  function runCounts(counts) {
5389
5528
  const c = counts ?? {};
5390
5529
  const rawInFlight = c.dispatched !== void 0 || c.claimed !== void 0 || c.running !== void 0 || c.cancellation_requested !== void 0;
@@ -5401,24 +5540,24 @@ function runCounts(counts) {
5401
5540
  };
5402
5541
  }
5403
5542
  __name(runCounts, "runCounts");
5404
- __name3(runCounts, "runCounts");
5543
+ __name4(runCounts, "runCounts");
5405
5544
  function isPricedStepReceipt(receipt) {
5406
5545
  return typeof receipt?.multiplier === "number" && Number.isFinite(receipt.multiplier);
5407
5546
  }
5408
5547
  __name(isPricedStepReceipt, "isPricedStepReceipt");
5409
- __name3(isPricedStepReceipt, "isPricedStepReceipt");
5548
+ __name4(isPricedStepReceipt, "isPricedStepReceipt");
5410
5549
  function receiptEngine(engine) {
5411
5550
  if (engine === "actions") return "seat";
5412
5551
  if (engine === "credits") return "legacy";
5413
5552
  return void 0;
5414
5553
  }
5415
5554
  __name(receiptEngine, "receiptEngine");
5416
- __name3(receiptEngine, "receiptEngine");
5555
+ __name4(receiptEngine, "receiptEngine");
5417
5556
  function receiptTier(tier) {
5418
5557
  return tier === "light" || tier === "standard" || tier === "heavy" ? tier : void 0;
5419
5558
  }
5420
5559
  __name(receiptTier, "receiptTier");
5421
- __name3(receiptTier, "receiptTier");
5560
+ __name4(receiptTier, "receiptTier");
5422
5561
  function stepBillingView(receipt) {
5423
5562
  const engine = receiptEngine(receipt?.engine);
5424
5563
  if (!receipt || engine === void 0) return void 0;
@@ -5435,7 +5574,7 @@ function stepBillingView(receipt) {
5435
5574
  });
5436
5575
  }
5437
5576
  __name(stepBillingView, "stepBillingView");
5438
- __name3(stepBillingView, "stepBillingView");
5577
+ __name4(stepBillingView, "stepBillingView");
5439
5578
  function runUsage(run, receipts) {
5440
5579
  const actions = n(run.budget?.spent?.actionsEstimate);
5441
5580
  const stamped = run.budget?.engine;
@@ -5459,13 +5598,13 @@ function runUsage(run, receipts) {
5459
5598
  };
5460
5599
  }
5461
5600
  __name(runUsage, "runUsage");
5462
- __name3(runUsage, "runUsage");
5601
+ __name4(runUsage, "runUsage");
5463
5602
  function runBudgetCap(budget) {
5464
5603
  const cap = budget?.maxCredits;
5465
5604
  return typeof cap === "number" && Number.isFinite(cap) && cap > 0 ? cap : void 0;
5466
5605
  }
5467
5606
  __name(runBudgetCap, "runBudgetCap");
5468
- __name3(runBudgetCap, "runBudgetCap");
5607
+ __name4(runBudgetCap, "runBudgetCap");
5469
5608
  function runBudgetRemaining(budget) {
5470
5609
  const cap = runBudgetCap(budget);
5471
5610
  if (cap === void 0) return void 0;
@@ -5473,7 +5612,7 @@ function runBudgetRemaining(budget) {
5473
5612
  return Math.max(0, cap - n(spent?.credits) - n(spent?.actionsEstimate) - n(budget?.reserved));
5474
5613
  }
5475
5614
  __name(runBudgetRemaining, "runBudgetRemaining");
5476
- __name3(runBudgetRemaining, "runBudgetRemaining");
5615
+ __name4(runBudgetRemaining, "runBudgetRemaining");
5477
5616
  function runCancelView(cancel) {
5478
5617
  if (!cancel) return void 0;
5479
5618
  return {
@@ -5499,7 +5638,7 @@ function runCancelView(cancel) {
5499
5638
  };
5500
5639
  }
5501
5640
  __name(runCancelView, "runCancelView");
5502
- __name3(runCancelView, "runCancelView");
5641
+ __name4(runCancelView, "runCancelView");
5503
5642
  function runWorkspaceView(ws) {
5504
5643
  if (!ws) return void 0;
5505
5644
  const w = ws;
@@ -5514,7 +5653,7 @@ function runWorkspaceView(ws) {
5514
5653
  });
5515
5654
  }
5516
5655
  __name(runWorkspaceView, "runWorkspaceView");
5517
- __name3(runWorkspaceView, "runWorkspaceView");
5656
+ __name4(runWorkspaceView, "runWorkspaceView");
5518
5657
  function toWorkflowRunSummary(run) {
5519
5658
  const status = run.status;
5520
5659
  const principal = run.principal?.principal;
@@ -5586,7 +5725,7 @@ function toWorkflowRunSummary(run) {
5586
5725
  });
5587
5726
  }
5588
5727
  __name(toWorkflowRunSummary, "toWorkflowRunSummary");
5589
- __name3(toWorkflowRunSummary, "toWorkflowRunSummary");
5728
+ __name4(toWorkflowRunSummary, "toWorkflowRunSummary");
5590
5729
  var STEP_ERROR_DETAIL_KEYS = [
5591
5730
  "reason",
5592
5731
  "key",
@@ -5615,7 +5754,17 @@ var STEP_ERROR_DETAIL_KEYS = [
5615
5754
  "workflowId",
5616
5755
  // LUA-696 (review 2): the `ctx.once` key of an `effect_in_doubt` park — the step site stamps it here (scrubbed)
5617
5756
  // beside `park.effectKey`; a key is user text and leaves scrubbed like every other string leaf.
5618
- "effectKey"
5757
+ "effectKey",
5758
+ // LUA-833: the Job tier's `job_auth_rejected{reason}` evidence — the pod that exited and its code, the Secret the
5759
+ // row named (a k8s object NAME, `wfs-<hash12>-a<n>`, never a value), the execution the pod was spawned for, the
5760
+ // one its credential was minted for, and whether that credential had expired. The LUA-716 / LUA-748 spawn
5761
+ // refusals name `secretName` too.
5762
+ "podName",
5763
+ "exitCode",
5764
+ "secretName",
5765
+ "executionId",
5766
+ "credentialsExecutionId",
5767
+ "expired"
5619
5768
  ];
5620
5769
  var STEP_ERROR_DETAIL_MAX_BYTES = 8 * 1024;
5621
5770
  var DETAIL_MAX_DEPTH = 4;
@@ -5638,7 +5787,7 @@ function scrubDetailValue(value22, depth) {
5638
5787
  return void 0;
5639
5788
  }
5640
5789
  __name(scrubDetailValue, "scrubDetailValue");
5641
- __name3(scrubDetailValue, "scrubDetailValue");
5790
+ __name4(scrubDetailValue, "scrubDetailValue");
5642
5791
  function stepErrorDetail(error) {
5643
5792
  if (!error || typeof error !== "object") return void 0;
5644
5793
  const d = error.detail;
@@ -5666,7 +5815,7 @@ function stepErrorDetail(error) {
5666
5815
  };
5667
5816
  }
5668
5817
  __name(stepErrorDetail, "stepErrorDetail");
5669
- __name3(stepErrorDetail, "stepErrorDetail");
5818
+ __name4(stepErrorDetail, "stepErrorDetail");
5670
5819
  var MAX_HOLIDAYS = 366;
5671
5820
  var MAX_WALK_DAYS = 400;
5672
5821
  var HHMM = /^([01]\d|2[0-3]):([0-5]\d)$/;
@@ -5702,10 +5851,10 @@ function timeZoneSupported(tz) {
5702
5851
  }
5703
5852
  }
5704
5853
  __name(timeZoneSupported, "timeZoneSupported");
5705
- __name3(timeZoneSupported, "timeZoneSupported");
5854
+ __name4(timeZoneSupported, "timeZoneSupported");
5706
5855
  function validateBusinessHours(cal, path = "businessHours") {
5707
5856
  const issues = [];
5708
- const issue = /* @__PURE__ */ __name3((p, message) => issues.push({
5857
+ const issue = /* @__PURE__ */ __name4((p, message) => issues.push({
5709
5858
  code: "business-hours-invalid",
5710
5859
  path: p,
5711
5860
  message
@@ -5745,24 +5894,24 @@ function validateBusinessHours(cal, path = "businessHours") {
5745
5894
  return issues;
5746
5895
  }
5747
5896
  __name(validateBusinessHours, "validateBusinessHours");
5748
- __name3(validateBusinessHours, "validateBusinessHours");
5897
+ __name4(validateBusinessHours, "validateBusinessHours");
5749
5898
  function toMinutes(hhmm) {
5750
5899
  const m = HHMM.exec(hhmm);
5751
5900
  return Number(m[1]) * 60 + Number(m[2]);
5752
5901
  }
5753
5902
  __name(toMinutes, "toMinutes");
5754
- __name3(toMinutes, "toMinutes");
5903
+ __name4(toMinutes, "toMinutes");
5755
5904
  function resolveCalendar(cal) {
5756
5905
  return cal.calendar === void 0 || cal.calendar === "mon-fri" ? MON_FRI : cal.calendar;
5757
5906
  }
5758
5907
  __name(resolveCalendar, "resolveCalendar");
5759
- __name3(resolveCalendar, "resolveCalendar");
5908
+ __name4(resolveCalendar, "resolveCalendar");
5760
5909
  function assertValid(cal) {
5761
5910
  const issues = validateBusinessHours(cal);
5762
5911
  if (issues.length > 0) throw new RangeError(`business-hours-invalid: ${issues.map((i) => i.path).join(", ")}`);
5763
5912
  }
5764
5913
  __name(assertValid, "assertValid");
5765
- __name3(assertValid, "assertValid");
5914
+ __name4(assertValid, "assertValid");
5766
5915
  var fmtCache = /* @__PURE__ */ new Map();
5767
5916
  function formatter(tz) {
5768
5917
  let f = fmtCache.get(tz);
@@ -5782,7 +5931,7 @@ function formatter(tz) {
5782
5931
  return f;
5783
5932
  }
5784
5933
  __name(formatter, "formatter");
5785
- __name3(formatter, "formatter");
5934
+ __name4(formatter, "formatter");
5786
5935
  var WEEKDAYS = {
5787
5936
  Sun: 0,
5788
5937
  Mon: 1,
@@ -5794,7 +5943,7 @@ var WEEKDAYS = {
5794
5943
  };
5795
5944
  function localParts(ms, tz) {
5796
5945
  const parts = formatter(tz).formatToParts(new Date(ms));
5797
- const get = /* @__PURE__ */ __name3((t) => parts.find((p) => p.type === t)?.value ?? "", "get");
5946
+ const get = /* @__PURE__ */ __name4((t) => parts.find((p) => p.type === t)?.value ?? "", "get");
5798
5947
  const hour = Number(get("hour")) % 24;
5799
5948
  return {
5800
5949
  year: Number(get("year")),
@@ -5806,7 +5955,7 @@ function localParts(ms, tz) {
5806
5955
  };
5807
5956
  }
5808
5957
  __name(localParts, "localParts");
5809
- __name3(localParts, "localParts");
5958
+ __name4(localParts, "localParts");
5810
5959
  function offsetAt(ms, tz) {
5811
5960
  const p = localParts(ms, tz);
5812
5961
  const asUtc = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, 0, 0);
@@ -5814,7 +5963,7 @@ function offsetAt(ms, tz) {
5814
5963
  return asUtc - floored;
5815
5964
  }
5816
5965
  __name(offsetAt, "offsetAt");
5817
- __name3(offsetAt, "offsetAt");
5966
+ __name4(offsetAt, "offsetAt");
5818
5967
  function localToUtc(y, m, d, minutes, tz) {
5819
5968
  const wall = Date.UTC(y, m - 1, d, Math.floor(minutes / 60), minutes % 60, 0, 0);
5820
5969
  const guess = wall - offsetAt(wall, tz);
@@ -5836,18 +5985,18 @@ function localToUtc(y, m, d, minutes, tz) {
5836
5985
  return probe;
5837
5986
  }
5838
5987
  __name(localToUtc, "localToUtc");
5839
- __name3(localToUtc, "localToUtc");
5988
+ __name4(localToUtc, "localToUtc");
5840
5989
  function sameWall(ms, y, m, d, minutes, tz) {
5841
5990
  const p = localParts(ms, tz);
5842
5991
  return p.year === y && p.month === m && p.day === d && p.hour * 60 + p.minute === minutes;
5843
5992
  }
5844
5993
  __name(sameWall, "sameWall");
5845
- __name3(sameWall, "sameWall");
5994
+ __name4(sameWall, "sameWall");
5846
5995
  function ymd(p) {
5847
5996
  return `${p.year}-${String(p.month).padStart(2, "0")}-${String(p.day).padStart(2, "0")}`;
5848
5997
  }
5849
5998
  __name(ymd, "ymd");
5850
- __name3(ymd, "ymd");
5999
+ __name4(ymd, "ymd");
5851
6000
  function windowOf(ms, tz, k, holidays) {
5852
6001
  const p = localParts(ms, tz);
5853
6002
  if (!k.days.includes(p.weekday) || holidays.has(ymd(p))) return null;
@@ -5857,14 +6006,14 @@ function windowOf(ms, tz, k, holidays) {
5857
6006
  };
5858
6007
  }
5859
6008
  __name(windowOf, "windowOf");
5860
- __name3(windowOf, "windowOf");
6009
+ __name4(windowOf, "windowOf");
5861
6010
  function nextDayAnchor(ms, tz) {
5862
6011
  const p = localParts(ms, tz);
5863
6012
  const next = new Date(Date.UTC(p.year, p.month - 1, p.day) + MS_PER_DAY);
5864
6013
  return localToUtc(next.getUTCFullYear(), next.getUTCMonth() + 1, next.getUTCDate(), 0, tz);
5865
6014
  }
5866
6015
  __name(nextDayAnchor, "nextDayAnchor");
5867
- __name3(nextDayAnchor, "nextDayAnchor");
6016
+ __name4(nextDayAnchor, "nextDayAnchor");
5868
6017
  function addBusinessTime(fromMs, hours, cal) {
5869
6018
  assertValid(cal);
5870
6019
  if (!Number.isFinite(fromMs) || !Number.isFinite(hours)) throw new RangeError("addBusinessTime: non-finite input");
@@ -5885,7 +6034,7 @@ function addBusinessTime(fromMs, hours, cal) {
5885
6034
  throw new RangeError("addBusinessTime: walk exceeded the calendar bound");
5886
6035
  }
5887
6036
  __name(addBusinessTime, "addBusinessTime");
5888
- __name3(addBusinessTime, "addBusinessTime");
6037
+ __name4(addBusinessTime, "addBusinessTime");
5889
6038
  function roundToBusinessTime(atMs, cal, round = "next-open") {
5890
6039
  assertValid(cal);
5891
6040
  if (!Number.isFinite(atMs)) throw new RangeError("roundToBusinessTime: non-finite input");
@@ -5903,7 +6052,7 @@ function roundToBusinessTime(atMs, cal, round = "next-open") {
5903
6052
  throw new RangeError("roundToBusinessTime: walk exceeded the calendar bound");
5904
6053
  }
5905
6054
  __name(roundToBusinessTime, "roundToBusinessTime");
5906
- __name3(roundToBusinessTime, "roundToBusinessTime");
6055
+ __name4(roundToBusinessTime, "roundToBusinessTime");
5907
6056
  function isBusinessTime(atMs, cal) {
5908
6057
  assertValid(cal);
5909
6058
  const k = resolveCalendar(cal);
@@ -5911,7 +6060,7 @@ function isBusinessTime(atMs, cal) {
5911
6060
  return !!w && atMs >= w.open && atMs < w.close;
5912
6061
  }
5913
6062
  __name(isBusinessTime, "isBusinessTime");
5914
- __name3(isBusinessTime, "isBusinessTime");
6063
+ __name4(isBusinessTime, "isBusinessTime");
5915
6064
  var JSON_PATCH_OPS = [
5916
6065
  "replace",
5917
6066
  "add",
@@ -5945,12 +6094,12 @@ function parseEditablePath(entry) {
5945
6094
  return out;
5946
6095
  }
5947
6096
  __name(parseEditablePath, "parseEditablePath");
5948
- __name3(parseEditablePath, "parseEditablePath");
6097
+ __name4(parseEditablePath, "parseEditablePath");
5949
6098
  function isEditablePathEntry(entry) {
5950
6099
  return typeof entry === "string" && parseEditablePath(entry) !== null;
5951
6100
  }
5952
6101
  __name(isEditablePathEntry, "isEditablePathEntry");
5953
- __name3(isEditablePathEntry, "isEditablePathEntry");
6102
+ __name4(isEditablePathEntry, "isEditablePathEntry");
5954
6103
  function pointerToSegments(pointer) {
5955
6104
  if (typeof pointer !== "string" || pointer.length === 0 || pointer[0] !== "/") return null;
5956
6105
  const decoded = pointer.slice(1).split("/").map((s) => s.replace(/~1/g, "/").replace(/~0/g, "~"));
@@ -5958,7 +6107,7 @@ function pointerToSegments(pointer) {
5958
6107
  return decoded.map((s) => s === "-" ? "-" : /^(0|[1-9]\d*)$/.test(s) ? Number(s) : s);
5959
6108
  }
5960
6109
  __name(pointerToSegments, "pointerToSegments");
5961
- __name3(pointerToSegments, "pointerToSegments");
6110
+ __name4(pointerToSegments, "pointerToSegments");
5962
6111
  function pointerToDotPath(pointer) {
5963
6112
  const segs = pointerToSegments(pointer);
5964
6113
  if (!segs) return pointer;
@@ -5971,7 +6120,7 @@ function pointerToDotPath(pointer) {
5971
6120
  return out;
5972
6121
  }
5973
6122
  __name(pointerToDotPath, "pointerToDotPath");
5974
- __name3(pointerToDotPath, "pointerToDotPath");
6123
+ __name4(pointerToDotPath, "pointerToDotPath");
5975
6124
  function coveredBy(segs, entry, op) {
5976
6125
  if (segs.length < entry.length) return false;
5977
6126
  for (let i = 0; i < entry.length; i += 1) {
@@ -5991,7 +6140,7 @@ function coveredBy(segs, entry, op) {
5991
6140
  return true;
5992
6141
  }
5993
6142
  __name(coveredBy, "coveredBy");
5994
- __name3(coveredBy, "coveredBy");
6143
+ __name4(coveredBy, "coveredBy");
5995
6144
  function matchesEditablePath(pointer, editablePaths, op = "replace") {
5996
6145
  const segs = pointerToSegments(pointer);
5997
6146
  if (!segs || segs.length === 0) return false;
@@ -6002,10 +6151,10 @@ function matchesEditablePath(pointer, editablePaths, op = "replace") {
6002
6151
  return false;
6003
6152
  }
6004
6153
  __name(matchesEditablePath, "matchesEditablePath");
6005
- __name3(matchesEditablePath, "matchesEditablePath");
6154
+ __name4(matchesEditablePath, "matchesEditablePath");
6006
6155
  function changedPointers(before, after, base = "") {
6007
6156
  if (before === after) return [];
6008
- const isObj = /* @__PURE__ */ __name3((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isObj");
6157
+ const isObj = /* @__PURE__ */ __name4((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isObj");
6009
6158
  if (Array.isArray(before) && Array.isArray(after)) {
6010
6159
  if (before.length !== after.length) return [
6011
6160
  base || "/"
@@ -6038,12 +6187,12 @@ function changedPointers(before, after, base = "") {
6038
6187
  ];
6039
6188
  }
6040
6189
  __name(changedPointers, "changedPointers");
6041
- __name3(changedPointers, "changedPointers");
6190
+ __name4(changedPointers, "changedPointers");
6042
6191
  function escapePointer(key) {
6043
6192
  return key.replace(/~/g, "~0").replace(/\//g, "~1");
6044
6193
  }
6045
6194
  __name(escapePointer, "escapePointer");
6046
- __name3(escapePointer, "escapePointer");
6195
+ __name4(escapePointer, "escapePointer");
6047
6196
  function validateJsonPatch(ops) {
6048
6197
  if (!Array.isArray(ops)) return {
6049
6198
  ok: false,
@@ -6113,7 +6262,7 @@ function validateJsonPatch(ops) {
6113
6262
  };
6114
6263
  }
6115
6264
  __name(validateJsonPatch, "validateJsonPatch");
6116
- __name3(validateJsonPatch, "validateJsonPatch");
6265
+ __name4(validateJsonPatch, "validateJsonPatch");
6117
6266
  function applyJsonPatch(doc, ops) {
6118
6267
  let value22 = structuredClone(doc);
6119
6268
  for (let i = 0; i < ops.length; i += 1) {
@@ -6214,21 +6363,85 @@ function applyJsonPatch(doc, ops) {
6214
6363
  };
6215
6364
  }
6216
6365
  __name(applyJsonPatch, "applyJsonPatch");
6217
- __name3(applyJsonPatch, "applyJsonPatch");
6366
+ __name4(applyJsonPatch, "applyJsonPatch");
6218
6367
  function rebaseItemPointer(pointer, itemsPath, index) {
6219
6368
  const base = `/${itemsPath.split(".").map(escapePointer).join("/")}/${index}`;
6220
6369
  return pointer === "/" || pointer === "" ? base : `${base}${pointer}`;
6221
6370
  }
6222
6371
  __name(rebaseItemPointer, "rebaseItemPointer");
6223
- __name3(rebaseItemPointer, "rebaseItemPointer");
6372
+ __name4(rebaseItemPointer, "rebaseItemPointer");
6373
+ var WORKFLOW_SCHEDULE_TYPES = [
6374
+ "cron",
6375
+ "interval",
6376
+ "once"
6377
+ ];
6378
+ var WORKFLOW_SCHEDULE_SHAPE_ISSUE = "schedule-shape-invalid";
6379
+ var WORKFLOW_SCHEDULE_SHAPES_HINT = "`schedule` must be one of { type: 'cron', expression: '<5-field cron>', timezone?: '<IANA tz>' } | { type: 'interval', seconds: <n> } | { type: 'once', executeAt: '<ISO-8601>' }";
6380
+ var WORKFLOW_SCHEDULE_RUN_AS = [
6381
+ "installer",
6382
+ "system"
6383
+ ];
6384
+ var isObject = /* @__PURE__ */ __name4((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isObject");
6385
+ function validateWorkflowSchedule(schedule, path = "/schedule") {
6386
+ if (schedule === void 0 || schedule === null) return [];
6387
+ const issue = /* @__PURE__ */ __name4((at, detail) => [
6388
+ {
6389
+ code: WORKFLOW_SCHEDULE_SHAPE_ISSUE,
6390
+ severity: "error",
6391
+ path: at,
6392
+ message: `${detail} \u2014 ${WORKFLOW_SCHEDULE_SHAPES_HINT}`
6393
+ }
6394
+ ], "issue");
6395
+ if (!isObject(schedule)) {
6396
+ return issue(path, `\`schedule\` is ${Array.isArray(schedule) ? "an array" : `a ${typeof schedule}`}, not a typed schedule object`);
6397
+ }
6398
+ const type = schedule.type;
6399
+ if (type === void 0) {
6400
+ const keys = Object.keys(schedule);
6401
+ const seen = keys.length ? ` (got { ${keys.join(", ")} })` : " (got {})";
6402
+ return issue(path, `\`schedule\` carries no \`type\` discriminator${seen}`);
6403
+ }
6404
+ if (typeof type !== "string" || !WORKFLOW_SCHEDULE_TYPES.includes(type)) {
6405
+ return issue(path, `\`schedule.type\` ${JSON.stringify(type)} is not one of ${WORKFLOW_SCHEDULE_TYPES.map((t) => `'${t}'`).join(" | ")}`);
6406
+ }
6407
+ if (schedule.runAs !== void 0 && !WORKFLOW_SCHEDULE_RUN_AS.includes(schedule.runAs)) {
6408
+ return issue(`${path}/runAs`, `\`schedule.runAs\` ${JSON.stringify(schedule.runAs)} is not one of ${WORKFLOW_SCHEDULE_RUN_AS.map((v) => `'${v}'`).join(" | ")}`);
6409
+ }
6410
+ switch (type) {
6411
+ case "cron": {
6412
+ if (typeof schedule.expression !== "string" || schedule.expression.trim().length === 0) {
6413
+ return issue(`${path}/expression`, "a { type: 'cron' } schedule needs a non-empty string `expression`");
6414
+ }
6415
+ if (schedule.timezone !== void 0 && (typeof schedule.timezone !== "string" || schedule.timezone.length === 0)) {
6416
+ return issue(`${path}/timezone`, "a { type: 'cron' } schedule's `timezone`, when given, is a non-empty IANA string");
6417
+ }
6418
+ return [];
6419
+ }
6420
+ case "interval": {
6421
+ const s = schedule.seconds;
6422
+ if (typeof s !== "number" || !Number.isFinite(s) || s <= 0) {
6423
+ return issue(`${path}/seconds`, "a { type: 'interval' } schedule needs a positive number `seconds`");
6424
+ }
6425
+ return [];
6426
+ }
6427
+ case "once": {
6428
+ if (typeof schedule.executeAt !== "string" || Number.isNaN(Date.parse(schedule.executeAt))) {
6429
+ return issue(`${path}/executeAt`, "a { type: 'once' } schedule needs an ISO-8601 string `executeAt`");
6430
+ }
6431
+ return [];
6432
+ }
6433
+ }
6434
+ }
6435
+ __name(validateWorkflowSchedule, "validateWorkflowSchedule");
6436
+ __name4(validateWorkflowSchedule, "validateWorkflowSchedule");
6224
6437
  var WORKFLOW_ENV_OVERLAY_MAX_KEYS = 64;
6225
6438
  var WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES = 4096;
6226
6439
  var WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE = /(SECRET|TOKEN|KEY|PASSWORD)$/;
6227
- var isEnvRef = /* @__PURE__ */ __name3((v) => typeof v === "object" && v !== null && !Array.isArray(v) && typeof v.__envRef === "string" && Object.keys(v).length === 1, "isEnvRef");
6228
- var looksLikeEmbeddedJson = /* @__PURE__ */ __name3((s) => s.length > 1 && s[0] === "{" && s.includes("__envRef"), "looksLikeEmbeddedJson");
6440
+ var isEnvRef = /* @__PURE__ */ __name4((v) => typeof v === "object" && v !== null && !Array.isArray(v) && typeof v.__envRef === "string" && Object.keys(v).length === 1, "isEnvRef");
6441
+ var looksLikeEmbeddedJson = /* @__PURE__ */ __name4((s) => s.length > 1 && s[0] === "{" && s.includes("__envRef"), "looksLikeEmbeddedJson");
6229
6442
  function collectEnvTemplateKeys(value22) {
6230
6443
  const keys = /* @__PURE__ */ new Set();
6231
- const walk2 = /* @__PURE__ */ __name3((v) => {
6444
+ const walk2 = /* @__PURE__ */ __name4((v) => {
6232
6445
  if (isEnvRef(v)) {
6233
6446
  keys.add(v.__envRef);
6234
6447
  return;
@@ -6254,10 +6467,10 @@ function collectEnvTemplateKeys(value22) {
6254
6467
  ].sort();
6255
6468
  }
6256
6469
  __name(collectEnvTemplateKeys, "collectEnvTemplateKeys");
6257
- __name3(collectEnvTemplateKeys, "collectEnvTemplateKeys");
6470
+ __name4(collectEnvTemplateKeys, "collectEnvTemplateKeys");
6258
6471
  function substituteEnvRefs(value22, overlay) {
6259
6472
  const missing = /* @__PURE__ */ new Set();
6260
- const walk2 = /* @__PURE__ */ __name3((v, slot = false) => {
6473
+ const walk2 = /* @__PURE__ */ __name4((v, slot = false) => {
6261
6474
  if (isEnvRef(v)) {
6262
6475
  if (Object.prototype.hasOwnProperty.call(overlay, v.__envRef)) {
6263
6476
  const s = overlay[v.__envRef];
@@ -6296,13 +6509,13 @@ function substituteEnvRefs(value22, overlay) {
6296
6509
  };
6297
6510
  }
6298
6511
  __name(substituteEnvRefs, "substituteEnvRefs");
6299
- __name3(substituteEnvRefs, "substituteEnvRefs");
6512
+ __name4(substituteEnvRefs, "substituteEnvRefs");
6300
6513
  function hashEnvOverlay(overlay) {
6301
6514
  if (overlay === void 0 || overlay === null) return void 0;
6302
6515
  return GRAPH_HASH_PREFIX + createHash2("sha256").update(canonicalJson(overlay)).digest("hex");
6303
6516
  }
6304
6517
  __name(hashEnvOverlay, "hashEnvOverlay");
6305
- __name3(hashEnvOverlay, "hashEnvOverlay");
6518
+ __name4(hashEnvOverlay, "hashEnvOverlay");
6306
6519
  function validateEnvOverlay(keys, overlay, limits = {}) {
6307
6520
  const maxKeys = limits.maxKeys ?? WORKFLOW_ENV_OVERLAY_MAX_KEYS;
6308
6521
  const maxValueBytes = limits.maxValueBytes ?? WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES;
@@ -6341,7 +6554,7 @@ function validateEnvOverlay(keys, overlay, limits = {}) {
6341
6554
  return issues;
6342
6555
  }
6343
6556
  __name(validateEnvOverlay, "validateEnvOverlay");
6344
- __name3(validateEnvOverlay, "validateEnvOverlay");
6557
+ __name4(validateEnvOverlay, "validateEnvOverlay");
6345
6558
  var ZERO = {
6346
6559
  steps: {
6347
6560
  min: 0,
@@ -6367,7 +6580,7 @@ function add(a, b) {
6367
6580
  };
6368
6581
  }
6369
6582
  __name(add, "add");
6370
- __name3(add, "add");
6583
+ __name4(add, "add");
6371
6584
  function scale(r, lo, hi) {
6372
6585
  return {
6373
6586
  steps: {
@@ -6382,12 +6595,12 @@ function scale(r, lo, hi) {
6382
6595
  };
6383
6596
  }
6384
6597
  __name(scale, "scale");
6385
- __name3(scale, "scale");
6598
+ __name4(scale, "scale");
6386
6599
  function armEntry(arm) {
6387
6600
  return Array.isArray(arm) ? arm[arm.length - 1] : arm;
6388
6601
  }
6389
6602
  __name(armEntry, "armEntry");
6390
- __name3(armEntry, "armEntry");
6603
+ __name4(armEntry, "armEntry");
6391
6604
  function ofEntry(e) {
6392
6605
  if (!e || typeof e !== "object") return ZERO;
6393
6606
  const n2 = e;
@@ -6476,7 +6689,7 @@ function ofEntry(e) {
6476
6689
  }
6477
6690
  }
6478
6691
  __name(ofEntry, "ofEntry");
6479
- __name3(ofEntry, "ofEntry");
6692
+ __name4(ofEntry, "ofEntry");
6480
6693
  function estimateGraph(envelopeOrGraph) {
6481
6694
  const graph = Array.isArray(envelopeOrGraph) ? envelopeOrGraph : envelopeOrGraph?.definition?.graph ?? [];
6482
6695
  const r = graph.map(ofEntry).reduce(add, ZERO);
@@ -6492,8 +6705,8 @@ function estimateGraph(envelopeOrGraph) {
6492
6705
  };
6493
6706
  }
6494
6707
  __name(estimateGraph, "estimateGraph");
6495
- __name3(estimateGraph, "estimateGraph");
6496
- var isRecord2 = /* @__PURE__ */ __name3((v) => !!v && typeof v === "object" && !Array.isArray(v), "isRecord");
6708
+ __name4(estimateGraph, "estimateGraph");
6709
+ var isRecord2 = /* @__PURE__ */ __name4((v) => !!v && typeof v === "object" && !Array.isArray(v), "isRecord");
6497
6710
  function* singleStepsOf(entry) {
6498
6711
  if (!isRecord2(entry)) return;
6499
6712
  switch (entry.type) {
@@ -6519,14 +6732,14 @@ function* singleStepsOf(entry) {
6519
6732
  }
6520
6733
  }
6521
6734
  __name(singleStepsOf, "singleStepsOf");
6522
- __name3(singleStepsOf, "singleStepsOf");
6735
+ __name4(singleStepsOf, "singleStepsOf");
6523
6736
  function entriesOf(graph) {
6524
6737
  const definition = isRecord2(graph) ? graph.definition : void 0;
6525
6738
  const entries = isRecord2(definition) ? definition.graph : void 0;
6526
6739
  return Array.isArray(entries) ? entries : [];
6527
6740
  }
6528
6741
  __name(entriesOf, "entriesOf");
6529
- __name3(entriesOf, "entriesOf");
6742
+ __name4(entriesOf, "entriesOf");
6530
6743
  function inheritTargets(graphs) {
6531
6744
  const targets = /* @__PURE__ */ new Set();
6532
6745
  for (const graph of graphs) {
@@ -6541,7 +6754,7 @@ function inheritTargets(graphs) {
6541
6754
  return targets;
6542
6755
  }
6543
6756
  __name(inheritTargets, "inheritTargets");
6544
- __name3(inheritTargets, "inheritTargets");
6757
+ __name4(inheritTargets, "inheritTargets");
6545
6758
  function needsInheritedWorkspace(graph) {
6546
6759
  if (!isRecord2(graph) || graph.workspace !== void 0) return false;
6547
6760
  for (const entry of entriesOf(graph)) {
@@ -6552,7 +6765,7 @@ function needsInheritedWorkspace(graph) {
6552
6765
  return false;
6553
6766
  }
6554
6767
  __name(needsInheritedWorkspace, "needsInheritedWorkspace");
6555
- __name3(needsInheritedWorkspace, "needsInheritedWorkspace");
6768
+ __name4(needsInheritedWorkspace, "needsInheritedWorkspace");
6556
6769
 
6557
6770
  // src/types/workflow.ts
6558
6771
  function createStep(s) {
@@ -6694,6 +6907,7 @@ var envRefKeys = /* @__PURE__ */ __name((v, into) => {
6694
6907
  }
6695
6908
  for (const inner of Object.values(v)) envRefKeys(inner, into);
6696
6909
  }, "envRefKeys");
6910
+ var foreachItemsNotLowered = /* @__PURE__ */ __name((what) => new LuaWorkflowBuildError("invalid-envelope", `foreach.items takes fromInit(path) / fromStep(step, path) or an initData.* / stepResults.* ref \u2014 ${what} is not a foreach source; .map({ '': \u2026 }, { id }) before the foreach instead`), "foreachItemsNotLowered");
6697
6911
  var refToDescriptor = /* @__PURE__ */ __name((items) => {
6698
6912
  if (!items) throw new LuaWorkflowBuildError("invalid-envelope", "foreach.items needs a ref");
6699
6913
  if ("initData" in items && items.initData === true) {
@@ -6703,11 +6917,14 @@ var refToDescriptor = /* @__PURE__ */ __name((items) => {
6703
6917
  };
6704
6918
  }
6705
6919
  if ("step" in items && typeof items.step === "string" && !("path" in items && items.path.startsWith("stepResults"))) {
6920
+ if ("rows" in items) throw foreachItemsNotLowered("rows(\u2026) (a paged dataset)");
6706
6921
  return {
6707
6922
  step: items.step,
6708
6923
  path: items.path
6709
6924
  };
6710
6925
  }
6926
+ if ("step" in items && Array.isArray(items.step)) throw foreachItemsNotLowered("a fan-in fromStep([\u2026])");
6927
+ if (typeof items.path !== "string") throw foreachItemsNotLowered("value(\u2026) / template(\u2026) / fromRequest(\u2026) / fromKnowledge(\u2026)");
6711
6928
  const path = items.path;
6712
6929
  if (path.startsWith("initData")) return {
6713
6930
  initData: true,
@@ -7257,9 +7474,12 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
7257
7474
  if (opts.approver === "creator" && opts.excludeInitiator === true) {
7258
7475
  throw new LuaWorkflowBuildError("approver-excludes-only-candidate", `"${id}": approver:'creator' with excludeInitiator:true always excludes the only candidate`);
7259
7476
  }
7260
- if (opts.fourEyes !== void 0 && opts.editable !== true) throw new LuaWorkflowBuildError("four-eyes-requires-editable", `"${id}": fourEyes requires editable:true`);
7261
- if ((opts.editablePaths !== void 0 || opts.editedPayloadSchema !== void 0) && opts.editable !== true) {
7262
- throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": editablePaths / editedPayloadSchema require editable:true`);
7477
+ const editable = approvalEditable(opts);
7478
+ if (opts.fourEyes !== void 0 && !editable) throw new LuaWorkflowBuildError("four-eyes-requires-editable", `"${id}": \`fourEyes\` requires editable:true`);
7479
+ if (opts.editable === false && Array.isArray(opts.editablePaths) && opts.editablePaths.length > 0) {
7480
+ throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": \`editablePaths\` beside editable:false is contradictory \u2014 drop the paths or set editable:true`);
7481
+ } else if ((opts.editablePaths !== void 0 || opts.editedPayloadSchema !== void 0) && !editable) {
7482
+ throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": \`editablePaths\` / \`editedPayloadSchema\` require editable:true (a non-empty editablePaths implies it)`);
7263
7483
  }
7264
7484
  for (const p of opts.editablePaths ?? []) {
7265
7485
  if (!EDITABLE_PATH_RE2.test(p)) throw new LuaWorkflowBuildError("editable-path-invalid", `"${id}": editablePaths entry "${p}" is outside the grammar seg(.seg)* with [*]/[n] selectors`);