olympus-ai 3.4.1 → 3.5.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.
- package/README.md +631 -630
- package/dist/__tests__/workflow-engine/checkpoint.test.d.ts +7 -0
- package/dist/__tests__/workflow-engine/checkpoint.test.d.ts.map +1 -0
- package/dist/__tests__/workflow-engine/checkpoint.test.js +373 -0
- package/dist/__tests__/workflow-engine/checkpoint.test.js.map +1 -0
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +8 -0
- package/dist/agents/definitions.js.map +1 -1
- package/dist/agents/idea-intake.d.ts +20 -0
- package/dist/agents/idea-intake.d.ts.map +1 -0
- package/dist/agents/idea-intake.js +255 -0
- package/dist/agents/idea-intake.js.map +1 -0
- package/dist/agents/index.d.ts +4 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +4 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/intent-generator.d.ts +19 -0
- package/dist/agents/intent-generator.d.ts.map +1 -0
- package/dist/agents/intent-generator.js +303 -0
- package/dist/agents/intent-generator.js.map +1 -0
- package/dist/agents/prd-writer.d.ts +19 -0
- package/dist/agents/prd-writer.d.ts.map +1 -0
- package/dist/agents/prd-writer.js +236 -0
- package/dist/agents/prd-writer.js.map +1 -0
- package/dist/agents/prometheus.d.ts.map +1 -1
- package/dist/agents/prometheus.js +96 -2
- package/dist/agents/prometheus.js.map +1 -1
- package/dist/agents/spec-writer.d.ts +19 -0
- package/dist/agents/spec-writer.d.ts.map +1 -0
- package/dist/agents/spec-writer.js +528 -0
- package/dist/agents/spec-writer.js.map +1 -0
- package/dist/features/index.d.ts +1 -0
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +6 -0
- package/dist/features/index.js.map +1 -1
- package/dist/features/workflow-engine/artifacts.d.ts +96 -0
- package/dist/features/workflow-engine/artifacts.d.ts.map +1 -0
- package/dist/features/workflow-engine/artifacts.js +399 -0
- package/dist/features/workflow-engine/artifacts.js.map +1 -0
- package/dist/features/workflow-engine/checkpoint.d.ts +67 -0
- package/dist/features/workflow-engine/checkpoint.d.ts.map +1 -0
- package/dist/features/workflow-engine/checkpoint.js +249 -0
- package/dist/features/workflow-engine/checkpoint.js.map +1 -0
- package/dist/features/workflow-engine/engine.d.ts +128 -0
- package/dist/features/workflow-engine/engine.d.ts.map +1 -0
- package/dist/features/workflow-engine/engine.js +600 -0
- package/dist/features/workflow-engine/engine.js.map +1 -0
- package/dist/features/workflow-engine/execution.d.ts +99 -0
- package/dist/features/workflow-engine/execution.d.ts.map +1 -0
- package/dist/features/workflow-engine/execution.js +493 -0
- package/dist/features/workflow-engine/execution.js.map +1 -0
- package/dist/features/workflow-engine/hooks.d.ts +78 -0
- package/dist/features/workflow-engine/hooks.d.ts.map +1 -0
- package/dist/features/workflow-engine/hooks.js +188 -0
- package/dist/features/workflow-engine/hooks.js.map +1 -0
- package/dist/features/workflow-engine/index.d.ts +17 -0
- package/dist/features/workflow-engine/index.d.ts.map +1 -0
- package/dist/features/workflow-engine/index.js +19 -0
- package/dist/features/workflow-engine/index.js.map +1 -0
- package/dist/features/workflow-engine/types.d.ts +220 -0
- package/dist/features/workflow-engine/types.d.ts.map +1 -0
- package/dist/features/workflow-engine/types.js +8 -0
- package/dist/features/workflow-engine/types.js.map +1 -0
- package/dist/features/workflow-engine/validation.d.ts +128 -0
- package/dist/features/workflow-engine/validation.d.ts.map +1 -0
- package/dist/features/workflow-engine/validation.js +746 -0
- package/dist/features/workflow-engine/validation.js.map +1 -0
- package/dist/hooks/ascent-verifier/index.d.ts +52 -0
- package/dist/hooks/ascent-verifier/index.d.ts.map +1 -1
- package/dist/hooks/ascent-verifier/index.js +146 -0
- package/dist/hooks/ascent-verifier/index.js.map +1 -1
- package/dist/hooks/registrations/learning-capture.d.ts.map +1 -1
- package/dist/hooks/registrations/learning-capture.js +32 -9
- package/dist/hooks/registrations/learning-capture.js.map +1 -1
- package/dist/hooks/registrations/user-prompt-submit.d.ts.map +1 -1
- package/dist/hooks/registrations/user-prompt-submit.js +85 -0
- package/dist/hooks/registrations/user-prompt-submit.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +310 -1
- package/dist/installer/index.js.map +1 -1
- package/dist/learning/session-state.d.ts.map +1 -1
- package/dist/learning/session-state.js +17 -0
- package/dist/learning/session-state.js.map +1 -1
- package/dist/learning/types.d.ts +3 -0
- package/dist/learning/types.d.ts.map +1 -1
- package/dist/shared/types.d.ts +17 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +3 -1
- package/scripts/dist/hooks/olympus-hooks.cjs +208 -97
- package/scripts/rebrand.mjs +0 -206
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkflowEngine - Core orchestrator for the multi-stage workflow system
|
|
3
|
+
*
|
|
4
|
+
* Manages the progression of features through stages:
|
|
5
|
+
* IDEA → PRD → SPEC → INTENTS → COMPLETE
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Checkpoint-based persistence for resumable workflows
|
|
9
|
+
* - Artifact generation and tracking
|
|
10
|
+
* - Status management (in_progress, paused, complete)
|
|
11
|
+
*/
|
|
12
|
+
import { saveCheckpoint, loadCheckpoint } from './checkpoint.js';
|
|
13
|
+
import { ensureWorkflowDir, writeArtifact, getArtifactPath } from './artifacts.js';
|
|
14
|
+
import { validateIdea, validatePrd } from './validation.js';
|
|
15
|
+
/**
|
|
16
|
+
* Ordered list of workflow stages for progression validation
|
|
17
|
+
*/
|
|
18
|
+
const STAGE_ORDER = ['idea', 'prd', 'spec', 'intents', 'complete'];
|
|
19
|
+
/**
|
|
20
|
+
* Get the next stage in the workflow progression
|
|
21
|
+
*/
|
|
22
|
+
function getNextStage(currentStage) {
|
|
23
|
+
const currentIndex = STAGE_ORDER.indexOf(currentStage);
|
|
24
|
+
if (currentIndex === -1 || currentIndex >= STAGE_ORDER.length - 1) {
|
|
25
|
+
return 'complete';
|
|
26
|
+
}
|
|
27
|
+
return STAGE_ORDER[currentIndex + 1];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* WorkflowEngine orchestrates the multi-stage workflow system.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const engine = new WorkflowEngine('/path/to/project', 'User Authentication');
|
|
35
|
+
* await engine.start('I want to build a user login system with OAuth');
|
|
36
|
+
* // Later...
|
|
37
|
+
* await engine.resume();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export class WorkflowEngine {
|
|
41
|
+
projectPath;
|
|
42
|
+
featureName;
|
|
43
|
+
workflowId;
|
|
44
|
+
interruptHandler = null;
|
|
45
|
+
/**
|
|
46
|
+
* Create a new WorkflowEngine instance
|
|
47
|
+
*
|
|
48
|
+
* @param projectPath - Absolute path to the project root
|
|
49
|
+
* @param featureName - Human-readable name for the feature
|
|
50
|
+
*/
|
|
51
|
+
constructor(projectPath, featureName) {
|
|
52
|
+
this.projectPath = projectPath;
|
|
53
|
+
this.featureName = featureName;
|
|
54
|
+
// Sanitize feature name to create workflow ID
|
|
55
|
+
this.workflowId = featureName.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Start a new workflow from the IDEA stage
|
|
59
|
+
*
|
|
60
|
+
* @param initialPrompt - The user's initial description of the feature
|
|
61
|
+
* @throws Error if disk is full, permissions are denied, or workflow initialization fails
|
|
62
|
+
*/
|
|
63
|
+
async start(initialPrompt) {
|
|
64
|
+
// Create initial checkpoint
|
|
65
|
+
const checkpoint = {
|
|
66
|
+
schema_version: '1.0.0',
|
|
67
|
+
workflow_id: this.workflowId,
|
|
68
|
+
feature_name: this.featureName,
|
|
69
|
+
created_at: new Date().toISOString(),
|
|
70
|
+
updated_at: new Date().toISOString(),
|
|
71
|
+
current_stage: 'idea',
|
|
72
|
+
status: 'in_progress',
|
|
73
|
+
artifacts: {
|
|
74
|
+
idea: null,
|
|
75
|
+
prd: null,
|
|
76
|
+
spec: null,
|
|
77
|
+
intents: null,
|
|
78
|
+
complete: null,
|
|
79
|
+
},
|
|
80
|
+
validation_results: {
|
|
81
|
+
idea: null,
|
|
82
|
+
prd: null,
|
|
83
|
+
spec: null,
|
|
84
|
+
intents: null,
|
|
85
|
+
complete: null,
|
|
86
|
+
},
|
|
87
|
+
resume_context: {
|
|
88
|
+
initial_prompt: initialPrompt,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
try {
|
|
92
|
+
// Create directory structure
|
|
93
|
+
await ensureWorkflowDir(this.projectPath, this.workflowId);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
const err = error;
|
|
97
|
+
console.error(`[WorkflowEngine] Failed to initialize workflow directory: ${err.message}`);
|
|
98
|
+
throw new Error(`Failed to start workflow: Could not create directory structure - ${err.message}`);
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
// Save initial checkpoint
|
|
102
|
+
await saveCheckpoint(this.projectPath, checkpoint);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
const err = error;
|
|
106
|
+
console.error(`[WorkflowEngine] Failed to save initial checkpoint: ${err.message}`);
|
|
107
|
+
throw new Error(`Failed to start workflow: Could not save checkpoint - ${err.message}`);
|
|
108
|
+
}
|
|
109
|
+
// Setup interrupt handler before executing stages
|
|
110
|
+
this.setupInterruptHandler();
|
|
111
|
+
try {
|
|
112
|
+
// Execute the IDEA stage
|
|
113
|
+
await this.executeStage('idea');
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
const err = error;
|
|
117
|
+
console.error(`[WorkflowEngine] Failed to execute IDEA stage: ${err.message}`);
|
|
118
|
+
// Try to save checkpoint as paused so workflow can be resumed
|
|
119
|
+
try {
|
|
120
|
+
const updatedCheckpoint = await loadCheckpoint(this.projectPath, this.workflowId);
|
|
121
|
+
if (updatedCheckpoint) {
|
|
122
|
+
updatedCheckpoint.status = 'paused';
|
|
123
|
+
updatedCheckpoint.resume_context = {
|
|
124
|
+
...updatedCheckpoint.resume_context,
|
|
125
|
+
error_message: err.message,
|
|
126
|
+
failed_stage: 'idea',
|
|
127
|
+
};
|
|
128
|
+
await saveCheckpoint(this.projectPath, updatedCheckpoint);
|
|
129
|
+
console.log('[WorkflowEngine] Workflow saved as paused. Resume with `/plan continue`');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (saveError) {
|
|
133
|
+
console.warn('[WorkflowEngine] Failed to save error checkpoint:', saveError.message);
|
|
134
|
+
}
|
|
135
|
+
throw new Error(`Failed to execute IDEA stage: ${err.message}`);
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
// Clean up interrupt handler after workflow completes or errors
|
|
139
|
+
this.cleanupInterruptHandler();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Resume an existing workflow from its current stage
|
|
144
|
+
*
|
|
145
|
+
* @returns Status message indicating what happened
|
|
146
|
+
* @throws Error if checkpoint doesn't exist or workflow execution fails
|
|
147
|
+
*/
|
|
148
|
+
async resume() {
|
|
149
|
+
let checkpoint;
|
|
150
|
+
try {
|
|
151
|
+
checkpoint = await loadCheckpoint(this.projectPath, this.workflowId);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
const err = error;
|
|
155
|
+
console.error(`[WorkflowEngine] Failed to load checkpoint for resume: ${err.message}`);
|
|
156
|
+
throw new Error(`Failed to resume workflow: Could not load checkpoint - ${err.message}`);
|
|
157
|
+
}
|
|
158
|
+
if (!checkpoint) {
|
|
159
|
+
console.error(`[WorkflowEngine] No checkpoint found for workflow: ${this.workflowId}`);
|
|
160
|
+
console.error(`[WorkflowEngine] Available workflows: Run 'olympus workflow list' to see workflows`);
|
|
161
|
+
throw new Error(`No checkpoint found for workflow: ${this.workflowId}`);
|
|
162
|
+
}
|
|
163
|
+
// Check if workflow is already complete
|
|
164
|
+
if (checkpoint.status === 'complete') {
|
|
165
|
+
return 'Workflow already complete';
|
|
166
|
+
}
|
|
167
|
+
// Update status to in_progress if it was paused
|
|
168
|
+
if (checkpoint.status === 'paused') {
|
|
169
|
+
checkpoint.status = 'in_progress';
|
|
170
|
+
try {
|
|
171
|
+
await saveCheckpoint(this.projectPath, checkpoint);
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
const err = error;
|
|
175
|
+
console.error(`[WorkflowEngine] Failed to update checkpoint status: ${err.message}`);
|
|
176
|
+
throw new Error(`Failed to resume workflow: Could not save checkpoint - ${err.message}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Setup interrupt handler before executing stages
|
|
180
|
+
this.setupInterruptHandler();
|
|
181
|
+
const currentStage = checkpoint.current_stage;
|
|
182
|
+
try {
|
|
183
|
+
// Execute the current stage
|
|
184
|
+
await this.executeStage(currentStage);
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
const err = error;
|
|
188
|
+
console.error(`[WorkflowEngine] Failed to execute ${currentStage} stage: ${err.message}`);
|
|
189
|
+
// Try to save checkpoint as paused so workflow can be resumed again
|
|
190
|
+
try {
|
|
191
|
+
const updatedCheckpoint = await loadCheckpoint(this.projectPath, this.workflowId);
|
|
192
|
+
if (updatedCheckpoint) {
|
|
193
|
+
updatedCheckpoint.status = 'paused';
|
|
194
|
+
updatedCheckpoint.resume_context = {
|
|
195
|
+
...updatedCheckpoint.resume_context,
|
|
196
|
+
error_message: err.message,
|
|
197
|
+
failed_stage: currentStage,
|
|
198
|
+
};
|
|
199
|
+
await saveCheckpoint(this.projectPath, updatedCheckpoint);
|
|
200
|
+
console.log('[WorkflowEngine] Workflow saved as paused. Fix the issue and resume with `/plan continue`');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (saveError) {
|
|
204
|
+
console.warn('[WorkflowEngine] Failed to save error checkpoint:', saveError.message);
|
|
205
|
+
}
|
|
206
|
+
throw new Error(`Failed to execute ${currentStage} stage: ${err.message}`);
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
// Clean up interrupt handler after workflow completes or errors
|
|
210
|
+
this.cleanupInterruptHandler();
|
|
211
|
+
}
|
|
212
|
+
return `Resumed workflow from stage: ${currentStage}`;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Pause the workflow at its current state
|
|
216
|
+
*
|
|
217
|
+
* @returns Path to the checkpoint file
|
|
218
|
+
* @throws Error if checkpoint doesn't exist or save fails
|
|
219
|
+
*/
|
|
220
|
+
async pause() {
|
|
221
|
+
let checkpoint;
|
|
222
|
+
try {
|
|
223
|
+
checkpoint = await loadCheckpoint(this.projectPath, this.workflowId);
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
const err = error;
|
|
227
|
+
console.error(`[WorkflowEngine] Failed to load checkpoint for pause: ${err.message}`);
|
|
228
|
+
throw new Error(`Failed to pause workflow: Could not load checkpoint - ${err.message}`);
|
|
229
|
+
}
|
|
230
|
+
if (!checkpoint) {
|
|
231
|
+
console.error(`[WorkflowEngine] No checkpoint found for workflow: ${this.workflowId}`);
|
|
232
|
+
throw new Error(`No checkpoint found for workflow: ${this.workflowId}`);
|
|
233
|
+
}
|
|
234
|
+
// Update status to paused
|
|
235
|
+
checkpoint.status = 'paused';
|
|
236
|
+
try {
|
|
237
|
+
await saveCheckpoint(this.projectPath, checkpoint);
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
const err = error;
|
|
241
|
+
console.error(`[WorkflowEngine] Failed to save paused checkpoint: ${err.message}`);
|
|
242
|
+
throw new Error(`Failed to pause workflow: Could not save checkpoint - ${err.message}`);
|
|
243
|
+
}
|
|
244
|
+
// Return the checkpoint file path
|
|
245
|
+
return `.olympus/workflow/${this.workflowId}/checkpoint.json`;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Execute a specific workflow stage
|
|
249
|
+
*
|
|
250
|
+
* @param stage - The stage to execute
|
|
251
|
+
*/
|
|
252
|
+
async executeStage(stage) {
|
|
253
|
+
if (stage === 'complete') {
|
|
254
|
+
throw new Error('No execution for complete stage');
|
|
255
|
+
}
|
|
256
|
+
// Load current checkpoint
|
|
257
|
+
const checkpoint = await loadCheckpoint(this.projectPath, this.workflowId);
|
|
258
|
+
if (!checkpoint) {
|
|
259
|
+
throw new Error(`No checkpoint found for workflow: ${this.workflowId}`);
|
|
260
|
+
}
|
|
261
|
+
// Dispatch to stage handler
|
|
262
|
+
switch (stage) {
|
|
263
|
+
case 'idea':
|
|
264
|
+
await this.executeIdeaStage(checkpoint);
|
|
265
|
+
break;
|
|
266
|
+
case 'prd':
|
|
267
|
+
await this.executePrdStage(checkpoint);
|
|
268
|
+
break;
|
|
269
|
+
case 'spec':
|
|
270
|
+
await this.executeSpecStage(checkpoint);
|
|
271
|
+
break;
|
|
272
|
+
case 'intents':
|
|
273
|
+
await this.executeIntentsStage(checkpoint);
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
// Update checkpoint with completion of this stage
|
|
277
|
+
const artifactId = `${stage.toUpperCase()}-001`;
|
|
278
|
+
const artifactPath = stage === 'intents'
|
|
279
|
+
? `.olympus/workflow/${this.workflowId}/intents/`
|
|
280
|
+
: `.olympus/workflow/${this.workflowId}/${stage}.md`;
|
|
281
|
+
checkpoint.artifacts[stage] = {
|
|
282
|
+
id: artifactId,
|
|
283
|
+
path: artifactPath,
|
|
284
|
+
created_at: new Date().toISOString(),
|
|
285
|
+
validation_passed: checkpoint.validation_results[stage]?.passed ?? false,
|
|
286
|
+
};
|
|
287
|
+
// Move to next stage
|
|
288
|
+
const nextStage = getNextStage(stage);
|
|
289
|
+
checkpoint.current_stage = nextStage;
|
|
290
|
+
if (nextStage === 'complete') {
|
|
291
|
+
checkpoint.status = 'complete';
|
|
292
|
+
}
|
|
293
|
+
// Save updated checkpoint
|
|
294
|
+
await saveCheckpoint(this.projectPath, checkpoint);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Get the current status of the workflow
|
|
298
|
+
*
|
|
299
|
+
* @throws Error if checkpoint doesn't exist or load fails
|
|
300
|
+
*/
|
|
301
|
+
async getStatus() {
|
|
302
|
+
let checkpoint;
|
|
303
|
+
try {
|
|
304
|
+
checkpoint = await loadCheckpoint(this.projectPath, this.workflowId);
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
const err = error;
|
|
308
|
+
console.error(`[WorkflowEngine] Failed to load checkpoint for status: ${err.message}`);
|
|
309
|
+
throw new Error(`Failed to get workflow status: Could not load checkpoint - ${err.message}`);
|
|
310
|
+
}
|
|
311
|
+
if (!checkpoint) {
|
|
312
|
+
console.error(`[WorkflowEngine] No checkpoint found for workflow: ${this.workflowId}`);
|
|
313
|
+
throw new Error(`No checkpoint found for workflow: ${this.workflowId}`);
|
|
314
|
+
}
|
|
315
|
+
// Collect non-null artifacts into array
|
|
316
|
+
const artifacts = [];
|
|
317
|
+
for (const stage of STAGE_ORDER) {
|
|
318
|
+
const artifact = checkpoint.artifacts[stage];
|
|
319
|
+
if (artifact) {
|
|
320
|
+
artifacts.push(artifact);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
workflow_id: checkpoint.workflow_id,
|
|
325
|
+
feature_name: checkpoint.feature_name,
|
|
326
|
+
current_stage: checkpoint.current_stage,
|
|
327
|
+
status: checkpoint.status,
|
|
328
|
+
artifacts,
|
|
329
|
+
updated_at: checkpoint.updated_at,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
// ============================================================================
|
|
333
|
+
// Interrupt Handling
|
|
334
|
+
// ============================================================================
|
|
335
|
+
/**
|
|
336
|
+
* Setup SIGINT handler to save checkpoint when workflow is interrupted.
|
|
337
|
+
* This allows users to resume their workflow later with `/plan continue`.
|
|
338
|
+
*
|
|
339
|
+
* @private
|
|
340
|
+
*/
|
|
341
|
+
setupInterruptHandler() {
|
|
342
|
+
this.interruptHandler = async () => {
|
|
343
|
+
console.log('\n[WorkflowEngine] Workflow interrupted - saving checkpoint...');
|
|
344
|
+
try {
|
|
345
|
+
const checkpoint = await loadCheckpoint(this.projectPath, this.workflowId);
|
|
346
|
+
if (checkpoint) {
|
|
347
|
+
checkpoint.status = 'paused';
|
|
348
|
+
checkpoint.updated_at = new Date().toISOString();
|
|
349
|
+
checkpoint.resume_context = {
|
|
350
|
+
...checkpoint.resume_context,
|
|
351
|
+
interrupted_at: new Date().toISOString(),
|
|
352
|
+
current_stage: checkpoint.current_stage,
|
|
353
|
+
message: `Workflow interrupted during ${checkpoint.current_stage} stage`,
|
|
354
|
+
};
|
|
355
|
+
await saveCheckpoint(this.projectPath, checkpoint);
|
|
356
|
+
console.log('[WorkflowEngine] Checkpoint saved. Resume with `/plan continue`');
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
console.error('[WorkflowEngine] Failed to save checkpoint on interrupt:', error);
|
|
361
|
+
}
|
|
362
|
+
process.exit(0);
|
|
363
|
+
};
|
|
364
|
+
process.on('SIGINT', this.interruptHandler);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Clean up the interrupt handler when workflow completes or errors.
|
|
368
|
+
*
|
|
369
|
+
* @private
|
|
370
|
+
*/
|
|
371
|
+
cleanupInterruptHandler() {
|
|
372
|
+
if (this.interruptHandler) {
|
|
373
|
+
process.off('SIGINT', this.interruptHandler);
|
|
374
|
+
this.interruptHandler = null;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
// ============================================================================
|
|
378
|
+
// Stage Execution Methods (Stubs - to be replaced with real agent calls)
|
|
379
|
+
// ============================================================================
|
|
380
|
+
/**
|
|
381
|
+
* Execute the IDEA stage
|
|
382
|
+
*
|
|
383
|
+
* Invokes the idea-intake agent to generate the IDEA artifact.
|
|
384
|
+
* The artifact is validated before the stage is considered complete.
|
|
385
|
+
*
|
|
386
|
+
* TODO: Replace with actual Task tool invocation when integration is complete.
|
|
387
|
+
* Current implementation creates mock artifacts with validation.
|
|
388
|
+
*/
|
|
389
|
+
async executeIdeaStage(checkpoint) {
|
|
390
|
+
const initialPrompt = checkpoint.resume_context?.initial_prompt || 'No initial prompt provided';
|
|
391
|
+
console.log(`[WorkflowEngine] Executing IDEA stage for feature: ${this.featureName}`);
|
|
392
|
+
console.log(`[WorkflowEngine] Initial prompt: ${initialPrompt}`);
|
|
393
|
+
// TODO: Implement actual agent invocation when Task tool integration is available
|
|
394
|
+
// This would invoke the idea-intake agent with the feature request:
|
|
395
|
+
//
|
|
396
|
+
// const agentPrompt = `Generate IDEA artifact for: ${this.featureName}\n\nInitial request: ${initialPrompt}`;
|
|
397
|
+
// await invokeAgent('idea-intake', agentPrompt, {
|
|
398
|
+
// workflowId: this.workflowId,
|
|
399
|
+
// outputPath: `.olympus/workflow/${this.workflowId}/idea.md`
|
|
400
|
+
// });
|
|
401
|
+
//
|
|
402
|
+
// The idea-intake agent would:
|
|
403
|
+
// 1. Interview the user about the feature
|
|
404
|
+
// 2. Analyze requirements and constraints
|
|
405
|
+
// 3. Generate a complete IDEA artifact with all required sections
|
|
406
|
+
// 4. Save to the designated path
|
|
407
|
+
console.log('[WorkflowEngine] Agent invocation: idea-intake (stub - would be invoked here)');
|
|
408
|
+
// For now, create mock artifact (will be replaced when agent integration is complete)
|
|
409
|
+
const ideaContent = `# Feature Idea: ${this.featureName}
|
|
410
|
+
|
|
411
|
+
## Initial Prompt
|
|
412
|
+
${initialPrompt}
|
|
413
|
+
|
|
414
|
+
## Summary
|
|
415
|
+
This is a placeholder idea document. The real idea-intake agent will generate
|
|
416
|
+
a proper analysis of the feature requirements.
|
|
417
|
+
|
|
418
|
+
## Key Requirements
|
|
419
|
+
- [To be filled by idea-intake agent]
|
|
420
|
+
|
|
421
|
+
## User Stories
|
|
422
|
+
- [To be filled by idea-intake agent]
|
|
423
|
+
|
|
424
|
+
## Acceptance Criteria
|
|
425
|
+
- [To be filled by idea-intake agent]
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
*Generated by WorkflowEngine (stub implementation)*
|
|
429
|
+
`;
|
|
430
|
+
await writeArtifact(this.projectPath, this.workflowId, 'idea', ideaContent);
|
|
431
|
+
// Validate the generated artifact
|
|
432
|
+
const ideaPath = getArtifactPath(this.projectPath, this.workflowId, 'idea');
|
|
433
|
+
console.log(`[WorkflowEngine] Validating IDEA artifact at: ${ideaPath}`);
|
|
434
|
+
const validationResult = await validateIdea(ideaPath);
|
|
435
|
+
// Store validation result in checkpoint
|
|
436
|
+
checkpoint.validation_results.idea = validationResult;
|
|
437
|
+
if (!validationResult.passed) {
|
|
438
|
+
console.log('[WorkflowEngine] IDEA validation failed:', validationResult.blocking_issues);
|
|
439
|
+
console.log(`[WorkflowEngine] Coverage: ${validationResult.coverage_percentage}%`);
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
console.log('[WorkflowEngine] IDEA validation passed');
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Execute the PRD stage
|
|
447
|
+
*
|
|
448
|
+
* Invokes the prd-writer agent to generate the PRD artifact.
|
|
449
|
+
* The PRD is validated against the IDEA artifact to ensure coverage.
|
|
450
|
+
*
|
|
451
|
+
* TODO: Replace with actual Task tool invocation when integration is complete.
|
|
452
|
+
* Current implementation creates mock artifacts with validation.
|
|
453
|
+
*/
|
|
454
|
+
async executePrdStage(checkpoint) {
|
|
455
|
+
console.log(`[WorkflowEngine] Executing PRD stage for feature: ${this.featureName}`);
|
|
456
|
+
// Get the IDEA artifact path for context
|
|
457
|
+
const ideaPath = getArtifactPath(this.projectPath, this.workflowId, 'idea');
|
|
458
|
+
// TODO: Implement actual agent invocation when Task tool integration is available
|
|
459
|
+
// This would invoke the prd-writer agent with the IDEA artifact:
|
|
460
|
+
//
|
|
461
|
+
// const agentPrompt = `Generate PRD artifact for: ${this.featureName}\n\nIDEA artifact: ${ideaPath}`;
|
|
462
|
+
// await invokeAgent('prd-writer', agentPrompt, {
|
|
463
|
+
// workflowId: this.workflowId,
|
|
464
|
+
// inputArtifacts: { idea: ideaPath },
|
|
465
|
+
// outputPath: `.olympus/workflow/${this.workflowId}/prd.md`
|
|
466
|
+
// });
|
|
467
|
+
//
|
|
468
|
+
// The prd-writer agent would:
|
|
469
|
+
// 1. Read and analyze the IDEA artifact
|
|
470
|
+
// 2. Generate user stories covering all constraints
|
|
471
|
+
// 3. Create a comprehensive PRD with requirement coverage
|
|
472
|
+
// 4. Save to the designated path
|
|
473
|
+
console.log('[WorkflowEngine] Agent invocation: prd-writer (stub - would be invoked here)');
|
|
474
|
+
console.log(`[WorkflowEngine] Input IDEA artifact: ${ideaPath}`);
|
|
475
|
+
// For now, create mock artifact (will be replaced when agent integration is complete)
|
|
476
|
+
const prdContent = `# Product Requirements Document: ${this.featureName}
|
|
477
|
+
|
|
478
|
+
## Overview
|
|
479
|
+
This is a placeholder PRD document. The real prd-writer agent will generate
|
|
480
|
+
a comprehensive product requirements document.
|
|
481
|
+
|
|
482
|
+
## Business Requirements
|
|
483
|
+
- [To be filled by prd-writer agent]
|
|
484
|
+
|
|
485
|
+
## Functional Requirements
|
|
486
|
+
- [To be filled by prd-writer agent]
|
|
487
|
+
|
|
488
|
+
## Non-Functional Requirements
|
|
489
|
+
- [To be filled by prd-writer agent]
|
|
490
|
+
|
|
491
|
+
## Success Metrics
|
|
492
|
+
- [To be filled by prd-writer agent]
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
*Generated by WorkflowEngine (stub implementation)*
|
|
496
|
+
`;
|
|
497
|
+
await writeArtifact(this.projectPath, this.workflowId, 'prd', prdContent);
|
|
498
|
+
// Validate the generated artifact against IDEA
|
|
499
|
+
const prdPath = getArtifactPath(this.projectPath, this.workflowId, 'prd');
|
|
500
|
+
console.log(`[WorkflowEngine] Validating PRD artifact at: ${prdPath}`);
|
|
501
|
+
const validationResult = await validatePrd(prdPath, ideaPath);
|
|
502
|
+
// Store validation result in checkpoint
|
|
503
|
+
checkpoint.validation_results.prd = validationResult;
|
|
504
|
+
if (!validationResult.passed) {
|
|
505
|
+
console.log('[WorkflowEngine] PRD validation failed:', validationResult.blocking_issues);
|
|
506
|
+
console.log(`[WorkflowEngine] Coverage: ${validationResult.coverage_percentage}%`);
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
console.log('[WorkflowEngine] PRD validation passed');
|
|
510
|
+
console.log(`[WorkflowEngine] Coverage: ${validationResult.coverage_percentage}%`);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Execute the SPEC stage
|
|
515
|
+
*
|
|
516
|
+
* TODO (Phase 3): Implement spec-writer agent invocation.
|
|
517
|
+
* The spec-writer agent would generate a technical specification from the PRD.
|
|
518
|
+
*/
|
|
519
|
+
async executeSpecStage(checkpoint) {
|
|
520
|
+
console.log('[WorkflowEngine] Executing SPEC stage (stub implementation)');
|
|
521
|
+
// TODO (Phase 3): Implement spec-writer agent invocation
|
|
522
|
+
// This would invoke the spec-writer agent with the PRD artifact:
|
|
523
|
+
//
|
|
524
|
+
// const prdPath = getArtifactPath(this.projectPath, this.workflowId, 'prd');
|
|
525
|
+
// const agentPrompt = `Generate technical specification for: ${this.featureName}\n\nPRD artifact: ${prdPath}`;
|
|
526
|
+
// await invokeAgent('spec-writer', agentPrompt, {
|
|
527
|
+
// workflowId: this.workflowId,
|
|
528
|
+
// inputArtifacts: { prd: prdPath },
|
|
529
|
+
// outputPath: `.olympus/workflow/${this.workflowId}/spec.md`
|
|
530
|
+
// });
|
|
531
|
+
// Create mock artifact
|
|
532
|
+
const specContent = `# Technical Specification: ${this.featureName}
|
|
533
|
+
|
|
534
|
+
## Overview
|
|
535
|
+
This is a placeholder technical specification. The real spec-writer agent will
|
|
536
|
+
generate a detailed technical specification.
|
|
537
|
+
|
|
538
|
+
## Architecture
|
|
539
|
+
- [To be filled by spec-writer agent]
|
|
540
|
+
|
|
541
|
+
## Data Models
|
|
542
|
+
- [To be filled by spec-writer agent]
|
|
543
|
+
|
|
544
|
+
## API Design
|
|
545
|
+
- [To be filled by spec-writer agent]
|
|
546
|
+
|
|
547
|
+
## Implementation Notes
|
|
548
|
+
- [To be filled by spec-writer agent]
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
*Generated by WorkflowEngine (stub implementation)*
|
|
552
|
+
`;
|
|
553
|
+
await writeArtifact(this.projectPath, this.workflowId, 'spec', specContent);
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Execute the INTENTS stage
|
|
557
|
+
*
|
|
558
|
+
* TODO (Phase 3): Implement intent-generator agent invocation.
|
|
559
|
+
* The intent-generator agent would create implementation intent files from the SPEC.
|
|
560
|
+
*/
|
|
561
|
+
async executeIntentsStage(checkpoint) {
|
|
562
|
+
console.log('[WorkflowEngine] Executing INTENTS stage (stub implementation)');
|
|
563
|
+
// TODO (Phase 3): Implement intent-generator agent invocation
|
|
564
|
+
// This would invoke the intent-generator agent with the SPEC artifact:
|
|
565
|
+
//
|
|
566
|
+
// const specPath = getArtifactPath(this.projectPath, this.workflowId, 'spec');
|
|
567
|
+
// const agentPrompt = `Generate implementation intents for: ${this.featureName}\n\nSPEC artifact: ${specPath}`;
|
|
568
|
+
// await invokeAgent('intent-generator', agentPrompt, {
|
|
569
|
+
// workflowId: this.workflowId,
|
|
570
|
+
// inputArtifacts: { spec: specPath },
|
|
571
|
+
// outputPath: `.olympus/workflow/${this.workflowId}/intents/`
|
|
572
|
+
// });
|
|
573
|
+
// For intents stage, we create files in the intents directory
|
|
574
|
+
// Since writeArtifact doesn't support intents, we'll write directly
|
|
575
|
+
const fs = await import('fs-extra');
|
|
576
|
+
const path = await import('path');
|
|
577
|
+
const intentsDir = path.join(this.projectPath, '.olympus', 'workflow', this.workflowId, 'intents');
|
|
578
|
+
await fs.ensureDir(intentsDir);
|
|
579
|
+
// Create a sample intent file
|
|
580
|
+
const intentContent = `# Intent: Implement ${this.featureName}
|
|
581
|
+
|
|
582
|
+
## Description
|
|
583
|
+
This is a placeholder intent file. The real intent-generator agent will
|
|
584
|
+
create detailed implementation intents.
|
|
585
|
+
|
|
586
|
+
## Tasks
|
|
587
|
+
- [ ] Task 1: [To be filled by intent-generator agent]
|
|
588
|
+
- [ ] Task 2: [To be filled by intent-generator agent]
|
|
589
|
+
- [ ] Task 3: [To be filled by intent-generator agent]
|
|
590
|
+
|
|
591
|
+
## Dependencies
|
|
592
|
+
- [To be filled by intent-generator agent]
|
|
593
|
+
|
|
594
|
+
---
|
|
595
|
+
*Generated by WorkflowEngine (stub implementation)*
|
|
596
|
+
`;
|
|
597
|
+
await fs.writeFile(path.join(intentsDir, 'intent-001.md'), intentContent, 'utf-8');
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/features/workflow-engine/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,GAAoB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAEpF;;GAEG;AACH,SAAS,YAAY,CAAC,YAA2B;IAC/C,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACvD,IAAI,YAAY,KAAK,CAAC,CAAC,IAAI,YAAY,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClE,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,WAAW,CAAC,YAAY,GAA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