openmatrix 0.1.64 → 0.1.65

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
  ## 任务信息
@@ -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.65",
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",