openmatrix 0.1.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 (85) hide show
  1. package/README.md +512 -0
  2. package/dist/agents/agent-runner.d.ts +152 -0
  3. package/dist/agents/agent-runner.js +656 -0
  4. package/dist/agents/base-agent.d.ts +46 -0
  5. package/dist/agents/base-agent.js +17 -0
  6. package/dist/agents/impl/coder-agent.d.ts +17 -0
  7. package/dist/agents/impl/coder-agent.js +96 -0
  8. package/dist/agents/impl/executor-agent.d.ts +32 -0
  9. package/dist/agents/impl/executor-agent.js +168 -0
  10. package/dist/agents/impl/index.d.ts +6 -0
  11. package/dist/agents/impl/index.js +17 -0
  12. package/dist/agents/impl/planner-agent.d.ts +24 -0
  13. package/dist/agents/impl/planner-agent.js +126 -0
  14. package/dist/agents/impl/researcher-agent.d.ts +17 -0
  15. package/dist/agents/impl/researcher-agent.js +133 -0
  16. package/dist/agents/impl/reviewer-agent.d.ts +17 -0
  17. package/dist/agents/impl/reviewer-agent.js +120 -0
  18. package/dist/agents/impl/tester-agent.d.ts +17 -0
  19. package/dist/agents/impl/tester-agent.js +110 -0
  20. package/dist/cli/commands/approve.d.ts +2 -0
  21. package/dist/cli/commands/approve.js +87 -0
  22. package/dist/cli/commands/meeting.d.ts +2 -0
  23. package/dist/cli/commands/meeting.js +245 -0
  24. package/dist/cli/commands/report.d.ts +2 -0
  25. package/dist/cli/commands/report.js +202 -0
  26. package/dist/cli/commands/resume.d.ts +2 -0
  27. package/dist/cli/commands/resume.js +104 -0
  28. package/dist/cli/commands/retry.d.ts +2 -0
  29. package/dist/cli/commands/retry.js +79 -0
  30. package/dist/cli/commands/start.d.ts +2 -0
  31. package/dist/cli/commands/start.js +252 -0
  32. package/dist/cli/commands/status.d.ts +2 -0
  33. package/dist/cli/commands/status.js +226 -0
  34. package/dist/cli/index.d.ts +2 -0
  35. package/dist/cli/index.js +26 -0
  36. package/dist/index.d.ts +2 -0
  37. package/dist/index.js +9 -0
  38. package/dist/orchestrator/ai-reviewer.d.ts +50 -0
  39. package/dist/orchestrator/ai-reviewer.js +326 -0
  40. package/dist/orchestrator/approval-manager.d.ts +62 -0
  41. package/dist/orchestrator/approval-manager.js +160 -0
  42. package/dist/orchestrator/executor.d.ts +114 -0
  43. package/dist/orchestrator/executor.js +325 -0
  44. package/dist/orchestrator/full-test-runner.d.ts +122 -0
  45. package/dist/orchestrator/full-test-runner.js +335 -0
  46. package/dist/orchestrator/git-commit-manager.d.ts +75 -0
  47. package/dist/orchestrator/git-commit-manager.js +248 -0
  48. package/dist/orchestrator/interactive-question-generator.d.ts +90 -0
  49. package/dist/orchestrator/interactive-question-generator.js +312 -0
  50. package/dist/orchestrator/meeting-manager.d.ts +85 -0
  51. package/dist/orchestrator/meeting-manager.js +222 -0
  52. package/dist/orchestrator/phase-executor.d.ts +198 -0
  53. package/dist/orchestrator/phase-executor.js +796 -0
  54. package/dist/orchestrator/question-generator.d.ts +22 -0
  55. package/dist/orchestrator/question-generator.js +102 -0
  56. package/dist/orchestrator/retry-manager.d.ts +41 -0
  57. package/dist/orchestrator/retry-manager.js +83 -0
  58. package/dist/orchestrator/scheduler.d.ts +62 -0
  59. package/dist/orchestrator/scheduler.js +148 -0
  60. package/dist/orchestrator/state-machine.d.ts +53 -0
  61. package/dist/orchestrator/state-machine.js +124 -0
  62. package/dist/orchestrator/task-parser.d.ts +7 -0
  63. package/dist/orchestrator/task-parser.js +63 -0
  64. package/dist/orchestrator/task-planner.d.ts +71 -0
  65. package/dist/orchestrator/task-planner.js +316 -0
  66. package/dist/storage/file-store.d.ts +12 -0
  67. package/dist/storage/file-store.js +80 -0
  68. package/dist/storage/state-manager.d.ts +31 -0
  69. package/dist/storage/state-manager.js +202 -0
  70. package/dist/types/index.d.ts +193 -0
  71. package/dist/types/index.js +30 -0
  72. package/dist/utils/logger.d.ts +41 -0
  73. package/dist/utils/logger.js +166 -0
  74. package/dist/utils/progress-reporter.d.ts +116 -0
  75. package/dist/utils/progress-reporter.js +287 -0
  76. package/package.json +50 -0
  77. package/scripts/build-check.js +19 -0
  78. package/scripts/install-skills.js +51 -0
  79. package/skills/approve.md +253 -0
  80. package/skills/meeting.md +346 -0
  81. package/skills/report.md +100 -0
  82. package/skills/resume.md +68 -0
  83. package/skills/retry.md +61 -0
  84. package/skills/start.md +449 -0
  85. package/skills/status.md +46 -0
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaskParser = void 0;
4
+ class TaskParser {
5
+ parse(content) {
6
+ const title = this.extractTitle(content);
7
+ const goals = this.extractSection(content, '目标');
8
+ const constraints = this.extractSection(content, '约束');
9
+ const deliverables = this.extractSection(content, '交付物');
10
+ const description = this.extractDescription(content);
11
+ return {
12
+ title,
13
+ description,
14
+ goals: [...new Set(goals)], // 去重
15
+ constraints: [...new Set(constraints)], // 去重
16
+ deliverables: [...new Set(deliverables)], // 去重
17
+ rawContent: content
18
+ };
19
+ }
20
+ extractTitle(content) {
21
+ const match = content.match(/^#\s+(.+)$/m);
22
+ return match ? match[1].trim() : 'Untitled Task';
23
+ }
24
+ extractDescription(content) {
25
+ // Remove title and sections, get first paragraph
26
+ let desc = content
27
+ .replace(/^#\s+.+$/m, '')
28
+ .replace(/^##\s+.+$/gm, '')
29
+ .replace(/^- .+$/gm, '')
30
+ .trim();
31
+ // Get first non-empty line
32
+ const lines = desc.split('\n').filter(l => l.trim());
33
+ return lines.length > 0 ? lines[0].trim() : '';
34
+ }
35
+ extractSection(content, sectionName) {
36
+ // Split content into lines and find the section
37
+ const lines = content.split('\n');
38
+ const items = [];
39
+ let inSection = false;
40
+ for (const line of lines) {
41
+ // Check if we're entering the target section
42
+ if (line.match(new RegExp(`^##\\s+${sectionName}\\s*$`))) {
43
+ inSection = true;
44
+ continue;
45
+ }
46
+ // Check if we've hit another section
47
+ if (line.match(/^##\s+/)) {
48
+ if (inSection)
49
+ break; // Exit if we were in the target section
50
+ continue;
51
+ }
52
+ // Extract list items if we're in the target section
53
+ if (inSection) {
54
+ const itemMatch = line.match(/^-\s+(.+)$/);
55
+ if (itemMatch) {
56
+ items.push(itemMatch[1].trim());
57
+ }
58
+ }
59
+ }
60
+ return items;
61
+ }
62
+ }
63
+ exports.TaskParser = TaskParser;
@@ -0,0 +1,71 @@
1
+ import type { ParsedTask } from '../types/index.js';
2
+ export interface TaskBreakdown {
3
+ taskId: string;
4
+ title: string;
5
+ description: string;
6
+ priority: 'P0' | 'P1' | 'P2' | 'P3';
7
+ dependencies: string[];
8
+ estimatedComplexity: 'low' | 'medium' | 'high';
9
+ assignedAgent: 'planner' | 'coder' | 'tester' | 'reviewer' | 'researcher' | 'executor';
10
+ acceptanceCriteria?: string[];
11
+ testTaskId?: string;
12
+ phase: 'design' | 'develop' | 'verify' | 'accept';
13
+ }
14
+ export interface UserAnswers {
15
+ objective?: string;
16
+ techStack?: string[];
17
+ testCoverage?: string;
18
+ documentationLevel?: string;
19
+ additionalContext?: Record<string, string>;
20
+ }
21
+ /**
22
+ * TaskPlanner - 任务拆解器
23
+ *
24
+ * 增强版特性:
25
+ * 1. 更细粒度的任务拆分 (每个目标拆分为设计+实现+测试)
26
+ * 2. 测试任务配对 (每个开发任务自动生成对应测试任务)
27
+ * 3. 验收标准注入 (从用户回答中提取)
28
+ * 4. 用户上下文注入 (将用户回答注入任务描述)
29
+ * 5. 依赖关系分析 (自动分析任务间依赖)
30
+ */
31
+ export declare class TaskPlanner {
32
+ private userAnswers;
33
+ constructor(userAnswers?: UserAnswers);
34
+ /**
35
+ * 设置用户回答
36
+ */
37
+ setUserAnswers(answers: UserAnswers): void;
38
+ /**
39
+ * Break down a parsed task into sub-tasks
40
+ *
41
+ * 增强版: 生成更细粒度的任务,包含设计、开发、测试配对
42
+ */
43
+ breakdown(parsedTask: ParsedTask, answers: Record<string, string>): TaskBreakdown[];
44
+ /**
45
+ * 提取用户上下文
46
+ */
47
+ private extractUserContext;
48
+ /**
49
+ * 解析数组类型的回答
50
+ */
51
+ private parseArrayAnswer;
52
+ /**
53
+ * 构建任务描述 (注入用户上下文)
54
+ */
55
+ private buildTaskDescription;
56
+ /**
57
+ * 构建测试任务描述
58
+ */
59
+ private buildTestDescription;
60
+ /**
61
+ * 解析覆盖率数值
62
+ */
63
+ private parseCoverage;
64
+ /**
65
+ * 生成验收标准
66
+ */
67
+ private generateAcceptanceCriteria;
68
+ private generateTaskId;
69
+ private determinePriority;
70
+ private estimateComplexity;
71
+ }
@@ -0,0 +1,316 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaskPlanner = void 0;
4
+ /**
5
+ * TaskPlanner - 任务拆解器
6
+ *
7
+ * 增强版特性:
8
+ * 1. 更细粒度的任务拆分 (每个目标拆分为设计+实现+测试)
9
+ * 2. 测试任务配对 (每个开发任务自动生成对应测试任务)
10
+ * 3. 验收标准注入 (从用户回答中提取)
11
+ * 4. 用户上下文注入 (将用户回答注入任务描述)
12
+ * 5. 依赖关系分析 (自动分析任务间依赖)
13
+ */
14
+ class TaskPlanner {
15
+ userAnswers;
16
+ constructor(userAnswers) {
17
+ this.userAnswers = userAnswers || {};
18
+ }
19
+ /**
20
+ * 设置用户回答
21
+ */
22
+ setUserAnswers(answers) {
23
+ this.userAnswers = answers;
24
+ }
25
+ /**
26
+ * Break down a parsed task into sub-tasks
27
+ *
28
+ * 增强版: 生成更细粒度的任务,包含设计、开发、测试配对
29
+ */
30
+ breakdown(parsedTask, answers) {
31
+ const breakdowns = [];
32
+ const seenTitles = new Set();
33
+ const userContext = this.extractUserContext(answers);
34
+ // 0. 设计阶段任务
35
+ if (parsedTask.goals.length > 1) {
36
+ breakdowns.push({
37
+ taskId: this.generateTaskId(),
38
+ title: '架构设计和任务规划',
39
+ description: `分析需求,设计整体架构,规划实现方案
40
+
41
+ ## 用户需求
42
+ ${userContext.objective || '未指定'}
43
+
44
+ ## 技术栈
45
+ ${userContext.techStack?.join(', ') || '未指定'}
46
+
47
+ ## 输出
48
+ - 架构设计文档
49
+ - 接口定义
50
+ - 任务依赖图`,
51
+ priority: 'P0',
52
+ dependencies: [],
53
+ estimatedComplexity: 'high',
54
+ assignedAgent: 'planner',
55
+ phase: 'design',
56
+ acceptanceCriteria: [
57
+ '架构设计文档完整',
58
+ '所有模块接口已定义',
59
+ '依赖关系明确',
60
+ '技术方案可行'
61
+ ]
62
+ });
63
+ }
64
+ // 1. 为每个目标创建细粒度任务
65
+ const devTaskIds = [];
66
+ for (let i = 0; i < parsedTask.goals.length; i++) {
67
+ const goal = parsedTask.goals[i];
68
+ // 跳过重复项
69
+ if (seenTitles.has(goal)) {
70
+ continue;
71
+ }
72
+ seenTitles.add(goal);
73
+ // 创建开发任务
74
+ const devTaskId = this.generateTaskId();
75
+ devTaskIds.push(devTaskId);
76
+ const acceptanceCriteria = this.generateAcceptanceCriteria(goal, userContext);
77
+ breakdowns.push({
78
+ taskId: devTaskId,
79
+ title: `实现: ${goal}`,
80
+ description: this.buildTaskDescription(goal, userContext, answers),
81
+ priority: this.determinePriority(i),
82
+ dependencies: i === 0 && parsedTask.goals.length > 1
83
+ ? [breakdowns[0].taskId] // 依赖设计任务
84
+ : (i > 0 ? [devTaskIds[i - 1]] : []), // 依赖前一个开发任务
85
+ estimatedComplexity: this.estimateComplexity(goal),
86
+ assignedAgent: 'coder',
87
+ phase: 'develop',
88
+ acceptanceCriteria,
89
+ testTaskId: undefined // 稍后关联
90
+ });
91
+ // 为每个开发任务创建配对的测试任务
92
+ const testTaskId = this.generateTaskId();
93
+ breakdowns.push({
94
+ taskId: testTaskId,
95
+ title: `测试: ${goal}`,
96
+ description: this.buildTestDescription(goal, devTaskId, userContext),
97
+ priority: this.determinePriority(i),
98
+ dependencies: [devTaskId], // 测试依赖开发任务
99
+ estimatedComplexity: 'medium',
100
+ assignedAgent: 'tester',
101
+ phase: 'verify',
102
+ acceptanceCriteria: [
103
+ `单元测试覆盖率 >= ${userContext.testCoverage || '60%'}`,
104
+ '边界情况已测试',
105
+ '异常处理已验证',
106
+ '所有测试通过'
107
+ ]
108
+ });
109
+ // 关联测试任务 ID
110
+ breakdowns[breakdowns.length - 2].testTaskId = testTaskId;
111
+ }
112
+ // 2. 代码审查任务 (仅在有开发任务时创建)
113
+ if (devTaskIds.length > 0) {
114
+ breakdowns.push({
115
+ taskId: this.generateTaskId(),
116
+ title: '代码审查',
117
+ description: `对所有开发任务进行代码审查
118
+
119
+ ## 审查范围
120
+ ${devTaskIds.map(id => `- ${id}`).join('\n')}
121
+
122
+ ## 审查要点
123
+ - 代码质量
124
+ - 安全性
125
+ - 性能
126
+ - 最佳实践`,
127
+ priority: 'P1',
128
+ dependencies: devTaskIds,
129
+ estimatedComplexity: 'medium',
130
+ assignedAgent: 'reviewer',
131
+ phase: 'verify',
132
+ acceptanceCriteria: [
133
+ '无严重代码问题',
134
+ '无安全隐患',
135
+ '代码符合规范',
136
+ '审查报告已生成'
137
+ ]
138
+ });
139
+ }
140
+ // 3. 集成测试任务 (如果有多个交付物)
141
+ if (parsedTask.deliverables.length > 1) {
142
+ breakdowns.push({
143
+ taskId: this.generateTaskId(),
144
+ title: '集成测试',
145
+ description: `验证所有交付物正确集成
146
+
147
+ ## 交付物
148
+ ${parsedTask.deliverables.map(d => `- ${d}`).join('\n')}
149
+
150
+ ## 测试范围
151
+ - 模块间接口
152
+ - 端到端流程
153
+ - 数据流验证`,
154
+ priority: 'P1',
155
+ dependencies: devTaskIds,
156
+ estimatedComplexity: 'medium',
157
+ assignedAgent: 'tester',
158
+ phase: 'verify',
159
+ acceptanceCriteria: [
160
+ '所有模块正确集成',
161
+ '端到端流程通过',
162
+ '接口兼容性验证',
163
+ '集成测试报告完整'
164
+ ]
165
+ });
166
+ }
167
+ // 4. 文档任务 (如果需要)
168
+ if (userContext.documentationLevel && userContext.documentationLevel !== '无需文档') {
169
+ breakdowns.push({
170
+ taskId: this.generateTaskId(),
171
+ title: '文档编写',
172
+ description: `编写项目文档
173
+
174
+ ## 文档级别
175
+ ${userContext.documentationLevel}
176
+
177
+ ## 文档内容
178
+ - README 更新
179
+ - API 文档
180
+ - 使用说明`,
181
+ priority: 'P2',
182
+ dependencies: devTaskIds,
183
+ estimatedComplexity: 'low',
184
+ assignedAgent: 'executor',
185
+ phase: 'accept',
186
+ acceptanceCriteria: [
187
+ 'README 已更新',
188
+ 'API 文档完整',
189
+ '使用说明清晰'
190
+ ]
191
+ });
192
+ }
193
+ return breakdowns;
194
+ }
195
+ /**
196
+ * 提取用户上下文
197
+ */
198
+ extractUserContext(answers) {
199
+ return {
200
+ objective: answers['目标'] || answers['objective'],
201
+ techStack: this.parseArrayAnswer(answers['技术栈'] || answers['techStack']),
202
+ testCoverage: answers['测试'] || answers['testCoverage'],
203
+ documentationLevel: answers['文档'] || answers['documentationLevel'],
204
+ additionalContext: answers
205
+ };
206
+ }
207
+ /**
208
+ * 解析数组类型的回答
209
+ */
210
+ parseArrayAnswer(answer) {
211
+ if (!answer)
212
+ return [];
213
+ // 处理逗号分隔或换行分隔的答案
214
+ return answer.split(/[,,\n]/).map(s => s.trim()).filter(Boolean);
215
+ }
216
+ /**
217
+ * 构建任务描述 (注入用户上下文)
218
+ */
219
+ buildTaskDescription(goal, userContext, answers) {
220
+ const parts = [];
221
+ parts.push(`## 任务目标\n${goal}\n`);
222
+ if (userContext.objective) {
223
+ parts.push(`## 整体目标\n${userContext.objective}\n`);
224
+ }
225
+ if (userContext.techStack && userContext.techStack.length > 0) {
226
+ parts.push(`## 技术栈要求\n${userContext.techStack.map(t => `- ${t}`).join('\n')}\n`);
227
+ }
228
+ // 注入所有用户回答
229
+ const relevantAnswers = Object.entries(answers).filter(([key]) => !['目标', '技术栈', '测试', '文档', 'objective', 'techStack', 'testCoverage', 'documentationLevel'].includes(key));
230
+ if (relevantAnswers.length > 0) {
231
+ parts.push(`## 其他要求\n${relevantAnswers.map(([k, v]) => `- ${k}: ${v}`).join('\n')}\n`);
232
+ }
233
+ parts.push(`## 输出要求
234
+ - 完成功能实现
235
+ - 代码可编译
236
+ - 遵循项目规范
237
+ - 添加必要注释`);
238
+ return parts.join('\n');
239
+ }
240
+ /**
241
+ * 构建测试任务描述
242
+ */
243
+ buildTestDescription(goal, devTaskId, userContext) {
244
+ const coverage = this.parseCoverage(userContext.testCoverage || '60%');
245
+ return `## 测试目标
246
+ 为 "${goal}" 编写测试用例
247
+
248
+ ## 关联开发任务
249
+ ${devTaskId}
250
+
251
+ ## 测试要求
252
+ - 单元测试覆盖率 >= ${coverage}%
253
+ - 测试正常流程
254
+ - 测试边界情况
255
+ - 测试异常处理
256
+
257
+ ## 测试文件
258
+ - 创建 \`.test.ts\` 或 \`.spec.ts\` 文件
259
+ - 放置在与源文件相同目录或 \`tests/\` 目录
260
+
261
+ ## 输出
262
+ - 测试文件
263
+ - 测试报告
264
+ - 覆盖率报告`;
265
+ }
266
+ /**
267
+ * 解析覆盖率数值
268
+ */
269
+ parseCoverage(coverageStr) {
270
+ const match = coverageStr.match(/(\d+)/);
271
+ return match ? parseInt(match[1], 10) : 60;
272
+ }
273
+ /**
274
+ * 生成验收标准
275
+ */
276
+ generateAcceptanceCriteria(goal, userContext) {
277
+ const criteria = [
278
+ `功能 "${goal}" 已实现`,
279
+ '代码可编译,无错误',
280
+ '代码符合项目规范',
281
+ '必要的注释已添加'
282
+ ];
283
+ if (userContext.testCoverage) {
284
+ criteria.push(`测试覆盖率 >= ${userContext.testCoverage}`);
285
+ }
286
+ if (userContext.techStack?.length) {
287
+ criteria.push(`使用指定技术栈: ${userContext.techStack.join(', ')}`);
288
+ }
289
+ criteria.push('无安全隐患');
290
+ criteria.push('边界情况已处理');
291
+ return criteria;
292
+ }
293
+ generateTaskId() {
294
+ const timestamp = Date.now().toString(36).toUpperCase();
295
+ const rand = Math.random().toString(36).slice(2, 4).toUpperCase();
296
+ return `TASK-${timestamp}${rand}`;
297
+ }
298
+ determinePriority(goalIndex) {
299
+ // First goal is highest priority
300
+ if (goalIndex === 0)
301
+ return 'P1';
302
+ return 'P2';
303
+ }
304
+ estimateComplexity(goal) {
305
+ if (goal.includes('测试'))
306
+ return 'medium';
307
+ if (goal.includes('实现') || goal.includes('开发'))
308
+ return 'medium';
309
+ if (goal.includes('设计') || goal.includes('研究'))
310
+ return 'high';
311
+ if (goal.includes('文档') || goal.includes('说明'))
312
+ return 'low';
313
+ return 'medium';
314
+ }
315
+ }
316
+ exports.TaskPlanner = TaskPlanner;
@@ -0,0 +1,12 @@
1
+ export declare class FileStore {
2
+ private basePath;
3
+ constructor(basePath: string);
4
+ ensureDir(path: string): Promise<void>;
5
+ writeJson<T>(path: string, data: T): Promise<void>;
6
+ readJson<T>(path: string): Promise<T | null>;
7
+ writeMarkdown(path: string, content: string): Promise<void>;
8
+ readMarkdown(path: string): Promise<string | null>;
9
+ exists(path: string): Promise<boolean>;
10
+ listFiles(dir: string): Promise<string[]>;
11
+ listDirs(dir: string): Promise<string[]>;
12
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileStore = void 0;
4
+ const promises_1 = require("fs/promises");
5
+ const path_1 = require("path");
6
+ const fs_1 = require("fs");
7
+ class FileStore {
8
+ basePath;
9
+ constructor(basePath) {
10
+ this.basePath = basePath;
11
+ }
12
+ async ensureDir(path) {
13
+ const fullPath = (0, path_1.join)(this.basePath, path);
14
+ await (0, promises_1.mkdir)(fullPath, { recursive: true });
15
+ }
16
+ async writeJson(path, data) {
17
+ const fullPath = (0, path_1.join)(this.basePath, path);
18
+ await (0, promises_1.mkdir)((0, path_1.dirname)(fullPath), { recursive: true });
19
+ await (0, promises_1.writeFile)(fullPath, JSON.stringify(data, null, 2), 'utf-8');
20
+ }
21
+ async readJson(path) {
22
+ const fullPath = (0, path_1.join)(this.basePath, path);
23
+ try {
24
+ const content = await (0, promises_1.readFile)(fullPath, 'utf-8');
25
+ return JSON.parse(content);
26
+ }
27
+ catch {
28
+ return null;
29
+ }
30
+ }
31
+ async writeMarkdown(path, content) {
32
+ const fullPath = (0, path_1.join)(this.basePath, path);
33
+ await (0, promises_1.mkdir)((0, path_1.dirname)(fullPath), { recursive: true });
34
+ await (0, promises_1.writeFile)(fullPath, content, 'utf-8');
35
+ }
36
+ async readMarkdown(path) {
37
+ const fullPath = (0, path_1.join)(this.basePath, path);
38
+ try {
39
+ return await (0, promises_1.readFile)(fullPath, 'utf-8');
40
+ }
41
+ catch {
42
+ return null;
43
+ }
44
+ }
45
+ async exists(path) {
46
+ const fullPath = (0, path_1.join)(this.basePath, path);
47
+ try {
48
+ await (0, promises_1.access)(fullPath, fs_1.constants.F_OK);
49
+ return true;
50
+ }
51
+ catch {
52
+ return false;
53
+ }
54
+ }
55
+ async listFiles(dir) {
56
+ const fullPath = (0, path_1.join)(this.basePath, dir);
57
+ try {
58
+ const files = await (0, promises_1.readdir)(fullPath, { withFileTypes: true });
59
+ return files
60
+ .filter((f) => f.isFile())
61
+ .map((f) => f.name);
62
+ }
63
+ catch {
64
+ return [];
65
+ }
66
+ }
67
+ async listDirs(dir) {
68
+ const fullPath = (0, path_1.join)(this.basePath, dir);
69
+ try {
70
+ const files = await (0, promises_1.readdir)(fullPath, { withFileTypes: true });
71
+ return files
72
+ .filter((f) => f.isDirectory())
73
+ .map((f) => f.name);
74
+ }
75
+ catch {
76
+ return [];
77
+ }
78
+ }
79
+ }
80
+ exports.FileStore = FileStore;
@@ -0,0 +1,31 @@
1
+ import type { GlobalState, Task, Approval, ApprovalStatus } from '../types/index.js';
2
+ export declare class StateManager {
3
+ private store;
4
+ private stateCache;
5
+ constructor(basePath: string);
6
+ initialize(): Promise<void>;
7
+ getState(): Promise<GlobalState>;
8
+ updateState(updates: Partial<GlobalState>): Promise<void>;
9
+ createTask(input: {
10
+ title: string;
11
+ description: string;
12
+ priority: 'P0' | 'P1' | 'P2' | 'P3';
13
+ timeout: number;
14
+ dependencies: string[];
15
+ assignedAgent: string;
16
+ }): Promise<Task>;
17
+ getTask(taskId: string): Promise<Task | null>;
18
+ updateTask(taskId: string, updates: Partial<Task>): Promise<void>;
19
+ listTasks(): Promise<Task[]>;
20
+ private updateTaskStatistics;
21
+ private generateRunId;
22
+ private generateTaskId;
23
+ saveApproval(approval: Approval): Promise<void>;
24
+ getApproval(approvalId: string): Promise<Approval | null>;
25
+ updateApproval(approval: Approval): Promise<void>;
26
+ getApprovalsByStatus(status: ApprovalStatus): Promise<Approval[]>;
27
+ getAllApprovals(): Promise<Approval[]>;
28
+ saveMeeting(meeting: any): Promise<void>;
29
+ getMeeting(meetingId: string): Promise<any | null>;
30
+ getMeetingsByStatus(status: string): Promise<any[]>;
31
+ }