@agimon-ai/po-workflow 0.0.0-alpha.31 → 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 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.
@@ -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(),
@@ -891,7 +895,10 @@ const CHOICE_SETTING_KEYS = new Set(Object.keys(ChoiceSettingsSchema.shape));
891
895
  /** A prompt printed raw would be split and expanded by the shell, so templates must quote it. */
892
896
  const UNQUOTED_PROMPT_PATTERN = /\{\{-?\s*(prompt|systemPrompt)\s*-?\}\}/;
893
897
  const LEGACY_INTERPOLATION_MARKER = "${{";
894
- /** A declared command's template and host options, whichever form it was written in. */
898
+ /**
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.
901
+ */
895
902
  function commandTemplateOf(command) {
896
903
  return typeof command === "string" ? {
897
904
  run: command,
@@ -1058,6 +1065,7 @@ var WorkflowParserService = class {
1058
1065
  const jobNames = new Set(Object.keys(workflow.jobs));
1059
1066
  for (const [name, command] of Object.entries(commands)) {
1060
1067
  const { run } = commandTemplateOf(command);
1068
+ if (run === void 0) continue;
1061
1069
  if (run.includes(LEGACY_INTERPOLATION_MARKER)) problems.push(`Command "${name}" uses \${{ }}; command templates are Liquid, use {{ }} instead.`);
1062
1070
  if (UNQUOTED_PROMPT_PATTERN.test(run)) problems.push(`Command "${name}" prints a prompt unquoted; write {{ prompt | shell }}.`);
1063
1071
  try {
@@ -1480,7 +1488,9 @@ async function diagnoseWorkflow(workflowPath, options) {
1480
1488
  const hostKeys = options.runConfigKeys === void 0 ? void 0 : new Set(options.runConfigKeys);
1481
1489
  const reads = (command) => {
1482
1490
  const declared = workflow.commands?.[command];
1483
- return declared === void 0 ? void 0 : new Set(parser.templateVariables(commandTemplateOf(declared).run));
1491
+ if (declared === void 0) return void 0;
1492
+ const { run } = commandTemplateOf(declared);
1493
+ return new Set(run === void 0 ? [] : parser.templateVariables(run));
1484
1494
  };
1485
1495
  const unknownKeys = (keys, known) => [...new Set(keys)].filter((key) => !known.has(key));
1486
1496
  for (const { step, location } of collectSteps(workflow)) {
@@ -6609,6 +6619,7 @@ const RUN_KEY = "run";
6609
6619
  const INTERACTIVE_RUN_KEY = "interactiveRun";
6610
6620
  const CUSTOM_RUN_KEY = "customRun";
6611
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";
6612
6623
  const WORKFLOW_RUN_CONFIG_ENV_KEY = "WORKFLOW_RUN_CONFIG";
6613
6624
  const DEFAULT_CHOICE = "default";
6614
6625
  const OUTPUT_TAIL_LINES = 50;
@@ -6918,7 +6929,7 @@ var StepRunnerService = class StepRunnerService {
6918
6929
  this.logger.error(` ${RED$2}${STATUS_FAIL}${RESET$3} ${stepName}\n`);
6919
6930
  return false;
6920
6931
  }
6921
- const { command, custom, interactive, template } = resolvedStepCommand;
6932
+ const { command, custom, inProcessOnly, interactive, template } = resolvedStepCommand;
6922
6933
  const isCodexCommand = this.quotaService.isCodexCommand(command, resolvedStepCommand.agentKey);
6923
6934
  const shouldContinue = step["continue-on-error"] || options.continueOnError;
6924
6935
  let timeoutMs;
@@ -7066,6 +7077,7 @@ var StepRunnerService = class StepRunnerService {
7066
7077
  }, (trace) => this.startStepExecution({
7067
7078
  traceparent: trace?.traceparent,
7068
7079
  command,
7080
+ inProcessOnly: inProcessOnly === true,
7069
7081
  custom,
7070
7082
  interactive,
7071
7083
  onExecutionStarted: options.onExecutionStarted,
@@ -7493,7 +7505,7 @@ var StepRunnerService = class StepRunnerService {
7493
7505
  * Start a step through the host executor when it offers one, else spawn it.
7494
7506
  */
7495
7507
  startStepExecution(request) {
7496
- const { command, custom, interactive, stepEnv, stepName, template, timeoutMs, workDir } = request;
7508
+ const { command, custom, inProcessOnly, interactive, stepEnv, stepName, template, timeoutMs, workDir } = request;
7497
7509
  const executor = this.stepExecutor;
7498
7510
  const base = {
7499
7511
  traceparent: request.traceparent,
@@ -7512,8 +7524,21 @@ var StepRunnerService = class StepRunnerService {
7512
7524
  ...base,
7513
7525
  customRun: custom
7514
7526
  }), stepName, workDir, command, timeoutMs, request.onExecutionStarted);
7515
- const executionCommand = interactive ? this.withInteractiveTerminalTitle(command, stepEnv) : command;
7516
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;
7517
7542
  const spawnHere = () => interactive ? this.withTerminal(() => this.interruptedSignal ? Promise.resolve({
7518
7543
  status: RESULT_STATUS_SIGNALED,
7519
7544
  signal: this.interruptedSignal
@@ -7796,7 +7821,7 @@ var StepRunnerService = class StepRunnerService {
7796
7821
  const systemPromptSource = entry.systemPrompt ?? step.systemPrompt;
7797
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;
7798
7823
  const { run, inProcess } = commandTemplateOf(declared);
7799
- const passesSystemPrompt = this.parser.templateUsesSystemPrompt(run);
7824
+ const passesSystemPrompt = run !== void 0 && this.parser.templateUsesSystemPrompt(run);
7800
7825
  const values = {
7801
7826
  ...runConfig,
7802
7827
  command: entry.command,
@@ -7804,8 +7829,8 @@ var StepRunnerService = class StepRunnerService {
7804
7829
  ...choiceName === void 0 ? {} : { choice: choiceName },
7805
7830
  ...systemPrompt === void 0 || !passesSystemPrompt ? {} : { systemPrompt }
7806
7831
  };
7807
- let command;
7808
- try {
7832
+ let command = `${entry.command}: ${prompt.split(COMMAND_LINE_BREAK)[0]}`;
7833
+ if (run !== void 0) try {
7809
7834
  command = this.parser.renderCommandTemplate(run, values);
7810
7835
  } catch (error) {
7811
7836
  return failed(`command "${entry.command}" did not render: ${error instanceof Error ? error.message : String(error)}`);
@@ -7813,6 +7838,7 @@ var StepRunnerService = class StepRunnerService {
7813
7838
  return {
7814
7839
  agentKey: entry.command,
7815
7840
  command,
7841
+ ...run === void 0 ? { inProcessOnly: true } : {},
7816
7842
  interactive: true,
7817
7843
  runConfig,
7818
7844
  template: {
@@ -7821,7 +7847,8 @@ var StepRunnerService = class StepRunnerService {
7821
7847
  prompt,
7822
7848
  reads: [...new Set(offered.flatMap((candidate) => {
7823
7849
  const offeredTemplate = selection.commands?.[candidate.command];
7824
- return offeredTemplate === void 0 ? [] : this.parser.templateVariables(commandTemplateOf(offeredTemplate).run);
7850
+ const offeredRun = offeredTemplate === void 0 ? void 0 : commandTemplateOf(offeredTemplate).run;
7851
+ return offeredRun === void 0 ? [] : this.parser.templateVariables(offeredRun);
7825
7852
  }))],
7826
7853
  ...choiceName === void 0 ? {} : { choice: choiceName },
7827
7854
  ...systemPrompt === void 0 ? {} : { systemPrompt }
@@ -11429,4 +11456,4 @@ Object.defineProperty(exports, "workflowShellOutput", {
11429
11456
  }
11430
11457
  });
11431
11458
 
11432
- //# sourceMappingURL=RecoverWorkflowService-Dt22H-Bk.cjs.map
11459
+ //# sourceMappingURL=RecoverWorkflowService-BLehH1qi.cjs.map