@osolmaz/pi-workflows 0.9.1 → 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 (75) 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/render/graph-render.js +13 -2
  17. package/dist/render/graph-render.js.map +1 -1
  18. package/dist/workflows/catalog.d.ts +1 -0
  19. package/dist/workflows/catalog.js +6 -0
  20. package/dist/workflows/catalog.js.map +1 -1
  21. package/dist/workflows/composition.d.ts +45 -0
  22. package/dist/workflows/composition.js +471 -0
  23. package/dist/workflows/composition.js.map +1 -0
  24. package/dist/workflows/decision.d.ts +11 -5
  25. package/dist/workflows/decision.js.map +1 -1
  26. package/dist/workflows/definition.d.ts +22 -3
  27. package/dist/workflows/definition.js +46 -3
  28. package/dist/workflows/definition.js.map +1 -1
  29. package/dist/workflows/engine.js +115 -16
  30. package/dist/workflows/engine.js.map +1 -1
  31. package/dist/workflows/graph.js +8 -6
  32. package/dist/workflows/graph.js.map +1 -1
  33. package/dist/workflows/index.d.ts +3 -2
  34. package/dist/workflows/index.js +2 -1
  35. package/dist/workflows/index.js.map +1 -1
  36. package/dist/workflows/loader.d.ts +5 -4
  37. package/dist/workflows/loader.js +118 -18
  38. package/dist/workflows/loader.js.map +1 -1
  39. package/dist/workflows/schema.d.ts +3 -1
  40. package/dist/workflows/schema.js +49 -2
  41. package/dist/workflows/schema.js.map +1 -1
  42. package/dist/workflows/store.js +32 -2
  43. package/dist/workflows/store.js.map +1 -1
  44. package/dist/workflows/types.d.ts +77 -2
  45. package/docs/CONTROLLERS.md +1 -1
  46. package/docs/DESIGN_PHILOSOPHY.md +1 -1
  47. package/docs/MONITOR.md +35 -18
  48. package/docs/WORKFLOW_COMPOSITION.md +326 -0
  49. package/docs/plans/2026-08-19-workflow-composition-plan.md +300 -0
  50. package/docs/run-bundles.md +24 -10
  51. package/docs/workflows.md +65 -12
  52. package/examples/workflows/autodevise.workflow.ts +1 -0
  53. package/examples/workflows/autoimplement.workflow.ts +1 -92
  54. package/herdr-plugin.toml +1 -1
  55. package/package.json +5 -1
  56. package/skills/monitor/SKILL.md +6 -1
  57. package/skills/pi-workflows/SKILL.md +3 -1
  58. package/src/builtins/autodevise.workflow.ts +231 -0
  59. package/src/builtins/autoimplement.workflow.ts +856 -0
  60. package/src/builtins/catalog.ts +5 -1
  61. package/src/builtins/index.ts +13 -0
  62. package/src/builtins/monitor.workflow.ts +242 -15
  63. package/src/render/graph-render.ts +14 -2
  64. package/src/workflows/catalog.ts +7 -0
  65. package/src/workflows/composition.ts +627 -0
  66. package/src/workflows/decision.ts +12 -5
  67. package/src/workflows/definition.ts +118 -8
  68. package/src/workflows/engine.ts +151 -18
  69. package/src/workflows/graph.ts +8 -6
  70. package/src/workflows/index.ts +20 -0
  71. package/src/workflows/loader.ts +186 -18
  72. package/src/workflows/schema.ts +62 -2
  73. package/src/workflows/store.ts +37 -2
  74. package/src/workflows/types.ts +109 -2
  75. package/examples/workflows/elegant-solution.workflow.ts +0 -95
package/README.md CHANGED
@@ -139,6 +139,37 @@ structured run ends to request one normal, human-readable assistant response.
139
139
  Workflows without it remain silent after their final structured output, which
140
140
  keeps shell-only and machine-consumed workflows model-free.
141
141
 
142
+ ## Compose workflows
143
+
144
+ A workflow can import another workflow and connect its named exits without copying its nodes:
145
+
146
+ ```typescript
147
+ import { compute, defineWorkflow, includeWorkflow } from "@osolmaz/pi-workflows";
148
+ import autodevise from "./autodevise.workflow.js";
149
+
150
+ export default defineWorkflow({
151
+ source: import.meta.url,
152
+ name: "parent",
153
+ startAt: "start",
154
+ includes: {
155
+ design: includeWorkflow(autodevise, {
156
+ input: ({ outputs }) => ({ problem: String(outputs.start) }),
157
+ }),
158
+ },
159
+ nodes: {
160
+ start: compute({ run: () => "Fix the reported defect" }),
161
+ finish: compute({ run: ({ outputs }) => outputs.design }),
162
+ },
163
+ edges: [
164
+ { from: "start", to: "design" },
165
+ { from: "design.ready", to: "finish" },
166
+ { from: "design.blocked", to: "finish" },
167
+ ],
168
+ });
169
+ ```
170
+
171
+ Direct imports check child input and exit names in TypeScript. Names and paths remain available for dynamic discovery. Nested children share one run, trace, pause state, and cancellation state. See [Workflow composition](docs/WORKFLOW_COMPOSITION.md) for the complete contract.
172
+
142
173
  ## Agent-managed workflows
143
174
 
144
175
  The model can use the same `workflow` tool to list, start, inspect, pause,
@@ -151,10 +182,10 @@ Pi Workflows includes a `monitor` workflow for plain-language requests such as:
151
182
 
152
183
  The monitor checks immediately, reports only the states requested by the user,
153
184
  waits with a normal shell action, and loops until its stop condition or check
154
- limit. Its input supports `task`, `everyMinutes`, `reportWhen`, `stopWhen`,
155
- `maxChecks`, and an optional `checkTimeoutMinutes`. Project and global
156
- workflows can replace the built-in `monitor`
157
- by using the same file name.
185
+ limit. Its input supports `task`, `everyMinutes`, `stopWhen`, `maxChecks`, and
186
+ an optional `checkTimeoutMinutes`.
187
+
188
+ Monitor is observation-only by default. An explicit `repair` policy authorizes its composed `autodevise` and `autoimplement` path. The monitor checks the target again after repair and stops when the same issue and target evidence return without progress. Project and global workflows can replace the built-in `monitor` by using the same file name.
158
189
 
159
190
  A monitor occupies the session's one active workflow slot. If its Pi runner
160
191
  stops during the shell wait, the run parks and repeats that wait node when a
@@ -162,13 +193,12 @@ runner resumes it.
162
193
 
163
194
  Because the workflow runs in your current conversation, you can have a long
164
195
  discussion first and then trigger a workflow that builds on it. The
165
- `elegant-solution` example does exactly that. It asks the model for the most
166
- elegant long-term production-ready solution to the problem you discussed, then
167
- for the holy grail, then whether the two are the same (y/n). On `y` it routes
168
- straight into implementation, and on `n` it asks the model to reconcile the
169
- gap and pauses at a checkpoint for you to decide. In either case, its
170
- `presentationPrompt` turns the final structured result into a plain assistant
171
- response.
196
+ `autodevise` example does exactly that. It frames the problem and scope, devises
197
+ an elegant production-ready solution, and compares it with the holy grail. It
198
+ then selects the best practical in-scope solution without asking the user to
199
+ resolve the gap. The ideal can win when it is feasible, but work outside the
200
+ current authority cannot block a valid practical solution. The workflow ends
201
+ with a detailed implementation plan.
172
202
 
173
203
  ## Watching a run
174
204
 
@@ -183,7 +213,7 @@ pi-workflows view --once # print a snapshot and exit (good for scripts)
183
213
  ```
184
214
 
185
215
  The run detail view draws the workflow as a boxed graph, like the acpx replay
186
- viewer. Every card has a centered step-name header and a divider above its
216
+ viewer. Included nodes use hierarchical labels such as `implementation › redesign › plan`. Every card has a centered step-name header and a divider above its
187
217
  structured metadata. Border characters keep the graph background, the body
188
218
  surface begins inside the border, and the header interior uses a separate
189
219
  surface. Node type, status, attempts, and timing use compact symbol rows; start
@@ -302,10 +332,14 @@ example set. Copy any of them into `.pi/workflows/` to use them:
302
332
  while they run.
303
333
  - `two-turn` chains three agent steps that build on each other's outputs in
304
334
  the same conversation.
305
- - `elegant-solution` is the mid-conversation trigger described above.
306
- - `autoimplement` runs an implement, verify, review loop where the review
307
- decision routes `issues_found` back to a fix step until it comes back
308
- `clean`, bounded by `maxSteps`.
335
+ - `autodevise` turns the current problem into a chosen practical solution and
336
+ a detailed implementation plan, using the ideal end state as guidance rather
337
+ than an out-of-scope requirement.
338
+ - `autoimplement` implements and verifies a plan, writes and runs the exact Pi
339
+ Reviewer command, tracks P0 through P2, handles PR comments and CI, and
340
+ finalizes the PR. P0 and P1 fixes require another review. P2-only work is
341
+ verified without another reviewer round. A five-minute CI wait routes to
342
+ additional useful local testing.
309
343
  - `autoresearch` runs an iterative feature-search loop in the style of
310
344
  [karpathy/autoresearch](https://github.com/karpathy/autoresearch): setup
311
345
  creates a frozen evaluation harness, one editable feature file, and a
@@ -0,0 +1,58 @@
1
+ export type AutodeviseInput = {
2
+ problem: string;
3
+ scope?: string;
4
+ constraints?: string[];
5
+ previousPlan?: unknown;
6
+ newEvidence?: unknown;
7
+ };
8
+ export type AutodeviseReady = {
9
+ status: "ready";
10
+ frame: unknown;
11
+ proposal: unknown;
12
+ ideal: unknown;
13
+ selection: unknown;
14
+ plan: unknown;
15
+ planDigest: string;
16
+ previousPlanDigest?: string;
17
+ changed: boolean;
18
+ };
19
+ export type AutodeviseBlocked = {
20
+ status: "blocked";
21
+ frame: unknown;
22
+ proposal: unknown;
23
+ ideal: unknown;
24
+ selection: unknown;
25
+ reason: string;
26
+ };
27
+ export declare const autodeviseWorkflow: import("../workflows/types.js").WorkflowDefinition<AutodeviseInput, {
28
+ readonly ready: {
29
+ readonly from: "finalize";
30
+ readonly validate: (value: unknown) => AutodeviseReady;
31
+ };
32
+ readonly blocked: {
33
+ readonly from: "blocked";
34
+ readonly validate: (value: unknown) => AutodeviseBlocked;
35
+ };
36
+ }, import("../workflows/types.js").WorkflowIncludeMap> & {
37
+ nodes: {
38
+ readonly frame: import("../workflows/types.js").AgentNodeDefinition;
39
+ readonly propose: import("../workflows/types.js").AgentNodeDefinition;
40
+ readonly ideal: import("../workflows/types.js").AgentNodeDefinition;
41
+ readonly choose: import("../workflows/types.js").AgentNodeDefinition;
42
+ readonly plan: import("../workflows/types.js").AgentNodeDefinition;
43
+ readonly blocked: import("../workflows/types.js").ComputeNodeDefinition;
44
+ readonly finalize: import("../workflows/types.js").ComputeNodeDefinition;
45
+ };
46
+ includes?: import("../workflows/types.js").WorkflowIncludeMap;
47
+ exits?: {
48
+ readonly ready: {
49
+ readonly from: "finalize";
50
+ readonly validate: (value: unknown) => AutodeviseReady;
51
+ };
52
+ readonly blocked: {
53
+ readonly from: "blocked";
54
+ readonly validate: (value: unknown) => AutodeviseBlocked;
55
+ };
56
+ };
57
+ };
58
+ export default autodeviseWorkflow;
@@ -0,0 +1,190 @@
1
+ import { createHash } from "node:crypto";
2
+ import { agent, compute, defineWorkflow } from "../workflows/definition.js";
3
+ function requireRecord(value, label) {
4
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
5
+ throw new Error(`${label} must be an object`);
6
+ }
7
+ return value;
8
+ }
9
+ function requireString(value, label) {
10
+ if (typeof value !== "string" || value.trim().length === 0) {
11
+ throw new Error(`${label} must be a non-empty string`);
12
+ }
13
+ return value.trim();
14
+ }
15
+ function parseInput(value) {
16
+ const input = requireRecord(value, "autodevise input");
17
+ const constraints = input.constraints;
18
+ if (constraints !== undefined &&
19
+ (!Array.isArray(constraints) || constraints.some((item) => typeof item !== "string"))) {
20
+ throw new Error("autodevise constraints must be an array of strings");
21
+ }
22
+ return {
23
+ problem: requireString(input.problem, "autodevise problem"),
24
+ ...(input.scope !== undefined ? { scope: requireString(input.scope, "autodevise scope") } : {}),
25
+ ...(constraints !== undefined ? { constraints: [...constraints] } : {}),
26
+ ...(input.previousPlan !== undefined ? { previousPlan: input.previousPlan } : {}),
27
+ ...(input.newEvidence !== undefined ? { newEvidence: input.newEvidence } : {}),
28
+ };
29
+ }
30
+ function parseSelection(value) {
31
+ const selection = requireRecord(value, "autodevise selection");
32
+ if (selection.status !== "ready" && selection.status !== "blocked") {
33
+ throw new Error("autodevise selection status must be ready or blocked");
34
+ }
35
+ requireString(selection.selected, "autodevise selected solution");
36
+ requireString(selection.why, "autodevise selection reason");
37
+ if (selection.status === "blocked")
38
+ requireString(selection.blocker, "autodevise blocker");
39
+ return selection;
40
+ }
41
+ function digest(value) {
42
+ return `sha256:${createHash("sha256").update(JSON.stringify(value)).digest("hex")}`;
43
+ }
44
+ export const autodeviseWorkflow = defineWorkflow({
45
+ source: import.meta.url,
46
+ contractId: "pi-workflows.autodevise.v1",
47
+ name: "autodevise",
48
+ input: parseInput,
49
+ title: ({ input }) => `autodevise: ${input.problem.slice(0, 60)}`,
50
+ presentationPrompt: [
51
+ "Present the selected practical solution and its implementation plan.",
52
+ "Briefly state how the ideal informed the choice and what was excluded as outside scope.",
53
+ "Do not ask the user to choose between the options.",
54
+ ].join("\n"),
55
+ startAt: "frame",
56
+ maxSteps: 10,
57
+ exits: {
58
+ ready: {
59
+ from: "finalize",
60
+ validate: (value) => value,
61
+ },
62
+ blocked: {
63
+ from: "blocked",
64
+ validate: (value) => value,
65
+ },
66
+ },
67
+ nodes: {
68
+ frame: agent({
69
+ statusDetail: "framing the problem",
70
+ prompt: ({ input }) => {
71
+ const request = input;
72
+ return [
73
+ `Frame this problem: ${request.problem}`,
74
+ `Authorized scope: ${request.scope ?? "infer it conservatively from the request and current project"}.`,
75
+ `Constraints: ${JSON.stringify(request.constraints ?? [])}.`,
76
+ `Previous plan: ${JSON.stringify(request.previousPlan ?? null)}.`,
77
+ `New evidence: ${JSON.stringify(request.newEvidence ?? null)}.`,
78
+ "Identify the goal, observable success criteria, systems in scope, systems outside scope, and interfaces we control.",
79
+ "Do not invent permission to change an upstream project, external service, or unrelated repository.",
80
+ ].join("\n");
81
+ },
82
+ expectedOutput: `{ "problem": "concise statement", "success": ["criterion"], "inScope": ["change"], "outOfScope": ["change"], "constraints": ["constraint"], "controlBoundary": "what can change" }`,
83
+ validate: (value) => requireRecord(value, "autodevise frame"),
84
+ }),
85
+ propose: agent({
86
+ statusDetail: "devising a solution",
87
+ prompt: ({ outputs }) => [
88
+ "Devise the most elegant, long-term production-ready solution within the framed scope.",
89
+ "Prefer a small number of general parts, clear ownership boundaries, and existing public interfaces.",
90
+ "Avoid one-off mechanisms and unnecessary infrastructure.",
91
+ "Do not implement anything.",
92
+ `Problem frame: ${JSON.stringify(outputs.frame)}`,
93
+ ].join("\n"),
94
+ expectedOutput: `{ "solution": "proposal", "rationale": "why", "parts": ["part"], "tradeoffs": ["trade-off"] }`,
95
+ validate: (value) => requireRecord(value, "autodevise proposal"),
96
+ }),
97
+ ideal: agent({
98
+ statusDetail: "describing the ideal end state",
99
+ prompt: ({ outputs, input }) => [
100
+ "Set the proposal aside and describe the holy grail for this problem.",
101
+ "The holy grail can match the proposal or exceed the current scope.",
102
+ "Name dependencies outside our authority instead of assuming they can change.",
103
+ "Explain the practical value beyond the proposal.",
104
+ `Problem frame: ${JSON.stringify(outputs.frame)}`,
105
+ `Proposal: ${JSON.stringify(outputs.propose)}`,
106
+ `New evidence: ${JSON.stringify(input.newEvidence ?? null)}`,
107
+ ].join("\n"),
108
+ expectedOutput: `{ "ideal": "ideal end state", "outsideDependencies": ["dependency"], "additionalValue": ["benefit"] }`,
109
+ validate: (value) => requireRecord(value, "autodevise ideal"),
110
+ }),
111
+ choose: agent({
112
+ statusDetail: "choosing the practical solution",
113
+ prompt: ({ outputs }) => [
114
+ "Choose the right solution without asking the user to decide.",
115
+ "Choose the ideal when it is production-ready, proportionate, in scope, and implementable through interfaces we control.",
116
+ "Otherwise choose the strongest practical in-scope solution with a clear path toward the ideal.",
117
+ "Do not block only because the ideal depends on work outside our authority.",
118
+ "Do not make an upstream change, unrelated repository, new service, or unapproved resource a requirement.",
119
+ "Prefer the simpler choice when options give materially equivalent results.",
120
+ "Return blocked only when no truthful in-scope solution can meet the success criteria.",
121
+ `Frame: ${JSON.stringify(outputs.frame)}`,
122
+ `Proposal: ${JSON.stringify(outputs.propose)}`,
123
+ `Ideal: ${JSON.stringify(outputs.ideal)}`,
124
+ ].join("\n"),
125
+ expectedOutput: `{ "status": "ready" | "blocked", "selected": "solution", "why": "reason", "relationshipToIdeal": "relationship", "excluded": ["excluded work"], "compromises": ["compromise"], "blocker": "required only when blocked" }`,
126
+ validate: parseSelection,
127
+ }),
128
+ plan: agent({
129
+ timeoutMs: 30 * 60_000,
130
+ statusDetail: "writing the implementation plan",
131
+ prompt: ({ outputs, input }) => [
132
+ "Write a detailed implementation-ready plan for the selected solution.",
133
+ "Keep every step inside the framed scope and authority.",
134
+ "For each step, state what changes, where it changes, and how to verify it.",
135
+ "Include contract changes, compatibility boundaries, tests, rollout or migration work, and failure handling when they apply.",
136
+ "Use the new evidence to correct the previous plan when one exists.",
137
+ "Do not implement the plan.",
138
+ `Frame: ${JSON.stringify(outputs.frame)}`,
139
+ `Selection: ${JSON.stringify(outputs.choose)}`,
140
+ `Previous plan: ${JSON.stringify(input.previousPlan ?? null)}`,
141
+ `New evidence: ${JSON.stringify(input.newEvidence ?? null)}`,
142
+ ].join("\n"),
143
+ expectedOutput: `{ "summary": "approach", "steps": [{ "change": "change", "where": "location", "verification": "evidence" }], "contracts": ["impact"], "tests": ["test"], "risks": [{ "risk": "risk", "mitigation": "mitigation" }], "boundaries": ["excluded work"] }`,
144
+ validate: (value) => requireRecord(value, "autodevise plan"),
145
+ }),
146
+ blocked: compute({
147
+ run: ({ outputs }) => {
148
+ const selection = outputs.choose;
149
+ return {
150
+ status: "blocked",
151
+ frame: outputs.frame,
152
+ proposal: outputs.propose,
153
+ ideal: outputs.ideal,
154
+ selection,
155
+ reason: requireString(selection.blocker, "autodevise blocker"),
156
+ };
157
+ },
158
+ }),
159
+ finalize: compute({
160
+ run: ({ outputs, input }) => {
161
+ const request = input;
162
+ const planDigest = digest(outputs.plan);
163
+ const previousPlanDigest = request.previousPlan === undefined ? undefined : digest(request.previousPlan);
164
+ return {
165
+ status: "ready",
166
+ frame: outputs.frame,
167
+ proposal: outputs.propose,
168
+ ideal: outputs.ideal,
169
+ selection: outputs.choose,
170
+ plan: outputs.plan,
171
+ planDigest,
172
+ ...(previousPlanDigest !== undefined ? { previousPlanDigest } : {}),
173
+ changed: previousPlanDigest === undefined || previousPlanDigest !== planDigest,
174
+ };
175
+ },
176
+ }),
177
+ },
178
+ edges: [
179
+ { from: "frame", to: "propose" },
180
+ { from: "propose", to: "ideal" },
181
+ { from: "ideal", to: "choose" },
182
+ {
183
+ from: "choose",
184
+ switch: { on: "$.status", cases: { ready: "plan", blocked: "blocked" } },
185
+ },
186
+ { from: "plan", to: "finalize" },
187
+ ],
188
+ });
189
+ export default autodeviseWorkflow;
190
+ //# sourceMappingURL=autodevise.workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autodevise.workflow.js","sourceRoot":"","sources":["../../src/builtins/autodevise.workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AA+B5E,SAAS,aAAa,CAAC,KAAc,EAAE,KAAa;IAClD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa,CAAC,KAAc,EAAE,KAAa;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,6BAA6B,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACtC,IACE,WAAW,KAAK,SAAS;QACzB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,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AS,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACnE,OAAO,EAAE,kBAAkB,KAAK,SAAS,IAAI,kBAAkB,KAAK,UAAU;iBACrD,CAAC;YAC9B,CAAC;SACF,CAAC;KACH;IACD,KAAK,EAAE;QACL,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE;QAChC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE;QAChC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE;QAC/B;YACE,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE;SACzE;QACD,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE;KACjC;CACF,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,154 @@
1
+ import { type AutodeviseInput } from "./autodevise.workflow.js";
2
+ export type AutoimplementInput = {
3
+ task: string;
4
+ plan?: unknown;
5
+ scope?: string;
6
+ constraints?: string[];
7
+ repository?: string;
8
+ baseBranch?: string;
9
+ merge?: boolean;
10
+ };
11
+ type ReviewFinding = {
12
+ severity: "P0" | "P1" | "P2" | "lower";
13
+ kind: "design" | "implementation";
14
+ summary: string;
15
+ };
16
+ type ReviewAssessment = {
17
+ route: "critical" | "p2" | "clean" | "command_error";
18
+ invocationSucceeded: boolean;
19
+ p0: ReviewFinding[];
20
+ p1: ReviewFinding[];
21
+ p2: ReviewFinding[];
22
+ lower: ReviewFinding[];
23
+ reason: string;
24
+ };
25
+ export type AutoimplementCompleted = {
26
+ status: "completed";
27
+ task: string;
28
+ plan: unknown;
29
+ implementation: unknown;
30
+ verification: unknown;
31
+ reviewRounds: ReviewAssessment[];
32
+ ci: unknown;
33
+ delivery: unknown;
34
+ };
35
+ export type AutoimplementBlocked = {
36
+ status: "blocked";
37
+ task: string;
38
+ reason: string;
39
+ evidence: unknown;
40
+ };
41
+ export declare const autoimplementWorkflow: import("../workflows/types.js").WorkflowDefinition<AutoimplementInput, {
42
+ readonly completed: {
43
+ readonly from: "finalize";
44
+ readonly validate: (value: unknown) => AutoimplementCompleted;
45
+ };
46
+ readonly blocked: {
47
+ readonly from: "blocked";
48
+ readonly validate: (value: unknown) => AutoimplementBlocked;
49
+ };
50
+ }, {
51
+ readonly redesign: import("../workflows/types.js").WorkflowIncludeDefinition<import("../workflows/types.js").WorkflowDefinition<AutodeviseInput, {
52
+ readonly ready: {
53
+ readonly from: "finalize";
54
+ readonly validate: (value: unknown) => import("./autodevise.workflow.js").AutodeviseReady;
55
+ };
56
+ readonly blocked: {
57
+ readonly from: "blocked";
58
+ readonly validate: (value: unknown) => import("./autodevise.workflow.js").AutodeviseBlocked;
59
+ };
60
+ }, import("../workflows/types.js").WorkflowIncludeMap> & {
61
+ nodes: {
62
+ readonly frame: import("../workflows/types.js").AgentNodeDefinition;
63
+ readonly propose: import("../workflows/types.js").AgentNodeDefinition;
64
+ readonly ideal: import("../workflows/types.js").AgentNodeDefinition;
65
+ readonly choose: import("../workflows/types.js").AgentNodeDefinition;
66
+ readonly plan: import("../workflows/types.js").AgentNodeDefinition;
67
+ readonly blocked: import("../workflows/types.js").ComputeNodeDefinition;
68
+ readonly finalize: import("../workflows/types.js").ComputeNodeDefinition;
69
+ };
70
+ includes?: import("../workflows/types.js").WorkflowIncludeMap;
71
+ exits?: {
72
+ readonly ready: {
73
+ readonly from: "finalize";
74
+ readonly validate: (value: unknown) => import("./autodevise.workflow.js").AutodeviseReady;
75
+ };
76
+ readonly blocked: {
77
+ readonly from: "blocked";
78
+ readonly validate: (value: unknown) => import("./autodevise.workflow.js").AutodeviseBlocked;
79
+ };
80
+ };
81
+ }>;
82
+ }> & {
83
+ nodes: {
84
+ readonly prepare: import("../workflows/types.js").ComputeNodeDefinition;
85
+ readonly adoptPlan: import("../workflows/types.js").ComputeNodeDefinition;
86
+ readonly implement: import("../workflows/types.js").AgentNodeDefinition;
87
+ readonly classifyImplementation: import("../workflows/types.js").AgentNodeDefinition;
88
+ readonly verify: import("../workflows/types.js").AgentNodeDefinition;
89
+ readonly classifyVerification: import("../workflows/types.js").AgentNodeDefinition;
90
+ readonly fix: import("../workflows/types.js").AgentNodeDefinition;
91
+ readonly publish: import("../workflows/types.js").AgentNodeDefinition;
92
+ readonly authorReviewCommand: import("../workflows/types.js").AgentNodeDefinition;
93
+ readonly runReview: import("../workflows/types.js").ShellActionNodeDefinition;
94
+ readonly repairReviewCommand: import("../workflows/types.js").AgentNodeDefinition;
95
+ readonly assessReview: import("../workflows/types.js").AgentNodeDefinition;
96
+ readonly triageReview: import("../workflows/types.js").ComputeNodeDefinition;
97
+ readonly addressP2: import("../workflows/types.js").AgentNodeDefinition;
98
+ readonly verifyP2: import("../workflows/types.js").AgentNodeDefinition;
99
+ readonly inspectComments: import("../workflows/types.js").AgentNodeDefinition;
100
+ readonly inspectCi: import("../workflows/types.js").AgentNodeDefinition;
101
+ readonly trackCi: import("../workflows/types.js").ShellActionNodeDefinition;
102
+ readonly repairCiCommand: import("../workflows/types.js").AgentNodeDefinition;
103
+ readonly assessTrackedCi: import("../workflows/types.js").AgentNodeDefinition;
104
+ readonly opportunisticTest: import("../workflows/types.js").AgentNodeDefinition;
105
+ readonly classifyCi: import("../workflows/types.js").AgentNodeDefinition;
106
+ readonly finalizeDelivery: import("../workflows/types.js").AgentNodeDefinition;
107
+ readonly blocked: import("../workflows/types.js").ComputeNodeDefinition;
108
+ readonly finalize: import("../workflows/types.js").ComputeNodeDefinition;
109
+ };
110
+ includes?: {
111
+ readonly redesign: import("../workflows/types.js").WorkflowIncludeDefinition<import("../workflows/types.js").WorkflowDefinition<AutodeviseInput, {
112
+ readonly ready: {
113
+ readonly from: "finalize";
114
+ readonly validate: (value: unknown) => import("./autodevise.workflow.js").AutodeviseReady;
115
+ };
116
+ readonly blocked: {
117
+ readonly from: "blocked";
118
+ readonly validate: (value: unknown) => import("./autodevise.workflow.js").AutodeviseBlocked;
119
+ };
120
+ }, import("../workflows/types.js").WorkflowIncludeMap> & {
121
+ nodes: {
122
+ readonly frame: import("../workflows/types.js").AgentNodeDefinition;
123
+ readonly propose: import("../workflows/types.js").AgentNodeDefinition;
124
+ readonly ideal: import("../workflows/types.js").AgentNodeDefinition;
125
+ readonly choose: import("../workflows/types.js").AgentNodeDefinition;
126
+ readonly plan: import("../workflows/types.js").AgentNodeDefinition;
127
+ readonly blocked: import("../workflows/types.js").ComputeNodeDefinition;
128
+ readonly finalize: import("../workflows/types.js").ComputeNodeDefinition;
129
+ };
130
+ includes?: import("../workflows/types.js").WorkflowIncludeMap;
131
+ exits?: {
132
+ readonly ready: {
133
+ readonly from: "finalize";
134
+ readonly validate: (value: unknown) => import("./autodevise.workflow.js").AutodeviseReady;
135
+ };
136
+ readonly blocked: {
137
+ readonly from: "blocked";
138
+ readonly validate: (value: unknown) => import("./autodevise.workflow.js").AutodeviseBlocked;
139
+ };
140
+ };
141
+ }>;
142
+ };
143
+ exits?: {
144
+ readonly completed: {
145
+ readonly from: "finalize";
146
+ readonly validate: (value: unknown) => AutoimplementCompleted;
147
+ };
148
+ readonly blocked: {
149
+ readonly from: "blocked";
150
+ readonly validate: (value: unknown) => AutoimplementBlocked;
151
+ };
152
+ };
153
+ };
154
+ export default autoimplementWorkflow;