lua-cli 3.40.0 → 3.41.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 +41 -21
- package/dist/api-exports.js +161 -16
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +1006 -419
- package/dist/index.js.map +1 -1
- package/dist/voice/test/index.d.ts +18 -18
- package/dist/workflow-builder.d.ts +19 -3
- package/dist/workflow-builder.js +151 -6
- package/dist/workflow-builder.js.map +1 -1
- package/docs/workflows/workspaces-and-long-steps.md +1 -1
- package/package.json +3 -3
- package/template/package.json +1 -1
|
@@ -255,14 +255,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
255
255
|
*/
|
|
256
256
|
options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
257
257
|
}, "strip", z.ZodTypeAny, {
|
|
258
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
259
258
|
provider?: "deepgram" | "elevenlabs";
|
|
260
259
|
kind?: "plugin";
|
|
260
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
261
261
|
options?: Record<string, unknown>;
|
|
262
262
|
}, {
|
|
263
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
264
263
|
provider?: "deepgram" | "elevenlabs";
|
|
265
264
|
kind?: "plugin";
|
|
265
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
266
266
|
options?: Record<string, unknown>;
|
|
267
267
|
}>, z.ZodObject<{
|
|
268
268
|
kind: z.ZodLiteral<"realtime">;
|
|
@@ -321,14 +321,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
321
321
|
*/
|
|
322
322
|
options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
323
323
|
}, "strip", z.ZodTypeAny, {
|
|
324
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
325
324
|
provider?: "deepgram" | "elevenlabs";
|
|
326
325
|
kind?: "plugin";
|
|
326
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
327
327
|
options?: Record<string, unknown>;
|
|
328
328
|
}, {
|
|
329
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
330
329
|
provider?: "deepgram" | "elevenlabs";
|
|
331
330
|
kind?: "plugin";
|
|
331
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
332
332
|
options?: Record<string, unknown>;
|
|
333
333
|
}>, z.ZodObject<{
|
|
334
334
|
kind: z.ZodLiteral<"realtime">;
|
|
@@ -387,14 +387,14 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
387
387
|
*/
|
|
388
388
|
options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
389
389
|
}, "strip", z.ZodTypeAny, {
|
|
390
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
391
390
|
provider?: "deepgram" | "elevenlabs";
|
|
392
391
|
kind?: "plugin";
|
|
392
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
393
393
|
options?: Record<string, unknown>;
|
|
394
394
|
}, {
|
|
395
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
396
395
|
provider?: "deepgram" | "elevenlabs";
|
|
397
396
|
kind?: "plugin";
|
|
397
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
398
398
|
options?: Record<string, unknown>;
|
|
399
399
|
}>, z.ZodObject<{
|
|
400
400
|
kind: z.ZodLiteral<"realtime">;
|
|
@@ -579,9 +579,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
579
579
|
options?: Record<string, unknown>;
|
|
580
580
|
model?: string;
|
|
581
581
|
} | {
|
|
582
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
583
582
|
provider?: "deepgram" | "elevenlabs";
|
|
584
583
|
kind?: "plugin";
|
|
584
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
585
585
|
options?: Record<string, unknown>;
|
|
586
586
|
} | {
|
|
587
587
|
provider?: "google" | "xai" | "openai";
|
|
@@ -595,9 +595,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
595
595
|
options?: Record<string, unknown>;
|
|
596
596
|
model?: string;
|
|
597
597
|
} | {
|
|
598
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
599
598
|
provider?: "deepgram" | "elevenlabs";
|
|
600
599
|
kind?: "plugin";
|
|
600
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
601
601
|
options?: Record<string, unknown>;
|
|
602
602
|
} | {
|
|
603
603
|
provider?: "google" | "xai" | "openai";
|
|
@@ -610,9 +610,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
610
610
|
options?: Record<string, unknown>;
|
|
611
611
|
model?: string;
|
|
612
612
|
} | {
|
|
613
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
614
613
|
provider?: "deepgram" | "elevenlabs";
|
|
615
614
|
kind?: "plugin";
|
|
615
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
616
616
|
options?: Record<string, unknown>;
|
|
617
617
|
} | {
|
|
618
618
|
provider?: "google" | "xai" | "openai";
|
|
@@ -673,9 +673,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
673
673
|
options?: Record<string, unknown>;
|
|
674
674
|
model?: string;
|
|
675
675
|
} | {
|
|
676
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
677
676
|
provider?: "deepgram" | "elevenlabs";
|
|
678
677
|
kind?: "plugin";
|
|
678
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
679
679
|
options?: Record<string, unknown>;
|
|
680
680
|
} | {
|
|
681
681
|
provider?: "google" | "xai" | "openai";
|
|
@@ -689,9 +689,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
689
689
|
options?: Record<string, unknown>;
|
|
690
690
|
model?: string;
|
|
691
691
|
} | {
|
|
692
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
693
692
|
provider?: "deepgram" | "elevenlabs";
|
|
694
693
|
kind?: "plugin";
|
|
694
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
695
695
|
options?: Record<string, unknown>;
|
|
696
696
|
} | {
|
|
697
697
|
provider?: "google" | "xai" | "openai";
|
|
@@ -704,9 +704,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
704
704
|
options?: Record<string, unknown>;
|
|
705
705
|
model?: string;
|
|
706
706
|
} | {
|
|
707
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
708
707
|
provider?: "deepgram" | "elevenlabs";
|
|
709
708
|
kind?: "plugin";
|
|
709
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
710
710
|
options?: Record<string, unknown>;
|
|
711
711
|
} | {
|
|
712
712
|
provider?: "google" | "xai" | "openai";
|
|
@@ -767,9 +767,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
767
767
|
options?: Record<string, unknown>;
|
|
768
768
|
model?: string;
|
|
769
769
|
} | {
|
|
770
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
771
770
|
provider?: "deepgram" | "elevenlabs";
|
|
772
771
|
kind?: "plugin";
|
|
772
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
773
773
|
options?: Record<string, unknown>;
|
|
774
774
|
} | {
|
|
775
775
|
provider?: "google" | "xai" | "openai";
|
|
@@ -783,9 +783,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
783
783
|
options?: Record<string, unknown>;
|
|
784
784
|
model?: string;
|
|
785
785
|
} | {
|
|
786
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
787
786
|
provider?: "deepgram" | "elevenlabs";
|
|
788
787
|
kind?: "plugin";
|
|
788
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
789
789
|
options?: Record<string, unknown>;
|
|
790
790
|
} | {
|
|
791
791
|
provider?: "google" | "xai" | "openai";
|
|
@@ -798,9 +798,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
798
798
|
options?: Record<string, unknown>;
|
|
799
799
|
model?: string;
|
|
800
800
|
} | {
|
|
801
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
802
801
|
provider?: "deepgram" | "elevenlabs";
|
|
803
802
|
kind?: "plugin";
|
|
803
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
804
804
|
options?: Record<string, unknown>;
|
|
805
805
|
} | {
|
|
806
806
|
provider?: "google" | "xai" | "openai";
|
|
@@ -861,9 +861,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
861
861
|
options?: Record<string, unknown>;
|
|
862
862
|
model?: string;
|
|
863
863
|
} | {
|
|
864
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
865
864
|
provider?: "deepgram" | "elevenlabs";
|
|
866
865
|
kind?: "plugin";
|
|
866
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
867
867
|
options?: Record<string, unknown>;
|
|
868
868
|
} | {
|
|
869
869
|
provider?: "google" | "xai" | "openai";
|
|
@@ -877,9 +877,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
877
877
|
options?: Record<string, unknown>;
|
|
878
878
|
model?: string;
|
|
879
879
|
} | {
|
|
880
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
881
880
|
provider?: "deepgram" | "elevenlabs";
|
|
882
881
|
kind?: "plugin";
|
|
882
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
883
883
|
options?: Record<string, unknown>;
|
|
884
884
|
} | {
|
|
885
885
|
provider?: "google" | "xai" | "openai";
|
|
@@ -892,9 +892,9 @@ declare const LuaVoiceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
892
892
|
options?: Record<string, unknown>;
|
|
893
893
|
model?: string;
|
|
894
894
|
} | {
|
|
895
|
-
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
896
895
|
provider?: "deepgram" | "elevenlabs";
|
|
897
896
|
kind?: "plugin";
|
|
897
|
+
class?: "LLM" | "STT" | "STTv2" | "TTS";
|
|
898
898
|
options?: Record<string, unknown>;
|
|
899
899
|
} | {
|
|
900
900
|
provider?: "google" | "xai" | "openai";
|
|
@@ -59,10 +59,11 @@ export declare interface AgentStepOptions {
|
|
|
59
59
|
/**
|
|
60
60
|
* EM-WS3: pin a plugin step's Lua-API proxy (and its key) to ANOTHER agent instead of this workflow's own. Legal only
|
|
61
61
|
* beside `plugins`. Refused at run time (`target_not_granted`) unless the platform's plugin-target switch is on AND
|
|
62
|
-
* this workflow's agent holds a `supervision:act` or `supervision:release` grant on the target.
|
|
62
|
+
* this workflow's agent holds a `supervision:act` or `supervision:release` grant on the target. EM-WS3 × EM-WS2: the
|
|
63
|
+
* id may be `template('${initData.<path>}')`, rendered from the run input at dispatch (a per-run target).
|
|
63
64
|
*/
|
|
64
65
|
target?: {
|
|
65
|
-
agentId: string;
|
|
66
|
+
agentId: string | TemplateBinding;
|
|
66
67
|
};
|
|
67
68
|
/**
|
|
68
69
|
* What this step DOES: `classify` | `extract` | `transform` | `draft` | `research` | `reason` | `code` |
|
|
@@ -339,7 +340,7 @@ export declare type LuaWorkflowBuildCode = 'duplicate-step-id' | 'unknown-step-r
|
|
|
339
340
|
*/
|
|
340
341
|
| 'workspace-not-declared' | 'workspace-inherit-without-parent-workspace' | 'workspace-inherit-conflict' | 'harness-requires-job-tier' | 'max-turns-requires-job-tier' | 'max-turns-invalid'
|
|
341
342
|
/** EM-WS3: a step's `plugins` outside the allowlist, repeated, or off the Job tier. */
|
|
342
|
-
| 'plugins-invalid' | 'cap-exceeded' | 'chunk-size-invalid' | 'rate-limit-invalid' | 'backoff-invalid' | 'loop-interval-out-of-range' | 'mapping-placement' | 'container-arm-empty'
|
|
343
|
+
| 'plugins-invalid' | 'target-invalid' | 'lua-api-invalid' | 'cap-exceeded' | 'chunk-size-invalid' | 'rate-limit-invalid' | 'backoff-invalid' | 'loop-interval-out-of-range' | 'mapping-placement' | 'container-arm-empty'
|
|
343
344
|
/**
|
|
344
345
|
* @deprecated LUA-684 — the builder no longer throws it: an `approval` / `waitForSignal` IS a container arm
|
|
345
346
|
* (`parallel(['approve', …])`). Where the engine cannot run one — a `loop` body, the step of a `[map, step]`
|
|
@@ -488,6 +489,21 @@ export declare interface LuaWorkflowStep<TIn extends ZodType = ZodType, TOut ext
|
|
|
488
489
|
workspace?: WorkflowStepWorkspace;
|
|
489
490
|
jobResources?: WorkflowJobResources;
|
|
490
491
|
jobTools?: WorkflowJobToolId[];
|
|
492
|
+
/**
|
|
493
|
+
* EM-WS3 × EM-WS2: let this `tier:'job'` step run `lua` (`ctx.exec('lua', [...])`, `` ctx.$`lua push …` ``) against the
|
|
494
|
+
* Lua API through the platform's staging-only proxy, with a short-lived key for ONE agent: this workflow's agent, or
|
|
495
|
+
* `target`. It is the same proxy and the same deny rules as a plugin agent step: deploy, promote, publish,
|
|
496
|
+
* activate, env, chat and runtime calls are refused.
|
|
497
|
+
*/
|
|
498
|
+
luaApi?: true;
|
|
499
|
+
/**
|
|
500
|
+
* EM-WS3: pin the `luaApi` proxy (and its key) to ANOTHER agent. The id may be static or
|
|
501
|
+
* `template('${initData.<path>}')`, rendered from the run input at dispatch. The same flag and supervision-grant
|
|
502
|
+
* rules apply as on a plugin agent step.
|
|
503
|
+
*/
|
|
504
|
+
target?: {
|
|
505
|
+
agentId: string | TemplateBinding;
|
|
506
|
+
};
|
|
491
507
|
/** default { maxAttempts: 1 } */
|
|
492
508
|
retry?: RetryPolicy;
|
|
493
509
|
/** default 'none'; 'external' ⇒ park on platform-fault reclaim. */
|
package/dist/workflow-builder.js
CHANGED
|
@@ -68,17 +68,125 @@ function workflowJobPluginsProblem(plugins) {
|
|
|
68
68
|
}
|
|
69
69
|
__name(workflowJobPluginsProblem, "workflowJobPluginsProblem");
|
|
70
70
|
__name2(workflowJobPluginsProblem, "workflowJobPluginsProblem");
|
|
71
|
-
|
|
71
|
+
var WORKFLOW_JOB_TARGET_TEMPLATE_RE = /^\$\{\s*initData\.([A-Za-z0-9_.\-[\]]+)\s*\}$/;
|
|
72
|
+
var TARGET_PATH_SEGMENT_RE = /^[A-Za-z0-9_-]+(?:\[(?:0|[1-9]\d*)\])*$/;
|
|
73
|
+
function workflowJobTargetTemplatePath(binding) {
|
|
74
|
+
if (!binding || typeof binding !== "object" || Array.isArray(binding)) return null;
|
|
75
|
+
const keys = Object.keys(binding);
|
|
76
|
+
const tpl = binding.template;
|
|
77
|
+
if (keys.length !== 1 || typeof tpl !== "string" || tpl.length > 512) return null;
|
|
78
|
+
const m = WORKFLOW_JOB_TARGET_TEMPLATE_RE.exec(tpl.trim());
|
|
79
|
+
if (!m) return null;
|
|
80
|
+
const names = m[1].split(".").map((seg) => seg.replace(/\[(?:0|[1-9]\d*)\]/g, ""));
|
|
81
|
+
if (names.some((n2) => n2 === "__proto__" || n2 === "prototype" || n2 === "constructor")) return null;
|
|
82
|
+
return m[1].split(".").every((seg) => TARGET_PATH_SEGMENT_RE.test(seg)) ? m[1] : null;
|
|
83
|
+
}
|
|
84
|
+
__name(workflowJobTargetTemplatePath, "workflowJobTargetTemplatePath");
|
|
85
|
+
__name2(workflowJobTargetTemplatePath, "workflowJobTargetTemplatePath");
|
|
86
|
+
function isWorkflowJobTargetTemplate(target) {
|
|
87
|
+
const agentId = target?.agentId;
|
|
88
|
+
return !!agentId && typeof agentId === "object";
|
|
89
|
+
}
|
|
90
|
+
__name(isWorkflowJobTargetTemplate, "isWorkflowJobTargetTemplate");
|
|
91
|
+
__name2(isWorkflowJobTargetTemplate, "isWorkflowJobTargetTemplate");
|
|
92
|
+
function workflowJobLuaApiProblem(luaApi, nodeType, tier) {
|
|
93
|
+
if (luaApi === void 0) return null;
|
|
94
|
+
if (luaApi !== true) return "`luaApi` must be exactly true";
|
|
95
|
+
if (nodeType !== "code") return "`luaApi` is legal on code steps only (an agent step uses `plugins`)";
|
|
96
|
+
if (tier !== "job") return "`luaApi` requires tier:'job'";
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
__name(workflowJobLuaApiProblem, "workflowJobLuaApiProblem");
|
|
100
|
+
__name2(workflowJobLuaApiProblem, "workflowJobLuaApiProblem");
|
|
101
|
+
function workflowJobUsesLuaApi(step3) {
|
|
102
|
+
return Array.isArray(step3.plugins) && step3.plugins.length > 0 || step3.kind === "code" && step3.luaApi === true;
|
|
103
|
+
}
|
|
104
|
+
__name(workflowJobUsesLuaApi, "workflowJobUsesLuaApi");
|
|
105
|
+
__name2(workflowJobUsesLuaApi, "workflowJobUsesLuaApi");
|
|
106
|
+
function workflowJobTargetProblem(target, plugins, luaApi) {
|
|
72
107
|
if (target === void 0) return null;
|
|
73
108
|
if (!target || typeof target !== "object" || Array.isArray(target)) return "target must be { agentId }";
|
|
74
109
|
const keys = Object.keys(target);
|
|
75
110
|
const agentId = target.agentId;
|
|
76
|
-
if (keys.length !== 1 ||
|
|
77
|
-
if (
|
|
111
|
+
if (keys.length !== 1 || !("agentId" in target)) return "target must be exactly { agentId }";
|
|
112
|
+
if (typeof agentId === "string") {
|
|
113
|
+
if (!agentId.trim() || agentId.length > 256) return "target must be exactly { agentId: <non-empty string> }";
|
|
114
|
+
if (agentId.includes("${")) return "a run-input target is written template('${initData.<path>}'), never a string with ${\u2026}";
|
|
115
|
+
} else if (workflowJobTargetTemplatePath(agentId) === null) {
|
|
116
|
+
return "target.agentId must be a static id or template('${initData.<path>}') \u2014 exactly one initData placeholder, no default";
|
|
117
|
+
}
|
|
118
|
+
const hasPlugins = Array.isArray(plugins) && plugins.length > 0;
|
|
119
|
+
if (!hasPlugins && luaApi !== true) return "`target` is legal only beside `plugins` or `luaApi: true`";
|
|
78
120
|
return null;
|
|
79
121
|
}
|
|
80
122
|
__name(workflowJobTargetProblem, "workflowJobTargetProblem");
|
|
81
123
|
__name2(workflowJobTargetProblem, "workflowJobTargetProblem");
|
|
124
|
+
function readInitDataPath(root, path) {
|
|
125
|
+
let cur = root;
|
|
126
|
+
for (const seg of path.split(".")) {
|
|
127
|
+
const name = seg.replace(/\[(?:0|[1-9]\d*)\]/g, "");
|
|
128
|
+
const indexes = [
|
|
129
|
+
...seg.matchAll(/\[(0|[1-9]\d*)\]/g)
|
|
130
|
+
].map((x) => Number(x[1]));
|
|
131
|
+
if (cur === null || typeof cur !== "object" || !Object.prototype.hasOwnProperty.call(cur, name)) return void 0;
|
|
132
|
+
cur = cur[name];
|
|
133
|
+
for (const i of indexes) {
|
|
134
|
+
if (!Array.isArray(cur) || i >= cur.length) return void 0;
|
|
135
|
+
cur = cur[i];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return cur;
|
|
139
|
+
}
|
|
140
|
+
__name(readInitDataPath, "readInitDataPath");
|
|
141
|
+
__name2(readInitDataPath, "readInitDataPath");
|
|
142
|
+
function renderWorkflowJobTarget(target, initData) {
|
|
143
|
+
const agentId = target?.agentId;
|
|
144
|
+
if (target === void 0 || target === null || agentId === void 0) return {
|
|
145
|
+
ok: true,
|
|
146
|
+
agentId: void 0,
|
|
147
|
+
templated: false
|
|
148
|
+
};
|
|
149
|
+
if (typeof agentId === "string") {
|
|
150
|
+
if (!agentId.trim() || agentId.includes("${")) return {
|
|
151
|
+
ok: false,
|
|
152
|
+
reason: "invalid",
|
|
153
|
+
message: "target.agentId is invalid"
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
ok: true,
|
|
157
|
+
agentId,
|
|
158
|
+
templated: false
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const path = workflowJobTargetTemplatePath(agentId);
|
|
162
|
+
if (path === null) return {
|
|
163
|
+
ok: false,
|
|
164
|
+
reason: "invalid",
|
|
165
|
+
message: "target.agentId is not a valid initData template"
|
|
166
|
+
};
|
|
167
|
+
const value3 = readInitDataPath(initData, path);
|
|
168
|
+
if (value3 === void 0 || value3 === null) {
|
|
169
|
+
return {
|
|
170
|
+
ok: false,
|
|
171
|
+
reason: "unbound",
|
|
172
|
+
message: `target_unresolved: the run input has no initData.${path}`
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (typeof value3 !== "string" || !value3.trim() || value3.length > 256 || /\s/.test(value3.trim())) {
|
|
176
|
+
return {
|
|
177
|
+
ok: false,
|
|
178
|
+
reason: "empty",
|
|
179
|
+
message: `target_unresolved: initData.${path} is not a non-empty agent id`
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
ok: true,
|
|
184
|
+
agentId: value3.trim(),
|
|
185
|
+
templated: true
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
__name(renderWorkflowJobTarget, "renderWorkflowJobTarget");
|
|
189
|
+
__name2(renderWorkflowJobTarget, "renderWorkflowJobTarget");
|
|
82
190
|
|
|
83
191
|
// src/types/workflow.ts
|
|
84
192
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
@@ -5161,6 +5269,17 @@ function sortVerdictReasons(reasons) {
|
|
|
5161
5269
|
}
|
|
5162
5270
|
__name(sortVerdictReasons, "sortVerdictReasons");
|
|
5163
5271
|
__name3(sortVerdictReasons, "sortVerdictReasons");
|
|
5272
|
+
var ENV_TEMPLATE_SECRET_KEY_RE = /(SECRET|TOKEN|KEY|PASSWORD)$/;
|
|
5273
|
+
function envTemplatePlaceholder(key) {
|
|
5274
|
+
if (ENV_TEMPLATE_SECRET_KEY_RE.test(key)) {
|
|
5275
|
+
throw new Error(`env-template-secret-key: \`${key}\` looks like a secret \u2014 read it with env('${key}') inside execute instead`);
|
|
5276
|
+
}
|
|
5277
|
+
return {
|
|
5278
|
+
__envRef: key
|
|
5279
|
+
};
|
|
5280
|
+
}
|
|
5281
|
+
__name(envTemplatePlaceholder, "envTemplatePlaceholder");
|
|
5282
|
+
__name3(envTemplatePlaceholder, "envTemplatePlaceholder");
|
|
5164
5283
|
|
|
5165
5284
|
// ../workflow-graph/dist/index.mjs
|
|
5166
5285
|
import { createHash } from "crypto";
|
|
@@ -5829,6 +5948,17 @@ function liftRenderedApprover(row, rendered) {
|
|
|
5829
5948
|
}
|
|
5830
5949
|
__name(liftRenderedApprover, "liftRenderedApprover");
|
|
5831
5950
|
__name4(liftRenderedApprover, "liftRenderedApprover");
|
|
5951
|
+
function approverUsersOf(users) {
|
|
5952
|
+
if (Array.isArray(users)) {
|
|
5953
|
+
if (users.length === 0 || users.length > APPROVER_SPEC_MAX_USERS) return null;
|
|
5954
|
+
return users.every((m) => typeof m === "string" && m.length > 0 && m.length <= 128) ? users : null;
|
|
5955
|
+
}
|
|
5956
|
+
if (typeof users !== "string") return null;
|
|
5957
|
+
const lifted = liftRenderedApprover("users", users);
|
|
5958
|
+
return lifted && "users" in lifted ? lifted.users : null;
|
|
5959
|
+
}
|
|
5960
|
+
__name(approverUsersOf, "approverUsersOf");
|
|
5961
|
+
__name4(approverUsersOf, "approverUsersOf");
|
|
5832
5962
|
var WORKSPACE_TEMPLATE_EXPR_RE = /^\$\{\s*(?:initData|input)\.([^}]+?)\s*\}$/;
|
|
5833
5963
|
function workspaceTemplatePath(template22) {
|
|
5834
5964
|
const key = template22.trim();
|
|
@@ -6395,8 +6525,13 @@ function validateLuaExtensions(g, caps = WORKFLOW_CAPS_DEFAULT, opts = {
|
|
|
6395
6525
|
}
|
|
6396
6526
|
const plugins = node.plugins;
|
|
6397
6527
|
const target = node.target;
|
|
6528
|
+
const luaApi = node.luaApi;
|
|
6529
|
+
if (luaApi !== void 0) {
|
|
6530
|
+
const problem = workflowJobLuaApiProblem(luaApi, node.type === "step" ? "code" : node.type, isJobTier(node) ? "job" : node.tier);
|
|
6531
|
+
if (problem) err("lua-api-invalid", problem, `${path}.luaApi`, id2);
|
|
6532
|
+
}
|
|
6398
6533
|
if (target !== void 0) {
|
|
6399
|
-
const problem = workflowJobTargetProblem(target, plugins);
|
|
6534
|
+
const problem = workflowJobTargetProblem(target, plugins, luaApi);
|
|
6400
6535
|
if (problem) err("target-invalid", problem, `${path}.target`, id2);
|
|
6401
6536
|
}
|
|
6402
6537
|
if (plugins !== void 0) {
|
|
@@ -9729,7 +9864,9 @@ function stepNodeOf(s) {
|
|
|
9729
9864
|
tier,
|
|
9730
9865
|
workspace: s.workspace,
|
|
9731
9866
|
jobResources: s.jobResources,
|
|
9732
|
-
jobTools: s.jobTools
|
|
9867
|
+
jobTools: s.jobTools,
|
|
9868
|
+
luaApi: s.luaApi,
|
|
9869
|
+
target: s.target
|
|
9733
9870
|
});
|
|
9734
9871
|
}
|
|
9735
9872
|
__name(stepNodeOf, "stepNodeOf");
|
|
@@ -9814,6 +9951,14 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
9814
9951
|
const tier = s.tier ?? (s.workspace ? "job" : void 0);
|
|
9815
9952
|
if (s.workspace && s.tier !== void 0 && s.tier !== "job") throw new LuaWorkflowBuildError("workspace-requires-job-tier", `"${s.id}": a step mounting a workspace must be tier:'job'`);
|
|
9816
9953
|
if (s.jobTools && tier !== "job") throw new LuaWorkflowBuildError("cap-exceeded", `"${s.id}": jobTools require tier:'job' (job-tools-require-job-tier)`);
|
|
9954
|
+
if (s.luaApi !== void 0) {
|
|
9955
|
+
const problem = workflowJobLuaApiProblem(s.luaApi, "code", tier);
|
|
9956
|
+
if (problem) throw new LuaWorkflowBuildError("lua-api-invalid", `"${s.id}": ${problem}`);
|
|
9957
|
+
}
|
|
9958
|
+
if (s.target !== void 0) {
|
|
9959
|
+
const problem = workflowJobTargetProblem(s.target, void 0, s.luaApi);
|
|
9960
|
+
if (problem) throw new LuaWorkflowBuildError("target-invalid", `"${s.id}": ${problem}`);
|
|
9961
|
+
}
|
|
9817
9962
|
assertTimeout({
|
|
9818
9963
|
id: s.id,
|
|
9819
9964
|
timeoutSeconds: s.timeoutSeconds,
|
|
@@ -10070,7 +10215,7 @@ var WorkflowBuilderImpl = class WorkflowBuilderImpl2 {
|
|
|
10070
10215
|
}
|
|
10071
10216
|
if (opts.target !== void 0) {
|
|
10072
10217
|
const problem = workflowJobTargetProblem(opts.target, opts.plugins);
|
|
10073
|
-
if (problem) throw new LuaWorkflowBuildError("
|
|
10218
|
+
if (problem) throw new LuaWorkflowBuildError("target-invalid", `"${id2}": ${problem}`);
|
|
10074
10219
|
}
|
|
10075
10220
|
assertTimeout({
|
|
10076
10221
|
id: id2,
|