@davidorex/pi-workflows 0.2.0 → 0.3.0

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.
Files changed (215) hide show
  1. package/CHANGELOG.md +7 -4
  2. package/README.md +12 -2
  3. package/agents/architecture-designer.agent.yaml +58 -0
  4. package/agents/architecture-inferrer.agent.yaml +60 -0
  5. package/agents/gap-identifier.agent.yaml +66 -0
  6. package/agents/handoff-writer.agent.yaml +64 -0
  7. package/agents/plan-creator.agent.yaml +63 -0
  8. package/agents/project-definer.agent.yaml +53 -0
  9. package/agents/project-inferrer.agent.yaml +63 -0
  10. package/agents/requirements-gatherer.agent.yaml +58 -0
  11. package/dist/agent-spec.d.ts +27 -0
  12. package/dist/agent-spec.d.ts.map +1 -0
  13. package/dist/agent-spec.js +112 -0
  14. package/dist/agent-spec.js.map +1 -0
  15. package/dist/checkpoint.d.ts +50 -0
  16. package/dist/checkpoint.d.ts.map +1 -0
  17. package/dist/checkpoint.js +109 -0
  18. package/dist/checkpoint.js.map +1 -0
  19. package/dist/completion.d.ts +18 -0
  20. package/dist/completion.d.ts.map +1 -0
  21. package/dist/completion.js +58 -0
  22. package/dist/completion.js.map +1 -0
  23. package/dist/dag.d.ts +56 -0
  24. package/dist/dag.d.ts.map +1 -0
  25. package/dist/dag.js +172 -0
  26. package/dist/dag.js.map +1 -0
  27. package/dist/dispatch.d.ts +35 -0
  28. package/dist/dispatch.d.ts.map +1 -0
  29. package/dist/dispatch.js +311 -0
  30. package/dist/dispatch.js.map +1 -0
  31. package/dist/expression.d.ts +64 -0
  32. package/dist/expression.d.ts.map +1 -0
  33. package/dist/expression.js +294 -0
  34. package/dist/expression.js.map +1 -0
  35. package/dist/format.d.ts +19 -0
  36. package/dist/format.d.ts.map +1 -0
  37. package/dist/format.js +42 -0
  38. package/dist/format.js.map +1 -0
  39. package/dist/index.d.ts +8 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +675 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/output.d.ts +12 -0
  44. package/dist/output.d.ts.map +1 -0
  45. package/dist/output.js +59 -0
  46. package/dist/output.js.map +1 -0
  47. package/dist/state.d.ts +66 -0
  48. package/dist/state.d.ts.map +1 -0
  49. package/dist/state.js +227 -0
  50. package/dist/state.js.map +1 -0
  51. package/dist/step-agent.d.ts +35 -0
  52. package/dist/step-agent.d.ts.map +1 -0
  53. package/dist/step-agent.js +156 -0
  54. package/dist/step-agent.js.map +1 -0
  55. package/dist/step-command.d.ts +21 -0
  56. package/dist/step-command.d.ts.map +1 -0
  57. package/dist/step-command.js +150 -0
  58. package/dist/step-command.js.map +1 -0
  59. package/dist/step-foreach.d.ts +33 -0
  60. package/dist/step-foreach.d.ts.map +1 -0
  61. package/dist/step-foreach.js +112 -0
  62. package/dist/step-foreach.js.map +1 -0
  63. package/dist/step-gate.d.ts +18 -0
  64. package/dist/step-gate.d.ts.map +1 -0
  65. package/dist/step-gate.js +137 -0
  66. package/dist/step-gate.js.map +1 -0
  67. package/dist/step-loop.d.ts +32 -0
  68. package/dist/step-loop.d.ts.map +1 -0
  69. package/dist/step-loop.js +278 -0
  70. package/dist/step-loop.js.map +1 -0
  71. package/dist/step-monitor.d.ts +56 -0
  72. package/dist/step-monitor.d.ts.map +1 -0
  73. package/dist/step-monitor.js +317 -0
  74. package/dist/step-monitor.js.map +1 -0
  75. package/dist/step-parallel.d.ts +43 -0
  76. package/dist/step-parallel.d.ts.map +1 -0
  77. package/dist/step-parallel.js +122 -0
  78. package/dist/step-parallel.js.map +1 -0
  79. package/{src/step-pause.ts → dist/step-pause.d.ts} +3 -13
  80. package/dist/step-pause.d.ts.map +1 -0
  81. package/dist/step-pause.js +22 -0
  82. package/dist/step-pause.js.map +1 -0
  83. package/dist/step-shared.d.ts +57 -0
  84. package/dist/step-shared.d.ts.map +1 -0
  85. package/dist/step-shared.js +125 -0
  86. package/dist/step-shared.js.map +1 -0
  87. package/dist/step-transform.d.ts +11 -0
  88. package/dist/step-transform.d.ts.map +1 -0
  89. package/dist/step-transform.js +41 -0
  90. package/dist/step-transform.js.map +1 -0
  91. package/dist/template.d.ts +51 -0
  92. package/dist/template.d.ts.map +1 -0
  93. package/{src/template.ts → dist/template.js} +32 -38
  94. package/dist/template.js.map +1 -0
  95. package/dist/test-helpers.d.ts +17 -0
  96. package/dist/test-helpers.d.ts.map +1 -0
  97. package/dist/test-helpers.js +46 -0
  98. package/dist/test-helpers.js.map +1 -0
  99. package/dist/tui.d.ts +47 -0
  100. package/dist/tui.d.ts.map +1 -0
  101. package/dist/tui.js +143 -0
  102. package/dist/tui.js.map +1 -0
  103. package/dist/types.d.ts +164 -0
  104. package/dist/types.d.ts.map +1 -0
  105. package/dist/types.js +3 -0
  106. package/dist/types.js.map +1 -0
  107. package/dist/workflow-discovery.d.ts +23 -0
  108. package/dist/workflow-discovery.d.ts.map +1 -0
  109. package/dist/workflow-discovery.js +103 -0
  110. package/dist/workflow-discovery.js.map +1 -0
  111. package/dist/workflow-executor.d.ts +50 -0
  112. package/dist/workflow-executor.d.ts.map +1 -0
  113. package/dist/workflow-executor.js +726 -0
  114. package/dist/workflow-executor.js.map +1 -0
  115. package/dist/workflow-sdk.d.ts +44 -0
  116. package/dist/workflow-sdk.d.ts.map +1 -0
  117. package/dist/workflow-sdk.js +438 -0
  118. package/dist/workflow-sdk.js.map +1 -0
  119. package/dist/workflow-spec.d.ts +33 -0
  120. package/dist/workflow-spec.d.ts.map +1 -0
  121. package/dist/workflow-spec.js +464 -0
  122. package/dist/workflow-spec.js.map +1 -0
  123. package/dist/workflows-dir.d.ts +3 -0
  124. package/dist/workflows-dir.d.ts.map +1 -0
  125. package/{src/workflows-dir.ts → dist/workflows-dir.js} +1 -0
  126. package/dist/workflows-dir.js.map +1 -0
  127. package/package.json +53 -38
  128. package/schemas/decomposition-specs.schema.json +48 -48
  129. package/schemas/execution-results.schema.json +48 -48
  130. package/schemas/investigation-findings.schema.json +43 -43
  131. package/schemas/pattern-analysis.schema.json +41 -41
  132. package/schemas/phase.schema.json +48 -0
  133. package/schemas/plan-breakdown.schema.json +20 -20
  134. package/schemas/quality-analysis.schema.json +33 -33
  135. package/schemas/research-findings.schema.json +42 -42
  136. package/schemas/structure-analysis.schema.json +40 -40
  137. package/schemas/synthesis.schema.json +31 -31
  138. package/schemas/verifier-output.schema.json +94 -94
  139. package/skill-narrative.md +84 -0
  140. package/skills/pi-workflows/SKILL.md +247 -0
  141. package/templates/architecture-designer/task.md +117 -0
  142. package/templates/architecture-inferrer/task.md +61 -0
  143. package/templates/gap-identifier/task.md +103 -0
  144. package/templates/handoff-writer/task.md +91 -0
  145. package/templates/plan-creator/task.md +143 -0
  146. package/templates/project-definer/task.md +67 -0
  147. package/templates/project-inferrer/task.md +56 -0
  148. package/templates/requirements-gatherer/task.md +90 -0
  149. package/workflows/analyze-existing-project.workflow.yaml +74 -0
  150. package/workflows/create-handoff.workflow.yaml +58 -0
  151. package/workflows/create-phase.workflow.yaml +1 -1
  152. package/workflows/do-gap.workflow.yaml +4 -4
  153. package/workflows/fix-audit.workflow.yaml +1 -1
  154. package/workflows/gap-to-phase.workflow.yaml +1 -1
  155. package/workflows/init-new-project.workflow.yaml +55 -0
  156. package/workflows/plan-from-requirements.workflow.yaml +51 -0
  157. package/workflows/self-implement.workflow.yaml +3 -3
  158. package/workflows/typed-analysis.workflow.yaml +4 -4
  159. package/src/agent-spec.test.ts +0 -289
  160. package/src/agent-spec.ts +0 -122
  161. package/src/block-validation.test.ts +0 -350
  162. package/src/checkpoint.test.ts +0 -237
  163. package/src/checkpoint.ts +0 -140
  164. package/src/completion.test.ts +0 -143
  165. package/src/completion.ts +0 -68
  166. package/src/dag.test.ts +0 -350
  167. package/src/dag.ts +0 -219
  168. package/src/dispatch.test.ts +0 -475
  169. package/src/dispatch.ts +0 -353
  170. package/src/expression.test.ts +0 -353
  171. package/src/expression.ts +0 -332
  172. package/src/format.test.ts +0 -80
  173. package/src/format.ts +0 -41
  174. package/src/graduated-failure.test.ts +0 -556
  175. package/src/index.test.ts +0 -114
  176. package/src/index.ts +0 -516
  177. package/src/loop.test.ts +0 -551
  178. package/src/output.test.ts +0 -213
  179. package/src/output.ts +0 -70
  180. package/src/parallel-integration.test.ts +0 -175
  181. package/src/resume.test.ts +0 -192
  182. package/src/state.test.ts +0 -192
  183. package/src/state.ts +0 -254
  184. package/src/step-agent.test.ts +0 -327
  185. package/src/step-agent.ts +0 -178
  186. package/src/step-command.test.ts +0 -330
  187. package/src/step-command.ts +0 -132
  188. package/src/step-foreach.test.ts +0 -647
  189. package/src/step-foreach.ts +0 -148
  190. package/src/step-gate.test.ts +0 -185
  191. package/src/step-gate.ts +0 -116
  192. package/src/step-loop.test.ts +0 -626
  193. package/src/step-loop.ts +0 -323
  194. package/src/step-parallel.test.ts +0 -475
  195. package/src/step-parallel.ts +0 -168
  196. package/src/step-pause.test.ts +0 -30
  197. package/src/step-shared.test.ts +0 -355
  198. package/src/step-shared.ts +0 -157
  199. package/src/step-transform.test.ts +0 -155
  200. package/src/step-transform.ts +0 -47
  201. package/src/template-integration.test.ts +0 -72
  202. package/src/template.test.ts +0 -162
  203. package/src/test-helpers.ts +0 -51
  204. package/src/tui.test.ts +0 -355
  205. package/src/tui.ts +0 -182
  206. package/src/types.ts +0 -195
  207. package/src/verifier-schema.test.ts +0 -226
  208. package/src/workflow-discovery.test.ts +0 -105
  209. package/src/workflow-discovery.ts +0 -114
  210. package/src/workflow-executor.test.ts +0 -1532
  211. package/src/workflow-executor.ts +0 -810
  212. package/src/workflow-sdk.test.ts +0 -238
  213. package/src/workflow-sdk.ts +0 -262
  214. package/src/workflow-spec.test.ts +0 -576
  215. package/src/workflow-spec.ts +0 -471
@@ -3,11 +3,10 @@
3
3
  * Provides three-tier template resolution (project > user > builtin)
4
4
  * and renders agent system prompts with step input as context.
5
5
  */
6
- import nunjucks from "nunjucks";
7
- import path from "node:path";
8
- import os from "node:os";
9
6
  import fs from "node:fs";
10
-
7
+ import os from "node:os";
8
+ import path from "node:path";
9
+ import nunjucks from "nunjucks";
11
10
  /**
12
11
  * Create a Nunjucks environment with three-tier template resolution.
13
12
  *
@@ -21,32 +20,28 @@ import fs from "node:fs";
21
20
  * @param cwd - project root directory
22
21
  * @param builtinDir - optional path to builtin templates (defaults to templates/ relative to package root)
23
22
  */
24
- export function createTemplateEnv(cwd: string, builtinDir?: string): nunjucks.Environment {
25
- const projectDir = path.join(cwd, ".pi", "templates");
26
- const userDir = path.join(os.homedir(), ".pi", "agent", "templates");
27
- const defaultBuiltinDir = builtinDir ?? path.resolve(import.meta.dirname, "..", "templates");
28
-
29
- // Nunjucks FileSystemLoader searches directories in order first match wins.
30
- // Only include directories that exist to avoid noisy warnings.
31
- const searchPaths: string[] = [];
32
- if (fs.existsSync(projectDir)) searchPaths.push(projectDir);
33
- if (fs.existsSync(userDir)) searchPaths.push(userDir);
34
- if (fs.existsSync(defaultBuiltinDir)) searchPaths.push(defaultBuiltinDir);
35
-
36
- // If no template directories exist, use a no-op loader — plain text passes through.
37
- const loader = searchPaths.length > 0
38
- ? new nunjucks.FileSystemLoader(searchPaths)
39
- : undefined;
40
-
41
- return new nunjucks.Environment(loader, {
42
- autoescape: false,
43
- throwOnUndefined: false,
44
- });
23
+ export function createTemplateEnv(cwd, builtinDir) {
24
+ const projectDir = path.join(cwd, ".pi", "templates");
25
+ const userDir = path.join(os.homedir(), ".pi", "agent", "templates");
26
+ const defaultBuiltinDir = builtinDir ?? path.resolve(import.meta.dirname, "..", "templates");
27
+ // Nunjucks FileSystemLoader searches directories in order — first match wins.
28
+ // Only include directories that exist to avoid noisy warnings.
29
+ const searchPaths = [];
30
+ if (fs.existsSync(projectDir))
31
+ searchPaths.push(projectDir);
32
+ if (fs.existsSync(userDir))
33
+ searchPaths.push(userDir);
34
+ if (fs.existsSync(defaultBuiltinDir))
35
+ searchPaths.push(defaultBuiltinDir);
36
+ // If no template directories exist, use a no-op loader plain text passes through.
37
+ const loader = searchPaths.length > 0 ? new nunjucks.FileSystemLoader(searchPaths) : undefined;
38
+ return new nunjucks.Environment(loader, {
39
+ autoescape: false,
40
+ throwOnUndefined: false,
41
+ });
45
42
  }
46
-
47
43
  /** Sentinel used to protect ${{ }} workflow expressions from Nunjucks rendering. */
48
44
  const WORKFLOW_EXPR_PLACEHOLDER = "\x00__PI_WORKFLOW_EXPR__";
49
-
50
45
  /**
51
46
  * Render a template string through Nunjucks.
52
47
  *
@@ -61,18 +56,16 @@ const WORKFLOW_EXPR_PLACEHOLDER = "\x00__PI_WORKFLOW_EXPR__";
61
56
  * @param context - variables available in the template
62
57
  * @returns rendered string
63
58
  */
64
- export function renderTemplate(env: nunjucks.Environment, templateStr: string, context: Record<string, unknown>): string {
65
- // Protect ${{ }} workflow expressions from Nunjucks
66
- const escaped = templateStr.replace(/\$\{\{/g, WORKFLOW_EXPR_PLACEHOLDER);
67
- const rendered = env.renderString(escaped, context);
68
- return rendered.replace(new RegExp(escapeRegExp(WORKFLOW_EXPR_PLACEHOLDER), "g"), "${{");
59
+ export function renderTemplate(env, templateStr, context) {
60
+ // Protect ${{ }} workflow expressions from Nunjucks
61
+ const escaped = templateStr.replace(/\$\{\{/g, WORKFLOW_EXPR_PLACEHOLDER);
62
+ const rendered = env.renderString(escaped, context);
63
+ return rendered.replace(new RegExp(escapeRegExp(WORKFLOW_EXPR_PLACEHOLDER), "g"), "${{");
69
64
  }
70
-
71
65
  /** Escape special regex characters in a string. */
72
- function escapeRegExp(s: string): string {
73
- return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
66
+ function escapeRegExp(s) {
67
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
74
68
  }
75
-
76
69
  /**
77
70
  * Render a named template file through Nunjucks.
78
71
  *
@@ -87,6 +80,7 @@ function escapeRegExp(s: string): string {
87
80
  * @param context - variables available in the template
88
81
  * @returns rendered string
89
82
  */
90
- export function renderTemplateFile(env: nunjucks.Environment, templateName: string, context: Record<string, unknown>): string {
91
- return env.render(templateName, context);
83
+ export function renderTemplateFile(env, templateName, context) {
84
+ return env.render(templateName, context);
92
85
  }
86
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,UAAmB;IACjE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IACrE,MAAM,iBAAiB,GAAG,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAE7F,8EAA8E;IAC9E,+DAA+D;IAC/D,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5D,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC;QAAE,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAE1E,oFAAoF;IACpF,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE/F,OAAO,IAAI,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE;QACvC,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,KAAK;KACvB,CAAC,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAC7B,GAAyB,EACzB,WAAmB,EACnB,OAAgC;IAEhC,oDAAoD;IACpD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;IAC1E,MAAM,QAAQ,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;AAC1F,CAAC;AAED,mDAAmD;AACnD,SAAS,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CACjC,GAAyB,EACzB,YAAoB,EACpB,OAAgC;IAEhC,OAAO,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { StepSpec, WorkflowSpec } from "./types.js";
2
+ /**
3
+ * Create a mock extension context for testing.
4
+ */
5
+ export declare function mockCtx(cwd: string): any;
6
+ /**
7
+ * Create a mock pi API for testing.
8
+ */
9
+ export declare function mockPi(): any;
10
+ /**
11
+ * Create a minimal WorkflowSpec for testing.
12
+ * A fresh temp directory is created for filePath.
13
+ */
14
+ export declare function makeSpec(overrides: Partial<WorkflowSpec> & {
15
+ steps: Record<string, StepSpec>;
16
+ }): WorkflowSpec;
17
+ //# sourceMappingURL=test-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../src/test-helpers.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEzD;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAS7B,GAAG,CACR;AAED;;GAEG;AACH,wBAAgB,MAAM,IAKhB,GAAG,CACR;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CAAE,GAAG,YAAY,CAU7G"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Shared test helpers — mock factories for ctx, pi, and workflow specs.
3
+ */
4
+ import fs from "node:fs";
5
+ import os from "node:os";
6
+ import path from "node:path";
7
+ /**
8
+ * Create a mock extension context for testing.
9
+ */
10
+ export function mockCtx(cwd) {
11
+ return {
12
+ cwd,
13
+ hasUI: false,
14
+ ui: {
15
+ setWidget: () => { },
16
+ notify: () => { },
17
+ setStatus: () => { },
18
+ },
19
+ };
20
+ }
21
+ /**
22
+ * Create a mock pi API for testing.
23
+ */
24
+ export function mockPi() {
25
+ const messages = [];
26
+ return {
27
+ sendMessage: (msg, opts) => messages.push({ msg, opts }),
28
+ _messages: messages,
29
+ };
30
+ }
31
+ /**
32
+ * Create a minimal WorkflowSpec for testing.
33
+ * A fresh temp directory is created for filePath.
34
+ */
35
+ export function makeSpec(overrides) {
36
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "wf-test-"));
37
+ return {
38
+ name: "test-workflow",
39
+ description: "Test workflow",
40
+ version: "1",
41
+ source: "project",
42
+ filePath: path.join(tmpDir, "test.workflow.yaml"),
43
+ ...overrides,
44
+ };
45
+ }
46
+ //# sourceMappingURL=test-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../src/test-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IAClC,OAAO;QACN,GAAG;QACH,KAAK,EAAE,KAAK;QACZ,EAAE,EAAE;YACH,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;YACnB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;YAChB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;SACnB;KACM,CAAC;AACV,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM;IACrB,MAAM,QAAQ,GAAU,EAAE,CAAC;IAC3B,OAAO;QACN,WAAW,EAAE,CAAC,GAAQ,EAAE,IAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;QAClE,SAAS,EAAE,QAAQ;KACZ,CAAC;AACV,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAsE;IAC9F,MAAM,MAAM,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IAClE,OAAO;QACN,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,eAAe;QAC5B,OAAO,EAAE,GAAG;QACZ,MAAM,EAAE,SAAkB;QAC1B,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,oBAAoB,CAAC;QACjD,GAAG,SAAS;KACZ,CAAC;AACH,CAAC"}
package/dist/tui.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * TUI progress widget for workflow execution.
3
+ * Shows step status, timing, cost, and parallel execution indicators.
4
+ */
5
+ import type { Theme } from "@mariozechner/pi-coding-agent";
6
+ import type { Component, TUI } from "@mariozechner/pi-tui";
7
+ import type { ExecutionState, WorkflowSpec } from "./types.js";
8
+ export interface StepActivity {
9
+ tool: string;
10
+ preview: string;
11
+ timestamp: number;
12
+ }
13
+ export interface StepOutputSummary {
14
+ tasks?: Array<{
15
+ name: string;
16
+ status: string;
17
+ files?: string[];
18
+ }>;
19
+ testCount?: number;
20
+ note?: string;
21
+ }
22
+ export interface ProgressWidgetState {
23
+ spec: WorkflowSpec;
24
+ state: ExecutionState;
25
+ currentStep?: string;
26
+ startTime: number;
27
+ parallelSubSteps?: Record<string, import("./types.js").StepResult>;
28
+ resumedSteps?: number;
29
+ activities: Map<string, StepActivity[]>;
30
+ outputSummaries: Map<string, StepOutputSummary>;
31
+ }
32
+ /**
33
+ * Create a widget factory for ctx.ui.setWidget().
34
+ * Returns a function that pi calls to get the component.
35
+ *
36
+ * The returned component renders a compact progress view:
37
+ * ─────────────────────────────────────
38
+ * ● bugfix step 2/3 1m32s
39
+ * ✓ diagnose 42s $0.03 12k tok
40
+ * ▸ fix 50s 8k tok...
41
+ * · verify
42
+ * ─────────────────────────────────────
43
+ */
44
+ export declare function createProgressWidget(widgetState: ProgressWidgetState): (tui: TUI, theme: Theme) => Component & {
45
+ dispose?(): void;
46
+ };
47
+ //# sourceMappingURL=tui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAc,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,cAAc,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,UAAU,CAAC,CAAC;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IACxC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,mBAAmB,GAC9B,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,KAAK,SAAS,GAAG;IAAE,OAAO,CAAC,IAAI,IAAI,CAAA;CAAE,CAuI9D"}
package/dist/tui.js ADDED
@@ -0,0 +1,143 @@
1
+ import { formatCost, formatDuration, formatTokens } from "./format.js";
2
+ /**
3
+ * Create a widget factory for ctx.ui.setWidget().
4
+ * Returns a function that pi calls to get the component.
5
+ *
6
+ * The returned component renders a compact progress view:
7
+ * ─────────────────────────────────────
8
+ * ● bugfix step 2/3 1m32s
9
+ * ✓ diagnose 42s $0.03 12k tok
10
+ * ▸ fix 50s 8k tok...
11
+ * · verify
12
+ * ─────────────────────────────────────
13
+ */
14
+ export function createProgressWidget(widgetState) {
15
+ return (tui, theme) => {
16
+ /** Pulse interval (ms) for the elapsed-time ticker. Balances update frequency vs overhead. */
17
+ const PULSE_INTERVAL_MS = 800;
18
+ let pulseOn = true;
19
+ const interval = setInterval(() => {
20
+ pulseOn = !pulseOn;
21
+ tui.requestRender();
22
+ }, PULSE_INTERVAL_MS);
23
+ return {
24
+ render(width) {
25
+ const lines = [];
26
+ const stepNames = Object.keys(widgetState.spec.steps);
27
+ const totalSteps = stepNames.length;
28
+ // Parse current steps (may be comma-separated for parallel)
29
+ const currentSteps = widgetState.currentStep?.split(", ") ?? [];
30
+ const parallelCount = currentSteps.length;
31
+ // Determine current step number
32
+ let currentStepNum = 0;
33
+ if (currentSteps.length > 0 && currentSteps[0]) {
34
+ const idx = stepNames.indexOf(currentSteps[0]);
35
+ currentStepNum = idx >= 0 ? idx + 1 : 0;
36
+ }
37
+ else {
38
+ // Count completed steps
39
+ currentStepNum = Object.values(widgetState.state.steps).filter((s) => s.status === "completed").length;
40
+ }
41
+ const elapsed = formatDuration(Date.now() - widgetState.startTime);
42
+ const workflowName = theme.bold(widgetState.spec.name);
43
+ const indicator = pulseOn ? theme.fg("accent", "\u25cf") : theme.fg("dim", "\u25cf");
44
+ const parallelTag = parallelCount > 1 ? ` [${parallelCount} parallel]` : "";
45
+ const headerLine = `${indicator} ${workflowName} step ${currentStepNum}/${totalSteps}${parallelTag} ${theme.fg("dim", elapsed)}`;
46
+ lines.push(headerLine.length > width ? headerLine.slice(0, width) : headerLine);
47
+ // Resumed indicator
48
+ if (widgetState.resumedSteps) {
49
+ const resumedLine = ` ${theme.fg("dim", "\u21bb")} Resumed: ${widgetState.resumedSteps} steps from prior run`;
50
+ lines.push(resumedLine.length > width ? resumedLine.slice(0, width) : resumedLine);
51
+ }
52
+ // Paused indicator
53
+ if (widgetState.state.status === "paused") {
54
+ const pausedLine = ` ${theme.fg("accent", "\u23f8")} Paused`;
55
+ lines.push(pausedLine.length > width ? pausedLine.slice(0, width) : pausedLine);
56
+ }
57
+ // Step lines
58
+ for (const stepName of stepNames) {
59
+ const stepResult = widgetState.state.steps[stepName];
60
+ let line;
61
+ if (stepResult && stepResult.status === "skipped") {
62
+ // Skipped step: ⊘ stepName [skipped]
63
+ line = ` ${theme.fg("dim", "\u2298")} ${stepName} ${theme.fg("dim", "[skipped]")}`;
64
+ }
65
+ else if (stepResult && stepResult.status === "completed") {
66
+ const dur = formatDuration(stepResult.durationMs);
67
+ const cost = formatCost(stepResult.usage.cost);
68
+ const tok = formatTokens(stepResult.usage.input + stepResult.usage.output);
69
+ // Show step type indicator for gate/transform
70
+ const typeTag = stepResult.agent === "gate" ? " [gate]" : stepResult.agent === "transform" ? " [transform]" : "";
71
+ const truncTag = stepResult.truncated ? ` ${theme.fg("warning", "[truncated]")}` : "";
72
+ line = ` ${theme.fg("success", "\u2713")} ${stepName}${typeTag} ${theme.fg("dim", dur)} ${theme.fg("dim", cost)} ${theme.fg("dim", tok)}${truncTag}`;
73
+ lines.push(line.length > width ? line.slice(0, width) : line);
74
+ // Render output summary sub-lines (capped at 3)
75
+ const summary = widgetState.outputSummaries?.get(stepName);
76
+ if (summary) {
77
+ let summaryLines = 0;
78
+ const MAX_SUMMARY_LINES = 3;
79
+ if (summary.tasks) {
80
+ for (const task of summary.tasks) {
81
+ if (summaryLines >= MAX_SUMMARY_LINES)
82
+ break;
83
+ const files = task.files?.join(", ") || "";
84
+ const statusIcon = task.status === "done" ? "\u2713" : task.status === "failed" ? "\u2717" : "\u00b7";
85
+ const taskLine = ` ${theme.fg("dim", statusIcon)} ${theme.fg("dim", task.name)}${files ? " " + theme.fg("dim", files) : ""}`;
86
+ lines.push(taskLine.length > width ? taskLine.slice(0, width) : taskLine);
87
+ summaryLines++;
88
+ }
89
+ }
90
+ if (summary.testCount && summaryLines < MAX_SUMMARY_LINES) {
91
+ const testLine = ` ${theme.fg("dim", `${summary.testCount} tests pass`)}`;
92
+ lines.push(testLine.length > width ? testLine.slice(0, width) : testLine);
93
+ summaryLines++;
94
+ }
95
+ if (summary.note && summaryLines < MAX_SUMMARY_LINES) {
96
+ const noteLine = ` ${theme.fg("dim", summary.note)}`;
97
+ lines.push(noteLine.length > width ? noteLine.slice(0, width) : noteLine);
98
+ }
99
+ }
100
+ continue; // skip the push below, already pushed
101
+ }
102
+ else if (stepResult && stepResult.status === "failed") {
103
+ const dur = formatDuration(stepResult.durationMs);
104
+ const errorPreview = stepResult.error || "Unknown error";
105
+ line = ` ${theme.fg("error", "\u2717")} ${stepName} ${theme.fg("dim", dur)} ${errorPreview}`;
106
+ }
107
+ else if (stepResult && stepResult.agent === "parallel") {
108
+ // Completed parallel step — show with sub-step count
109
+ const dur = formatDuration(stepResult.durationMs);
110
+ const cost = formatCost(stepResult.usage.cost);
111
+ const tok = formatTokens(stepResult.usage.input + stepResult.usage.output);
112
+ line = ` ${theme.fg("success", "\u2713")} ${stepName} [parallel] ${theme.fg("dim", dur)} ${theme.fg("dim", cost)} ${theme.fg("dim", tok)}`;
113
+ }
114
+ else if (currentSteps.includes(stepName)) {
115
+ const stepElapsed = formatDuration(Date.now() - widgetState.startTime);
116
+ line = ` ${theme.fg("accent", "\u25b8")} ${theme.fg("accent", stepName)} ${theme.fg("dim", stepElapsed + "...")}`;
117
+ lines.push(line.length > width ? line.slice(0, width) : line);
118
+ // Render most recent tool activity under running step
119
+ const activities = widgetState.activities?.get(stepName);
120
+ if (activities && activities.length > 0) {
121
+ const latest = activities[activities.length - 1];
122
+ const actLine = ` ${theme.fg("dim", latest.tool)} ${theme.fg("dim", latest.preview)}`;
123
+ lines.push(actLine.length > width ? actLine.slice(0, width) : actLine);
124
+ }
125
+ continue; // skip the push below, already pushed
126
+ }
127
+ else {
128
+ line = ` ${theme.fg("dim", "\u00b7")} ${stepName}`;
129
+ }
130
+ lines.push(line.length > width ? line.slice(0, width) : line);
131
+ }
132
+ return lines;
133
+ },
134
+ invalidate() {
135
+ /* no cached state to clear */
136
+ },
137
+ dispose() {
138
+ clearInterval(interval);
139
+ },
140
+ };
141
+ };
142
+ }
143
+ //# sourceMappingURL=tui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tui.js","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA0BvE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CACnC,WAAgC;IAEhC,OAAO,CAAC,GAAQ,EAAE,KAAY,EAAE,EAAE;QACjC,8FAA8F;QAC9F,MAAM,iBAAiB,GAAG,GAAG,CAAC;QAC9B,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;YACjC,OAAO,GAAG,CAAC,OAAO,CAAC;YACnB,GAAG,CAAC,aAAa,EAAE,CAAC;QACrB,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAEtB,OAAO;YACN,MAAM,CAAC,KAAa;gBACnB,MAAM,KAAK,GAAa,EAAE,CAAC;gBAC3B,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtD,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC;gBAEpC,4DAA4D;gBAC5D,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAChE,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC;gBAE1C,gCAAgC;gBAChC,IAAI,cAAc,GAAG,CAAC,CAAC;gBACvB,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;oBAChD,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC/C,cAAc,GAAG,GAAG,IAA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,CAAC,CAAC,OAAO,CAAC,CAAC;wBACxE,CAAC;wBACD,SAAS,CAAC,sCAAsC;oBACjD,CAAC;yBAAM,CAAC;wBACP,IAAI,GAAG,KAAK,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,QAAQ,EAAE,CAAC;oBACrD,CAAC;oBAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC/D,CAAC;gBAED,OAAO,KAAK,CAAC;YACd,CAAC;YACD,UAAU;gBACT,8BAA8B;YAC/B,CAAC;YACD,OAAO;gBACN,aAAa,CAAC,QAAQ,CAAC,CAAC;YACzB,CAAC;SACD,CAAC;IACH,CAAC,CAAC;AACH,CAAC"}
@@ -0,0 +1,164 @@
1
+ export interface WorkflowSpec {
2
+ name: string;
3
+ description: string;
4
+ version?: string;
5
+ input?: Record<string, unknown>;
6
+ output?: Record<string, unknown>;
7
+ triggerTurn?: boolean;
8
+ completion?: CompletionSpec;
9
+ steps: Record<string, StepSpec>;
10
+ artifacts?: Record<string, ArtifactSpec>;
11
+ source: "user" | "project";
12
+ filePath: string;
13
+ }
14
+ export interface ArtifactSpec {
15
+ path: string;
16
+ from: string;
17
+ schema?: string;
18
+ }
19
+ export interface RetryConfig {
20
+ maxAttempts?: number;
21
+ onExhausted?: "fail" | "skip";
22
+ steeringMessage?: string;
23
+ }
24
+ export interface StepSpec {
25
+ agent?: string;
26
+ model?: string;
27
+ input?: Record<string, unknown>;
28
+ output?: StepOutputSpec;
29
+ when?: string;
30
+ timeout?: {
31
+ seconds: number;
32
+ };
33
+ retry?: RetryConfig;
34
+ loop?: LoopSpec;
35
+ gate?: GateSpec;
36
+ transform?: TransformSpec;
37
+ parallel?: Record<string, StepSpec>;
38
+ pause?: string | boolean;
39
+ monitor?: string;
40
+ command?: string;
41
+ forEach?: string;
42
+ as?: string;
43
+ workflow?: string;
44
+ }
45
+ export interface LoopSpec {
46
+ maxAttempts: number;
47
+ attempts?: string;
48
+ steps: Record<string, StepSpec>;
49
+ onExhausted?: StepSpec;
50
+ }
51
+ export interface GateSpec {
52
+ check: string;
53
+ onPass?: "continue" | "break";
54
+ onFail?: "continue" | "break" | "fail";
55
+ }
56
+ export interface TransformSpec {
57
+ /**
58
+ * A mapping of output field names to ${{ }} expressions.
59
+ * The result is an object with each field resolved.
60
+ * No LLM invocation — pure data transformation.
61
+ */
62
+ mapping: Record<string, unknown>;
63
+ }
64
+ export interface StepOutputSpec {
65
+ format?: "json" | "text";
66
+ schema?: string;
67
+ path?: string;
68
+ }
69
+ export interface AgentSpec {
70
+ name: string;
71
+ description?: string;
72
+ role?: string;
73
+ systemPrompt?: string;
74
+ promptTemplate?: string;
75
+ taskTemplate?: string;
76
+ model?: string;
77
+ thinking?: string;
78
+ tools?: string[];
79
+ extensions?: string[];
80
+ skills?: string[];
81
+ output?: string;
82
+ inputSchema?: Record<string, unknown>;
83
+ outputFormat?: "json" | "text";
84
+ outputSchema?: string;
85
+ }
86
+ export interface ExecutionState {
87
+ input: unknown;
88
+ steps: Record<string, StepResult>;
89
+ status: "running" | "completed" | "failed" | "paused";
90
+ loop?: LoopState;
91
+ workflowName?: string;
92
+ specVersion?: string;
93
+ startedAt?: string;
94
+ updatedAt?: string;
95
+ }
96
+ export interface LoopState {
97
+ stepName: string;
98
+ iteration: number;
99
+ maxAttempts: number;
100
+ priorAttempts: LoopAttempt[];
101
+ }
102
+ export interface LoopAttempt {
103
+ iteration: number;
104
+ steps: Record<string, StepResult>;
105
+ }
106
+ export interface StepResult {
107
+ step: string;
108
+ agent: string;
109
+ status: "completed" | "failed" | "skipped";
110
+ output?: unknown;
111
+ textOutput?: string;
112
+ outputPath?: string;
113
+ sessionLog?: string;
114
+ usage: StepUsage;
115
+ durationMs: number;
116
+ error?: string;
117
+ truncated?: boolean;
118
+ warnings?: string[];
119
+ attempt?: number;
120
+ totalAttempts?: number;
121
+ priorErrors?: string[];
122
+ }
123
+ export interface StepUsage {
124
+ input: number;
125
+ output: number;
126
+ cacheRead: number;
127
+ cacheWrite: number;
128
+ cost: number;
129
+ turns: number;
130
+ }
131
+ export interface WorkflowResult {
132
+ workflow: string;
133
+ runId: string;
134
+ status: "completed" | "failed" | "paused";
135
+ steps: Record<string, StepResult>;
136
+ output?: unknown;
137
+ totalUsage: StepUsage;
138
+ totalDurationMs: number;
139
+ runDir: string;
140
+ artifacts?: Record<string, string>;
141
+ }
142
+ export interface CompletionSpec {
143
+ message?: string;
144
+ include?: string[];
145
+ template?: string;
146
+ }
147
+ export interface ExpressionScope {
148
+ input: unknown;
149
+ steps: Record<string, StepResult>;
150
+ [key: string]: unknown;
151
+ }
152
+ export interface CompletionScope {
153
+ input: unknown;
154
+ steps: Record<string, StepResult>;
155
+ totalUsage: StepUsage;
156
+ totalDurationMs: number;
157
+ runDir: string;
158
+ runId: string;
159
+ workflow: string;
160
+ status: "completed" | "failed";
161
+ output?: unknown;
162
+ [key: string]: unknown;
163
+ }
164
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC,MA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ADDED
@@ -0,0 +1,3 @@
1
+ // ── Workflow Spec (parsed from YAML) ──
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,yCAAyC"}
@@ -0,0 +1,23 @@
1
+ import type { WorkflowSpec } from "./types.js";
2
+ /**
3
+ * Discover all workflow specs from project, user, and builtin directories.
4
+ *
5
+ * Scans (highest priority first):
6
+ * 1. .workflows/ (project-level, source: "project")
7
+ * 2. ~/.pi/agent/workflows/ (user-level, source: "user")
8
+ * 3. <package>/workflows/ (builtin workflows, source: "user")
9
+ *
10
+ * Higher-priority specs shadow lower-priority specs with the same name.
11
+ *
12
+ * @param cwd - current working directory (project root)
13
+ * @param builtinDir - optional path to builtin workflows (defaults to workflows/ relative to package root)
14
+ * @returns Array of parsed WorkflowSpec objects. Specs that fail parsing are
15
+ * skipped with a warning (logged to stderr), not thrown.
16
+ */
17
+ export declare function discoverWorkflows(cwd: string, builtinDir?: string): WorkflowSpec[];
18
+ /**
19
+ * Find a workflow by name from discovered workflows.
20
+ * Returns undefined if not found.
21
+ */
22
+ export declare function findWorkflow(name: string, cwd: string, builtinDir?: string): WorkflowSpec | undefined;
23
+ //# sourceMappingURL=workflow-discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-discovery.d.ts","sourceRoot":"","sources":["../src/workflow-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CA0BlF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAGrG"}