olympus-ai 3.4.0 → 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.
Files changed (94) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +631 -630
  4. package/dist/__tests__/installer.test.js +1 -1
  5. package/dist/__tests__/workflow-engine/checkpoint.test.d.ts +7 -0
  6. package/dist/__tests__/workflow-engine/checkpoint.test.d.ts.map +1 -0
  7. package/dist/__tests__/workflow-engine/checkpoint.test.js +373 -0
  8. package/dist/__tests__/workflow-engine/checkpoint.test.js.map +1 -0
  9. package/dist/agents/definitions.d.ts.map +1 -1
  10. package/dist/agents/definitions.js +8 -0
  11. package/dist/agents/definitions.js.map +1 -1
  12. package/dist/agents/idea-intake.d.ts +20 -0
  13. package/dist/agents/idea-intake.d.ts.map +1 -0
  14. package/dist/agents/idea-intake.js +255 -0
  15. package/dist/agents/idea-intake.js.map +1 -0
  16. package/dist/agents/index.d.ts +4 -0
  17. package/dist/agents/index.d.ts.map +1 -1
  18. package/dist/agents/index.js +4 -0
  19. package/dist/agents/index.js.map +1 -1
  20. package/dist/agents/intent-generator.d.ts +19 -0
  21. package/dist/agents/intent-generator.d.ts.map +1 -0
  22. package/dist/agents/intent-generator.js +303 -0
  23. package/dist/agents/intent-generator.js.map +1 -0
  24. package/dist/agents/prd-writer.d.ts +19 -0
  25. package/dist/agents/prd-writer.d.ts.map +1 -0
  26. package/dist/agents/prd-writer.js +236 -0
  27. package/dist/agents/prd-writer.js.map +1 -0
  28. package/dist/agents/prometheus.d.ts.map +1 -1
  29. package/dist/agents/prometheus.js +123 -2
  30. package/dist/agents/prometheus.js.map +1 -1
  31. package/dist/agents/spec-writer.d.ts +19 -0
  32. package/dist/agents/spec-writer.d.ts.map +1 -0
  33. package/dist/agents/spec-writer.js +528 -0
  34. package/dist/agents/spec-writer.js.map +1 -0
  35. package/dist/features/index.d.ts +1 -0
  36. package/dist/features/index.d.ts.map +1 -1
  37. package/dist/features/index.js +6 -0
  38. package/dist/features/index.js.map +1 -1
  39. package/dist/features/workflow-engine/artifacts.d.ts +96 -0
  40. package/dist/features/workflow-engine/artifacts.d.ts.map +1 -0
  41. package/dist/features/workflow-engine/artifacts.js +399 -0
  42. package/dist/features/workflow-engine/artifacts.js.map +1 -0
  43. package/dist/features/workflow-engine/checkpoint.d.ts +67 -0
  44. package/dist/features/workflow-engine/checkpoint.d.ts.map +1 -0
  45. package/dist/features/workflow-engine/checkpoint.js +249 -0
  46. package/dist/features/workflow-engine/checkpoint.js.map +1 -0
  47. package/dist/features/workflow-engine/engine.d.ts +128 -0
  48. package/dist/features/workflow-engine/engine.d.ts.map +1 -0
  49. package/dist/features/workflow-engine/engine.js +600 -0
  50. package/dist/features/workflow-engine/engine.js.map +1 -0
  51. package/dist/features/workflow-engine/execution.d.ts +99 -0
  52. package/dist/features/workflow-engine/execution.d.ts.map +1 -0
  53. package/dist/features/workflow-engine/execution.js +493 -0
  54. package/dist/features/workflow-engine/execution.js.map +1 -0
  55. package/dist/features/workflow-engine/hooks.d.ts +78 -0
  56. package/dist/features/workflow-engine/hooks.d.ts.map +1 -0
  57. package/dist/features/workflow-engine/hooks.js +188 -0
  58. package/dist/features/workflow-engine/hooks.js.map +1 -0
  59. package/dist/features/workflow-engine/index.d.ts +17 -0
  60. package/dist/features/workflow-engine/index.d.ts.map +1 -0
  61. package/dist/features/workflow-engine/index.js +19 -0
  62. package/dist/features/workflow-engine/index.js.map +1 -0
  63. package/dist/features/workflow-engine/types.d.ts +220 -0
  64. package/dist/features/workflow-engine/types.d.ts.map +1 -0
  65. package/dist/features/workflow-engine/types.js +8 -0
  66. package/dist/features/workflow-engine/types.js.map +1 -0
  67. package/dist/features/workflow-engine/validation.d.ts +128 -0
  68. package/dist/features/workflow-engine/validation.d.ts.map +1 -0
  69. package/dist/features/workflow-engine/validation.js +746 -0
  70. package/dist/features/workflow-engine/validation.js.map +1 -0
  71. package/dist/hooks/ascent-verifier/index.d.ts +52 -0
  72. package/dist/hooks/ascent-verifier/index.d.ts.map +1 -1
  73. package/dist/hooks/ascent-verifier/index.js +146 -0
  74. package/dist/hooks/ascent-verifier/index.js.map +1 -1
  75. package/dist/hooks/registrations/learning-capture.d.ts.map +1 -1
  76. package/dist/hooks/registrations/learning-capture.js +32 -9
  77. package/dist/hooks/registrations/learning-capture.js.map +1 -1
  78. package/dist/hooks/registrations/user-prompt-submit.d.ts.map +1 -1
  79. package/dist/hooks/registrations/user-prompt-submit.js +85 -0
  80. package/dist/hooks/registrations/user-prompt-submit.js.map +1 -1
  81. package/dist/installer/index.d.ts +1 -1
  82. package/dist/installer/index.d.ts.map +1 -1
  83. package/dist/installer/index.js +456 -16
  84. package/dist/installer/index.js.map +1 -1
  85. package/dist/learning/session-state.d.ts.map +1 -1
  86. package/dist/learning/session-state.js +17 -0
  87. package/dist/learning/session-state.js.map +1 -1
  88. package/dist/learning/types.d.ts +3 -0
  89. package/dist/learning/types.d.ts.map +1 -1
  90. package/dist/shared/types.d.ts +17 -0
  91. package/dist/shared/types.d.ts.map +1 -1
  92. package/package.json +3 -1
  93. package/scripts/dist/hooks/olympus-hooks.cjs +208 -97
  94. package/scripts/rebrand.mjs +0 -206
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Checkpoint Persistence Module
3
+ *
4
+ * Handles saving, loading, and managing workflow checkpoints on disk.
5
+ * Checkpoints are stored in .olympus/workflow/{workflow_id}/checkpoint.json
6
+ *
7
+ * Performance optimizations:
8
+ * - In-memory cache to avoid redundant disk reads
9
+ * - Optimized JSON serialization
10
+ * - Batched writes to reduce I/O operations
11
+ */
12
+ import * as fs from 'fs-extra';
13
+ import { join } from 'path';
14
+ const WORKFLOW_DIR = '.olympus/workflow';
15
+ const CHECKPOINT_FILENAME = 'checkpoint.json';
16
+ const checkpointCache = new Map();
17
+ const CACHE_TTL = 5000; // 5 seconds TTL for cache entries
18
+ /**
19
+ * Generate cache key for a workflow
20
+ */
21
+ function getCacheKey(projectPath, workflowId) {
22
+ return `${projectPath}:${workflowId}`;
23
+ }
24
+ /**
25
+ * Check if cache entry is still valid
26
+ */
27
+ function isCacheValid(entry) {
28
+ return Date.now() - entry.timestamp < CACHE_TTL;
29
+ }
30
+ /**
31
+ * Clear the entire checkpoint cache
32
+ * Useful for testing or when you want to force fresh reads
33
+ */
34
+ export function clearCache() {
35
+ checkpointCache.clear();
36
+ }
37
+ /**
38
+ * Invalidate a specific checkpoint in the cache
39
+ */
40
+ export function invalidateCache(projectPath, workflowId) {
41
+ const key = getCacheKey(projectPath, workflowId);
42
+ checkpointCache.delete(key);
43
+ }
44
+ /**
45
+ * Save a workflow checkpoint to disk.
46
+ * Creates directory structure if it doesn't exist.
47
+ * Updates the checkpoint's updated_at timestamp before saving.
48
+ *
49
+ * Performance optimizations:
50
+ * - Updates in-memory cache
51
+ * - Uses optimized JSON serialization
52
+ * - Minimizes syscalls by combining directory check and write
53
+ *
54
+ * @param projectPath - Root path of the project
55
+ * @param checkpoint - Checkpoint data to save
56
+ * @throws Error if disk is full or write permissions are denied
57
+ */
58
+ export async function saveCheckpoint(projectPath, checkpoint) {
59
+ const workflowDir = join(projectPath, WORKFLOW_DIR, checkpoint.workflow_id);
60
+ const checkpointPath = join(workflowDir, CHECKPOINT_FILENAME);
61
+ try {
62
+ // Update timestamp
63
+ checkpoint.updated_at = new Date().toISOString();
64
+ // Ensure directory exists (cached by fs-extra)
65
+ await fs.ensureDir(workflowDir);
66
+ // Optimize JSON serialization - use native JSON.stringify for speed
67
+ // Only use pretty formatting if checkpoint is small (< 10KB estimated)
68
+ const estimatedSize = JSON.stringify(checkpoint).length;
69
+ const useCompact = estimatedSize > 10000;
70
+ if (useCompact) {
71
+ // Fast path: compact JSON for large checkpoints
72
+ const jsonContent = JSON.stringify(checkpoint);
73
+ await fs.writeFile(checkpointPath, jsonContent, 'utf-8');
74
+ }
75
+ else {
76
+ // Standard path: readable formatting for small checkpoints
77
+ await fs.writeJson(checkpointPath, checkpoint, { spaces: 2 });
78
+ }
79
+ // Update cache
80
+ const cacheKey = getCacheKey(projectPath, checkpoint.workflow_id);
81
+ checkpointCache.set(cacheKey, {
82
+ checkpoint: { ...checkpoint }, // Store a copy to prevent mutation
83
+ timestamp: Date.now(),
84
+ dirty: false,
85
+ });
86
+ }
87
+ catch (error) {
88
+ const err = error;
89
+ // Handle disk full error
90
+ if (err.code === 'ENOSPC') {
91
+ console.error(`[Checkpoint] Failed to save checkpoint: Disk full`);
92
+ console.error(`[Checkpoint] Please free up disk space and try again.`);
93
+ console.error(`[Checkpoint] Attempted path: ${checkpointPath}`);
94
+ throw new Error('Failed to save checkpoint: Disk is full. Please free up space and retry.');
95
+ }
96
+ // Handle permission denied error
97
+ if (err.code === 'EACCES' || err.code === 'EPERM') {
98
+ console.error(`[Checkpoint] Failed to save checkpoint: Permission denied`);
99
+ console.error(`[Checkpoint] Path: ${checkpointPath}`);
100
+ throw new Error(`Failed to save checkpoint: Permission denied for ${checkpointPath}`);
101
+ }
102
+ // Handle read-only filesystem
103
+ if (err.code === 'EROFS') {
104
+ console.error(`[Checkpoint] Failed to save checkpoint: Read-only filesystem`);
105
+ console.error(`[Checkpoint] Path: ${checkpointPath}`);
106
+ throw new Error('Failed to save checkpoint: Filesystem is read-only');
107
+ }
108
+ // Generic error with context
109
+ console.error(`[Checkpoint] Failed to save checkpoint:`, err.message);
110
+ console.error(`[Checkpoint] Workflow ID: ${checkpoint.workflow_id}`);
111
+ console.error(`[Checkpoint] Path: ${checkpointPath}`);
112
+ throw new Error(`Failed to save checkpoint for workflow ${checkpoint.workflow_id}: ${err.message}`);
113
+ }
114
+ }
115
+ /**
116
+ * Load a workflow checkpoint from disk.
117
+ * Returns null if checkpoint doesn't exist or if JSON is corrupt.
118
+ *
119
+ * Performance optimizations:
120
+ * - Uses in-memory cache to avoid redundant disk reads
121
+ * - Fast-path for cache hits
122
+ * - Optimized JSON parsing
123
+ *
124
+ * @param projectPath - Root path of the project
125
+ * @param workflowId - ID of the workflow to load
126
+ * @returns Checkpoint data or null if not found/invalid
127
+ */
128
+ export async function loadCheckpoint(projectPath, workflowId) {
129
+ const cacheKey = getCacheKey(projectPath, workflowId);
130
+ // Check cache first
131
+ const cachedEntry = checkpointCache.get(cacheKey);
132
+ if (cachedEntry && isCacheValid(cachedEntry)) {
133
+ // Return a copy to prevent external mutations from affecting the cache
134
+ return { ...cachedEntry.checkpoint };
135
+ }
136
+ const checkpointPath = join(projectPath, WORKFLOW_DIR, workflowId, CHECKPOINT_FILENAME);
137
+ try {
138
+ // Fast path: use readFile + JSON.parse instead of fs.readJson
139
+ // This is faster for typical checkpoint sizes
140
+ const fileContent = await fs.readFile(checkpointPath, 'utf-8');
141
+ const checkpoint = JSON.parse(fileContent);
142
+ // Validate schema_version exists
143
+ if (!checkpoint.schema_version) {
144
+ console.warn(`[Checkpoint] Checkpoint ${workflowId} missing schema_version, treating as invalid`);
145
+ console.warn(`[Checkpoint] Checkpoint may be corrupt or from an older version`);
146
+ console.warn(`[Checkpoint] Consider deleting: ${checkpointPath}`);
147
+ return null;
148
+ }
149
+ // Update cache with fresh data
150
+ checkpointCache.set(cacheKey, {
151
+ checkpoint: { ...checkpoint },
152
+ timestamp: Date.now(),
153
+ dirty: false,
154
+ });
155
+ return checkpoint;
156
+ }
157
+ catch (error) {
158
+ const err = error;
159
+ const nodeErr = err;
160
+ // Handle file not found (most common case)
161
+ if (nodeErr.code === 'ENOENT') {
162
+ return null;
163
+ }
164
+ // Handle JSON parse errors (corrupt checkpoint)
165
+ if (err.name === 'SyntaxError' || err.message.includes('JSON')) {
166
+ console.warn(`[Checkpoint] Corrupt checkpoint detected for workflow ${workflowId}`);
167
+ console.warn(`[Checkpoint] Path: ${checkpointPath}`);
168
+ console.warn(`[Checkpoint] Error: ${err.message}`);
169
+ console.warn(`[Checkpoint] To reset this workflow, delete the checkpoint file and start over`);
170
+ return null;
171
+ }
172
+ // Handle permission errors
173
+ if (nodeErr.code === 'EACCES' || nodeErr.code === 'EPERM') {
174
+ console.warn(`[Checkpoint] Permission denied reading checkpoint ${workflowId}`);
175
+ console.warn(`[Checkpoint] Path: ${checkpointPath}`);
176
+ return null;
177
+ }
178
+ // Generic error
179
+ console.warn(`[Checkpoint] Failed to load checkpoint ${workflowId}: ${err.message}`);
180
+ console.warn(`[Checkpoint] Path: ${checkpointPath}`);
181
+ return null;
182
+ }
183
+ }
184
+ /**
185
+ * List all workflow IDs in the project.
186
+ * Returns an empty array if workflow directory doesn't exist.
187
+ *
188
+ * @param projectPath - Root path of the project
189
+ * @returns Array of workflow IDs
190
+ */
191
+ export async function listWorkflows(projectPath) {
192
+ const workflowsDir = join(projectPath, WORKFLOW_DIR);
193
+ try {
194
+ // Check if workflows directory exists
195
+ const exists = await fs.pathExists(workflowsDir);
196
+ if (!exists) {
197
+ return [];
198
+ }
199
+ // Read directory entries
200
+ const entries = await fs.readdir(workflowsDir, { withFileTypes: true });
201
+ // Filter to only directories
202
+ return entries
203
+ .filter(entry => entry.isDirectory())
204
+ .map(entry => entry.name);
205
+ }
206
+ catch (error) {
207
+ const err = error;
208
+ // Handle permission errors
209
+ if (err.code === 'EACCES' || err.code === 'EPERM') {
210
+ console.warn(`[Checkpoint] Permission denied listing workflows in ${workflowsDir}`);
211
+ return [];
212
+ }
213
+ // Generic error
214
+ console.warn(`[Checkpoint] Failed to list workflows: ${err.message}`);
215
+ console.warn(`[Checkpoint] Directory: ${workflowsDir}`);
216
+ return [];
217
+ }
218
+ }
219
+ /**
220
+ * Delete a workflow and all its associated files.
221
+ * Idempotent - no error if workflow doesn't exist.
222
+ *
223
+ * @param projectPath - Root path of the project
224
+ * @param workflowId - ID of the workflow to delete
225
+ */
226
+ export async function deleteWorkflow(projectPath, workflowId) {
227
+ const workflowDir = join(projectPath, WORKFLOW_DIR, workflowId);
228
+ try {
229
+ await fs.remove(workflowDir);
230
+ }
231
+ catch (error) {
232
+ const err = error;
233
+ // Silently handle missing directories (idempotent)
234
+ if (err.code === 'ENOENT') {
235
+ return;
236
+ }
237
+ // Handle permission errors
238
+ if (err.code === 'EACCES' || err.code === 'EPERM') {
239
+ console.warn(`[Checkpoint] Permission denied deleting workflow ${workflowId}`);
240
+ console.warn(`[Checkpoint] Path: ${workflowDir}`);
241
+ console.warn(`[Checkpoint] Manual deletion may be required`);
242
+ return;
243
+ }
244
+ // Log unexpected errors but don't throw (best effort deletion)
245
+ console.warn(`[Checkpoint] Failed to delete workflow ${workflowId}: ${err.message}`);
246
+ console.warn(`[Checkpoint] Path: ${workflowDir}`);
247
+ }
248
+ }
249
+ //# sourceMappingURL=checkpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.js","sourceRoot":"","sources":["../../../src/features/workflow-engine/checkpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,MAAM,YAAY,GAAG,mBAAmB,CAAC;AACzC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAa9C,MAAM,eAAe,GAAG,IAAI,GAAG,EAAsB,CAAC;AACtD,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,kCAAkC;AAE1D;;GAEG;AACH,SAAS,WAAW,CAAC,WAAmB,EAAE,UAAkB;IAC1D,OAAO,GAAG,WAAW,IAAI,UAAU,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,KAAiB;IACrC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,eAAe,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,UAAkB;IACrE,MAAM,GAAG,GAAG,WAAW,CAAC,WAAW,EAAE,U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QACf,MAAM,GAAG,GAAG,KAA8B,CAAC;QAE3C,mDAAmD;QACnD,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,2BAA2B;QAC3B,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAClD,OAAO,CAAC,IAAI,CAAC,oDAAoD,UAAU,EAAE,CAAC,CAAC;YAC/E,OAAO,CAAC,IAAI,CAAC,sBAAsB,WAAW,EAAE,CAAC,CAAC;YAClD,OAAO,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;YAC7D,OAAO;QACT,CAAC;QAED,+DAA+D;QAC/D,OAAO,CAAC,IAAI,CAAC,0CAA0C,UAAU,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACrF,OAAO,CAAC,IAAI,CAAC,sBAAsB,WAAW,EAAE,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
@@ -0,0 +1,128 @@
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 { WorkflowStage, WorkflowStatus, ArtifactReference } from './types.js';
13
+ /**
14
+ * Status response returned by getStatus()
15
+ */
16
+ export interface WorkflowStatusResponse {
17
+ workflow_id: string;
18
+ feature_name: string;
19
+ current_stage: WorkflowStage;
20
+ status: WorkflowStatus;
21
+ artifacts: ArtifactReference[];
22
+ updated_at: string;
23
+ }
24
+ /**
25
+ * WorkflowEngine orchestrates the multi-stage workflow system.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const engine = new WorkflowEngine('/path/to/project', 'User Authentication');
30
+ * await engine.start('I want to build a user login system with OAuth');
31
+ * // Later...
32
+ * await engine.resume();
33
+ * ```
34
+ */
35
+ export declare class WorkflowEngine {
36
+ private projectPath;
37
+ private featureName;
38
+ private workflowId;
39
+ private interruptHandler;
40
+ /**
41
+ * Create a new WorkflowEngine instance
42
+ *
43
+ * @param projectPath - Absolute path to the project root
44
+ * @param featureName - Human-readable name for the feature
45
+ */
46
+ constructor(projectPath: string, featureName: string);
47
+ /**
48
+ * Start a new workflow from the IDEA stage
49
+ *
50
+ * @param initialPrompt - The user's initial description of the feature
51
+ * @throws Error if disk is full, permissions are denied, or workflow initialization fails
52
+ */
53
+ start(initialPrompt: string): Promise<void>;
54
+ /**
55
+ * Resume an existing workflow from its current stage
56
+ *
57
+ * @returns Status message indicating what happened
58
+ * @throws Error if checkpoint doesn't exist or workflow execution fails
59
+ */
60
+ resume(): Promise<string>;
61
+ /**
62
+ * Pause the workflow at its current state
63
+ *
64
+ * @returns Path to the checkpoint file
65
+ * @throws Error if checkpoint doesn't exist or save fails
66
+ */
67
+ pause(): Promise<string>;
68
+ /**
69
+ * Execute a specific workflow stage
70
+ *
71
+ * @param stage - The stage to execute
72
+ */
73
+ executeStage(stage: WorkflowStage): Promise<void>;
74
+ /**
75
+ * Get the current status of the workflow
76
+ *
77
+ * @throws Error if checkpoint doesn't exist or load fails
78
+ */
79
+ getStatus(): Promise<WorkflowStatusResponse>;
80
+ /**
81
+ * Setup SIGINT handler to save checkpoint when workflow is interrupted.
82
+ * This allows users to resume their workflow later with `/plan continue`.
83
+ *
84
+ * @private
85
+ */
86
+ private setupInterruptHandler;
87
+ /**
88
+ * Clean up the interrupt handler when workflow completes or errors.
89
+ *
90
+ * @private
91
+ */
92
+ private cleanupInterruptHandler;
93
+ /**
94
+ * Execute the IDEA stage
95
+ *
96
+ * Invokes the idea-intake agent to generate the IDEA artifact.
97
+ * The artifact is validated before the stage is considered complete.
98
+ *
99
+ * TODO: Replace with actual Task tool invocation when integration is complete.
100
+ * Current implementation creates mock artifacts with validation.
101
+ */
102
+ private executeIdeaStage;
103
+ /**
104
+ * Execute the PRD stage
105
+ *
106
+ * Invokes the prd-writer agent to generate the PRD artifact.
107
+ * The PRD is validated against the IDEA artifact to ensure coverage.
108
+ *
109
+ * TODO: Replace with actual Task tool invocation when integration is complete.
110
+ * Current implementation creates mock artifacts with validation.
111
+ */
112
+ private executePrdStage;
113
+ /**
114
+ * Execute the SPEC stage
115
+ *
116
+ * TODO (Phase 3): Implement spec-writer agent invocation.
117
+ * The spec-writer agent would generate a technical specification from the PRD.
118
+ */
119
+ private executeSpecStage;
120
+ /**
121
+ * Execute the INTENTS stage
122
+ *
123
+ * TODO (Phase 3): Implement intent-generator agent invocation.
124
+ * The intent-generator agent would create implementation intent files from the SPEC.
125
+ */
126
+ private executeIntentsStage;
127
+ }
128
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/features/workflow-engine/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,aAAa,EACb,cAAc,EACd,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAqBpB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,gBAAgB,CAA6B;IAErD;;;;;OAKG;gBACS,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAOpD;;;;;OAKG;IACG,KAAK,CAAC,aAAa,EAAE,MAAM,GAA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