openmatrix 0.1.64 → 0.1.66

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.
@@ -66,7 +66,7 @@ export declare class AgentRunner {
66
66
  /**
67
67
  * 构建完整的执行提示词
68
68
  */
69
- buildExecutionPrompt(task: Task): string;
69
+ buildExecutionPrompt(task: Task): Promise<string>;
70
70
  /**
71
71
  * 构建累积上下文 - 从已完成任务中提取共享信息
72
72
  *
@@ -80,7 +80,7 @@ class AgentRunner {
80
80
  */
81
81
  async prepareSubagentTask(task) {
82
82
  const subagentType = this.mapAgentType(task.assignedAgent);
83
- const prompt = this.buildExecutionPrompt(task);
83
+ const prompt = await this.buildExecutionPrompt(task);
84
84
  const needsIsolation = this.needsIsolation(task);
85
85
  console.log(`🤖 Preparing ${task.assignedAgent} subagent for task ${task.id}`);
86
86
  return {
@@ -133,10 +133,10 @@ class AgentRunner {
133
133
  /**
134
134
  * 构建完整的执行提示词
135
135
  */
136
- buildExecutionPrompt(task) {
136
+ async buildExecutionPrompt(task) {
137
137
  const agentPrompt = this.buildAgentPrompt(task);
138
138
  const phaseContext = this.buildPhaseContext(task);
139
- const accumulatedContext = this.buildAccumulatedContext(task);
139
+ const accumulatedContext = await this.buildAccumulatedContext(task);
140
140
  return `# 任务执行
141
141
 
142
142
  ## 任务信息
@@ -40,7 +40,6 @@ const state_manager_js_1 = require("../../storage/state-manager.js");
40
40
  const task_parser_js_1 = require("../../orchestrator/task-parser.js");
41
41
  const task_planner_js_1 = require("../../orchestrator/task-planner.js");
42
42
  const approval_manager_js_1 = require("../../orchestrator/approval-manager.js");
43
- const executor_js_1 = require("../../orchestrator/executor.js");
44
43
  const gitignore_js_1 = require("../../utils/gitignore.js");
45
44
  const index_js_1 = require("../../types/index.js");
46
45
  const fs = __importStar(require("fs/promises"));
@@ -253,33 +252,26 @@ async function handleTasksJson(options, stateManager, state, omPath, basePath) {
253
252
  }
254
253
  return;
255
254
  }
256
- // 无审批点,直接开始执行
257
- const executor = new executor_js_1.OrchestratorExecutor(stateManager, approvalManager, {
258
- maxConcurrent: state.config.maxConcurrentAgents,
259
- taskTimeout: state.config.timeout * 1000
260
- });
261
- const phaseExecutor = executor.getPhaseExecutor();
262
- if (phaseExecutor) {
263
- phaseExecutor.setRunId(state.runId);
264
- if (executionMode === 'auto') {
265
- phaseExecutor.setAutoMode(true);
266
- }
267
- }
268
- const result = await executor.step();
255
+ // 无审批点,返回任务列表供 Skill 执行
256
+ const allTasks = await stateManager.listTasks();
257
+ const subagentTasks = allTasks.map(t => ({
258
+ taskId: t.id,
259
+ agentType: t.assignedAgent,
260
+ title: t.title,
261
+ description: t.description,
262
+ priority: t.priority,
263
+ dependencies: t.dependencies,
264
+ timeout: t.timeout
265
+ }));
269
266
  if (options.json) {
270
267
  console.log(JSON.stringify({
271
- status: result.status,
272
- message: result.message,
273
- statistics: result.statistics,
274
- subagentTasks: result.subagentTasks.map(t => ({
275
- subagent_type: t.subagent_type,
276
- description: t.description,
277
- prompt: t.prompt,
278
- isolation: t.isolation,
279
- taskId: t.taskId,
280
- agentType: t.agentType,
281
- timeout: t.timeout
282
- })),
268
+ status: 'tasks_ready',
269
+ message: '任务已准备就绪,等待 Skill 执行',
270
+ statistics: {
271
+ totalTasks: allTasks.length,
272
+ pending: allTasks.filter(t => t.status === 'pending').length
273
+ },
274
+ subagentTasks,
283
275
  taskInfo: {
284
276
  title: tasksInput.title,
285
277
  description: tasksInput.description,
@@ -289,9 +281,9 @@ async function handleTasksJson(options, stateManager, state, omPath, basePath) {
289
281
  }
290
282
  else {
291
283
  console.log(`\n📋 ${tasksInput.title} - ${subTasks.length} 个子任务已创建`);
292
- console.log(`🎯 执行模式: ${executionMode}`);
293
- console.log(` 质量级别: ${qualityLevel}`);
294
- console.log('\n🚀 开始执行...');
284
+ console.log(`🎯 执行模式:${executionMode}`);
285
+ console.log(` 质量级别:${qualityLevel}`);
286
+ console.log('\n🚀 等待 Skill 执行任务...');
295
287
  console.log(' 使用 /om:status 查看进度');
296
288
  }
297
289
  }
@@ -426,32 +418,26 @@ async function handleAutoParse(input, options, stateManager, state) {
426
418
  }
427
419
  return;
428
420
  }
429
- const executor = new executor_js_1.OrchestratorExecutor(stateManager, approvalManager, {
430
- maxConcurrent: state.config.maxConcurrentAgents,
431
- taskTimeout: state.config.timeout * 1000
432
- });
433
- const phaseExecutor = executor.getPhaseExecutor();
434
- if (phaseExecutor) {
435
- phaseExecutor.setRunId(state.runId);
436
- if (executionMode === 'auto') {
437
- phaseExecutor.setAutoMode(true);
438
- }
439
- }
440
- const result = await executor.step();
421
+ // 无审批点,返回任务列表供 Skill 执行
422
+ const allTasks = await stateManager.listTasks();
423
+ const subagentTasks = allTasks.map(t => ({
424
+ taskId: t.id,
425
+ agentType: t.assignedAgent,
426
+ title: t.title,
427
+ description: t.description,
428
+ priority: t.priority,
429
+ dependencies: t.dependencies,
430
+ timeout: t.timeout
431
+ }));
441
432
  if (options.json) {
442
433
  console.log(JSON.stringify({
443
- status: result.status,
444
- message: result.message,
445
- statistics: result.statistics,
446
- subagentTasks: result.subagentTasks.map(t => ({
447
- subagent_type: t.subagent_type,
448
- description: t.description,
449
- prompt: t.prompt,
450
- isolation: t.isolation,
451
- taskId: t.taskId,
452
- agentType: t.agentType,
453
- timeout: t.timeout
454
- })),
434
+ status: 'tasks_ready',
435
+ message: '任务已准备就绪,等待 Skill 执行',
436
+ statistics: {
437
+ totalTasks: allTasks.length,
438
+ pending: allTasks.filter(t => t.status === 'pending').length
439
+ },
440
+ subagentTasks,
455
441
  taskInfo: {
456
442
  title: options.title || parsedTask.title,
457
443
  description: options.description,
@@ -463,8 +449,8 @@ async function handleAutoParse(input, options, stateManager, state) {
463
449
  }
464
450
  else {
465
451
  console.log(`\n📋 生成 ${subTasks.length} 个子任务`);
466
- console.log(`🎯 执行模式: ${executionMode}`);
467
- console.log('\n🚀 开始执行...');
452
+ console.log(`🎯 执行模式:${executionMode}`);
453
+ console.log('\n🚀 等待 Skill 执行任务...');
468
454
  console.log(' 使用 /om:status 查看进度');
469
455
  }
470
456
  }
@@ -85,7 +85,28 @@ class StateManager {
85
85
  async updateState(updates) {
86
86
  await this.withLock(async () => {
87
87
  const state = await this.getState();
88
- const newState = { ...state, ...updates };
88
+ // 确保 statistics 存在(兼容旧版本)
89
+ if (!state.statistics) {
90
+ state.statistics = {
91
+ totalTasks: 0,
92
+ completed: 0,
93
+ inProgress: 0,
94
+ failed: 0,
95
+ pending: 0,
96
+ scheduled: 0,
97
+ blocked: 0,
98
+ waiting: 0,
99
+ verify: 0,
100
+ accept: 0,
101
+ retry_queue: 0
102
+ };
103
+ }
104
+ // 合并 updates,statistics 需要单独处理
105
+ const newState = {
106
+ ...state,
107
+ ...updates,
108
+ statistics: updates.statistics ? { ...state.statistics, ...updates.statistics } : state.statistics
109
+ };
89
110
  await this.store.writeJson('state.json', newState);
90
111
  this.stateCache = newState;
91
112
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmatrix",
3
- "version": "0.1.64",
3
+ "version": "0.1.66",
4
4
  "description": "AI Agent task orchestration system with Claude Code Skills integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",