@agimon-ai/po-workflow 0.0.0-alpha.57 → 0.0.0-alpha.59

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
@@ -84,8 +84,10 @@ not select or resolve the tools folder.
84
84
  - `sessionId` and the admitted working directory `cwd`.
85
85
  - `workflow`: the trusted `PoWorkflowContextService`, including the captured config, job/step identity,
86
86
  admitted `jobEnvironment` and `stepEnvironment`, and workflow state reader.
87
- - Injected `fs` and `shell` capabilities.
87
+ - Injected `fs` and `shell` capabilities. Their methods take a call context as the last argument.
88
88
  - `signal`: the session tools lifetime, aborted on session disposal or mounting failure.
89
+ - `context`: a call context for `fs` and `shell`, aborted with `signal`. Inside `bind(run)`, pass
90
+ `run.context` instead, which also aborts when that exec ends.
89
91
 
90
92
  Return the existing `PoCodemodeNamespace` contract: name `jobTools`, a non-empty one-line `summary`
91
93
  (maximum 600 characters), TypeScript `declarations` for discovery, and `bind(run)`. Bind returns flat
@@ -144,6 +146,19 @@ bridge. A missing file or invalid factory fails the managed step session rather
144
146
  omitting its selected tools. The namespace and skill mount and dispose together; disposing them does
145
147
  not stop the owning workflow or change its recovery rules.
146
148
 
149
+ ## Step instructions
150
+
151
+ A workflow can give its managed Po agent steps their own instructions file:
152
+
153
+ ```yaml
154
+ instructions: ./AGENTS.md
155
+ ```
156
+
157
+ The file replaces the AGENTS.md files the step session would discover from its working directory; it
158
+ does not add to them. The path resolves relative to the declaring YAML and is inherited through
159
+ `imports` as a default, like `tools`. A missing or unreadable file fails the step session rather than
160
+ running it without instructions. Shell steps and external Claude/Codex CLI runners ignore it.
161
+
147
162
  ## Launch and monitor
148
163
 
149
164
  Core tools are:
@@ -251,7 +251,9 @@ const PreBlockSchema = zod.z.object({
251
251
  steps: zod.z.array(StepSchema).optional()
252
252
  });
253
253
  const JobHookBlockSchema = zod.z.object({ steps: zod.z.array(StepSchema).optional() });
254
- const WorkflowToolsPathSchema = zod.z.string().min(1).refine((value) => value.trim().length > 0 && !/^[a-z][a-z0-9+.-]*:/iu.test(value.trimStart()) && value.split("").every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127), "Workflow tools must be a local filesystem path without URL schemes or control characters.").describe("Tools folder relative to its declaring YAML file, containing index.mjs and SKILL.md.");
254
+ const localPathSchema = (label) => zod.z.string().min(1).refine((value) => value.trim().length > 0 && !/^[a-z][a-z0-9+.-]*:/iu.test(value.trimStart()) && value.split("").every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127), `${label} must be a local filesystem path without URL schemes or control characters.`);
255
+ const WorkflowToolsPathSchema = localPathSchema("Workflow tools").describe("Tools folder relative to its declaring YAML file, containing index.mjs and SKILL.md.");
256
+ const WorkflowInstructionsPathSchema = localPathSchema("Workflow instructions").describe("Instructions file relative to its declaring YAML file. Step sessions read it instead of the AGENTS.md files they would discover.");
255
257
  const JobSchema = zod.z.object({
256
258
  tools: WorkflowToolsPathSchema.optional(),
257
259
  "runs-on": zod.z.string().optional(),
@@ -333,6 +335,7 @@ const RunDirectorySchema = zod.z.object({
333
335
  const WorkflowSchema = zod.z.object({
334
336
  name: zod.z.string().optional(),
335
337
  tools: WorkflowToolsPathSchema.optional(),
338
+ instructions: WorkflowInstructionsPathSchema.optional(),
336
339
  tags: zod.z.array(zod.z.string().trim().min(1)).optional().describe("Tags used to categorize and filter workflow definitions."),
337
340
  workspace: zod.z.string().optional(),
338
341
  runner: zod.z.string().optional().describe("Default runner key for step command maps when no CLI runner is provided."),
@@ -2500,6 +2503,7 @@ var WorkflowParserService = class {
2500
2503
  ...Object.values(workflow.jobs ?? {}),
2501
2504
  workflow.repair
2502
2505
  ]) if (declaration?.tools !== void 0) declaration.tools = (0, node_path.resolve)((0, node_path.dirname)(workflowPath), WorkflowToolsPathSchema.parse(declaration.tools));
2506
+ if (workflow.instructions !== void 0) workflow.instructions = (0, node_path.resolve)((0, node_path.dirname)(workflowPath), WorkflowInstructionsPathSchema.parse(workflow.instructions));
2503
2507
  }
2504
2508
  /**
2505
2509
  * Render a command template into the shell command a step runs.
@@ -2642,7 +2646,7 @@ var WorkflowParserService = class {
2642
2646
  * - system-prompt: concatenated (imported + main)
2643
2647
  * - commands, choices: merged per name (main overrides imported)
2644
2648
  * - runConfig, sessionConfig: merged per key (main overrides imported)
2645
- * - tools: scalar default (main wins, otherwise first imported selection)
2649
+ * - tools, instructions: scalar default (main wins, otherwise first imported selection)
2646
2650
  * Imports are processed in order; earlier merged values act as main overrides.
2647
2651
  * Circular imports are detected and throw an error.
2648
2652
  */
@@ -2659,6 +2663,7 @@ var WorkflowParserService = class {
2659
2663
  this.resolveToolsPaths(imported, resolvedImport);
2660
2664
  if (imported.imports) await this.resolveImports(imported, resolvedImport, visited);
2661
2665
  workflow.tools ??= imported.tools;
2666
+ workflow.instructions ??= imported.instructions;
2662
2667
  if (imported.env) workflow.env = {
2663
2668
  ...imported.env,
2664
2669
  ...workflow.env
@@ -11541,4 +11546,4 @@ Object.defineProperty(exports, "workflowShellOutput", {
11541
11546
  }
11542
11547
  });
11543
11548
 
11544
- //# sourceMappingURL=RecoverWorkflowService-DL5itVWA.cjs.map
11549
+ //# sourceMappingURL=RecoverWorkflowService-BQiYI4Pg.cjs.map