lua-cli 3.32.6 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-exports.d.ts +100 -20
- package/dist/api-exports.js +1417 -713
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +2457 -1296
- package/dist/index.js.map +1 -1
- package/dist/workflow-builder.d.ts +21 -8
- package/dist/workflow-builder.js +724 -269
- package/dist/workflow-builder.js.map +1 -1
- package/docs/CLI_REFERENCE.md +13 -11
- package/docs/README.md +2 -2
- package/docs/api/AI.md +9 -8
- package/docs/api/LuaAgent.md +5 -5
- package/docs/api/LuaWorkflow.md +16 -16
- package/docs/workflows/artefacts-and-datasets.md +4 -0
- package/docs/workflows/workspaces-and-long-steps.md +2 -2
- package/package.json +6 -5
- package/template/examples/workflows/linear-ready.trigger.ts +20 -9
- package/template/package.json +1 -1
package/dist/workflow-builder.js
CHANGED
|
@@ -100,6 +100,14 @@ function isAllowedReviewableExecuteTool(tool) {
|
|
|
100
100
|
}
|
|
101
101
|
__name(isAllowedReviewableExecuteTool, "isAllowedReviewableExecuteTool");
|
|
102
102
|
__name2(isAllowedReviewableExecuteTool, "isAllowedReviewableExecuteTool");
|
|
103
|
+
var REVIEWABLE_STANDING_START_TOOLS = [
|
|
104
|
+
"scheduleWorkflow"
|
|
105
|
+
];
|
|
106
|
+
function isReviewableStandingStartTool(tool) {
|
|
107
|
+
return REVIEWABLE_STANDING_START_TOOLS.includes(tool);
|
|
108
|
+
}
|
|
109
|
+
__name(isReviewableStandingStartTool, "isReviewableStandingStartTool");
|
|
110
|
+
__name2(isReviewableStandingStartTool, "isReviewableStandingStartTool");
|
|
103
111
|
var REVIEWABLE_MCP_SEND_TOOL_SUFFIX = "_create_messaging_message";
|
|
104
112
|
function isReviewableMcpSendTool(tool) {
|
|
105
113
|
return tool.length > REVIEWABLE_MCP_SEND_TOOL_SUFFIX.length && tool.endsWith(REVIEWABLE_MCP_SEND_TOOL_SUFFIX);
|
|
@@ -152,7 +160,7 @@ function mcpSendSiblingForDraftTool(tool, availableToolIds) {
|
|
|
152
160
|
__name(mcpSendSiblingForDraftTool, "mcpSendSiblingForDraftTool");
|
|
153
161
|
__name2(mcpSendSiblingForDraftTool, "mcpSendSiblingForDraftTool");
|
|
154
162
|
function isReviewableExecuteTool(tool) {
|
|
155
|
-
return isAllowedReviewableExecuteTool(tool) || isReviewableMcpSendTool(tool);
|
|
163
|
+
return isAllowedReviewableExecuteTool(tool) || isReviewableMcpSendTool(tool) || isReviewableStandingStartTool(tool);
|
|
156
164
|
}
|
|
157
165
|
__name(isReviewableExecuteTool, "isReviewableExecuteTool");
|
|
158
166
|
__name2(isReviewableExecuteTool, "isReviewableExecuteTool");
|
|
@@ -312,7 +320,10 @@ function transformChatHistoryContentParts(parts) {
|
|
|
312
320
|
content.push({
|
|
313
321
|
type: "file",
|
|
314
322
|
data: part.data,
|
|
315
|
-
mediaType
|
|
323
|
+
mediaType,
|
|
324
|
+
...part.filename && {
|
|
325
|
+
filename: part.filename
|
|
326
|
+
}
|
|
316
327
|
});
|
|
317
328
|
}
|
|
318
329
|
}
|
|
@@ -1206,6 +1217,70 @@ function normalizeLuaJobExecutionTimeoutSeconds(timeout) {
|
|
|
1206
1217
|
}
|
|
1207
1218
|
__name(normalizeLuaJobExecutionTimeoutSeconds, "normalizeLuaJobExecutionTimeoutSeconds");
|
|
1208
1219
|
__name2(normalizeLuaJobExecutionTimeoutSeconds, "normalizeLuaJobExecutionTimeoutSeconds");
|
|
1220
|
+
var KEYS = /* @__PURE__ */ new Set([
|
|
1221
|
+
"v",
|
|
1222
|
+
"kind",
|
|
1223
|
+
"agentId",
|
|
1224
|
+
"jobId",
|
|
1225
|
+
"scheduledTime",
|
|
1226
|
+
"triggerId"
|
|
1227
|
+
]);
|
|
1228
|
+
var MAX_BODY_BYTES = 4096;
|
|
1229
|
+
var MAX_ID_LENGTH = 512;
|
|
1230
|
+
var UTC_ISO = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/;
|
|
1231
|
+
function isId(value3) {
|
|
1232
|
+
return typeof value3 === "string" && value3.length > 0 && value3.length <= MAX_ID_LENGTH;
|
|
1233
|
+
}
|
|
1234
|
+
__name(isId, "isId");
|
|
1235
|
+
__name2(isId, "isId");
|
|
1236
|
+
function parseScheduledJobFire(raw) {
|
|
1237
|
+
if (new TextEncoder().encode(raw).byteLength > MAX_BODY_BYTES) {
|
|
1238
|
+
throw new Error("Invalid scheduled job fire: body is too large");
|
|
1239
|
+
}
|
|
1240
|
+
let value3;
|
|
1241
|
+
try {
|
|
1242
|
+
value3 = JSON.parse(raw);
|
|
1243
|
+
} catch {
|
|
1244
|
+
throw new Error("Invalid scheduled job fire: body is not JSON");
|
|
1245
|
+
}
|
|
1246
|
+
if (!value3 || typeof value3 !== "object" || Array.isArray(value3)) {
|
|
1247
|
+
throw new Error("Invalid scheduled job fire: body must be an object");
|
|
1248
|
+
}
|
|
1249
|
+
const record = value3;
|
|
1250
|
+
if (Object.keys(record).some((key) => !KEYS.has(key))) {
|
|
1251
|
+
throw new Error("Invalid scheduled job fire: unknown field");
|
|
1252
|
+
}
|
|
1253
|
+
if (record.v !== 1 || record.kind !== "scheduled-job-fire") {
|
|
1254
|
+
throw new Error("Invalid scheduled job fire: unsupported contract");
|
|
1255
|
+
}
|
|
1256
|
+
if (!isId(record.agentId)) {
|
|
1257
|
+
throw new Error("Invalid scheduled job fire: agentId is required");
|
|
1258
|
+
}
|
|
1259
|
+
if (!isId(record.jobId)) {
|
|
1260
|
+
throw new Error("Invalid scheduled job fire: jobId is required");
|
|
1261
|
+
}
|
|
1262
|
+
if (typeof record.scheduledTime !== "string" || !UTC_ISO.test(record.scheduledTime) || !Number.isFinite(Date.parse(record.scheduledTime)) || ![
|
|
1263
|
+
new Date(record.scheduledTime).toISOString(),
|
|
1264
|
+
new Date(record.scheduledTime).toISOString().replace(".000Z", "Z")
|
|
1265
|
+
].includes(record.scheduledTime)) {
|
|
1266
|
+
throw new Error("Invalid scheduled job fire: scheduledTime must be ISO 8601");
|
|
1267
|
+
}
|
|
1268
|
+
if (record.triggerId !== void 0 && !isId(record.triggerId)) {
|
|
1269
|
+
throw new Error("Invalid scheduled job fire: triggerId must be a non-empty string");
|
|
1270
|
+
}
|
|
1271
|
+
return {
|
|
1272
|
+
v: 1,
|
|
1273
|
+
kind: "scheduled-job-fire",
|
|
1274
|
+
agentId: record.agentId,
|
|
1275
|
+
jobId: record.jobId,
|
|
1276
|
+
scheduledTime: record.scheduledTime,
|
|
1277
|
+
...typeof record.triggerId === "string" ? {
|
|
1278
|
+
triggerId: record.triggerId
|
|
1279
|
+
} : {}
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
__name(parseScheduledJobFire, "parseScheduledJobFire");
|
|
1283
|
+
__name2(parseScheduledJobFire, "parseScheduledJobFire");
|
|
1209
1284
|
var TEMPLATE_TRIGGER_URL_ENV_PREFIX = "LUA_TRIGGER_URL__";
|
|
1210
1285
|
function triggerUrlEnvKey(triggerKey) {
|
|
1211
1286
|
const upper = triggerKey.trim().replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
@@ -1213,6 +1288,10 @@ function triggerUrlEnvKey(triggerKey) {
|
|
|
1213
1288
|
}
|
|
1214
1289
|
__name(triggerUrlEnvKey, "triggerUrlEnvKey");
|
|
1215
1290
|
__name2(triggerUrlEnvKey, "triggerUrlEnvKey");
|
|
1291
|
+
var TEMPLATE_INSTALL_POLICY_PER_WORKSPACE_VALUES = Object.freeze([
|
|
1292
|
+
"single",
|
|
1293
|
+
"multiple"
|
|
1294
|
+
]);
|
|
1216
1295
|
var SUBJECT_TYPES = [
|
|
1217
1296
|
"user",
|
|
1218
1297
|
"apiKey",
|
|
@@ -1546,7 +1625,20 @@ var ProjectedResourceSchema = z3.object({
|
|
|
1546
1625
|
"platform-allowlist"
|
|
1547
1626
|
]),
|
|
1548
1627
|
/** Product data only. A roster row confers nothing. */
|
|
1549
|
-
rostered: z3.boolean()
|
|
1628
|
+
rostered: z3.boolean(),
|
|
1629
|
+
/**
|
|
1630
|
+
* Ownership, product data only (PRO-1754). `createdBy` is the creating
|
|
1631
|
+
* user's id straight off the sub-agent document; `owner` is that id
|
|
1632
|
+
* resolved to a display identity after the list is decided. Both are
|
|
1633
|
+
* absent when the document records no creator or the lookup fails —
|
|
1634
|
+
* they never influence which resources are listed.
|
|
1635
|
+
*/
|
|
1636
|
+
createdBy: z3.string().min(1).max(256).optional(),
|
|
1637
|
+
owner: z3.object({
|
|
1638
|
+
id: z3.string().min(1).max(256),
|
|
1639
|
+
name: z3.string().optional(),
|
|
1640
|
+
email: z3.string().optional()
|
|
1641
|
+
}).optional()
|
|
1550
1642
|
}).passthrough();
|
|
1551
1643
|
var CapabilityProfilesSchema = z3.record(z3.string().min(1).max(64), z3.array(ProjectedScopeSchema));
|
|
1552
1644
|
var RoleCatalogSchema = z3.record(z3.string().min(1).max(128), z3.object({
|
|
@@ -1725,6 +1817,15 @@ var WORKFLOW_RUN_STATUSES = [
|
|
|
1725
1817
|
...WORKFLOW_RUN_IDLE,
|
|
1726
1818
|
...WORKFLOW_RUN_TERMINAL
|
|
1727
1819
|
];
|
|
1820
|
+
var WORKFLOW_RUN_GATE_KINDS = [
|
|
1821
|
+
"start-consent",
|
|
1822
|
+
"quota",
|
|
1823
|
+
"billing",
|
|
1824
|
+
"org_archived",
|
|
1825
|
+
"disabled",
|
|
1826
|
+
"exception",
|
|
1827
|
+
"budget"
|
|
1828
|
+
];
|
|
1728
1829
|
var WORKFLOW_STEP_STATUSES = [
|
|
1729
1830
|
"pending",
|
|
1730
1831
|
"ready",
|
|
@@ -1746,6 +1847,16 @@ var WORKFLOW_STEP_IN_FLIGHT = [
|
|
|
1746
1847
|
"running",
|
|
1747
1848
|
"cancellation_requested"
|
|
1748
1849
|
];
|
|
1850
|
+
var WORKFLOW_SIGNAL_EVENT_SITES = [
|
|
1851
|
+
"webhook",
|
|
1852
|
+
"trigger",
|
|
1853
|
+
"device-trigger"
|
|
1854
|
+
];
|
|
1855
|
+
function isWorkflowSignalEventSite(value3) {
|
|
1856
|
+
return typeof value3 === "string" && WORKFLOW_SIGNAL_EVENT_SITES.includes(value3);
|
|
1857
|
+
}
|
|
1858
|
+
__name(isWorkflowSignalEventSite, "isWorkflowSignalEventSite");
|
|
1859
|
+
__name2(isWorkflowSignalEventSite, "isWorkflowSignalEventSite");
|
|
1749
1860
|
var ARCHIVE_WINDOW_MARGIN_DAYS = 7;
|
|
1750
1861
|
function shouldSkipArchive(run, manifestSha256, sinkSha256) {
|
|
1751
1862
|
if (!run.completedAt || !run.exportedAt || run.exportedAt < run.completedAt) return false;
|
|
@@ -1858,6 +1969,16 @@ function scheduledWorkflowRunIdForTime(jobId, scheduledTime) {
|
|
|
1858
1969
|
}
|
|
1859
1970
|
__name(scheduledWorkflowRunIdForTime, "scheduledWorkflowRunIdForTime");
|
|
1860
1971
|
__name2(scheduledWorkflowRunIdForTime, "scheduledWorkflowRunIdForTime");
|
|
1972
|
+
var WORKFLOW_SUSPEND_KINDS = [
|
|
1973
|
+
"input",
|
|
1974
|
+
"approval",
|
|
1975
|
+
"signal",
|
|
1976
|
+
"gate"
|
|
1977
|
+
];
|
|
1978
|
+
var WORKFLOW_RUN_NOTIFICATION_SUSPENDED_KINDS = [
|
|
1979
|
+
...WORKFLOW_SUSPEND_KINDS,
|
|
1980
|
+
...WORKFLOW_RUN_GATE_KINDS
|
|
1981
|
+
];
|
|
1861
1982
|
var WORKFLOW_SIGNAL_PAYLOAD_MAX_BYTES = 64 * 1024;
|
|
1862
1983
|
var WORKFLOW_RESOLVE_OUTPUT_MAX_BYTES = 256 * 1024;
|
|
1863
1984
|
var WORKFLOW_RETRY_BACKOFFS = [
|
|
@@ -2049,6 +2170,30 @@ var WORKFLOW_BUDGET_MAX_DURATION_SECONDS = Object.freeze({
|
|
|
2049
2170
|
min: 60,
|
|
2050
2171
|
max: 2592e3
|
|
2051
2172
|
});
|
|
2173
|
+
var WORKFLOW_GOAL_JUDGE_SELF = "$self";
|
|
2174
|
+
function workflowGoalJudgeKind(judge) {
|
|
2175
|
+
return judge && typeof judge === "object" && judge.predicate !== void 0 ? "predicate" : "agent";
|
|
2176
|
+
}
|
|
2177
|
+
__name(workflowGoalJudgeKind, "workflowGoalJudgeKind");
|
|
2178
|
+
__name2(workflowGoalJudgeKind, "workflowGoalJudgeKind");
|
|
2179
|
+
function isWorkflowGoalJudgeComplete(judge) {
|
|
2180
|
+
if (workflowGoalJudgeKind(judge) === "predicate") return true;
|
|
2181
|
+
return typeof judge.agentId === "string" && judge.agentId.length > 0 && !!judge.schema && typeof judge.schema === "object" && !Array.isArray(judge.schema);
|
|
2182
|
+
}
|
|
2183
|
+
__name(isWorkflowGoalJudgeComplete, "isWorkflowGoalJudgeComplete");
|
|
2184
|
+
__name2(isWorkflowGoalJudgeComplete, "isWorkflowGoalJudgeComplete");
|
|
2185
|
+
function normalizeWorkflowGoalJudge(judge) {
|
|
2186
|
+
if (workflowGoalJudgeKind(judge) === "agent") return judge;
|
|
2187
|
+
return {
|
|
2188
|
+
agentId: judge.agentId ?? WORKFLOW_GOAL_JUDGE_SELF,
|
|
2189
|
+
predicate: judge.predicate,
|
|
2190
|
+
...judge.schema ? {
|
|
2191
|
+
schema: judge.schema
|
|
2192
|
+
} : {}
|
|
2193
|
+
};
|
|
2194
|
+
}
|
|
2195
|
+
__name(normalizeWorkflowGoalJudge, "normalizeWorkflowGoalJudge");
|
|
2196
|
+
__name2(normalizeWorkflowGoalJudge, "normalizeWorkflowGoalJudge");
|
|
2052
2197
|
var REDACTED_PLACEHOLDER = "[REDACTED]";
|
|
2053
2198
|
var PROVIDER_MESSAGE_MAX_CHARS = 300;
|
|
2054
2199
|
var ERROR_MESSAGE_MAX_CHARS = 2e3;
|
|
@@ -2612,21 +2757,31 @@ function resolveEffectiveFeature(row, catalogDefault) {
|
|
|
2612
2757
|
}
|
|
2613
2758
|
__name(resolveEffectiveFeature, "resolveEffectiveFeature");
|
|
2614
2759
|
__name2(resolveEffectiveFeature, "resolveEffectiveFeature");
|
|
2615
|
-
function
|
|
2616
|
-
|
|
2760
|
+
function asFeatureRow(value3) {
|
|
2761
|
+
if (value3 === false) return {
|
|
2762
|
+
active: false
|
|
2763
|
+
};
|
|
2764
|
+
return typeof value3 === "object" && value3 !== null && !Array.isArray(value3) ? value3 : void 0;
|
|
2765
|
+
}
|
|
2766
|
+
__name(asFeatureRow, "asFeatureRow");
|
|
2767
|
+
__name2(asFeatureRow, "asFeatureRow");
|
|
2768
|
+
function agentFeatureBagCarries(bag, name) {
|
|
2769
|
+
return bag != null && Object.prototype.hasOwnProperty.call(bag, name) && asFeatureRow(bag[name]) !== void 0;
|
|
2617
2770
|
}
|
|
2618
|
-
__name(
|
|
2619
|
-
__name2(
|
|
2771
|
+
__name(agentFeatureBagCarries, "agentFeatureBagCarries");
|
|
2772
|
+
__name2(agentFeatureBagCarries, "agentFeatureBagCarries");
|
|
2620
2773
|
function effectiveAgentFeatureRows(base, override) {
|
|
2621
2774
|
const merged = /* @__PURE__ */ new Map();
|
|
2622
|
-
for (const [name,
|
|
2623
|
-
|
|
2775
|
+
for (const [name, value3] of Object.entries(base ?? {})) {
|
|
2776
|
+
const row = asFeatureRow(value3);
|
|
2777
|
+
if (row) merged.set(name, {
|
|
2624
2778
|
row,
|
|
2625
2779
|
origin: "baseAgent"
|
|
2626
2780
|
});
|
|
2627
2781
|
}
|
|
2628
|
-
for (const [name,
|
|
2629
|
-
|
|
2782
|
+
for (const [name, value3] of Object.entries(override ?? {})) {
|
|
2783
|
+
const row = asFeatureRow(value3);
|
|
2784
|
+
if (row) merged.set(name, {
|
|
2630
2785
|
row,
|
|
2631
2786
|
origin: "subAgent"
|
|
2632
2787
|
});
|
|
@@ -2648,20 +2803,83 @@ function effectiveAgentFeatureRows(base, override) {
|
|
|
2648
2803
|
}
|
|
2649
2804
|
__name(effectiveAgentFeatureRows, "effectiveAgentFeatureRows");
|
|
2650
2805
|
__name2(effectiveAgentFeatureRows, "effectiveAgentFeatureRows");
|
|
2806
|
+
var SUBAGENT_PER_KEY_FLAG_ENV = "LUA_SUBAGENT_FEATURES_PER_KEY";
|
|
2807
|
+
var PER_KEY_FLAG_VALUES = /* @__PURE__ */ new Set([
|
|
2808
|
+
"1",
|
|
2809
|
+
"true",
|
|
2810
|
+
"on",
|
|
2811
|
+
"yes"
|
|
2812
|
+
]);
|
|
2813
|
+
function agentFeatureMergeRuleFromEnv(env) {
|
|
2814
|
+
const raw = env[SUBAGENT_PER_KEY_FLAG_ENV];
|
|
2815
|
+
return typeof raw === "string" && PER_KEY_FLAG_VALUES.has(raw.trim().toLowerCase()) ? "per-key" : "wholesale";
|
|
2816
|
+
}
|
|
2817
|
+
__name(agentFeatureMergeRuleFromEnv, "agentFeatureMergeRuleFromEnv");
|
|
2818
|
+
__name2(agentFeatureMergeRuleFromEnv, "agentFeatureMergeRuleFromEnv");
|
|
2819
|
+
function effectiveAgentFeatures(base, override, rule) {
|
|
2820
|
+
if (rule === "wholesale") return override || base || void 0;
|
|
2821
|
+
return effectiveAgentFeatureRows(base, override).rows;
|
|
2822
|
+
}
|
|
2823
|
+
__name(effectiveAgentFeatures, "effectiveAgentFeatures");
|
|
2824
|
+
__name2(effectiveAgentFeatures, "effectiveAgentFeatures");
|
|
2651
2825
|
|
|
2652
2826
|
// ../workflow-graph/dist/index.mjs
|
|
2653
2827
|
import { createHash } from "crypto";
|
|
2654
2828
|
import { z as z4 } from "zod";
|
|
2655
2829
|
import { z as z22 } from "zod";
|
|
2656
|
-
|
|
2830
|
+
|
|
2831
|
+
// ../shared-types/dist/workflow-job-tools.mjs
|
|
2657
2832
|
var __defProp3 = Object.defineProperty;
|
|
2658
|
-
var __name3 = /* @__PURE__ */ __name((target,
|
|
2833
|
+
var __name3 = /* @__PURE__ */ __name((target, value3) => __defProp3(target, "name", { value: value3, configurable: true }), "__name");
|
|
2834
|
+
var WORKFLOW_JOB_TOOLS = [
|
|
2835
|
+
"shell",
|
|
2836
|
+
"read",
|
|
2837
|
+
"write",
|
|
2838
|
+
"edit",
|
|
2839
|
+
"glob",
|
|
2840
|
+
"grep",
|
|
2841
|
+
"git",
|
|
2842
|
+
"gh",
|
|
2843
|
+
"fetch",
|
|
2844
|
+
"ripwire"
|
|
2845
|
+
];
|
|
2846
|
+
var WORKFLOW_JOB_READ_ONLY_DROPPED = [
|
|
2847
|
+
"write",
|
|
2848
|
+
"edit",
|
|
2849
|
+
"git",
|
|
2850
|
+
"shell"
|
|
2851
|
+
];
|
|
2852
|
+
var WORKFLOW_JOB_DEFAULT_TOOLS = [
|
|
2853
|
+
"shell",
|
|
2854
|
+
"read",
|
|
2855
|
+
"write",
|
|
2856
|
+
"edit",
|
|
2857
|
+
"glob",
|
|
2858
|
+
"grep",
|
|
2859
|
+
"git"
|
|
2860
|
+
];
|
|
2861
|
+
function effectiveJobTools(jobTools, readOnly) {
|
|
2862
|
+
const base = jobTools?.length ? jobTools : WORKFLOW_JOB_DEFAULT_TOOLS;
|
|
2863
|
+
const out = [];
|
|
2864
|
+
for (const id of base) {
|
|
2865
|
+
if (readOnly && WORKFLOW_JOB_READ_ONLY_DROPPED.includes(id)) continue;
|
|
2866
|
+
if (!out.includes(id)) out.push(id);
|
|
2867
|
+
}
|
|
2868
|
+
return out;
|
|
2869
|
+
}
|
|
2870
|
+
__name(effectiveJobTools, "effectiveJobTools");
|
|
2871
|
+
__name3(effectiveJobTools, "effectiveJobTools");
|
|
2872
|
+
|
|
2873
|
+
// ../workflow-graph/dist/index.mjs
|
|
2874
|
+
import { createHash as createHash2 } from "crypto";
|
|
2875
|
+
var __defProp4 = Object.defineProperty;
|
|
2876
|
+
var __name4 = /* @__PURE__ */ __name((target, value22) => __defProp4(target, "name", { value: value22, configurable: true }), "__name");
|
|
2659
2877
|
var WorkflowTemplateError = class extends Error {
|
|
2660
2878
|
static {
|
|
2661
2879
|
__name(this, "WorkflowTemplateError");
|
|
2662
2880
|
}
|
|
2663
2881
|
static {
|
|
2664
|
-
|
|
2882
|
+
__name4(this, "WorkflowTemplateError");
|
|
2665
2883
|
}
|
|
2666
2884
|
placeholder;
|
|
2667
2885
|
constructor(message, placeholder) {
|
|
@@ -2673,7 +2891,7 @@ function isMapConfigObject(v) {
|
|
|
2673
2891
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
2674
2892
|
}
|
|
2675
2893
|
__name(isMapConfigObject, "isMapConfigObject");
|
|
2676
|
-
|
|
2894
|
+
__name4(isMapConfigObject, "isMapConfigObject");
|
|
2677
2895
|
function parseMapConfig(raw, stepId) {
|
|
2678
2896
|
if (isMapConfigObject(raw)) return raw;
|
|
2679
2897
|
if (typeof raw !== "string") {
|
|
@@ -2686,14 +2904,14 @@ function parseMapConfig(raw, stepId) {
|
|
|
2686
2904
|
}
|
|
2687
2905
|
}
|
|
2688
2906
|
__name(parseMapConfig, "parseMapConfig");
|
|
2689
|
-
|
|
2907
|
+
__name4(parseMapConfig, "parseMapConfig");
|
|
2690
2908
|
function mapConfigWire(raw) {
|
|
2691
2909
|
if (typeof raw === "string") return raw;
|
|
2692
2910
|
if (isMapConfigObject(raw)) return canonicalJson(raw);
|
|
2693
2911
|
return void 0;
|
|
2694
2912
|
}
|
|
2695
2913
|
__name(mapConfigWire, "mapConfigWire");
|
|
2696
|
-
|
|
2914
|
+
__name4(mapConfigWire, "mapConfigWire");
|
|
2697
2915
|
var TEMPLATE_PLACEHOLDER = /\$\{([^}]*)\}/g;
|
|
2698
2916
|
var TEMPLATE_NAMESPACES = [
|
|
2699
2917
|
"initData",
|
|
@@ -2705,7 +2923,7 @@ function describeBadPlaceholder(template22, idx, rawExpr) {
|
|
|
2705
2923
|
return `Template placeholder #${idx} (\${${rawExpr}}) in '${template22}'`;
|
|
2706
2924
|
}
|
|
2707
2925
|
__name(describeBadPlaceholder, "describeBadPlaceholder");
|
|
2708
|
-
|
|
2926
|
+
__name4(describeBadPlaceholder, "describeBadPlaceholder");
|
|
2709
2927
|
function parseTemplatePlaceholder(rawExpr) {
|
|
2710
2928
|
const dot = rawExpr.indexOf(".");
|
|
2711
2929
|
return {
|
|
@@ -2714,7 +2932,7 @@ function parseTemplatePlaceholder(rawExpr) {
|
|
|
2714
2932
|
};
|
|
2715
2933
|
}
|
|
2716
2934
|
__name(parseTemplatePlaceholder, "parseTemplatePlaceholder");
|
|
2717
|
-
|
|
2935
|
+
__name4(parseTemplatePlaceholder, "parseTemplatePlaceholder");
|
|
2718
2936
|
function traverseMappingPath(root, path, errorLabel) {
|
|
2719
2937
|
if (path === "" || path === ".") return root;
|
|
2720
2938
|
const parts = path.split(".");
|
|
@@ -2726,7 +2944,7 @@ function traverseMappingPath(root, path, errorLabel) {
|
|
|
2726
2944
|
return value22;
|
|
2727
2945
|
}
|
|
2728
2946
|
__name(traverseMappingPath, "traverseMappingPath");
|
|
2729
|
-
|
|
2947
|
+
__name4(traverseMappingPath, "traverseMappingPath");
|
|
2730
2948
|
function stringifyTemplateValue(v, template22, idx, rawExpr) {
|
|
2731
2949
|
if (v === null || v === void 0) return "";
|
|
2732
2950
|
if (typeof v === "object") {
|
|
@@ -2739,17 +2957,17 @@ function stringifyTemplateValue(v, template22, idx, rawExpr) {
|
|
|
2739
2957
|
return String(v);
|
|
2740
2958
|
}
|
|
2741
2959
|
__name(stringifyTemplateValue, "stringifyTemplateValue");
|
|
2742
|
-
|
|
2960
|
+
__name4(stringifyTemplateValue, "stringifyTemplateValue");
|
|
2743
2961
|
function escapeFence(content) {
|
|
2744
2962
|
return content.replace(/<\/lua-data/g, "<\\/lua-data");
|
|
2745
2963
|
}
|
|
2746
2964
|
__name(escapeFence, "escapeFence");
|
|
2747
|
-
|
|
2965
|
+
__name4(escapeFence, "escapeFence");
|
|
2748
2966
|
function fenceBlock(name, source, content) {
|
|
2749
2967
|
return `<lua-data name="${name}" source="${source}" untrusted="true">${escapeFence(content)}</lua-data>`;
|
|
2750
2968
|
}
|
|
2751
2969
|
__name(fenceBlock, "fenceBlock");
|
|
2752
|
-
|
|
2970
|
+
__name4(fenceBlock, "fenceBlock");
|
|
2753
2971
|
function renderTemplate(template22, ctx, opts) {
|
|
2754
2972
|
let idx = 0;
|
|
2755
2973
|
return template22.replace(TEMPLATE_PLACEHOLDER, (_match, rawExpr) => {
|
|
@@ -2790,12 +3008,12 @@ function renderTemplate(template22, ctx, opts) {
|
|
|
2790
3008
|
});
|
|
2791
3009
|
}
|
|
2792
3010
|
__name(renderTemplate, "renderTemplate");
|
|
2793
|
-
|
|
3011
|
+
__name4(renderTemplate, "renderTemplate");
|
|
2794
3012
|
function isMapDescriptor(v) {
|
|
2795
3013
|
if (v === null || typeof v !== "object" || Array.isArray(v)) return false;
|
|
2796
3014
|
const d = v;
|
|
2797
3015
|
const keys = Object.keys(d);
|
|
2798
|
-
const only = /* @__PURE__ */
|
|
3016
|
+
const only = /* @__PURE__ */ __name4((...allowed) => keys.every((k) => allowed.includes(k)), "only");
|
|
2799
3017
|
if ("value" in d) return keys.length === 1;
|
|
2800
3018
|
if ("template" in d) return keys.length === 1 && typeof d.template === "string";
|
|
2801
3019
|
if ("requestContextPath" in d) return keys.length === 1 && typeof d.requestContextPath === "string";
|
|
@@ -2808,7 +3026,7 @@ function isMapDescriptor(v) {
|
|
|
2808
3026
|
return false;
|
|
2809
3027
|
}
|
|
2810
3028
|
__name(isMapDescriptor, "isMapDescriptor");
|
|
2811
|
-
|
|
3029
|
+
__name4(isMapDescriptor, "isMapDescriptor");
|
|
2812
3030
|
var MAP_DESCRIPTOR_KEYS = [
|
|
2813
3031
|
"step",
|
|
2814
3032
|
"path",
|
|
@@ -2833,13 +3051,13 @@ function malformedMapMembers(cfg) {
|
|
|
2833
3051
|
return out;
|
|
2834
3052
|
}
|
|
2835
3053
|
__name(malformedMapMembers, "malformedMapMembers");
|
|
2836
|
-
|
|
3054
|
+
__name4(malformedMapMembers, "malformedMapMembers");
|
|
2837
3055
|
function mapMemberMalformedMessage(id, m) {
|
|
2838
3056
|
const keys = m.keys.map((k) => `\`${k}\``).join(", ");
|
|
2839
3057
|
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
3058
|
}
|
|
2841
3059
|
__name(mapMemberMalformedMessage, "mapMemberMalformedMessage");
|
|
2842
|
-
|
|
3060
|
+
__name4(mapMemberMalformedMessage, "mapMemberMalformedMessage");
|
|
2843
3061
|
function resolveDescriptor(key, m, ctx) {
|
|
2844
3062
|
if (!isMapDescriptor(m)) return {
|
|
2845
3063
|
value: m
|
|
@@ -2900,7 +3118,7 @@ function resolveDescriptor(key, m, ctx) {
|
|
|
2900
3118
|
}
|
|
2901
3119
|
}
|
|
2902
3120
|
__name(resolveDescriptor, "resolveDescriptor");
|
|
2903
|
-
|
|
3121
|
+
__name4(resolveDescriptor, "resolveDescriptor");
|
|
2904
3122
|
function resolveMapping(cfg, ctx) {
|
|
2905
3123
|
const keys = Object.keys(cfg);
|
|
2906
3124
|
if (keys.length === 1 && keys[0] === "") {
|
|
@@ -2917,37 +3135,200 @@ function resolveMapping(cfg, ctx) {
|
|
|
2917
3135
|
};
|
|
2918
3136
|
}
|
|
2919
3137
|
__name(resolveMapping, "resolveMapping");
|
|
2920
|
-
|
|
2921
|
-
var fromInit = /* @__PURE__ */
|
|
3138
|
+
__name4(resolveMapping, "resolveMapping");
|
|
3139
|
+
var fromInit = /* @__PURE__ */ __name4((path) => ({
|
|
2922
3140
|
initData: true,
|
|
2923
3141
|
path
|
|
2924
3142
|
}), "fromInit");
|
|
2925
|
-
var fromStep = /* @__PURE__ */
|
|
2926
|
-
const idOf = /* @__PURE__ */
|
|
3143
|
+
var fromStep = /* @__PURE__ */ __name4((s, path = "") => {
|
|
3144
|
+
const idOf = /* @__PURE__ */ __name4((x) => typeof x === "string" ? x : x.id, "idOf");
|
|
2927
3145
|
return {
|
|
2928
3146
|
step: Array.isArray(s) ? s.map(idOf) : idOf(s),
|
|
2929
3147
|
path
|
|
2930
3148
|
};
|
|
2931
3149
|
}, "fromStep");
|
|
2932
|
-
var value = /* @__PURE__ */
|
|
3150
|
+
var value = /* @__PURE__ */ __name4((v) => ({
|
|
2933
3151
|
value: v
|
|
2934
3152
|
}), "value");
|
|
2935
|
-
var template = /* @__PURE__ */
|
|
3153
|
+
var template = /* @__PURE__ */ __name4((s) => ({
|
|
2936
3154
|
template: s
|
|
2937
3155
|
}), "template");
|
|
2938
|
-
var fromRequest = /* @__PURE__ */
|
|
3156
|
+
var fromRequest = /* @__PURE__ */ __name4((path) => ({
|
|
2939
3157
|
requestContextPath: path
|
|
2940
3158
|
}), "fromRequest");
|
|
2941
|
-
var rows = /* @__PURE__ */
|
|
3159
|
+
var rows = /* @__PURE__ */ __name4((s, path, page) => ({
|
|
2942
3160
|
step: typeof s === "string" ? s : s.id,
|
|
2943
3161
|
path,
|
|
2944
3162
|
rows: page
|
|
2945
3163
|
}), "rows");
|
|
2946
|
-
var fromKnowledge = /* @__PURE__ */
|
|
3164
|
+
var fromKnowledge = /* @__PURE__ */ __name4((k) => ({
|
|
2947
3165
|
knowledge: k
|
|
2948
3166
|
}), "fromKnowledge");
|
|
2949
3167
|
var SideEffectsSchema = z4.enum(WORKFLOW_SIDE_EFFECTS);
|
|
2950
3168
|
var JobResourcesSchema = z4.enum(WORKFLOW_JOB_RESOURCES);
|
|
3169
|
+
var WORKFLOW_MODEL_TEMPLATE_ROOT = "initData";
|
|
3170
|
+
var WORKFLOW_MODEL_TEMPLATE_RE = /^\$\{\s*initData\.([A-Za-z0-9_.\-[\]]+)\s*(?:\|([^}]*))?\}$/;
|
|
3171
|
+
var PATH_SEGMENT_RE = /^[A-Za-z0-9_-]+(?:\[(?:0|[1-9]\d*)\])*$/;
|
|
3172
|
+
function looksLikeModelTemplate(model) {
|
|
3173
|
+
return typeof model === "string" && model.includes("${");
|
|
3174
|
+
}
|
|
3175
|
+
__name(looksLikeModelTemplate, "looksLikeModelTemplate");
|
|
3176
|
+
__name4(looksLikeModelTemplate, "looksLikeModelTemplate");
|
|
3177
|
+
function parseModelTemplate(model) {
|
|
3178
|
+
if (!looksLikeModelTemplate(model)) return {
|
|
3179
|
+
kind: "static"
|
|
3180
|
+
};
|
|
3181
|
+
const trimmed = model.trim();
|
|
3182
|
+
const m = WORKFLOW_MODEL_TEMPLATE_RE.exec(trimmed);
|
|
3183
|
+
if (!m) {
|
|
3184
|
+
const inner = /^\$\{([^}]*)\}$/.exec(trimmed)?.[1];
|
|
3185
|
+
const root = inner?.split(/[.|]/, 1)[0];
|
|
3186
|
+
const why = inner !== void 0 && root !== void 0 && root !== WORKFLOW_MODEL_TEMPLATE_ROOT ? `only the \`${WORKFLOW_MODEL_TEMPLATE_ROOT}\` root is allowed (got \`${root || "(empty)"}\`)` : inner !== void 0 && (inner === WORKFLOW_MODEL_TEMPLATE_ROOT || inner.startsWith(`${WORKFLOW_MODEL_TEMPLATE_ROOT}.`)) ? "the path after `initData.` is empty" : "the whole value must be exactly one placeholder \u2014 no prefix, suffix or second placeholder";
|
|
3187
|
+
return {
|
|
3188
|
+
kind: "invalid",
|
|
3189
|
+
message: modelTemplateInvalidMessage(model, why)
|
|
3190
|
+
};
|
|
3191
|
+
}
|
|
3192
|
+
const path = m[1];
|
|
3193
|
+
if (!path.split(".").every((seg) => PATH_SEGMENT_RE.test(seg))) {
|
|
3194
|
+
return {
|
|
3195
|
+
kind: "invalid",
|
|
3196
|
+
message: modelTemplateInvalidMessage(model, `the path \`${path}\` is not a dotted path of names and canonical [n] indexes`)
|
|
3197
|
+
};
|
|
3198
|
+
}
|
|
3199
|
+
if (m[2] !== void 0) {
|
|
3200
|
+
const dflt = m[2].trim();
|
|
3201
|
+
if (!dflt) return {
|
|
3202
|
+
kind: "invalid",
|
|
3203
|
+
message: modelTemplateInvalidMessage(model, "the default after `|` is empty")
|
|
3204
|
+
};
|
|
3205
|
+
if (dflt.includes("|")) {
|
|
3206
|
+
return {
|
|
3207
|
+
kind: "invalid",
|
|
3208
|
+
message: modelTemplateInvalidMessage(model, "a placeholder names ONE default \u2014 a second `|` is not a fallback chain")
|
|
3209
|
+
};
|
|
3210
|
+
}
|
|
3211
|
+
return {
|
|
3212
|
+
kind: "template",
|
|
3213
|
+
template: {
|
|
3214
|
+
placeholder: trimmed,
|
|
3215
|
+
path,
|
|
3216
|
+
default: dflt
|
|
3217
|
+
}
|
|
3218
|
+
};
|
|
3219
|
+
}
|
|
3220
|
+
return {
|
|
3221
|
+
kind: "template",
|
|
3222
|
+
template: {
|
|
3223
|
+
placeholder: trimmed,
|
|
3224
|
+
path
|
|
3225
|
+
}
|
|
3226
|
+
};
|
|
3227
|
+
}
|
|
3228
|
+
__name(parseModelTemplate, "parseModelTemplate");
|
|
3229
|
+
__name4(parseModelTemplate, "parseModelTemplate");
|
|
3230
|
+
function modelTemplateInvalidMessage(model, why) {
|
|
3231
|
+
return `model "${model.trim()}" is not a valid run-input-bound model placeholder \u2014 ${why}; the forms are \${initData.<path>} and \${initData.<path>|<provider/model default>}`;
|
|
3232
|
+
}
|
|
3233
|
+
__name(modelTemplateInvalidMessage, "modelTemplateInvalidMessage");
|
|
3234
|
+
__name4(modelTemplateInvalidMessage, "modelTemplateInvalidMessage");
|
|
3235
|
+
function modelTemplateDefaultRequiredMessage(model) {
|
|
3236
|
+
return `model "${model}" runs on the Job tier, so its placeholder needs a default \u2014 the harness / provider gates (harness:'claude-code' needs an Anthropic model) classify it at push; write ${model.replace(/\}$/, "|<provider/model>}")}`;
|
|
3237
|
+
}
|
|
3238
|
+
__name(modelTemplateDefaultRequiredMessage, "modelTemplateDefaultRequiredMessage");
|
|
3239
|
+
__name4(modelTemplateDefaultRequiredMessage, "modelTemplateDefaultRequiredMessage");
|
|
3240
|
+
function staticModelPin(model) {
|
|
3241
|
+
if (typeof model !== "string") return void 0;
|
|
3242
|
+
const parsed = parseModelTemplate(model);
|
|
3243
|
+
if (parsed.kind === "static") return model;
|
|
3244
|
+
if (parsed.kind === "template") return parsed.template.default;
|
|
3245
|
+
return void 0;
|
|
3246
|
+
}
|
|
3247
|
+
__name(staticModelPin, "staticModelPin");
|
|
3248
|
+
__name4(staticModelPin, "staticModelPin");
|
|
3249
|
+
function readPath(root, path) {
|
|
3250
|
+
let cur = root;
|
|
3251
|
+
for (const seg of path.split(".")) {
|
|
3252
|
+
const name = seg.replace(/\[(?:0|[1-9]\d*)\]/g, "");
|
|
3253
|
+
const indexes = [
|
|
3254
|
+
...seg.matchAll(/\[(0|[1-9]\d*)\]/g)
|
|
3255
|
+
].map((x) => Number(x[1]));
|
|
3256
|
+
if (cur === null || typeof cur !== "object") return void 0;
|
|
3257
|
+
cur = cur[name];
|
|
3258
|
+
for (const i of indexes) {
|
|
3259
|
+
if (!Array.isArray(cur)) return void 0;
|
|
3260
|
+
cur = cur[i];
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
return cur;
|
|
3264
|
+
}
|
|
3265
|
+
__name(readPath, "readPath");
|
|
3266
|
+
__name4(readPath, "readPath");
|
|
3267
|
+
function renderModelTemplate(model, initData) {
|
|
3268
|
+
if (model === void 0 || !looksLikeModelTemplate(model)) return {
|
|
3269
|
+
ok: true,
|
|
3270
|
+
model,
|
|
3271
|
+
source: "static"
|
|
3272
|
+
};
|
|
3273
|
+
const parsed = parseModelTemplate(model);
|
|
3274
|
+
if (parsed.kind === "invalid") {
|
|
3275
|
+
return {
|
|
3276
|
+
ok: false,
|
|
3277
|
+
placeholder: model.trim(),
|
|
3278
|
+
path: "",
|
|
3279
|
+
reason: "invalid",
|
|
3280
|
+
message: parsed.message
|
|
3281
|
+
};
|
|
3282
|
+
}
|
|
3283
|
+
if (parsed.kind === "static") return {
|
|
3284
|
+
ok: true,
|
|
3285
|
+
model,
|
|
3286
|
+
source: "static"
|
|
3287
|
+
};
|
|
3288
|
+
const { placeholder, path } = parsed.template;
|
|
3289
|
+
if (initData !== void 0 && initData !== null && (typeof initData !== "object" || Array.isArray(initData))) {
|
|
3290
|
+
return {
|
|
3291
|
+
ok: false,
|
|
3292
|
+
placeholder,
|
|
3293
|
+
path,
|
|
3294
|
+
reason: "input-not-object",
|
|
3295
|
+
message: modelTemplateInputNotObjectMessage(placeholder, initData)
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3298
|
+
const value22 = readPath(initData, path);
|
|
3299
|
+
const reason = value22 === void 0 || value22 === null ? "unbound" : typeof value22 !== "string" ? "not-a-string" : value22.trim() ? null : "empty";
|
|
3300
|
+
if (reason === null) return {
|
|
3301
|
+
ok: true,
|
|
3302
|
+
model: value22.trim(),
|
|
3303
|
+
source: "initData"
|
|
3304
|
+
};
|
|
3305
|
+
if (parsed.template.default !== void 0) return {
|
|
3306
|
+
ok: true,
|
|
3307
|
+
model: parsed.template.default,
|
|
3308
|
+
source: "default"
|
|
3309
|
+
};
|
|
3310
|
+
return {
|
|
3311
|
+
ok: false,
|
|
3312
|
+
placeholder,
|
|
3313
|
+
path,
|
|
3314
|
+
reason,
|
|
3315
|
+
message: modelTemplateUnboundMessage(placeholder, path, reason)
|
|
3316
|
+
};
|
|
3317
|
+
}
|
|
3318
|
+
__name(renderModelTemplate, "renderModelTemplate");
|
|
3319
|
+
__name4(renderModelTemplate, "renderModelTemplate");
|
|
3320
|
+
function modelTemplateUnboundMessage(placeholder, path, reason) {
|
|
3321
|
+
const what = reason === "unbound" ? `the run input has no ${WORKFLOW_MODEL_TEMPLATE_ROOT}.${path}` : reason === "empty" ? `${WORKFLOW_MODEL_TEMPLATE_ROOT}.${path} is empty on the run input` : `${WORKFLOW_MODEL_TEMPLATE_ROOT}.${path} on the run input is not a string`;
|
|
3322
|
+
return `model placeholder "${placeholder}" is unbound \u2014 ${what} and the placeholder declares no default; pass one in the run input or write \${${WORKFLOW_MODEL_TEMPLATE_ROOT}.${path}|<provider/model>}`;
|
|
3323
|
+
}
|
|
3324
|
+
__name(modelTemplateUnboundMessage, "modelTemplateUnboundMessage");
|
|
3325
|
+
__name4(modelTemplateUnboundMessage, "modelTemplateUnboundMessage");
|
|
3326
|
+
function modelTemplateInputNotObjectMessage(placeholder, initData) {
|
|
3327
|
+
const type = Array.isArray(initData) ? "an array" : `a ${typeof initData}`;
|
|
3328
|
+
return `model placeholder "${placeholder}" cannot be rendered \u2014 the run input is ${type}, not an object; start the run with an object input (a JSON string must be parsed before it is passed)`;
|
|
3329
|
+
}
|
|
3330
|
+
__name(modelTemplateInputNotObjectMessage, "modelTemplateInputNotObjectMessage");
|
|
3331
|
+
__name4(modelTemplateInputNotObjectMessage, "modelTemplateInputNotObjectMessage");
|
|
2951
3332
|
var APPROVER_SPEC_MAX_USERS = 20;
|
|
2952
3333
|
var ESCALATION_MAX_HOPS = 3;
|
|
2953
3334
|
var TemplateBindingSchema = z22.object({
|
|
@@ -3029,7 +3410,7 @@ function describeApproverSpecRefusal(spec) {
|
|
|
3029
3410
|
};
|
|
3030
3411
|
}
|
|
3031
3412
|
__name(describeApproverSpecRefusal, "describeApproverSpecRefusal");
|
|
3032
|
-
|
|
3413
|
+
__name4(describeApproverSpecRefusal, "describeApproverSpecRefusal");
|
|
3033
3414
|
var BINDING_ROOTS = [
|
|
3034
3415
|
"initData",
|
|
3035
3416
|
"stepResults",
|
|
@@ -3043,30 +3424,30 @@ function bindingRootsOk(template22) {
|
|
|
3043
3424
|
return refs.length > 0 && refs.every((r) => BINDING_ROOTS.includes(r));
|
|
3044
3425
|
}
|
|
3045
3426
|
__name(bindingRootsOk, "bindingRootsOk");
|
|
3046
|
-
|
|
3427
|
+
__name4(bindingRootsOk, "bindingRootsOk");
|
|
3047
3428
|
function isTemplateBinding(v) {
|
|
3048
3429
|
return typeof v === "object" && v !== null && typeof v.template === "string";
|
|
3049
3430
|
}
|
|
3050
3431
|
__name(isTemplateBinding, "isTemplateBinding");
|
|
3051
|
-
|
|
3432
|
+
__name4(isTemplateBinding, "isTemplateBinding");
|
|
3052
3433
|
function approvalEditable(node) {
|
|
3053
3434
|
if (node.editable === true) return true;
|
|
3054
3435
|
if (node.editable === false) return false;
|
|
3055
3436
|
return Array.isArray(node.editablePaths) && node.editablePaths.length > 0;
|
|
3056
3437
|
}
|
|
3057
3438
|
__name(approvalEditable, "approvalEditable");
|
|
3058
|
-
|
|
3439
|
+
__name4(approvalEditable, "approvalEditable");
|
|
3059
3440
|
function validateApproverBlock(node, opts = {
|
|
3060
3441
|
path: "approval"
|
|
3061
3442
|
}) {
|
|
3062
3443
|
const issues = [];
|
|
3063
|
-
const push = /* @__PURE__ */
|
|
3444
|
+
const push = /* @__PURE__ */ __name4((code, path, message, severity = "error") => issues.push({
|
|
3064
3445
|
code,
|
|
3065
3446
|
path,
|
|
3066
3447
|
severity,
|
|
3067
3448
|
message
|
|
3068
3449
|
}), "push");
|
|
3069
|
-
const checkSpec = /* @__PURE__ */
|
|
3450
|
+
const checkSpec = /* @__PURE__ */ __name4((spec, path) => {
|
|
3070
3451
|
const r = ApproverSpecSchema.safeParse(spec);
|
|
3071
3452
|
if (!r.success) {
|
|
3072
3453
|
const users = spec?.users;
|
|
@@ -3123,7 +3504,7 @@ function validateApproverBlock(node, opts = {
|
|
|
3123
3504
|
return issues;
|
|
3124
3505
|
}
|
|
3125
3506
|
__name(validateApproverBlock, "validateApproverBlock");
|
|
3126
|
-
|
|
3507
|
+
__name4(validateApproverBlock, "validateApproverBlock");
|
|
3127
3508
|
function liftRenderedApprover(row, rendered) {
|
|
3128
3509
|
const text = (rendered ?? "").trim();
|
|
3129
3510
|
if (!text) return null;
|
|
@@ -3152,7 +3533,7 @@ function liftRenderedApprover(row, rendered) {
|
|
|
3152
3533
|
};
|
|
3153
3534
|
}
|
|
3154
3535
|
__name(liftRenderedApprover, "liftRenderedApprover");
|
|
3155
|
-
|
|
3536
|
+
__name4(liftRenderedApprover, "liftRenderedApprover");
|
|
3156
3537
|
var WORKSPACE_TEMPLATE_EXPR_RE = /^\$\{\s*(?:initData|input)\.([^}]+?)\s*\}$/;
|
|
3157
3538
|
function workspaceTemplatePath(template22) {
|
|
3158
3539
|
const key = template22.trim();
|
|
@@ -3162,7 +3543,7 @@ function workspaceTemplatePath(template22) {
|
|
|
3162
3543
|
return key.replace(/^(?:input|initData)\./, "").split(".");
|
|
3163
3544
|
}
|
|
3164
3545
|
__name(workspaceTemplatePath, "workspaceTemplatePath");
|
|
3165
|
-
|
|
3546
|
+
__name4(workspaceTemplatePath, "workspaceTemplatePath");
|
|
3166
3547
|
function retryBackoffs() {
|
|
3167
3548
|
if (!Array.isArray(WORKFLOW_RETRY_BACKOFFS)) {
|
|
3168
3549
|
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 +3551,7 @@ function retryBackoffs() {
|
|
|
3170
3551
|
return WORKFLOW_RETRY_BACKOFFS;
|
|
3171
3552
|
}
|
|
3172
3553
|
__name(retryBackoffs, "retryBackoffs");
|
|
3173
|
-
|
|
3554
|
+
__name4(retryBackoffs, "retryBackoffs");
|
|
3174
3555
|
var SLEEP_UNTIL_REPLACEMENT = Object.freeze({
|
|
3175
3556
|
type: "sleep",
|
|
3176
3557
|
duration: 6e4
|
|
@@ -3179,12 +3560,12 @@ function sleepUntilUnsupportedMessage(id) {
|
|
|
3179
3560
|
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
3561
|
}
|
|
3181
3562
|
__name(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
|
|
3182
|
-
|
|
3563
|
+
__name4(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
|
|
3183
3564
|
function armSubrunUnsupportedMessage(id, workflowId) {
|
|
3184
3565
|
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
3566
|
}
|
|
3186
3567
|
__name(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
|
|
3187
|
-
|
|
3568
|
+
__name4(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
|
|
3188
3569
|
var WORKFLOW_CAPS_DEFAULT = Object.freeze({
|
|
3189
3570
|
maxParallelArms: 16,
|
|
3190
3571
|
maxForeachConcurrency: 16,
|
|
@@ -3209,7 +3590,7 @@ var WORKFLOW_SIGNAL_DEFAULT_SOURCES = [
|
|
|
3209
3590
|
"api",
|
|
3210
3591
|
"user"
|
|
3211
3592
|
];
|
|
3212
|
-
var clone = /* @__PURE__ */
|
|
3593
|
+
var clone = /* @__PURE__ */ __name4((v) => JSON.parse(JSON.stringify(v)), "clone");
|
|
3213
3594
|
function fillPolicy(node, defaultTimeout) {
|
|
3214
3595
|
if (node.tier === void 0 && node.workspace !== void 0 && node.workspace !== "inherit") node.tier = "job";
|
|
3215
3596
|
if (node.timeoutSeconds === void 0) node.timeoutSeconds = node.tier === "job" ? WORKFLOW_JOB_DEFAULT_TIMEOUT_SECONDS : defaultTimeout;
|
|
@@ -3220,7 +3601,7 @@ function fillPolicy(node, defaultTimeout) {
|
|
|
3220
3601
|
if ((node.type === "step" || node.type === "tool") && node.sideEffects === void 0) node.sideEffects = "none";
|
|
3221
3602
|
}
|
|
3222
3603
|
__name(fillPolicy, "fillPolicy");
|
|
3223
|
-
|
|
3604
|
+
__name4(fillPolicy, "fillPolicy");
|
|
3224
3605
|
function fillSingle(node) {
|
|
3225
3606
|
switch (node.type) {
|
|
3226
3607
|
case "step": {
|
|
@@ -3241,7 +3622,7 @@ function fillSingle(node) {
|
|
|
3241
3622
|
}
|
|
3242
3623
|
}
|
|
3243
3624
|
__name(fillSingle, "fillSingle");
|
|
3244
|
-
|
|
3625
|
+
__name4(fillSingle, "fillSingle");
|
|
3245
3626
|
function fillHitl(node) {
|
|
3246
3627
|
if (node.type === "approval") {
|
|
3247
3628
|
const a = node;
|
|
@@ -3261,14 +3642,14 @@ function fillHitl(node) {
|
|
|
3261
3642
|
];
|
|
3262
3643
|
}
|
|
3263
3644
|
__name(fillHitl, "fillHitl");
|
|
3264
|
-
|
|
3645
|
+
__name4(fillHitl, "fillHitl");
|
|
3265
3646
|
function fillArm(arm) {
|
|
3266
3647
|
if (arm.type === "mapping") return;
|
|
3267
3648
|
if (isHitlNode(arm)) fillHitl(arm);
|
|
3268
3649
|
else fillSingle(arm);
|
|
3269
3650
|
}
|
|
3270
3651
|
__name(fillArm, "fillArm");
|
|
3271
|
-
|
|
3652
|
+
__name4(fillArm, "fillArm");
|
|
3272
3653
|
function fillEntry(entry) {
|
|
3273
3654
|
switch (entry.type) {
|
|
3274
3655
|
case "step":
|
|
@@ -3312,36 +3693,25 @@ function fillEntry(entry) {
|
|
|
3312
3693
|
}
|
|
3313
3694
|
}
|
|
3314
3695
|
__name(fillEntry, "fillEntry");
|
|
3315
|
-
|
|
3696
|
+
__name4(fillEntry, "fillEntry");
|
|
3316
3697
|
function withDefaultsFilled(g) {
|
|
3317
3698
|
const out = clone(g);
|
|
3318
3699
|
out.definition.graph.forEach(fillEntry);
|
|
3319
3700
|
return out;
|
|
3320
3701
|
}
|
|
3321
3702
|
__name(withDefaultsFilled, "withDefaultsFilled");
|
|
3322
|
-
|
|
3703
|
+
__name4(withDefaultsFilled, "withDefaultsFilled");
|
|
3323
3704
|
var CONNECTION_ID_HEX_RE = /^[0-9a-f]{24}$/;
|
|
3324
3705
|
function isConnectionKeyShaped(value22) {
|
|
3325
3706
|
return WORKFLOW_CONNECTION_KEY_RE.test(value22) && !CONNECTION_ID_HEX_RE.test(value22);
|
|
3326
3707
|
}
|
|
3327
3708
|
__name(isConnectionKeyShaped, "isConnectionKeyShaped");
|
|
3328
|
-
|
|
3709
|
+
__name4(isConnectionKeyShaped, "isConnectionKeyShaped");
|
|
3329
3710
|
function connectionKeyUndeclaredMessage(path, key) {
|
|
3330
3711
|
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
3712
|
}
|
|
3332
3713
|
__name(connectionKeyUndeclaredMessage, "connectionKeyUndeclaredMessage");
|
|
3333
|
-
|
|
3334
|
-
var WORKFLOW_JOB_TOOLS = [
|
|
3335
|
-
"shell",
|
|
3336
|
-
"read",
|
|
3337
|
-
"write",
|
|
3338
|
-
"edit",
|
|
3339
|
-
"glob",
|
|
3340
|
-
"grep",
|
|
3341
|
-
"git",
|
|
3342
|
-
"gh",
|
|
3343
|
-
"fetch"
|
|
3344
|
-
];
|
|
3714
|
+
__name4(connectionKeyUndeclaredMessage, "connectionKeyUndeclaredMessage");
|
|
3345
3715
|
var WORKFLOW_JOB_MAX_WORKTREE_ARMS = 8;
|
|
3346
3716
|
function classifyModelProvider(model) {
|
|
3347
3717
|
const m = (model ?? "").trim().toLowerCase();
|
|
@@ -3352,14 +3722,14 @@ function classifyModelProvider(model) {
|
|
|
3352
3722
|
return null;
|
|
3353
3723
|
}
|
|
3354
3724
|
__name(classifyModelProvider, "classifyModelProvider");
|
|
3355
|
-
|
|
3356
|
-
var workspaceOf = /* @__PURE__ */
|
|
3357
|
-
var mountsWorkspace = /* @__PURE__ */
|
|
3725
|
+
__name4(classifyModelProvider, "classifyModelProvider");
|
|
3726
|
+
var workspaceOf = /* @__PURE__ */ __name4((node) => node.workspace, "workspaceOf");
|
|
3727
|
+
var mountsWorkspace = /* @__PURE__ */ __name4((node) => {
|
|
3358
3728
|
const w = workspaceOf(node);
|
|
3359
3729
|
return w !== void 0 && w !== "inherit";
|
|
3360
3730
|
}, "mountsWorkspace");
|
|
3361
|
-
var isJobTier = /* @__PURE__ */
|
|
3362
|
-
var jobToolsOf = /* @__PURE__ */
|
|
3731
|
+
var isJobTier = /* @__PURE__ */ __name4((node) => node.tier === "job" || mountsWorkspace(node), "isJobTier");
|
|
3732
|
+
var jobToolsOf = /* @__PURE__ */ __name4((node) => {
|
|
3363
3733
|
if (node.type === "agent") return node.toolScope?.jobTools;
|
|
3364
3734
|
return node.jobTools;
|
|
3365
3735
|
}, "jobToolsOf");
|
|
@@ -3375,17 +3745,17 @@ function schemaAtPath(schema, path) {
|
|
|
3375
3745
|
return cur;
|
|
3376
3746
|
}
|
|
3377
3747
|
__name(schemaAtPath, "schemaAtPath");
|
|
3378
|
-
|
|
3379
|
-
var schemaIsArray = /* @__PURE__ */
|
|
3748
|
+
__name4(schemaAtPath, "schemaAtPath");
|
|
3749
|
+
var schemaIsArray = /* @__PURE__ */ __name4((schema) => {
|
|
3380
3750
|
if (!schema) return void 0;
|
|
3381
3751
|
const t = schema.type;
|
|
3382
3752
|
if (t === void 0) return void 0;
|
|
3383
3753
|
return Array.isArray(t) ? t.includes("array") : t === "array";
|
|
3384
3754
|
}, "schemaIsArray");
|
|
3385
|
-
var isHitlNode = /* @__PURE__ */
|
|
3386
|
-
var isSingleStep = /* @__PURE__ */
|
|
3387
|
-
var singleId = /* @__PURE__ */
|
|
3388
|
-
var armId = /* @__PURE__ */
|
|
3755
|
+
var isHitlNode = /* @__PURE__ */ __name4((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
|
|
3756
|
+
var isSingleStep = /* @__PURE__ */ __name4((n2) => !isHitlNode(n2), "isSingleStep");
|
|
3757
|
+
var singleId = /* @__PURE__ */ __name4((s) => s.type === "step" ? s.step.id : s.id, "singleId");
|
|
3758
|
+
var armId = /* @__PURE__ */ __name4((a) => a.type === "mapping" ? a.id : singleId(a), "armId");
|
|
3389
3759
|
var TEMPLATE_STEP_REF = /\$\{\s*stepResults\.([A-Za-z0-9_\-]+)/g;
|
|
3390
3760
|
function templateStepRefs(text) {
|
|
3391
3761
|
const ids = [];
|
|
@@ -3393,7 +3763,7 @@ function templateStepRefs(text) {
|
|
|
3393
3763
|
return ids;
|
|
3394
3764
|
}
|
|
3395
3765
|
__name(templateStepRefs, "templateStepRefs");
|
|
3396
|
-
|
|
3766
|
+
__name4(templateStepRefs, "templateStepRefs");
|
|
3397
3767
|
function readMapConfig(raw) {
|
|
3398
3768
|
if (!raw) return void 0;
|
|
3399
3769
|
if (typeof raw !== "string") return raw;
|
|
@@ -3405,7 +3775,7 @@ function readMapConfig(raw) {
|
|
|
3405
3775
|
}
|
|
3406
3776
|
}
|
|
3407
3777
|
__name(readMapConfig, "readMapConfig");
|
|
3408
|
-
|
|
3778
|
+
__name4(readMapConfig, "readMapConfig");
|
|
3409
3779
|
function mapConfigStepRefs(raw) {
|
|
3410
3780
|
const cfg = readMapConfig(raw);
|
|
3411
3781
|
if (!cfg) return [];
|
|
@@ -3420,7 +3790,7 @@ function mapConfigStepRefs(raw) {
|
|
|
3420
3790
|
return ids;
|
|
3421
3791
|
}
|
|
3422
3792
|
__name(mapConfigStepRefs, "mapConfigStepRefs");
|
|
3423
|
-
|
|
3793
|
+
__name4(mapConfigStepRefs, "mapConfigStepRefs");
|
|
3424
3794
|
function nodeStepRefs(entry) {
|
|
3425
3795
|
switch (entry.type) {
|
|
3426
3796
|
case "agent": {
|
|
@@ -3449,12 +3819,12 @@ function nodeStepRefs(entry) {
|
|
|
3449
3819
|
}
|
|
3450
3820
|
}
|
|
3451
3821
|
__name(nodeStepRefs, "nodeStepRefs");
|
|
3452
|
-
|
|
3822
|
+
__name4(nodeStepRefs, "nodeStepRefs");
|
|
3453
3823
|
function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
3454
3824
|
static: true
|
|
3455
3825
|
}) {
|
|
3456
3826
|
const issues = [];
|
|
3457
|
-
const err = /* @__PURE__ */
|
|
3827
|
+
const err = /* @__PURE__ */ __name4((code, message, path, stepId) => {
|
|
3458
3828
|
issues.push({
|
|
3459
3829
|
code,
|
|
3460
3830
|
message,
|
|
@@ -3463,7 +3833,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3463
3833
|
stepId
|
|
3464
3834
|
});
|
|
3465
3835
|
}, "err");
|
|
3466
|
-
const warn = /* @__PURE__ */
|
|
3836
|
+
const warn = /* @__PURE__ */ __name4((code, message, path, stepId) => {
|
|
3467
3837
|
issues.push({
|
|
3468
3838
|
code,
|
|
3469
3839
|
message,
|
|
@@ -3499,6 +3869,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3499
3869
|
}
|
|
3500
3870
|
}
|
|
3501
3871
|
const declaredKeys = new Set(opts.connectionKeys ?? []);
|
|
3872
|
+
const ownKeys = /* @__PURE__ */ new Set();
|
|
3502
3873
|
if (g.connections !== void 0 && !Array.isArray(g.connections)) {
|
|
3503
3874
|
err("connection-declaration-invalid", "`connections` must be an array of { key, integrationType }", "connections");
|
|
3504
3875
|
}
|
|
@@ -3510,7 +3881,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3510
3881
|
err("connection-declaration-invalid", `connections[${i}].key must match ${WORKFLOW_CONNECTION_KEY_RE}`, `${path}.key`);
|
|
3511
3882
|
return;
|
|
3512
3883
|
}
|
|
3513
|
-
if (
|
|
3884
|
+
if (ownKeys.has(key)) {
|
|
3514
3885
|
err("connection-declaration-invalid", `connections[${i}].key "${key}" is declared twice`, `${path}.key`);
|
|
3515
3886
|
return;
|
|
3516
3887
|
}
|
|
@@ -3518,9 +3889,10 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3518
3889
|
err("connection-declaration-invalid", `connections[${i}] ("${key}") needs an integrationType (the catalog slug, e.g. 'github')`, `${path}.integrationType`);
|
|
3519
3890
|
return;
|
|
3520
3891
|
}
|
|
3892
|
+
ownKeys.add(key);
|
|
3521
3893
|
declaredKeys.add(key);
|
|
3522
3894
|
});
|
|
3523
|
-
const undeclaredKey = /* @__PURE__ */
|
|
3895
|
+
const undeclaredKey = /* @__PURE__ */ __name4((ref) => typeof ref === "string" && !declaredKeys.has(ref) && isConnectionKeyShaped(ref) && opts.connectionIds?.has(ref) !== true, "undeclaredKey");
|
|
3524
3896
|
const credentialsRef = envelopeWorkspace?.credentialsRef;
|
|
3525
3897
|
if (undeclaredKey(credentialsRef)) {
|
|
3526
3898
|
err("connection-key-undeclared", connectionKeyUndeclaredMessage("workspace.credentialsRef", credentialsRef), "workspace.credentialsRef");
|
|
@@ -3528,7 +3900,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3528
3900
|
const seen = /* @__PURE__ */ new Map();
|
|
3529
3901
|
let nodeCount = 0;
|
|
3530
3902
|
const upstream = /* @__PURE__ */ new Set();
|
|
3531
|
-
const checkId = /* @__PURE__ */
|
|
3903
|
+
const checkId = /* @__PURE__ */ __name4((id, path) => {
|
|
3532
3904
|
nodeCount += 1;
|
|
3533
3905
|
if (seen.has(id)) {
|
|
3534
3906
|
err("duplicate-step-id", `step id "${id}" is declared twice (first at ${seen.get(id)})`, path, id);
|
|
@@ -3536,9 +3908,9 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3536
3908
|
seen.set(id, path);
|
|
3537
3909
|
}
|
|
3538
3910
|
}, "checkId");
|
|
3539
|
-
const checkPolicyEnums = /* @__PURE__ */
|
|
3911
|
+
const checkPolicyEnums = /* @__PURE__ */ __name4((node, path) => {
|
|
3540
3912
|
const id = singleId(node);
|
|
3541
|
-
const check = /* @__PURE__ */
|
|
3913
|
+
const check = /* @__PURE__ */ __name4((member, allowed) => {
|
|
3542
3914
|
const value22 = node[member];
|
|
3543
3915
|
if (value22 === void 0 || typeof value22 === "string" && allowed.includes(value22)) return;
|
|
3544
3916
|
err("invalid-envelope", `\`${member}\` must be ${allowed.map((a) => `'${a}'`).join(" | ")} (got ${JSON.stringify(value22)})`, `${path}.${member}`, id);
|
|
@@ -3546,7 +3918,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3546
3918
|
check("sideEffects", WORKFLOW_SIDE_EFFECTS);
|
|
3547
3919
|
check("jobResources", WORKFLOW_JOB_RESOURCES);
|
|
3548
3920
|
}, "checkPolicyEnums");
|
|
3549
|
-
const checkRetry = /* @__PURE__ */
|
|
3921
|
+
const checkRetry = /* @__PURE__ */ __name4((node, path) => {
|
|
3550
3922
|
const r = node.retry;
|
|
3551
3923
|
if (!r) return;
|
|
3552
3924
|
const id = singleId(node);
|
|
@@ -3572,7 +3944,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3572
3944
|
}
|
|
3573
3945
|
}
|
|
3574
3946
|
}, "checkRetry");
|
|
3575
|
-
const checkTimeout = /* @__PURE__ */
|
|
3947
|
+
const checkTimeout = /* @__PURE__ */ __name4((node, path) => {
|
|
3576
3948
|
const t = node.timeoutSeconds;
|
|
3577
3949
|
if (t === void 0) return;
|
|
3578
3950
|
const id = singleId(node);
|
|
@@ -3591,7 +3963,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3591
3963
|
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
3964
|
}
|
|
3593
3965
|
}, "checkTimeout");
|
|
3594
|
-
const checkSpecialistRole = /* @__PURE__ */
|
|
3966
|
+
const checkSpecialistRole = /* @__PURE__ */ __name4((node, path) => {
|
|
3595
3967
|
const role = node.role;
|
|
3596
3968
|
const hasRef = typeof role.ref === "string";
|
|
3597
3969
|
const hasInline = role.name !== void 0 || role.instructions !== void 0 || Array.isArray(role.tools) && role.tools.length > 0;
|
|
@@ -3623,7 +3995,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3623
3995
|
}
|
|
3624
3996
|
}
|
|
3625
3997
|
}, "checkSpecialistRole");
|
|
3626
|
-
const checkRequiredConnections = /* @__PURE__ */
|
|
3998
|
+
const checkRequiredConnections = /* @__PURE__ */ __name4((node, path) => {
|
|
3627
3999
|
const required = node.requiredConnections;
|
|
3628
4000
|
if (!Array.isArray(required)) return;
|
|
3629
4001
|
const undeclared = required.filter(undeclaredKey);
|
|
@@ -3636,7 +4008,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3636
4008
|
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
4009
|
}
|
|
3638
4010
|
}, "checkRequiredConnections");
|
|
3639
|
-
const checkTier = /* @__PURE__ */
|
|
4011
|
+
const checkTier = /* @__PURE__ */ __name4((node, path) => {
|
|
3640
4012
|
const id = singleId(node);
|
|
3641
4013
|
if (node.workspace && node.workspace !== "inherit" && node.tier !== void 0 && node.tier !== "job") {
|
|
3642
4014
|
err("workspace-requires-job-tier", "a step mounting a workspace must be tier:'job'", `${path}.workspace`, id);
|
|
@@ -3644,7 +4016,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3644
4016
|
if (node.harness !== void 0 && node.tier !== "job") {
|
|
3645
4017
|
err("harness-requires-job-tier", "`harness` is only legal on a tier:'job' agent step", `${path}.harness`, id);
|
|
3646
4018
|
}
|
|
3647
|
-
const provider = node.type === "agent" ? classifyModelProvider(node.model) : null;
|
|
4019
|
+
const provider = node.type === "agent" ? classifyModelProvider(staticModelPin(node.model)) : null;
|
|
3648
4020
|
if (node.harness === "claude-code" && provider !== null && provider !== "anthropic") {
|
|
3649
4021
|
err("harness-provider-mismatch", `harness:'claude-code' needs an Anthropic model (model "${node.type === "agent" ? node.model : ""}" is ${provider})`, `${path}.harness`, id);
|
|
3650
4022
|
}
|
|
@@ -3652,22 +4024,36 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3652
4024
|
err("job-tier-provider-unsupported", `model provider '${provider}' is outside LUA_WF_JOB_PROVIDERS [${opts.policy.jobProviders.join(", ")}]`, `${path}.model`, id);
|
|
3653
4025
|
}
|
|
3654
4026
|
}, "checkTier");
|
|
3655
|
-
const checkModel = /* @__PURE__ */
|
|
4027
|
+
const checkModel = /* @__PURE__ */ __name4((node, path) => {
|
|
3656
4028
|
if (node.type !== "agent" || typeof node.model !== "string") return;
|
|
4029
|
+
const id = singleId(node);
|
|
4030
|
+
const parsed = parseModelTemplate(node.model);
|
|
4031
|
+
if (parsed.kind === "invalid") {
|
|
4032
|
+
err("model-template-invalid", parsed.message, `${path}.model`, id);
|
|
4033
|
+
return;
|
|
4034
|
+
}
|
|
4035
|
+
if (parsed.kind === "template" && parsed.template.default === void 0) {
|
|
4036
|
+
if (isJobTier(node)) {
|
|
4037
|
+
err("model-template-default-required", modelTemplateDefaultRequiredMessage(node.model), `${path}.model`, id);
|
|
4038
|
+
}
|
|
4039
|
+
return;
|
|
4040
|
+
}
|
|
4041
|
+
const pin = parsed.kind === "template" ? parsed.template.default : node.model;
|
|
4042
|
+
if (pin === void 0) return;
|
|
4043
|
+
const inContext = /* @__PURE__ */ __name4((message) => parsed.kind === "template" ? `${message} (the default of ${parsed.template.placeholder})` : message, "inContext");
|
|
3657
4044
|
const registry = opts.approvedModels;
|
|
3658
4045
|
if (registry === void 0) return;
|
|
3659
|
-
const id = singleId(node);
|
|
3660
4046
|
if (registry === "unavailable") {
|
|
3661
|
-
const
|
|
3662
|
-
if (
|
|
3663
|
-
warn("model-unresolved", `model "${
|
|
4047
|
+
const trimmed = pin.trim();
|
|
4048
|
+
if (trimmed && !normalizeModelId(trimmed, []).ok) {
|
|
4049
|
+
warn("model-unresolved", inContext(`model "${trimmed}" could not be checked against the approved-model registry (unavailable at push) \u2014 it dispatches only if it resolves there (a provider/model registry code, or a bare id exactly one approved model carries)`), `${path}.model`, id);
|
|
3664
4050
|
}
|
|
3665
4051
|
return;
|
|
3666
4052
|
}
|
|
3667
|
-
const resolved = normalizeModelId(
|
|
3668
|
-
if (!resolved.ok) err("model-unresolved", modelUnresolvedMessage(resolved), `${path}.model`, id);
|
|
4053
|
+
const resolved = normalizeModelId(pin, registry);
|
|
4054
|
+
if (!resolved.ok) err("model-unresolved", inContext(modelUnresolvedMessage(resolved)), `${path}.model`, id);
|
|
3669
4055
|
}, "checkModel");
|
|
3670
|
-
const checkWorkspace = /* @__PURE__ */
|
|
4056
|
+
const checkWorkspace = /* @__PURE__ */ __name4((node, path) => {
|
|
3671
4057
|
const id = singleId(node);
|
|
3672
4058
|
const ws = workspaceOf(node);
|
|
3673
4059
|
if (isJobTier(node) && opts.policy && opts.policy.jobTier !== true) {
|
|
@@ -3690,6 +4076,9 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3690
4076
|
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
4077
|
}
|
|
3692
4078
|
}
|
|
4079
|
+
if (node.type === "agent" && ws && ws !== "inherit" && ws.mount === "ro" && Array.isArray(tools) && effectiveJobTools(tools, true).length === 0) {
|
|
4080
|
+
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);
|
|
4081
|
+
}
|
|
3693
4082
|
if (ws && ws !== "inherit") {
|
|
3694
4083
|
if (!envelopeWorkspace && !opts.mayInherit) {
|
|
3695
4084
|
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 +4098,16 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3709
4098
|
}
|
|
3710
4099
|
}, "checkWorkspace");
|
|
3711
4100
|
const outputSchemas = /* @__PURE__ */ new Map();
|
|
3712
|
-
const recordOutputSchema = /* @__PURE__ */
|
|
4101
|
+
const recordOutputSchema = /* @__PURE__ */ __name4((node) => {
|
|
3713
4102
|
const schema = node.type === "step" ? node.step.outputSchema : node.type === "agent" ? node.outputSchema : void 0;
|
|
3714
4103
|
if (schema !== void 0) outputSchemas.set(singleId(node), schema);
|
|
3715
4104
|
}, "recordOutputSchema");
|
|
3716
|
-
const checkMapMembers = /* @__PURE__ */
|
|
4105
|
+
const checkMapMembers = /* @__PURE__ */ __name4((cfg, basePath, id) => {
|
|
3717
4106
|
for (const m of malformedMapMembers(cfg)) {
|
|
3718
4107
|
warn(MAP_MEMBER_MALFORMED_CODE, mapMemberMalformedMessage(id, m), `${basePath}.${m.member}`, id);
|
|
3719
4108
|
}
|
|
3720
4109
|
}, "checkMapMembers");
|
|
3721
|
-
const checkInputShape = /* @__PURE__ */
|
|
4110
|
+
const checkInputShape = /* @__PURE__ */ __name4((node, path) => {
|
|
3722
4111
|
const input = node.input;
|
|
3723
4112
|
if (input === void 0) return;
|
|
3724
4113
|
const id = singleId(node);
|
|
@@ -3728,11 +4117,11 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3728
4117
|
}
|
|
3729
4118
|
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
4119
|
}, "checkInputShape");
|
|
3731
|
-
const checkBodyInput = /* @__PURE__ */
|
|
4120
|
+
const checkBodyInput = /* @__PURE__ */ __name4((body, path, container) => {
|
|
3732
4121
|
if (body.type === "workflow" || body.input === void 0) return;
|
|
3733
4122
|
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
4123
|
}, "checkBodyInput");
|
|
3735
|
-
const checkSingle = /* @__PURE__ */
|
|
4124
|
+
const checkSingle = /* @__PURE__ */ __name4((node, path, depth) => {
|
|
3736
4125
|
recordOutputSchema(node);
|
|
3737
4126
|
if (node.type === "workflow" && (typeof node.workflowId !== "string" || node.workflowId.length === 0)) {
|
|
3738
4127
|
checkId(node.id, path);
|
|
@@ -3781,7 +4170,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3781
4170
|
}
|
|
3782
4171
|
}
|
|
3783
4172
|
}, "checkSingle");
|
|
3784
|
-
const checkHitl = /* @__PURE__ */
|
|
4173
|
+
const checkHitl = /* @__PURE__ */ __name4((node, path) => {
|
|
3785
4174
|
if (node.type === "waitForSignal") {
|
|
3786
4175
|
const w = node;
|
|
3787
4176
|
checkId(w.id, path);
|
|
@@ -3820,7 +4209,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3820
4209
|
}
|
|
3821
4210
|
}
|
|
3822
4211
|
}, "checkHitl");
|
|
3823
|
-
const checkHitlArm = /* @__PURE__ */
|
|
4212
|
+
const checkHitlArm = /* @__PURE__ */ __name4((node, path, container) => {
|
|
3824
4213
|
if (!workflowContainerRunsHitlArm(container)) {
|
|
3825
4214
|
checkId(node.id, path);
|
|
3826
4215
|
err("node-type-unsupported-in-container", workflowHitlArmUnsupportedMessage(node.type, node.id, container), path, node.id);
|
|
@@ -3828,7 +4217,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
3828
4217
|
}
|
|
3829
4218
|
checkHitl(node, path);
|
|
3830
4219
|
}, "checkHitlArm");
|
|
3831
|
-
const checkArm = /* @__PURE__ */
|
|
4220
|
+
const checkArm = /* @__PURE__ */ __name4((arm, path, depth, container) => {
|
|
3832
4221
|
if (arm.type === "mapping") {
|
|
3833
4222
|
checkId(arm.id, path);
|
|
3834
4223
|
checkMapMembers(readMapConfig(arm.mapConfig), `${path}.mapConfig`, arm.id);
|
|
@@ -4025,7 +4414,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
4025
4414
|
return issues;
|
|
4026
4415
|
}
|
|
4027
4416
|
__name(validateLuaExtensions, "validateLuaExtensions");
|
|
4028
|
-
|
|
4417
|
+
__name4(validateLuaExtensions, "validateLuaExtensions");
|
|
4029
4418
|
var EDITABLE_PATH_RE = /^[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?(\.[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?)*$/;
|
|
4030
4419
|
var PREDICATE_OPS = /* @__PURE__ */ new Set([
|
|
4031
4420
|
"eq",
|
|
@@ -4048,8 +4437,8 @@ function isPredicate(p) {
|
|
|
4048
4437
|
return typeof p === "object" && p !== null && typeof p.op === "string" && PREDICATE_OPS.has(p.op);
|
|
4049
4438
|
}
|
|
4050
4439
|
__name(isPredicate, "isPredicate");
|
|
4051
|
-
|
|
4052
|
-
var isPredicateScalar = /* @__PURE__ */
|
|
4440
|
+
__name4(isPredicate, "isPredicate");
|
|
4441
|
+
var isPredicateScalar = /* @__PURE__ */ __name4((v) => v === null || typeof v === "string" || typeof v === "number" || typeof v === "boolean", "isPredicateScalar");
|
|
4053
4442
|
function isPathOrLiteral(v) {
|
|
4054
4443
|
if (typeof v !== "object" || v === null) return false;
|
|
4055
4444
|
const r = v;
|
|
@@ -4057,7 +4446,7 @@ function isPathOrLiteral(v) {
|
|
|
4057
4446
|
return "literal" in r && isPredicateScalar(r.literal);
|
|
4058
4447
|
}
|
|
4059
4448
|
__name(isPathOrLiteral, "isPathOrLiteral");
|
|
4060
|
-
|
|
4449
|
+
__name4(isPathOrLiteral, "isPathOrLiteral");
|
|
4061
4450
|
function isWellFormedPredicate(p) {
|
|
4062
4451
|
if (!isPredicate(p)) return false;
|
|
4063
4452
|
const r = p;
|
|
@@ -4088,11 +4477,11 @@ function isWellFormedPredicate(p) {
|
|
|
4088
4477
|
}
|
|
4089
4478
|
}
|
|
4090
4479
|
__name(isWellFormedPredicate, "isWellFormedPredicate");
|
|
4091
|
-
|
|
4480
|
+
__name4(isWellFormedPredicate, "isWellFormedPredicate");
|
|
4092
4481
|
var GRAPH_HASH_PREFIX = "sha256-cj1:";
|
|
4093
4482
|
function canonicalJson(value22) {
|
|
4094
4483
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
4095
|
-
const encode = /* @__PURE__ */
|
|
4484
|
+
const encode = /* @__PURE__ */ __name4((v) => {
|
|
4096
4485
|
if (v === null || typeof v === "number" || typeof v === "boolean") return JSON.stringify(v);
|
|
4097
4486
|
if (typeof v === "string") return JSON.stringify(v);
|
|
4098
4487
|
if (typeof v === "bigint") return JSON.stringify(`${v}n`);
|
|
@@ -4113,19 +4502,19 @@ function canonicalJson(value22) {
|
|
|
4113
4502
|
return encode(value22);
|
|
4114
4503
|
}
|
|
4115
4504
|
__name(canonicalJson, "canonicalJson");
|
|
4116
|
-
|
|
4505
|
+
__name4(canonicalJson, "canonicalJson");
|
|
4117
4506
|
function hashGraph(g) {
|
|
4118
4507
|
const { metadata: _provenance, ...definition } = withDefaultsFilled(g).definition;
|
|
4119
4508
|
return GRAPH_HASH_PREFIX + createHash("sha256").update(canonicalJson(definition)).digest("hex");
|
|
4120
4509
|
}
|
|
4121
4510
|
__name(hashGraph, "hashGraph");
|
|
4122
|
-
|
|
4511
|
+
__name4(hashGraph, "hashGraph");
|
|
4123
4512
|
var WorkflowPlanError = class extends Error {
|
|
4124
4513
|
static {
|
|
4125
4514
|
__name(this, "WorkflowPlanError");
|
|
4126
4515
|
}
|
|
4127
4516
|
static {
|
|
4128
|
-
|
|
4517
|
+
__name4(this, "WorkflowPlanError");
|
|
4129
4518
|
}
|
|
4130
4519
|
code;
|
|
4131
4520
|
constructor(code, message) {
|
|
@@ -4133,15 +4522,15 @@ var WorkflowPlanError = class extends Error {
|
|
|
4133
4522
|
this.name = "WorkflowPlanError";
|
|
4134
4523
|
}
|
|
4135
4524
|
};
|
|
4136
|
-
var isArmStep = /* @__PURE__ */
|
|
4137
|
-
var armStepId = /* @__PURE__ */
|
|
4138
|
-
var armStepKind = /* @__PURE__ */
|
|
4139
|
-
var joinIdOf = /* @__PURE__ */
|
|
4140
|
-
var containerIdOf = /* @__PURE__ */
|
|
4525
|
+
var isArmStep = /* @__PURE__ */ __name4((e) => isWorkflowArmEntryType(e.type), "isArmStep");
|
|
4526
|
+
var armStepId = /* @__PURE__ */ __name4((e) => e.type === "step" ? e.step.id : e.id, "armStepId");
|
|
4527
|
+
var armStepKind = /* @__PURE__ */ __name4((e) => WORKFLOW_ARM_ENTRY_STEP_KINDS[e.type], "armStepKind");
|
|
4528
|
+
var joinIdOf = /* @__PURE__ */ __name4((entryId) => `${entryId}.join`, "joinIdOf");
|
|
4529
|
+
var containerIdOf = /* @__PURE__ */ __name4((type, entryIndex) => `${type}@${entryIndex}`, "containerIdOf");
|
|
4141
4530
|
function compilePlan(g) {
|
|
4142
4531
|
const steps = {};
|
|
4143
4532
|
const order = [];
|
|
4144
|
-
const addNode = /* @__PURE__ */
|
|
4533
|
+
const addNode = /* @__PURE__ */ __name4((id, node) => {
|
|
4145
4534
|
if (id in steps) {
|
|
4146
4535
|
throw new WorkflowPlanError("duplicate-step-id", `Duplicate step id "${id}" in definition.graph`);
|
|
4147
4536
|
}
|
|
@@ -4312,7 +4701,7 @@ function compilePlan(g) {
|
|
|
4312
4701
|
};
|
|
4313
4702
|
}
|
|
4314
4703
|
__name(compilePlan, "compilePlan");
|
|
4315
|
-
|
|
4704
|
+
__name4(compilePlan, "compilePlan");
|
|
4316
4705
|
var PATH_PLACEHOLDER = /^\$\{([^}]+)\}$/;
|
|
4317
4706
|
var MISSING = /* @__PURE__ */ Symbol("predicate.missing");
|
|
4318
4707
|
function resolvePath(rawPath, ctx) {
|
|
@@ -4356,7 +4745,7 @@ function resolvePath(rawPath, ctx) {
|
|
|
4356
4745
|
return walk(root, rest);
|
|
4357
4746
|
}
|
|
4358
4747
|
__name(resolvePath, "resolvePath");
|
|
4359
|
-
|
|
4748
|
+
__name4(resolvePath, "resolvePath");
|
|
4360
4749
|
function walk(root, path) {
|
|
4361
4750
|
if (path === "") return root;
|
|
4362
4751
|
const parts = path.split(".");
|
|
@@ -4371,13 +4760,13 @@ function walk(root, path) {
|
|
|
4371
4760
|
return value22;
|
|
4372
4761
|
}
|
|
4373
4762
|
__name(walk, "walk");
|
|
4374
|
-
|
|
4763
|
+
__name4(walk, "walk");
|
|
4375
4764
|
function resolveValue(ref, ctx) {
|
|
4376
4765
|
if ("literal" in ref) return ref.literal;
|
|
4377
4766
|
return resolvePath(ref.path, ctx);
|
|
4378
4767
|
}
|
|
4379
4768
|
__name(resolveValue, "resolveValue");
|
|
4380
|
-
|
|
4769
|
+
__name4(resolveValue, "resolveValue");
|
|
4381
4770
|
function evaluatePredicate(pred, ctx) {
|
|
4382
4771
|
switch (pred.op) {
|
|
4383
4772
|
case "and":
|
|
@@ -4417,7 +4806,7 @@ function evaluatePredicate(pred, ctx) {
|
|
|
4417
4806
|
}
|
|
4418
4807
|
}
|
|
4419
4808
|
__name(evaluatePredicate, "evaluatePredicate");
|
|
4420
|
-
|
|
4809
|
+
__name4(evaluatePredicate, "evaluatePredicate");
|
|
4421
4810
|
function compare(op, left, right) {
|
|
4422
4811
|
if (op === "eq") return left === right;
|
|
4423
4812
|
if (op === "ne") return left !== right;
|
|
@@ -4436,14 +4825,14 @@ function compare(op, left, right) {
|
|
|
4436
4825
|
return false;
|
|
4437
4826
|
}
|
|
4438
4827
|
__name(compare, "compare");
|
|
4439
|
-
|
|
4828
|
+
__name4(compare, "compare");
|
|
4440
4829
|
function derivePredicateLabel(pred, maxLength = 80) {
|
|
4441
4830
|
const raw = renderPredicate(pred);
|
|
4442
4831
|
if (raw.length <= maxLength) return raw;
|
|
4443
4832
|
return raw.slice(0, maxLength - 1) + "\u2026";
|
|
4444
4833
|
}
|
|
4445
4834
|
__name(derivePredicateLabel, "derivePredicateLabel");
|
|
4446
|
-
|
|
4835
|
+
__name4(derivePredicateLabel, "derivePredicateLabel");
|
|
4447
4836
|
function renderPredicate(pred) {
|
|
4448
4837
|
switch (pred.op) {
|
|
4449
4838
|
case "and":
|
|
@@ -4478,55 +4867,55 @@ function renderPredicate(pred) {
|
|
|
4478
4867
|
}
|
|
4479
4868
|
}
|
|
4480
4869
|
__name(renderPredicate, "renderPredicate");
|
|
4481
|
-
|
|
4870
|
+
__name4(renderPredicate, "renderPredicate");
|
|
4482
4871
|
function wrapLabel(child, rendered) {
|
|
4483
4872
|
return child.op === "and" || child.op === "or" || child.op === "not" ? `(${rendered})` : rendered;
|
|
4484
4873
|
}
|
|
4485
4874
|
__name(wrapLabel, "wrapLabel");
|
|
4486
|
-
|
|
4875
|
+
__name4(wrapLabel, "wrapLabel");
|
|
4487
4876
|
function renderRef(ref) {
|
|
4488
4877
|
if ("literal" in ref) return JSON.stringify(ref.literal);
|
|
4489
4878
|
return ref.path;
|
|
4490
4879
|
}
|
|
4491
4880
|
__name(renderRef, "renderRef");
|
|
4492
|
-
|
|
4493
|
-
var stepIdOf = /* @__PURE__ */
|
|
4881
|
+
__name4(renderRef, "renderRef");
|
|
4882
|
+
var stepIdOf = /* @__PURE__ */ __name4((s) => typeof s === "string" ? s : s.id, "stepIdOf");
|
|
4494
4883
|
function step(s) {
|
|
4495
4884
|
const id = stepIdOf(s);
|
|
4496
4885
|
return {
|
|
4497
|
-
path: /* @__PURE__ */
|
|
4886
|
+
path: /* @__PURE__ */ __name4((p) => ({
|
|
4498
4887
|
path: p === "" ? `stepResults.${id}` : `stepResults.${id}.${p}`
|
|
4499
4888
|
}), "path")
|
|
4500
4889
|
};
|
|
4501
4890
|
}
|
|
4502
4891
|
__name(step, "step");
|
|
4503
|
-
|
|
4892
|
+
__name4(step, "step");
|
|
4504
4893
|
function stepOf(id) {
|
|
4505
4894
|
return step(id);
|
|
4506
4895
|
}
|
|
4507
4896
|
__name(stepOf, "stepOf");
|
|
4508
|
-
|
|
4897
|
+
__name4(stepOf, "stepOf");
|
|
4509
4898
|
function init(path) {
|
|
4510
4899
|
return {
|
|
4511
4900
|
path: path === "" ? "initData" : `initData.${path}`
|
|
4512
4901
|
};
|
|
4513
4902
|
}
|
|
4514
4903
|
__name(init, "init");
|
|
4515
|
-
|
|
4904
|
+
__name4(init, "init");
|
|
4516
4905
|
function state(path) {
|
|
4517
4906
|
return {
|
|
4518
4907
|
path: path === "" ? "state" : `state.${path}`
|
|
4519
4908
|
};
|
|
4520
4909
|
}
|
|
4521
4910
|
__name(state, "state");
|
|
4522
|
-
|
|
4911
|
+
__name4(state, "state");
|
|
4523
4912
|
function lit(v) {
|
|
4524
4913
|
return {
|
|
4525
4914
|
literal: v
|
|
4526
4915
|
};
|
|
4527
4916
|
}
|
|
4528
4917
|
__name(lit, "lit");
|
|
4529
|
-
|
|
4918
|
+
__name4(lit, "lit");
|
|
4530
4919
|
function toPathOrLiteral(v) {
|
|
4531
4920
|
if (typeof v === "object" && v !== null) {
|
|
4532
4921
|
if ("path" in v) return {
|
|
@@ -4541,8 +4930,8 @@ function toPathOrLiteral(v) {
|
|
|
4541
4930
|
};
|
|
4542
4931
|
}
|
|
4543
4932
|
__name(toPathOrLiteral, "toPathOrLiteral");
|
|
4544
|
-
|
|
4545
|
-
var cmp = /* @__PURE__ */
|
|
4933
|
+
__name4(toPathOrLiteral, "toPathOrLiteral");
|
|
4934
|
+
var cmp = /* @__PURE__ */ __name4((op) => (l, r) => ({
|
|
4546
4935
|
op,
|
|
4547
4936
|
left: toPathOrLiteral(l),
|
|
4548
4937
|
right: toPathOrLiteral(r)
|
|
@@ -4553,49 +4942,49 @@ var gt = cmp("gt");
|
|
|
4553
4942
|
var gte = cmp("gte");
|
|
4554
4943
|
var lt = cmp("lt");
|
|
4555
4944
|
var lte = cmp("lte");
|
|
4556
|
-
var inSet = /* @__PURE__ */
|
|
4945
|
+
var inSet = /* @__PURE__ */ __name4((v, set) => ({
|
|
4557
4946
|
op: "in",
|
|
4558
4947
|
value: {
|
|
4559
4948
|
path: v.path
|
|
4560
4949
|
},
|
|
4561
4950
|
set
|
|
4562
4951
|
}), "inSet");
|
|
4563
|
-
var notIn = /* @__PURE__ */
|
|
4952
|
+
var notIn = /* @__PURE__ */ __name4((v, set) => ({
|
|
4564
4953
|
op: "notIn",
|
|
4565
4954
|
value: {
|
|
4566
4955
|
path: v.path
|
|
4567
4956
|
},
|
|
4568
4957
|
set
|
|
4569
4958
|
}), "notIn");
|
|
4570
|
-
var exists = /* @__PURE__ */
|
|
4959
|
+
var exists = /* @__PURE__ */ __name4((ref) => ({
|
|
4571
4960
|
op: "exists",
|
|
4572
4961
|
path: ref.path
|
|
4573
4962
|
}), "exists");
|
|
4574
|
-
var notExists = /* @__PURE__ */
|
|
4963
|
+
var notExists = /* @__PURE__ */ __name4((ref) => ({
|
|
4575
4964
|
op: "notExists",
|
|
4576
4965
|
path: ref.path
|
|
4577
4966
|
}), "notExists");
|
|
4578
|
-
var truthy = /* @__PURE__ */
|
|
4967
|
+
var truthy = /* @__PURE__ */ __name4((ref) => ({
|
|
4579
4968
|
op: "truthy",
|
|
4580
4969
|
value: {
|
|
4581
4970
|
path: ref.path
|
|
4582
4971
|
}
|
|
4583
4972
|
}), "truthy");
|
|
4584
|
-
var falsy = /* @__PURE__ */
|
|
4973
|
+
var falsy = /* @__PURE__ */ __name4((ref) => ({
|
|
4585
4974
|
op: "falsy",
|
|
4586
4975
|
value: {
|
|
4587
4976
|
path: ref.path
|
|
4588
4977
|
}
|
|
4589
4978
|
}), "falsy");
|
|
4590
|
-
var and = /* @__PURE__ */
|
|
4979
|
+
var and = /* @__PURE__ */ __name4((...args) => ({
|
|
4591
4980
|
op: "and",
|
|
4592
4981
|
args
|
|
4593
4982
|
}), "and");
|
|
4594
|
-
var or = /* @__PURE__ */
|
|
4983
|
+
var or = /* @__PURE__ */ __name4((...args) => ({
|
|
4595
4984
|
op: "or",
|
|
4596
4985
|
args
|
|
4597
4986
|
}), "or");
|
|
4598
|
-
var not = /* @__PURE__ */
|
|
4987
|
+
var not = /* @__PURE__ */ __name4((arg) => ({
|
|
4599
4988
|
op: "not",
|
|
4600
4989
|
arg
|
|
4601
4990
|
}), "not");
|
|
@@ -4660,7 +5049,7 @@ function continuedFailureValue(error, killReason) {
|
|
|
4660
5049
|
};
|
|
4661
5050
|
}
|
|
4662
5051
|
__name(continuedFailureValue, "continuedFailureValue");
|
|
4663
|
-
|
|
5052
|
+
__name4(continuedFailureValue, "continuedFailureValue");
|
|
4664
5053
|
function isContinuedFailureValue(v) {
|
|
4665
5054
|
if (v === null || typeof v !== "object" || Array.isArray(v)) return false;
|
|
4666
5055
|
const o = v;
|
|
@@ -4668,8 +5057,8 @@ function isContinuedFailureValue(v) {
|
|
|
4668
5057
|
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
5058
|
}
|
|
4670
5059
|
__name(isContinuedFailureValue, "isContinuedFailureValue");
|
|
4671
|
-
|
|
4672
|
-
var isHitlNode2 = /* @__PURE__ */
|
|
5060
|
+
__name4(isContinuedFailureValue, "isContinuedFailureValue");
|
|
5061
|
+
var isHitlNode2 = /* @__PURE__ */ __name4((n2) => isWorkflowHitlEntryType(n2.type), "isHitlNode");
|
|
4673
5062
|
function inlineContainerArm(mapping, step22) {
|
|
4674
5063
|
return {
|
|
4675
5064
|
...step22,
|
|
@@ -4677,8 +5066,8 @@ function inlineContainerArm(mapping, step22) {
|
|
|
4677
5066
|
};
|
|
4678
5067
|
}
|
|
4679
5068
|
__name(inlineContainerArm, "inlineContainerArm");
|
|
4680
|
-
|
|
4681
|
-
var nodeIdOf = /* @__PURE__ */
|
|
5069
|
+
__name4(inlineContainerArm, "inlineContainerArm");
|
|
5070
|
+
var nodeIdOf = /* @__PURE__ */ __name4((n2) => n2.type === "step" ? n2.step.id : n2.id, "nodeIdOf");
|
|
4682
5071
|
function entryIds(entry) {
|
|
4683
5072
|
switch (entry.type) {
|
|
4684
5073
|
case "parallel":
|
|
@@ -4702,13 +5091,13 @@ function entryIds(entry) {
|
|
|
4702
5091
|
}
|
|
4703
5092
|
}
|
|
4704
5093
|
__name(entryIds, "entryIds");
|
|
4705
|
-
|
|
5094
|
+
__name4(entryIds, "entryIds");
|
|
4706
5095
|
function resolvePlacements(calls) {
|
|
4707
5096
|
const issues = [];
|
|
4708
5097
|
const declared = /* @__PURE__ */ new Map();
|
|
4709
5098
|
const placedBy = /* @__PURE__ */ new Map();
|
|
4710
5099
|
const allIds = /* @__PURE__ */ new Map();
|
|
4711
|
-
const claimId = /* @__PURE__ */
|
|
5100
|
+
const claimId = /* @__PURE__ */ __name4((id, callIndex) => {
|
|
4712
5101
|
const first = allIds.get(id);
|
|
4713
5102
|
if (first !== void 0 && first !== callIndex) {
|
|
4714
5103
|
issues.push({
|
|
@@ -4748,7 +5137,7 @@ function resolvePlacements(calls) {
|
|
|
4748
5137
|
break;
|
|
4749
5138
|
}
|
|
4750
5139
|
});
|
|
4751
|
-
const armMapPlacementIssue = /* @__PURE__ */
|
|
5140
|
+
const armMapPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
|
|
4752
5141
|
if (!ref.armMap || node.type === "mapping" || isHitlNode2(node)) return void 0;
|
|
4753
5142
|
const id = nodeIdOf(node);
|
|
4754
5143
|
if ((container === "foreach" || container === "loop") && node.type !== "workflow") {
|
|
@@ -4769,7 +5158,7 @@ function resolvePlacements(calls) {
|
|
|
4769
5158
|
}
|
|
4770
5159
|
return void 0;
|
|
4771
5160
|
}, "armMapPlacementIssue");
|
|
4772
|
-
const hitlPlacementIssue = /* @__PURE__ */
|
|
5161
|
+
const hitlPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
|
|
4773
5162
|
if (!isHitlNode2(node)) return void 0;
|
|
4774
5163
|
const id = node.id;
|
|
4775
5164
|
if (ref.armMap) {
|
|
@@ -4790,7 +5179,7 @@ function resolvePlacements(calls) {
|
|
|
4790
5179
|
}
|
|
4791
5180
|
return void 0;
|
|
4792
5181
|
}, "hitlPlacementIssue");
|
|
4793
|
-
const resolve = /* @__PURE__ */
|
|
5182
|
+
const resolve = /* @__PURE__ */ __name4((ref, i, allowMapping, container) => {
|
|
4794
5183
|
if ("node" in ref) {
|
|
4795
5184
|
if (ref.node.type === "mapping" && !allowMapping) {
|
|
4796
5185
|
issues.push({
|
|
@@ -4845,7 +5234,7 @@ function resolvePlacements(calls) {
|
|
|
4845
5234
|
placedBy.set(ref.ref, i);
|
|
4846
5235
|
return d.node;
|
|
4847
5236
|
}, "resolve");
|
|
4848
|
-
const claim = /* @__PURE__ */
|
|
5237
|
+
const claim = /* @__PURE__ */ __name4((ref, i, allowMapping, container) => {
|
|
4849
5238
|
if ("ref" in ref) {
|
|
4850
5239
|
resolve(ref, i, allowMapping, container);
|
|
4851
5240
|
return;
|
|
@@ -4880,7 +5269,7 @@ function resolvePlacements(calls) {
|
|
|
4880
5269
|
}
|
|
4881
5270
|
});
|
|
4882
5271
|
const graph = [];
|
|
4883
|
-
const lookup = /* @__PURE__ */
|
|
5272
|
+
const lookup = /* @__PURE__ */ __name4((ref) => {
|
|
4884
5273
|
const n2 = "node" in ref ? ref.node : declared.get(ref.ref)?.node;
|
|
4885
5274
|
if (!n2 || !ref.armMap || n2.type === "mapping" || isHitlNode2(n2)) return n2;
|
|
4886
5275
|
return inlineContainerArm(ref.armMap, n2);
|
|
@@ -4963,7 +5352,7 @@ function resolvePlacements(calls) {
|
|
|
4963
5352
|
};
|
|
4964
5353
|
}
|
|
4965
5354
|
__name(resolvePlacements, "resolvePlacements");
|
|
4966
|
-
|
|
5355
|
+
__name4(resolvePlacements, "resolvePlacements");
|
|
4967
5356
|
var GOAL_JUDGE_STEP_ID = "__goal_judge";
|
|
4968
5357
|
var NON_LEAF_KINDS = /* @__PURE__ */ new Set([
|
|
4969
5358
|
"foreach",
|
|
@@ -4974,18 +5363,18 @@ function isConditionalJoinId(stepId) {
|
|
|
4974
5363
|
return CONDITIONAL_JOIN_ID.test(stepId);
|
|
4975
5364
|
}
|
|
4976
5365
|
__name(isConditionalJoinId, "isConditionalJoinId");
|
|
4977
|
-
|
|
5366
|
+
__name4(isConditionalJoinId, "isConditionalJoinId");
|
|
4978
5367
|
function isPlainObject(v) {
|
|
4979
5368
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4980
5369
|
}
|
|
4981
5370
|
__name(isPlainObject, "isPlainObject");
|
|
4982
|
-
|
|
5371
|
+
__name4(isPlainObject, "isPlainObject");
|
|
4983
5372
|
function leafValue(row) {
|
|
4984
5373
|
if (row.status === "completed") return row.output === void 0 ? null : row.output;
|
|
4985
5374
|
return continuedFailureValue(row.error, row.killReason);
|
|
4986
5375
|
}
|
|
4987
5376
|
__name(leafValue, "leafValue");
|
|
4988
|
-
|
|
5377
|
+
__name4(leafValue, "leafValue");
|
|
4989
5378
|
function runOutputLeaves(steps) {
|
|
4990
5379
|
const dependedOn = /* @__PURE__ */ new Set();
|
|
4991
5380
|
for (const s of steps) {
|
|
@@ -4995,7 +5384,7 @@ function runOutputLeaves(steps) {
|
|
|
4995
5384
|
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
5385
|
}
|
|
4997
5386
|
__name(runOutputLeaves, "runOutputLeaves");
|
|
4998
|
-
|
|
5387
|
+
__name4(runOutputLeaves, "runOutputLeaves");
|
|
4999
5388
|
function deriveRunOutput(steps) {
|
|
5000
5389
|
const leaves = runOutputLeaves(steps);
|
|
5001
5390
|
if (leaves.length === 0) return void 0;
|
|
@@ -5026,13 +5415,13 @@ function deriveRunOutput(steps) {
|
|
|
5026
5415
|
};
|
|
5027
5416
|
}
|
|
5028
5417
|
__name(deriveRunOutput, "deriveRunOutput");
|
|
5029
|
-
|
|
5418
|
+
__name4(deriveRunOutput, "deriveRunOutput");
|
|
5030
5419
|
function subrunSettledOutput(child) {
|
|
5031
5420
|
if (child.output !== void 0) return child.output;
|
|
5032
5421
|
return deriveRunOutput(child.steps ?? [])?.output ?? null;
|
|
5033
5422
|
}
|
|
5034
5423
|
__name(subrunSettledOutput, "subrunSettledOutput");
|
|
5035
|
-
|
|
5424
|
+
__name4(subrunSettledOutput, "subrunSettledOutput");
|
|
5036
5425
|
function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
|
|
5037
5426
|
const byId = /* @__PURE__ */ new Map();
|
|
5038
5427
|
for (const s of steps) {
|
|
@@ -5043,11 +5432,11 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
|
|
|
5043
5432
|
const seeded = [];
|
|
5044
5433
|
const unseeded = [];
|
|
5045
5434
|
const known = new Set(Object.keys(targetPlan.steps));
|
|
5046
|
-
const parentOf = /* @__PURE__ */
|
|
5435
|
+
const parentOf = /* @__PURE__ */ __name4((id) => {
|
|
5047
5436
|
const m = /^(.*)(\[\d+\]|#\d+)$/.exec(id);
|
|
5048
5437
|
return m ? m[1] : void 0;
|
|
5049
5438
|
}, "parentOf");
|
|
5050
|
-
const dependsOf = /* @__PURE__ */
|
|
5439
|
+
const dependsOf = /* @__PURE__ */ __name4((id) => {
|
|
5051
5440
|
const node = targetPlan.steps[id];
|
|
5052
5441
|
if (node) return node.dependsOn;
|
|
5053
5442
|
const parent = parentOf(id);
|
|
@@ -5093,8 +5482,8 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
|
|
|
5093
5482
|
};
|
|
5094
5483
|
}
|
|
5095
5484
|
__name(seedLedgerFromRun, "seedLedgerFromRun");
|
|
5096
|
-
|
|
5097
|
-
var branchArmId = /* @__PURE__ */
|
|
5485
|
+
__name4(seedLedgerFromRun, "seedLedgerFromRun");
|
|
5486
|
+
var branchArmId = /* @__PURE__ */ __name4((arm) => arm.type === "step" ? arm.step.id : arm.id, "branchArmId");
|
|
5098
5487
|
function branchSpecFromConditional(entry) {
|
|
5099
5488
|
return {
|
|
5100
5489
|
arms: entry.steps.map((arm, i) => ({
|
|
@@ -5110,7 +5499,7 @@ function branchSpecFromConditional(entry) {
|
|
|
5110
5499
|
};
|
|
5111
5500
|
}
|
|
5112
5501
|
__name(branchSpecFromConditional, "branchSpecFromConditional");
|
|
5113
|
-
|
|
5502
|
+
__name4(branchSpecFromConditional, "branchSpecFromConditional");
|
|
5114
5503
|
function selectBranchArms(spec, ctx) {
|
|
5115
5504
|
const taken = [];
|
|
5116
5505
|
for (const arm of spec.arms) {
|
|
@@ -5122,9 +5511,9 @@ function selectBranchArms(spec, ctx) {
|
|
|
5122
5511
|
return taken;
|
|
5123
5512
|
}
|
|
5124
5513
|
__name(selectBranchArms, "selectBranchArms");
|
|
5125
|
-
|
|
5126
|
-
var canonical = /* @__PURE__ */
|
|
5127
|
-
var sortKeys = /* @__PURE__ */
|
|
5514
|
+
__name4(selectBranchArms, "selectBranchArms");
|
|
5515
|
+
var canonical = /* @__PURE__ */ __name4((v) => JSON.stringify(sortKeys(v)), "canonical");
|
|
5516
|
+
var sortKeys = /* @__PURE__ */ __name4((v) => {
|
|
5128
5517
|
if (Array.isArray(v)) return v.map(sortKeys);
|
|
5129
5518
|
if (v && typeof v === "object") {
|
|
5130
5519
|
return Object.fromEntries(Object.keys(v).sort().map((k) => [
|
|
@@ -5152,7 +5541,7 @@ function replayLedger(g, ledger) {
|
|
|
5152
5541
|
startedAt: 0,
|
|
5153
5542
|
...ledger.requestContext
|
|
5154
5543
|
};
|
|
5155
|
-
const ctxFor = /* @__PURE__ */
|
|
5544
|
+
const ctxFor = /* @__PURE__ */ __name4((id) => ({
|
|
5156
5545
|
initData: ledger.initData,
|
|
5157
5546
|
stepResults: ancestorResults(plan, id, rows22),
|
|
5158
5547
|
state: ledger.state ?? {},
|
|
@@ -5218,9 +5607,9 @@ function replayLedger(g, ledger) {
|
|
|
5218
5607
|
};
|
|
5219
5608
|
}
|
|
5220
5609
|
__name(replayLedger, "replayLedger");
|
|
5221
|
-
|
|
5610
|
+
__name4(replayLedger, "replayLedger");
|
|
5222
5611
|
var JOIN = ".join";
|
|
5223
|
-
var entryOfJoin = /* @__PURE__ */
|
|
5612
|
+
var entryOfJoin = /* @__PURE__ */ __name4((id) => id.endsWith(JOIN) ? id.slice(0, -JOIN.length) : void 0, "entryOfJoin");
|
|
5224
5613
|
function replayResultOf(row, node) {
|
|
5225
5614
|
if (!row) return void 0;
|
|
5226
5615
|
if (row.status === "completed") return {
|
|
@@ -5235,12 +5624,12 @@ function replayResultOf(row, node) {
|
|
|
5235
5624
|
return void 0;
|
|
5236
5625
|
}
|
|
5237
5626
|
__name(replayResultOf, "replayResultOf");
|
|
5238
|
-
|
|
5627
|
+
__name4(replayResultOf, "replayResultOf");
|
|
5239
5628
|
function ancestorResults(plan, id, rows22) {
|
|
5240
5629
|
const out = {};
|
|
5241
5630
|
const joinAliased = /* @__PURE__ */ new Set();
|
|
5242
5631
|
const seen = /* @__PURE__ */ new Set();
|
|
5243
|
-
const take = /* @__PURE__ */
|
|
5632
|
+
const take = /* @__PURE__ */ __name4((rowId) => {
|
|
5244
5633
|
const hit = replayResultOf(rows22.get(rowId), plan.steps[rowId]);
|
|
5245
5634
|
if (!hit) return void 0;
|
|
5246
5635
|
if (!joinAliased.has(rowId)) out[rowId] = hit.value;
|
|
@@ -5257,7 +5646,7 @@ function ancestorResults(plan, id, rows22) {
|
|
|
5257
5646
|
}
|
|
5258
5647
|
return hit;
|
|
5259
5648
|
}, "take");
|
|
5260
|
-
const walk2 = /* @__PURE__ */
|
|
5649
|
+
const walk2 = /* @__PURE__ */ __name4((ids) => {
|
|
5261
5650
|
for (const dep of ids) {
|
|
5262
5651
|
if (seen.has(dep)) continue;
|
|
5263
5652
|
seen.add(dep);
|
|
@@ -5289,7 +5678,7 @@ function ancestorResults(plan, id, rows22) {
|
|
|
5289
5678
|
return out;
|
|
5290
5679
|
}
|
|
5291
5680
|
__name(ancestorResults, "ancestorResults");
|
|
5292
|
-
|
|
5681
|
+
__name4(ancestorResults, "ancestorResults");
|
|
5293
5682
|
function inferTaken(entry, rows22) {
|
|
5294
5683
|
const arms = [
|
|
5295
5684
|
...entry.steps,
|
|
@@ -5303,7 +5692,7 @@ function inferTaken(entry, rows22) {
|
|
|
5303
5692
|
});
|
|
5304
5693
|
}
|
|
5305
5694
|
__name(inferTaken, "inferTaken");
|
|
5306
|
-
|
|
5695
|
+
__name4(inferTaken, "inferTaken");
|
|
5307
5696
|
function countChildren(entry, rows22) {
|
|
5308
5697
|
const body = branchArmId(entry.step);
|
|
5309
5698
|
let n2 = 0;
|
|
@@ -5311,19 +5700,19 @@ function countChildren(entry, rows22) {
|
|
|
5311
5700
|
return n2;
|
|
5312
5701
|
}
|
|
5313
5702
|
__name(countChildren, "countChildren");
|
|
5314
|
-
|
|
5703
|
+
__name4(countChildren, "countChildren");
|
|
5315
5704
|
var FORCE_CANCEL_STALE_MS = 10 * 60 * 1e3;
|
|
5316
5705
|
var TERMINAL = new Set(WORKFLOW_RUN_TERMINAL);
|
|
5317
5706
|
function isTerminalRunStatus(status) {
|
|
5318
5707
|
return TERMINAL.has(status);
|
|
5319
5708
|
}
|
|
5320
5709
|
__name(isTerminalRunStatus, "isTerminalRunStatus");
|
|
5321
|
-
|
|
5710
|
+
__name4(isTerminalRunStatus, "isTerminalRunStatus");
|
|
5322
5711
|
function pruneUndefined(o) {
|
|
5323
5712
|
return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
|
|
5324
5713
|
}
|
|
5325
5714
|
__name(pruneUndefined, "pruneUndefined");
|
|
5326
|
-
|
|
5715
|
+
__name4(pruneUndefined, "pruneUndefined");
|
|
5327
5716
|
var WORKFLOW_INLINE_RUN_TAG = "inline";
|
|
5328
5717
|
function runOrigin(run) {
|
|
5329
5718
|
if (run.goalId) return "goal";
|
|
@@ -5332,7 +5721,7 @@ function runOrigin(run) {
|
|
|
5332
5721
|
return "definition";
|
|
5333
5722
|
}
|
|
5334
5723
|
__name(runOrigin, "runOrigin");
|
|
5335
|
-
|
|
5724
|
+
__name4(runOrigin, "runOrigin");
|
|
5336
5725
|
var RUN_ERROR_ISSUES_MAX = 20;
|
|
5337
5726
|
function runErrorIssues(issues) {
|
|
5338
5727
|
if (!Array.isArray(issues)) return void 0;
|
|
@@ -5350,7 +5739,7 @@ function runErrorIssues(issues) {
|
|
|
5350
5739
|
return out.length ? out : void 0;
|
|
5351
5740
|
}
|
|
5352
5741
|
__name(runErrorIssues, "runErrorIssues");
|
|
5353
|
-
|
|
5742
|
+
__name4(runErrorIssues, "runErrorIssues");
|
|
5354
5743
|
function runNextAction(run) {
|
|
5355
5744
|
if (isTerminalRunStatus(run.status)) return "none";
|
|
5356
5745
|
if (run.status === "suspended" && run.gate?.kind === "budget") return "raise_budget";
|
|
@@ -5360,7 +5749,7 @@ function runNextAction(run) {
|
|
|
5360
5749
|
return Date.now() >= forceAt ? "force" : "cancel_again";
|
|
5361
5750
|
}
|
|
5362
5751
|
__name(runNextAction, "runNextAction");
|
|
5363
|
-
|
|
5752
|
+
__name4(runNextAction, "runNextAction");
|
|
5364
5753
|
var IN_FLIGHT = new Set(WORKFLOW_STEP_IN_FLIGHT);
|
|
5365
5754
|
function emptyRunCounts() {
|
|
5366
5755
|
const out = {
|
|
@@ -5371,7 +5760,7 @@ function emptyRunCounts() {
|
|
|
5371
5760
|
return out;
|
|
5372
5761
|
}
|
|
5373
5762
|
__name(emptyRunCounts, "emptyRunCounts");
|
|
5374
|
-
|
|
5763
|
+
__name4(emptyRunCounts, "emptyRunCounts");
|
|
5375
5764
|
function runCountsFromStatusTally(tally) {
|
|
5376
5765
|
const out = emptyRunCounts();
|
|
5377
5766
|
for (const [status, n2] of Object.entries(tally)) {
|
|
@@ -5383,25 +5772,25 @@ function runCountsFromStatusTally(tally) {
|
|
|
5383
5772
|
return out;
|
|
5384
5773
|
}
|
|
5385
5774
|
__name(runCountsFromStatusTally, "runCountsFromStatusTally");
|
|
5386
|
-
|
|
5775
|
+
__name4(runCountsFromStatusTally, "runCountsFromStatusTally");
|
|
5387
5776
|
function runCountsFromStepStatuses(statuses) {
|
|
5388
5777
|
const tally = {};
|
|
5389
5778
|
for (const s of statuses) tally[s] = (tally[s] ?? 0) + 1;
|
|
5390
5779
|
return runCountsFromStatusTally(tally);
|
|
5391
5780
|
}
|
|
5392
5781
|
__name(runCountsFromStepStatuses, "runCountsFromStepStatuses");
|
|
5393
|
-
|
|
5782
|
+
__name4(runCountsFromStepStatuses, "runCountsFromStepStatuses");
|
|
5394
5783
|
function isBillingHeldStep(row) {
|
|
5395
5784
|
return row.status === "ready" && row.billingHold === true;
|
|
5396
5785
|
}
|
|
5397
5786
|
__name(isBillingHeldStep, "isBillingHeldStep");
|
|
5398
|
-
|
|
5787
|
+
__name4(isBillingHeldStep, "isBillingHeldStep");
|
|
5399
5788
|
function stepEffectiveStatus(row) {
|
|
5400
5789
|
return isBillingHeldStep(row) ? "suspended" : row.status;
|
|
5401
5790
|
}
|
|
5402
5791
|
__name(stepEffectiveStatus, "stepEffectiveStatus");
|
|
5403
|
-
|
|
5404
|
-
var n = /* @__PURE__ */
|
|
5792
|
+
__name4(stepEffectiveStatus, "stepEffectiveStatus");
|
|
5793
|
+
var n = /* @__PURE__ */ __name4((v) => typeof v === "number" && Number.isFinite(v) ? v : 0, "n");
|
|
5405
5794
|
function runCounts(counts) {
|
|
5406
5795
|
const c = counts ?? {};
|
|
5407
5796
|
const rawInFlight = c.dispatched !== void 0 || c.claimed !== void 0 || c.running !== void 0 || c.cancellation_requested !== void 0;
|
|
@@ -5418,24 +5807,24 @@ function runCounts(counts) {
|
|
|
5418
5807
|
};
|
|
5419
5808
|
}
|
|
5420
5809
|
__name(runCounts, "runCounts");
|
|
5421
|
-
|
|
5810
|
+
__name4(runCounts, "runCounts");
|
|
5422
5811
|
function isPricedStepReceipt(receipt) {
|
|
5423
5812
|
return typeof receipt?.multiplier === "number" && Number.isFinite(receipt.multiplier);
|
|
5424
5813
|
}
|
|
5425
5814
|
__name(isPricedStepReceipt, "isPricedStepReceipt");
|
|
5426
|
-
|
|
5815
|
+
__name4(isPricedStepReceipt, "isPricedStepReceipt");
|
|
5427
5816
|
function receiptEngine(engine) {
|
|
5428
5817
|
if (engine === "actions") return "seat";
|
|
5429
5818
|
if (engine === "credits") return "legacy";
|
|
5430
5819
|
return void 0;
|
|
5431
5820
|
}
|
|
5432
5821
|
__name(receiptEngine, "receiptEngine");
|
|
5433
|
-
|
|
5822
|
+
__name4(receiptEngine, "receiptEngine");
|
|
5434
5823
|
function receiptTier(tier) {
|
|
5435
5824
|
return tier === "light" || tier === "standard" || tier === "heavy" ? tier : void 0;
|
|
5436
5825
|
}
|
|
5437
5826
|
__name(receiptTier, "receiptTier");
|
|
5438
|
-
|
|
5827
|
+
__name4(receiptTier, "receiptTier");
|
|
5439
5828
|
function stepBillingView(receipt) {
|
|
5440
5829
|
const engine = receiptEngine(receipt?.engine);
|
|
5441
5830
|
if (!receipt || engine === void 0) return void 0;
|
|
@@ -5452,7 +5841,7 @@ function stepBillingView(receipt) {
|
|
|
5452
5841
|
});
|
|
5453
5842
|
}
|
|
5454
5843
|
__name(stepBillingView, "stepBillingView");
|
|
5455
|
-
|
|
5844
|
+
__name4(stepBillingView, "stepBillingView");
|
|
5456
5845
|
function runUsage(run, receipts) {
|
|
5457
5846
|
const actions = n(run.budget?.spent?.actionsEstimate);
|
|
5458
5847
|
const stamped = run.budget?.engine;
|
|
@@ -5476,13 +5865,13 @@ function runUsage(run, receipts) {
|
|
|
5476
5865
|
};
|
|
5477
5866
|
}
|
|
5478
5867
|
__name(runUsage, "runUsage");
|
|
5479
|
-
|
|
5868
|
+
__name4(runUsage, "runUsage");
|
|
5480
5869
|
function runBudgetCap(budget) {
|
|
5481
5870
|
const cap = budget?.maxCredits;
|
|
5482
5871
|
return typeof cap === "number" && Number.isFinite(cap) && cap > 0 ? cap : void 0;
|
|
5483
5872
|
}
|
|
5484
5873
|
__name(runBudgetCap, "runBudgetCap");
|
|
5485
|
-
|
|
5874
|
+
__name4(runBudgetCap, "runBudgetCap");
|
|
5486
5875
|
function runBudgetRemaining(budget) {
|
|
5487
5876
|
const cap = runBudgetCap(budget);
|
|
5488
5877
|
if (cap === void 0) return void 0;
|
|
@@ -5490,7 +5879,7 @@ function runBudgetRemaining(budget) {
|
|
|
5490
5879
|
return Math.max(0, cap - n(spent?.credits) - n(spent?.actionsEstimate) - n(budget?.reserved));
|
|
5491
5880
|
}
|
|
5492
5881
|
__name(runBudgetRemaining, "runBudgetRemaining");
|
|
5493
|
-
|
|
5882
|
+
__name4(runBudgetRemaining, "runBudgetRemaining");
|
|
5494
5883
|
function runCancelView(cancel) {
|
|
5495
5884
|
if (!cancel) return void 0;
|
|
5496
5885
|
return {
|
|
@@ -5516,7 +5905,7 @@ function runCancelView(cancel) {
|
|
|
5516
5905
|
};
|
|
5517
5906
|
}
|
|
5518
5907
|
__name(runCancelView, "runCancelView");
|
|
5519
|
-
|
|
5908
|
+
__name4(runCancelView, "runCancelView");
|
|
5520
5909
|
function runWorkspaceView(ws) {
|
|
5521
5910
|
if (!ws) return void 0;
|
|
5522
5911
|
const w = ws;
|
|
@@ -5531,7 +5920,7 @@ function runWorkspaceView(ws) {
|
|
|
5531
5920
|
});
|
|
5532
5921
|
}
|
|
5533
5922
|
__name(runWorkspaceView, "runWorkspaceView");
|
|
5534
|
-
|
|
5923
|
+
__name4(runWorkspaceView, "runWorkspaceView");
|
|
5535
5924
|
function toWorkflowRunSummary(run) {
|
|
5536
5925
|
const status = run.status;
|
|
5537
5926
|
const principal = run.principal?.principal;
|
|
@@ -5603,7 +5992,7 @@ function toWorkflowRunSummary(run) {
|
|
|
5603
5992
|
});
|
|
5604
5993
|
}
|
|
5605
5994
|
__name(toWorkflowRunSummary, "toWorkflowRunSummary");
|
|
5606
|
-
|
|
5995
|
+
__name4(toWorkflowRunSummary, "toWorkflowRunSummary");
|
|
5607
5996
|
var STEP_ERROR_DETAIL_KEYS = [
|
|
5608
5997
|
"reason",
|
|
5609
5998
|
"key",
|
|
@@ -5632,7 +6021,26 @@ var STEP_ERROR_DETAIL_KEYS = [
|
|
|
5632
6021
|
"workflowId",
|
|
5633
6022
|
// LUA-696 (review 2): the `ctx.once` key of an `effect_in_doubt` park — the step site stamps it here (scrubbed)
|
|
5634
6023
|
// beside `park.effectKey`; a key is user text and leaves scrubbed like every other string leaf.
|
|
5635
|
-
"effectKey"
|
|
6024
|
+
"effectKey",
|
|
6025
|
+
// LUA-833: the Job tier's `job_auth_rejected{reason}` evidence — the pod that exited and its code, the Secret the
|
|
6026
|
+
// row named (a k8s object NAME, `wfs-<hash12>-a<n>`, never a value), the execution the pod was spawned for, the
|
|
6027
|
+
// one its credential was minted for, and whether that credential had expired. The LUA-716 / LUA-748 spawn
|
|
6028
|
+
// refusals name `secretName` too.
|
|
6029
|
+
"podName",
|
|
6030
|
+
"exitCode",
|
|
6031
|
+
"secretName",
|
|
6032
|
+
"executionId",
|
|
6033
|
+
"credentialsExecutionId",
|
|
6034
|
+
"expired",
|
|
6035
|
+
// Run-input-bound model pins (the Principal Engineer stage models): the Job tier's `MODEL_ERROR` refusals name the
|
|
6036
|
+
// pin they judged (`requested`), the declared harness, the provider the classifier read and the precedence leg the
|
|
6037
|
+
// pin came from (`source`: initData / default / node / env / org / stamp), and `provider_unsupported`'s fleet
|
|
6038
|
+
// (`allowed`, the LUA_WF_JOB_PROVIDERS list) — the members the PR body promises.
|
|
6039
|
+
"requested",
|
|
6040
|
+
"harness",
|
|
6041
|
+
"provider",
|
|
6042
|
+
"source",
|
|
6043
|
+
"allowed"
|
|
5636
6044
|
];
|
|
5637
6045
|
var STEP_ERROR_DETAIL_MAX_BYTES = 8 * 1024;
|
|
5638
6046
|
var DETAIL_MAX_DEPTH = 4;
|
|
@@ -5655,7 +6063,7 @@ function scrubDetailValue(value22, depth) {
|
|
|
5655
6063
|
return void 0;
|
|
5656
6064
|
}
|
|
5657
6065
|
__name(scrubDetailValue, "scrubDetailValue");
|
|
5658
|
-
|
|
6066
|
+
__name4(scrubDetailValue, "scrubDetailValue");
|
|
5659
6067
|
function stepErrorDetail(error) {
|
|
5660
6068
|
if (!error || typeof error !== "object") return void 0;
|
|
5661
6069
|
const d = error.detail;
|
|
@@ -5683,7 +6091,7 @@ function stepErrorDetail(error) {
|
|
|
5683
6091
|
};
|
|
5684
6092
|
}
|
|
5685
6093
|
__name(stepErrorDetail, "stepErrorDetail");
|
|
5686
|
-
|
|
6094
|
+
__name4(stepErrorDetail, "stepErrorDetail");
|
|
5687
6095
|
var MAX_HOLIDAYS = 366;
|
|
5688
6096
|
var MAX_WALK_DAYS = 400;
|
|
5689
6097
|
var HHMM = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
@@ -5719,10 +6127,10 @@ function timeZoneSupported(tz) {
|
|
|
5719
6127
|
}
|
|
5720
6128
|
}
|
|
5721
6129
|
__name(timeZoneSupported, "timeZoneSupported");
|
|
5722
|
-
|
|
6130
|
+
__name4(timeZoneSupported, "timeZoneSupported");
|
|
5723
6131
|
function validateBusinessHours(cal, path = "businessHours") {
|
|
5724
6132
|
const issues = [];
|
|
5725
|
-
const issue = /* @__PURE__ */
|
|
6133
|
+
const issue = /* @__PURE__ */ __name4((p, message) => issues.push({
|
|
5726
6134
|
code: "business-hours-invalid",
|
|
5727
6135
|
path: p,
|
|
5728
6136
|
message
|
|
@@ -5762,24 +6170,24 @@ function validateBusinessHours(cal, path = "businessHours") {
|
|
|
5762
6170
|
return issues;
|
|
5763
6171
|
}
|
|
5764
6172
|
__name(validateBusinessHours, "validateBusinessHours");
|
|
5765
|
-
|
|
6173
|
+
__name4(validateBusinessHours, "validateBusinessHours");
|
|
5766
6174
|
function toMinutes(hhmm) {
|
|
5767
6175
|
const m = HHMM.exec(hhmm);
|
|
5768
6176
|
return Number(m[1]) * 60 + Number(m[2]);
|
|
5769
6177
|
}
|
|
5770
6178
|
__name(toMinutes, "toMinutes");
|
|
5771
|
-
|
|
6179
|
+
__name4(toMinutes, "toMinutes");
|
|
5772
6180
|
function resolveCalendar(cal) {
|
|
5773
6181
|
return cal.calendar === void 0 || cal.calendar === "mon-fri" ? MON_FRI : cal.calendar;
|
|
5774
6182
|
}
|
|
5775
6183
|
__name(resolveCalendar, "resolveCalendar");
|
|
5776
|
-
|
|
6184
|
+
__name4(resolveCalendar, "resolveCalendar");
|
|
5777
6185
|
function assertValid(cal) {
|
|
5778
6186
|
const issues = validateBusinessHours(cal);
|
|
5779
6187
|
if (issues.length > 0) throw new RangeError(`business-hours-invalid: ${issues.map((i) => i.path).join(", ")}`);
|
|
5780
6188
|
}
|
|
5781
6189
|
__name(assertValid, "assertValid");
|
|
5782
|
-
|
|
6190
|
+
__name4(assertValid, "assertValid");
|
|
5783
6191
|
var fmtCache = /* @__PURE__ */ new Map();
|
|
5784
6192
|
function formatter(tz) {
|
|
5785
6193
|
let f = fmtCache.get(tz);
|
|
@@ -5799,7 +6207,7 @@ function formatter(tz) {
|
|
|
5799
6207
|
return f;
|
|
5800
6208
|
}
|
|
5801
6209
|
__name(formatter, "formatter");
|
|
5802
|
-
|
|
6210
|
+
__name4(formatter, "formatter");
|
|
5803
6211
|
var WEEKDAYS = {
|
|
5804
6212
|
Sun: 0,
|
|
5805
6213
|
Mon: 1,
|
|
@@ -5811,7 +6219,7 @@ var WEEKDAYS = {
|
|
|
5811
6219
|
};
|
|
5812
6220
|
function localParts(ms, tz) {
|
|
5813
6221
|
const parts = formatter(tz).formatToParts(new Date(ms));
|
|
5814
|
-
const get = /* @__PURE__ */
|
|
6222
|
+
const get = /* @__PURE__ */ __name4((t) => parts.find((p) => p.type === t)?.value ?? "", "get");
|
|
5815
6223
|
const hour = Number(get("hour")) % 24;
|
|
5816
6224
|
return {
|
|
5817
6225
|
year: Number(get("year")),
|
|
@@ -5823,7 +6231,7 @@ function localParts(ms, tz) {
|
|
|
5823
6231
|
};
|
|
5824
6232
|
}
|
|
5825
6233
|
__name(localParts, "localParts");
|
|
5826
|
-
|
|
6234
|
+
__name4(localParts, "localParts");
|
|
5827
6235
|
function offsetAt(ms, tz) {
|
|
5828
6236
|
const p = localParts(ms, tz);
|
|
5829
6237
|
const asUtc = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, 0, 0);
|
|
@@ -5831,7 +6239,7 @@ function offsetAt(ms, tz) {
|
|
|
5831
6239
|
return asUtc - floored;
|
|
5832
6240
|
}
|
|
5833
6241
|
__name(offsetAt, "offsetAt");
|
|
5834
|
-
|
|
6242
|
+
__name4(offsetAt, "offsetAt");
|
|
5835
6243
|
function localToUtc(y, m, d, minutes, tz) {
|
|
5836
6244
|
const wall = Date.UTC(y, m - 1, d, Math.floor(minutes / 60), minutes % 60, 0, 0);
|
|
5837
6245
|
const guess = wall - offsetAt(wall, tz);
|
|
@@ -5853,18 +6261,18 @@ function localToUtc(y, m, d, minutes, tz) {
|
|
|
5853
6261
|
return probe;
|
|
5854
6262
|
}
|
|
5855
6263
|
__name(localToUtc, "localToUtc");
|
|
5856
|
-
|
|
6264
|
+
__name4(localToUtc, "localToUtc");
|
|
5857
6265
|
function sameWall(ms, y, m, d, minutes, tz) {
|
|
5858
6266
|
const p = localParts(ms, tz);
|
|
5859
6267
|
return p.year === y && p.month === m && p.day === d && p.hour * 60 + p.minute === minutes;
|
|
5860
6268
|
}
|
|
5861
6269
|
__name(sameWall, "sameWall");
|
|
5862
|
-
|
|
6270
|
+
__name4(sameWall, "sameWall");
|
|
5863
6271
|
function ymd(p) {
|
|
5864
6272
|
return `${p.year}-${String(p.month).padStart(2, "0")}-${String(p.day).padStart(2, "0")}`;
|
|
5865
6273
|
}
|
|
5866
6274
|
__name(ymd, "ymd");
|
|
5867
|
-
|
|
6275
|
+
__name4(ymd, "ymd");
|
|
5868
6276
|
function windowOf(ms, tz, k, holidays) {
|
|
5869
6277
|
const p = localParts(ms, tz);
|
|
5870
6278
|
if (!k.days.includes(p.weekday) || holidays.has(ymd(p))) return null;
|
|
@@ -5874,14 +6282,14 @@ function windowOf(ms, tz, k, holidays) {
|
|
|
5874
6282
|
};
|
|
5875
6283
|
}
|
|
5876
6284
|
__name(windowOf, "windowOf");
|
|
5877
|
-
|
|
6285
|
+
__name4(windowOf, "windowOf");
|
|
5878
6286
|
function nextDayAnchor(ms, tz) {
|
|
5879
6287
|
const p = localParts(ms, tz);
|
|
5880
6288
|
const next = new Date(Date.UTC(p.year, p.month - 1, p.day) + MS_PER_DAY);
|
|
5881
6289
|
return localToUtc(next.getUTCFullYear(), next.getUTCMonth() + 1, next.getUTCDate(), 0, tz);
|
|
5882
6290
|
}
|
|
5883
6291
|
__name(nextDayAnchor, "nextDayAnchor");
|
|
5884
|
-
|
|
6292
|
+
__name4(nextDayAnchor, "nextDayAnchor");
|
|
5885
6293
|
function addBusinessTime(fromMs, hours, cal) {
|
|
5886
6294
|
assertValid(cal);
|
|
5887
6295
|
if (!Number.isFinite(fromMs) || !Number.isFinite(hours)) throw new RangeError("addBusinessTime: non-finite input");
|
|
@@ -5902,7 +6310,7 @@ function addBusinessTime(fromMs, hours, cal) {
|
|
|
5902
6310
|
throw new RangeError("addBusinessTime: walk exceeded the calendar bound");
|
|
5903
6311
|
}
|
|
5904
6312
|
__name(addBusinessTime, "addBusinessTime");
|
|
5905
|
-
|
|
6313
|
+
__name4(addBusinessTime, "addBusinessTime");
|
|
5906
6314
|
function roundToBusinessTime(atMs, cal, round = "next-open") {
|
|
5907
6315
|
assertValid(cal);
|
|
5908
6316
|
if (!Number.isFinite(atMs)) throw new RangeError("roundToBusinessTime: non-finite input");
|
|
@@ -5920,7 +6328,7 @@ function roundToBusinessTime(atMs, cal, round = "next-open") {
|
|
|
5920
6328
|
throw new RangeError("roundToBusinessTime: walk exceeded the calendar bound");
|
|
5921
6329
|
}
|
|
5922
6330
|
__name(roundToBusinessTime, "roundToBusinessTime");
|
|
5923
|
-
|
|
6331
|
+
__name4(roundToBusinessTime, "roundToBusinessTime");
|
|
5924
6332
|
function isBusinessTime(atMs, cal) {
|
|
5925
6333
|
assertValid(cal);
|
|
5926
6334
|
const k = resolveCalendar(cal);
|
|
@@ -5928,7 +6336,7 @@ function isBusinessTime(atMs, cal) {
|
|
|
5928
6336
|
return !!w && atMs >= w.open && atMs < w.close;
|
|
5929
6337
|
}
|
|
5930
6338
|
__name(isBusinessTime, "isBusinessTime");
|
|
5931
|
-
|
|
6339
|
+
__name4(isBusinessTime, "isBusinessTime");
|
|
5932
6340
|
var JSON_PATCH_OPS = [
|
|
5933
6341
|
"replace",
|
|
5934
6342
|
"add",
|
|
@@ -5962,12 +6370,12 @@ function parseEditablePath(entry) {
|
|
|
5962
6370
|
return out;
|
|
5963
6371
|
}
|
|
5964
6372
|
__name(parseEditablePath, "parseEditablePath");
|
|
5965
|
-
|
|
6373
|
+
__name4(parseEditablePath, "parseEditablePath");
|
|
5966
6374
|
function isEditablePathEntry(entry) {
|
|
5967
6375
|
return typeof entry === "string" && parseEditablePath(entry) !== null;
|
|
5968
6376
|
}
|
|
5969
6377
|
__name(isEditablePathEntry, "isEditablePathEntry");
|
|
5970
|
-
|
|
6378
|
+
__name4(isEditablePathEntry, "isEditablePathEntry");
|
|
5971
6379
|
function pointerToSegments(pointer) {
|
|
5972
6380
|
if (typeof pointer !== "string" || pointer.length === 0 || pointer[0] !== "/") return null;
|
|
5973
6381
|
const decoded = pointer.slice(1).split("/").map((s) => s.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
@@ -5975,7 +6383,7 @@ function pointerToSegments(pointer) {
|
|
|
5975
6383
|
return decoded.map((s) => s === "-" ? "-" : /^(0|[1-9]\d*)$/.test(s) ? Number(s) : s);
|
|
5976
6384
|
}
|
|
5977
6385
|
__name(pointerToSegments, "pointerToSegments");
|
|
5978
|
-
|
|
6386
|
+
__name4(pointerToSegments, "pointerToSegments");
|
|
5979
6387
|
function pointerToDotPath(pointer) {
|
|
5980
6388
|
const segs = pointerToSegments(pointer);
|
|
5981
6389
|
if (!segs) return pointer;
|
|
@@ -5988,7 +6396,7 @@ function pointerToDotPath(pointer) {
|
|
|
5988
6396
|
return out;
|
|
5989
6397
|
}
|
|
5990
6398
|
__name(pointerToDotPath, "pointerToDotPath");
|
|
5991
|
-
|
|
6399
|
+
__name4(pointerToDotPath, "pointerToDotPath");
|
|
5992
6400
|
function coveredBy(segs, entry, op) {
|
|
5993
6401
|
if (segs.length < entry.length) return false;
|
|
5994
6402
|
for (let i = 0; i < entry.length; i += 1) {
|
|
@@ -6008,7 +6416,7 @@ function coveredBy(segs, entry, op) {
|
|
|
6008
6416
|
return true;
|
|
6009
6417
|
}
|
|
6010
6418
|
__name(coveredBy, "coveredBy");
|
|
6011
|
-
|
|
6419
|
+
__name4(coveredBy, "coveredBy");
|
|
6012
6420
|
function matchesEditablePath(pointer, editablePaths, op = "replace") {
|
|
6013
6421
|
const segs = pointerToSegments(pointer);
|
|
6014
6422
|
if (!segs || segs.length === 0) return false;
|
|
@@ -6019,10 +6427,10 @@ function matchesEditablePath(pointer, editablePaths, op = "replace") {
|
|
|
6019
6427
|
return false;
|
|
6020
6428
|
}
|
|
6021
6429
|
__name(matchesEditablePath, "matchesEditablePath");
|
|
6022
|
-
|
|
6430
|
+
__name4(matchesEditablePath, "matchesEditablePath");
|
|
6023
6431
|
function changedPointers(before, after, base = "") {
|
|
6024
6432
|
if (before === after) return [];
|
|
6025
|
-
const isObj = /* @__PURE__ */
|
|
6433
|
+
const isObj = /* @__PURE__ */ __name4((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isObj");
|
|
6026
6434
|
if (Array.isArray(before) && Array.isArray(after)) {
|
|
6027
6435
|
if (before.length !== after.length) return [
|
|
6028
6436
|
base || "/"
|
|
@@ -6055,12 +6463,12 @@ function changedPointers(before, after, base = "") {
|
|
|
6055
6463
|
];
|
|
6056
6464
|
}
|
|
6057
6465
|
__name(changedPointers, "changedPointers");
|
|
6058
|
-
|
|
6466
|
+
__name4(changedPointers, "changedPointers");
|
|
6059
6467
|
function escapePointer(key) {
|
|
6060
6468
|
return key.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
6061
6469
|
}
|
|
6062
6470
|
__name(escapePointer, "escapePointer");
|
|
6063
|
-
|
|
6471
|
+
__name4(escapePointer, "escapePointer");
|
|
6064
6472
|
function validateJsonPatch(ops) {
|
|
6065
6473
|
if (!Array.isArray(ops)) return {
|
|
6066
6474
|
ok: false,
|
|
@@ -6130,7 +6538,7 @@ function validateJsonPatch(ops) {
|
|
|
6130
6538
|
};
|
|
6131
6539
|
}
|
|
6132
6540
|
__name(validateJsonPatch, "validateJsonPatch");
|
|
6133
|
-
|
|
6541
|
+
__name4(validateJsonPatch, "validateJsonPatch");
|
|
6134
6542
|
function applyJsonPatch(doc, ops) {
|
|
6135
6543
|
let value22 = structuredClone(doc);
|
|
6136
6544
|
for (let i = 0; i < ops.length; i += 1) {
|
|
@@ -6231,13 +6639,13 @@ function applyJsonPatch(doc, ops) {
|
|
|
6231
6639
|
};
|
|
6232
6640
|
}
|
|
6233
6641
|
__name(applyJsonPatch, "applyJsonPatch");
|
|
6234
|
-
|
|
6642
|
+
__name4(applyJsonPatch, "applyJsonPatch");
|
|
6235
6643
|
function rebaseItemPointer(pointer, itemsPath, index) {
|
|
6236
6644
|
const base = `/${itemsPath.split(".").map(escapePointer).join("/")}/${index}`;
|
|
6237
6645
|
return pointer === "/" || pointer === "" ? base : `${base}${pointer}`;
|
|
6238
6646
|
}
|
|
6239
6647
|
__name(rebaseItemPointer, "rebaseItemPointer");
|
|
6240
|
-
|
|
6648
|
+
__name4(rebaseItemPointer, "rebaseItemPointer");
|
|
6241
6649
|
var WORKFLOW_SCHEDULE_TYPES = [
|
|
6242
6650
|
"cron",
|
|
6243
6651
|
"interval",
|
|
@@ -6245,10 +6653,14 @@ var WORKFLOW_SCHEDULE_TYPES = [
|
|
|
6245
6653
|
];
|
|
6246
6654
|
var WORKFLOW_SCHEDULE_SHAPE_ISSUE = "schedule-shape-invalid";
|
|
6247
6655
|
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
|
|
6656
|
+
var WORKFLOW_SCHEDULE_RUN_AS = [
|
|
6657
|
+
"installer",
|
|
6658
|
+
"system"
|
|
6659
|
+
];
|
|
6660
|
+
var isObject = /* @__PURE__ */ __name4((v) => typeof v === "object" && v !== null && !Array.isArray(v), "isObject");
|
|
6249
6661
|
function validateWorkflowSchedule(schedule, path = "/schedule") {
|
|
6250
6662
|
if (schedule === void 0 || schedule === null) return [];
|
|
6251
|
-
const issue = /* @__PURE__ */
|
|
6663
|
+
const issue = /* @__PURE__ */ __name4((at, detail) => [
|
|
6252
6664
|
{
|
|
6253
6665
|
code: WORKFLOW_SCHEDULE_SHAPE_ISSUE,
|
|
6254
6666
|
severity: "error",
|
|
@@ -6268,6 +6680,9 @@ function validateWorkflowSchedule(schedule, path = "/schedule") {
|
|
|
6268
6680
|
if (typeof type !== "string" || !WORKFLOW_SCHEDULE_TYPES.includes(type)) {
|
|
6269
6681
|
return issue(path, `\`schedule.type\` ${JSON.stringify(type)} is not one of ${WORKFLOW_SCHEDULE_TYPES.map((t) => `'${t}'`).join(" | ")}`);
|
|
6270
6682
|
}
|
|
6683
|
+
if (schedule.runAs !== void 0 && !WORKFLOW_SCHEDULE_RUN_AS.includes(schedule.runAs)) {
|
|
6684
|
+
return issue(`${path}/runAs`, `\`schedule.runAs\` ${JSON.stringify(schedule.runAs)} is not one of ${WORKFLOW_SCHEDULE_RUN_AS.map((v) => `'${v}'`).join(" | ")}`);
|
|
6685
|
+
}
|
|
6271
6686
|
switch (type) {
|
|
6272
6687
|
case "cron": {
|
|
6273
6688
|
if (typeof schedule.expression !== "string" || schedule.expression.trim().length === 0) {
|
|
@@ -6294,15 +6709,15 @@ function validateWorkflowSchedule(schedule, path = "/schedule") {
|
|
|
6294
6709
|
}
|
|
6295
6710
|
}
|
|
6296
6711
|
__name(validateWorkflowSchedule, "validateWorkflowSchedule");
|
|
6297
|
-
|
|
6712
|
+
__name4(validateWorkflowSchedule, "validateWorkflowSchedule");
|
|
6298
6713
|
var WORKFLOW_ENV_OVERLAY_MAX_KEYS = 64;
|
|
6299
6714
|
var WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES = 4096;
|
|
6300
6715
|
var WORKFLOW_ENV_TEMPLATE_SECRET_KEY_RE = /(SECRET|TOKEN|KEY|PASSWORD)$/;
|
|
6301
|
-
var isEnvRef = /* @__PURE__ */
|
|
6302
|
-
var looksLikeEmbeddedJson = /* @__PURE__ */
|
|
6716
|
+
var isEnvRef = /* @__PURE__ */ __name4((v) => typeof v === "object" && v !== null && !Array.isArray(v) && typeof v.__envRef === "string" && Object.keys(v).length === 1, "isEnvRef");
|
|
6717
|
+
var looksLikeEmbeddedJson = /* @__PURE__ */ __name4((s) => s.length > 1 && s[0] === "{" && s.includes("__envRef"), "looksLikeEmbeddedJson");
|
|
6303
6718
|
function collectEnvTemplateKeys(value22) {
|
|
6304
6719
|
const keys = /* @__PURE__ */ new Set();
|
|
6305
|
-
const walk2 = /* @__PURE__ */
|
|
6720
|
+
const walk2 = /* @__PURE__ */ __name4((v) => {
|
|
6306
6721
|
if (isEnvRef(v)) {
|
|
6307
6722
|
keys.add(v.__envRef);
|
|
6308
6723
|
return;
|
|
@@ -6328,10 +6743,10 @@ function collectEnvTemplateKeys(value22) {
|
|
|
6328
6743
|
].sort();
|
|
6329
6744
|
}
|
|
6330
6745
|
__name(collectEnvTemplateKeys, "collectEnvTemplateKeys");
|
|
6331
|
-
|
|
6746
|
+
__name4(collectEnvTemplateKeys, "collectEnvTemplateKeys");
|
|
6332
6747
|
function substituteEnvRefs(value22, overlay) {
|
|
6333
6748
|
const missing = /* @__PURE__ */ new Set();
|
|
6334
|
-
const walk2 = /* @__PURE__ */
|
|
6749
|
+
const walk2 = /* @__PURE__ */ __name4((v, slot = false) => {
|
|
6335
6750
|
if (isEnvRef(v)) {
|
|
6336
6751
|
if (Object.prototype.hasOwnProperty.call(overlay, v.__envRef)) {
|
|
6337
6752
|
const s = overlay[v.__envRef];
|
|
@@ -6370,13 +6785,13 @@ function substituteEnvRefs(value22, overlay) {
|
|
|
6370
6785
|
};
|
|
6371
6786
|
}
|
|
6372
6787
|
__name(substituteEnvRefs, "substituteEnvRefs");
|
|
6373
|
-
|
|
6788
|
+
__name4(substituteEnvRefs, "substituteEnvRefs");
|
|
6374
6789
|
function hashEnvOverlay(overlay) {
|
|
6375
6790
|
if (overlay === void 0 || overlay === null) return void 0;
|
|
6376
6791
|
return GRAPH_HASH_PREFIX + createHash2("sha256").update(canonicalJson(overlay)).digest("hex");
|
|
6377
6792
|
}
|
|
6378
6793
|
__name(hashEnvOverlay, "hashEnvOverlay");
|
|
6379
|
-
|
|
6794
|
+
__name4(hashEnvOverlay, "hashEnvOverlay");
|
|
6380
6795
|
function validateEnvOverlay(keys, overlay, limits = {}) {
|
|
6381
6796
|
const maxKeys = limits.maxKeys ?? WORKFLOW_ENV_OVERLAY_MAX_KEYS;
|
|
6382
6797
|
const maxValueBytes = limits.maxValueBytes ?? WORKFLOW_ENV_OVERLAY_MAX_VALUE_BYTES;
|
|
@@ -6415,7 +6830,7 @@ function validateEnvOverlay(keys, overlay, limits = {}) {
|
|
|
6415
6830
|
return issues;
|
|
6416
6831
|
}
|
|
6417
6832
|
__name(validateEnvOverlay, "validateEnvOverlay");
|
|
6418
|
-
|
|
6833
|
+
__name4(validateEnvOverlay, "validateEnvOverlay");
|
|
6419
6834
|
var ZERO = {
|
|
6420
6835
|
steps: {
|
|
6421
6836
|
min: 0,
|
|
@@ -6441,7 +6856,7 @@ function add(a, b) {
|
|
|
6441
6856
|
};
|
|
6442
6857
|
}
|
|
6443
6858
|
__name(add, "add");
|
|
6444
|
-
|
|
6859
|
+
__name4(add, "add");
|
|
6445
6860
|
function scale(r, lo, hi) {
|
|
6446
6861
|
return {
|
|
6447
6862
|
steps: {
|
|
@@ -6456,12 +6871,12 @@ function scale(r, lo, hi) {
|
|
|
6456
6871
|
};
|
|
6457
6872
|
}
|
|
6458
6873
|
__name(scale, "scale");
|
|
6459
|
-
|
|
6874
|
+
__name4(scale, "scale");
|
|
6460
6875
|
function armEntry(arm) {
|
|
6461
6876
|
return Array.isArray(arm) ? arm[arm.length - 1] : arm;
|
|
6462
6877
|
}
|
|
6463
6878
|
__name(armEntry, "armEntry");
|
|
6464
|
-
|
|
6879
|
+
__name4(armEntry, "armEntry");
|
|
6465
6880
|
function ofEntry(e) {
|
|
6466
6881
|
if (!e || typeof e !== "object") return ZERO;
|
|
6467
6882
|
const n2 = e;
|
|
@@ -6550,7 +6965,7 @@ function ofEntry(e) {
|
|
|
6550
6965
|
}
|
|
6551
6966
|
}
|
|
6552
6967
|
__name(ofEntry, "ofEntry");
|
|
6553
|
-
|
|
6968
|
+
__name4(ofEntry, "ofEntry");
|
|
6554
6969
|
function estimateGraph(envelopeOrGraph) {
|
|
6555
6970
|
const graph = Array.isArray(envelopeOrGraph) ? envelopeOrGraph : envelopeOrGraph?.definition?.graph ?? [];
|
|
6556
6971
|
const r = graph.map(ofEntry).reduce(add, ZERO);
|
|
@@ -6566,8 +6981,8 @@ function estimateGraph(envelopeOrGraph) {
|
|
|
6566
6981
|
};
|
|
6567
6982
|
}
|
|
6568
6983
|
__name(estimateGraph, "estimateGraph");
|
|
6569
|
-
|
|
6570
|
-
var isRecord2 = /* @__PURE__ */
|
|
6984
|
+
__name4(estimateGraph, "estimateGraph");
|
|
6985
|
+
var isRecord2 = /* @__PURE__ */ __name4((v) => !!v && typeof v === "object" && !Array.isArray(v), "isRecord");
|
|
6571
6986
|
function* singleStepsOf(entry) {
|
|
6572
6987
|
if (!isRecord2(entry)) return;
|
|
6573
6988
|
switch (entry.type) {
|
|
@@ -6593,14 +7008,14 @@ function* singleStepsOf(entry) {
|
|
|
6593
7008
|
}
|
|
6594
7009
|
}
|
|
6595
7010
|
__name(singleStepsOf, "singleStepsOf");
|
|
6596
|
-
|
|
7011
|
+
__name4(singleStepsOf, "singleStepsOf");
|
|
6597
7012
|
function entriesOf(graph) {
|
|
6598
7013
|
const definition = isRecord2(graph) ? graph.definition : void 0;
|
|
6599
7014
|
const entries = isRecord2(definition) ? definition.graph : void 0;
|
|
6600
7015
|
return Array.isArray(entries) ? entries : [];
|
|
6601
7016
|
}
|
|
6602
7017
|
__name(entriesOf, "entriesOf");
|
|
6603
|
-
|
|
7018
|
+
__name4(entriesOf, "entriesOf");
|
|
6604
7019
|
function inheritTargets(graphs) {
|
|
6605
7020
|
const targets = /* @__PURE__ */ new Set();
|
|
6606
7021
|
for (const graph of graphs) {
|
|
@@ -6615,7 +7030,7 @@ function inheritTargets(graphs) {
|
|
|
6615
7030
|
return targets;
|
|
6616
7031
|
}
|
|
6617
7032
|
__name(inheritTargets, "inheritTargets");
|
|
6618
|
-
|
|
7033
|
+
__name4(inheritTargets, "inheritTargets");
|
|
6619
7034
|
function needsInheritedWorkspace(graph) {
|
|
6620
7035
|
if (!isRecord2(graph) || graph.workspace !== void 0) return false;
|
|
6621
7036
|
for (const entry of entriesOf(graph)) {
|
|
@@ -6626,7 +7041,43 @@ function needsInheritedWorkspace(graph) {
|
|
|
6626
7041
|
return false;
|
|
6627
7042
|
}
|
|
6628
7043
|
__name(needsInheritedWorkspace, "needsInheritedWorkspace");
|
|
6629
|
-
|
|
7044
|
+
__name4(needsInheritedWorkspace, "needsInheritedWorkspace");
|
|
7045
|
+
function armEntry2(arm) {
|
|
7046
|
+
return Array.isArray(arm) ? arm[arm.length - 1] : arm;
|
|
7047
|
+
}
|
|
7048
|
+
__name(armEntry2, "armEntry2");
|
|
7049
|
+
__name4(armEntry2, "armEntry");
|
|
7050
|
+
function entryHasJobTier(entry) {
|
|
7051
|
+
const n2 = armEntry2(entry);
|
|
7052
|
+
if (!n2 || typeof n2 !== "object") return false;
|
|
7053
|
+
const node = n2;
|
|
7054
|
+
if (node.tier === "job") return true;
|
|
7055
|
+
const ws = node.workspace;
|
|
7056
|
+
if (ws !== void 0 && ws !== "inherit") return true;
|
|
7057
|
+
switch (node.type) {
|
|
7058
|
+
case "parallel":
|
|
7059
|
+
return Array.isArray(node.steps) && node.steps.some(entryHasJobTier);
|
|
7060
|
+
case "conditional":
|
|
7061
|
+
return Array.isArray(node.steps) && node.steps.some(entryHasJobTier) || node.otherwise !== void 0 && entryHasJobTier(node.otherwise);
|
|
7062
|
+
case "foreach":
|
|
7063
|
+
case "loop":
|
|
7064
|
+
return entryHasJobTier(node.step);
|
|
7065
|
+
default:
|
|
7066
|
+
return false;
|
|
7067
|
+
}
|
|
7068
|
+
}
|
|
7069
|
+
__name(entryHasJobTier, "entryHasJobTier");
|
|
7070
|
+
__name4(entryHasJobTier, "entryHasJobTier");
|
|
7071
|
+
function graphHasJobTierStep(envelopeOrGraph) {
|
|
7072
|
+
if (!envelopeOrGraph || typeof envelopeOrGraph !== "object") return false;
|
|
7073
|
+
const env = envelopeOrGraph;
|
|
7074
|
+
const envWorkspace = env.workspace;
|
|
7075
|
+
if (envWorkspace !== void 0 && envWorkspace !== "inherit") return true;
|
|
7076
|
+
const graph = Array.isArray(envelopeOrGraph) ? envelopeOrGraph : env.definition?.graph ?? [];
|
|
7077
|
+
return Array.isArray(graph) && graph.some(entryHasJobTier);
|
|
7078
|
+
}
|
|
7079
|
+
__name(graphHasJobTierStep, "graphHasJobTierStep");
|
|
7080
|
+
__name4(graphHasJobTierStep, "graphHasJobTierStep");
|
|
6630
7081
|
|
|
6631
7082
|
// src/types/workflow.ts
|
|
6632
7083
|
function createStep(s) {
|
|
@@ -6768,6 +7219,7 @@ var envRefKeys = /* @__PURE__ */ __name((v, into) => {
|
|
|
6768
7219
|
}
|
|
6769
7220
|
for (const inner of Object.values(v)) envRefKeys(inner, into);
|
|
6770
7221
|
}, "envRefKeys");
|
|
7222
|
+
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
7223
|
var refToDescriptor = /* @__PURE__ */ __name((items) => {
|
|
6772
7224
|
if (!items) throw new LuaWorkflowBuildError("invalid-envelope", "foreach.items needs a ref");
|
|
6773
7225
|
if ("initData" in items && items.initData === true) {
|
|
@@ -6777,11 +7229,14 @@ var refToDescriptor = /* @__PURE__ */ __name((items) => {
|
|
|
6777
7229
|
};
|
|
6778
7230
|
}
|
|
6779
7231
|
if ("step" in items && typeof items.step === "string" && !("path" in items && items.path.startsWith("stepResults"))) {
|
|
7232
|
+
if ("rows" in items) throw foreachItemsNotLowered("rows(\u2026) (a paged dataset)");
|
|
6780
7233
|
return {
|
|
6781
7234
|
step: items.step,
|
|
6782
7235
|
path: items.path
|
|
6783
7236
|
};
|
|
6784
7237
|
}
|
|
7238
|
+
if ("step" in items && Array.isArray(items.step)) throw foreachItemsNotLowered("a fan-in fromStep([\u2026])");
|
|
7239
|
+
if (typeof items.path !== "string") throw foreachItemsNotLowered("value(\u2026) / template(\u2026) / fromRequest(\u2026) / fromKnowledge(\u2026)");
|
|
6785
7240
|
const path = items.path;
|
|
6786
7241
|
if (path.startsWith("initData")) return {
|
|
6787
7242
|
initData: true,
|