poe-code 3.0.183 → 3.0.184

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.
@@ -1,5 +1,5 @@
1
- import { type PipelineRunOptions, type PipelineRunResult } from "@poe-code/pipeline";
2
- export type { AgentRunUsage, AgentRunInput, AgentRunResult, PipelineConfig, PipelineMetrics, PipelinePlan, PipelineStatus, PipelineTask, ResolvedStepDefinitions, ResolvedStepsConfig, StepDefinition, StepMode, TaskProgress, PlanSummary } from "@poe-code/pipeline";
1
+ import { type PipelineFileSystem, type PipelineRunOptions, type PipelineRunResult } from "@poe-code/pipeline";
2
+ export type { AgentRunUsage, AgentRunInput, AgentRunResult, PipelineConfig, PipelineMetrics, PipelinePlan, PipelineLockStatus, PipelineStatus, PipelineTask, ResolvedStepDefinitions, ResolvedStepsConfig, StepDefinition, StepMode, TaskProgress, PlanSummary } from "@poe-code/pipeline";
3
3
  export { resolvePlanDirectory } from "@poe-code/pipeline";
4
4
  export type { PipelineRunOptions, PipelineRunResult };
5
5
  export interface PipelineInitSource {
@@ -14,7 +14,7 @@ export interface PipelineInitRunOptions {
14
14
  model?: string;
15
15
  cwd: string;
16
16
  homeDir: string;
17
- planDirectory?: string;
17
+ fs?: PipelineFileSystem;
18
18
  sources: PipelineInitSource[];
19
19
  question?: string;
20
20
  assumeYes: boolean;
@@ -1,30 +1,153 @@
1
1
  import * as fsPromises from "node:fs/promises";
2
- import { resolvePlanDirectory as resolveWorkspacePlanDirectory, runPipeline as runWorkspacePipeline } from "@poe-code/pipeline";
2
+ import path from "node:path";
3
+ import { isActivityTimeoutError } from "@poe-code/agent-spawn";
4
+ import { parsePlan, resolveAbsolutePlanPath, resolvePlanPath, runPipeline as runWorkspacePipeline } from "@poe-code/pipeline";
3
5
  import { buildPipelineInitPrompt } from "../cli/commands/pipeline-init.js";
4
6
  import pipelineSkillPlan from "../templates/pipeline/SKILL_plan.md";
5
7
  import { spawn as sdkSpawn } from "./spawn.js";
6
8
  export { resolvePlanDirectory } from "@poe-code/pipeline";
9
+ const PIPELINE_ACTIVITY_TIMEOUT_RETRY_COUNT = 3;
7
10
  function isAbortError(error) {
8
11
  return error instanceof Error && error.name === "AbortError";
9
12
  }
13
+ function createDefaultFs() {
14
+ return {
15
+ readFile: fsPromises.readFile,
16
+ writeFile: fsPromises.writeFile,
17
+ readdir: fsPromises.readdir,
18
+ stat: async (filePath) => {
19
+ const stat = await fsPromises.stat(filePath);
20
+ return {
21
+ isFile: () => stat.isFile(),
22
+ isDirectory: () => stat.isDirectory(),
23
+ mtimeMs: stat.mtimeMs
24
+ };
25
+ },
26
+ mkdir: async (filePath, options) => {
27
+ await fsPromises.mkdir(filePath, options);
28
+ },
29
+ rmdir: fsPromises.rmdir,
30
+ rename: fsPromises.rename
31
+ };
32
+ }
33
+ function createEmptyMetrics() {
34
+ return {
35
+ totalInputTokens: 0,
36
+ totalOutputTokens: 0,
37
+ totalCachedTokens: 0,
38
+ tasksCompleted: 0,
39
+ tasksFailed: 0,
40
+ stepsCompleted: 0
41
+ };
42
+ }
43
+ function needsPipelineInit(planContent) {
44
+ try {
45
+ return parsePlan(planContent).tasks.length === 0;
46
+ }
47
+ catch (error) {
48
+ const message = error instanceof Error ? error.message : String(error);
49
+ if (message === "Invalid plan YAML: expected a top-level object." ||
50
+ message === 'Invalid plan YAML: expected "tasks" to be an array.') {
51
+ return true;
52
+ }
53
+ throw error;
54
+ }
55
+ }
56
+ function withPipelineTimeoutRetries(runAgent) {
57
+ return async (input) => {
58
+ for (let attempt = 1; attempt <= PIPELINE_ACTIVITY_TIMEOUT_RETRY_COUNT; attempt += 1) {
59
+ try {
60
+ return await runAgent(input);
61
+ }
62
+ catch (error) {
63
+ if (!isActivityTimeoutError(error) ||
64
+ attempt === PIPELINE_ACTIVITY_TIMEOUT_RETRY_COUNT) {
65
+ throw error;
66
+ }
67
+ }
68
+ }
69
+ throw new Error("Unreachable");
70
+ };
71
+ }
10
72
  export async function runPipeline(options) {
11
- const runAgent = options.runAgent ?? (async (input) => {
73
+ const fs = options.fs ?? createDefaultFs();
74
+ const runAgent = withPipelineTimeoutRetries(options.runAgent ?? (async (input) => {
12
75
  return await sdkSpawn.autonomous(input.agent, {
13
76
  prompt: input.prompt,
14
77
  cwd: input.cwd,
15
78
  logDir: input.logDir,
16
79
  model: input.model,
17
80
  mode: input.mode,
81
+ maxTimeoutRetries: 1,
18
82
  ...(input.mcpServers ? { mcpServers: input.mcpServers } : {}),
19
83
  ...(input.signal ? { signal: input.signal } : {})
20
84
  });
85
+ }));
86
+ const planPath = await resolvePlanPath({
87
+ cwd: options.cwd,
88
+ homeDir: options.homeDir,
89
+ plan: options.plan,
90
+ planDirectory: options.planDirectory,
91
+ assumeYes: options.assumeYes,
92
+ fs,
93
+ selectPlan: options.selectPlan,
94
+ promptForPath: options.promptForPath
21
95
  });
96
+ if (!planPath) {
97
+ return {
98
+ stopReason: "cancelled",
99
+ planPath: "",
100
+ runsCompleted: 0,
101
+ totalDurationMs: 0,
102
+ metrics: createEmptyMetrics()
103
+ };
104
+ }
105
+ const absolutePlanPath = resolveAbsolutePlanPath(planPath, options.cwd, options.homeDir);
106
+ const planContent = await fs.readFile(absolutePlanPath, "utf8");
107
+ if (needsPipelineInit(planContent)) {
108
+ const initResult = await runPipelineInit({
109
+ agent: options.agent,
110
+ ...(options.model ? { model: options.model } : {}),
111
+ cwd: options.cwd,
112
+ homeDir: options.homeDir,
113
+ fs,
114
+ sources: [
115
+ {
116
+ absolutePath: absolutePlanPath,
117
+ relativePath: planPath,
118
+ title: path.basename(planPath, path.extname(planPath))
119
+ }
120
+ ],
121
+ assumeYes: options.assumeYes ?? false,
122
+ runAgent,
123
+ ...(options.signal ? { signal: options.signal } : {})
124
+ });
125
+ if (initResult.stopReason === "cancelled") {
126
+ return {
127
+ stopReason: "cancelled",
128
+ planPath,
129
+ runsCompleted: 0,
130
+ totalDurationMs: 0,
131
+ metrics: createEmptyMetrics()
132
+ };
133
+ }
134
+ if (initResult.stopReason === "failed") {
135
+ throw new Error(`Pipeline init failed for "${planPath}".`);
136
+ }
137
+ const initializedPlanContent = await fs.readFile(absolutePlanPath, "utf8");
138
+ if (needsPipelineInit(initializedPlanContent)) {
139
+ throw new Error(`Pipeline init did not produce runnable tasks for "${planPath}".`);
140
+ }
141
+ }
22
142
  return runWorkspacePipeline({
23
143
  ...options,
144
+ fs,
145
+ plan: planPath,
24
146
  runAgent
25
147
  });
26
148
  }
27
149
  export async function runPipelineInit(options) {
150
+ const fs = options.fs ?? createDefaultFs();
28
151
  const runAgent = options.runAgent ?? (async (input) => {
29
152
  return await sdkSpawn.autonomous(input.agent, {
30
153
  prompt: input.prompt,
@@ -40,11 +163,6 @@ export async function runPipelineInit(options) {
40
163
  sourcesProcessed: 0
41
164
  };
42
165
  }
43
- const planDirectory = resolveWorkspacePlanDirectory({
44
- cwd: options.cwd,
45
- homeDir: options.homeDir,
46
- planDirectory: options.planDirectory ?? ".poe-code/pipeline/plans"
47
- });
48
166
  let sourcesProcessed = 0;
49
167
  const totalSources = options.sources.length;
50
168
  for (const [sourceIndex, source] of options.sources.entries()) {
@@ -57,7 +175,7 @@ export async function runPipelineInit(options) {
57
175
  const displayIndex = sourceIndex + 1;
58
176
  try {
59
177
  options.onSourceStart?.(source, displayIndex, totalSources);
60
- const sourceDocContent = await fsPromises.readFile(source.absolutePath, "utf8");
178
+ const sourceDocContent = await fs.readFile(source.absolutePath, "utf8");
61
179
  if (options.signal?.aborted) {
62
180
  return {
63
181
  stopReason: "cancelled",
@@ -66,7 +184,6 @@ export async function runPipelineInit(options) {
66
184
  }
67
185
  const prompt = buildPipelineInitPrompt({
68
186
  question: options.question,
69
- planDirectory,
70
187
  sourceDocPath: source.relativePath,
71
188
  sourceDocContent,
72
189
  skillContent: pipelineSkillPlan
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/sdk/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,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ask the user for a one-sentence description of what they want to build.
12
12
  Write a markdown pipeline plan with YAML frontmatter. Before writing, determine where to place it:
13
13
 
14
14
  1. Write the plan to `docs/plans/plan-<name>.md` by default.
15
- 2. Find the `steps.yaml` file. Check these locations in order and use the first one found:
16
- a. `<project-root>/.poe-code/pipeline/steps.yaml` (project-level)
17
- b. `~/.poe-code/pipeline/steps.yaml` (user-global)
18
- If found, read it to determine available steps and note any `setup`/`teardown` hooks defined there. If not found in either location, use stepless tasks.
15
+ 2. Find named step configs in `.poe-code/pipeline/steps/`.
16
+ a. Check `<project-root>/.poe-code/pipeline/steps/` first.
17
+ b. If that directory does not exist, check `~/.poe-code/pipeline/steps/`.
18
+ c. Read the available `*.yaml` files there (for example `default.yaml`, `fast.yaml`). Use `default` when the user does not ask for a different config. If no directory exists, use stepless tasks.
19
19
  3. Decide what belongs in the markdown body. If the user already has a Markdown design/context doc (for example in `docs/plans/`), use that content as the plan body when it makes sense. If they want to keep the source doc separate, link it via `vars` so it is available in every prompt without repeating the path.
20
20
 
21
21
  ## Rules
@@ -24,12 +24,14 @@ Write a markdown pipeline plan with YAML frontmatter. Before writing, determine
24
24
  - Do not create tasks that depend on hidden state from previous tasks.
25
25
  - Use short kebab-case ids.
26
26
  - Keep titles concise and descriptive.
27
- - The available steps come from the `steps.yaml` file you found (project or global). Use the current step names instead of inventing hardcoded ones.
28
- - If no step configuration is present, use stepless tasks with scalar `status: open`.
27
+ - The available steps come from the named step config you found in `.poe-code/pipeline/steps/`. Use the current step names instead of inventing hardcoded ones.
28
+ - Always write `extends: <name>` in the frontmatter. Use `default` unless you discovered or intentionally chose another named config.
29
+ - If no step configuration directory is present, use stepless tasks with scalar `status: open`.
29
30
  - If step configuration is present, start every configured step status at `open`.
30
- - `setup` and `teardown` defined in `steps.yaml` are inherited automatically.
31
+ - `setup` and `teardown` from the extended step config are inherited automatically.
31
32
  - To disable an inherited hook for a specific plan, set `setup: false` or `teardown: false`.
32
- - To override an inherited hook, define the full block with an `prompt` field.
33
+ - To override an inherited hook, define the full block with a `prompt` field.
34
+ - Use the plan-level `steps:` block only for per-plan step overrides. Override only the fields you need; unset fields inherit from the extended config.
33
35
  - If the user keeps an existing Markdown plan document as a separate file, add a `vars` block with a `plan_doc` key pointing to the file path. The pipeline runtime reads the file and makes its contents available as a named placeholder in every prompt.
34
36
  - `vars` values are plain strings. Use the `file` include syntax inside a value to load a file at runtime (path relative to project root): write `var_name: "` followed by the file include tag and a closing `"`.
35
37
  - Each var name becomes a double-curly-brace placeholder usable in any task, step, setup, or teardown prompt.
@@ -44,6 +46,7 @@ Write a markdown pipeline plan with YAML frontmatter. Before writing, determine
44
46
  $schema: https://poe-platform.github.io/poe-code/schemas/plans/pipeline.schema.json
45
47
  kind: pipeline
46
48
  version: 1
49
+ extends: default
47
50
 
48
51
  # vars: optional. Define named values available as double-curly-brace placeholders in every prompt.
49
52
  # Each value is a plain string. To load a file at runtime, write the value using the
@@ -52,9 +55,19 @@ version: 1
52
55
  #
53
56
  # vars:
54
57
  # plan_doc: "(file include for docs/plans/my-feature.md)" # loaded at runtime
55
- # env: production # literal string
58
+ # env: production # literal string
56
59
 
57
- # setup/teardown are inherited from steps.yaml automatically.
60
+ # Optional per-plan step overrides. Unset fields inherit from the extended config.
61
+ # Omit this block when the base config already fits.
62
+ #
63
+ # steps:
64
+ # implement:
65
+ # prompt: |
66
+ # Focus on the risky auth paths first.
67
+ # test:
68
+ # mode: read
69
+
70
+ # setup/teardown are inherited from the extended step config automatically.
58
71
  # Include them only to disable or override:
59
72
  #
60
73
  # setup: false # disable the inherited setup hook
@@ -69,9 +82,9 @@ tasks:
69
82
  prompt: |
70
83
  Improve auth validation and session handling.
71
84
  # If vars defines plan_doc, reference it here using the double-curly-brace placeholder syntax.
72
- # scalar when no steps.yaml steps are defined:
85
+ # scalar when no step config is available:
73
86
  status: open
74
- # stepped when steps.yaml defines steps:
87
+ # stepped when the extended config defines steps:
75
88
  # status:
76
89
  # implement: open
77
90
  # test: open
@@ -91,5 +104,5 @@ Run `poe-code pipeline validate <path>` to check the plan is valid before runnin
91
104
 
92
105
  ## Notes
93
106
 
94
- - Match the uncommented step names and order from whichever `steps.yaml` file you find.
107
+ - Match the uncommented step names and order from the named step config you choose.
95
108
  - If `poe-code` is not available as a global command, use `npx poe-code` instead.
@@ -1,4 +1,7 @@
1
- # Edit this file to define Pipeline steps.
1
+ # Edit this file to define the default named Pipeline step config.
2
+ # Save additional named configs alongside it in the same directory, for example:
3
+ # .poe-code/pipeline/steps/default.yaml
4
+ # .poe-code/pipeline/steps/fast.yaml
2
5
  # Leave it comment-only to keep the default no-step behavior.
3
6
  # Uncomment and change the example below when you want stepped tasks.
4
7
  # Add `mode` only when you want to override the default `yolo`.
@@ -6,7 +9,7 @@
6
9
  # Use {{file 'path'}} in any prompt to inline the contents of a Markdown file (relative to project root).
7
10
  #
8
11
  # Optional: setup runs once before any tasks, teardown runs once after all complete.
9
- # These can also be defined in plan.md to override the defaults below.
12
+ # These can also be defined in the plan frontmatter to override the defaults below.
10
13
  #
11
14
  # setup:
12
15
  # prompt: Prepare the workspace
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "3.0.183",
3
+ "version": "3.0.184",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -38,9 +38,10 @@ export function statsToLines(stats, width) {
38
38
  }
39
39
  const mutedStyle = getToneStyle("muted");
40
40
  const totalTokens = stats.tokensIn + stats.tokensOut;
41
+ const iterationsLabel = stats.iterationsLabel ?? "Iteration";
41
42
  const lines = [
42
43
  createKeyValueLine("Status", formatStatus(stats.status), width, getStatusStyle(stats.status)),
43
- createKeyValueLine("Iteration", formatNumber(stats.iterations), width),
44
+ createKeyValueLine(iterationsLabel, formatNumber(stats.iterations), width),
44
45
  createKeyValueLine("Elapsed", formatElapsed(stats.elapsedMs), width),
45
46
  createBlankLine(),
46
47
  createKeyValueLine("Tokens In", formatNumber(stats.tokensIn), width),
@@ -7,6 +7,7 @@ export type OutputItem = {
7
7
  export type DashboardStats = {
8
8
  status: "idle" | "running" | "paused" | "done" | "error";
9
9
  iterations: number;
10
+ iterationsLabel?: string;
10
11
  tokensIn: number;
11
12
  tokensOut: number;
12
13
  elapsedMs: number;