@agimon-ai/po-workflow 0.0.0-alpha.162 → 0.0.0-alpha.163

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
@@ -15,8 +15,8 @@ Workflow files describe job dependencies and host-executed steps, while Po provi
15
15
 
16
16
  ## Install
17
17
 
18
- The seeded `modes.yaml` selects the `workflow` layer in `minimal`, `copilot` and `examples`.
19
- Remove it from a mode to omit Workflow there. No minor-mode activation is required.
18
+ The seeded `presets.yaml` selects the `workflow` layer in `minimal`, `copilot` and `examples`.
19
+ Remove it from a preset to omit Workflow there. No mode activation is required.
20
20
 
21
21
  ## Define a workflow
22
22
 
@@ -42,7 +42,7 @@ jobs:
42
42
  no VM, container, or sandbox. Review workflow files as executable code. Runner-specific
43
43
  `interactiveRun` mappings are available for commands that require a TTY.
44
44
 
45
- A step can also declare `runConfig` (major mode, minor modes, profile, domains, model, thinking)
45
+ A step can also declare `runConfig` (preset, modes, profile, domains, model, thinking)
46
46
  and `customRun` (a prompt). Launched from the Po server, a `customRun` step runs as a child
47
47
  session of the launching session with those settings, until the agent has recorded what the step
48
48
  needs, and `run` and `interactiveRun` steps each get their own RMUX pane. Each run keeps its engine
@@ -56,7 +56,7 @@ Managed Po agent steps can receive a workflow-owned `jobTools` code-mode namespa
56
56
  ```yaml
57
57
  name: summarize
58
58
  runConfig:
59
- majorMode: copilot
59
+ preset: copilot
60
60
  tools: ./tools/shared
61
61
  jobs:
62
62
  report:
@@ -155,12 +155,12 @@ and wait for a completion notification.
155
155
  The package also supplies the `dynamicWorkflow` code-mode namespace: tracked Mastra
156
156
  workflows composed with `then`, `parallel`, `branch` and bounded `foreach`, with live
157
157
  `team.run` transcripts. It is available when the `workflow` layer is selected, with no
158
- minor-mode gate. Inside a YAML run, a `customRun` step's agent can use it
158
+ mode gate. Inside a YAML run, a `customRun` step's agent can use it
159
159
  for fan-out whose shape is only known at run time, and the run view shows those runs under
160
160
  that step. See the [code-mode guide](src/prompts/codemode-how-to-workflow/SKILL.md).
161
161
  Tracker state is in memory per session; it is not persisted with the run record.
162
162
 
163
- Existing default-package entries still work and deduplicate with the layer. No configuration migration runs, and persisted `minorModes: [workflow]` has no effect.
163
+ Existing default-package entries still work and deduplicate with the layer. No configuration migration runs, and persisted `modes: [workflow]` has no effect.
164
164
 
165
165
  ## Storage, concurrency, and lifecycle
166
166
 
@@ -194,7 +194,7 @@ maintenance. A selected tools folder also supplies the managed session's pinned
194
194
  In a server (web cockpit) session, a launch does not run in the session that asked for it. The
195
195
  session creates a child **workflow session** (provenance `workflow-session`), nested under it in the
196
196
  rail, and hands it the launch. The workflow session owns the run (`PO_SESSION_ID`), runs its step
197
- sessions, so its agent can troubleshoot and recover the run without a workflow minor mode. The run's
197
+ sessions, so its agent can troubleshoot and recover the run without a workflow mode. The run's
198
198
  environment also carries `PO_WORKFLOW_LAUNCHER_SESSION_ID`, naming the launching session, which
199
199
  lists the run in its Activity group, is told when it ends, and may read its status.
200
200
 
@@ -213,7 +213,7 @@ lists the run in its Activity group, is told when it ends, and may read its stat
213
213
 
214
214
  ## Native execution contract
215
215
 
216
- 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 unchanged. `subagentModel` and `subagentThinking` set Team preferences independently of the step model.
216
+ Agent steps require an effective `runConfig.preset`; delegated workflows require top-level `runConfig.preset` before their owner child is created. Selection projects preset, modes, profile and domains unchanged. `subagentModel` and `subagentThinking` set Team preferences independently of the step model.
217
217
 
218
218
  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.
219
219
 
@@ -384,7 +384,10 @@ const WorkflowDefinitionSchema = zod.z.object({
384
384
  commands: zod.z.record(zod.z.string(), CommandTemplateSchema).optional().describe("Command templates a templated interactiveRun selects with --command."),
385
385
  choices: zod.z.record(zod.z.string(), ChoiceSchema).optional().describe("Model compositions a launch selects with --choice; \"default\" is used when none is named."),
386
386
  runConfig: RunConfigSchema.optional().describe("Defaults laid under the runConfig of every interactiveRun and customRun step; a step key wins."),
387
- sessionConfig: zod.z.object({ majorMode: zod.z.string().trim().min(1).optional().describe("Major mode of the workflow session that owns the run; steps keep their runConfig.majorMode.") }).strict().optional().describe("Settings for the workflow session a launch creates, not for its step sessions."),
387
+ sessionConfig: zod.z.object({
388
+ majorMode: zod.z.never({ error: "sessionConfig.majorMode was renamed to preset" }).optional(),
389
+ preset: zod.z.string().trim().min(1).optional().describe("Preset of the workflow session that owns the run; steps keep their runConfig.preset.")
390
+ }).strict().optional().describe("Settings for the workflow session a launch creates, not for its step sessions."),
388
391
  imports: zod.z.array(zod.z.string()).optional(),
389
392
  "system-prompt": zod.z.string().optional(),
390
393
  "max-workflows": zod.z.number().int().positive().optional(),
@@ -2612,15 +2615,27 @@ var WorkflowRegistryService = class {
2612
2615
  /** A YAML list, or one comma-separated string, as `--domains a,b` accepts. */
2613
2616
  const nameList = zod.z.union([zod.z.string(), zod.z.array(zod.z.string())]).transform((value) => (Array.isArray(value) ? value : value.split(",")).map((name) => name.trim()).filter((name) => name.length > 0));
2614
2617
  const singleName = zod.z.string().trim().min(1);
2618
+ /** Keys renamed away, by their replacement. */
2619
+ const RENAMED_RUN_CONFIG_KEYS = {
2620
+ majorMode: "preset",
2621
+ minorModes: "modes"
2622
+ };
2623
+ const renamedKey = (key) => zod.z.never({ error: `runConfig.${key} was renamed to ${RENAMED_RUN_CONFIG_KEYS[key]}` }).optional();
2624
+ /** Declared so every variant refuses the renamed keys by name instead of dropping them. */
2625
+ const RETIRED_RUN_CONFIG_KEYS = {
2626
+ majorMode: renamedKey("majorMode"),
2627
+ minorModes: renamedKey("minorModes")
2628
+ };
2615
2629
  /**
2616
2630
  * The Po keys of a workflow step's `runConfig`.
2617
2631
  *
2618
2632
  * The engine treats `runConfig` as an opaque map, so this is where a typo such
2619
- * as `majormode` is caught instead of silently running on workspace defaults.
2633
+ * as `prest` is caught instead of silently running on workspace defaults.
2620
2634
  */
2621
2635
  const poRunConfigSchema = zod.z.object({
2622
- majorMode: singleName.optional().describe("Major mode the step session runs in."),
2623
- minorModes: nameList.optional().describe("Minor modes activated in the step session."),
2636
+ ...RETIRED_RUN_CONFIG_KEYS,
2637
+ preset: singleName.optional().describe("Preset the step session runs in."),
2638
+ modes: nameList.optional().describe("Modes activated in the step session."),
2624
2639
  profile: singleName.nullable().optional().describe("Profile the step session runs as; null runs it with no profile, never the workspace default."),
2625
2640
  domains: nameList.optional().describe("Domains selected for the step session. An empty list selects none."),
2626
2641
  model: singleName.optional().describe("Model selector, provider/id."),
@@ -2634,7 +2649,7 @@ const poRunConfigSchema = zod.z.object({
2634
2649
  */
2635
2650
  const poTemplateRunConfigSchema = poRunConfigSchema.strip();
2636
2651
  /** The runConfig keys Po reads itself, the host keys `workflow-mcp doctor` checks steps against. */
2637
- const PO_RUN_CONFIG_KEYS = poRunConfigSchema.keyof().options;
2652
+ const PO_RUN_CONFIG_KEYS = poRunConfigSchema.keyof().options.filter((key) => !Object.hasOwn(RETIRED_RUN_CONFIG_KEYS, key));
2638
2653
  //#endregion
2639
2654
  //#region src/services/workflowRuntime/index.ts
2640
2655
  /** Freeze the admitted environment too, so concurrent runs cannot mutate each other's facts. */
@@ -3404,8 +3419,9 @@ function assertWorkflowAllocationExecution(workflow, options = {}) {
3404
3419
  return;
3405
3420
  }
3406
3421
  const record = value;
3407
- if ("minorModes" in record) {
3408
- if ((Array.isArray(record.minorModes) ? record.minorModes : typeof record.minorModes === "string" ? record.minorModes.split(",").map((mode) => mode.trim()) : []).includes("help")) throw new Error("Workflow allocations cannot activate Help or admin capabilities.");
3422
+ for (const key of ["modes", "minorModes"]) {
3423
+ const listed = record[key];
3424
+ if ((Array.isArray(listed) ? listed : typeof listed === "string" ? listed.split(",").map((mode) => mode.trim()) : []).includes("help")) throw new Error("Workflow allocations cannot activate Help or admin capabilities.");
3409
3425
  }
3410
3426
  if (record.customRun !== void 0 && options.custom === false) throw new Error("Allocated customRun requires a managed in-process executor.");
3411
3427
  if (record.interactiveRun !== void 0) {
@@ -7989,7 +8005,7 @@ function cloudWorkflowLaunchRefusal(workflow, selection) {
7989
8005
  * A step's `runConfig`, validated against the keys Po understands.
7990
8006
  *
7991
8007
  * A templated step's may also carry keys its command template reads. A key
7992
- * that is neither, such as `majormode`, fails the step rather than running it
8008
+ * that is neither, such as `prest`, fails the step rather than running it
7993
8009
  * on workspace defaults. An engine that does not say what its template reads
7994
8010
  * leaves such keys unchecked.
7995
8011
  */
@@ -8009,8 +8025,8 @@ function readPoRunConfig(runConfig, template) {
8009
8025
  /** The selection a step session is pinned to; unset keys keep the workspace defaults. */
8010
8026
  function sessionSelection(config) {
8011
8027
  return {
8012
- ...config.majorMode === void 0 ? {} : { majorMode: config.majorMode },
8013
- ...config.minorModes === void 0 ? {} : { minorModes: config.minorModes },
8028
+ ...config.preset === void 0 ? {} : { preset: config.preset },
8029
+ ...config.modes === void 0 ? {} : { modes: config.modes },
8014
8030
  ...config.profile === void 0 ? {} : { profile: config.profile },
8015
8031
  ...config.domains === void 0 ? {} : { domains: config.domains }
8016
8032
  };
@@ -8119,7 +8135,7 @@ function assertStaticChildShell(definition) {
8119
8135
  * Runs workflow steps inside Po instead of a shell.
8120
8136
  *
8121
8137
  * A customRun step becomes a child session of the launching session, with the
8122
- * step's major mode, minor modes, profile, domains and model, so its messages
8138
+ * step's preset, modes, profile, domains and model, so its messages
8123
8139
  * stream like any other conversation. Command steps go to their own terminal
8124
8140
  * pane when a launcher is available and fall back to the engine's spawn when
8125
8141
  * it is not.
@@ -8262,7 +8278,7 @@ function createStepExecutor(dependencies) {
8262
8278
  }
8263
8279
  /**
8264
8280
  * Run a step as a child session of the launching session, with the step's
8265
- * major mode, minor modes, profile, domains and model.
8281
+ * preset, modes, profile, domains and model.
8266
8282
  *
8267
8283
  * The session keeps going until the step has what the workflow needs: each
8268
8284
  * time the agent settles, the engine's decision gate is asked, and while
@@ -8287,11 +8303,11 @@ function createStepExecutor(dependencies) {
8287
8303
  let initialPrompt = request.prompt;
8288
8304
  try {
8289
8305
  const config = readPoRunConfig(request.runConfig, request.template);
8290
- if (config.majorMode === void 0) throw new Error("Agent steps require an effective runConfig.majorMode.");
8306
+ if (config.preset === void 0) throw new Error("Agent steps require an effective runConfig.preset.");
8291
8307
  if (request.identity !== void 0) {
8292
8308
  const expectedProfile = request.identity.kind === "none" ? null : request.identity.profile;
8293
8309
  if (config.profile !== expectedProfile) throw new Error("Workflow step profile differs from its admitted identity.");
8294
- if (config.minorModes?.includes("help")) throw new Error("Workflow allocations cannot activate Help.");
8310
+ if (config.modes?.includes("help")) throw new Error("Workflow allocations cannot activate Help.");
8295
8311
  }
8296
8312
  name = request.child === void 0 ? stepSessionName(request.env, request.stepName) : `${request.child.job}:${request.child.invocationId}:${request.stepName}`;
8297
8313
  const environment = stepEnvironment(request.env, dependencies.hostEnvironment);
@@ -8825,12 +8841,12 @@ async function diagnoseWorkflowBindings(workflow, options) {
8825
8841
  ...input.profile && !(resolved.runConfig ?? step.runConfig)?.profile ? { profile: input.profile } : {}
8826
8842
  };
8827
8843
  try {
8828
- if (!readPoRunConfig(config, resolved.template).majorMode) problem("missing-major-mode", "Set an effective runConfig.majorMode for this managed agent step.");
8844
+ if (!readPoRunConfig(config, resolved.template).preset) problem("missing-preset", "Set an effective runConfig.preset for this managed agent step.");
8829
8845
  } catch (error) {
8830
8846
  problem("invalid-run-config", error instanceof Error ? error.message : "Effective runConfig is invalid. Check scalar names and supported string/list shapes.");
8831
8847
  }
8832
8848
  if (Object.values(config).some((value) => JSON.stringify(value).includes("${{"))) problem("unexpanded-run-config", "runConfig values are not interpolated by execution. Supply concrete settings or select a declared choice.");
8833
- later("host.selection", "Mode/profile/model/domain availability and provider authentication require host admission, not just YAML validation.");
8849
+ later("host.selection", "Preset/profile/model/domain availability and provider authentication require host admission, not just YAML validation.");
8834
8850
  if (!(resolved.custom?.prompt ?? resolved.template?.prompt)?.trim()) problem("empty-prompt", "Provide a nonempty prompt after injection.");
8835
8851
  }
8836
8852
  if (step.uses) later("step.uses", "Action behavior is not executed or verified by this preview.");
@@ -8964,7 +8980,7 @@ function parseProblems(message) {
8964
8980
  * Everything the parser refuses comes back as errors, one per problem. On top
8965
8981
  * of that, what only shows up once a step runs:
8966
8982
  * - runConfig keys nothing reads. A key a host does not know, such as a
8967
- * misspelled `majormode`, would otherwise run the step on defaults or fail it
8983
+ * misspelled `prest`, would otherwise run the step on defaults or fail it
8968
8984
  * mid-run. Which keys are known depends on the host, so they are errors only
8969
8985
  * when `runConfigKeys` names the host's own; without them, keys a templated
8970
8986
  * step's command does not read are warnings.
@@ -8992,6 +9008,12 @@ async function diagnoseWorkflow(workflowPath, options) {
8992
9008
  }
8993
9009
  const diagnostics = [];
8994
9010
  const hostKeys = options.runConfigKeys === void 0 ? void 0 : new Set(options.runConfigKeys);
9011
+ const renamed = options.renamedRunConfigKeys ?? {};
9012
+ const renamedTo = (key) => Object.hasOwn(renamed, key) ? renamed[key] : void 0;
9013
+ const notHostSetting = (key) => {
9014
+ const replacement = renamedTo(key);
9015
+ return replacement === void 0 ? `runConfig key "${key}" is not a host setting.` : `runConfig.${key} was renamed to ${replacement}.`;
9016
+ };
8995
9017
  const reads = (command) => {
8996
9018
  const declared = workflow.commands?.[command];
8997
9019
  if (declared === void 0) return void 0;
@@ -9015,7 +9037,7 @@ async function diagnoseWorkflow(workflowPath, options) {
9015
9037
  level: hostKeys === void 0 ? "warning" : "error",
9016
9038
  code: "unknown-run-config-key",
9017
9039
  location,
9018
- message: hostKeys === void 0 ? `runConfig key "${key}" is not read by ${commands}; a host may still read it (pass the host's keys to check).` : `runConfig key "${key}" is neither a host setting nor read by ${commands}.`
9040
+ message: hostKeys === void 0 ? `runConfig key "${key}" is not read by ${commands}; a host may still read it (pass the host's keys to check).` : renamedTo(key) !== void 0 ? notHostSetting(key) : `runConfig key "${key}" is neither a host setting nor read by ${commands}.`
9019
9041
  });
9020
9042
  };
9021
9043
  const anyCommand = /* @__PURE__ */ new Set([...offeredReads.flatMap((keys) => [...keys]), ...hostKeys ?? []]);
@@ -9029,7 +9051,7 @@ async function diagnoseWorkflow(workflowPath, options) {
9029
9051
  level: "error",
9030
9052
  code: "unknown-run-config-key",
9031
9053
  location: "runner" in entry && entry.runner ? `${location}${STEP_SEPARATOR}customRun.${entry.runner}` : location,
9032
- message: `runConfig key "${key}" is not a host setting.`
9054
+ message: notHostSetting(key)
9033
9055
  });
9034
9056
  if (step.customRun && step.run === void 0 && step.interactiveRun === void 0) diagnostics.push({
9035
9057
  level: "warning",
@@ -9042,7 +9064,7 @@ async function diagnoseWorkflow(workflowPath, options) {
9042
9064
  level: "error",
9043
9065
  code: "unknown-run-config-key",
9044
9066
  location: `runners.${runner}`,
9045
- message: `runConfig key "${key}" is not a host setting.`
9067
+ message: notHostSetting(key)
9046
9068
  });
9047
9069
  const jobs = new Set(Object.keys(workflow.jobs));
9048
9070
  for (const [name, job] of Object.entries(workflow.jobs)) {
@@ -14132,6 +14154,12 @@ Object.defineProperty(exports, "PROGRESS_FILENAME", {
14132
14154
  return PROGRESS_FILENAME;
14133
14155
  }
14134
14156
  });
14157
+ Object.defineProperty(exports, "RENAMED_RUN_CONFIG_KEYS", {
14158
+ enumerable: true,
14159
+ get: function() {
14160
+ return RENAMED_RUN_CONFIG_KEYS;
14161
+ }
14162
+ });
14135
14163
  Object.defineProperty(exports, "RecoverWorkflowInputSchema", {
14136
14164
  enumerable: true,
14137
14165
  get: function() {
@@ -14529,4 +14557,4 @@ Object.defineProperty(exports, "workflowShellOutput", {
14529
14557
  }
14530
14558
  });
14531
14559
 
14532
- //# sourceMappingURL=RecoverWorkflowService-Diz9Ixa2.cjs.map
14560
+ //# sourceMappingURL=RecoverWorkflowService-BBKmIcte.cjs.map