@agimon-ai/po-workflow 0.0.0-alpha.30 → 0.0.0-alpha.32
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/README.md +1 -1
- package/dist/{RecoverWorkflowService-BAVHSWqr.cjs → RecoverWorkflowService-BLehH1qi.cjs} +84 -115
- package/dist/RecoverWorkflowService-BLehH1qi.cjs.map +1 -0
- package/dist/{RecoverWorkflowService-Xo-OZAJ4.mjs → RecoverWorkflowService-BOCa93OS.mjs} +65 -90
- package/dist/RecoverWorkflowService-BOCa93OS.mjs.map +1 -0
- package/dist/cli.cjs +68 -21
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +66 -19
- package/dist/cli.mjs.map +1 -1
- package/dist/extensions/native.mjs +209 -183
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +8 -4
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +9 -5
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +3 -0
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/workflowCommandTemplate-r57z3b46.mjs +79 -0
- package/dist/workflowCommandTemplate-r57z3b46.mjs.map +1 -0
- package/dist/workflowCommandTemplate-w6rOCJpw.cjs +102 -0
- package/dist/workflowCommandTemplate-w6rOCJpw.cjs.map +1 -0
- package/package.json +9 -9
- package/src/prompts/po-author-workflow/SKILL.md +2 -0
- package/src/types/webWorkflows.ts +2 -0
- package/dist/RecoverWorkflowService-BAVHSWqr.cjs.map +0 -1
- package/dist/RecoverWorkflowService-Xo-OZAJ4.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -152,6 +152,6 @@ Business Source License 1.1: free for personal use, organisations under USD 1M r
|
|
|
152
152
|
|
|
153
153
|
Agent steps require an effective `runConfig.majorMode`; delegated workflows require top-level `runConfig.majorMode` before their owner child is created. Selection projects major mode, minor modes, profile and domains, adding the workflow minor mode once. `subagentModel` and `subagentThinking` set Team preferences independently of the step model.
|
|
154
154
|
|
|
155
|
-
The native host requires execution-state inspection before creating agent steps. After settlement it waits for idle, no pending messages and a known background snapshot without core holds or holding-provider errors before checking decisions. Unknown ownership waits closed without consuming reminders; stops interrupt reads and retry delays.
|
|
155
|
+
The native host requires execution-state inspection before creating agent steps. After settlement it waits for idle, no pending messages and a known background snapshot without core holds or holding-provider errors before checking decisions. Unknown ownership waits closed without consuming reminders; stops interrupt reads and retry delays. Running commands stop holding an inline step after five idle minutes, but its decision gate still runs before session release.
|
|
156
156
|
|
|
157
157
|
Delegated successes are informational. Errors wake the workflow owner through durable custom-message admission; the launcher gets an error notification, not an agent-waking failure completion. Diagnosis stays local. Recovery, pause, resume and stop are request-driven. User-requested stops do not trigger diagnosis or automatic restart.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
2
|
+
const require_workflowCommandTemplate = require("./workflowCommandTemplate-w6rOCJpw.cjs");
|
|
2
3
|
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
3
4
|
let zod = require("zod");
|
|
4
5
|
let node_path = require("node:path");
|
|
5
6
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
7
|
let js_yaml = require("js-yaml");
|
|
7
|
-
let liquidjs = require("liquidjs");
|
|
8
8
|
let node_child_process = require("node:child_process");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
10
10
|
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
@@ -320,12 +320,16 @@ const RunnerSchema = zod.z.object({ runConfig: RunConfigSchema.optional().descri
|
|
|
320
320
|
/**
|
|
321
321
|
* A command a step can run through, as a Liquid template rendered into its
|
|
322
322
|
* shell command. `inProcess` tells a host that runs agent sessions itself that
|
|
323
|
-
* it may run the step in-process from the structured values instead
|
|
323
|
+
* it may run the step in-process from the structured values instead; such a
|
|
324
|
+
* command may leave out `run`, and then no other host can run it.
|
|
324
325
|
*/
|
|
325
326
|
const CommandTemplateSchema = zod.z.union([zod.z.string().min(1), zod.z.object({
|
|
326
|
-
run: zod.z.string().min(1).describe("Liquid template rendered into the shell command."),
|
|
327
|
+
run: zod.z.string().min(1).optional().describe("Liquid template rendered into the shell command. An inProcess command may leave it out."),
|
|
327
328
|
inProcess: zod.z.boolean().optional().describe("A host that runs agent sessions may run this command in-process instead of the shell.")
|
|
328
|
-
}).strict()
|
|
329
|
+
}).strict().refine((command) => command.run !== void 0 || command.inProcess === true, {
|
|
330
|
+
message: "A command without run must set inProcess: true.",
|
|
331
|
+
path: ["run"]
|
|
332
|
+
})]);
|
|
329
333
|
const ChoiceSettingsSchema = zod.z.object({
|
|
330
334
|
model: zod.z.string().min(1).optional(),
|
|
331
335
|
thinking: zod.z.string().min(1).optional(),
|
|
@@ -866,65 +870,6 @@ async function workflowShellOutput(runtime, command, options = {}) {
|
|
|
866
870
|
return output;
|
|
867
871
|
}
|
|
868
872
|
//#endregion
|
|
869
|
-
//#region src/services/workflowShell/index.ts
|
|
870
|
-
/**
|
|
871
|
-
* Shell-quoting helpers for safely interpolating values into shell command strings.
|
|
872
|
-
*
|
|
873
|
-
* DESIGN PATTERNS:
|
|
874
|
-
* - Pure functions with no side effects
|
|
875
|
-
* - Context-aware escaping driven by the surrounding quote character
|
|
876
|
-
*
|
|
877
|
-
* AVOID:
|
|
878
|
-
* - String.prototype.replace with a value as the replacement string: its replacement
|
|
879
|
-
* patterns ($&, $1, $$, ...) would corrupt any value containing `$`. Build the result
|
|
880
|
-
* with slice/concat or a function replacer instead.
|
|
881
|
-
*/
|
|
882
|
-
/**
|
|
883
|
-
* Escape a string for safe use as a single-quoted shell argument.
|
|
884
|
-
*
|
|
885
|
-
* Wraps the value in single quotes and neutralises embedded single quotes via the
|
|
886
|
-
* quote-break-escape-requote pattern (`'\''`).
|
|
887
|
-
*/
|
|
888
|
-
function escapeShellArg(value) {
|
|
889
|
-
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Escape a value for safe insertion inside a double-quoted shell string (`"..."`).
|
|
893
|
-
*
|
|
894
|
-
* Inside double quotes only `\`, `$`, `` ` `` and `"` retain special meaning, so each is
|
|
895
|
-
* backslash-escaped in a single pass. A function replacer is used so a `$` in the value is
|
|
896
|
-
* never interpreted as a replacement pattern.
|
|
897
|
-
*/
|
|
898
|
-
function escapeForDoubleQuotes(value) {
|
|
899
|
-
return value.replace(/[\\$`"]/g, (char) => `\\${char}`);
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* Replace every occurrence of `placeholder` in `template` with `value`, escaping the value
|
|
903
|
-
* for the shell-quoting context of the character immediately preceding the placeholder:
|
|
904
|
-
*
|
|
905
|
-
* - preceded by `"` -> escape for a double-quoted slot (`\ $ ` ` " `)
|
|
906
|
-
* - preceded by `'` -> escape embedded single quotes (the template supplies the surrounding quotes)
|
|
907
|
-
* - otherwise (bare) -> wrap the value as a single safe single-quoted token
|
|
908
|
-
*
|
|
909
|
-
* The result is assembled with slice/concat so `value` is never treated as a
|
|
910
|
-
* String.prototype.replace replacement pattern.
|
|
911
|
-
*/
|
|
912
|
-
function substituteShellPlaceholder(template, placeholder, value) {
|
|
913
|
-
let result = "";
|
|
914
|
-
let searchFrom = 0;
|
|
915
|
-
for (;;) {
|
|
916
|
-
const index = template.indexOf(placeholder, searchFrom);
|
|
917
|
-
if (index === -1) return result + template.slice(searchFrom);
|
|
918
|
-
result += template.slice(searchFrom, index) + escapeForPrecedingQuote(value, template[index - 1]);
|
|
919
|
-
searchFrom = index + placeholder.length;
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
function escapeForPrecedingQuote(value, precedingChar) {
|
|
923
|
-
if (precedingChar === "\"") return escapeForDoubleQuotes(value);
|
|
924
|
-
if (precedingChar === "'") return value.replace(/'/g, "'\\''");
|
|
925
|
-
return escapeShellArg(value);
|
|
926
|
-
}
|
|
927
|
-
//#endregion
|
|
928
873
|
//#region src/services/WorkflowParserService/index.ts
|
|
929
874
|
/**
|
|
930
875
|
* WorkflowParserService
|
|
@@ -951,17 +896,9 @@ const CHOICE_SETTING_KEYS = new Set(Object.keys(ChoiceSettingsSchema.shape));
|
|
|
951
896
|
const UNQUOTED_PROMPT_PATTERN = /\{\{-?\s*(prompt|systemPrompt)\s*-?\}\}/;
|
|
952
897
|
const LEGACY_INTERPOLATION_MARKER = "${{";
|
|
953
898
|
/**
|
|
954
|
-
*
|
|
955
|
-
*
|
|
956
|
-
* `default`, so optional values such as the system prompt can be tested.
|
|
899
|
+
* A declared command's template and host options, whichever form it was written
|
|
900
|
+
* in. `run` is undefined for an in-process command with no shell form.
|
|
957
901
|
*/
|
|
958
|
-
const commandTemplates = new liquidjs.Liquid({
|
|
959
|
-
strictVariables: true,
|
|
960
|
-
strictFilters: true,
|
|
961
|
-
lenientIf: true
|
|
962
|
-
});
|
|
963
|
-
commandTemplates.registerFilter("shell", (value) => escapeShellArg(Array.isArray(value) ? value.join(",") : String(value ?? "")));
|
|
964
|
-
/** A declared command's template and host options, whichever form it was written in. */
|
|
965
902
|
function commandTemplateOf(command) {
|
|
966
903
|
return typeof command === "string" ? {
|
|
967
904
|
run: command,
|
|
@@ -1082,6 +1019,22 @@ var WorkflowParserService = class {
|
|
|
1082
1019
|
return parsed;
|
|
1083
1020
|
}
|
|
1084
1021
|
/**
|
|
1022
|
+
* Read and import-merge a partial workflow definition without concrete schema
|
|
1023
|
+
* validation or extends resolution. This is intentionally for inspection only.
|
|
1024
|
+
*/
|
|
1025
|
+
async parseWorkflowTemplateFile(workflowPath) {
|
|
1026
|
+
const resolved = (0, node_path.resolve)(this.runtime.cwd, workflowPath);
|
|
1027
|
+
if (!await (0, _agimon_ai_po_core_platform.pathExists)(this.runtime.fs, resolved, this.runtime.ioContext)) throw new Error(`Workflow file not found: ${resolved}`);
|
|
1028
|
+
const content = (0, _agimon_ai_po_core_platform.getOrThrow)(await this.runtime.fs.readTextFile(resolved, this.runtime.ioContext));
|
|
1029
|
+
const parsed = (0, js_yaml.load)(content);
|
|
1030
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(`Workflow template must be a YAML object: ${resolved}`);
|
|
1031
|
+
const workflow = parsed;
|
|
1032
|
+
workflow.jobs ??= {};
|
|
1033
|
+
if (workflow.imports) await this.resolveImports(workflow, resolved);
|
|
1034
|
+
workflow.jobs ??= {};
|
|
1035
|
+
return workflow;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1085
1038
|
* Render a command template into the shell command a step runs.
|
|
1086
1039
|
*
|
|
1087
1040
|
* Values enter as data and are never rendered again, so `${{ }}` text a
|
|
@@ -1089,15 +1042,15 @@ var WorkflowParserService = class {
|
|
|
1089
1042
|
* is. Use the `shell` filter to quote a value as one shell word.
|
|
1090
1043
|
*/
|
|
1091
1044
|
renderCommandTemplate(template, values) {
|
|
1092
|
-
return
|
|
1045
|
+
return require_workflowCommandTemplate.renderWorkflowCommandTemplate(template, values);
|
|
1093
1046
|
}
|
|
1094
1047
|
/** The top-level values a command template reads. */
|
|
1095
1048
|
templateVariables(template) {
|
|
1096
|
-
return
|
|
1049
|
+
return require_workflowCommandTemplate.workflowCommandTemplateVariables(template);
|
|
1097
1050
|
}
|
|
1098
1051
|
/** Whether a template passes the system prompt itself; when not, it is folded into the prompt. */
|
|
1099
1052
|
templateUsesSystemPrompt(template) {
|
|
1100
|
-
return
|
|
1053
|
+
return require_workflowCommandTemplate.workflowCommandTemplateVariables(template).includes(SYSTEM_PROMPT_VARIABLE);
|
|
1101
1054
|
}
|
|
1102
1055
|
/**
|
|
1103
1056
|
* Check what the schema cannot see once imports and templates are merged:
|
|
@@ -1112,12 +1065,13 @@ var WorkflowParserService = class {
|
|
|
1112
1065
|
const jobNames = new Set(Object.keys(workflow.jobs));
|
|
1113
1066
|
for (const [name, command] of Object.entries(commands)) {
|
|
1114
1067
|
const { run } = commandTemplateOf(command);
|
|
1068
|
+
if (run === void 0) continue;
|
|
1115
1069
|
if (run.includes(LEGACY_INTERPOLATION_MARKER)) problems.push(`Command "${name}" uses \${{ }}; command templates are Liquid, use {{ }} instead.`);
|
|
1116
1070
|
if (UNQUOTED_PROMPT_PATTERN.test(run)) problems.push(`Command "${name}" prints a prompt unquoted; write {{ prompt | shell }}.`);
|
|
1117
1071
|
try {
|
|
1118
|
-
if (!
|
|
1072
|
+
if (!require_workflowCommandTemplate.workflowCommandTemplateVariables(run).includes(PROMPT_VARIABLE)) problems.push(`Command "${name}" never passes {{ prompt | shell }} to the agent.`);
|
|
1119
1073
|
} catch (error) {
|
|
1120
|
-
problems.push(`Command "${name}" is not a valid Liquid template: ${error.message}`);
|
|
1074
|
+
problems.push(`Command "${name}" is not a valid Liquid template: ${error instanceof Error ? error.message : String(error)}`);
|
|
1121
1075
|
}
|
|
1122
1076
|
}
|
|
1123
1077
|
for (const [name, choice] of Object.entries(choices)) for (const key of Object.keys(choice)) if (!CHOICE_SETTING_KEYS.has(key) && !(key in commands)) problems.push(`Choice "${name}" overrides "${key}", which is not a declared command.`);
|
|
@@ -1534,7 +1488,9 @@ async function diagnoseWorkflow(workflowPath, options) {
|
|
|
1534
1488
|
const hostKeys = options.runConfigKeys === void 0 ? void 0 : new Set(options.runConfigKeys);
|
|
1535
1489
|
const reads = (command) => {
|
|
1536
1490
|
const declared = workflow.commands?.[command];
|
|
1537
|
-
|
|
1491
|
+
if (declared === void 0) return void 0;
|
|
1492
|
+
const { run } = commandTemplateOf(declared);
|
|
1493
|
+
return new Set(run === void 0 ? [] : parser.templateVariables(run));
|
|
1538
1494
|
};
|
|
1539
1495
|
const unknownKeys = (keys, known) => [...new Set(keys)].filter((key) => !known.has(key));
|
|
1540
1496
|
for (const { step, location } of collectSteps(workflow)) {
|
|
@@ -5903,7 +5859,7 @@ var BackgroundServiceManager = class {
|
|
|
5903
5859
|
while (Date.now() - start < timeout) {
|
|
5904
5860
|
if (shouldAbort?.()) return false;
|
|
5905
5861
|
try {
|
|
5906
|
-
await workflowShellOutput(this.runtime, `/bin/zsh -c ${escapeShellArg(checkCmd)}`, {
|
|
5862
|
+
await workflowShellOutput(this.runtime, `/bin/zsh -c ${require_workflowCommandTemplate.escapeShellArg(checkCmd)}`, {
|
|
5907
5863
|
cwd: workDir,
|
|
5908
5864
|
environment: readyEnv,
|
|
5909
5865
|
timeoutMs: 5e3
|
|
@@ -6663,6 +6619,7 @@ const RUN_KEY = "run";
|
|
|
6663
6619
|
const INTERACTIVE_RUN_KEY = "interactiveRun";
|
|
6664
6620
|
const CUSTOM_RUN_KEY = "customRun";
|
|
6665
6621
|
const CUSTOM_RUN_UNSUPPORTED_MESSAGE = "customRun needs a host step executor and no run or interactiveRun fallback exists for step";
|
|
6622
|
+
const IN_PROCESS_ONLY_UNSUPPORTED_MESSAGE = "has no run template, and this host cannot run it in-process";
|
|
6666
6623
|
const WORKFLOW_RUN_CONFIG_ENV_KEY = "WORKFLOW_RUN_CONFIG";
|
|
6667
6624
|
const DEFAULT_CHOICE = "default";
|
|
6668
6625
|
const OUTPUT_TAIL_LINES = 50;
|
|
@@ -6972,7 +6929,7 @@ var StepRunnerService = class StepRunnerService {
|
|
|
6972
6929
|
this.logger.error(` ${RED$2}${STATUS_FAIL}${RESET$3} ${stepName}\n`);
|
|
6973
6930
|
return false;
|
|
6974
6931
|
}
|
|
6975
|
-
const { command, custom, interactive, template } = resolvedStepCommand;
|
|
6932
|
+
const { command, custom, inProcessOnly, interactive, template } = resolvedStepCommand;
|
|
6976
6933
|
const isCodexCommand = this.quotaService.isCodexCommand(command, resolvedStepCommand.agentKey);
|
|
6977
6934
|
const shouldContinue = step["continue-on-error"] || options.continueOnError;
|
|
6978
6935
|
let timeoutMs;
|
|
@@ -7120,6 +7077,7 @@ var StepRunnerService = class StepRunnerService {
|
|
|
7120
7077
|
}, (trace) => this.startStepExecution({
|
|
7121
7078
|
traceparent: trace?.traceparent,
|
|
7122
7079
|
command,
|
|
7080
|
+
inProcessOnly: inProcessOnly === true,
|
|
7123
7081
|
custom,
|
|
7124
7082
|
interactive,
|
|
7125
7083
|
onExecutionStarted: options.onExecutionStarted,
|
|
@@ -7547,7 +7505,7 @@ var StepRunnerService = class StepRunnerService {
|
|
|
7547
7505
|
* Start a step through the host executor when it offers one, else spawn it.
|
|
7548
7506
|
*/
|
|
7549
7507
|
startStepExecution(request) {
|
|
7550
|
-
const { command, custom, interactive, stepEnv, stepName, template, timeoutMs, workDir } = request;
|
|
7508
|
+
const { command, custom, inProcessOnly, interactive, stepEnv, stepName, template, timeoutMs, workDir } = request;
|
|
7551
7509
|
const executor = this.stepExecutor;
|
|
7552
7510
|
const base = {
|
|
7553
7511
|
traceparent: request.traceparent,
|
|
@@ -7566,8 +7524,21 @@ var StepRunnerService = class StepRunnerService {
|
|
|
7566
7524
|
...base,
|
|
7567
7525
|
customRun: custom
|
|
7568
7526
|
}), stepName, workDir, command, timeoutMs, request.onExecutionStarted);
|
|
7569
|
-
const executionCommand = interactive ? this.withInteractiveTerminalTitle(command, stepEnv) : command;
|
|
7570
7527
|
const executeCommand = executor?.command?.bind(executor);
|
|
7528
|
+
if (inProcessOnly) {
|
|
7529
|
+
const notInProcess = () => Promise.resolve({
|
|
7530
|
+
status: RESULT_STATUS_COMPLETED,
|
|
7531
|
+
exitCode: UNKNOWN_EXIT_CODE,
|
|
7532
|
+
failure: `command "${template?.name}" ${IN_PROCESS_ONLY_UNSUPPORTED_MESSAGE}`
|
|
7533
|
+
});
|
|
7534
|
+
if (!executeCommand) return notInProcess();
|
|
7535
|
+
return this.executeExternal(() => executeCommand.call(executor, {
|
|
7536
|
+
...base,
|
|
7537
|
+
interactive,
|
|
7538
|
+
...template === void 0 ? {} : { template }
|
|
7539
|
+
}), stepName, workDir, command, timeoutMs, request.onExecutionStarted, notInProcess);
|
|
7540
|
+
}
|
|
7541
|
+
const executionCommand = interactive ? this.withInteractiveTerminalTitle(command, stepEnv) : command;
|
|
7571
7542
|
const spawnHere = () => interactive ? this.withTerminal(() => this.interruptedSignal ? Promise.resolve({
|
|
7572
7543
|
status: RESULT_STATUS_SIGNALED,
|
|
7573
7544
|
signal: this.interruptedSignal
|
|
@@ -7850,7 +7821,7 @@ var StepRunnerService = class StepRunnerService {
|
|
|
7850
7821
|
const systemPromptSource = entry.systemPrompt ?? step.systemPrompt;
|
|
7851
7822
|
const systemPrompt = [systemPromptSource === void 0 ? void 0 : this.parser.interpolate(systemPromptSource, promptContext), this.decisionInstructions(context, decisionFile)].filter((part) => part !== void 0 && part.length > 0).join("\n\n") || void 0;
|
|
7852
7823
|
const { run, inProcess } = commandTemplateOf(declared);
|
|
7853
|
-
const passesSystemPrompt = this.parser.templateUsesSystemPrompt(run);
|
|
7824
|
+
const passesSystemPrompt = run !== void 0 && this.parser.templateUsesSystemPrompt(run);
|
|
7854
7825
|
const values = {
|
|
7855
7826
|
...runConfig,
|
|
7856
7827
|
command: entry.command,
|
|
@@ -7858,8 +7829,8 @@ var StepRunnerService = class StepRunnerService {
|
|
|
7858
7829
|
...choiceName === void 0 ? {} : { choice: choiceName },
|
|
7859
7830
|
...systemPrompt === void 0 || !passesSystemPrompt ? {} : { systemPrompt }
|
|
7860
7831
|
};
|
|
7861
|
-
let command
|
|
7862
|
-
try {
|
|
7832
|
+
let command = `${entry.command}: ${prompt.split(COMMAND_LINE_BREAK)[0]}`;
|
|
7833
|
+
if (run !== void 0) try {
|
|
7863
7834
|
command = this.parser.renderCommandTemplate(run, values);
|
|
7864
7835
|
} catch (error) {
|
|
7865
7836
|
return failed(`command "${entry.command}" did not render: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -7867,6 +7838,7 @@ var StepRunnerService = class StepRunnerService {
|
|
|
7867
7838
|
return {
|
|
7868
7839
|
agentKey: entry.command,
|
|
7869
7840
|
command,
|
|
7841
|
+
...run === void 0 ? { inProcessOnly: true } : {},
|
|
7870
7842
|
interactive: true,
|
|
7871
7843
|
runConfig,
|
|
7872
7844
|
template: {
|
|
@@ -7875,7 +7847,8 @@ var StepRunnerService = class StepRunnerService {
|
|
|
7875
7847
|
prompt,
|
|
7876
7848
|
reads: [...new Set(offered.flatMap((candidate) => {
|
|
7877
7849
|
const offeredTemplate = selection.commands?.[candidate.command];
|
|
7878
|
-
|
|
7850
|
+
const offeredRun = offeredTemplate === void 0 ? void 0 : commandTemplateOf(offeredTemplate).run;
|
|
7851
|
+
return offeredRun === void 0 ? [] : this.parser.templateVariables(offeredRun);
|
|
7879
7852
|
}))],
|
|
7880
7853
|
...choiceName === void 0 ? {} : { choice: choiceName },
|
|
7881
7854
|
...systemPrompt === void 0 ? {} : { systemPrompt }
|
|
@@ -9889,7 +9862,8 @@ var RunWorkflowService = class {
|
|
|
9889
9862
|
const innerCommand = await this.createLaunchScriptCommand(input, workflowPath, workflow);
|
|
9890
9863
|
const launchBaseName = input.name || workflow.name || (0, node_path.basename)(workflowPath);
|
|
9891
9864
|
const launchDisplayName = input.name ? launchBaseName : `${launchBaseName}-${this.parser.generateHumanReadableId()}`;
|
|
9892
|
-
const
|
|
9865
|
+
const namedLaunchCommand = require_workflowCommandTemplate.substituteShellPlaceholder(launchCommand, LAUNCH_NAME_PLACEHOLDER, launchDisplayName);
|
|
9866
|
+
const shell = require_workflowCommandTemplate.substituteShellPlaceholder(namedLaunchCommand, LAUNCH_COMMAND_PLACEHOLDER, innerCommand);
|
|
9893
9867
|
this.logger.info(`${DIM}Delegating via launch-command: ${shell}${RESET}`);
|
|
9894
9868
|
delegated = true;
|
|
9895
9869
|
const launched = await this.spawnLaunchCommand(shell, {
|
|
@@ -10795,7 +10769,7 @@ var RunWorkflowService = class {
|
|
|
10795
10769
|
const launcher = (0, node_path.resolve)(binDir, STEP_CLI_NAME);
|
|
10796
10770
|
const runAsNode = this.runtime.workflowHost.isElectron ? "ELECTRON_RUN_AS_NODE=1 " : "";
|
|
10797
10771
|
(0, _agimon_ai_po_core_platform.getOrThrow)(await this.runtime.fs.createDir(binDir, { recursive: true }, this.runtime.ioContext));
|
|
10798
|
-
(0, _agimon_ai_po_core_platform.getOrThrow)(await this.runtime.fs.writeFile(launcher, `#!/bin/sh\n${runAsNode}exec ${escapeShellArg(this.runtime.workflowHost.executablePath)} ${escapeShellArg(cliPath)} "$@"\n`, this.runtime.ioContext));
|
|
10772
|
+
(0, _agimon_ai_po_core_platform.getOrThrow)(await this.runtime.fs.writeFile(launcher, `#!/bin/sh\n${runAsNode}exec ${require_workflowCommandTemplate.escapeShellArg(this.runtime.workflowHost.executablePath)} ${require_workflowCommandTemplate.escapeShellArg(cliPath)} "$@"\n`, this.runtime.ioContext));
|
|
10799
10773
|
await this.runtime.workflowHost.setMode(launcher, 493);
|
|
10800
10774
|
workflowEnv.PATH = `${binDir}:${workflowEnv.PATH ?? this.runtime.baseEnvironment.PATH ?? ""}`;
|
|
10801
10775
|
}
|
|
@@ -10835,17 +10809,17 @@ var RunWorkflowService = class {
|
|
|
10835
10809
|
""
|
|
10836
10810
|
].join("\n");
|
|
10837
10811
|
await this.runtime.workflowHost.writeExclusive(scriptPath, script);
|
|
10838
|
-
return `sh ${escapeShellArg(scriptPath)}`;
|
|
10812
|
+
return `sh ${require_workflowCommandTemplate.escapeShellArg(scriptPath)}`;
|
|
10839
10813
|
}
|
|
10840
10814
|
async buildLauncherOriginExports() {
|
|
10841
10815
|
const exports = [];
|
|
10842
|
-
if (this.runtime.baseEnvironment[CMUX_WORKSPACE_ID_ENV]) exports.push(`export ${WORKFLOW_LAUNCHER_ORIGIN_WORKSPACE_ID_ENV}=${escapeShellArg(this.runtime.baseEnvironment[CMUX_WORKSPACE_ID_ENV])}`);
|
|
10843
|
-
if (this.runtime.baseEnvironment[CMUX_SURFACE_ID_ENV]) exports.push(`export ${WORKFLOW_LAUNCHER_ORIGIN_SURFACE_ID_ENV}=${escapeShellArg(this.runtime.baseEnvironment[CMUX_SURFACE_ID_ENV])}`);
|
|
10816
|
+
if (this.runtime.baseEnvironment[CMUX_WORKSPACE_ID_ENV]) exports.push(`export ${WORKFLOW_LAUNCHER_ORIGIN_WORKSPACE_ID_ENV}=${require_workflowCommandTemplate.escapeShellArg(this.runtime.baseEnvironment[CMUX_WORKSPACE_ID_ENV])}`);
|
|
10817
|
+
if (this.runtime.baseEnvironment[CMUX_SURFACE_ID_ENV]) exports.push(`export ${WORKFLOW_LAUNCHER_ORIGIN_SURFACE_ID_ENV}=${require_workflowCommandTemplate.escapeShellArg(this.runtime.baseEnvironment[CMUX_SURFACE_ID_ENV])}`);
|
|
10844
10818
|
const paneId = this.runtime.baseEnvironment[TMUX_PANE_ENV];
|
|
10845
10819
|
if (paneId) {
|
|
10846
|
-
exports.push(`export ${WORKFLOW_LAUNCHER_ORIGIN_PANE_ID_ENV}=${escapeShellArg(paneId)}`);
|
|
10820
|
+
exports.push(`export ${WORKFLOW_LAUNCHER_ORIGIN_PANE_ID_ENV}=${require_workflowCommandTemplate.escapeShellArg(paneId)}`);
|
|
10847
10821
|
const identity = await this.readTmuxIdentity(paneId);
|
|
10848
|
-
if (identity?.sessionId) exports.push(`export ${WORKFLOW_LAUNCHER_ORIGIN_SESSION_ID_ENV}=${escapeShellArg(identity.sessionId)}`);
|
|
10822
|
+
if (identity?.sessionId) exports.push(`export ${WORKFLOW_LAUNCHER_ORIGIN_SESSION_ID_ENV}=${require_workflowCommandTemplate.escapeShellArg(identity.sessionId)}`);
|
|
10849
10823
|
}
|
|
10850
10824
|
return exports;
|
|
10851
10825
|
}
|
|
@@ -10883,7 +10857,7 @@ var RunWorkflowService = class {
|
|
|
10883
10857
|
}
|
|
10884
10858
|
async readTmuxIdentity(paneId) {
|
|
10885
10859
|
try {
|
|
10886
|
-
const [sessionId, sessionName, windowId, resolvedPaneId] = (await workflowShellOutput(this.runtime, `tmux display-message -p -t ${escapeShellArg(paneId)} ${escapeShellArg("#{session_id} #{session_name} #{window_id} #{pane_id}")}`)).trim().split(" ");
|
|
10860
|
+
const [sessionId, sessionName, windowId, resolvedPaneId] = (await workflowShellOutput(this.runtime, `tmux display-message -p -t ${require_workflowCommandTemplate.escapeShellArg(paneId)} ${require_workflowCommandTemplate.escapeShellArg("#{session_id} #{session_name} #{window_id} #{pane_id}")}`)).trim().split(" ");
|
|
10887
10861
|
if (!sessionId || !sessionName || !windowId || !resolvedPaneId) return void 0;
|
|
10888
10862
|
return {
|
|
10889
10863
|
paneId: resolvedPaneId,
|
|
@@ -10901,28 +10875,29 @@ var RunWorkflowService = class {
|
|
|
10901
10875
|
* adding --skip-launch to prevent infinite recursion.
|
|
10902
10876
|
*/
|
|
10903
10877
|
buildLaunchCliCommand(input, workflowPath, workflow) {
|
|
10878
|
+
const cliPath = this.resolveCliPath();
|
|
10904
10879
|
const parts = [
|
|
10905
10880
|
"node",
|
|
10906
|
-
escapeShellArg(
|
|
10881
|
+
require_workflowCommandTemplate.escapeShellArg(cliPath),
|
|
10907
10882
|
"run-workflow",
|
|
10908
|
-
escapeShellArg(workflowPath),
|
|
10883
|
+
require_workflowCommandTemplate.escapeShellArg(workflowPath),
|
|
10909
10884
|
"--skip-launch"
|
|
10910
10885
|
];
|
|
10911
10886
|
const runner = this.resolveRunner(input, workflow);
|
|
10912
|
-
if (input.job) parts.push("--job", escapeShellArg(input.job));
|
|
10913
|
-
if (runner) parts.push("--runner", escapeShellArg(runner));
|
|
10914
|
-
if (input.command) parts.push("--command", escapeShellArg(input.command));
|
|
10915
|
-
if (input.choice) parts.push("--choice", escapeShellArg(input.choice));
|
|
10887
|
+
if (input.job) parts.push("--job", require_workflowCommandTemplate.escapeShellArg(input.job));
|
|
10888
|
+
if (runner) parts.push("--runner", require_workflowCommandTemplate.escapeShellArg(runner));
|
|
10889
|
+
if (input.command) parts.push("--command", require_workflowCommandTemplate.escapeShellArg(input.command));
|
|
10890
|
+
if (input.choice) parts.push("--choice", require_workflowCommandTemplate.escapeShellArg(input.choice));
|
|
10916
10891
|
if (input.dryRun) parts.push("--dry-run");
|
|
10917
10892
|
if (input.continueOnError) parts.push("--continue-on-error");
|
|
10918
10893
|
if (input.keepWorktree) parts.push("--keep-worktree");
|
|
10919
|
-
if (input.prompt) parts.push("--prompt", escapeShellArg(input.prompt));
|
|
10920
|
-
if (input.name) parts.push("--name", escapeShellArg(input.name));
|
|
10921
|
-
if (input.workspace) parts.push("--workspace", escapeShellArg(input.workspace));
|
|
10922
|
-
if (input.secretFile) parts.push("--secret-file", escapeShellArg(input.secretFile));
|
|
10923
|
-
if (input.statusFile) parts.push("--status-file", escapeShellArg(input.statusFile));
|
|
10924
|
-
if (input.inputs) for (const [key, val] of Object.entries(input.inputs)) parts.push("--input", escapeShellArg(`${key}=${val}`));
|
|
10925
|
-
if (input.env) for (const [key, val] of Object.entries(input.env)) parts.push("--env", escapeShellArg(`${key}=${val}`));
|
|
10894
|
+
if (input.prompt) parts.push("--prompt", require_workflowCommandTemplate.escapeShellArg(input.prompt));
|
|
10895
|
+
if (input.name) parts.push("--name", require_workflowCommandTemplate.escapeShellArg(input.name));
|
|
10896
|
+
if (input.workspace) parts.push("--workspace", require_workflowCommandTemplate.escapeShellArg(input.workspace));
|
|
10897
|
+
if (input.secretFile) parts.push("--secret-file", require_workflowCommandTemplate.escapeShellArg(input.secretFile));
|
|
10898
|
+
if (input.statusFile) parts.push("--status-file", require_workflowCommandTemplate.escapeShellArg(input.statusFile));
|
|
10899
|
+
if (input.inputs) for (const [key, val] of Object.entries(input.inputs)) parts.push("--input", require_workflowCommandTemplate.escapeShellArg(`${key}=${val}`));
|
|
10900
|
+
if (input.env) for (const [key, val] of Object.entries(input.env)) parts.push("--env", require_workflowCommandTemplate.escapeShellArg(`${key}=${val}`));
|
|
10926
10901
|
return parts.join(" ");
|
|
10927
10902
|
}
|
|
10928
10903
|
/**
|
|
@@ -11384,12 +11359,6 @@ Object.defineProperty(exports, "diagnoseWorkflows", {
|
|
|
11384
11359
|
return diagnoseWorkflows;
|
|
11385
11360
|
}
|
|
11386
11361
|
});
|
|
11387
|
-
Object.defineProperty(exports, "escapeShellArg", {
|
|
11388
|
-
enumerable: true,
|
|
11389
|
-
get: function() {
|
|
11390
|
-
return escapeShellArg;
|
|
11391
|
-
}
|
|
11392
|
-
});
|
|
11393
11362
|
Object.defineProperty(exports, "formatArtifactWarning", {
|
|
11394
11363
|
enumerable: true,
|
|
11395
11364
|
get: function() {
|
|
@@ -11487,4 +11456,4 @@ Object.defineProperty(exports, "workflowShellOutput", {
|
|
|
11487
11456
|
}
|
|
11488
11457
|
});
|
|
11489
11458
|
|
|
11490
|
-
//# sourceMappingURL=RecoverWorkflowService-
|
|
11459
|
+
//# sourceMappingURL=RecoverWorkflowService-BLehH1qi.cjs.map
|