@osolmaz/pi-workflows 0.9.0 → 0.10.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 (78) hide show
  1. package/README.md +50 -16
  2. package/dist/builtins/autodevise.workflow.d.ts +58 -0
  3. package/dist/builtins/autodevise.workflow.js +190 -0
  4. package/dist/builtins/autodevise.workflow.js.map +1 -0
  5. package/dist/builtins/autoimplement.workflow.d.ts +154 -0
  6. package/dist/builtins/autoimplement.workflow.js +729 -0
  7. package/dist/builtins/autoimplement.workflow.js.map +1 -0
  8. package/dist/builtins/catalog.js +5 -1
  9. package/dist/builtins/catalog.js.map +1 -1
  10. package/dist/builtins/index.d.ts +3 -0
  11. package/dist/builtins/index.js +4 -0
  12. package/dist/builtins/index.js.map +1 -0
  13. package/dist/builtins/monitor.workflow.d.ts +25 -3
  14. package/dist/builtins/monitor.workflow.js +200 -13
  15. package/dist/builtins/monitor.workflow.js.map +1 -1
  16. package/dist/extension/herdr-viewer.js +2 -6
  17. package/dist/extension/herdr-viewer.js.map +1 -1
  18. package/dist/render/graph-render.js +13 -2
  19. package/dist/render/graph-render.js.map +1 -1
  20. package/dist/workflows/catalog.d.ts +1 -0
  21. package/dist/workflows/catalog.js +6 -0
  22. package/dist/workflows/catalog.js.map +1 -1
  23. package/dist/workflows/composition.d.ts +45 -0
  24. package/dist/workflows/composition.js +471 -0
  25. package/dist/workflows/composition.js.map +1 -0
  26. package/dist/workflows/decision.d.ts +11 -5
  27. package/dist/workflows/decision.js.map +1 -1
  28. package/dist/workflows/definition.d.ts +22 -3
  29. package/dist/workflows/definition.js +46 -3
  30. package/dist/workflows/definition.js.map +1 -1
  31. package/dist/workflows/engine.js +115 -16
  32. package/dist/workflows/engine.js.map +1 -1
  33. package/dist/workflows/graph.js +8 -6
  34. package/dist/workflows/graph.js.map +1 -1
  35. package/dist/workflows/index.d.ts +3 -2
  36. package/dist/workflows/index.js +2 -1
  37. package/dist/workflows/index.js.map +1 -1
  38. package/dist/workflows/loader.d.ts +5 -4
  39. package/dist/workflows/loader.js +118 -18
  40. package/dist/workflows/loader.js.map +1 -1
  41. package/dist/workflows/schema.d.ts +3 -1
  42. package/dist/workflows/schema.js +49 -2
  43. package/dist/workflows/schema.js.map +1 -1
  44. package/dist/workflows/store.js +32 -2
  45. package/dist/workflows/store.js.map +1 -1
  46. package/dist/workflows/types.d.ts +77 -2
  47. package/docs/CONTROLLERS.md +1 -1
  48. package/docs/DESIGN_PHILOSOPHY.md +1 -1
  49. package/docs/MONITOR.md +35 -18
  50. package/docs/WORKFLOW_COMPOSITION.md +326 -0
  51. package/docs/plans/2026-08-19-workflow-composition-plan.md +300 -0
  52. package/docs/run-bundles.md +24 -10
  53. package/docs/workflows.md +65 -12
  54. package/examples/workflows/autodevise.workflow.ts +1 -0
  55. package/examples/workflows/autoimplement.workflow.ts +1 -92
  56. package/herdr-plugin.toml +1 -1
  57. package/package.json +5 -1
  58. package/skills/monitor/SKILL.md +6 -1
  59. package/skills/pi-workflows/SKILL.md +3 -1
  60. package/src/builtins/autodevise.workflow.ts +231 -0
  61. package/src/builtins/autoimplement.workflow.ts +856 -0
  62. package/src/builtins/catalog.ts +5 -1
  63. package/src/builtins/index.ts +13 -0
  64. package/src/builtins/monitor.workflow.ts +242 -15
  65. package/src/extension/herdr-viewer.ts +1 -6
  66. package/src/render/graph-render.ts +14 -2
  67. package/src/workflows/catalog.ts +7 -0
  68. package/src/workflows/composition.ts +627 -0
  69. package/src/workflows/decision.ts +12 -5
  70. package/src/workflows/definition.ts +118 -8
  71. package/src/workflows/engine.ts +151 -18
  72. package/src/workflows/graph.ts +8 -6
  73. package/src/workflows/index.ts +20 -0
  74. package/src/workflows/loader.ts +186 -18
  75. package/src/workflows/schema.ts +62 -2
  76. package/src/workflows/store.ts +37 -2
  77. package/src/workflows/types.ts +109 -2
  78. package/examples/workflows/elegant-solution.workflow.ts +0 -95
@@ -1,95 +0,0 @@
1
- import { agent, checkpoint, decision, decisionEdge, defineWorkflow } from "@osolmaz/pi-workflows";
2
-
3
- const sameChoices = ["y", "n"] as const;
4
-
5
- /**
6
- * Trigger this mid-conversation with /workflow elegant-solution once a
7
- * problem has been discussed. It makes the model commit to the most elegant
8
- * long-term production-ready solution, articulate the holy grail, and check
9
- * whether the two match before implementing.
10
- */
11
- export default defineWorkflow({
12
- name: "elegant-solution",
13
- title: "Elegant production-ready solution",
14
- presentationPrompt: ({ state }) =>
15
- state.status === "waiting"
16
- ? [
17
- "Explain the elegant proposal, the holy grail, the important gap, and the pragmatic path in plain language.",
18
- "End by asking the user whether to implement the pragmatic path.",
19
- `Proposal: ${JSON.stringify(state.outputs.propose)}`,
20
- `Holy grail: ${JSON.stringify(state.outputs.holy_grail)}`,
21
- ].join("\n")
22
- : "Summarize what was implemented, what was tested, and what still needs verification.",
23
- startAt: "propose",
24
- nodes: {
25
- propose: agent({
26
- prompt: () =>
27
- [
28
- "Consider the problem discussed so far in this conversation.",
29
- "What is the most elegant and long-term production-ready solution?",
30
- "Think it through and commit to one concrete proposal.",
31
- ].join("\n"),
32
- expectedOutput: `{ "solution": "the proposed solution", "rationale": "why it is the most elegant long-term choice" }`,
33
- }),
34
- holy_grail: agent({
35
- prompt: () =>
36
- [
37
- "Now set your previous proposal aside for a moment.",
38
- "What is the holy grail for this problem?",
39
- "Describe the ideal end state with no constraints on effort.",
40
- ].join("\n"),
41
- expectedOutput: `{ "holyGrail": "the ideal end state" }`,
42
- }),
43
- compare: decision({
44
- choices: sameChoices,
45
- question: ({ outputs }) =>
46
- [
47
- "Is the holy grail the same as what you proposed? Answer y or n.",
48
- "",
49
- `Proposal: ${JSON.stringify(outputs.propose)}`,
50
- `Holy grail: ${JSON.stringify(outputs.holy_grail)}`,
51
- ].join("\n"),
52
- }),
53
- implement: agent({
54
- timeoutMs: 60 * 60_000,
55
- statusDetail: "implementing",
56
- prompt: ({ outputs }) =>
57
- [
58
- "The proposal matches the holy grail, so implement it now.",
59
- "Implement the most elegant and long-term production-ready solution end-to-end.",
60
- "Test as much as possible without destructive actions, and state what could not be verified locally.",
61
- "",
62
- `Proposal: ${JSON.stringify(outputs.propose)}`,
63
- ].join("\n"),
64
- expectedOutput: `{ "implemented": true, "summary": "what was built", "tested": "what was verified", "untested": "what still needs verification" }`,
65
- }),
66
- reconcile: agent({
67
- prompt: ({ outputs }) =>
68
- [
69
- "The proposal and the holy grail differ.",
70
- "Explain the gap and propose the pragmatic path: what to build now and how it evolves toward the holy grail.",
71
- "",
72
- `Proposal: ${JSON.stringify(outputs.propose)}`,
73
- `Holy grail: ${JSON.stringify(outputs.holy_grail)}`,
74
- ].join("\n"),
75
- expectedOutput: `{ "gap": "how they differ", "path": "what to build now and how it evolves" }`,
76
- }),
77
- review: checkpoint({
78
- summary: "human decides between proposal and holy grail path",
79
- run: ({ outputs }) => outputs.reconcile,
80
- }),
81
- },
82
- edges: [
83
- { from: "propose", to: "holy_grail" },
84
- { from: "holy_grail", to: "compare" },
85
- decisionEdge({
86
- from: "compare",
87
- choices: sameChoices,
88
- cases: {
89
- y: "implement",
90
- n: "reconcile",
91
- },
92
- }),
93
- { from: "reconcile", to: "review" },
94
- ],
95
- });