lua-cli 3.32.6 → 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.
@@ -1213,6 +1213,10 @@ function triggerUrlEnvKey(triggerKey) {
1213
1213
  }
1214
1214
  __name(triggerUrlEnvKey, "triggerUrlEnvKey");
1215
1215
  __name2(triggerUrlEnvKey, "triggerUrlEnvKey");
1216
+ var TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES = Object.freeze([
1217
+ "single",
1218
+ "multiple"
1219
+ ]);
1216
1220
  var SUBJECT_TYPES = [
1217
1221
  "user",
1218
1222
  "apiKey",
@@ -1725,6 +1729,15 @@ var WORKFLOW_RUN_STATUSES = [
1725
1729
  ...WORKFLOW_RUN_IDLE,
1726
1730
  ...WORKFLOW_RUN_TERMINAL
1727
1731
  ];
1732
+ var WORKFLOW_RUN_GATE_KINDS = [
1733
+ "start-consent",
1734
+ "quota",
1735
+ "billing",
1736
+ "org_archived",
1737
+ "disabled",
1738
+ "exception",
1739
+ "budget"
1740
+ ];
1728
1741
  var WORKFLOW_STEP_STATUSES = [
1729
1742
  "pending",
1730
1743
  "ready",
@@ -1746,6 +1759,16 @@ var WORKFLOW_STEP_IN_FLIGHT = [
1746
1759
  "running",
1747
1760
  "cancellation_requested"
1748
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");
1749
1772
  var ARCHIVE_WINDOW_MARGIN_DAYS = 7;
1750
1773
  function shouldSkipArchive(run, manifestSha256, sinkSha256) {
1751
1774
  if (!run.completedAt || !run.exportedAt || run.exportedAt < run.completedAt) return false;
@@ -1858,6 +1881,16 @@ function scheduledWorkflowRunIdForTime(jobId, scheduledTime) {
1858
1881
  }
1859
1882
  __name(scheduledWorkflowRunIdForTime, "scheduledWorkflowRunIdForTime");
1860
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
+ ];
1861
1894
  var WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES = 64 * 1024;
1862
1895
  var WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES = 256 * 1024;
1863
1896
  var WORKFLOW_RETRY_BACKOFFS = [
@@ -2049,6 +2082,30 @@ var WORKFLOW_BUDGET_MAX_DURATION_SECONDS = Object.freeze({
2049
2082
  min: 60,
2050
2083
  max: 2592e3
2051
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");
2052
2109
  var REDACTED_PLACEHOLDER = "[REDACTED]";
2053
2110
  var PROVIDER_MESSAGE_MAX_CHARS = 300;
2054
2111
  var ERROR_MESSAGE_MAX_CHARS = 2e3;
@@ -2612,21 +2669,31 @@ function resolveEffectiveFeature(row, catalogDefault) {
2612
2669
  }
2613
2670
  __name(resolveEffectiveFeature, "resolveEffectiveFeature");
2614
2671
  __name2(resolveEffectiveFeature, "resolveEffectiveFeature");
2615
- function isFeatureRow(value3) {
2616
- 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;
2617
2677
  }
2618
- __name(isFeatureRow, "isFeatureRow");
2619
- __name2(isFeatureRow, "isFeatureRow");
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;
2682
+ }
2683
+ __name(agentFeatureBagCarries, "agentFeatureBagCarries");
2684
+ __name2(agentFeatureBagCarries, "agentFeatureBagCarries");
2620
2685
  function effectiveAgentFeatureRows(base, override) {
2621
2686
  const merged = /* @__PURE__ */ new Map();
2622
- for (const [name, row] of Object.entries(base ?? {})) {
2623
- 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, {
2624
2690
  row,
2625
2691
  origin: "baseAgent"
2626
2692
  });
2627
2693
  }
2628
- for (const [name, row] of Object.entries(override ?? {})) {
2629
- 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, {
2630
2697
  row,
2631
2698
  origin: "subAgent"
2632
2699
  });
@@ -2648,20 +2715,83 @@ function effectiveAgentFeatureRows(base, override) {
2648
2715
  }
2649
2716
  __name(effectiveAgentFeatureRows, "effectiveAgentFeatureRows");
2650
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");
2651
2737
 
2652
2738
  // ../workflow-graph/dist/index.mjs
2653
2739
  import { createHash } from "crypto";
2654
2740
  import { z as z4 } from "zod";
2655
2741
  import { z as z22 } from "zod";
2656
- import { createHash as createHash2 } from "crypto";
2742
+
2743
+ // ../shared-types/dist/workflow-job-tools.mjs
2657
2744
  var __defProp3 = Object.defineProperty;
2658
- 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");
2659
2789
  var WorkflowTemplateError = class extends Error {
2660
2790
  static {
2661
2791
  __name(this, "WorkflowTemplateError");
2662
2792
  }
2663
2793
  static {
2664
- __name3(this, "WorkflowTemplateError");
2794
+ __name4(this, "WorkflowTemplateError");
2665
2795
  }
2666
2796
  placeholder;
2667
2797
  constructor(message, placeholder) {
@@ -2673,7 +2803,7 @@ function isMapConfigObject(v) {
2673
2803
  return typeof v === "object" && v !== null && !Array.isArray(v);
2674
2804
  }
2675
2805
  __name(isMapConfigObject, "isMapConfigObject");
2676
- __name3(isMapConfigObject, "isMapConfigObject");
2806
+ __name4(isMapConfigObject, "isMapConfigObject");
2677
2807
  function parseMapConfig(raw, stepId) {
2678
2808
  if (isMapConfigObject(raw)) return raw;
2679
2809
  if (typeof raw !== "string") {
@@ -2686,14 +2816,14 @@ function parseMapConfig(raw, stepId) {
2686
2816
  }
2687
2817
  }
2688
2818
  __name(parseMapConfig, "parseMapConfig");
2689
- __name3(parseMapConfig, "parseMapConfig");
2819
+ __name4(parseMapConfig, "parseMapConfig");
2690
2820
  function mapConfigWire(raw) {
2691
2821
  if (typeof raw === "string") return raw;
2692
2822
  if (isMapConfigObject(raw)) return canonicalJson(raw);
2693
2823
  return void 0;
2694
2824
  }
2695
2825
  __name(mapConfigWire, "mapConfigWire");
2696
- __name3(mapConfigWire, "mapConfigWire");
2826
+ __name4(mapConfigWire, "mapConfigWire");
2697
2827
  var TEMPLATE_PLACEHOLDER = /\$\{([^}]*)\}/g;
2698
2828
  var TEMPLATE_NAMESPACES = [
2699
2829
  "initData",
@@ -2705,7 +2835,7 @@ function describeBadPlaceholder(template22, idx, rawExpr) {
2705
2835
  return `Template placeholder #${idx} (\${${rawExpr}}) in '${template22}'`;
2706
2836
  }
2707
2837
  __name(describeBadPlaceholder, "describeBadPlaceholder");
2708
- __name3(describeBadPlaceholder, "describeBadPlaceholder");
2838
+ __name4(describeBadPlaceholder, "describeBadPlaceholder");
2709
2839
  function parseTemplatePlaceholder(rawExpr) {
2710
2840
  const dot = rawExpr.indexOf(".");
2711
2841
  return {
@@ -2714,7 +2844,7 @@ function parseTemplatePlaceholder(rawExpr) {
2714
2844
  };
2715
2845
  }
2716
2846
  __name(parseTemplatePlaceholder, "parseTemplatePlaceholder");
2717
- __name3(parseTemplatePlaceholder, "parseTemplatePlaceholder");
2847
+ __name4(parseTemplatePlaceholder, "parseTemplatePlaceholder");
2718
2848
  function traverseMappingPath(root, path, errorLabel) {
2719
2849
  if (path === "" || path === ".") return root;
2720
2850
  const parts = path.split(".");
@@ -2726,7 +2856,7 @@ function traverseMappingPath(root, path, errorLabel) {
2726
2856
  return value22;
2727
2857
  }
2728
2858
  __name(traverseMappingPath, "traverseMappingPath");
2729
- __name3(traverseMappingPath, "traverseMappingPath");
2859
+ __name4(traverseMappingPath, "traverseMappingPath");
2730
2860
  function stringifyTemplateValue(v, template22, idx, rawExpr) {
2731
2861
  if (v === null || v === void 0) return "";
2732
2862
  if (typeof v === "object") {
@@ -2739,17 +2869,17 @@ function stringifyTemplateValue(v, template22, idx, rawExpr) {
2739
2869
  return String(v);
2740
2870
  }
2741
2871
  __name(stringifyTemplateValue, "stringifyTemplateValue");
2742
- __name3(stringifyTemplateValue, "stringifyTemplateValue");
2872
+ __name4(stringifyTemplateValue, "stringifyTemplateValue");
2743
2873
  function escapeFence(content) {
2744
2874
  return content.replace(/<\/lua-data/g, "<\\/lua-data");
2745
2875
  }
2746
2876
  __name(escapeFence, "escapeFence");
2747
- __name3(escapeFence, "escapeFence");
2877
+ __name4(escapeFence, "escapeFence");
2748
2878
  function fenceBlock(name, source, content) {
2749
2879
  return `<lua-data name="${name}" source="${source}" untrusted="true">${escapeFence(content)}</lua-data>`;
2750
2880
  }
2751
2881
  __name(fenceBlock, "fenceBlock");
2752
- __name3(fenceBlock, "fenceBlock");
2882
+ __name4(fenceBlock, "fenceBlock");
2753
2883
  function renderTemplate(template22, ctx, opts) {
2754
2884
  let idx = 0;
2755
2885
  return template22.replace(TEMPLATE_PLACEHOLDER, (_match, rawExpr) => {
@@ -2790,12 +2920,12 @@ function renderTemplate(template22, ctx, opts) {
2790
2920
  });
2791
2921
  }
2792
2922
  __name(renderTemplate, "renderTemplate");
2793
- __name3(renderTemplate, "renderTemplate");
2923
+ __name4(renderTemplate, "renderTemplate");
2794
2924
  function isMapDescriptor(v) {
2795
2925
  if (v === null || typeof v !== "object" || Array.isArray(v)) return false;
2796
2926
  const d = v;
2797
2927
  const keys = Object.keys(d);
2798
- 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");
2799
2929
  if ("value" in d) return keys.length === 1;
2800
2930
  if ("template" in d) return keys.length === 1 && typeof d.template === "string";
2801
2931
  if ("requestContextPath" in d) return keys.length === 1 && typeof d.requestContextPath === "string";
@@ -2808,7 +2938,7 @@ function isMapDescriptor(v) {
2808
2938
  return false;
2809
2939
  }
2810
2940
  __name(isMapDescriptor, "isMapDescriptor");
2811
- __name3(isMapDescriptor, "isMapDescriptor");
2941
+ __name4(isMapDescriptor, "isMapDescriptor");
2812
2942
  var MAP_DESCRIPTOR_KEYS = [
2813
2943
  "step",
2814
2944
  "path",
@@ -2833,13 +2963,13 @@ function malformedMapMembers(cfg) {
2833
2963
  return out;
2834
2964
  }
2835
2965
  __name(malformedMapMembers, "malformedMapMembers");
2836
- __name3(malformedMapMembers, "malformedMapMembers");
2966
+ __name4(malformedMapMembers, "malformedMapMembers");
2837
2967
  function mapMemberMalformedMessage(id, m) {
2838
2968
  const keys = m.keys.map((k) => `\`${k}\``).join(", ");
2839
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`;
2840
2970
  }
2841
2971
  __name(mapMemberMalformedMessage, "mapMemberMalformedMessage");
2842
- __name3(mapMemberMalformedMessage, "mapMemberMalformedMessage");
2972
+ __name4(mapMemberMalformedMessage, "mapMemberMalformedMessage");
2843
2973
  function resolveDescriptor(key, m, ctx) {
2844
2974
  if (!isMapDescriptor(m)) return {
2845
2975
  value: m
@@ -2900,7 +3030,7 @@ function resolveDescriptor(key, m, ctx) {
2900
3030
  }
2901
3031
  }
2902
3032
  __name(resolveDescriptor, "resolveDescriptor");
2903
- __name3(resolveDescriptor, "resolveDescriptor");
3033
+ __name4(resolveDescriptor, "resolveDescriptor");
2904
3034
  function resolveMapping(cfg, ctx) {
2905
3035
  const keys = Object.keys(cfg);
2906
3036
  if (keys.length === 1 && keys[0] === "") {
@@ -2917,33 +3047,33 @@ function resolveMapping(cfg, ctx) {
2917
3047
  };
2918
3048
  }
2919
3049
  __name(resolveMapping, "resolveMapping");
2920
- __name3(resolveMapping, "resolveMapping");
2921
- var fromInit = /* @__PURE__ */ __name3((path) => ({
3050
+ __name4(resolveMapping, "resolveMapping");
3051
+ var fromInit = /* @__PURE__ */ __name4((path) => ({
2922
3052
  initData: true,
2923
3053
  path
2924
3054
  }), "fromInit");
2925
- var fromStep = /* @__PURE__ */ __name3((s, path = "") => {
2926
- 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");
2927
3057
  return {
2928
3058
  step: Array.isArray(s) ? s.map(idOf) : idOf(s),
2929
3059
  path
2930
3060
  };
2931
3061
  }, "fromStep");
2932
- var value = /* @__PURE__ */ __name3((v) => ({
3062
+ var value = /* @__PURE__ */ __name4((v) => ({
2933
3063
  value: v
2934
3064
  }), "value");
2935
- var template = /* @__PURE__ */ __name3((s) => ({
3065
+ var template = /* @__PURE__ */ __name4((s) => ({
2936
3066
  template: s
2937
3067
  }), "template");
2938
- var fromRequest = /* @__PURE__ */ __name3((path) => ({
3068
+ var fromRequest = /* @__PURE__ */ __name4((path) => ({
2939
3069
  requestContextPath: path
2940
3070
  }), "fromRequest");
2941
- var rows = /* @__PURE__ */ __name3((s, path, page) => ({
3071
+ var rows = /* @__PURE__ */ __name4((s, path, page) => ({
2942
3072
  step: typeof s === "string" ? s : s.id,
2943
3073
  path,
2944
3074
  rows: page
2945
3075
  }), "rows");
2946
- var fromKnowledge = /* @__PURE__ */ __name3((k) => ({
3076
+ var fromKnowledge = /* @__PURE__ */ __name4((k) => ({
2947
3077
  knowledge: k
2948
3078
  }), "fromKnowledge");
2949
3079
  var SideEffectsSchema = z4.enum(WORKFLOW_SIDE_EFFECTS);
@@ -3029,7 +3159,7 @@ function describeApproverSpecRefusal(spec) {
3029
3159
  };
3030
3160
  }
3031
3161
  __name(describeApproverSpecRefusal, "describeApproverSpecRefusal");
3032
- __name3(describeApproverSpecRefusal, "describeApproverSpecRefusal");
3162
+ __name4(describeApproverSpecRefusal, "describeApproverSpecRefusal");
3033
3163
  var BINDING_ROOTS = [
3034
3164
  "initData",
3035
3165
  "stepResults",
@@ -3043,30 +3173,30 @@ function bindingRootsOk(template22) {
3043
3173
  return refs.length > 0 && refs.every((r) => BINDING_ROOTS.includes(r));
3044
3174
  }
3045
3175
  __name(bindingRootsOk, "bindingRootsOk");
3046
- __name3(bindingRootsOk, "bindingRootsOk");
3176
+ __name4(bindingRootsOk, "bindingRootsOk");
3047
3177
  function isTemplateBinding(v) {
3048
3178
  return typeof v === "object" && v !== null && typeof v.template === "string";
3049
3179
  }
3050
3180
  __name(isTemplateBinding, "isTemplateBinding");
3051
- __name3(isTemplateBinding, "isTemplateBinding");
3181
+ __name4(isTemplateBinding, "isTemplateBinding");
3052
3182
  function approvalEditable(node) {
3053
3183
  if (node.editable === true) return true;
3054
3184
  if (node.editable === false) return false;
3055
3185
  return Array.isArray(node.editablePaths) && node.editablePaths.length > 0;
3056
3186
  }
3057
3187
  __name(approvalEditable, "approvalEditable");
3058
- __name3(approvalEditable, "approvalEditable");
3188
+ __name4(approvalEditable, "approvalEditable");
3059
3189
  function validateApproverBlock(node, opts = {
3060
3190
  path: "approval"
3061
3191
  }) {
3062
3192
  const issues = [];
3063
- const push = /* @__PURE__ */ __name3((code, path, message, severity = "error") => issues.push({
3193
+ const push = /* @__PURE__ */ __name4((code, path, message, severity = "error") => issues.push({
3064
3194
  code,
3065
3195
  path,
3066
3196
  severity,
3067
3197
  message
3068
3198
  }), "push");
3069
- const checkSpec = /* @__PURE__ */ __name3((spec, path) => {
3199
+ const checkSpec = /* @__PURE__ */ __name4((spec, path) => {
3070
3200
  const r = ApproverSpecSchema.safeParse(spec);
3071
3201
  if (!r.success) {
3072
3202
  const users = spec?.users;
@@ -3123,7 +3253,7 @@ function validateApproverBlock(node, opts = {
3123
3253
  return issues;
3124
3254
  }
3125
3255
  __name(validateApproverBlock, "validateApproverBlock");
3126
- __name3(validateApproverBlock, "validateApproverBlock");
3256
+ __name4(validateApproverBlock, "validateApproverBlock");
3127
3257
  function liftRenderedApprover(row, rendered) {
3128
3258
  const text = (rendered ?? "").trim();
3129
3259
  if (!text) return null;
@@ -3152,7 +3282,7 @@ function liftRenderedApprover(row, rendered) {
3152
3282
  };
3153
3283
  }
3154
3284
  __name(liftRenderedApprover, "liftRenderedApprover");
3155
- __name3(liftRenderedApprover, "liftRenderedApprover");
3285
+ __name4(liftRenderedApprover, "liftRenderedApprover");
3156
3286
  var WORKSPACE_TEMPLATE_EXPR_RE = /^\$\{\s*(?:initData|input)\.([^}]+?)\s*\}$/;
3157
3287
  function workspaceTemplatePath(template22) {
3158
3288
  const key = template22.trim();
@@ -3162,7 +3292,7 @@ function workspaceTemplatePath(template22) {
3162
3292
  return key.replace(/^(?:input|initData)\./, "").split(".");
3163
3293
  }
3164
3294
  __name(workspaceTemplatePath, "workspaceTemplatePath");
3165
- __name3(workspaceTemplatePath, "workspaceTemplatePath");
3295
+ __name4(workspaceTemplatePath, "workspaceTemplatePath");
3166
3296
  function retryBackoffs() {
3167
3297
  if (!Array.isArray(WORKFLOW_RETRY_BACKOFFS)) {
3168
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')");
@@ -3170,7 +3300,7 @@ function retryBackoffs() {
3170
3300
  return WORKFLOW_RETRY_BACKOFFS;
3171
3301
  }
3172
3302
  __name(retryBackoffs, "retryBackoffs");
3173
- __name3(retryBackoffs, "retryBackoffs");
3303
+ __name4(retryBackoffs, "retryBackoffs");
3174
3304
  var SLEEP_UNTIL_REPLACEMENT = Object.freeze({
3175
3305
  type: "sleep",
3176
3306
  duration: 6e4
@@ -3179,12 +3309,12 @@ function sleepUntilUnsupportedMessage(id) {
3179
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} }`;
3180
3310
  }
3181
3311
  __name(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
3182
- __name3(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
3312
+ __name4(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
3183
3313
  function armSubrunUnsupportedMessage(id, workflowId) {
3184
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)`;
3185
3315
  }
3186
3316
  __name(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
3187
- __name3(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
3317
+ __name4(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
3188
3318
  var WORKFLOW_CAPS_DEFAULT = Object.freeze({
3189
3319
  maxParallelArms: 16,
3190
3320
  maxForeachConcurrency: 16,
@@ -3209,7 +3339,7 @@ var WORKFLOW_SIGNAL_DEFAULT_SOURCES = [
3209
3339
  "api",
3210
3340
  "user"
3211
3341
  ];
3212
- var clone = /* @__PURE__ */ __name3((v) => JSON.parse(JSON.stringify(v)), "clone");
3342
+ var clone = /* @__PURE__ */ __name4((v) => JSON.parse(JSON.stringify(v)), "clone");
3213
3343
  function fillPolicy(node, defaultTimeout) {
3214
3344
  if (node.tier === void 0 && node.workspace !== void 0 && node.workspace !== "inherit") node.tier = "job";
3215
3345
  if (node.timeoutSeconds === void 0) node.timeoutSeconds = node.tier === "job" ? WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS : defaultTimeout;
@@ -3220,7 +3350,7 @@ function fillPolicy(node, defaultTimeout) {
3220
3350
  if ((node.type === "step" || node.type === "tool") && node.sideEffects === void 0) node.sideEffects = "none";
3221
3351
  }
3222
3352
  __name(fillPolicy, "fillPolicy");
3223
- __name3(fillPolicy, "fillPolicy");
3353
+ __name4(fillPolicy, "fillPolicy");
3224
3354
  function fillSingle(node) {
3225
3355
  switch (node.type) {
3226
3356
  case "step": {
@@ -3241,7 +3371,7 @@ function fillSingle(node) {
3241
3371
  }
3242
3372
  }
3243
3373
  __name(fillSingle, "fillSingle");
3244
- __name3(fillSingle, "fillSingle");
3374
+ __name4(fillSingle, "fillSingle");
3245
3375
  function fillHitl(node) {
3246
3376
  if (node.type === "approval") {
3247
3377
  const a = node;
@@ -3261,14 +3391,14 @@ function fillHitl(node) {
3261
3391
  ];
3262
3392
  }
3263
3393
  __name(fillHitl, "fillHitl");
3264
- __name3(fillHitl, "fillHitl");
3394
+ __name4(fillHitl, "fillHitl");
3265
3395
  function fillArm(arm) {
3266
3396
  if (arm.type === "mapping") return;
3267
3397
  if (isHitlNode(arm)) fillHitl(arm);
3268
3398
  else fillSingle(arm);
3269
3399
  }
3270
3400
  __name(fillArm, "fillArm");
3271
- __name3(fillArm, "fillArm");
3401
+ __name4(fillArm, "fillArm");
3272
3402
  function fillEntry(entry) {
3273
3403
  switch (entry.type) {
3274
3404
  case "step":
@@ -3312,36 +3442,25 @@ function fillEntry(entry) {
3312
3442
  }
3313
3443
  }
3314
3444
  __name(fillEntry, "fillEntry");
3315
- __name3(fillEntry, "fillEntry");
3445
+ __name4(fillEntry, "fillEntry");
3316
3446
  function withDefaultsFilled(g) {
3317
3447
  const out = clone(g);
3318
3448
  out.definition.graph.forEach(fillEntry);
3319
3449
  return out;
3320
3450
  }
3321
3451
  __name(withDefaultsFilled, "withDefaultsFilled");
3322
- __name3(withDefaultsFilled, "withDefaultsFilled");
3452
+ __name4(withDefaultsFilled, "withDefaultsFilled");
3323
3453
  var CONNECTION_ID_HEX_RE = /^[0-9a-f]{24}$/;
3324
3454
  function isConnectionKeyShaped(value22) {
3325
3455
  return WORKFLOW_CONNECTION_KEY_RE.test(value22) && !CONNECTION_ID_HEX_RE.test(value22);
3326
3456
  }
3327
3457
  __name(isConnectionKeyShaped, "isConnectionKeyShaped");
3328
- __name3(isConnectionKeyShaped, "isConnectionKeyShaped");
3458
+ __name4(isConnectionKeyShaped, "isConnectionKeyShaped");
3329
3459
  function connectionKeyUndeclaredMessage(path, key) {
3330
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`;
3331
3461
  }
3332
3462
  __name(connectionKeyUndeclaredMessage, "connectionKeyUndeclaredMessage");
3333
- __name3(connectionKeyUndeclaredMessage, "connectionKeyUndeclaredMessage");
3334
- var WORKFLOW_JOB_TOOLS = [
3335
- "shell",
3336
- "read",
3337
- "write",
3338
- "edit",
3339
- "glob",
3340
- "grep",
3341
- "git",
3342
- "gh",
3343
- "fetch"
3344
- ];
3463
+ __name4(connectionKeyUndeclaredMessage, "connectionKeyUndeclaredMessage");
3345
3464
  var WORKFLOW_JOB_MAX_WORKTREE_ARMS = 8;
3346
3465
  function classifyModelProvider(model) {
3347
3466
  const m = (model ?? "").trim().toLowerCase();
@@ -3352,14 +3471,14 @@ function classifyModelProvider(model) {
3352
3471
  return null;
3353
3472
  }
3354
3473
  __name(classifyModelProvider, "classifyModelProvider");
3355
- __name3(classifyModelProvider, "classifyModelProvider");
3356
- var workspaceOf = /* @__PURE__ */ __name3((node) => node.workspace, "workspaceOf");
3357
- var mountsWorkspace = /* @__PURE__ */ __name3((node) => {
3474
+ __name4(classifyModelProvider, "classifyModelProvider");
3475
+ var workspaceOf = /* @__PURE__ */ __name4((node) => node.workspace, "workspaceOf");
3476
+ var mountsWorkspace = /* @__PURE__ */ __name4((node) => {
3358
3477
  const w = workspaceOf(node);
3359
3478
  return w !== void 0 && w !== "inherit";
3360
3479
  }, "mountsWorkspace");
3361
- var isJobTier = /* @__PURE__ */ __name3((node) => node.tier === "job" || mountsWorkspace(node), "isJobTier");
3362
- var jobToolsOf = /* @__PURE__ */ __name3((node) => {
3480
+ var isJobTier = /* @__PURE__ */ __name4((node) => node.tier === "job" || mountsWorkspace(node), "isJobTier");
3481
+ var jobToolsOf = /* @__PURE__ */ __name4((node) => {
3363
3482
  if (node.type === "agent") return node.toolScope?.jobTools;
3364
3483
  return node.jobTools;
3365
3484
  }, "jobToolsOf");
@@ -3375,17 +3494,17 @@ function schemaAtPath(schema, path) {
3375
3494
  return cur;
3376
3495
  }
3377
3496
  __name(schemaAtPath, "schemaAtPath");
3378
- __name3(schemaAtPath, "schemaAtPath");
3379
- var schemaIsArray = /* @__PURE__ */ __name3((schema) => {
3497
+ __name4(schemaAtPath, "schemaAtPath");
3498
+ var schemaIsArray = /* @__PURE__ */ __name4((schema) => {
3380
3499
  if (!schema) return void 0;
3381
3500
  const t = schema.type;
3382
3501
  if (t === void 0) return void 0;
3383
3502
  return Array.isArray(t) ? t.includes("array") : t === "array";
3384
3503
  }, "schemaIsArray");
3385
- var isHitlNode = /* @__PURE__ */ __name3((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
3386
- var isSingleStep = /* @__PURE__ */ __name3((n2) => !isHitlNode(n2), "isSingleStep");
3387
- var singleId = /* @__PURE__ */ __name3((s) => s.type === "step" ? s.step.id : s.id, "singleId");
3388
- 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");
3389
3508
  var TEMPLATE_STEP_REF = /\$\{\s*stepResults\.([A-Za-z0-9_\-]+)/g;
3390
3509
  function templateStepRefs(text) {
3391
3510
  const ids = [];
@@ -3393,7 +3512,7 @@ function templateStepRefs(text) {
3393
3512
  return ids;
3394
3513
  }
3395
3514
  __name(templateStepRefs, "templateStepRefs");
3396
- __name3(templateStepRefs, "templateStepRefs");
3515
+ __name4(templateStepRefs, "templateStepRefs");
3397
3516
  function readMapConfig(raw) {
3398
3517
  if (!raw) return void 0;
3399
3518
  if (typeof raw !== "string") return raw;
@@ -3405,7 +3524,7 @@ function readMapConfig(raw) {
3405
3524
  }
3406
3525
  }
3407
3526
  __name(readMapConfig, "readMapConfig");
3408
- __name3(readMapConfig, "readMapConfig");
3527
+ __name4(readMapConfig, "readMapConfig");
3409
3528
  function mapConfigStepRefs(raw) {
3410
3529
  const cfg = readMapConfig(raw);
3411
3530
  if (!cfg) return [];
@@ -3420,7 +3539,7 @@ function mapConfigStepRefs(raw) {
3420
3539
  return ids;
3421
3540
  }
3422
3541
  __name(mapConfigStepRefs, "mapConfigStepRefs");
3423
- __name3(mapConfigStepRefs, "mapConfigStepRefs");
3542
+ __name4(mapConfigStepRefs, "mapConfigStepRefs");
3424
3543
  function nodeStepRefs(entry) {
3425
3544
  switch (entry.type) {
3426
3545
  case "agent": {
@@ -3449,12 +3568,12 @@ function nodeStepRefs(entry) {
3449
3568
  }
3450
3569
  }
3451
3570
  __name(nodeStepRefs, "nodeStepRefs");
3452
- __name3(nodeStepRefs, "nodeStepRefs");
3571
+ __name4(nodeStepRefs, "nodeStepRefs");
3453
3572
  function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3454
3573
  static: true
3455
3574
  }) {
3456
3575
  const issues = [];
3457
- const err = /* @__PURE__ */ __name3((code, message, path, stepId) => {
3576
+ const err = /* @__PURE__ */ __name4((code, message, path, stepId) => {
3458
3577
  issues.push({
3459
3578
  code,
3460
3579
  message,
@@ -3463,7 +3582,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3463
3582
  stepId
3464
3583
  });
3465
3584
  }, "err");
3466
- const warn = /* @__PURE__ */ __name3((code, message, path, stepId) => {
3585
+ const warn = /* @__PURE__ */ __name4((code, message, path, stepId) => {
3467
3586
  issues.push({
3468
3587
  code,
3469
3588
  message,
@@ -3520,7 +3639,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3520
3639
  }
3521
3640
  declaredKeys.add(key);
3522
3641
  });
3523
- 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");
3524
3643
  const credentialsRef = envelopeWorkspace?.credentialsRef;
3525
3644
  if (undeclaredKey(credentialsRef)) {
3526
3645
  err("connection-key-undeclared", connectionKeyUndeclaredMessage("workspace.credentialsRef", credentialsRef), "workspace.credentialsRef");
@@ -3528,7 +3647,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3528
3647
  const seen = /* @__PURE__ */ new Map();
3529
3648
  let nodeCount = 0;
3530
3649
  const upstream = /* @__PURE__ */ new Set();
3531
- const checkId = /* @__PURE__ */ __name3((id, path) => {
3650
+ const checkId = /* @__PURE__ */ __name4((id, path) => {
3532
3651
  nodeCount += 1;
3533
3652
  if (seen.has(id)) {
3534
3653
  err("duplicate-step-id", `step id "${id}" is declared twice (first at ${seen.get(id)})`, path, id);
@@ -3536,9 +3655,9 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3536
3655
  seen.set(id, path);
3537
3656
  }
3538
3657
  }, "checkId");
3539
- const checkPolicyEnums = /* @__PURE__ */ __name3((node, path) => {
3658
+ const checkPolicyEnums = /* @__PURE__ */ __name4((node, path) => {
3540
3659
  const id = singleId(node);
3541
- const check = /* @__PURE__ */ __name3((member, allowed) => {
3660
+ const check = /* @__PURE__ */ __name4((member, allowed) => {
3542
3661
  const value22 = node[member];
3543
3662
  if (value22 === void 0 || typeof value22 === "string" && allowed.includes(value22)) return;
3544
3663
  err("invalid-envelope", `\`${member}\` must be ${allowed.map((a) => `'${a}'`).join(" | ")} (got ${JSON.stringify(value22)})`, `${path}.${member}`, id);
@@ -3546,7 +3665,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3546
3665
  check("sideEffects", WORKFLOW_SIDE_EFFECTS);
3547
3666
  check("jobResources", WORKFLOW_JOB_RESOURCES);
3548
3667
  }, "checkPolicyEnums");
3549
- const checkRetry = /* @__PURE__ */ __name3((node, path) => {
3668
+ const checkRetry = /* @__PURE__ */ __name4((node, path) => {
3550
3669
  const r = node.retry;
3551
3670
  if (!r) return;
3552
3671
  const id = singleId(node);
@@ -3572,7 +3691,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3572
3691
  }
3573
3692
  }
3574
3693
  }, "checkRetry");
3575
- const checkTimeout = /* @__PURE__ */ __name3((node, path) => {
3694
+ const checkTimeout = /* @__PURE__ */ __name4((node, path) => {
3576
3695
  const t = node.timeoutSeconds;
3577
3696
  if (t === void 0) return;
3578
3697
  const id = singleId(node);
@@ -3591,7 +3710,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3591
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);
3592
3711
  }
3593
3712
  }, "checkTimeout");
3594
- const checkSpecialistRole = /* @__PURE__ */ __name3((node, path) => {
3713
+ const checkSpecialistRole = /* @__PURE__ */ __name4((node, path) => {
3595
3714
  const role = node.role;
3596
3715
  const hasRef = typeof role.ref === "string";
3597
3716
  const hasInline = role.name !== void 0 || role.instructions !== void 0 || Array.isArray(role.tools) && role.tools.length > 0;
@@ -3623,7 +3742,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3623
3742
  }
3624
3743
  }
3625
3744
  }, "checkSpecialistRole");
3626
- const checkRequiredConnections = /* @__PURE__ */ __name3((node, path) => {
3745
+ const checkRequiredConnections = /* @__PURE__ */ __name4((node, path) => {
3627
3746
  const required = node.requiredConnections;
3628
3747
  if (!Array.isArray(required)) return;
3629
3748
  const undeclared = required.filter(undeclaredKey);
@@ -3636,7 +3755,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3636
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));
3637
3756
  }
3638
3757
  }, "checkRequiredConnections");
3639
- const checkTier = /* @__PURE__ */ __name3((node, path) => {
3758
+ const checkTier = /* @__PURE__ */ __name4((node, path) => {
3640
3759
  const id = singleId(node);
3641
3760
  if (node.workspace && node.workspace !== "inherit" && node.tier !== void 0 && node.tier !== "job") {
3642
3761
  err("workspace-requires-job-tier", "a step mounting a workspace must be tier:'job'", `${path}.workspace`, id);
@@ -3652,7 +3771,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3652
3771
  err("job-tier-provider-unsupported", `model provider '${provider}' is outside LUA_WF_JOB_PROVIDERS [${opts.policy.jobProviders.join(", ")}]`, `${path}.model`, id);
3653
3772
  }
3654
3773
  }, "checkTier");
3655
- const checkModel = /* @__PURE__ */ __name3((node, path) => {
3774
+ const checkModel = /* @__PURE__ */ __name4((node, path) => {
3656
3775
  if (node.type !== "agent" || typeof node.model !== "string") return;
3657
3776
  const registry = opts.approvedModels;
3658
3777
  if (registry === void 0) return;
@@ -3667,7 +3786,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3667
3786
  const resolved = normalizeModelId(node.model, registry);
3668
3787
  if (!resolved.ok) err("model-unresolved", modelUnresolvedMessage(resolved), `${path}.model`, id);
3669
3788
  }, "checkModel");
3670
- const checkWorkspace = /* @__PURE__ */ __name3((node, path) => {
3789
+ const checkWorkspace = /* @__PURE__ */ __name4((node, path) => {
3671
3790
  const id = singleId(node);
3672
3791
  const ws = workspaceOf(node);
3673
3792
  if (isJobTier(node) && opts.policy && opts.policy.jobTier !== true) {
@@ -3690,6 +3809,9 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3690
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);
3691
3810
  }
3692
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
+ }
3693
3815
  if (ws && ws !== "inherit") {
3694
3816
  if (!envelopeWorkspace && !opts.mayInherit) {
3695
3817
  err("workspace-not-declared", `"${id}" mounts a workspace but the workflow declares none \u2014 add workspace:{kind, \u2026} on createWorkflow`, `${path}.workspace`, id);
@@ -3709,16 +3831,16 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3709
3831
  }
3710
3832
  }, "checkWorkspace");
3711
3833
  const outputSchemas = /* @__PURE__ */ new Map();
3712
- const recordOutputSchema = /* @__PURE__ */ __name3((node) => {
3834
+ const recordOutputSchema = /* @__PURE__ */ __name4((node) => {
3713
3835
  const schema = node.type === "step" ? node.step.outputSchema : node.type === "agent" ? node.outputSchema : void 0;
3714
3836
  if (schema !== void 0) outputSchemas.set(singleId(node), schema);
3715
3837
  }, "recordOutputSchema");
3716
- const checkMapMembers = /* @__PURE__ */ __name3((cfg, basePath, id) => {
3838
+ const checkMapMembers = /* @__PURE__ */ __name4((cfg, basePath, id) => {
3717
3839
  for (const m of malformedMapMembers(cfg)) {
3718
3840
  warn(MAP_MEMBER_MALFORMED_CODE, mapMemberMalformedMessage(id, m), `${basePath}.${m.member}`, id);
3719
3841
  }
3720
3842
  }, "checkMapMembers");
3721
- const checkInputShape = /* @__PURE__ */ __name3((node, path) => {
3843
+ const checkInputShape = /* @__PURE__ */ __name4((node, path) => {
3722
3844
  const input = node.input;
3723
3845
  if (input === void 0) return;
3724
3846
  const id = singleId(node);
@@ -3728,11 +3850,11 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3728
3850
  }
3729
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);
3730
3852
  }, "checkInputShape");
3731
- const checkBodyInput = /* @__PURE__ */ __name3((body, path, container) => {
3853
+ const checkBodyInput = /* @__PURE__ */ __name4((body, path, container) => {
3732
3854
  if (body.type === "workflow" || body.input === void 0) return;
3733
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));
3734
3856
  }, "checkBodyInput");
3735
- const checkSingle = /* @__PURE__ */ __name3((node, path, depth) => {
3857
+ const checkSingle = /* @__PURE__ */ __name4((node, path, depth) => {
3736
3858
  recordOutputSchema(node);
3737
3859
  if (node.type === "workflow" && (typeof node.workflowId !== "string" || node.workflowId.length === 0)) {
3738
3860
  checkId(node.id, path);
@@ -3781,7 +3903,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3781
3903
  }
3782
3904
  }
3783
3905
  }, "checkSingle");
3784
- const checkHitl = /* @__PURE__ */ __name3((node, path) => {
3906
+ const checkHitl = /* @__PURE__ */ __name4((node, path) => {
3785
3907
  if (node.type === "waitForSignal") {
3786
3908
  const w = node;
3787
3909
  checkId(w.id, path);
@@ -3820,7 +3942,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3820
3942
  }
3821
3943
  }
3822
3944
  }, "checkHitl");
3823
- const checkHitlArm = /* @__PURE__ */ __name3((node, path, container) => {
3945
+ const checkHitlArm = /* @__PURE__ */ __name4((node, path, container) => {
3824
3946
  if (!workflowContainerRunsHitlArm(container)) {
3825
3947
  checkId(node.id, path);
3826
3948
  err("node-type-unsupported-in-container", workflowHitlArmUnsupportedMessage(node.type, node.id, container), path, node.id);
@@ -3828,7 +3950,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
3828
3950
  }
3829
3951
  checkHitl(node, path);
3830
3952
  }, "checkHitlArm");
3831
- const checkArm = /* @__PURE__ */ __name3((arm, path, depth, container) => {
3953
+ const checkArm = /* @__PURE__ */ __name4((arm, path, depth, container) => {
3832
3954
  if (arm.type === "mapping") {
3833
3955
  checkId(arm.id, path);
3834
3956
  checkMapMembers(readMapConfig(arm.mapConfig), `${path}.mapConfig`, arm.id);
@@ -4025,7 +4147,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
4025
4147
  return issues;
4026
4148
  }
4027
4149
  __name(validateLuaExtensions, "validateLuaExtensions");
4028
- __name3(validateLuaExtensions, "validateLuaExtensions");
4150
+ __name4(validateLuaExtensions, "validateLuaExtensions");
4029
4151
  var EDITABLE_PATH_RE = /^[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?(\.[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?)*$/;
4030
4152
  var PREDICATE_OPS = /* @__PURE__ */ new Set([
4031
4153
  "eq",
@@ -4048,8 +4170,8 @@ function isPredicate(p) {
4048
4170
  return typeof p === "object" && p !== null && typeof p.op === "string" && PREDICATE_OPS.has(p.op);
4049
4171
  }
4050
4172
  __name(isPredicate, "isPredicate");
4051
- __name3(isPredicate, "isPredicate");
4052
- 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");
4053
4175
  function isPathOrLiteral(v) {
4054
4176
  if (typeof v !== "object" || v === null) return false;
4055
4177
  const r = v;
@@ -4057,7 +4179,7 @@ function isPathOrLiteral(v) {
4057
4179
  return "literal" in r && isPredicateScalar(r.literal);
4058
4180
  }
4059
4181
  __name(isPathOrLiteral, "isPathOrLiteral");
4060
- __name3(isPathOrLiteral, "isPathOrLiteral");
4182
+ __name4(isPathOrLiteral, "isPathOrLiteral");
4061
4183
  function isWellFormedPredicate(p) {
4062
4184
  if (!isPredicate(p)) return false;
4063
4185
  const r = p;
@@ -4088,11 +4210,11 @@ function isWellFormedPredicate(p) {
4088
4210
  }
4089
4211
  }
4090
4212
  __name(isWellFormedPredicate, "isWellFormedPredicate");
4091
- __name3(isWellFormedPredicate, "isWellFormedPredicate");
4213
+ __name4(isWellFormedPredicate, "isWellFormedPredicate");
4092
4214
  var GRAPH_HASH_PREFIX = "sha256-cj1:";
4093
4215
  function canonicalJson(value22) {
4094
4216
  const seen = /* @__PURE__ */ new WeakSet();
4095
- const encode = /* @__PURE__ */ __name3((v) => {
4217
+ const encode = /* @__PURE__ */ __name4((v) => {
4096
4218
  if (v === null || typeof v === "number" || typeof v === "boolean") return JSON.stringify(v);
4097
4219
  if (typeof v === "string") return JSON.stringify(v);
4098
4220
  if (typeof v === "bigint") return JSON.stringify(`${v}n`);
@@ -4113,19 +4235,19 @@ function canonicalJson(value22) {
4113
4235
  return encode(value22);
4114
4236
  }
4115
4237
  __name(canonicalJson, "canonicalJson");
4116
- __name3(canonicalJson, "canonicalJson");
4238
+ __name4(canonicalJson, "canonicalJson");
4117
4239
  function hashGraph(g) {
4118
4240
  const { metadata: _provenance, ...definition } = withDefaultsFilled(g).definition;
4119
4241
  return GRAPH_HASH_PREFIX + createHash("sha256").update(canonicalJson(definition)).digest("hex");
4120
4242
  }
4121
4243
  __name(hashGraph, "hashGraph");
4122
- __name3(hashGraph, "hashGraph");
4244
+ __name4(hashGraph, "hashGraph");
4123
4245
  var WorkflowPlanError = class extends Error {
4124
4246
  static {
4125
4247
  __name(this, "WorkflowPlanError");
4126
4248
  }
4127
4249
  static {
4128
- __name3(this, "WorkflowPlanError");
4250
+ __name4(this, "WorkflowPlanError");
4129
4251
  }
4130
4252
  code;
4131
4253
  constructor(code, message) {
@@ -4133,15 +4255,15 @@ var WorkflowPlanError = class extends Error {
4133
4255
  this.name = "WorkflowPlanError";
4134
4256
  }
4135
4257
  };
4136
- var isArmStep = /* @__PURE__ */ __name3((e) => isWorkflowArmEntryType(e.type), "isArmStep");
4137
- var armStepId = /* @__PURE__ */ __name3((e) => e.type === "step" ? e.step.id : e.id, "armStepId");
4138
- var armStepKind = /* @__PURE__ */ __name3((e) => WORKFLOW_ARM_ENTRY_STEP_KINDS[e.type], "armStepKind");
4139
- var joinIdOf = /* @__PURE__ */ __name3((entryId) => `${entryId}.join`, "joinIdOf");
4140
- 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");
4141
4263
  function compilePlan(g) {
4142
4264
  const steps = {};
4143
4265
  const order = [];
4144
- const addNode = /* @__PURE__ */ __name3((id, node) => {
4266
+ const addNode = /* @__PURE__ */ __name4((id, node) => {
4145
4267
  if (id in steps) {
4146
4268
  throw new WorkflowPlanError("duplicate-step-id", `Duplicate step id "${id}" in definition.graph`);
4147
4269
  }
@@ -4312,7 +4434,7 @@ function compilePlan(g) {
4312
4434
  };
4313
4435
  }
4314
4436
  __name(compilePlan, "compilePlan");
4315
- __name3(compilePlan, "compilePlan");
4437
+ __name4(compilePlan, "compilePlan");
4316
4438
  var PATH_PLACEHOLDER = /^\$\{([^}]+)\}$/;
4317
4439
  var MISSING = /* @__PURE__ */ Symbol("predicate.missing");
4318
4440
  function resolvePath(rawPath, ctx) {
@@ -4356,7 +4478,7 @@ function resolvePath(rawPath, ctx) {
4356
4478
  return walk(root, rest);
4357
4479
  }
4358
4480
  __name(resolvePath, "resolvePath");
4359
- __name3(resolvePath, "resolvePath");
4481
+ __name4(resolvePath, "resolvePath");
4360
4482
  function walk(root, path) {
4361
4483
  if (path === "") return root;
4362
4484
  const parts = path.split(".");
@@ -4371,13 +4493,13 @@ function walk(root, path) {
4371
4493
  return value22;
4372
4494
  }
4373
4495
  __name(walk, "walk");
4374
- __name3(walk, "walk");
4496
+ __name4(walk, "walk");
4375
4497
  function resolveValue(ref, ctx) {
4376
4498
  if ("literal" in ref) return ref.literal;
4377
4499
  return resolvePath(ref.path, ctx);
4378
4500
  }
4379
4501
  __name(resolveValue, "resolveValue");
4380
- __name3(resolveValue, "resolveValue");
4502
+ __name4(resolveValue, "resolveValue");
4381
4503
  function evaluatePredicate(pred, ctx) {
4382
4504
  switch (pred.op) {
4383
4505
  case "and":
@@ -4417,7 +4539,7 @@ function evaluatePredicate(pred, ctx) {
4417
4539
  }
4418
4540
  }
4419
4541
  __name(evaluatePredicate, "evaluatePredicate");
4420
- __name3(evaluatePredicate, "evaluatePredicate");
4542
+ __name4(evaluatePredicate, "evaluatePredicate");
4421
4543
  function compare(op, left, right) {
4422
4544
  if (op === "eq") return left === right;
4423
4545
  if (op === "ne") return left !== right;
@@ -4436,14 +4558,14 @@ function compare(op, left, right) {
4436
4558
  return false;
4437
4559
  }
4438
4560
  __name(compare, "compare");
4439
- __name3(compare, "compare");
4561
+ __name4(compare, "compare");
4440
4562
  function derivePredicateLabel(pred, maxLength = 80) {
4441
4563
  const raw = renderPredicate(pred);
4442
4564
  if (raw.length <= maxLength) return raw;
4443
4565
  return raw.slice(0, maxLength - 1) + "\u2026";
4444
4566
  }
4445
4567
  __name(derivePredicateLabel, "derivePredicateLabel");
4446
- __name3(derivePredicateLabel, "derivePredicateLabel");
4568
+ __name4(derivePredicateLabel, "derivePredicateLabel");
4447
4569
  function renderPredicate(pred) {
4448
4570
  switch (pred.op) {
4449
4571
  case "and":
@@ -4478,55 +4600,55 @@ function renderPredicate(pred) {
4478
4600
  }
4479
4601
  }
4480
4602
  __name(renderPredicate, "renderPredicate");
4481
- __name3(renderPredicate, "renderPredicate");
4603
+ __name4(renderPredicate, "renderPredicate");
4482
4604
  function wrapLabel(child, rendered) {
4483
4605
  return child.op === "and" || child.op === "or" || child.op === "not" ? `(${rendered})` : rendered;
4484
4606
  }
4485
4607
  __name(wrapLabel, "wrapLabel");
4486
- __name3(wrapLabel, "wrapLabel");
4608
+ __name4(wrapLabel, "wrapLabel");
4487
4609
  function renderRef(ref) {
4488
4610
  if ("literal" in ref) return JSON.stringify(ref.literal);
4489
4611
  return ref.path;
4490
4612
  }
4491
4613
  __name(renderRef, "renderRef");
4492
- __name3(renderRef, "renderRef");
4493
- 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");
4494
4616
  function step(s) {
4495
4617
  const id = stepIdOf(s);
4496
4618
  return {
4497
- path: /* @__PURE__ */ __name3((p) => ({
4619
+ path: /* @__PURE__ */ __name4((p) => ({
4498
4620
  path: p === "" ? `stepResults.${id}` : `stepResults.${id}.${p}`
4499
4621
  }), "path")
4500
4622
  };
4501
4623
  }
4502
4624
  __name(step, "step");
4503
- __name3(step, "step");
4625
+ __name4(step, "step");
4504
4626
  function stepOf(id) {
4505
4627
  return step(id);
4506
4628
  }
4507
4629
  __name(stepOf, "stepOf");
4508
- __name3(stepOf, "stepOf");
4630
+ __name4(stepOf, "stepOf");
4509
4631
  function init(path) {
4510
4632
  return {
4511
4633
  path: path === "" ? "initData" : `initData.${path}`
4512
4634
  };
4513
4635
  }
4514
4636
  __name(init, "init");
4515
- __name3(init, "init");
4637
+ __name4(init, "init");
4516
4638
  function state(path) {
4517
4639
  return {
4518
4640
  path: path === "" ? "state" : `state.${path}`
4519
4641
  };
4520
4642
  }
4521
4643
  __name(state, "state");
4522
- __name3(state, "state");
4644
+ __name4(state, "state");
4523
4645
  function lit(v) {
4524
4646
  return {
4525
4647
  literal: v
4526
4648
  };
4527
4649
  }
4528
4650
  __name(lit, "lit");
4529
- __name3(lit, "lit");
4651
+ __name4(lit, "lit");
4530
4652
  function toPathOrLiteral(v) {
4531
4653
  if (typeof v === "object" && v !== null) {
4532
4654
  if ("path" in v) return {
@@ -4541,8 +4663,8 @@ function toPathOrLiteral(v) {
4541
4663
  };
4542
4664
  }
4543
4665
  __name(toPathOrLiteral, "toPathOrLiteral");
4544
- __name3(toPathOrLiteral, "toPathOrLiteral");
4545
- var cmp = /* @__PURE__ */ __name3((op) => (l, r) => ({
4666
+ __name4(toPathOrLiteral, "toPathOrLiteral");
4667
+ var cmp = /* @__PURE__ */ __name4((op) => (l, r) => ({
4546
4668
  op,
4547
4669
  left: toPathOrLiteral(l),
4548
4670
  right: toPathOrLiteral(r)
@@ -4553,49 +4675,49 @@ var gt = cmp("gt");
4553
4675
  var gte = cmp("gte");
4554
4676
  var lt = cmp("lt");
4555
4677
  var lte = cmp("lte");
4556
- var inSet = /* @__PURE__ */ __name3((v, set) => ({
4678
+ var inSet = /* @__PURE__ */ __name4((v, set) => ({
4557
4679
  op: "in",
4558
4680
  value: {
4559
4681
  path: v.path
4560
4682
  },
4561
4683
  set
4562
4684
  }), "inSet");
4563
- var notIn = /* @__PURE__ */ __name3((v, set) => ({
4685
+ var notIn = /* @__PURE__ */ __name4((v, set) => ({
4564
4686
  op: "notIn",
4565
4687
  value: {
4566
4688
  path: v.path
4567
4689
  },
4568
4690
  set
4569
4691
  }), "notIn");
4570
- var exists = /* @__PURE__ */ __name3((ref) => ({
4692
+ var exists = /* @__PURE__ */ __name4((ref) => ({
4571
4693
  op: "exists",
4572
4694
  path: ref.path
4573
4695
  }), "exists");
4574
- var notExists = /* @__PURE__ */ __name3((ref) => ({
4696
+ var notExists = /* @__PURE__ */ __name4((ref) => ({
4575
4697
  op: "notExists",
4576
4698
  path: ref.path
4577
4699
  }), "notExists");
4578
- var truthy = /* @__PURE__ */ __name3((ref) => ({
4700
+ var truthy = /* @__PURE__ */ __name4((ref) => ({
4579
4701
  op: "truthy",
4580
4702
  value: {
4581
4703
  path: ref.path
4582
4704
  }
4583
4705
  }), "truthy");
4584
- var falsy = /* @__PURE__ */ __name3((ref) => ({
4706
+ var falsy = /* @__PURE__ */ __name4((ref) => ({
4585
4707
  op: "falsy",
4586
4708
  value: {
4587
4709
  path: ref.path
4588
4710
  }
4589
4711
  }), "falsy");
4590
- var and = /* @__PURE__ */ __name3((...args) => ({
4712
+ var and = /* @__PURE__ */ __name4((...args) => ({
4591
4713
  op: "and",
4592
4714
  args
4593
4715
  }), "and");
4594
- var or = /* @__PURE__ */ __name3((...args) => ({
4716
+ var or = /* @__PURE__ */ __name4((...args) => ({
4595
4717
  op: "or",
4596
4718
  args
4597
4719
  }), "or");
4598
- var not = /* @__PURE__ */ __name3((arg) => ({
4720
+ var not = /* @__PURE__ */ __name4((arg) => ({
4599
4721
  op: "not",
4600
4722
  arg
4601
4723
  }), "not");
@@ -4660,7 +4782,7 @@ function continuedFailureValue(error, killReason) {
4660
4782
  };
4661
4783
  }
4662
4784
  __name(continuedFailureValue, "continuedFailureValue");
4663
- __name3(continuedFailureValue, "continuedFailureValue");
4785
+ __name4(continuedFailureValue, "continuedFailureValue");
4664
4786
  function isContinuedFailureValue(v) {
4665
4787
  if (v === null || typeof v !== "object" || Array.isArray(v)) return false;
4666
4788
  const o = v;
@@ -4668,8 +4790,8 @@ function isContinuedFailureValue(v) {
4668
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";
4669
4791
  }
4670
4792
  __name(isContinuedFailureValue, "isContinuedFailureValue");
4671
- __name3(isContinuedFailureValue, "isContinuedFailureValue");
4672
- var isHitlNode2 = /* @__PURE__ */ __name3((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
4793
+ __name4(isContinuedFailureValue, "isContinuedFailureValue");
4794
+ var isHitlNode2 = /* @__PURE__ */ __name4((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
4673
4795
  function inlineContainerArm(mapping, step22) {
4674
4796
  return {
4675
4797
  ...step22,
@@ -4677,8 +4799,8 @@ function inlineContainerArm(mapping, step22) {
4677
4799
  };
4678
4800
  }
4679
4801
  __name(inlineContainerArm, "inlineContainerArm");
4680
- __name3(inlineContainerArm, "inlineContainerArm");
4681
- 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");
4682
4804
  function entryIds(entry) {
4683
4805
  switch (entry.type) {
4684
4806
  case "parallel":
@@ -4702,13 +4824,13 @@ function entryIds(entry) {
4702
4824
  }
4703
4825
  }
4704
4826
  __name(entryIds, "entryIds");
4705
- __name3(entryIds, "entryIds");
4827
+ __name4(entryIds, "entryIds");
4706
4828
  function resolvePlacements(calls) {
4707
4829
  const issues = [];
4708
4830
  const declared = /* @__PURE__ */ new Map();
4709
4831
  const placedBy = /* @__PURE__ */ new Map();
4710
4832
  const allIds = /* @__PURE__ */ new Map();
4711
- const claimId = /* @__PURE__ */ __name3((id, callIndex) => {
4833
+ const claimId = /* @__PURE__ */ __name4((id, callIndex) => {
4712
4834
  const first = allIds.get(id);
4713
4835
  if (first !== void 0 && first !== callIndex) {
4714
4836
  issues.push({
@@ -4748,7 +4870,7 @@ function resolvePlacements(calls) {
4748
4870
  break;
4749
4871
  }
4750
4872
  });
4751
- const armMapPlacementIssue = /* @__PURE__ */ __name3((node, ref, i, container) => {
4873
+ const armMapPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
4752
4874
  if (!ref.armMap || node.type === "mapping" || isHitlNode2(node)) return void 0;
4753
4875
  const id = nodeIdOf(node);
4754
4876
  if ((container === "foreach" || container === "loop") && node.type !== "workflow") {
@@ -4769,7 +4891,7 @@ function resolvePlacements(calls) {
4769
4891
  }
4770
4892
  return void 0;
4771
4893
  }, "armMapPlacementIssue");
4772
- const hitlPlacementIssue = /* @__PURE__ */ __name3((node, ref, i, container) => {
4894
+ const hitlPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
4773
4895
  if (!isHitlNode2(node)) return void 0;
4774
4896
  const id = node.id;
4775
4897
  if (ref.armMap) {
@@ -4790,7 +4912,7 @@ function resolvePlacements(calls) {
4790
4912
  }
4791
4913
  return void 0;
4792
4914
  }, "hitlPlacementIssue");
4793
- const resolve = /* @__PURE__ */ __name3((ref, i, allowMapping, container) => {
4915
+ const resolve = /* @__PURE__ */ __name4((ref, i, allowMapping, container) => {
4794
4916
  if ("node" in ref) {
4795
4917
  if (ref.node.type === "mapping" && !allowMapping) {
4796
4918
  issues.push({
@@ -4845,7 +4967,7 @@ function resolvePlacements(calls) {
4845
4967
  placedBy.set(ref.ref, i);
4846
4968
  return d.node;
4847
4969
  }, "resolve");
4848
- const claim = /* @__PURE__ */ __name3((ref, i, allowMapping, container) => {
4970
+ const claim = /* @__PURE__ */ __name4((ref, i, allowMapping, container) => {
4849
4971
  if ("ref" in ref) {
4850
4972
  resolve(ref, i, allowMapping, container);
4851
4973
  return;
@@ -4880,7 +5002,7 @@ function resolvePlacements(calls) {
4880
5002
  }
4881
5003
  });
4882
5004
  const graph = [];
4883
- const lookup = /* @__PURE__ */ __name3((ref) => {
5005
+ const lookup = /* @__PURE__ */ __name4((ref) => {
4884
5006
  const n2 = "node" in ref ? ref.node : declared.get(ref.ref)?.node;
4885
5007
  if (!n2 || !ref.armMap || n2.type === "mapping" || isHitlNode2(n2)) return n2;
4886
5008
  return inlineContainerArm(ref.armMap, n2);
@@ -4963,7 +5085,7 @@ function resolvePlacements(calls) {
4963
5085
  };
4964
5086
  }
4965
5087
  __name(resolvePlacements, "resolvePlacements");
4966
- __name3(resolvePlacements, "resolvePlacements");
5088
+ __name4(resolvePlacements, "resolvePlacements");
4967
5089
  var GOAL_JUDGE_STEP_ID = "__goal_judge";
4968
5090
  var NON_LEAF_KINDS = /* @__PURE__ */ new Set([
4969
5091
  "foreach",
@@ -4974,18 +5096,18 @@ function isConditionalJoinId(stepId) {
4974
5096
  return CONDITIONAL_JOIN_ID.test(stepId);
4975
5097
  }
4976
5098
  __name(isConditionalJoinId, "isConditionalJoinId");
4977
- __name3(isConditionalJoinId, "isConditionalJoinId");
5099
+ __name4(isConditionalJoinId, "isConditionalJoinId");
4978
5100
  function isPlainObject(v) {
4979
5101
  return typeof v === "object" && v !== null && !Array.isArray(v);
4980
5102
  }
4981
5103
  __name(isPlainObject, "isPlainObject");
4982
- __name3(isPlainObject, "isPlainObject");
5104
+ __name4(isPlainObject, "isPlainObject");
4983
5105
  function leafValue(row) {
4984
5106
  if (row.status === "completed") return row.output === void 0 ? null : row.output;
4985
5107
  return continuedFailureValue(row.error, row.killReason);
4986
5108
  }
4987
5109
  __name(leafValue, "leafValue");
4988
- __name3(leafValue, "leafValue");
5110
+ __name4(leafValue, "leafValue");
4989
5111
  function runOutputLeaves(steps) {
4990
5112
  const dependedOn = /* @__PURE__ */ new Set();
4991
5113
  for (const s of steps) {
@@ -4995,7 +5117,7 @@ function runOutputLeaves(steps) {
4995
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));
4996
5118
  }
4997
5119
  __name(runOutputLeaves, "runOutputLeaves");
4998
- __name3(runOutputLeaves, "runOutputLeaves");
5120
+ __name4(runOutputLeaves, "runOutputLeaves");
4999
5121
  function deriveRunOutput(steps) {
5000
5122
  const leaves = runOutputLeaves(steps);
5001
5123
  if (leaves.length === 0) return void 0;
@@ -5026,13 +5148,13 @@ function deriveRunOutput(steps) {
5026
5148
  };
5027
5149
  }
5028
5150
  __name(deriveRunOutput, "deriveRunOutput");
5029
- __name3(deriveRunOutput, "deriveRunOutput");
5151
+ __name4(deriveRunOutput, "deriveRunOutput");
5030
5152
  function subrunSettledOutput(child) {
5031
5153
  if (child.output !== void 0) return child.output;
5032
5154
  return deriveRunOutput(child.steps ?? [])?.output ?? null;
5033
5155
  }
5034
5156
  __name(subrunSettledOutput, "subrunSettledOutput");
5035
- __name3(subrunSettledOutput, "subrunSettledOutput");
5157
+ __name4(subrunSettledOutput, "subrunSettledOutput");
5036
5158
  function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
5037
5159
  const byId = /* @__PURE__ */ new Map();
5038
5160
  for (const s of steps) {
@@ -5043,11 +5165,11 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
5043
5165
  const seeded = [];
5044
5166
  const unseeded = [];
5045
5167
  const known = new Set(Object.keys(targetPlan.steps));
5046
- const parentOf = /* @__PURE__ */ __name3((id) => {
5168
+ const parentOf = /* @__PURE__ */ __name4((id) => {
5047
5169
  const m = /^(.*)(\[\d+\]|#\d+)$/.exec(id);
5048
5170
  return m ? m[1] : void 0;
5049
5171
  }, "parentOf");
5050
- const dependsOf = /* @__PURE__ */ __name3((id) => {
5172
+ const dependsOf = /* @__PURE__ */ __name4((id) => {
5051
5173
  const node = targetPlan.steps[id];
5052
5174
  if (node) return node.dependsOn;
5053
5175
  const parent = parentOf(id);
@@ -5093,8 +5215,8 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
5093
5215
  };
5094
5216
  }
5095
5217
  __name(seedLedgerFromRun, "seedLedgerFromRun");
5096
- __name3(seedLedgerFromRun, "seedLedgerFromRun");
5097
- 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");
5098
5220
  function branchSpecFromConditional(entry) {
5099
5221
  return {
5100
5222
  arms: entry.steps.map((arm, i) => ({
@@ -5110,7 +5232,7 @@ function branchSpecFromConditional(entry) {
5110
5232
  };
5111
5233
  }
5112
5234
  __name(branchSpecFromConditional, "branchSpecFromConditional");
5113
- __name3(branchSpecFromConditional, "branchSpecFromConditional");
5235
+ __name4(branchSpecFromConditional, "branchSpecFromConditional");
5114
5236
  function selectBranchArms(spec, ctx) {
5115
5237
  const taken = [];
5116
5238
  for (const arm of spec.arms) {
@@ -5122,9 +5244,9 @@ function selectBranchArms(spec, ctx) {
5122
5244
  return taken;
5123
5245
  }
5124
5246
  __name(selectBranchArms, "selectBranchArms");
5125
- __name3(selectBranchArms, "selectBranchArms");
5126
- var canonical = /* @__PURE__ */ __name3((v) => JSON.stringify(sortKeys(v)), "canonical");
5127
- 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) => {
5128
5250
  if (Array.isArray(v)) return v.map(sortKeys);
5129
5251
  if (v && typeof v === "object") {
5130
5252
  return Object.fromEntries(Object.keys(v).sort().map((k) => [
@@ -5152,7 +5274,7 @@ function replayLedger(g, ledger) {
5152
5274
  startedAt: 0,
5153
5275
  ...ledger.requestContext
5154
5276
  };
5155
- const ctxFor = /* @__PURE__ */ __name3((id) => ({
5277
+ const ctxFor = /* @__PURE__ */ __name4((id) => ({
5156
5278
  initData: ledger.initData,
5157
5279
  stepResults: ancestorResults(plan, id, rows22),
5158
5280
  state: ledger.state ?? {},
@@ -5218,9 +5340,9 @@ function replayLedger(g, ledger) {
5218
5340
  };
5219
5341
  }
5220
5342
  __name(replayLedger, "replayLedger");
5221
- __name3(replayLedger, "replayLedger");
5343
+ __name4(replayLedger, "replayLedger");
5222
5344
  var JOIN = ".join";
5223
- 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");
5224
5346
  function replayResultOf(row, node) {
5225
5347
  if (!row) return void 0;
5226
5348
  if (row.status === "completed") return {
@@ -5235,12 +5357,12 @@ function replayResultOf(row, node) {
5235
5357
  return void 0;
5236
5358
  }
5237
5359
  __name(replayResultOf, "replayResultOf");
5238
- __name3(replayResultOf, "replayResultOf");
5360
+ __name4(replayResultOf, "replayResultOf");
5239
5361
  function ancestorResults(plan, id, rows22) {
5240
5362
  const out = {};
5241
5363
  const joinAliased = /* @__PURE__ */ new Set();
5242
5364
  const seen = /* @__PURE__ */ new Set();
5243
- const take = /* @__PURE__ */ __name3((rowId) => {
5365
+ const take = /* @__PURE__ */ __name4((rowId) => {
5244
5366
  const hit = replayResultOf(rows22.get(rowId), plan.steps[rowId]);
5245
5367
  if (!hit) return void 0;
5246
5368
  if (!joinAliased.has(rowId)) out[rowId] = hit.value;
@@ -5257,7 +5379,7 @@ function ancestorResults(plan, id, rows22) {
5257
5379
  }
5258
5380
  return hit;
5259
5381
  }, "take");
5260
- const walk2 = /* @__PURE__ */ __name3((ids) => {
5382
+ const walk2 = /* @__PURE__ */ __name4((ids) => {
5261
5383
  for (const dep of ids) {
5262
5384
  if (seen.has(dep)) continue;
5263
5385
  seen.add(dep);
@@ -5289,7 +5411,7 @@ function ancestorResults(plan, id, rows22) {
5289
5411
  return out;
5290
5412
  }
5291
5413
  __name(ancestorResults, "ancestorResults");
5292
- __name3(ancestorResults, "ancestorResults");
5414
+ __name4(ancestorResults, "ancestorResults");
5293
5415
  function inferTaken(entry, rows22) {
5294
5416
  const arms = [
5295
5417
  ...entry.steps,
@@ -5303,7 +5425,7 @@ function inferTaken(entry, rows22) {
5303
5425
  });
5304
5426
  }
5305
5427
  __name(inferTaken, "inferTaken");
5306
- __name3(inferTaken, "inferTaken");
5428
+ __name4(inferTaken, "inferTaken");
5307
5429
  function countChildren(entry, rows22) {
5308
5430
  const body = branchArmId(entry.step);
5309
5431
  let n2 = 0;
@@ -5311,19 +5433,19 @@ function countChildren(entry, rows22) {
5311
5433
  return n2;
5312
5434
  }
5313
5435
  __name(countChildren, "countChildren");
5314
- __name3(countChildren, "countChildren");
5436
+ __name4(countChildren, "countChildren");
5315
5437
  var FORCE_CANCEL_STALE_MS = 10 * 60 * 1e3;
5316
5438
  var TERMINAL = new Set(WORKFLOW_RUN_TERMINAL);
5317
5439
  function isTerminalRunStatus(status) {
5318
5440
  return TERMINAL.has(status);
5319
5441
  }
5320
5442
  __name(isTerminalRunStatus, "isTerminalRunStatus");
5321
- __name3(isTerminalRunStatus, "isTerminalRunStatus");
5443
+ __name4(isTerminalRunStatus, "isTerminalRunStatus");
5322
5444
  function pruneUndefined(o) {
5323
5445
  return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
5324
5446
  }
5325
5447
  __name(pruneUndefined, "pruneUndefined");
5326
- __name3(pruneUndefined, "pruneUndefined");
5448
+ __name4(pruneUndefined, "pruneUndefined");
5327
5449
  var WORKFLOW_INLINE_RUN_TAG = "inline";
5328
5450
  function runOrigin(run) {
5329
5451
  if (run.goalId) return "goal";
@@ -5332,7 +5454,7 @@ function runOrigin(run) {
5332
5454
  return "definition";
5333
5455
  }
5334
5456
  __name(runOrigin, "runOrigin");
5335
- __name3(runOrigin, "runOrigin");
5457
+ __name4(runOrigin, "runOrigin");
5336
5458
  var RUN_ERROR_ISSUES_MAX = 20;
5337
5459
  function runErrorIssues(issues) {
5338
5460
  if (!Array.isArray(issues)) return void 0;
@@ -5350,7 +5472,7 @@ function runErrorIssues(issues) {
5350
5472
  return out.length ? out : void 0;
5351
5473
  }
5352
5474
  __name(runErrorIssues, "runErrorIssues");
5353
- __name3(runErrorIssues, "runErrorIssues");
5475
+ __name4(runErrorIssues, "runErrorIssues");
5354
5476
  function runNextAction(run) {
5355
5477
  if (isTerminalRunStatus(run.status)) return "none";
5356
5478
  if (run.status === "suspended" && run.gate?.kind === "budget") return "raise_budget";
@@ -5360,7 +5482,7 @@ function runNextAction(run) {
5360
5482
  return Date.now() >= forceAt ? "force" : "cancel_again";
5361
5483
  }
5362
5484
  __name(runNextAction, "runNextAction");
5363
- __name3(runNextAction, "runNextAction");
5485
+ __name4(runNextAction, "runNextAction");
5364
5486
  var IN_FLIGHT = new Set(WORKFLOW_STEP_IN_FLIGHT);
5365
5487
  function emptyRunCounts() {
5366
5488
  const out = {
@@ -5371,7 +5493,7 @@ function emptyRunCounts() {
5371
5493
  return out;
5372
5494
  }
5373
5495
  __name(emptyRunCounts, "emptyRunCounts");
5374
- __name3(emptyRunCounts, "emptyRunCounts");
5496
+ __name4(emptyRunCounts, "emptyRunCounts");
5375
5497
  function runCountsFromStatusTally(tally) {
5376
5498
  const out = emptyRunCounts();
5377
5499
  for (const [status, n2] of Object.entries(tally)) {
@@ -5383,25 +5505,25 @@ function runCountsFromStatusTally(tally) {
5383
5505
  return out;
5384
5506
  }
5385
5507
  __name(runCountsFromStatusTally, "runCountsFromStatusTally");
5386
- __name3(runCountsFromStatusTally, "runCountsFromStatusTally");
5508
+ __name4(runCountsFromStatusTally, "runCountsFromStatusTally");
5387
5509
  function runCountsFromStepStatuses(statuses) {
5388
5510
  const tally = {};
5389
5511
  for (const s of statuses) tally[s] = (tally[s] ?? 0) + 1;
5390
5512
  return runCountsFromStatusTally(tally);
5391
5513
  }
5392
5514
  __name(runCountsFromStepStatuses, "runCountsFromStepStatuses");
5393
- __name3(runCountsFromStepStatuses, "runCountsFromStepStatuses");
5515
+ __name4(runCountsFromStepStatuses, "runCountsFromStepStatuses");
5394
5516
  function isBillingHeldStep(row) {
5395
5517
  return row.status === "ready" && row.billingHold === true;
5396
5518
  }
5397
5519
  __name(isBillingHeldStep, "isBillingHeldStep");
5398
- __name3(isBillingHeldStep, "isBillingHeldStep");
5520
+ __name4(isBillingHeldStep, "isBillingHeldStep");
5399
5521
  function stepEffectiveStatus(row) {
5400
5522
  return isBillingHeldStep(row) ? "suspended" : row.status;
5401
5523
  }
5402
5524
  __name(stepEffectiveStatus, "stepEffectiveStatus");
5403
- __name3(stepEffectiveStatus, "stepEffectiveStatus");
5404
- 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");
5405
5527
  function runCounts(counts) {
5406
5528
  const c = counts ?? {};
5407
5529
  const rawInFlight = c.dispatched !== void 0 || c.claimed !== void 0 || c.running !== void 0 || c.cancellation_requested !== void 0;
@@ -5418,24 +5540,24 @@ function runCounts(counts) {
5418
5540
  };
5419
5541
  }
5420
5542
  __name(runCounts, "runCounts");
5421
- __name3(runCounts, "runCounts");
5543
+ __name4(runCounts, "runCounts");
5422
5544
  function isPricedStepReceipt(receipt) {
5423
5545
  return typeof receipt?.multiplier === "number" && Number.isFinite(receipt.multiplier);
5424
5546
  }
5425
5547
  __name(isPricedStepReceipt, "isPricedStepReceipt");
5426
- __name3(isPricedStepReceipt, "isPricedStepReceipt");
5548
+ __name4(isPricedStepReceipt, "isPricedStepReceipt");
5427
5549
  function receiptEngine(engine) {
5428
5550
  if (engine === "actions") return "seat";
5429
5551
  if (engine === "credits") return "legacy";
5430
5552
  return void 0;
5431
5553
  }
5432
5554
  __name(receiptEngine, "receiptEngine");
5433
- __name3(receiptEngine, "receiptEngine");
5555
+ __name4(receiptEngine, "receiptEngine");
5434
5556
  function receiptTier(tier) {
5435
5557
  return tier === "light" || tier === "standard" || tier === "heavy" ? tier : void 0;
5436
5558
  }
5437
5559
  __name(receiptTier, "receiptTier");
5438
- __name3(receiptTier, "receiptTier");
5560
+ __name4(receiptTier, "receiptTier");
5439
5561
  function stepBillingView(receipt) {
5440
5562
  const engine = receiptEngine(receipt?.engine);
5441
5563
  if (!receipt || engine === void 0) return void 0;
@@ -5452,7 +5574,7 @@ function stepBillingView(receipt) {
5452
5574
  });
5453
5575
  }
5454
5576
  __name(stepBillingView, "stepBillingView");
5455
- __name3(stepBillingView, "stepBillingView");
5577
+ __name4(stepBillingView, "stepBillingView");
5456
5578
  function runUsage(run, receipts) {
5457
5579
  const actions = n(run.budget?.spent?.actionsEstimate);
5458
5580
  const stamped = run.budget?.engine;
@@ -5476,13 +5598,13 @@ function runUsage(run, receipts) {
5476
5598
  };
5477
5599
  }
5478
5600
  __name(runUsage, "runUsage");
5479
- __name3(runUsage, "runUsage");
5601
+ __name4(runUsage, "runUsage");
5480
5602
  function runBudgetCap(budget) {
5481
5603
  const cap = budget?.maxCredits;
5482
5604
  return typeof cap === "number" && Number.isFinite(cap) && cap > 0 ? cap : void 0;
5483
5605
  }
5484
5606
  __name(runBudgetCap, "runBudgetCap");
5485
- __name3(runBudgetCap, "runBudgetCap");
5607
+ __name4(runBudgetCap, "runBudgetCap");
5486
5608
  function runBudgetRemaining(budget) {
5487
5609
  const cap = runBudgetCap(budget);
5488
5610
  if (cap === void 0) return void 0;
@@ -5490,7 +5612,7 @@ function runBudgetRemaining(budget) {
5490
5612
  return Math.max(0, cap - n(spent?.credits) - n(spent?.actionsEstimate) - n(budget?.reserved));
5491
5613
  }
5492
5614
  __name(runBudgetRemaining, "runBudgetRemaining");
5493
- __name3(runBudgetRemaining, "runBudgetRemaining");
5615
+ __name4(runBudgetRemaining, "runBudgetRemaining");
5494
5616
  function runCancelView(cancel) {
5495
5617
  if (!cancel) return void 0;
5496
5618
  return {
@@ -5516,7 +5638,7 @@ function runCancelView(cancel) {
5516
5638
  };
5517
5639
  }
5518
5640
  __name(runCancelView, "runCancelView");
5519
- __name3(runCancelView, "runCancelView");
5641
+ __name4(runCancelView, "runCancelView");
5520
5642
  function runWorkspaceView(ws) {
5521
5643
  if (!ws) return void 0;
5522
5644
  const w = ws;
@@ -5531,7 +5653,7 @@ function runWorkspaceView(ws) {
5531
5653
  });
5532
5654
  }
5533
5655
  __name(runWorkspaceView, "runWorkspaceView");
5534
- __name3(runWorkspaceView, "runWorkspaceView");
5656
+ __name4(runWorkspaceView, "runWorkspaceView");
5535
5657
  function toWorkflowRunSummary(run) {
5536
5658
  const status = run.status;
5537
5659
  const principal = run.principal?.principal;
@@ -5603,7 +5725,7 @@ function toWorkflowRunSummary(run) {
5603
5725
  });
5604
5726
  }
5605
5727
  __name(toWorkflowRunSummary, "toWorkflowRunSummary");
5606
- __name3(toWorkflowRunSummary, "toWorkflowRunSummary");
5728
+ __name4(toWorkflowRunSummary, "toWorkflowRunSummary");
5607
5729
  var STEP_ERROR_DETAIL_KEYS = [
5608
5730
  "reason",
5609
5731
  "key",
@@ -5632,7 +5754,17 @@ var STEP_ERROR_DETAIL_KEYS = [
5632
5754
  "workflowId",
5633
5755
  // LUA-696 (review 2): the `ctx.once` key of an `effect_in_doubt` park — the step site stamps it here (scrubbed)
5634
5756
  // beside `park.effectKey`; a key is user text and leaves scrubbed like every other string leaf.
5635
- "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"
5636
5768
  ];
5637
5769
  var STEP_ERROR_DETAIL_MAX_BYTES = 8 * 1024;
5638
5770
  var DETAIL_MAX_DEPTH = 4;
@@ -5655,7 +5787,7 @@ function scrubDetailValue(value22, depth) {
5655
5787
  return void 0;
5656
5788
  }
5657
5789
  __name(scrubDetailValue, "scrubDetailValue");
5658
- __name3(scrubDetailValue, "scrubDetailValue");
5790
+ __name4(scrubDetailValue, "scrubDetailValue");
5659
5791
  function stepErrorDetail(error) {
5660
5792
  if (!error || typeof error !== "object") return void 0;
5661
5793
  const d = error.detail;
@@ -5683,7 +5815,7 @@ function stepErrorDetail(error) {
5683
5815
  };
5684
5816
  }
5685
5817
  __name(stepErrorDetail, "stepErrorDetail");
5686
- __name3(stepErrorDetail, "stepErrorDetail");
5818
+ __name4(stepErrorDetail, "stepErrorDetail");
5687
5819
  var MAX_HOLIDAYS = 366;
5688
5820
  var MAX_WALK_DAYS = 400;
5689
5821
  var HHMM = /^([01]\d|2[0-3]):([0-5]\d)$/;
@@ -5719,10 +5851,10 @@ function timeZoneSupported(tz) {
5719
5851
  }
5720
5852
  }
5721
5853
  __name(timeZoneSupported, "timeZoneSupported");
5722
- __name3(timeZoneSupported, "timeZoneSupported");
5854
+ __name4(timeZoneSupported, "timeZoneSupported");
5723
5855
  function validateBusinessHours(cal, path = "businessHours") {
5724
5856
  const issues = [];
5725
- const issue = /* @__PURE__ */ __name3((p, message) => issues.push({
5857
+ const issue = /* @__PURE__ */ __name4((p, message) => issues.push({
5726
5858
  code: "business-hours-invalid",
5727
5859
  path: p,
5728
5860
  message
@@ -5762,24 +5894,24 @@ function validateBusinessHours(cal, path = "businessHours") {
5762
5894
  return issues;
5763
5895
  }
5764
5896
  __name(validateBusinessHours, "validateBusinessHours");
5765
- __name3(validateBusinessHours, "validateBusinessHours");
5897
+ __name4(validateBusinessHours, "validateBusinessHours");
5766
5898
  function toMinutes(hhmm) {
5767
5899
  const m = HHMM.exec(hhmm);
5768
5900
  return Number(m[1]) * 60 + Number(m[2]);
5769
5901
  }
5770
5902
  __name(toMinutes, "toMinutes");
5771
- __name3(toMinutes, "toMinutes");
5903
+ __name4(toMinutes, "toMinutes");
5772
5904
  function resolveCalendar(cal) {
5773
5905
  return cal.calendar === void 0 || cal.calendar === "mon-fri" ? MON_FRI : cal.calendar;
5774
5906
  }
5775
5907
  __name(resolveCalendar, "resolveCalendar");
5776
- __name3(resolveCalendar, "resolveCalendar");
5908
+ __name4(resolveCalendar, "resolveCalendar");
5777
5909
  function assertValid(cal) {
5778
5910
  const issues = validateBusinessHours(cal);
5779
5911
  if (issues.length > 0) throw new RangeError(`business-hours-invalid: ${issues.map((i) => i.path).join(", ")}`);
5780
5912
  }
5781
5913
  __name(assertValid, "assertValid");
5782
- __name3(assertValid, "assertValid");
5914
+ __name4(assertValid, "assertValid");
5783
5915
  var fmtCache = /* @__PURE__ */ new Map();
5784
5916
  function formatter(tz) {
5785
5917
  let f = fmtCache.get(tz);
@@ -5799,7 +5931,7 @@ function formatter(tz) {
5799
5931
  return f;
5800
5932
  }
5801
5933
  __name(formatter, "formatter");
5802
- __name3(formatter, "formatter");
5934
+ __name4(formatter, "formatter");
5803
5935
  var WEEKDAYS = {
5804
5936
  Sun: 0,
5805
5937
  Mon: 1,
@@ -5811,7 +5943,7 @@ var WEEKDAYS = {
5811
5943
  };
5812
5944
  function localParts(ms, tz) {
5813
5945
  const parts = formatter(tz).formatToParts(new Date(ms));
5814
- 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");
5815
5947
  const hour = Number(get("hour")) % 24;
5816
5948
  return {
5817
5949
  year: Number(get("year")),
@@ -5823,7 +5955,7 @@ function localParts(ms, tz) {
5823
5955
  };
5824
5956
  }
5825
5957
  __name(localParts, "localParts");
5826
- __name3(localParts, "localParts");
5958
+ __name4(localParts, "localParts");
5827
5959
  function offsetAt(ms, tz) {
5828
5960
  const p = localParts(ms, tz);
5829
5961
  const asUtc = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, 0, 0);
@@ -5831,7 +5963,7 @@ function offsetAt(ms, tz) {
5831
5963
  return asUtc - floored;
5832
5964
  }
5833
5965
  __name(offsetAt, "offsetAt");
5834
- __name3(offsetAt, "offsetAt");
5966
+ __name4(offsetAt, "offsetAt");
5835
5967
  function localToUtc(y, m, d, minutes, tz) {
5836
5968
  const wall = Date.UTC(y, m - 1, d, Math.floor(minutes / 60), minutes % 60, 0, 0);
5837
5969
  const guess = wall - offsetAt(wall, tz);
@@ -5853,18 +5985,18 @@ function localToUtc(y, m, d, minutes, tz) {
5853
5985
  return probe;
5854
5986
  }
5855
5987
  __name(localToUtc, "localToUtc");
5856
- __name3(localToUtc, "localToUtc");
5988
+ __name4(localToUtc, "localToUtc");
5857
5989
  function sameWall(ms, y, m, d, minutes, tz) {
5858
5990
  const p = localParts(ms, tz);
5859
5991
  return p.year === y && p.month === m && p.day === d && p.hour * 60 + p.minute === minutes;
5860
5992
  }
5861
5993
  __name(sameWall, "sameWall");
5862
- __name3(sameWall, "sameWall");
5994
+ __name4(sameWall, "sameWall");
5863
5995
  function ymd(p) {
5864
5996
  return `${p.year}-${String(p.month).padStart(2, "0")}-${String(p.day).padStart(2, "0")}`;
5865
5997
  }
5866
5998
  __name(ymd, "ymd");
5867
- __name3(ymd, "ymd");
5999
+ __name4(ymd, "ymd");
5868
6000
  function windowOf(ms, tz, k, holidays) {
5869
6001
  const p = localParts(ms, tz);
5870
6002
  if (!k.days.includes(p.weekday) || holidays.has(ymd(p))) return null;
@@ -5874,14 +6006,14 @@ function windowOf(ms, tz, k, holidays) {
5874
6006
  };
5875
6007
  }
5876
6008
  __name(windowOf, "windowOf");
5877
- __name3(windowOf, "windowOf");
6009
+ __name4(windowOf, "windowOf");
5878
6010
  function nextDayAnchor(ms, tz) {
5879
6011
  const p = localParts(ms, tz);
5880
6012
  const next = new Date(Date.UTC(p.year, p.month - 1, p.day) + MS_PER_DAY);
5881
6013
  return localToUtc(next.getUTCFullYear(), next.getUTCMonth() + 1, next.getUTCDate(), 0, tz);
5882
6014
  }
5883
6015
  __name(nextDayAnchor, "nextDayAnchor");
5884
- __name3(nextDayAnchor, "nextDayAnchor");
6016
+ __name4(nextDayAnchor, "nextDayAnchor");
5885
6017
  function addBusinessTime(fromMs, hours, cal) {
5886
6018
  assertValid(cal);
5887
6019
  if (!Number.isFinite(fromMs) || !Number.isFinite(hours)) throw new RangeError("addBusinessTime: non-finite input");
@@ -5902,7 +6034,7 @@ function addBusinessTime(fromMs, hours, cal) {
5902
6034
  throw new RangeError("addBusinessTime: walk exceeded the calendar bound");
5903
6035
  }
5904
6036
  __name(addBusinessTime, "addBusinessTime");
5905
- __name3(addBusinessTime, "addBusinessTime");
6037
+ __name4(addBusinessTime, "addBusinessTime");
5906
6038
  function roundToBusinessTime(atMs, cal, round = "next-open") {
5907
6039
  assertValid(cal);
5908
6040
  if (!Number.isFinite(atMs)) throw new RangeError("roundToBusinessTime: non-finite input");
@@ -5920,7 +6052,7 @@ function roundToBusinessTime(atMs, cal, round = "next-open") {
5920
6052
  throw new RangeError("roundToBusinessTime: walk exceeded the calendar bound");
5921
6053
  }
5922
6054
  __name(roundToBusinessTime, "roundToBusinessTime");
5923
- __name3(roundToBusinessTime, "roundToBusinessTime");
6055
+ __name4(roundToBusinessTime, "roundToBusinessTime");
5924
6056
  function isBusinessTime(atMs, cal) {
5925
6057
  assertValid(cal);
5926
6058
  const k = resolveCalendar(cal);
@@ -5928,7 +6060,7 @@ function isBusinessTime(atMs, cal) {
5928
6060
  return !!w && atMs >= w.open && atMs < w.close;
5929
6061
  }
5930
6062
  __name(isBusinessTime, "isBusinessTime");
5931
- __name3(isBusinessTime, "isBusinessTime");
6063
+ __name4(isBusinessTime, "isBusinessTime");
5932
6064
  var JSON_PATCH_OPS = [
5933
6065
  "replace",
5934
6066
  "add",
@@ -5962,12 +6094,12 @@ function parseEditablePath(entry) {
5962
6094
  return out;
5963
6095
  }
5964
6096
  __name(parseEditablePath, "parseEditablePath");
5965
- __name3(parseEditablePath, "parseEditablePath");
6097
+ __name4(parseEditablePath, "parseEditablePath");
5966
6098
  function isEditablePathEntry(entry) {
5967
6099
  return typeof entry === "string" && parseEditablePath(entry) !== null;
5968
6100
  }
5969
6101
  __name(isEditablePathEntry, "isEditablePathEntry");
5970
- __name3(isEditablePathEntry, "isEditablePathEntry");
6102
+ __name4(isEditablePathEntry, "isEditablePathEntry");
5971
6103
  function pointerToSegments(pointer) {
5972
6104
  if (typeof pointer !== "string" || pointer.length === 0 || pointer[0] !== "/") return null;
5973
6105
  const decoded = pointer.slice(1).split("/").map((s) => s.replace(/~1/g, "/").replace(/~0/g, "~"));
@@ -5975,7 +6107,7 @@ function pointerToSegments(pointer) {
5975
6107
  return decoded.map((s) => s === "-" ? "-" : /^(0|[1-9]\d*)$/.test(s) ? Number(s) : s);
5976
6108
  }
5977
6109
  __name(pointerToSegments, "pointerToSegments");
5978
- __name3(pointerToSegments, "pointerToSegments");
6110
+ __name4(pointerToSegments, "pointerToSegments");
5979
6111
  function pointerToDotPath(pointer) {
5980
6112
  const segs = pointerToSegments(pointer);
5981
6113
  if (!segs) return pointer;
@@ -5988,7 +6120,7 @@ function pointerToDotPath(pointer) {
5988
6120
  return out;
5989
6121
  }
5990
6122
  __name(pointerToDotPath, "pointerToDotPath");
5991
- __name3(pointerToDotPath, "pointerToDotPath");
6123
+ __name4(pointerToDotPath, "pointerToDotPath");
5992
6124
  function coveredBy(segs, entry, op) {
5993
6125
  if (segs.length < entry.length) return false;
5994
6126
  for (let i = 0; i < entry.length; i += 1) {
@@ -6008,7 +6140,7 @@ function coveredBy(segs, entry, op) {
6008
6140
  return true;
6009
6141
  }
6010
6142
  __name(coveredBy, "coveredBy");
6011
- __name3(coveredBy, "coveredBy");
6143
+ __name4(coveredBy, "coveredBy");
6012
6144
  function matchesEditablePath(pointer, editablePaths, op = "replace") {
6013
6145
  const segs = pointerToSegments(pointer);
6014
6146
  if (!segs || segs.length === 0) return false;
@@ -6019,10 +6151,10 @@ function matchesEditablePath(pointer, editablePaths, op = "replace") {
6019
6151
  return false;
6020
6152
  }
6021
6153
  __name(matchesEditablePath, "matchesEditablePath");
6022
- __name3(matchesEditablePath, "matchesEditablePath");
6154
+ __name4(matchesEditablePath, "matchesEditablePath");
6023
6155
  function changedPointers(before, after, base = "") {
6024
6156
  if (before === after) return [];
6025
- 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");
6026
6158
  if (Array.isArray(before) && Array.isArray(after)) {
6027
6159
  if (before.length !== after.length) return [
6028
6160
  base || "/"
@@ -6055,12 +6187,12 @@ function changedPointers(before, after, base = "") {
6055
6187
  ];
6056
6188
  }
6057
6189
  __name(changedPointers, "changedPointers");
6058
- __name3(changedPointers, "changedPointers");
6190
+ __name4(changedPointers, "changedPointers");
6059
6191
  function escapePointer(key) {
6060
6192
  return key.replace(/~/g, "~0").replace(/\//g, "~1");
6061
6193
  }
6062
6194
  __name(escapePointer, "escapePointer");
6063
- __name3(escapePointer, "escapePointer");
6195
+ __name4(escapePointer, "escapePointer");
6064
6196
  function validateJsonPatch(ops) {
6065
6197
  if (!Array.isArray(ops)) return {
6066
6198
  ok: false,
@@ -6130,7 +6262,7 @@ function validateJsonPatch(ops) {
6130
6262
  };
6131
6263
  }
6132
6264
  __name(validateJsonPatch, "validateJsonPatch");
6133
- __name3(validateJsonPatch, "validateJsonPatch");
6265
+ __name4(validateJsonPatch, "validateJsonPatch");
6134
6266
  function applyJsonPatch(doc, ops) {
6135
6267
  let value22 = structuredClone(doc);
6136
6268
  for (let i = 0; i < ops.length; i += 1) {
@@ -6231,13 +6363,13 @@ function applyJsonPatch(doc, ops) {
6231
6363
  };
6232
6364
  }
6233
6365
  __name(applyJsonPatch, "applyJsonPatch");
6234
- __name3(applyJsonPatch, "applyJsonPatch");
6366
+ __name4(applyJsonPatch, "applyJsonPatch");
6235
6367
  function rebaseItemPointer(pointer, itemsPath, index) {
6236
6368
  const base = `/${itemsPath.split(".").map(escapePointer).join("/")}/${index}`;
6237
6369
  return pointer === "/" || pointer === "" ? base : `${base}${pointer}`;
6238
6370
  }
6239
6371
  __name(rebaseItemPointer, "rebaseItemPointer");
6240
- __name3(rebaseItemPointer, "rebaseItemPointer");
6372
+ __name4(rebaseItemPointer, "rebaseItemPointer");
6241
6373
  var WORKFLOW_SCHEDULE_TYPES = [
6242
6374
  "cron",
6243
6375
  "interval",
@@ -6245,10 +6377,14 @@ var WORKFLOW_SCHEDULE_TYPES = [
6245
6377
  ];
6246
6378
  var WORKFLOW_SCHEDULE_SHAPE_ISSUE = "schedule-shape-invalid";
6247
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>' }";
6248
- var isObject = /* @__PURE__ */ __name3((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isObject");
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");
6249
6385
  function validateWorkflowSchedule(schedule, path = "/schedule") {
6250
6386
  if (schedule === void 0 || schedule === null) return [];
6251
- const issue = /* @__PURE__ */ __name3((at, detail) => [
6387
+ const issue = /* @__PURE__ */ __name4((at, detail) => [
6252
6388
  {
6253
6389
  code: WORKFLOW_SCHEDULE_SHAPE_ISSUE,
6254
6390
  severity: "error",
@@ -6268,6 +6404,9 @@ function validateWorkflowSchedule(schedule, path = "/schedule") {
6268
6404
  if (typeof type !== "string" || !WORKFLOW_SCHEDULE_TYPES.includes(type)) {
6269
6405
  return issue(path, `\`schedule.type\` ${JSON.stringify(type)} is not one of ${WORKFLOW_SCHEDULE_TYPES.map((t) => `'${t}'`).join(" | ")}`);
6270
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
+ }
6271
6410
  switch (type) {
6272
6411
  case "cron": {
6273
6412
  if (typeof schedule.expression !== "string" || schedule.expression.trim().length === 0) {
@@ -6294,15 +6433,15 @@ function validateWorkflowSchedule(schedule, path = "/schedule") {
6294
6433
  }
6295
6434
  }
6296
6435
  __name(validateWorkflowSchedule, "validateWorkflowSchedule");
6297
- __name3(validateWorkflowSchedule, "validateWorkflowSchedule");
6436
+ __name4(validateWorkflowSchedule, "validateWorkflowSchedule");
6298
6437
  var WORKFLOW_ENV_OVERLAY_MAX_KEYS = 64;
6299
6438
  var WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES = 4096;
6300
6439
  var WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE = /(SECRET|TOKEN|KEY|PASSWORD)$/;
6301
- var isEnvRef = /* @__PURE__ */ __name3((v) => typeof v === "object" && v !== null && !Array.isArray(v) && typeof v.__envRef === "string" && Object.keys(v).length === 1, "isEnvRef");
6302
- 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");
6303
6442
  function collectEnvTemplateKeys(value22) {
6304
6443
  const keys = /* @__PURE__ */ new Set();
6305
- const walk2 = /* @__PURE__ */ __name3((v) => {
6444
+ const walk2 = /* @__PURE__ */ __name4((v) => {
6306
6445
  if (isEnvRef(v)) {
6307
6446
  keys.add(v.__envRef);
6308
6447
  return;
@@ -6328,10 +6467,10 @@ function collectEnvTemplateKeys(value22) {
6328
6467
  ].sort();
6329
6468
  }
6330
6469
  __name(collectEnvTemplateKeys, "collectEnvTemplateKeys");
6331
- __name3(collectEnvTemplateKeys, "collectEnvTemplateKeys");
6470
+ __name4(collectEnvTemplateKeys, "collectEnvTemplateKeys");
6332
6471
  function substituteEnvRefs(value22, overlay) {
6333
6472
  const missing = /* @__PURE__ */ new Set();
6334
- const walk2 = /* @__PURE__ */ __name3((v, slot = false) => {
6473
+ const walk2 = /* @__PURE__ */ __name4((v, slot = false) => {
6335
6474
  if (isEnvRef(v)) {
6336
6475
  if (Object.prototype.hasOwnProperty.call(overlay, v.__envRef)) {
6337
6476
  const s = overlay[v.__envRef];
@@ -6370,13 +6509,13 @@ function substituteEnvRefs(value22, overlay) {
6370
6509
  };
6371
6510
  }
6372
6511
  __name(substituteEnvRefs, "substituteEnvRefs");
6373
- __name3(substituteEnvRefs, "substituteEnvRefs");
6512
+ __name4(substituteEnvRefs, "substituteEnvRefs");
6374
6513
  function hashEnvOverlay(overlay) {
6375
6514
  if (overlay === void 0 || overlay === null) return void 0;
6376
6515
  return GRAPH_HASH_PREFIX + createHash2("sha256").update(canonicalJson(overlay)).digest("hex");
6377
6516
  }
6378
6517
  __name(hashEnvOverlay, "hashEnvOverlay");
6379
- __name3(hashEnvOverlay, "hashEnvOverlay");
6518
+ __name4(hashEnvOverlay, "hashEnvOverlay");
6380
6519
  function validateEnvOverlay(keys, overlay, limits = {}) {
6381
6520
  const maxKeys = limits.maxKeys ?? WORKFLOW_ENV_OVERLAY_MAX_KEYS;
6382
6521
  const maxValueBytes = limits.maxValueBytes ?? WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES;
@@ -6415,7 +6554,7 @@ function validateEnvOverlay(keys, overlay, limits = {}) {
6415
6554
  return issues;
6416
6555
  }
6417
6556
  __name(validateEnvOverlay, "validateEnvOverlay");
6418
- __name3(validateEnvOverlay, "validateEnvOverlay");
6557
+ __name4(validateEnvOverlay, "validateEnvOverlay");
6419
6558
  var ZERO = {
6420
6559
  steps: {
6421
6560
  min: 0,
@@ -6441,7 +6580,7 @@ function add(a, b) {
6441
6580
  };
6442
6581
  }
6443
6582
  __name(add, "add");
6444
- __name3(add, "add");
6583
+ __name4(add, "add");
6445
6584
  function scale(r, lo, hi) {
6446
6585
  return {
6447
6586
  steps: {
@@ -6456,12 +6595,12 @@ function scale(r, lo, hi) {
6456
6595
  };
6457
6596
  }
6458
6597
  __name(scale, "scale");
6459
- __name3(scale, "scale");
6598
+ __name4(scale, "scale");
6460
6599
  function armEntry(arm) {
6461
6600
  return Array.isArray(arm) ? arm[arm.length - 1] : arm;
6462
6601
  }
6463
6602
  __name(armEntry, "armEntry");
6464
- __name3(armEntry, "armEntry");
6603
+ __name4(armEntry, "armEntry");
6465
6604
  function ofEntry(e) {
6466
6605
  if (!e || typeof e !== "object") return ZERO;
6467
6606
  const n2 = e;
@@ -6550,7 +6689,7 @@ function ofEntry(e) {
6550
6689
  }
6551
6690
  }
6552
6691
  __name(ofEntry, "ofEntry");
6553
- __name3(ofEntry, "ofEntry");
6692
+ __name4(ofEntry, "ofEntry");
6554
6693
  function estimateGraph(envelopeOrGraph) {
6555
6694
  const graph = Array.isArray(envelopeOrGraph) ? envelopeOrGraph : envelopeOrGraph?.definition?.graph ?? [];
6556
6695
  const r = graph.map(ofEntry).reduce(add, ZERO);
@@ -6566,8 +6705,8 @@ function estimateGraph(envelopeOrGraph) {
6566
6705
  };
6567
6706
  }
6568
6707
  __name(estimateGraph, "estimateGraph");
6569
- __name3(estimateGraph, "estimateGraph");
6570
- 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");
6571
6710
  function* singleStepsOf(entry) {
6572
6711
  if (!isRecord2(entry)) return;
6573
6712
  switch (entry.type) {
@@ -6593,14 +6732,14 @@ function* singleStepsOf(entry) {
6593
6732
  }
6594
6733
  }
6595
6734
  __name(singleStepsOf, "singleStepsOf");
6596
- __name3(singleStepsOf, "singleStepsOf");
6735
+ __name4(singleStepsOf, "singleStepsOf");
6597
6736
  function entriesOf(graph) {
6598
6737
  const definition = isRecord2(graph) ? graph.definition : void 0;
6599
6738
  const entries = isRecord2(definition) ? definition.graph : void 0;
6600
6739
  return Array.isArray(entries) ? entries : [];
6601
6740
  }
6602
6741
  __name(entriesOf, "entriesOf");
6603
- __name3(entriesOf, "entriesOf");
6742
+ __name4(entriesOf, "entriesOf");
6604
6743
  function inheritTargets(graphs) {
6605
6744
  const targets = /* @__PURE__ */ new Set();
6606
6745
  for (const graph of graphs) {
@@ -6615,7 +6754,7 @@ function inheritTargets(graphs) {
6615
6754
  return targets;
6616
6755
  }
6617
6756
  __name(inheritTargets, "inheritTargets");
6618
- __name3(inheritTargets, "inheritTargets");
6757
+ __name4(inheritTargets, "inheritTargets");
6619
6758
  function needsInheritedWorkspace(graph) {
6620
6759
  if (!isRecord2(graph) || graph.workspace !== void 0) return false;
6621
6760
  for (const entry of entriesOf(graph)) {
@@ -6626,7 +6765,7 @@ function needsInheritedWorkspace(graph) {
6626
6765
  return false;
6627
6766
  }
6628
6767
  __name(needsInheritedWorkspace, "needsInheritedWorkspace");
6629
- __name3(needsInheritedWorkspace, "needsInheritedWorkspace");
6768
+ __name4(needsInheritedWorkspace, "needsInheritedWorkspace");
6630
6769
 
6631
6770
  // src/types/workflow.ts
6632
6771
  function createStep(s) {
@@ -6768,6 +6907,7 @@ var envRefKeys = /* @__PURE__ */ __name((v, into) => {
6768
6907
  }
6769
6908
  for (const inner of Object.values(v)) envRefKeys(inner, into);
6770
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");
6771
6911
  var refToDescriptor = /* @__PURE__ */ __name((items) => {
6772
6912
  if (!items) throw new LuaWorkflowBuildError("invalid-envelope", "foreach.items needs a ref");
6773
6913
  if ("initData" in items && items.initData === true) {
@@ -6777,11 +6917,14 @@ var refToDescriptor = /* @__PURE__ */ __name((items) => {
6777
6917
  };
6778
6918
  }
6779
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)");
6780
6921
  return {
6781
6922
  step: items.step,
6782
6923
  path: items.path
6783
6924
  };
6784
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)");
6785
6928
  const path = items.path;
6786
6929
  if (path.startsWith("initData")) return {
6787
6930
  initData: true,