lua-cli 3.39.0 → 3.39.2
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 +72 -72
- package/dist/api-exports.js +529 -283
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +778 -500
- package/dist/index.js.map +1 -1
- package/dist/voice/test/index.d.ts +72 -72
- package/dist/workflow-builder.js +478 -241
- package/dist/workflow-builder.js.map +1 -1
- package/package.json +4 -3
- package/template/package.json +1 -1
package/dist/workflow-builder.js
CHANGED
|
@@ -8,6 +8,7 @@ import { zodToJsonSchema } from "zod-to-json-schema";
|
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { z as z2 } from "zod";
|
|
10
10
|
import { z as z3 } from "zod";
|
|
11
|
+
import { z as z4 } from "zod";
|
|
11
12
|
var __defProp2 = Object.defineProperty;
|
|
12
13
|
var __name2 = /* @__PURE__ */ __name((target, value3) => __defProp2(target, "name", { value: value3, configurable: true }), "__name");
|
|
13
14
|
var PLUMBING_THREAD_CHANNELS = [
|
|
@@ -184,9 +185,9 @@ __name2(isMcpDraftCreateTool, "isMcpDraftCreateTool");
|
|
|
184
185
|
function mcpSendSiblingForDraftTool(tool, availableToolIds) {
|
|
185
186
|
const candidates = [
|
|
186
187
|
...availableToolIds
|
|
187
|
-
].filter((
|
|
188
|
-
id,
|
|
189
|
-
serverName:
|
|
188
|
+
].filter((id2) => id2.endsWith(REVIEWABLE_MCP_SEND_TOOL_SUFFIX)).map((id2) => ({
|
|
189
|
+
id: id2,
|
|
190
|
+
serverName: id2.slice(0, -REVIEWABLE_MCP_SEND_TOOL_SUFFIX.length)
|
|
190
191
|
})).filter(({ serverName }) => tool.startsWith(`${serverName}_`)).sort((a, b) => b.serverName.length - a.serverName.length);
|
|
191
192
|
return candidates[0]?.id;
|
|
192
193
|
}
|
|
@@ -367,8 +368,8 @@ __name(transformChatHistoryContentParts, "transformChatHistoryContentParts");
|
|
|
367
368
|
__name2(transformChatHistoryContentParts, "transformChatHistoryContentParts");
|
|
368
369
|
var RICH_PARTS_MESSAGE_ID_PREFIX = "rich-parts:";
|
|
369
370
|
var SCREENSHOT_MESSAGE_ID_PREFIX = "screenshot:";
|
|
370
|
-
function isSyntheticSideRow(
|
|
371
|
-
return
|
|
371
|
+
function isSyntheticSideRow(id2) {
|
|
372
|
+
return id2.startsWith(SCREENSHOT_MESSAGE_ID_PREFIX) || id2.startsWith(RICH_PARTS_MESSAGE_ID_PREFIX);
|
|
372
373
|
}
|
|
373
374
|
__name(isSyntheticSideRow, "isSyntheticSideRow");
|
|
374
375
|
__name2(isSyntheticSideRow, "isSyntheticSideRow");
|
|
@@ -1118,14 +1119,14 @@ function workflowContainerRunsHitlArm(container) {
|
|
|
1118
1119
|
}
|
|
1119
1120
|
__name(workflowContainerRunsHitlArm, "workflowContainerRunsHitlArm");
|
|
1120
1121
|
__name2(workflowContainerRunsHitlArm, "workflowContainerRunsHitlArm");
|
|
1121
|
-
function workflowHitlArmUnsupportedMessage(type,
|
|
1122
|
+
function workflowHitlArmUnsupportedMessage(type, id2, container) {
|
|
1122
1123
|
const legal = WORKFLOW_HITL_ARM_CONTAINERS.map((c) => `\`${c}\``).join(" / ");
|
|
1123
|
-
return `the engine does not run \`${type}\` inside a \`${container}\` yet (node "${
|
|
1124
|
+
return `the engine does not run \`${type}\` inside a \`${container}\` yet (node "${id2}") \u2014 place it at the top level, as a ${legal} arm, or inside a child \`workflow\``;
|
|
1124
1125
|
}
|
|
1125
1126
|
__name(workflowHitlArmUnsupportedMessage, "workflowHitlArmUnsupportedMessage");
|
|
1126
1127
|
__name2(workflowHitlArmUnsupportedMessage, "workflowHitlArmUnsupportedMessage");
|
|
1127
|
-
function workflowHitlArmShapeMessage(type,
|
|
1128
|
-
return shape === "mapped-arm" ? `\`${type}\` arm "${
|
|
1128
|
+
function workflowHitlArmShapeMessage(type, id2, shape) {
|
|
1129
|
+
return shape === "mapped-arm" ? `\`${type}\` arm "${id2}" takes the previous output as its payload \u2014 it cannot head a [mapping, step] chain; map before the container instead` : `a chunked foreach hands each child a slice of items, not one \u2014 \`${type}\` body "${id2}" takes one item; drop \`chunk\``;
|
|
1129
1130
|
}
|
|
1130
1131
|
__name(workflowHitlArmShapeMessage, "workflowHitlArmShapeMessage");
|
|
1131
1132
|
__name2(workflowHitlArmShapeMessage, "workflowHitlArmShapeMessage");
|
|
@@ -2260,12 +2261,12 @@ function decodeLogCursor(raw) {
|
|
|
2260
2261
|
return null;
|
|
2261
2262
|
}
|
|
2262
2263
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
2263
|
-
const { t, id } = parsed;
|
|
2264
|
+
const { t, id: id2 } = parsed;
|
|
2264
2265
|
if (typeof t !== "number" || !Number.isSafeInteger(t) || t < 0) return null;
|
|
2265
|
-
if (typeof
|
|
2266
|
+
if (typeof id2 !== "string" || !id2 || id2.length > LOG_CURSOR_MAX_ID_LENGTH) return null;
|
|
2266
2267
|
return {
|
|
2267
2268
|
t,
|
|
2268
|
-
id
|
|
2269
|
+
id: id2
|
|
2269
2270
|
};
|
|
2270
2271
|
}
|
|
2271
2272
|
__name(decodeLogCursor, "decodeLogCursor");
|
|
@@ -3131,64 +3132,64 @@ function hasCapability(profiles, profileId, required) {
|
|
|
3131
3132
|
}
|
|
3132
3133
|
__name(hasCapability, "hasCapability");
|
|
3133
3134
|
__name2(hasCapability, "hasCapability");
|
|
3134
|
-
function workflowJobId(
|
|
3135
|
-
switch (
|
|
3135
|
+
function workflowJobId(id2) {
|
|
3136
|
+
switch (id2.kind) {
|
|
3136
3137
|
case "start":
|
|
3137
|
-
return `wft_${
|
|
3138
|
+
return `wft_${id2.runId}_0`;
|
|
3138
3139
|
case "start-redrive":
|
|
3139
|
-
return `wft_${
|
|
3140
|
+
return `wft_${id2.runId}_start_r${id2.now}`;
|
|
3140
3141
|
case "tick":
|
|
3141
|
-
return `wft_${
|
|
3142
|
+
return `wft_${id2.runId}_${id2.seq}`;
|
|
3142
3143
|
case "timer":
|
|
3143
|
-
return `wft_${
|
|
3144
|
+
return `wft_${id2.runId}_timer_${id2.stepId}_${id2.attempt}`;
|
|
3144
3145
|
case "timer-remainder":
|
|
3145
|
-
return `wft_${
|
|
3146
|
+
return `wft_${id2.runId}_timer_${id2.stepId}_${id2.attempt}_r${id2.now}`;
|
|
3146
3147
|
case "timer-deferral":
|
|
3147
|
-
return `wft_${
|
|
3148
|
+
return `wft_${id2.runId}_timer_${id2.stepId}_${id2.attempt}_d${id2.now}`;
|
|
3148
3149
|
case "timer-sibling":
|
|
3149
|
-
return `wft_${
|
|
3150
|
+
return `wft_${id2.runId}_timer_${id2.stepId}_${id2.attempt}_w${id2.now}`;
|
|
3150
3151
|
case "retry":
|
|
3151
|
-
return `wft_${
|
|
3152
|
+
return `wft_${id2.runId}_retry_${id2.stepId}_${id2.attempt}`;
|
|
3152
3153
|
case "respawn":
|
|
3153
|
-
return `wft_${
|
|
3154
|
+
return `wft_${id2.runId}_respawn_${id2.stepId}_${id2.attempt}_s${id2.segment}_r${id2.now}`;
|
|
3154
3155
|
case "redrive":
|
|
3155
|
-
return `wft_${
|
|
3156
|
+
return `wft_${id2.runId}_redrive_${id2.stepId}_${id2.attempt}_r${id2.now}`;
|
|
3156
3157
|
case "redispatch":
|
|
3157
|
-
return `wft_${
|
|
3158
|
+
return `wft_${id2.runId}_redispatch_${id2.stepId}_${id2.attempt}_x${id2.executionId ?? "none"}_r${id2.now}`;
|
|
3158
3159
|
case "expiry":
|
|
3159
|
-
return `wft_${
|
|
3160
|
+
return `wft_${id2.runId}_expire_${id2.stepId}_${id2.attempt}_t${id2.suspendedAt}${id2.hop > 0 ? `_h${id2.hop}` : ""}`;
|
|
3160
3161
|
case "step-terminal":
|
|
3161
|
-
return `wft_${
|
|
3162
|
+
return `wft_${id2.runId}_term_${id2.stepId}_${id2.attempt}_r${id2.now}`;
|
|
3162
3163
|
case "handback":
|
|
3163
|
-
return `wft_${
|
|
3164
|
+
return `wft_${id2.runId}_handback_${id2.stepId}_${id2.attempt}_${id2.now}`;
|
|
3164
3165
|
case "foreach-rate":
|
|
3165
|
-
return `wft_${
|
|
3166
|
+
return `wft_${id2.runId}_fe_${id2.stepId}_${id2.attempt}_${id2.bucket}`;
|
|
3166
3167
|
case "budget-expiry":
|
|
3167
|
-
return `wft_${
|
|
3168
|
+
return `wft_${id2.runId}_expiry_budget_r${id2.now}`;
|
|
3168
3169
|
case "budget-resume":
|
|
3169
|
-
return `wft_${
|
|
3170
|
+
return `wft_${id2.runId}_resume_budget_${id2.now}`;
|
|
3170
3171
|
case "deadline":
|
|
3171
|
-
return `wft_${
|
|
3172
|
+
return `wft_${id2.runId}_deadline_${id2.deadlineAt}`;
|
|
3172
3173
|
case "deadline-remainder":
|
|
3173
|
-
return `wft_${
|
|
3174
|
+
return `wft_${id2.runId}_deadline_${id2.deadlineAt}_r${id2.now}`;
|
|
3174
3175
|
case "readmit":
|
|
3175
|
-
return `wft_${
|
|
3176
|
+
return `wft_${id2.runId}_readmit_${id2.now}`;
|
|
3176
3177
|
case "cancel":
|
|
3177
|
-
return `wft_${
|
|
3178
|
+
return `wft_${id2.runId}_cancel`;
|
|
3178
3179
|
case "reconcile":
|
|
3179
|
-
return `wft_${
|
|
3180
|
+
return `wft_${id2.runId}_reconcile_${id2.now}`;
|
|
3180
3181
|
case "replay":
|
|
3181
|
-
return `wft_${
|
|
3182
|
+
return `wft_${id2.runId}_replay_g${id2.leaseGeneration}`;
|
|
3182
3183
|
case "migration":
|
|
3183
|
-
return `wfm_${
|
|
3184
|
+
return `wfm_${id2.migrationId}`;
|
|
3184
3185
|
default:
|
|
3185
|
-
return assertNever(
|
|
3186
|
+
return assertNever(id2);
|
|
3186
3187
|
}
|
|
3187
3188
|
}
|
|
3188
3189
|
__name(workflowJobId, "workflowJobId");
|
|
3189
3190
|
__name2(workflowJobId, "workflowJobId");
|
|
3190
|
-
function assertNever(
|
|
3191
|
-
throw new Error(`workflowJobId: unknown wake kind ${JSON.stringify(
|
|
3191
|
+
function assertNever(id2) {
|
|
3192
|
+
throw new Error(`workflowJobId: unknown wake kind ${JSON.stringify(id2)}`);
|
|
3192
3193
|
}
|
|
3193
3194
|
__name(assertNever, "assertNever");
|
|
3194
3195
|
__name2(assertNever, "assertNever");
|
|
@@ -3319,13 +3320,13 @@ var IDEMPOTENCY_HOLDING_STATUSES = [
|
|
|
3319
3320
|
];
|
|
3320
3321
|
var WORKFLOW_SCHEDULED_RUN_ID_PREFIX = "wfr_sched_";
|
|
3321
3322
|
var CLOUD_TASK_RUN_ID_PREFIX = "ct_";
|
|
3322
|
-
function isCloudTaskRunId(
|
|
3323
|
-
return
|
|
3323
|
+
function isCloudTaskRunId(id2) {
|
|
3324
|
+
return id2.startsWith(CLOUD_TASK_RUN_ID_PREFIX);
|
|
3324
3325
|
}
|
|
3325
3326
|
__name(isCloudTaskRunId, "isCloudTaskRunId");
|
|
3326
3327
|
__name2(isCloudTaskRunId, "isCloudTaskRunId");
|
|
3327
|
-
function isScheduledWorkflowRunId(
|
|
3328
|
-
return
|
|
3328
|
+
function isScheduledWorkflowRunId(id2) {
|
|
3329
|
+
return id2.startsWith(WORKFLOW_SCHEDULED_RUN_ID_PREFIX);
|
|
3329
3330
|
}
|
|
3330
3331
|
__name(isScheduledWorkflowRunId, "isScheduledWorkflowRunId");
|
|
3331
3332
|
__name2(isScheduledWorkflowRunId, "isScheduledWorkflowRunId");
|
|
@@ -4109,10 +4110,246 @@ function effectiveAgentFeatures(base, override, rule) {
|
|
|
4109
4110
|
}
|
|
4110
4111
|
__name(effectiveAgentFeatures, "effectiveAgentFeatures");
|
|
4111
4112
|
__name2(effectiveAgentFeatures, "effectiveAgentFeatures");
|
|
4113
|
+
var ONBOARDING_FLOW_KEY = "alpha-choose-meet";
|
|
4114
|
+
var ONBOARDING_SCHEMA_VERSION = 1;
|
|
4115
|
+
var id = z4.string().min(1).max(80).regex(/^[A-Za-z0-9][A-Za-z0-9_-]*$/);
|
|
4116
|
+
var copy = /* @__PURE__ */ __name2((max) => z4.string().max(max), "copy");
|
|
4117
|
+
var onboardingHeadingSchema = z4.discriminatedUnion("kind", [
|
|
4118
|
+
z4.object({
|
|
4119
|
+
kind: z4.literal("plain"),
|
|
4120
|
+
text: copy(240)
|
|
4121
|
+
}).strict(),
|
|
4122
|
+
z4.object({
|
|
4123
|
+
kind: z4.literal("highlighted"),
|
|
4124
|
+
before: copy(240),
|
|
4125
|
+
highlight: copy(240),
|
|
4126
|
+
after: copy(240)
|
|
4127
|
+
}).strict()
|
|
4128
|
+
]);
|
|
4129
|
+
var onboardingRichTextInlineSchema = z4.discriminatedUnion("kind", [
|
|
4130
|
+
z4.object({
|
|
4131
|
+
kind: z4.literal("text"),
|
|
4132
|
+
text: copy(2e3),
|
|
4133
|
+
marks: z4.array(z4.enum([
|
|
4134
|
+
"bold",
|
|
4135
|
+
"italic"
|
|
4136
|
+
])).max(2).refine((marks) => new Set(marks).size === marks.length, "Text marks must be unique").optional()
|
|
4137
|
+
}).strict(),
|
|
4138
|
+
z4.object({
|
|
4139
|
+
kind: z4.literal("lineBreak")
|
|
4140
|
+
}).strict()
|
|
4141
|
+
]);
|
|
4142
|
+
var onboardingRichTextSchema = z4.object({
|
|
4143
|
+
blocks: z4.array(z4.object({
|
|
4144
|
+
kind: z4.literal("paragraph"),
|
|
4145
|
+
content: z4.array(onboardingRichTextInlineSchema).max(100)
|
|
4146
|
+
}).strict()).max(40)
|
|
4147
|
+
}).strict();
|
|
4148
|
+
var onboardingDestinationSchema = z4.discriminatedUnion("kind", [
|
|
4149
|
+
z4.object({
|
|
4150
|
+
kind: z4.literal("question"),
|
|
4151
|
+
questionId: id
|
|
4152
|
+
}).strict(),
|
|
4153
|
+
z4.object({
|
|
4154
|
+
kind: z4.literal("template"),
|
|
4155
|
+
templateContentId: id
|
|
4156
|
+
}).strict(),
|
|
4157
|
+
z4.object({
|
|
4158
|
+
kind: z4.literal("unavailable"),
|
|
4159
|
+
unavailableId: id
|
|
4160
|
+
}).strict()
|
|
4161
|
+
]);
|
|
4162
|
+
var onboardingArtworkSchema = z4.discriminatedUnion("kind", [
|
|
4163
|
+
z4.object({
|
|
4164
|
+
kind: z4.literal("builtinRing")
|
|
4165
|
+
}).strict(),
|
|
4166
|
+
z4.object({
|
|
4167
|
+
kind: z4.literal("uploaded"),
|
|
4168
|
+
assetId: id,
|
|
4169
|
+
accessibility: z4.discriminatedUnion("kind", [
|
|
4170
|
+
z4.object({
|
|
4171
|
+
kind: z4.literal("decorative")
|
|
4172
|
+
}).strict(),
|
|
4173
|
+
z4.object({
|
|
4174
|
+
kind: z4.literal("described"),
|
|
4175
|
+
altText: copy(500)
|
|
4176
|
+
}).strict()
|
|
4177
|
+
])
|
|
4178
|
+
}).strict()
|
|
4179
|
+
]);
|
|
4180
|
+
var onboardingAnswerSchema = z4.object({
|
|
4181
|
+
id,
|
|
4182
|
+
label: copy(160),
|
|
4183
|
+
supportingText: copy(500).optional(),
|
|
4184
|
+
destination: onboardingDestinationSchema.nullable()
|
|
4185
|
+
}).strict();
|
|
4186
|
+
var onboardingQuestionSchema = z4.object({
|
|
4187
|
+
id,
|
|
4188
|
+
heading: onboardingHeadingSchema,
|
|
4189
|
+
helperText: onboardingRichTextSchema.optional(),
|
|
4190
|
+
continueButtonLabel: copy(80),
|
|
4191
|
+
answers: z4.array(onboardingAnswerSchema).max(30)
|
|
4192
|
+
}).strict();
|
|
4193
|
+
var onboardingTemplateSectionSchema = z4.object({
|
|
4194
|
+
id,
|
|
4195
|
+
label: copy(100),
|
|
4196
|
+
body: onboardingRichTextSchema
|
|
4197
|
+
}).strict();
|
|
4198
|
+
var onboardingTemplateContentSchema = z4.object({
|
|
4199
|
+
id,
|
|
4200
|
+
templateId: copy(160),
|
|
4201
|
+
displayName: copy(100),
|
|
4202
|
+
eyebrow: copy(100).optional(),
|
|
4203
|
+
heading: onboardingHeadingSchema,
|
|
4204
|
+
description: onboardingRichTextSchema,
|
|
4205
|
+
badges: z4.array(copy(80)).max(12),
|
|
4206
|
+
sections: z4.array(onboardingTemplateSectionSchema).max(20),
|
|
4207
|
+
artwork: onboardingArtworkSchema,
|
|
4208
|
+
hireButtonLabel: copy(80),
|
|
4209
|
+
changeRoleButtonLabel: copy(80),
|
|
4210
|
+
nextStepText: onboardingRichTextSchema
|
|
4211
|
+
}).strict();
|
|
4212
|
+
var onboardingUnavailableOutcomeSchema = z4.object({
|
|
4213
|
+
id,
|
|
4214
|
+
heading: onboardingHeadingSchema,
|
|
4215
|
+
explanation: onboardingRichTextSchema,
|
|
4216
|
+
backButtonLabel: copy(80),
|
|
4217
|
+
alternative: z4.object({
|
|
4218
|
+
templateContentId: id,
|
|
4219
|
+
introduction: onboardingRichTextSchema,
|
|
4220
|
+
buttonLabel: copy(80)
|
|
4221
|
+
}).strict().optional()
|
|
4222
|
+
}).strict();
|
|
4223
|
+
var onboardingFlowSchema = z4.object({
|
|
4224
|
+
key: z4.literal(ONBOARDING_FLOW_KEY),
|
|
4225
|
+
schemaVersion: z4.literal(ONBOARDING_SCHEMA_VERSION),
|
|
4226
|
+
entryQuestionId: id.nullable(),
|
|
4227
|
+
questions: z4.array(onboardingQuestionSchema).max(100),
|
|
4228
|
+
templateContents: z4.array(onboardingTemplateContentSchema).max(100),
|
|
4229
|
+
unavailableOutcomes: z4.array(onboardingUnavailableOutcomeSchema).max(100)
|
|
4230
|
+
}).strict();
|
|
4231
|
+
var onboardingActorSchema = z4.object({
|
|
4232
|
+
subjectId: z4.string(),
|
|
4233
|
+
email: z4.string().email()
|
|
4234
|
+
}).strict();
|
|
4235
|
+
var onboardingEditorSchema = onboardingActorSchema.extend({
|
|
4236
|
+
editedAt: z4.string().datetime({
|
|
4237
|
+
offset: true
|
|
4238
|
+
})
|
|
4239
|
+
}).strict();
|
|
4240
|
+
var onboardingPublicationSummarySchema = z4.object({
|
|
4241
|
+
publicationId: id,
|
|
4242
|
+
revision: z4.number().int().positive(),
|
|
4243
|
+
sourceDraftVersion: z4.number().int().nonnegative(),
|
|
4244
|
+
contentHash: z4.string().regex(/^[a-f0-9]{64}$/),
|
|
4245
|
+
publishedAt: z4.string().datetime({
|
|
4246
|
+
offset: true
|
|
4247
|
+
}),
|
|
4248
|
+
publishedBy: onboardingActorSchema,
|
|
4249
|
+
questionCount: z4.number().int().nonnegative(),
|
|
4250
|
+
templateCount: z4.number().int().nonnegative(),
|
|
4251
|
+
unavailableCount: z4.number().int().nonnegative()
|
|
4252
|
+
}).strict();
|
|
4253
|
+
var onboardingValidationIssueSchema = z4.object({
|
|
4254
|
+
code: z4.string(),
|
|
4255
|
+
path: z4.string(),
|
|
4256
|
+
message: z4.string()
|
|
4257
|
+
}).strict();
|
|
4258
|
+
var onboardingValidationResponseSchema = z4.discriminatedUnion("valid", [
|
|
4259
|
+
z4.object({
|
|
4260
|
+
valid: z4.literal(true),
|
|
4261
|
+
summary: z4.object({
|
|
4262
|
+
questionCount: z4.number().int().nonnegative(),
|
|
4263
|
+
templateCount: z4.number().int().nonnegative(),
|
|
4264
|
+
unavailableCount: z4.number().int().nonnegative()
|
|
4265
|
+
}).strict()
|
|
4266
|
+
}).strict(),
|
|
4267
|
+
z4.object({
|
|
4268
|
+
valid: z4.literal(false),
|
|
4269
|
+
issues: z4.array(onboardingValidationIssueSchema)
|
|
4270
|
+
}).strict()
|
|
4271
|
+
]);
|
|
4272
|
+
var onboardingAssetSchema = z4.object({
|
|
4273
|
+
assetId: id,
|
|
4274
|
+
url: z4.string().url(),
|
|
4275
|
+
width: z4.number().int().positive(),
|
|
4276
|
+
height: z4.number().int().positive(),
|
|
4277
|
+
contentType: z4.enum([
|
|
4278
|
+
"image/png",
|
|
4279
|
+
"image/jpeg",
|
|
4280
|
+
"image/webp"
|
|
4281
|
+
]),
|
|
4282
|
+
bytes: z4.number().int().positive(),
|
|
4283
|
+
sha256: z4.string().regex(/^[a-f0-9]{64}$/),
|
|
4284
|
+
createdAt: z4.string().datetime({
|
|
4285
|
+
offset: true
|
|
4286
|
+
}),
|
|
4287
|
+
uploadedBy: onboardingActorSchema
|
|
4288
|
+
}).strict();
|
|
4289
|
+
var onboardingPublicAssetSchema = onboardingAssetSchema.pick({
|
|
4290
|
+
assetId: true,
|
|
4291
|
+
url: true,
|
|
4292
|
+
width: true,
|
|
4293
|
+
height: true,
|
|
4294
|
+
contentType: true
|
|
4295
|
+
}).strict();
|
|
4296
|
+
var getOnboardingConfigResponseSchema = z4.object({
|
|
4297
|
+
flowKey: z4.literal(ONBOARDING_FLOW_KEY),
|
|
4298
|
+
draftVersion: z4.number().int().nonnegative(),
|
|
4299
|
+
draft: onboardingFlowSchema,
|
|
4300
|
+
assets: z4.array(onboardingAssetSchema),
|
|
4301
|
+
lastEditor: onboardingEditorSchema.nullable(),
|
|
4302
|
+
activePublication: onboardingPublicationSummarySchema.nullable()
|
|
4303
|
+
}).strict();
|
|
4304
|
+
var saveOnboardingDraftRequestSchema = z4.object({
|
|
4305
|
+
expectedDraftVersion: z4.number().int().nonnegative(),
|
|
4306
|
+
draft: onboardingFlowSchema
|
|
4307
|
+
}).strict();
|
|
4308
|
+
var validateOnboardingRequestSchema = z4.object({
|
|
4309
|
+
draft: onboardingFlowSchema
|
|
4310
|
+
}).strict();
|
|
4311
|
+
var publishOnboardingRequestSchema = z4.object({
|
|
4312
|
+
expectedDraftVersion: z4.number().int().nonnegative(),
|
|
4313
|
+
expectedActivePublicationId: id.nullable()
|
|
4314
|
+
}).strict();
|
|
4315
|
+
var rollbackOnboardingRequestSchema = z4.object({
|
|
4316
|
+
publicationId: id,
|
|
4317
|
+
expectedActivePublicationId: id.nullable()
|
|
4318
|
+
}).strict();
|
|
4319
|
+
var onboardingTemplateCatalogItemSchema = z4.object({
|
|
4320
|
+
templateId: z4.string(),
|
|
4321
|
+
name: z4.string(),
|
|
4322
|
+
description: z4.string().optional()
|
|
4323
|
+
}).strict();
|
|
4324
|
+
var getPublishedOnboardingResponseSchema = z4.discriminatedUnion("status", [
|
|
4325
|
+
z4.object({
|
|
4326
|
+
status: z4.literal("available"),
|
|
4327
|
+
publicationId: id,
|
|
4328
|
+
revision: z4.number().int().positive(),
|
|
4329
|
+
contentHash: z4.string().regex(/^[a-f0-9]{64}$/),
|
|
4330
|
+
flow: onboardingFlowSchema,
|
|
4331
|
+
assets: z4.array(onboardingPublicAssetSchema)
|
|
4332
|
+
}).strict(),
|
|
4333
|
+
z4.object({
|
|
4334
|
+
status: z4.literal("unavailable"),
|
|
4335
|
+
reason: z4.literal("not_published"),
|
|
4336
|
+
message: z4.string()
|
|
4337
|
+
}).strict()
|
|
4338
|
+
]);
|
|
4339
|
+
function parseOnboardingFlow(value3) {
|
|
4340
|
+
return onboardingFlowSchema.parse(value3);
|
|
4341
|
+
}
|
|
4342
|
+
__name(parseOnboardingFlow, "parseOnboardingFlow");
|
|
4343
|
+
__name2(parseOnboardingFlow, "parseOnboardingFlow");
|
|
4344
|
+
function parsePublishedOnboardingResponse(value3) {
|
|
4345
|
+
return getPublishedOnboardingResponseSchema.parse(value3);
|
|
4346
|
+
}
|
|
4347
|
+
__name(parsePublishedOnboardingResponse, "parsePublishedOnboardingResponse");
|
|
4348
|
+
__name2(parsePublishedOnboardingResponse, "parsePublishedOnboardingResponse");
|
|
4112
4349
|
|
|
4113
4350
|
// ../workflow-graph/dist/index.mjs
|
|
4114
4351
|
import { createHash } from "crypto";
|
|
4115
|
-
import { z as
|
|
4352
|
+
import { z as z5 } from "zod";
|
|
4116
4353
|
import { z as z22 } from "zod";
|
|
4117
4354
|
|
|
4118
4355
|
// ../shared-types/dist/workflow-job-tools.mjs
|
|
@@ -4148,9 +4385,9 @@ var WORKFLOW_JOB_DEFAULT_TOOLS = [
|
|
|
4148
4385
|
function effectiveJobTools(jobTools, readOnly) {
|
|
4149
4386
|
const base = jobTools?.length ? jobTools : WORKFLOW_JOB_DEFAULT_TOOLS;
|
|
4150
4387
|
const out = [];
|
|
4151
|
-
for (const
|
|
4152
|
-
if (readOnly && WORKFLOW_JOB_READ_ONLY_DROPPED.includes(
|
|
4153
|
-
if (!out.includes(
|
|
4388
|
+
for (const id2 of base) {
|
|
4389
|
+
if (readOnly && WORKFLOW_JOB_READ_ONLY_DROPPED.includes(id2)) continue;
|
|
4390
|
+
if (!out.includes(id2)) out.push(id2);
|
|
4154
4391
|
}
|
|
4155
4392
|
return out;
|
|
4156
4393
|
}
|
|
@@ -4339,9 +4576,9 @@ function malformedMapMembers(cfg) {
|
|
|
4339
4576
|
}
|
|
4340
4577
|
__name(malformedMapMembers, "malformedMapMembers");
|
|
4341
4578
|
__name4(malformedMapMembers, "malformedMapMembers");
|
|
4342
|
-
function mapMemberMalformedMessage(
|
|
4579
|
+
function mapMemberMalformedMessage(id2, m) {
|
|
4343
4580
|
const keys = m.keys.map((k) => `\`${k}\``).join(", ");
|
|
4344
|
-
return `"${
|
|
4581
|
+
return `"${id2}".${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`;
|
|
4345
4582
|
}
|
|
4346
4583
|
__name(mapMemberMalformedMessage, "mapMemberMalformedMessage");
|
|
4347
4584
|
__name4(mapMemberMalformedMessage, "mapMemberMalformedMessage");
|
|
@@ -4451,8 +4688,8 @@ var rows = /* @__PURE__ */ __name4((s, path, page) => ({
|
|
|
4451
4688
|
var fromKnowledge = /* @__PURE__ */ __name4((k) => ({
|
|
4452
4689
|
knowledge: k
|
|
4453
4690
|
}), "fromKnowledge");
|
|
4454
|
-
var SideEffectsSchema =
|
|
4455
|
-
var JobResourcesSchema =
|
|
4691
|
+
var SideEffectsSchema = z5.enum(WORKFLOW_SIDE_EFFECTS);
|
|
4692
|
+
var JobResourcesSchema = z5.enum(WORKFLOW_JOB_RESOURCES);
|
|
4456
4693
|
var WORKFLOW_MODEL_TEMPLATE_ROOT = "initData";
|
|
4457
4694
|
var WORKFLOW_MODEL_TEMPLATE_RE = /^\$\{\s*initData\.([A-Za-z0-9_.\-[\]]+)\s*(?:\|([^}]*))?\}$/;
|
|
4458
4695
|
var PATH_SEGMENT_RE = /^[A-Za-z0-9_-]+(?:\[(?:0|[1-9]\d*)\])*$/;
|
|
@@ -4843,13 +5080,13 @@ var SLEEP_UNTIL_REPLACEMENT = Object.freeze({
|
|
|
4843
5080
|
type: "sleep",
|
|
4844
5081
|
duration: 6e4
|
|
4845
5082
|
});
|
|
4846
|
-
function sleepUntilUnsupportedMessage(
|
|
4847
|
-
return `the engine does not execute \`sleepUntil\` yet (node "${
|
|
5083
|
+
function sleepUntilUnsupportedMessage(id2) {
|
|
5084
|
+
return `the engine does not execute \`sleepUntil\` yet (node "${id2}") \u2014 replace it with a \`sleep\` node with a \`duration\` in ms, e.g. { type: 'sleep', id: '${id2}', duration: ${SLEEP_UNTIL_REPLACEMENT.duration} }`;
|
|
4848
5085
|
}
|
|
4849
5086
|
__name(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
|
|
4850
5087
|
__name4(sleepUntilUnsupportedMessage, "sleepUntilUnsupportedMessage");
|
|
4851
|
-
function armSubrunUnsupportedMessage(
|
|
4852
|
-
return `the engine does not execute the implicit \`${workflowId}\` arm subrun (node "${
|
|
5088
|
+
function armSubrunUnsupportedMessage(id2, workflowId) {
|
|
5089
|
+
return `the engine does not execute the implicit \`${workflowId}\` arm subrun (node "${id2}") \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)`;
|
|
4853
5090
|
}
|
|
4854
5091
|
__name(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
|
|
4855
5092
|
__name4(armSubrunUnsupportedMessage, "armSubrunUnsupportedMessage");
|
|
@@ -5187,20 +5424,20 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
5187
5424
|
const seen = /* @__PURE__ */ new Map();
|
|
5188
5425
|
let nodeCount = 0;
|
|
5189
5426
|
const upstream = /* @__PURE__ */ new Set();
|
|
5190
|
-
const checkId = /* @__PURE__ */ __name4((
|
|
5427
|
+
const checkId = /* @__PURE__ */ __name4((id2, path) => {
|
|
5191
5428
|
nodeCount += 1;
|
|
5192
|
-
if (seen.has(
|
|
5193
|
-
err("duplicate-step-id", `step id "${
|
|
5429
|
+
if (seen.has(id2)) {
|
|
5430
|
+
err("duplicate-step-id", `step id "${id2}" is declared twice (first at ${seen.get(id2)})`, path, id2);
|
|
5194
5431
|
} else {
|
|
5195
|
-
seen.set(
|
|
5432
|
+
seen.set(id2, path);
|
|
5196
5433
|
}
|
|
5197
5434
|
}, "checkId");
|
|
5198
5435
|
const checkPolicyEnums = /* @__PURE__ */ __name4((node, path) => {
|
|
5199
|
-
const
|
|
5436
|
+
const id2 = singleId(node);
|
|
5200
5437
|
const check = /* @__PURE__ */ __name4((member, allowed) => {
|
|
5201
5438
|
const value22 = node[member];
|
|
5202
5439
|
if (value22 === void 0 || typeof value22 === "string" && allowed.includes(value22)) return;
|
|
5203
|
-
err("invalid-envelope", `\`${member}\` must be ${allowed.map((a) => `'${a}'`).join(" | ")} (got ${JSON.stringify(value22)})`, `${path}.${member}`,
|
|
5440
|
+
err("invalid-envelope", `\`${member}\` must be ${allowed.map((a) => `'${a}'`).join(" | ")} (got ${JSON.stringify(value22)})`, `${path}.${member}`, id2);
|
|
5204
5441
|
}, "check");
|
|
5205
5442
|
check("sideEffects", WORKFLOW_SIDE_EFFECTS);
|
|
5206
5443
|
check("jobResources", WORKFLOW_JOB_RESOURCES);
|
|
@@ -5208,46 +5445,46 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
5208
5445
|
const checkRetry = /* @__PURE__ */ __name4((node, path) => {
|
|
5209
5446
|
const r = node.retry;
|
|
5210
5447
|
if (!r) return;
|
|
5211
|
-
const
|
|
5448
|
+
const id2 = singleId(node);
|
|
5212
5449
|
const unknown = unknownWorkflowRetryMembers(r);
|
|
5213
|
-
if (unknown.length) err("invalid-envelope", workflowRetryUnknownMembersMessage(unknown), `${path}.retry`,
|
|
5450
|
+
if (unknown.length) err("invalid-envelope", workflowRetryUnknownMembersMessage(unknown), `${path}.retry`, id2);
|
|
5214
5451
|
if (!isWithinWorkflowRetryAttempts(r.maxAttempts)) {
|
|
5215
5452
|
const over = typeof r.maxAttempts === "number" && r.maxAttempts > WORKFLOW_RETRY_MAX_ATTEMPTS;
|
|
5216
|
-
err(over ? "cap-exceeded" : "invalid-envelope", workflowRetryMaxAttemptsMessage(r.maxAttempts), `${path}.retry.maxAttempts`,
|
|
5453
|
+
err(over ? "cap-exceeded" : "invalid-envelope", workflowRetryMaxAttemptsMessage(r.maxAttempts), `${path}.retry.maxAttempts`, id2);
|
|
5217
5454
|
}
|
|
5218
5455
|
const backoffs = retryBackoffs();
|
|
5219
5456
|
if (r.backoff !== void 0 && !backoffs.includes(r.backoff)) {
|
|
5220
5457
|
const list = backoffs.map((b) => `'${b}'`).join(" | ");
|
|
5221
|
-
err("backoff-invalid", `retry.backoff must be ${list}`, `${path}.retry.backoff`,
|
|
5458
|
+
err("backoff-invalid", `retry.backoff must be ${list}`, `${path}.retry.backoff`, id2);
|
|
5222
5459
|
}
|
|
5223
5460
|
if (r.backoffSeconds !== void 0 && r.backoffSeconds < 0) {
|
|
5224
|
-
err("backoff-invalid", "retry.backoffSeconds must be \u2265 0", `${path}.retry.backoffSeconds`,
|
|
5461
|
+
err("backoff-invalid", "retry.backoffSeconds must be \u2265 0", `${path}.retry.backoffSeconds`, id2);
|
|
5225
5462
|
}
|
|
5226
5463
|
if (r.maxBackoffSeconds !== void 0) {
|
|
5227
5464
|
if (r.backoff !== "exponential") {
|
|
5228
|
-
err("backoff-invalid", "retry.maxBackoffSeconds is only meaningful with backoff:'exponential'", `${path}.retry`,
|
|
5465
|
+
err("backoff-invalid", "retry.maxBackoffSeconds is only meaningful with backoff:'exponential'", `${path}.retry`, id2);
|
|
5229
5466
|
} else if (r.maxBackoffSeconds <= 0 || r.backoffSeconds !== void 0 && r.maxBackoffSeconds < r.backoffSeconds) {
|
|
5230
|
-
err("backoff-invalid", "retry.maxBackoffSeconds must be > 0 and \u2265 backoffSeconds", `${path}.retry.maxBackoffSeconds`,
|
|
5467
|
+
err("backoff-invalid", "retry.maxBackoffSeconds must be > 0 and \u2265 backoffSeconds", `${path}.retry.maxBackoffSeconds`, id2);
|
|
5231
5468
|
}
|
|
5232
5469
|
}
|
|
5233
5470
|
}, "checkRetry");
|
|
5234
5471
|
const checkTimeout = /* @__PURE__ */ __name4((node, path) => {
|
|
5235
5472
|
const t = node.timeoutSeconds;
|
|
5236
5473
|
if (t === void 0) return;
|
|
5237
|
-
const
|
|
5474
|
+
const id2 = singleId(node);
|
|
5238
5475
|
if (!Number.isInteger(t) || t < 1) {
|
|
5239
|
-
err("timeout-out-of-range", `timeoutSeconds must be an integer \u2265 1 (got ${t})`, `${path}.timeoutSeconds`,
|
|
5476
|
+
err("timeout-out-of-range", `timeoutSeconds must be an integer \u2265 1 (got ${t})`, `${path}.timeoutSeconds`, id2);
|
|
5240
5477
|
return;
|
|
5241
5478
|
}
|
|
5242
5479
|
if (node.tier === "job") {
|
|
5243
5480
|
const cap = node.type === "agent" ? caps.maxJobTimeoutSeconds : caps.maxJobSegmentSeconds;
|
|
5244
5481
|
if (t > cap) {
|
|
5245
|
-
err("job-timeout-exceeds-cap", `timeoutSeconds ${t} exceeds the Job-tier cap of ${cap} s`, `${path}.timeoutSeconds`,
|
|
5482
|
+
err("job-timeout-exceeds-cap", `timeoutSeconds ${t} exceeds the Job-tier cap of ${cap} s`, `${path}.timeoutSeconds`, id2);
|
|
5246
5483
|
} else if (node.type === "agent" && t > caps.maxJobSegmentSeconds && !node.workspace) {
|
|
5247
|
-
err("long-job-requires-workspace", `steps longer than 4 h checkpoint to the run workspace \u2014 add workspace:{mount:'rw'} (and workspace on createWorkflow) or split the step`, `${path}.timeoutSeconds`,
|
|
5484
|
+
err("long-job-requires-workspace", `steps longer than 4 h checkpoint to the run workspace \u2014 add workspace:{mount:'rw'} (and workspace on createWorkflow) or split the step`, `${path}.timeoutSeconds`, id2);
|
|
5248
5485
|
}
|
|
5249
5486
|
} else if (t > caps.maxWorkerTimeoutSeconds) {
|
|
5250
|
-
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`,
|
|
5487
|
+
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`, id2);
|
|
5251
5488
|
}
|
|
5252
5489
|
}, "checkTimeout");
|
|
5253
5490
|
const checkSpecialistRole = /* @__PURE__ */ __name4((node, path) => {
|
|
@@ -5311,32 +5548,32 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
5311
5548
|
return void 0;
|
|
5312
5549
|
}, "jobClassifiablePin");
|
|
5313
5550
|
const checkTier = /* @__PURE__ */ __name4((node, path) => {
|
|
5314
|
-
const
|
|
5551
|
+
const id2 = singleId(node);
|
|
5315
5552
|
if (node.workspace && node.workspace !== "inherit" && node.tier !== void 0 && node.tier !== "job") {
|
|
5316
|
-
err("workspace-requires-job-tier", "a step mounting a workspace must be tier:'job'", `${path}.workspace`,
|
|
5553
|
+
err("workspace-requires-job-tier", "a step mounting a workspace must be tier:'job'", `${path}.workspace`, id2);
|
|
5317
5554
|
}
|
|
5318
5555
|
if (node.harness !== void 0 && node.tier !== "job") {
|
|
5319
|
-
err("harness-requires-job-tier", "`harness` is only legal on a tier:'job' agent step", `${path}.harness`,
|
|
5556
|
+
err("harness-requires-job-tier", "`harness` is only legal on a tier:'job' agent step", `${path}.harness`, id2);
|
|
5320
5557
|
}
|
|
5321
5558
|
const provider = node.type === "agent" ? classifyModelProvider(jobClassifiablePin(node.model)) : null;
|
|
5322
5559
|
if (node.harness === "claude-code" && provider !== null && provider !== "anthropic") {
|
|
5323
|
-
err("harness-provider-mismatch", `harness:'claude-code' needs an Anthropic model (model "${node.type === "agent" ? node.model : ""}" is ${provider})`, `${path}.harness`,
|
|
5560
|
+
err("harness-provider-mismatch", `harness:'claude-code' needs an Anthropic model (model "${node.type === "agent" ? node.model : ""}" is ${provider})`, `${path}.harness`, id2);
|
|
5324
5561
|
}
|
|
5325
5562
|
if (isJobTier(node) && provider !== null && opts.policy?.jobProviders && !opts.policy.jobProviders.includes(provider)) {
|
|
5326
|
-
err("job-tier-provider-unsupported", `model provider '${provider}' is outside LUA_WF_JOB_PROVIDERS [${opts.policy.jobProviders.join(", ")}]`, `${path}.model`,
|
|
5563
|
+
err("job-tier-provider-unsupported", `model provider '${provider}' is outside LUA_WF_JOB_PROVIDERS [${opts.policy.jobProviders.join(", ")}]`, `${path}.model`, id2);
|
|
5327
5564
|
}
|
|
5328
5565
|
}, "checkTier");
|
|
5329
5566
|
const checkModel = /* @__PURE__ */ __name4((node, path) => {
|
|
5330
5567
|
if (node.type !== "agent" || typeof node.model !== "string") return;
|
|
5331
|
-
const
|
|
5568
|
+
const id2 = singleId(node);
|
|
5332
5569
|
const parsed = parseModelTemplate(node.model);
|
|
5333
5570
|
if (parsed.kind === "invalid") {
|
|
5334
|
-
err("model-template-invalid", parsed.message, `${path}.model`,
|
|
5571
|
+
err("model-template-invalid", parsed.message, `${path}.model`, id2);
|
|
5335
5572
|
return;
|
|
5336
5573
|
}
|
|
5337
5574
|
if (parsed.kind === "template" && parsed.template.default === void 0) {
|
|
5338
5575
|
if (isJobTier(node)) {
|
|
5339
|
-
err("model-template-default-required", modelTemplateDefaultRequiredMessage(node.model), `${path}.model`,
|
|
5576
|
+
err("model-template-default-required", modelTemplateDefaultRequiredMessage(node.model), `${path}.model`, id2);
|
|
5340
5577
|
}
|
|
5341
5578
|
return;
|
|
5342
5579
|
}
|
|
@@ -5349,12 +5586,12 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
5349
5586
|
if (registry === "unavailable") {
|
|
5350
5587
|
const trimmed = pin.trim();
|
|
5351
5588
|
if (trimmed && !normalizeModelId(trimmed, []).ok) {
|
|
5352
|
-
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`,
|
|
5589
|
+
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`, id2);
|
|
5353
5590
|
}
|
|
5354
5591
|
return;
|
|
5355
5592
|
}
|
|
5356
5593
|
const resolved = normalizeModelId(pin, registry);
|
|
5357
|
-
if (!resolved.ok) err("model-unresolved", inContext(modelUnresolvedMessage(resolved)), `${path}.model`,
|
|
5594
|
+
if (!resolved.ok) err("model-unresolved", inContext(modelUnresolvedMessage(resolved)), `${path}.model`, id2);
|
|
5358
5595
|
}, "checkModel");
|
|
5359
5596
|
const checkTaskClass = /* @__PURE__ */ __name4((node, path) => {
|
|
5360
5597
|
if (node.type !== "agent" || node.taskClass === void 0) return;
|
|
@@ -5363,46 +5600,46 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
5363
5600
|
err("task-class-without-model", `taskClass '${String(node.taskClass)}' needs a \`model\` on a pushed definition \u2014 write a class (model: 'class/fast' | 'class/balanced' | 'class/strong') or an approved provider/model code; nothing maps a task class to a model at dispatch, so a step with neither would run on the agent\u2019s own model`, `${path}.taskClass`, singleId(node));
|
|
5364
5601
|
}, "checkTaskClass");
|
|
5365
5602
|
const checkWorkspace = /* @__PURE__ */ __name4((node, path) => {
|
|
5366
|
-
const
|
|
5603
|
+
const id2 = singleId(node);
|
|
5367
5604
|
const ws = workspaceOf(node);
|
|
5368
5605
|
if (isJobTier(node) && opts.policy && opts.policy.jobTier !== true) {
|
|
5369
|
-
err("job-tier-disabled", `"${
|
|
5606
|
+
err("job-tier-disabled", `"${id2}" runs on the Job tier but the org's workflowPolicy.jobTier is off \u2014 an org admin enables it (lua features workflows.caps.jobTier true)`, `${path}.tier`, id2);
|
|
5370
5607
|
}
|
|
5371
5608
|
const tools = jobToolsOf(node);
|
|
5372
5609
|
if (tools !== void 0) {
|
|
5373
5610
|
if (!isJobTier(node)) {
|
|
5374
|
-
err("job-tools-require-job-tier", "`jobTools` needs tier:'job'", `${path}.jobTools`,
|
|
5611
|
+
err("job-tools-require-job-tier", "`jobTools` needs tier:'job'", `${path}.jobTools`, id2);
|
|
5375
5612
|
}
|
|
5376
5613
|
const unknown = (Array.isArray(tools) ? tools : [
|
|
5377
5614
|
tools
|
|
5378
5615
|
]).filter((t) => !WORKFLOW_JOB_TOOLS.includes(t));
|
|
5379
5616
|
if (unknown.length > 0) {
|
|
5380
|
-
err("job-tools-unknown", `jobTools ${JSON.stringify(unknown)} outside WORKFLOW_JOB_TOOLS [${WORKFLOW_JOB_TOOLS.join(", ")}]`, `${path}.jobTools`,
|
|
5617
|
+
err("job-tools-unknown", `jobTools ${JSON.stringify(unknown)} outside WORKFLOW_JOB_TOOLS [${WORKFLOW_JOB_TOOLS.join(", ")}]`, `${path}.jobTools`, id2);
|
|
5381
5618
|
}
|
|
5382
5619
|
if (node.type === "agent" && (Array.isArray(tools) ? tools : [
|
|
5383
5620
|
tools
|
|
5384
5621
|
]).includes("gh")) {
|
|
5385
|
-
warn("gh-on-coding-turn", `"${
|
|
5622
|
+
warn("gh-on-coding-turn", `"${id2}" 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`, id2);
|
|
5386
5623
|
}
|
|
5387
5624
|
}
|
|
5388
5625
|
if (node.type === "agent" && ws && ws !== "inherit" && ws.mount === "ro" && Array.isArray(tools) && effectiveJobTools(tools, true).length === 0) {
|
|
5389
|
-
warn("ro-step-has-no-tools", `"${
|
|
5626
|
+
warn("ro-step-has-no-tools", `"${id2}" 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`, id2);
|
|
5390
5627
|
}
|
|
5391
5628
|
if (ws && ws !== "inherit") {
|
|
5392
5629
|
if (!envelopeWorkspace && !opts.mayInherit) {
|
|
5393
|
-
err("workspace-not-declared", `"${
|
|
5630
|
+
err("workspace-not-declared", `"${id2}" mounts a workspace but the workflow declares none \u2014 add workspace:{kind, \u2026} on createWorkflow`, `${path}.workspace`, id2);
|
|
5394
5631
|
}
|
|
5395
5632
|
if (ws.isolation === "worktree" && envelopeWorkspace?.kind === "empty") {
|
|
5396
|
-
err("worktree-requires-git-workspace", `"${
|
|
5633
|
+
err("worktree-requires-git-workspace", `"${id2}": isolation:'worktree' needs a kind:'git' workspace (the envelope declares kind:'empty')`, `${path}.workspace.isolation`, id2);
|
|
5397
5634
|
}
|
|
5398
5635
|
}
|
|
5399
5636
|
if (node.type === "workflow" && ws === "inherit") {
|
|
5400
5637
|
if (!envelopeWorkspace) {
|
|
5401
|
-
err("workspace-inherit-without-parent-workspace", `"${
|
|
5638
|
+
err("workspace-inherit-without-parent-workspace", `"${id2}": workspace:'inherit' but the parent workflow declares no workspace \u2014 there is nothing to inherit`, `${path}.workspace`, id2);
|
|
5402
5639
|
}
|
|
5403
5640
|
const child = opts.resolveWorkflow?.(node.workflowId);
|
|
5404
5641
|
if (child?.workspace) {
|
|
5405
|
-
err("workspace-inherit-conflict", `"${
|
|
5642
|
+
err("workspace-inherit-conflict", `"${id2}": workspace:'inherit' on "${node.workflowId}", which declares its own workspace`, `${path}.workspace`, id2);
|
|
5406
5643
|
}
|
|
5407
5644
|
}
|
|
5408
5645
|
}, "checkWorkspace");
|
|
@@ -5411,20 +5648,20 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
5411
5648
|
const schema = node.type === "step" ? node.step.outputSchema : node.type === "agent" ? node.outputSchema : void 0;
|
|
5412
5649
|
if (schema !== void 0) outputSchemas.set(singleId(node), schema);
|
|
5413
5650
|
}, "recordOutputSchema");
|
|
5414
|
-
const checkMapMembers = /* @__PURE__ */ __name4((cfg, basePath,
|
|
5651
|
+
const checkMapMembers = /* @__PURE__ */ __name4((cfg, basePath, id2) => {
|
|
5415
5652
|
for (const m of malformedMapMembers(cfg)) {
|
|
5416
|
-
warn(MAP_MEMBER_MALFORMED_CODE, mapMemberMalformedMessage(
|
|
5653
|
+
warn(MAP_MEMBER_MALFORMED_CODE, mapMemberMalformedMessage(id2, m), `${basePath}.${m.member}`, id2);
|
|
5417
5654
|
}
|
|
5418
5655
|
}, "checkMapMembers");
|
|
5419
5656
|
const checkInputShape = /* @__PURE__ */ __name4((node, path) => {
|
|
5420
5657
|
const input = node.input;
|
|
5421
5658
|
if (input === void 0) return;
|
|
5422
|
-
const
|
|
5659
|
+
const id2 = singleId(node);
|
|
5423
5660
|
if (input !== null && typeof input === "object" && !Array.isArray(input)) {
|
|
5424
|
-
checkMapMembers(input, `${path}.input`,
|
|
5661
|
+
checkMapMembers(input, `${path}.input`, id2);
|
|
5425
5662
|
return;
|
|
5426
5663
|
}
|
|
5427
|
-
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`,
|
|
5664
|
+
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`, id2);
|
|
5428
5665
|
}, "checkInputShape");
|
|
5429
5666
|
const checkBodyInput = /* @__PURE__ */ __name4((body, path, container) => {
|
|
5430
5667
|
if (body.type === "workflow" || body.input === void 0) return;
|
|
@@ -5715,7 +5952,7 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
5715
5952
|
default:
|
|
5716
5953
|
err("invalid-envelope", `unknown entry type "${entry.type}"`, path);
|
|
5717
5954
|
}
|
|
5718
|
-
for (const
|
|
5955
|
+
for (const id2 of declared) upstream.add(id2);
|
|
5719
5956
|
});
|
|
5720
5957
|
if (nodeCount > caps.maxNodes) {
|
|
5721
5958
|
err("cap-exceeded", `${nodeCount} nodes exceeds the static cap of ${caps.maxNodes}`, "definition.graph");
|
|
@@ -5840,19 +6077,19 @@ var containerIdOf = /* @__PURE__ */ __name4((type, entryIndex) => `${type}@${ent
|
|
|
5840
6077
|
function compilePlan(g) {
|
|
5841
6078
|
const steps = {};
|
|
5842
6079
|
const order = [];
|
|
5843
|
-
const addNode = /* @__PURE__ */ __name4((
|
|
5844
|
-
if (
|
|
5845
|
-
throw new WorkflowPlanError("duplicate-step-id", `Duplicate step id "${
|
|
6080
|
+
const addNode = /* @__PURE__ */ __name4((id2, node) => {
|
|
6081
|
+
if (id2 in steps) {
|
|
6082
|
+
throw new WorkflowPlanError("duplicate-step-id", `Duplicate step id "${id2}" in definition.graph`);
|
|
5846
6083
|
}
|
|
5847
|
-
steps[
|
|
5848
|
-
order.push(
|
|
6084
|
+
steps[id2] = node;
|
|
6085
|
+
order.push(id2);
|
|
5849
6086
|
}, "addNode");
|
|
5850
6087
|
let prevTails = [];
|
|
5851
6088
|
const foreachJoinToEntry = /* @__PURE__ */ new Map();
|
|
5852
6089
|
g.definition.graph.forEach((entry, entryIndex) => {
|
|
5853
6090
|
if (isArmStep(entry)) {
|
|
5854
|
-
const
|
|
5855
|
-
addNode(
|
|
6091
|
+
const id2 = armStepId(entry);
|
|
6092
|
+
addNode(id2, {
|
|
5856
6093
|
kind: armStepKind(entry),
|
|
5857
6094
|
dependsOn: prevTails,
|
|
5858
6095
|
downstream: [],
|
|
@@ -5860,7 +6097,7 @@ function compilePlan(g) {
|
|
|
5860
6097
|
entry
|
|
5861
6098
|
});
|
|
5862
6099
|
prevTails = [
|
|
5863
|
-
|
|
6100
|
+
id2
|
|
5864
6101
|
];
|
|
5865
6102
|
return;
|
|
5866
6103
|
}
|
|
@@ -5999,10 +6236,10 @@ function compilePlan(g) {
|
|
|
5999
6236
|
throw new WorkflowPlanError("unknown-entry-type", `Unknown graph entry type "${entry.type}" at definition.graph[${entryIndex}]`);
|
|
6000
6237
|
}
|
|
6001
6238
|
});
|
|
6002
|
-
for (const
|
|
6003
|
-
for (const dep of steps[
|
|
6239
|
+
for (const id2 of order) {
|
|
6240
|
+
for (const dep of steps[id2].dependsOn) {
|
|
6004
6241
|
const target = steps[dep] ?? (foreachJoinToEntry.has(dep) ? steps[foreachJoinToEntry.get(dep)] : void 0);
|
|
6005
|
-
target?.downstream.push(
|
|
6242
|
+
target?.downstream.push(id2);
|
|
6006
6243
|
}
|
|
6007
6244
|
}
|
|
6008
6245
|
return {
|
|
@@ -6191,17 +6428,17 @@ __name(renderRef, "renderRef");
|
|
|
6191
6428
|
__name4(renderRef, "renderRef");
|
|
6192
6429
|
var stepIdOf = /* @__PURE__ */ __name4((s) => typeof s === "string" ? s : s.id, "stepIdOf");
|
|
6193
6430
|
function step(s) {
|
|
6194
|
-
const
|
|
6431
|
+
const id2 = stepIdOf(s);
|
|
6195
6432
|
return {
|
|
6196
6433
|
path: /* @__PURE__ */ __name4((p) => ({
|
|
6197
|
-
path: p === "" ? `stepResults.${
|
|
6434
|
+
path: p === "" ? `stepResults.${id2}` : `stepResults.${id2}.${p}`
|
|
6198
6435
|
}), "path")
|
|
6199
6436
|
};
|
|
6200
6437
|
}
|
|
6201
6438
|
__name(step, "step");
|
|
6202
6439
|
__name4(step, "step");
|
|
6203
|
-
function stepOf(
|
|
6204
|
-
return step(
|
|
6440
|
+
function stepOf(id2) {
|
|
6441
|
+
return step(id2);
|
|
6205
6442
|
}
|
|
6206
6443
|
__name(stepOf, "stepOf");
|
|
6207
6444
|
__name4(stepOf, "stepOf");
|
|
@@ -6407,18 +6644,18 @@ function resolvePlacements(calls) {
|
|
|
6407
6644
|
const declared = /* @__PURE__ */ new Map();
|
|
6408
6645
|
const placedBy = /* @__PURE__ */ new Map();
|
|
6409
6646
|
const allIds = /* @__PURE__ */ new Map();
|
|
6410
|
-
const claimId = /* @__PURE__ */ __name4((
|
|
6411
|
-
const first = allIds.get(
|
|
6647
|
+
const claimId = /* @__PURE__ */ __name4((id2, callIndex) => {
|
|
6648
|
+
const first = allIds.get(id2);
|
|
6412
6649
|
if (first !== void 0 && first !== callIndex) {
|
|
6413
6650
|
issues.push({
|
|
6414
6651
|
code: "duplicate-step-id",
|
|
6415
|
-
message: `step id "${
|
|
6652
|
+
message: `step id "${id2}" is declared more than once (calls #${first} and #${callIndex})`,
|
|
6416
6653
|
callIndex,
|
|
6417
|
-
stepId:
|
|
6654
|
+
stepId: id2
|
|
6418
6655
|
});
|
|
6419
6656
|
return;
|
|
6420
6657
|
}
|
|
6421
|
-
allIds.set(
|
|
6658
|
+
allIds.set(id2, callIndex);
|
|
6422
6659
|
}, "claimId");
|
|
6423
6660
|
calls.forEach((call, i) => {
|
|
6424
6661
|
switch (call.kind) {
|
|
@@ -6430,7 +6667,7 @@ function resolvePlacements(calls) {
|
|
|
6430
6667
|
});
|
|
6431
6668
|
break;
|
|
6432
6669
|
case "entry":
|
|
6433
|
-
for (const
|
|
6670
|
+
for (const id2 of entryIds(call.entry)) claimId(id2, i);
|
|
6434
6671
|
break;
|
|
6435
6672
|
case "parallel":
|
|
6436
6673
|
for (const arm of call.arms) if ("node" in arm) claimId(nodeIdOf(arm.node), i);
|
|
@@ -6449,42 +6686,42 @@ function resolvePlacements(calls) {
|
|
|
6449
6686
|
});
|
|
6450
6687
|
const armMapPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
|
|
6451
6688
|
if (!ref.armMap || node.type === "mapping" || isHitlNode2(node)) return void 0;
|
|
6452
|
-
const
|
|
6689
|
+
const id2 = nodeIdOf(node);
|
|
6453
6690
|
if ((container === "foreach" || container === "loop") && node.type !== "workflow") {
|
|
6454
6691
|
return {
|
|
6455
6692
|
code: "mapping-placement",
|
|
6456
|
-
message: container === "foreach" ? `foreach body "${
|
|
6693
|
+
message: container === "foreach" ? `foreach body "${id2}": a [map, step] body is not supported \u2014 the body receives each item as its input; map the items before the foreach instead (foreach(step, { items: \u2026 }) or a .map() before it)` : `loop body "${id2}": a [map, step] body is not supported \u2014 the body receives the previous output as its input; put the .map() before the loop instead`,
|
|
6457
6694
|
callIndex: i,
|
|
6458
|
-
stepId:
|
|
6695
|
+
stepId: id2
|
|
6459
6696
|
};
|
|
6460
6697
|
}
|
|
6461
6698
|
if (node.input !== void 0) {
|
|
6462
6699
|
return {
|
|
6463
6700
|
code: "mapping-placement",
|
|
6464
|
-
message: `"${
|
|
6701
|
+
message: `"${id2}": the [map, step] arm mapping and the node's own input map would both bind its input \u2014 keep one (drop the arm map, or the \`input\` on the declaration)`,
|
|
6465
6702
|
callIndex: i,
|
|
6466
|
-
stepId:
|
|
6703
|
+
stepId: id2
|
|
6467
6704
|
};
|
|
6468
6705
|
}
|
|
6469
6706
|
return void 0;
|
|
6470
6707
|
}, "armMapPlacementIssue");
|
|
6471
6708
|
const hitlPlacementIssue = /* @__PURE__ */ __name4((node, ref, i, container) => {
|
|
6472
6709
|
if (!isHitlNode2(node)) return void 0;
|
|
6473
|
-
const
|
|
6710
|
+
const id2 = node.id;
|
|
6474
6711
|
if (ref.armMap) {
|
|
6475
6712
|
return {
|
|
6476
6713
|
code: "node-type-unsupported-in-container",
|
|
6477
|
-
message: workflowHitlArmShapeMessage(node.type,
|
|
6714
|
+
message: workflowHitlArmShapeMessage(node.type, id2, "mapped-arm"),
|
|
6478
6715
|
callIndex: i,
|
|
6479
|
-
stepId:
|
|
6716
|
+
stepId: id2
|
|
6480
6717
|
};
|
|
6481
6718
|
}
|
|
6482
6719
|
if (container !== "place" && !workflowContainerRunsHitlArm(container)) {
|
|
6483
6720
|
return {
|
|
6484
6721
|
code: "node-type-unsupported-in-container",
|
|
6485
|
-
message: workflowHitlArmUnsupportedMessage(node.type,
|
|
6722
|
+
message: workflowHitlArmUnsupportedMessage(node.type, id2, container),
|
|
6486
6723
|
callIndex: i,
|
|
6487
|
-
stepId:
|
|
6724
|
+
stepId: id2
|
|
6488
6725
|
};
|
|
6489
6726
|
}
|
|
6490
6727
|
return void 0;
|
|
@@ -6590,8 +6827,8 @@ function resolvePlacements(calls) {
|
|
|
6590
6827
|
graph.push(call.entry);
|
|
6591
6828
|
return;
|
|
6592
6829
|
case "declare": {
|
|
6593
|
-
const
|
|
6594
|
-
if (placedBy.has(
|
|
6830
|
+
const id2 = nodeIdOf(call.node);
|
|
6831
|
+
if (placedBy.has(id2)) return;
|
|
6595
6832
|
graph.push(call.node);
|
|
6596
6833
|
return;
|
|
6597
6834
|
}
|
|
@@ -6742,14 +6979,14 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
|
|
|
6742
6979
|
const seeded = [];
|
|
6743
6980
|
const unseeded = [];
|
|
6744
6981
|
const known = new Set(Object.keys(targetPlan.steps));
|
|
6745
|
-
const parentOf = /* @__PURE__ */ __name4((
|
|
6746
|
-
const m = /^(.*)(\[\d+\]|#\d+)$/.exec(
|
|
6982
|
+
const parentOf = /* @__PURE__ */ __name4((id2) => {
|
|
6983
|
+
const m = /^(.*)(\[\d+\]|#\d+)$/.exec(id2);
|
|
6747
6984
|
return m ? m[1] : void 0;
|
|
6748
6985
|
}, "parentOf");
|
|
6749
|
-
const dependsOf = /* @__PURE__ */ __name4((
|
|
6750
|
-
const node = targetPlan.steps[
|
|
6986
|
+
const dependsOf = /* @__PURE__ */ __name4((id2) => {
|
|
6987
|
+
const node = targetPlan.steps[id2];
|
|
6751
6988
|
if (node) return node.dependsOn;
|
|
6752
|
-
const parent = parentOf(
|
|
6989
|
+
const parent = parentOf(id2);
|
|
6753
6990
|
return parent && targetPlan.steps[parent] ? [
|
|
6754
6991
|
parent
|
|
6755
6992
|
] : [];
|
|
@@ -6762,23 +6999,23 @@ function seedLedgerFromRun(run, steps, targetPlan, opts = {}) {
|
|
|
6762
6999
|
walk2.push(s.stepId);
|
|
6763
7000
|
}
|
|
6764
7001
|
}
|
|
6765
|
-
for (const
|
|
6766
|
-
const row = byId.get(
|
|
7002
|
+
for (const id2 of walk2) {
|
|
7003
|
+
const row = byId.get(id2);
|
|
6767
7004
|
if (!row || row.status !== "completed") continue;
|
|
6768
|
-
if (!dependsOf(
|
|
6769
|
-
unseeded.push(
|
|
7005
|
+
if (!dependsOf(id2).every((d) => seededIds.has(d))) {
|
|
7006
|
+
unseeded.push(id2);
|
|
6770
7007
|
continue;
|
|
6771
7008
|
}
|
|
6772
|
-
seededIds.add(
|
|
7009
|
+
seededIds.add(id2);
|
|
6773
7010
|
seeded.push({
|
|
6774
|
-
stepId:
|
|
7011
|
+
stepId: id2,
|
|
6775
7012
|
output: row.output,
|
|
6776
7013
|
attempt: row.attempt ?? 1,
|
|
6777
7014
|
effects: row.effects ?? {}
|
|
6778
7015
|
});
|
|
6779
7016
|
}
|
|
6780
7017
|
const dropped = steps.filter((s) => s.status === "completed" && !known.has(s.stepId) && !(parentOf(s.stepId) && known.has(parentOf(s.stepId)))).map((s) => s.stepId);
|
|
6781
|
-
const firstPending = targetPlan.order.find((
|
|
7018
|
+
const firstPending = targetPlan.order.find((id2) => !seededIds.has(id2));
|
|
6782
7019
|
const graphChanged = !!(opts.targetGraphHash && run.graphHash && opts.targetGraphHash !== run.graphHash);
|
|
6783
7020
|
return {
|
|
6784
7021
|
sourceRunId: run.id,
|
|
@@ -6851,37 +7088,37 @@ function replayLedger(g, ledger) {
|
|
|
6851
7088
|
startedAt: 0,
|
|
6852
7089
|
...ledger.requestContext
|
|
6853
7090
|
};
|
|
6854
|
-
const ctxFor = /* @__PURE__ */ __name4((
|
|
7091
|
+
const ctxFor = /* @__PURE__ */ __name4((id2) => ({
|
|
6855
7092
|
initData: ledger.initData,
|
|
6856
|
-
stepResults: ancestorResults(plan,
|
|
7093
|
+
stepResults: ancestorResults(plan, id2, rows22),
|
|
6857
7094
|
state: ledger.state ?? {},
|
|
6858
7095
|
requestContext
|
|
6859
7096
|
}), "ctxFor");
|
|
6860
7097
|
const verdicts = [];
|
|
6861
|
-
for (const
|
|
6862
|
-
const node = plan.steps[
|
|
6863
|
-
const recorded = rows22.get(
|
|
7098
|
+
for (const id2 of plan.order) {
|
|
7099
|
+
const node = plan.steps[id2];
|
|
7100
|
+
const recorded = rows22.get(id2);
|
|
6864
7101
|
if (!recorded || recorded.status === "pending" || recorded.status === "skipped") continue;
|
|
6865
7102
|
if (node.kind === "branch") {
|
|
6866
7103
|
const entry = node.entry;
|
|
6867
|
-
const taken = selectBranchArms(branchSpecFromConditional(entry), ctxFor(
|
|
7104
|
+
const taken = selectBranchArms(branchSpecFromConditional(entry), ctxFor(id2));
|
|
6868
7105
|
const recordedTaken = recorded.taken ?? inferTaken(entry, rows22);
|
|
6869
7106
|
verdicts.push({
|
|
6870
|
-
stepId:
|
|
7107
|
+
stepId: id2,
|
|
6871
7108
|
kind: "branch",
|
|
6872
7109
|
recorded: recordedTaken,
|
|
6873
7110
|
local: taken,
|
|
6874
7111
|
diverged: canonical(recordedTaken) !== canonical(taken)
|
|
6875
7112
|
});
|
|
6876
|
-
} else if (node.kind === "map" && !
|
|
7113
|
+
} else if (node.kind === "map" && !id2.endsWith(".join") && recorded.status === "completed") {
|
|
6877
7114
|
const entry = node.entry;
|
|
6878
|
-
const resolved = resolveMapping(parseMapConfig(entry.mapConfig,
|
|
7115
|
+
const resolved = resolveMapping(parseMapConfig(entry.mapConfig, id2), ctxFor(id2));
|
|
6879
7116
|
const local = "error" in resolved ? {
|
|
6880
7117
|
error: resolved.error,
|
|
6881
7118
|
key: resolved.key
|
|
6882
7119
|
} : resolved.value;
|
|
6883
7120
|
verdicts.push({
|
|
6884
|
-
stepId:
|
|
7121
|
+
stepId: id2,
|
|
6885
7122
|
kind: "map",
|
|
6886
7123
|
recorded: recorded.output,
|
|
6887
7124
|
local,
|
|
@@ -6890,11 +7127,11 @@ function replayLedger(g, ledger) {
|
|
|
6890
7127
|
} else if (node.kind === "foreach") {
|
|
6891
7128
|
const entry = node.entry;
|
|
6892
7129
|
const source = node.dependsOn[0];
|
|
6893
|
-
const items = source ? ctxFor(
|
|
7130
|
+
const items = source ? ctxFor(id2).stepResults[source] : void 0;
|
|
6894
7131
|
const local = Array.isArray(items) ? items.length : void 0;
|
|
6895
7132
|
const recordedCount = recorded.itemCount ?? countChildren(entry, rows22);
|
|
6896
7133
|
verdicts.push({
|
|
6897
|
-
stepId:
|
|
7134
|
+
stepId: id2,
|
|
6898
7135
|
kind: "foreach",
|
|
6899
7136
|
recorded: recordedCount,
|
|
6900
7137
|
local,
|
|
@@ -6903,7 +7140,7 @@ function replayLedger(g, ledger) {
|
|
|
6903
7140
|
} else if (node.kind === "subrun" && recorded.status === "completed" && recorded.child) {
|
|
6904
7141
|
const local = subrunSettledOutput(recorded.child);
|
|
6905
7142
|
verdicts.push({
|
|
6906
|
-
stepId:
|
|
7143
|
+
stepId: id2,
|
|
6907
7144
|
kind: "subrun",
|
|
6908
7145
|
recorded: recorded.output,
|
|
6909
7146
|
local,
|
|
@@ -6919,7 +7156,7 @@ function replayLedger(g, ledger) {
|
|
|
6919
7156
|
__name(replayLedger, "replayLedger");
|
|
6920
7157
|
__name4(replayLedger, "replayLedger");
|
|
6921
7158
|
var JOIN = ".join";
|
|
6922
|
-
var entryOfJoin = /* @__PURE__ */ __name4((
|
|
7159
|
+
var entryOfJoin = /* @__PURE__ */ __name4((id2) => id2.endsWith(JOIN) ? id2.slice(0, -JOIN.length) : void 0, "entryOfJoin");
|
|
6923
7160
|
function replayResultOf(row, node) {
|
|
6924
7161
|
if (!row) return void 0;
|
|
6925
7162
|
if (row.status === "completed") return {
|
|
@@ -6935,7 +7172,7 @@ function replayResultOf(row, node) {
|
|
|
6935
7172
|
}
|
|
6936
7173
|
__name(replayResultOf, "replayResultOf");
|
|
6937
7174
|
__name4(replayResultOf, "replayResultOf");
|
|
6938
|
-
function ancestorResults(plan,
|
|
7175
|
+
function ancestorResults(plan, id2, rows22) {
|
|
6939
7176
|
const out = {};
|
|
6940
7177
|
const joinAliased = /* @__PURE__ */ new Set();
|
|
6941
7178
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -6984,7 +7221,7 @@ function ancestorResults(plan, id, rows22) {
|
|
|
6984
7221
|
walk2(node.dependsOn);
|
|
6985
7222
|
}
|
|
6986
7223
|
}, "walk");
|
|
6987
|
-
walk2(plan.steps[
|
|
7224
|
+
walk2(plan.steps[id2]?.dependsOn ?? []);
|
|
6988
7225
|
return out;
|
|
6989
7226
|
}
|
|
6990
7227
|
__name(ancestorResults, "ancestorResults");
|
|
@@ -6996,8 +7233,8 @@ function inferTaken(entry, rows22) {
|
|
|
6996
7233
|
entry.otherwise
|
|
6997
7234
|
] : []
|
|
6998
7235
|
];
|
|
6999
|
-
return arms.map(branchArmId).filter((
|
|
7000
|
-
const r = rows22.get(
|
|
7236
|
+
return arms.map(branchArmId).filter((id2) => {
|
|
7237
|
+
const r = rows22.get(id2);
|
|
7001
7238
|
return r !== void 0 && r.status !== "skipped" && r.status !== "pending";
|
|
7002
7239
|
});
|
|
7003
7240
|
}
|
|
@@ -7006,7 +7243,7 @@ __name4(inferTaken, "inferTaken");
|
|
|
7006
7243
|
function countChildren(entry, rows22) {
|
|
7007
7244
|
const body = branchArmId(entry.step);
|
|
7008
7245
|
let n2 = 0;
|
|
7009
|
-
for (const
|
|
7246
|
+
for (const id2 of rows22.keys()) if (id2.startsWith(`${body}[`)) n2 += 1;
|
|
7010
7247
|
return n2;
|
|
7011
7248
|
}
|
|
7012
7249
|
__name(countChildren, "countChildren");
|
|
@@ -8452,8 +8689,8 @@ function step2(s) {
|
|
|
8452
8689
|
return step(typeof s === "string" ? s : s.id);
|
|
8453
8690
|
}
|
|
8454
8691
|
__name(step2, "step");
|
|
8455
|
-
function stepOf2(
|
|
8456
|
-
return stepOf(
|
|
8692
|
+
function stepOf2(id2) {
|
|
8693
|
+
return stepOf(id2);
|
|
8457
8694
|
}
|
|
8458
8695
|
__name(stepOf2, "stepOf");
|
|
8459
8696
|
var init2 = init;
|
|
@@ -8544,16 +8781,16 @@ var assertPredicate = /* @__PURE__ */ __name((p, where) => {
|
|
|
8544
8781
|
if (!isPredicate(p)) throw new LuaWorkflowBuildError("closure-predicate", `${where}: not a LuaPredicate`, "build predicates with eq/gt/inSet/exists/and/or/not");
|
|
8545
8782
|
return p;
|
|
8546
8783
|
}, "assertPredicate");
|
|
8547
|
-
var assertRetry = /* @__PURE__ */ __name((r,
|
|
8784
|
+
var assertRetry = /* @__PURE__ */ __name((r, id2) => {
|
|
8548
8785
|
if (!r) return;
|
|
8549
8786
|
if (!isWithinWorkflowRetryAttempts(r.maxAttempts)) {
|
|
8550
8787
|
const over = typeof r.maxAttempts === "number" && r.maxAttempts > WORKFLOW_RETRY_MAX_ATTEMPTS;
|
|
8551
|
-
throw new LuaWorkflowBuildError(over ? "cap-exceeded" : "invalid-envelope", `"${
|
|
8788
|
+
throw new LuaWorkflowBuildError(over ? "cap-exceeded" : "invalid-envelope", `"${id2}": ${workflowRetryMaxAttemptsMessage(r.maxAttempts)}`);
|
|
8552
8789
|
}
|
|
8553
|
-
if (r.backoff !== void 0 && !WORKFLOW_RETRY_BACKOFFS.includes(r.backoff)) throw new LuaWorkflowBuildError("backoff-invalid", `"${
|
|
8790
|
+
if (r.backoff !== void 0 && !WORKFLOW_RETRY_BACKOFFS.includes(r.backoff)) throw new LuaWorkflowBuildError("backoff-invalid", `"${id2}": retry.backoff must be ${WORKFLOW_RETRY_BACKOFFS.map((b) => `'${b}'`).join(" | ")}`);
|
|
8554
8791
|
if (r.maxBackoffSeconds !== void 0) {
|
|
8555
|
-
if (r.backoff !== "exponential") throw new LuaWorkflowBuildError("backoff-invalid", `"${
|
|
8556
|
-
if (r.maxBackoffSeconds <= 0 || r.backoffSeconds !== void 0 && r.maxBackoffSeconds < r.backoffSeconds) throw new LuaWorkflowBuildError("backoff-invalid", `"${
|
|
8792
|
+
if (r.backoff !== "exponential") throw new LuaWorkflowBuildError("backoff-invalid", `"${id2}": retry.maxBackoffSeconds is only meaningful with backoff:'exponential'`);
|
|
8793
|
+
if (r.maxBackoffSeconds <= 0 || r.backoffSeconds !== void 0 && r.maxBackoffSeconds < r.backoffSeconds) throw new LuaWorkflowBuildError("backoff-invalid", `"${id2}": retry.maxBackoffSeconds must be > 0 and \u2265 backoffSeconds`);
|
|
8557
8794
|
}
|
|
8558
8795
|
}, "assertRetry");
|
|
8559
8796
|
var assertTimeout = /* @__PURE__ */ __name((node) => {
|
|
@@ -8825,8 +9062,8 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
8825
9062
|
ref: arm
|
|
8826
9063
|
};
|
|
8827
9064
|
if (arm && typeof arm === "object" && isHitlEntry(arm)) {
|
|
8828
|
-
const
|
|
8829
|
-
throw new LuaWorkflowBuildError("invalid-step", `${where}: an approval / waitForSignal arm is placed by id \u2014 declare it with .approval(${JSON.stringify(
|
|
9065
|
+
const id2 = arm.id;
|
|
9066
|
+
throw new LuaWorkflowBuildError("invalid-step", `${where}: an approval / waitForSignal arm is placed by id \u2014 declare it with .approval(${JSON.stringify(id2 ?? "id")}, \u2026) / .waitForSignal(\u2026) and pass the id string`);
|
|
8830
9067
|
}
|
|
8831
9068
|
return {
|
|
8832
9069
|
node: this.registerStep(arm, where)
|
|
@@ -8946,14 +9183,14 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
8946
9183
|
assertNoClosure(mapping, "map()");
|
|
8947
9184
|
this.recordEnvRefs(mapping);
|
|
8948
9185
|
this.mapCount += 1;
|
|
8949
|
-
let
|
|
8950
|
-
if (
|
|
9186
|
+
let id2 = opts?.id;
|
|
9187
|
+
if (id2 === void 0) {
|
|
8951
9188
|
this.unnamedMaps += 1;
|
|
8952
|
-
|
|
9189
|
+
id2 = `map_${this.mapCount}`;
|
|
8953
9190
|
}
|
|
8954
9191
|
const node = {
|
|
8955
9192
|
type: "mapping",
|
|
8956
|
-
id,
|
|
9193
|
+
id: id2,
|
|
8957
9194
|
mapConfig: canonicalJson(mapping)
|
|
8958
9195
|
};
|
|
8959
9196
|
return this.push({
|
|
@@ -8964,12 +9201,12 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
8964
9201
|
sleep(ms, opts) {
|
|
8965
9202
|
if (typeof ms !== "number" || !Number.isFinite(ms) || ms < 0) throw new LuaWorkflowBuildError("invalid-envelope", "sleep(ms) takes a literal non-negative number");
|
|
8966
9203
|
this.sleepCount += 1;
|
|
8967
|
-
const
|
|
9204
|
+
const id2 = opts?.id ?? `sleep_${this.sleepCount}`;
|
|
8968
9205
|
return this.push({
|
|
8969
9206
|
kind: "entry",
|
|
8970
9207
|
entry: defined({
|
|
8971
9208
|
type: "sleep",
|
|
8972
|
-
id,
|
|
9209
|
+
id: id2,
|
|
8973
9210
|
duration: ms,
|
|
8974
9211
|
businessHours: opts?.businessHours
|
|
8975
9212
|
})
|
|
@@ -8977,13 +9214,13 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
8977
9214
|
}
|
|
8978
9215
|
sleepUntil(iso, opts) {
|
|
8979
9216
|
this.sleepCount += 1;
|
|
8980
|
-
const
|
|
9217
|
+
const id2 = opts?.id ?? `sleep_${this.sleepCount}`;
|
|
8981
9218
|
if (typeof iso === "string") {
|
|
8982
9219
|
return this.push({
|
|
8983
9220
|
kind: "entry",
|
|
8984
9221
|
entry: defined({
|
|
8985
9222
|
type: "sleepUntil",
|
|
8986
|
-
id,
|
|
9223
|
+
id: id2,
|
|
8987
9224
|
date: iso,
|
|
8988
9225
|
businessHours: opts?.businessHours,
|
|
8989
9226
|
round: opts?.round
|
|
@@ -8996,7 +9233,7 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
8996
9233
|
kind: "entry",
|
|
8997
9234
|
entry: {
|
|
8998
9235
|
type: "mapping",
|
|
8999
|
-
id: `${
|
|
9236
|
+
id: `${id2}_at`,
|
|
9000
9237
|
mapConfig: canonicalJson({
|
|
9001
9238
|
date: {
|
|
9002
9239
|
template: iso.template
|
|
@@ -9008,9 +9245,9 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9008
9245
|
kind: "entry",
|
|
9009
9246
|
entry: defined({
|
|
9010
9247
|
type: "sleepUntil",
|
|
9011
|
-
id,
|
|
9248
|
+
id: id2,
|
|
9012
9249
|
dateFrom: {
|
|
9013
|
-
step: `${
|
|
9250
|
+
step: `${id2}_at`,
|
|
9014
9251
|
path: "date"
|
|
9015
9252
|
},
|
|
9016
9253
|
businessHours: opts?.businessHours,
|
|
@@ -9018,35 +9255,35 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9018
9255
|
})
|
|
9019
9256
|
});
|
|
9020
9257
|
}
|
|
9021
|
-
agentStep(
|
|
9022
|
-
this.assertId(
|
|
9258
|
+
agentStep(id2, opts) {
|
|
9259
|
+
this.assertId(id2, "agentStep()");
|
|
9023
9260
|
if (!opts || typeof opts.agentId !== "string" && !(opts.agentId && typeof opts.agentId === "object" && "__envRef" in opts.agentId)) {
|
|
9024
|
-
throw new LuaWorkflowBuildError("invalid-envelope", `agentStep("${
|
|
9261
|
+
throw new LuaWorkflowBuildError("invalid-envelope", `agentStep("${id2}") needs an agentId`);
|
|
9025
9262
|
}
|
|
9026
9263
|
const tier = opts.tier ?? (opts.workspace ? "job" : void 0);
|
|
9027
|
-
if (opts.workspace && opts.tier !== void 0 && opts.tier !== "job") throw new LuaWorkflowBuildError("workspace-requires-job-tier", `"${
|
|
9028
|
-
if (opts.harness !== void 0 && tier !== "job") throw new LuaWorkflowBuildError("harness-requires-job-tier", `"${
|
|
9029
|
-
if (opts.toolScope?.jobTools && tier !== "job") throw new LuaWorkflowBuildError("cap-exceeded", `"${
|
|
9264
|
+
if (opts.workspace && opts.tier !== void 0 && opts.tier !== "job") throw new LuaWorkflowBuildError("workspace-requires-job-tier", `"${id2}": a step mounting a workspace must be tier:'job'`);
|
|
9265
|
+
if (opts.harness !== void 0 && tier !== "job") throw new LuaWorkflowBuildError("harness-requires-job-tier", `"${id2}": harness is only legal on a tier:'job' agent step`);
|
|
9266
|
+
if (opts.toolScope?.jobTools && tier !== "job") throw new LuaWorkflowBuildError("cap-exceeded", `"${id2}": toolScope.jobTools require tier:'job' (job-tools-require-job-tier)`);
|
|
9030
9267
|
for (const m of WORKFLOW_JOB_RANGE_MEMBERS) {
|
|
9031
9268
|
if (opts[m] === void 0) continue;
|
|
9032
|
-
if (tier !== "job") throw new LuaWorkflowBuildError("max-turns-requires-job-tier", `"${
|
|
9269
|
+
if (tier !== "job") throw new LuaWorkflowBuildError("max-turns-requires-job-tier", `"${id2}": ${m} is only legal on a tier:'job' agent step`);
|
|
9033
9270
|
if (!isWithinWorkflowJobRange(m, opts[m])) {
|
|
9034
9271
|
const { min, max } = WORKFLOW_JOB_RANGES[m];
|
|
9035
|
-
throw new LuaWorkflowBuildError("max-turns-invalid", `"${
|
|
9272
|
+
throw new LuaWorkflowBuildError("max-turns-invalid", `"${id2}": ${m} must be an integer ${min}..${max}`);
|
|
9036
9273
|
}
|
|
9037
9274
|
}
|
|
9038
9275
|
assertTimeout({
|
|
9039
|
-
id,
|
|
9276
|
+
id: id2,
|
|
9040
9277
|
timeoutSeconds: opts.timeoutSeconds,
|
|
9041
9278
|
tier,
|
|
9042
9279
|
workspace: opts.workspace,
|
|
9043
9280
|
kind: "agent"
|
|
9044
9281
|
});
|
|
9045
|
-
assertRetry(opts.retry,
|
|
9282
|
+
assertRetry(opts.retry, id2);
|
|
9046
9283
|
this.recordEnvRefs(opts.agentId, opts.prompt);
|
|
9047
9284
|
const node = defined({
|
|
9048
9285
|
type: "agent",
|
|
9049
|
-
id,
|
|
9286
|
+
id: id2,
|
|
9050
9287
|
agentId: opts.agentId,
|
|
9051
9288
|
promptTemplate: templateText(opts.prompt),
|
|
9052
9289
|
outputSchema: schemaToJson(opts.outputSchema),
|
|
@@ -9074,30 +9311,30 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9074
9311
|
node
|
|
9075
9312
|
});
|
|
9076
9313
|
}
|
|
9077
|
-
specialistStep(
|
|
9078
|
-
this.assertId(
|
|
9314
|
+
specialistStep(id2, opts) {
|
|
9315
|
+
this.assertId(id2, "specialistStep()");
|
|
9079
9316
|
const role = opts?.role;
|
|
9080
|
-
if (!role || typeof role !== "object") throw new LuaWorkflowBuildError("invalid-envelope", `specialistStep("${
|
|
9317
|
+
if (!role || typeof role !== "object") throw new LuaWorkflowBuildError("invalid-envelope", `specialistStep("${id2}") needs a role`);
|
|
9081
9318
|
if (role.ref !== void 0 && (role.name !== void 0 || role.instructions !== void 0 || role.tools !== void 0)) {
|
|
9082
|
-
throw new LuaWorkflowBuildError("role-ref-and-inline", `"${
|
|
9319
|
+
throw new LuaWorkflowBuildError("role-ref-and-inline", `"${id2}": role is EITHER { ref } OR the inline { name, instructions, tools } shape`);
|
|
9083
9320
|
}
|
|
9084
9321
|
if (role.ref === void 0) {
|
|
9085
9322
|
if (typeof role.instructions !== "string" || role.instructions.length > WORKFLOW_SPECIALIST_ROLE_MAX_INSTRUCTIONS) {
|
|
9086
|
-
throw new LuaWorkflowBuildError("ephemeral-role-too-long", `"${
|
|
9323
|
+
throw new LuaWorkflowBuildError("ephemeral-role-too-long", `"${id2}": role.instructions must be \u2264 ${WORKFLOW_SPECIALIST_ROLE_MAX_INSTRUCTIONS} chars`);
|
|
9087
9324
|
}
|
|
9088
|
-
if (!Array.isArray(role.tools)) throw new LuaWorkflowBuildError("invalid-envelope", `"${
|
|
9089
|
-
if (role.tools.length > 64) throw new LuaWorkflowBuildError("cap-exceeded", `"${
|
|
9325
|
+
if (!Array.isArray(role.tools)) throw new LuaWorkflowBuildError("invalid-envelope", `"${id2}": role.tools must be an array ([] = no tools)`);
|
|
9326
|
+
if (role.tools.length > 64) throw new LuaWorkflowBuildError("cap-exceeded", `"${id2}": role.tools exceeds 64 entries`);
|
|
9090
9327
|
}
|
|
9091
9328
|
assertTimeout({
|
|
9092
|
-
id,
|
|
9329
|
+
id: id2,
|
|
9093
9330
|
timeoutSeconds: opts.timeoutSeconds,
|
|
9094
9331
|
kind: "agent"
|
|
9095
9332
|
});
|
|
9096
|
-
assertRetry(opts.retry,
|
|
9333
|
+
assertRetry(opts.retry, id2);
|
|
9097
9334
|
this.recordEnvRefs(opts.prompt);
|
|
9098
9335
|
const node = defined({
|
|
9099
9336
|
type: "agent",
|
|
9100
|
-
id,
|
|
9337
|
+
id: id2,
|
|
9101
9338
|
agentId: "$self",
|
|
9102
9339
|
role: role.ref !== void 0 ? {
|
|
9103
9340
|
ref: role.ref
|
|
@@ -9120,20 +9357,20 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9120
9357
|
node
|
|
9121
9358
|
});
|
|
9122
9359
|
}
|
|
9123
|
-
toolStep(
|
|
9124
|
-
this.assertId(
|
|
9125
|
-
if (!tool || typeof tool !== "object" || typeof tool.name !== "string") throw new LuaWorkflowBuildError("invalid-envelope", `toolStep("${
|
|
9126
|
-
assertNoClosure(opts.input, `toolStep("${
|
|
9360
|
+
toolStep(id2, tool, opts = {}) {
|
|
9361
|
+
this.assertId(id2, "toolStep()");
|
|
9362
|
+
if (!tool || typeof tool !== "object" || typeof tool.name !== "string") throw new LuaWorkflowBuildError("invalid-envelope", `toolStep("${id2}") needs a LuaTool`);
|
|
9363
|
+
assertNoClosure(opts.input, `toolStep("${id2}").input`);
|
|
9127
9364
|
this.recordEnvRefs(opts.input);
|
|
9128
9365
|
assertTimeout({
|
|
9129
|
-
id,
|
|
9366
|
+
id: id2,
|
|
9130
9367
|
timeoutSeconds: opts.timeoutSeconds,
|
|
9131
9368
|
kind: "tool"
|
|
9132
9369
|
});
|
|
9133
|
-
assertRetry(opts.retry,
|
|
9370
|
+
assertRetry(opts.retry, id2);
|
|
9134
9371
|
const node = defined({
|
|
9135
9372
|
type: "tool",
|
|
9136
|
-
id,
|
|
9373
|
+
id: id2,
|
|
9137
9374
|
toolId: tool.name,
|
|
9138
9375
|
input: opts.input,
|
|
9139
9376
|
timeoutSeconds: opts.timeoutSeconds,
|
|
@@ -9147,34 +9384,34 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9147
9384
|
node
|
|
9148
9385
|
});
|
|
9149
9386
|
}
|
|
9150
|
-
approval(
|
|
9151
|
-
this.assertId(
|
|
9152
|
-
if (!opts || typeof opts.title !== "string") throw new LuaWorkflowBuildError("invalid-envelope", `approval("${
|
|
9387
|
+
approval(id2, opts) {
|
|
9388
|
+
this.assertId(id2, "approval()");
|
|
9389
|
+
if (!opts || typeof opts.title !== "string") throw new LuaWorkflowBuildError("invalid-envelope", `approval("${id2}") needs a title`);
|
|
9153
9390
|
if (opts.approver === "creator" && opts.excludeInitiator === true) {
|
|
9154
|
-
throw new LuaWorkflowBuildError("approver-excludes-only-candidate", `"${
|
|
9391
|
+
throw new LuaWorkflowBuildError("approver-excludes-only-candidate", `"${id2}": approver:'creator' with excludeInitiator:true always excludes the only candidate`);
|
|
9155
9392
|
}
|
|
9156
9393
|
const editable = approvalEditable(opts);
|
|
9157
|
-
if (opts.fourEyes !== void 0 && !editable) throw new LuaWorkflowBuildError("four-eyes-requires-editable", `"${
|
|
9394
|
+
if (opts.fourEyes !== void 0 && !editable) throw new LuaWorkflowBuildError("four-eyes-requires-editable", `"${id2}": \`fourEyes\` requires editable:true`);
|
|
9158
9395
|
if (opts.editable === false && Array.isArray(opts.editablePaths) && opts.editablePaths.length > 0) {
|
|
9159
|
-
throw new LuaWorkflowBuildError("editable-path-invalid", `"${
|
|
9396
|
+
throw new LuaWorkflowBuildError("editable-path-invalid", `"${id2}": \`editablePaths\` beside editable:false is contradictory \u2014 drop the paths or set editable:true`);
|
|
9160
9397
|
} else if ((opts.editablePaths !== void 0 || opts.editedPayloadSchema !== void 0) && !editable) {
|
|
9161
|
-
throw new LuaWorkflowBuildError("editable-path-invalid", `"${
|
|
9398
|
+
throw new LuaWorkflowBuildError("editable-path-invalid", `"${id2}": \`editablePaths\` / \`editedPayloadSchema\` require editable:true (a non-empty editablePaths implies it)`);
|
|
9162
9399
|
}
|
|
9163
9400
|
for (const p of opts.editablePaths ?? []) {
|
|
9164
|
-
if (!EDITABLE_PATH_RE2.test(p)) throw new LuaWorkflowBuildError("editable-path-invalid", `"${
|
|
9401
|
+
if (!EDITABLE_PATH_RE2.test(p)) throw new LuaWorkflowBuildError("editable-path-invalid", `"${id2}": editablePaths entry "${p}" is outside the grammar seg(.seg)* with [*]/[n] selectors`);
|
|
9165
9402
|
}
|
|
9166
9403
|
if (Array.isArray(opts.onTimeout)) {
|
|
9167
9404
|
const chain = opts.onTimeout;
|
|
9168
9405
|
const hops = chain.filter((h) => typeof h === "object");
|
|
9169
|
-
if (hops.length > 3) throw new LuaWorkflowBuildError("escalation-chain-too-long", `"${
|
|
9406
|
+
if (hops.length > 3) throw new LuaWorkflowBuildError("escalation-chain-too-long", `"${id2}": an onTimeout chain carries at most 3 escalation hops`);
|
|
9170
9407
|
const last = chain[chain.length - 1];
|
|
9171
|
-
if (last === void 0 || typeof last === "object") throw new LuaWorkflowBuildError("escalation-chain-not-terminal", `"${
|
|
9408
|
+
if (last === void 0 || typeof last === "object") throw new LuaWorkflowBuildError("escalation-chain-not-terminal", `"${id2}": an onTimeout chain must end in a terminal member`);
|
|
9172
9409
|
}
|
|
9173
|
-
if (typeof opts.details === "function") throw new LuaWorkflowBuildError("closure-binding", `approval("${
|
|
9410
|
+
if (typeof opts.details === "function") throw new LuaWorkflowBuildError("closure-binding", `approval("${id2}").details must be template(...)`);
|
|
9174
9411
|
this.recordEnvRefs(opts.details, opts.timeoutHours, opts.approver);
|
|
9175
9412
|
const node = defined({
|
|
9176
9413
|
type: "approval",
|
|
9177
|
-
id,
|
|
9414
|
+
id: id2,
|
|
9178
9415
|
title: opts.title,
|
|
9179
9416
|
details: opts.details ? templateText(opts.details) : void 0,
|
|
9180
9417
|
approver: opts.approver,
|
|
@@ -9196,13 +9433,13 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9196
9433
|
node
|
|
9197
9434
|
});
|
|
9198
9435
|
}
|
|
9199
|
-
waitForSignal(
|
|
9200
|
-
this.assertId(
|
|
9201
|
-
if (!opts || typeof opts.signal !== "string" || opts.signal.length === 0) throw new LuaWorkflowBuildError("invalid-envelope", `waitForSignal("${
|
|
9436
|
+
waitForSignal(id2, opts) {
|
|
9437
|
+
this.assertId(id2, "waitForSignal()");
|
|
9438
|
+
if (!opts || typeof opts.signal !== "string" || opts.signal.length === 0) throw new LuaWorkflowBuildError("invalid-envelope", `waitForSignal("${id2}") needs a signal name`);
|
|
9202
9439
|
this.recordEnvRefs(opts.timeoutHours);
|
|
9203
9440
|
const node = defined({
|
|
9204
9441
|
type: "waitForSignal",
|
|
9205
|
-
id,
|
|
9442
|
+
id: id2,
|
|
9206
9443
|
signal: opts.signal,
|
|
9207
9444
|
schema: schemaToJson(opts.schema),
|
|
9208
9445
|
timeoutHours: opts.timeoutHours,
|
|
@@ -9215,28 +9452,28 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9215
9452
|
node
|
|
9216
9453
|
});
|
|
9217
9454
|
}
|
|
9218
|
-
workflow(
|
|
9219
|
-
this.assertId(
|
|
9220
|
-
assertRetry(opts?.retry,
|
|
9455
|
+
workflow(id2, ref, input, opts) {
|
|
9456
|
+
this.assertId(id2, "workflow()");
|
|
9457
|
+
assertRetry(opts?.retry, id2);
|
|
9221
9458
|
const name = typeof ref === "string" ? ref : ref instanceof LuaWorkflow ? ref.getName() : void 0;
|
|
9222
|
-
if (!name) throw new LuaWorkflowBuildError("invalid-envelope", `workflow("${
|
|
9459
|
+
if (!name) throw new LuaWorkflowBuildError("invalid-envelope", `workflow("${id2}") needs a LuaWorkflow or a workflow name`);
|
|
9223
9460
|
if (opts?.workspace === "inherit") {
|
|
9224
|
-
if (!this.config.workspace) throw new LuaWorkflowBuildError("workspace-inherit-without-parent-workspace", `"${
|
|
9225
|
-
if (ref instanceof LuaWorkflow && ref.getConfig().workspace) throw new LuaWorkflowBuildError("workspace-inherit-conflict", `"${
|
|
9461
|
+
if (!this.config.workspace) throw new LuaWorkflowBuildError("workspace-inherit-without-parent-workspace", `"${id2}": workspace:'inherit' but the parent createWorkflow declares no workspace`);
|
|
9462
|
+
if (ref instanceof LuaWorkflow && ref.getConfig().workspace) throw new LuaWorkflowBuildError("workspace-inherit-conflict", `"${id2}": workspace:'inherit' on a workflow that declares its own workspace`);
|
|
9226
9463
|
}
|
|
9227
|
-
assertNoClosure(input, `workflow("${
|
|
9464
|
+
assertNoClosure(input, `workflow("${id2}").input`);
|
|
9228
9465
|
this.recordEnvRefs(input);
|
|
9229
9466
|
this.nestedRefs.push(opts?.workspace === "inherit" ? {
|
|
9230
|
-
id,
|
|
9467
|
+
id: id2,
|
|
9231
9468
|
name,
|
|
9232
9469
|
workspace: "inherit"
|
|
9233
9470
|
} : {
|
|
9234
|
-
id,
|
|
9471
|
+
id: id2,
|
|
9235
9472
|
name
|
|
9236
9473
|
});
|
|
9237
9474
|
const node = defined({
|
|
9238
9475
|
type: "workflow",
|
|
9239
|
-
id,
|
|
9476
|
+
id: id2,
|
|
9240
9477
|
workflowId: name,
|
|
9241
9478
|
input,
|
|
9242
9479
|
workspace: opts?.workspace,
|
|
@@ -9315,8 +9552,8 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9315
9552
|
});
|
|
9316
9553
|
}
|
|
9317
9554
|
}
|
|
9318
|
-
assertId(
|
|
9319
|
-
if (typeof
|
|
9555
|
+
assertId(id2, where) {
|
|
9556
|
+
if (typeof id2 !== "string" || !STEP_ID_RE.test(id2)) throw new LuaWorkflowBuildError("invalid-step-id", `${where}: id "${String(id2)}" must match ${STEP_ID_RE}`);
|
|
9320
9557
|
}
|
|
9321
9558
|
};
|
|
9322
9559
|
var EDITABLE_PATH_RE2 = /^[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?(\.[A-Za-z_][A-Za-z0-9_]*(\[(\*|\d+)\])?)*$/;
|