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.
Files changed (90) hide show
  1. package/README.md +631 -630
  2. package/dist/__tests__/workflow-engine/checkpoint.test.d.ts +7 -0
  3. package/dist/__tests__/workflow-engine/checkpoint.test.d.ts.map +1 -0
  4. package/dist/__tests__/workflow-engine/checkpoint.test.js +373 -0
  5. package/dist/__tests__/workflow-engine/checkpoint.test.js.map +1 -0
  6. package/dist/agents/definitions.d.ts.map +1 -1
  7. package/dist/agents/definitions.js +8 -0
  8. package/dist/agents/definitions.js.map +1 -1
  9. package/dist/agents/idea-intake.d.ts +20 -0
  10. package/dist/agents/idea-intake.d.ts.map +1 -0
  11. package/dist/agents/idea-intake.js +255 -0
  12. package/dist/agents/idea-intake.js.map +1 -0
  13. package/dist/agents/index.d.ts +4 -0
  14. package/dist/agents/index.d.ts.map +1 -1
  15. package/dist/agents/index.js +4 -0
  16. package/dist/agents/index.js.map +1 -1
  17. package/dist/agents/intent-generator.d.ts +19 -0
  18. package/dist/agents/intent-generator.d.ts.map +1 -0
  19. package/dist/agents/intent-generator.js +303 -0
  20. package/dist/agents/intent-generator.js.map +1 -0
  21. package/dist/agents/prd-writer.d.ts +19 -0
  22. package/dist/agents/prd-writer.d.ts.map +1 -0
  23. package/dist/agents/prd-writer.js +236 -0
  24. package/dist/agents/prd-writer.js.map +1 -0
  25. package/dist/agents/prometheus.d.ts.map +1 -1
  26. package/dist/agents/prometheus.js +96 -2
  27. package/dist/agents/prometheus.js.map +1 -1
  28. package/dist/agents/spec-writer.d.ts +19 -0
  29. package/dist/agents/spec-writer.d.ts.map +1 -0
  30. package/dist/agents/spec-writer.js +528 -0
  31. package/dist/agents/spec-writer.js.map +1 -0
  32. package/dist/features/index.d.ts +1 -0
  33. package/dist/features/index.d.ts.map +1 -1
  34. package/dist/features/index.js +6 -0
  35. package/dist/features/index.js.map +1 -1
  36. package/dist/features/workflow-engine/artifacts.d.ts +96 -0
  37. package/dist/features/workflow-engine/artifacts.d.ts.map +1 -0
  38. package/dist/features/workflow-engine/artifacts.js +399 -0
  39. package/dist/features/workflow-engine/artifacts.js.map +1 -0
  40. package/dist/features/workflow-engine/checkpoint.d.ts +67 -0
  41. package/dist/features/workflow-engine/checkpoint.d.ts.map +1 -0
  42. package/dist/features/workflow-engine/checkpoint.js +249 -0
  43. package/dist/features/workflow-engine/checkpoint.js.map +1 -0
  44. package/dist/features/workflow-engine/engine.d.ts +128 -0
  45. package/dist/features/workflow-engine/engine.d.ts.map +1 -0
  46. package/dist/features/workflow-engine/engine.js +600 -0
  47. package/dist/features/workflow-engine/engine.js.map +1 -0
  48. package/dist/features/workflow-engine/execution.d.ts +99 -0
  49. package/dist/features/workflow-engine/execution.d.ts.map +1 -0
  50. package/dist/features/workflow-engine/execution.js +493 -0
  51. package/dist/features/workflow-engine/execution.js.map +1 -0
  52. package/dist/features/workflow-engine/hooks.d.ts +78 -0
  53. package/dist/features/workflow-engine/hooks.d.ts.map +1 -0
  54. package/dist/features/workflow-engine/hooks.js +188 -0
  55. package/dist/features/workflow-engine/hooks.js.map +1 -0
  56. package/dist/features/workflow-engine/index.d.ts +17 -0
  57. package/dist/features/workflow-engine/index.d.ts.map +1 -0
  58. package/dist/features/workflow-engine/index.js +19 -0
  59. package/dist/features/workflow-engine/index.js.map +1 -0
  60. package/dist/features/workflow-engine/types.d.ts +220 -0
  61. package/dist/features/workflow-engine/types.d.ts.map +1 -0
  62. package/dist/features/workflow-engine/types.js +8 -0
  63. package/dist/features/workflow-engine/types.js.map +1 -0
  64. package/dist/features/workflow-engine/validation.d.ts +128 -0
  65. package/dist/features/workflow-engine/validation.d.ts.map +1 -0
  66. package/dist/features/workflow-engine/validation.js +746 -0
  67. package/dist/features/workflow-engine/validation.js.map +1 -0
  68. package/dist/hooks/ascent-verifier/index.d.ts +52 -0
  69. package/dist/hooks/ascent-verifier/index.d.ts.map +1 -1
  70. package/dist/hooks/ascent-verifier/index.js +146 -0
  71. package/dist/hooks/ascent-verifier/index.js.map +1 -1
  72. package/dist/hooks/registrations/learning-capture.d.ts.map +1 -1
  73. package/dist/hooks/registrations/learning-capture.js +32 -9
  74. package/dist/hooks/registrations/learning-capture.js.map +1 -1
  75. package/dist/hooks/registrations/user-prompt-submit.d.ts.map +1 -1
  76. package/dist/hooks/registrations/user-prompt-submit.js +85 -0
  77. package/dist/hooks/registrations/user-prompt-submit.js.map +1 -1
  78. package/dist/installer/index.d.ts.map +1 -1
  79. package/dist/installer/index.js +310 -1
  80. package/dist/installer/index.js.map +1 -1
  81. package/dist/learning/session-state.d.ts.map +1 -1
  82. package/dist/learning/session-state.js +17 -0
  83. package/dist/learning/session-state.js.map +1 -1
  84. package/dist/learning/types.d.ts +3 -0
  85. package/dist/learning/types.d.ts.map +1 -1
  86. package/dist/shared/types.d.ts +17 -0
  87. package/dist/shared/types.d.ts.map +1 -1
  88. package/package.json +3 -1
  89. package/scripts/dist/hooks/olympus-hooks.cjs +208 -97
  90. package/scripts/rebrand.mjs +0 -206
@@ -0,0 +1,399 @@
1
+ import * as path from 'path';
2
+ import * as fs from 'fs-extra';
3
+ /**
4
+ * Ensures the workflow directory structure exists.
5
+ * Creates:
6
+ * - .olympus/workflow/{workflowId}/
7
+ * - .olympus/workflow/{workflowId}/intents/
8
+ * - .olympus/workflow/{workflowId}/validation/
9
+ * - .olympus/workflow/{workflowId}/checkpoint.json (if not exists)
10
+ *
11
+ * Idempotent - safe to call multiple times.
12
+ * @throws Error if disk is full or permissions are denied
13
+ */
14
+ export async function ensureWorkflowDir(projectPath, workflowId) {
15
+ const workflowDir = path.join(projectPath, '.olympus', 'workflow', workflowId);
16
+ const intentsDir = path.join(workflowDir, 'intents');
17
+ const validationDir = path.join(workflowDir, 'validation');
18
+ const checkpointPath = path.join(workflowDir, 'checkpoint.json');
19
+ try {
20
+ // Create directories
21
+ await fs.ensureDir(workflowDir);
22
+ await fs.ensureDir(intentsDir);
23
+ await fs.ensureDir(validationDir);
24
+ // Initialize checkpoint.json if it doesn't exist
25
+ if (!await fs.pathExists(checkpointPath)) {
26
+ await fs.writeJson(checkpointPath, {
27
+ workflow_id: workflowId,
28
+ current_stage: 'idea',
29
+ created_at: new Date().toISOString(),
30
+ updated_at: new Date().toISOString(),
31
+ }, { spaces: 2 });
32
+ }
33
+ }
34
+ catch (error) {
35
+ const err = error;
36
+ // Handle disk full error
37
+ if (err.code === 'ENOSPC') {
38
+ console.error(`[Artifacts] Failed to create workflow directory: Disk full`);
39
+ console.error(`[Artifacts] Please free up disk space and try again.`);
40
+ console.error(`[Artifacts] Attempted path: ${workflowDir}`);
41
+ throw new Error('Failed to create workflow directory: Disk is full. Please free up space and retry.');
42
+ }
43
+ // Handle permission denied error
44
+ if (err.code === 'EACCES' || err.code === 'EPERM') {
45
+ console.error(`[Artifacts] Failed to create workflow directory: Permission denied`);
46
+ console.error(`[Artifacts] Path: ${workflowDir}`);
47
+ throw new Error(`Failed to create workflow directory: Permission denied for ${workflowDir}`);
48
+ }
49
+ // Handle read-only filesystem
50
+ if (err.code === 'EROFS') {
51
+ console.error(`[Artifacts] Failed to create workflow directory: Read-only filesystem`);
52
+ console.error(`[Artifacts] Path: ${workflowDir}`);
53
+ throw new Error('Failed to create workflow directory: Filesystem is read-only');
54
+ }
55
+ // Generic error with context
56
+ console.error(`[Artifacts] Failed to create workflow directory: ${err.message}`);
57
+ console.error(`[Artifacts] Workflow ID: ${workflowId}`);
58
+ console.error(`[Artifacts] Path: ${workflowDir}`);
59
+ throw new Error(`Failed to create workflow directory for ${workflowId}: ${err.message}`);
60
+ }
61
+ }
62
+ /**
63
+ * Returns the file path for a given workflow stage artifact.
64
+ *
65
+ * @throws Error if stage is 'complete' (no artifact for complete stage)
66
+ * @throws Error if stage is 'intents' (intents is a directory, not a file)
67
+ */
68
+ export function getArtifactPath(projectPath, workflowId, stage) {
69
+ if (stage === 'complete') {
70
+ throw new Error('No artifact file for complete stage');
71
+ }
72
+ if (stage === 'intents') {
73
+ throw new Error('Intents is a directory, not a single file. Use getIntentsDir() instead.');
74
+ }
75
+ const workflowDir = path.join(projectPath, '.olympus', 'workflow', workflowId);
76
+ const artifactMap = {
77
+ 'idea': 'idea.md',
78
+ 'prd': 'prd.md',
79
+ 'spec': 'spec.md',
80
+ };
81
+ const filename = artifactMap[stage];
82
+ return path.join(workflowDir, filename);
83
+ }
84
+ /**
85
+ * Writes artifact content to the correct path for the given stage.
86
+ * Creates parent directories if needed.
87
+ *
88
+ * @throws Error if stage is 'intents' (use different function for multiple intent files)
89
+ * @throws Error if stage is 'complete' (no artifact for complete stage)
90
+ * @throws Error if disk is full or permissions are denied
91
+ */
92
+ export async function writeArtifact(projectPath, workflowId, stage, content) {
93
+ if (stage === 'intents') {
94
+ throw new Error('Cannot write single artifact for intents stage. Use writeIntentFile() instead.');
95
+ }
96
+ const artifactPath = getArtifactPath(projectPath, workflowId, stage);
97
+ try {
98
+ await fs.ensureDir(path.dirname(artifactPath));
99
+ await fs.writeFile(artifactPath, content, 'utf-8');
100
+ }
101
+ catch (error) {
102
+ const err = error;
103
+ // Handle disk full error
104
+ if (err.code === 'ENOSPC') {
105
+ console.error(`[Artifacts] Failed to write ${stage} artifact: Disk full`);
106
+ console.error(`[Artifacts] Please free up disk space and try again.`);
107
+ console.error(`[Artifacts] Path: ${artifactPath}`);
108
+ throw new Error(`Failed to write ${stage} artifact: Disk is full. Please free up space and retry.`);
109
+ }
110
+ // Handle permission denied error
111
+ if (err.code === 'EACCES' || err.code === 'EPERM') {
112
+ console.error(`[Artifacts] Failed to write ${stage} artifact: Permission denied`);
113
+ console.error(`[Artifacts] Path: ${artifactPath}`);
114
+ throw new Error(`Failed to write ${stage} artifact: Permission denied for ${artifactPath}`);
115
+ }
116
+ // Handle read-only filesystem
117
+ if (err.code === 'EROFS') {
118
+ console.error(`[Artifacts] Failed to write ${stage} artifact: Read-only filesystem`);
119
+ console.error(`[Artifacts] Path: ${artifactPath}`);
120
+ throw new Error(`Failed to write ${stage} artifact: Filesystem is read-only`);
121
+ }
122
+ // Generic error with context
123
+ console.error(`[Artifacts] Failed to write ${stage} artifact: ${err.message}`);
124
+ console.error(`[Artifacts] Path: ${artifactPath}`);
125
+ throw new Error(`Failed to write ${stage} artifact: ${err.message}`);
126
+ }
127
+ }
128
+ /**
129
+ * Reads artifact content from the correct path for the given stage.
130
+ *
131
+ * @returns Content of the artifact, or null if the file doesn't exist
132
+ * @throws Error if stage is 'intents' (use different function to read multiple files)
133
+ * @throws Error if stage is 'complete' (no artifact for complete stage)
134
+ * @throws Error if permissions are denied or file is corrupt
135
+ */
136
+ export async function readArtifact(projectPath, workflowId, stage) {
137
+ if (stage === 'intents') {
138
+ throw new Error('Cannot read single artifact for intents stage. Use readIntentFiles() instead.');
139
+ }
140
+ const artifactPath = getArtifactPath(projectPath, workflowId, stage);
141
+ try {
142
+ if (!await fs.pathExists(artifactPath)) {
143
+ return null;
144
+ }
145
+ return await fs.readFile(artifactPath, 'utf-8');
146
+ }
147
+ catch (error) {
148
+ const err = error;
149
+ // File not found is expected (return null)
150
+ if (err.code === 'ENOENT') {
151
+ return null;
152
+ }
153
+ // Handle permission denied error
154
+ if (err.code === 'EACCES' || err.code === 'EPERM') {
155
+ console.error(`[Artifacts] Failed to read ${stage} artifact: Permission denied`);
156
+ console.error(`[Artifacts] Path: ${artifactPath}`);
157
+ throw new Error(`Failed to read ${stage} artifact: Permission denied for ${artifactPath}`);
158
+ }
159
+ // Generic error with context
160
+ console.error(`[Artifacts] Failed to read ${stage} artifact: ${err.message}`);
161
+ console.error(`[Artifacts] Path: ${artifactPath}`);
162
+ throw new Error(`Failed to read ${stage} artifact: ${err.message}`);
163
+ }
164
+ }
165
+ /**
166
+ * Generates a dependency graph from an array of intent tasks.
167
+ * Creates nodes and edges representing task dependencies.
168
+ *
169
+ * @param tasks - Array of IntentTask objects with dependencies
170
+ * @returns DependencyGraph with nodes and edges
171
+ *
172
+ * @example
173
+ * const tasks = [
174
+ * { id: "A", title: "Task A", component: "Auth", estimated_effort: 3, dependencies: [] },
175
+ * { id: "B", title: "Task B", component: "Auth", estimated_effort: 2, dependencies: ["A"] }
176
+ * ];
177
+ * const graph = generateDependencyGraph(tasks);
178
+ * // Returns: { nodes: [...], edges: [{ from: "A", to: "B" }] }
179
+ */
180
+ export function generateDependencyGraph(tasks) {
181
+ const nodes = tasks.map(task => ({
182
+ id: task.id,
183
+ title: task.title,
184
+ component: task.component,
185
+ estimated_effort: task.estimated_effort,
186
+ }));
187
+ const edges = [];
188
+ for (const task of tasks) {
189
+ for (const dep of task.dependencies) {
190
+ edges.push({ from: dep, to: task.id });
191
+ }
192
+ }
193
+ return { nodes, edges };
194
+ }
195
+ /**
196
+ * Validates a dependency graph for cycles and structural integrity.
197
+ * Throws errors if:
198
+ * - Circular dependencies are detected
199
+ * - Node IDs are not unique
200
+ * - Edge references point to non-existent nodes
201
+ *
202
+ * @param graph - The dependency graph to validate
203
+ * @throws Error if validation fails with detailed message
204
+ *
205
+ * @example
206
+ * validateDependencyGraph(graph); // Throws if graph has cycles
207
+ */
208
+ export function validateDependencyGraph(graph) {
209
+ // Validate unique node IDs
210
+ const nodeIds = new Set();
211
+ for (const node of graph.nodes) {
212
+ if (nodeIds.has(node.id)) {
213
+ throw new Error(`Duplicate node ID detected: ${node.id}`);
214
+ }
215
+ nodeIds.add(node.id);
216
+ }
217
+ // Validate all edges reference existing nodes
218
+ for (const edge of graph.edges) {
219
+ if (!nodeIds.has(edge.from)) {
220
+ throw new Error(`Edge references non-existent node: ${edge.from}`);
221
+ }
222
+ if (!nodeIds.has(edge.to)) {
223
+ throw new Error(`Edge references non-existent node: ${edge.to}`);
224
+ }
225
+ }
226
+ // Detect circular dependencies using DFS
227
+ const adjacencyList = new Map();
228
+ for (const node of graph.nodes) {
229
+ adjacencyList.set(node.id, []);
230
+ }
231
+ for (const edge of graph.edges) {
232
+ adjacencyList.get(edge.from).push(edge.to);
233
+ }
234
+ const visited = new Set();
235
+ const recStack = new Set();
236
+ const path = [];
237
+ function dfs(nodeId) {
238
+ visited.add(nodeId);
239
+ recStack.add(nodeId);
240
+ path.push(nodeId);
241
+ const neighbors = adjacencyList.get(nodeId) || [];
242
+ for (const neighbor of neighbors) {
243
+ if (!visited.has(neighbor)) {
244
+ if (dfs(neighbor)) {
245
+ return true;
246
+ }
247
+ }
248
+ else if (recStack.has(neighbor)) {
249
+ // Found a cycle
250
+ const cycleStart = path.indexOf(neighbor);
251
+ const cycle = path.slice(cycleStart).concat(neighbor);
252
+ throw new Error(`Circular dependency detected: ${cycle.join(' -> ')}`);
253
+ }
254
+ }
255
+ recStack.delete(nodeId);
256
+ path.pop();
257
+ return false;
258
+ }
259
+ for (const node of graph.nodes) {
260
+ if (!visited.has(node.id)) {
261
+ dfs(node.id);
262
+ }
263
+ }
264
+ }
265
+ /**
266
+ * Returns the execution order of tasks based on dependency graph.
267
+ * Uses topological sort (Kahn's algorithm) to determine order.
268
+ *
269
+ * @param graph - The dependency graph to sort
270
+ * @returns Array of task IDs in execution order
271
+ * @throws Error if graph contains cycles (should validate first)
272
+ *
273
+ * @example
274
+ * const order = getExecutionOrder(graph);
275
+ * // Returns: ["TASK-001", "TASK-002", "TASK-003"]
276
+ */
277
+ export function getExecutionOrder(graph) {
278
+ // Build adjacency list and in-degree map
279
+ const adjacencyList = new Map();
280
+ const inDegree = new Map();
281
+ // Initialize
282
+ for (const node of graph.nodes) {
283
+ adjacencyList.set(node.id, []);
284
+ inDegree.set(node.id, 0);
285
+ }
286
+ // Build graph
287
+ for (const edge of graph.edges) {
288
+ adjacencyList.get(edge.from).push(edge.to);
289
+ inDegree.set(edge.to, (inDegree.get(edge.to) || 0) + 1);
290
+ }
291
+ // Kahn's algorithm
292
+ const queue = [];
293
+ const result = [];
294
+ // Start with nodes that have no dependencies
295
+ for (const [nodeId, degree] of inDegree.entries()) {
296
+ if (degree === 0) {
297
+ queue.push(nodeId);
298
+ }
299
+ }
300
+ while (queue.length > 0) {
301
+ const current = queue.shift();
302
+ result.push(current);
303
+ // Reduce in-degree for neighbors
304
+ const neighbors = adjacencyList.get(current) || [];
305
+ for (const neighbor of neighbors) {
306
+ const newDegree = inDegree.get(neighbor) - 1;
307
+ inDegree.set(neighbor, newDegree);
308
+ if (newDegree === 0) {
309
+ queue.push(neighbor);
310
+ }
311
+ }
312
+ }
313
+ // If result doesn't contain all nodes, there's a cycle
314
+ if (result.length !== graph.nodes.length) {
315
+ throw new Error('Cannot determine execution order: graph contains cycles');
316
+ }
317
+ return result;
318
+ }
319
+ /**
320
+ * Links workflow artifacts to the master plan file.
321
+ * Creates or updates .olympus/plans/{workflowId}-plan.md with references
322
+ * to all structured workflow artifacts.
323
+ *
324
+ * @param projectPath - Root path of the project
325
+ * @param workflowId - Unique workflow identifier
326
+ * @throws Error if disk is full or permissions are denied
327
+ *
328
+ * @example
329
+ * await linkMasterPlan('/path/to/project', 'wf-2024-01-15-user-auth');
330
+ * // Creates/updates .olympus/plans/wf-2024-01-15-user-auth-plan.md
331
+ */
332
+ export async function linkMasterPlan(projectPath, workflowId) {
333
+ const plansDir = path.join(projectPath, '.olympus', 'plans');
334
+ const planPath = path.join(plansDir, `${workflowId}-plan.md`);
335
+ try {
336
+ await fs.ensureDir(plansDir);
337
+ const artifactsSection = `## Structured Artifacts
338
+
339
+ This feature was developed using the structured workflow system:
340
+
341
+ - [IDEA Artifact](.olympus/workflow/${workflowId}/idea.md)
342
+ - [PRD Artifact](.olympus/workflow/${workflowId}/prd.md)
343
+ - [SPEC Artifact](.olympus/workflow/${workflowId}/spec.md)
344
+ - [Intent Files](.olympus/workflow/${workflowId}/intents/)
345
+ - [Dependency Graph](.olympus/workflow/${workflowId}/intents/dependency-graph.json)
346
+ - [Workflow Checkpoint](.olympus/workflow/${workflowId}/checkpoint.json)
347
+ `;
348
+ let content = '';
349
+ if (await fs.pathExists(planPath)) {
350
+ // Read existing file
351
+ content = await fs.readFile(planPath, 'utf-8');
352
+ // Check if Structured Artifacts section exists
353
+ const sectionRegex = /## Structured Artifacts[\s\S]*?(?=\n## |$)/;
354
+ if (sectionRegex.test(content)) {
355
+ // Replace existing section
356
+ content = content.replace(sectionRegex, artifactsSection.trim());
357
+ }
358
+ else {
359
+ // Append section at the end
360
+ content = content.trim() + '\n\n' + artifactsSection;
361
+ }
362
+ }
363
+ else {
364
+ // Create new file with header
365
+ content = `# Plan: ${workflowId}
366
+
367
+ ${artifactsSection}`;
368
+ }
369
+ await fs.writeFile(planPath, content, 'utf-8');
370
+ }
371
+ catch (error) {
372
+ const err = error;
373
+ // Handle disk full error
374
+ if (err.code === 'ENOSPC') {
375
+ console.error(`[Artifacts] Failed to link master plan: Disk full`);
376
+ console.error(`[Artifacts] Please free up disk space and try again.`);
377
+ console.error(`[Artifacts] Path: ${planPath}`);
378
+ throw new Error('Failed to link master plan: Disk is full. Please free up space and retry.');
379
+ }
380
+ // Handle permission denied error
381
+ if (err.code === 'EACCES' || err.code === 'EPERM') {
382
+ console.error(`[Artifacts] Failed to link master plan: Permission denied`);
383
+ console.error(`[Artifacts] Path: ${planPath}`);
384
+ throw new Error(`Failed to link master plan: Permission denied for ${planPath}`);
385
+ }
386
+ // Handle read-only filesystem
387
+ if (err.code === 'EROFS') {
388
+ console.error(`[Artifacts] Failed to link master plan: Read-only filesystem`);
389
+ console.error(`[Artifacts] Path: ${planPath}`);
390
+ throw new Error('Failed to link master plan: Filesystem is read-only');
391
+ }
392
+ // Generic error with context
393
+ console.error(`[Artifacts] Failed to link master plan: ${err.message}`);
394
+ console.error(`[Artifacts] Workflow ID: ${workflowId}`);
395
+ console.error(`[Artifacts] Path: ${planPath}`);
396
+ throw new Error(`Failed to link master plan for ${workflowId}: ${err.message}`);
397
+ }
398
+ }
399
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../src/features/workflow-engine/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAA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C,KAAK,CAAC,sDAAsD,CAAC,CAAC;YACtE,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;YAC/C,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;QACJ,CAAC;QAED,iCAAiC;QACjC,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAClD,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;YAC3E,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;YAC/C,MAAM,IAAI,KAAK,CACb,qDAAqD,QAAQ,EAAE,CAChE,CAAC;QACJ,CAAC;QAED,8BAA8B;QAC9B,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;YAC9E,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;YAC/C,MAAM,IAAI,KAAK,CACb,qDAAqD,CACtD,CAAC;QACJ,CAAC;QAED,6BAA6B;QAC7B,OAAO,CAAC,KAAK,CAAC,2CAA2C,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACxE,OAAO,CAAC,KAAK,CAAC,4BAA4B,UAAU,EAAE,CAAC,CAAC;QACxD,OAAO,CAAC,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;QAC/C,MAAM,IAAI,KAAK,CACb,kCAAkC,UAAU,KAAK,GAAG,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,67 @@
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 { WorkflowCheckpoint } from './types.js';
13
+ /**
14
+ * Clear the entire checkpoint cache
15
+ * Useful for testing or when you want to force fresh reads
16
+ */
17
+ export declare function clearCache(): void;
18
+ /**
19
+ * Invalidate a specific checkpoint in the cache
20
+ */
21
+ export declare function invalidateCache(projectPath: string, workflowId: string): void;
22
+ /**
23
+ * Save a workflow checkpoint to disk.
24
+ * Creates directory structure if it doesn't exist.
25
+ * Updates the checkpoint's updated_at timestamp before saving.
26
+ *
27
+ * Performance optimizations:
28
+ * - Updates in-memory cache
29
+ * - Uses optimized JSON serialization
30
+ * - Minimizes syscalls by combining directory check and write
31
+ *
32
+ * @param projectPath - Root path of the project
33
+ * @param checkpoint - Checkpoint data to save
34
+ * @throws Error if disk is full or write permissions are denied
35
+ */
36
+ export declare function saveCheckpoint(projectPath: string, checkpoint: WorkflowCheckpoint): Promise<void>;
37
+ /**
38
+ * Load a workflow checkpoint from disk.
39
+ * Returns null if checkpoint doesn't exist or if JSON is corrupt.
40
+ *
41
+ * Performance optimizations:
42
+ * - Uses in-memory cache to avoid redundant disk reads
43
+ * - Fast-path for cache hits
44
+ * - Optimized JSON parsing
45
+ *
46
+ * @param projectPath - Root path of the project
47
+ * @param workflowId - ID of the workflow to load
48
+ * @returns Checkpoint data or null if not found/invalid
49
+ */
50
+ export declare function loadCheckpoint(projectPath: string, workflowId: string): Promise<WorkflowCheckpoint | null>;
51
+ /**
52
+ * List all workflow IDs in the project.
53
+ * Returns an empty array if workflow directory doesn't exist.
54
+ *
55
+ * @param projectPath - Root path of the project
56
+ * @returns Array of workflow IDs
57
+ */
58
+ export declare function listWorkflows(projectPath: string): Promise<string[]>;
59
+ /**
60
+ * Delete a workflow and all its associated files.
61
+ * Idempotent - no error if workflow doesn't exist.
62
+ *
63
+ * @param projectPath - Root path of the project
64
+ * @param workflowId - ID of the workflow to delete
65
+ */
66
+ export declare function deleteWorkflow(projectPath: string, workflowId: string): Promise<void>;
67
+ //# sourceMappingURL=checkpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../src/features/workflow-engine/checkpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAiChD;;;GAGG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAG7E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAuEf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAqEpC;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA+B1E;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAyBf"}