mycohive-claw 4.0.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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +222 -0
  3. package/dist/circuit-breaker.d.ts +82 -0
  4. package/dist/circuit-breaker.d.ts.map +1 -0
  5. package/dist/circuit-breaker.js +214 -0
  6. package/dist/circuit-breaker.js.map +1 -0
  7. package/dist/context-tree.d.ts +94 -0
  8. package/dist/context-tree.d.ts.map +1 -0
  9. package/dist/context-tree.js +624 -0
  10. package/dist/context-tree.js.map +1 -0
  11. package/dist/event-bus.d.ts +174 -0
  12. package/dist/event-bus.d.ts.map +1 -0
  13. package/dist/event-bus.js +750 -0
  14. package/dist/event-bus.js.map +1 -0
  15. package/dist/i18n.d.ts +91 -0
  16. package/dist/i18n.d.ts.map +1 -0
  17. package/dist/i18n.js +150 -0
  18. package/dist/i18n.js.map +1 -0
  19. package/dist/index.d.ts +38 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +301 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/intent-analyzer.d.ts +119 -0
  24. package/dist/intent-analyzer.d.ts.map +1 -0
  25. package/dist/intent-analyzer.js +563 -0
  26. package/dist/intent-analyzer.js.map +1 -0
  27. package/dist/logger.d.ts +46 -0
  28. package/dist/logger.d.ts.map +1 -0
  29. package/dist/logger.js +126 -0
  30. package/dist/logger.js.map +1 -0
  31. package/dist/metrics.d.ts +98 -0
  32. package/dist/metrics.d.ts.map +1 -0
  33. package/dist/metrics.js +192 -0
  34. package/dist/metrics.js.map +1 -0
  35. package/dist/openclaw-api.d.ts +122 -0
  36. package/dist/openclaw-api.d.ts.map +1 -0
  37. package/dist/openclaw-api.js +8 -0
  38. package/dist/openclaw-api.js.map +1 -0
  39. package/dist/rate-limiter.d.ts +46 -0
  40. package/dist/rate-limiter.d.ts.map +1 -0
  41. package/dist/rate-limiter.js +134 -0
  42. package/dist/rate-limiter.js.map +1 -0
  43. package/dist/result-cache.d.ts +76 -0
  44. package/dist/result-cache.d.ts.map +1 -0
  45. package/dist/result-cache.js +158 -0
  46. package/dist/result-cache.js.map +1 -0
  47. package/dist/router.d.ts +90 -0
  48. package/dist/router.d.ts.map +1 -0
  49. package/dist/router.js +447 -0
  50. package/dist/router.js.map +1 -0
  51. package/dist/setup-entry.d.ts +18 -0
  52. package/dist/setup-entry.d.ts.map +1 -0
  53. package/dist/setup-entry.js +64 -0
  54. package/dist/setup-entry.js.map +1 -0
  55. package/dist/token-counter.d.ts +57 -0
  56. package/dist/token-counter.d.ts.map +1 -0
  57. package/dist/token-counter.js +125 -0
  58. package/dist/token-counter.js.map +1 -0
  59. package/dist/tool-handlers.d.ts +52 -0
  60. package/dist/tool-handlers.d.ts.map +1 -0
  61. package/dist/tool-handlers.js +317 -0
  62. package/dist/tool-handlers.js.map +1 -0
  63. package/dist/tools/mycohive-tools.d.ts +11 -0
  64. package/dist/tools/mycohive-tools.d.ts.map +1 -0
  65. package/dist/tools/mycohive-tools.js +160 -0
  66. package/dist/tools/mycohive-tools.js.map +1 -0
  67. package/dist/types.d.ts +58 -0
  68. package/dist/types.d.ts.map +1 -0
  69. package/dist/types.js +57 -0
  70. package/dist/types.js.map +1 -0
  71. package/dist/workspace-loader.d.ts +67 -0
  72. package/dist/workspace-loader.d.ts.map +1 -0
  73. package/dist/workspace-loader.js +175 -0
  74. package/dist/workspace-loader.js.map +1 -0
  75. package/package.json +52 -0
  76. package/workspaces/api_dev/CONFIG.md +31 -0
  77. package/workspaces/api_dev/RULES.md +8 -0
  78. package/workspaces/api_dev/SKILL.md +69 -0
  79. package/workspaces/api_dev/SOUL.md +19 -0
  80. package/workspaces/architect/CONFIG.md +32 -0
  81. package/workspaces/architect/RULES.md +8 -0
  82. package/workspaces/architect/SKILL.md +63 -0
  83. package/workspaces/architect/SOUL.md +19 -0
  84. package/workspaces/backend_dev/CONFIG.md +42 -0
  85. package/workspaces/backend_dev/RULES.md +8 -0
  86. package/workspaces/backend_dev/SKILL.md +41 -0
  87. package/workspaces/backend_dev/SOUL.md +19 -0
  88. package/workspaces/browser/CONFIG.md +42 -0
  89. package/workspaces/browser/RULES.md +8 -0
  90. package/workspaces/browser/SKILL.md +57 -0
  91. package/workspaces/browser/SOUL.md +19 -0
  92. package/workspaces/builder/CONFIG.md +31 -0
  93. package/workspaces/builder/RULES.md +8 -0
  94. package/workspaces/builder/SKILL.md +39 -0
  95. package/workspaces/builder/SOUL.md +18 -0
  96. package/workspaces/coder/CONFIG.md +44 -0
  97. package/workspaces/coder/RULES.md +9 -0
  98. package/workspaces/coder/SKILL.md +53 -0
  99. package/workspaces/coder/SOUL.md +19 -0
  100. package/workspaces/coordinator/CONFIG.md +62 -0
  101. package/workspaces/coordinator/RULES.md +8 -0
  102. package/workspaces/coordinator/SKILL.md +77 -0
  103. package/workspaces/coordinator/SOUL.md +20 -0
  104. package/workspaces/data_engineer/CONFIG.md +32 -0
  105. package/workspaces/data_engineer/RULES.md +8 -0
  106. package/workspaces/data_engineer/SKILL.md +44 -0
  107. package/workspaces/data_engineer/SOUL.md +19 -0
  108. package/workspaces/deployer/CONFIG.md +45 -0
  109. package/workspaces/deployer/RULES.md +8 -0
  110. package/workspaces/deployer/SKILL.md +74 -0
  111. package/workspaces/deployer/SOUL.md +19 -0
  112. package/workspaces/dreamer/CONFIG.md +34 -0
  113. package/workspaces/dreamer/RULES.md +8 -0
  114. package/workspaces/dreamer/SKILL.md +48 -0
  115. package/workspaces/dreamer/SOUL.md +19 -0
  116. package/workspaces/evaluator/CONFIG.md +40 -0
  117. package/workspaces/evaluator/RULES.md +21 -0
  118. package/workspaces/evaluator/SKILL.md +65 -0
  119. package/workspaces/evaluator/SOUL.md +20 -0
  120. package/workspaces/front_director/CONFIG.md +54 -0
  121. package/workspaces/front_director/RULES.md +8 -0
  122. package/workspaces/front_director/SKILL.md +52 -0
  123. package/workspaces/front_director/SOUL.md +20 -0
  124. package/workspaces/frontend_dev/CONFIG.md +33 -0
  125. package/workspaces/frontend_dev/RULES.md +8 -0
  126. package/workspaces/frontend_dev/SKILL.md +42 -0
  127. package/workspaces/frontend_dev/SOUL.md +19 -0
  128. package/workspaces/observer/CONFIG.md +60 -0
  129. package/workspaces/observer/RULES.md +7 -0
  130. package/workspaces/observer/SKILL.md +77 -0
  131. package/workspaces/observer/SOUL.md +19 -0
  132. package/workspaces/planner/CONFIG.md +43 -0
  133. package/workspaces/planner/RULES.md +8 -0
  134. package/workspaces/planner/SKILL.md +65 -0
  135. package/workspaces/planner/SOUL.md +20 -0
  136. package/workspaces/qa/CONFIG.md +32 -0
  137. package/workspaces/qa/RULES.md +8 -0
  138. package/workspaces/qa/SKILL.md +52 -0
  139. package/workspaces/qa/SOUL.md +19 -0
  140. package/workspaces/researcher/CONFIG.md +32 -0
  141. package/workspaces/researcher/RULES.md +8 -0
  142. package/workspaces/researcher/SKILL.md +58 -0
  143. package/workspaces/researcher/SOUL.md +20 -0
  144. package/workspaces/reviewer/CONFIG.md +41 -0
  145. package/workspaces/reviewer/RULES.md +17 -0
  146. package/workspaces/reviewer/SKILL.md +56 -0
  147. package/workspaces/reviewer/SOUL.md +20 -0
  148. package/workspaces/router/CONFIG.md +58 -0
  149. package/workspaces/router/RULES.md +8 -0
  150. package/workspaces/router/SKILL.md +97 -0
  151. package/workspaces/router/SOUL.md +20 -0
  152. package/workspaces/scraper/CONFIG.md +41 -0
  153. package/workspaces/scraper/RULES.md +8 -0
  154. package/workspaces/scraper/SKILL.md +51 -0
  155. package/workspaces/scraper/SOUL.md +19 -0
  156. package/workspaces/scripter/CONFIG.md +42 -0
  157. package/workspaces/scripter/RULES.md +8 -0
  158. package/workspaces/scripter/SKILL.md +54 -0
  159. package/workspaces/scripter/SOUL.md +18 -0
  160. package/workspaces/security/CONFIG.md +47 -0
  161. package/workspaces/security/RULES.md +8 -0
  162. package/workspaces/security/SKILL.md +50 -0
  163. package/workspaces/security/SOUL.md +19 -0
  164. package/workspaces/translator/CONFIG.md +43 -0
  165. package/workspaces/translator/RULES.md +8 -0
  166. package/workspaces/translator/SKILL.md +35 -0
  167. package/workspaces/translator/SOUL.md +19 -0
  168. package/workspaces/writer/CONFIG.md +31 -0
  169. package/workspaces/writer/RULES.md +8 -0
  170. package/workspaces/writer/SKILL.md +40 -0
  171. package/workspaces/writer/SOUL.md +19 -0
package/dist/router.js ADDED
@@ -0,0 +1,447 @@
1
+ /**
2
+ * Router 模块
3
+ * 版本: v4.0.0
4
+ *
5
+ * 意图分析 + 自动路由的核心模块。
6
+ * 取消 @xxx/!! 标识,用户只需描述需求,系统自动分析并派发。
7
+ * 包含:dispatch 重试、熔断机制
8
+ */
9
+ import { IntentAnalyzer, Workflow } from "./intent-analyzer.js";
10
+ import { getEventBus } from "./event-bus.js";
11
+ import { getContextTree } from "./context-tree.js";
12
+ import { getLogger } from "./logger.js";
13
+ import { metrics, MetricNames } from "./metrics.js";
14
+ import { getCircuitBreaker, CircuitState } from "./circuit-breaker.js";
15
+ const DEFAULT_CONFIG = {
16
+ defaultAgents: ["coder"],
17
+ fallbackAgent: "coordinator",
18
+ confidenceThreshold: 0.6,
19
+ maxRetries: 3,
20
+ dispatchTimeoutMs: 30000,
21
+ dispatchRetries: 3,
22
+ };
23
+ export class Router {
24
+ // 内存 shared_state(v4.0 不使用 shell 脚本)
25
+ sharedStateStore = new Map();
26
+ analyzer;
27
+ eventBus;
28
+ contextTree;
29
+ config;
30
+ openclawApi = null;
31
+ logger = getLogger().child("[Router]");
32
+ circuitBreaker;
33
+ workspaceLoader = null;
34
+ constructor(config, eventBus, contextTree) {
35
+ this.analyzer = new IntentAnalyzer();
36
+ this.eventBus = eventBus || getEventBus();
37
+ this.contextTree = contextTree || getContextTree();
38
+ this.config = { ...DEFAULT_CONFIG, ...config };
39
+ this.circuitBreaker = getCircuitBreaker("router-dispatch", {
40
+ failureThreshold: 5,
41
+ successThreshold: 3,
42
+ timeoutMs: 30000,
43
+ monitorIntervalMs: 1000,
44
+ });
45
+ }
46
+ /**
47
+ * 从内存 shared_state 读取(带 TTL 缓存)
48
+ */
49
+ async readSharedState(msgId, key) {
50
+ const cacheKey = `${msgId}:${key}`;
51
+ const cached = this.sharedStateStore.get(cacheKey);
52
+ if (cached && cached.expiresAt > Date.now()) {
53
+ return cached.value;
54
+ }
55
+ return null;
56
+ }
57
+ /**
58
+ * 写入内存 shared_state(5秒 TTL)
59
+ */
60
+ async writeSharedState(msgId, key, value) {
61
+ const cacheKey = `${msgId}:${key}`;
62
+ this.sharedStateStore.set(cacheKey, {
63
+ value,
64
+ expiresAt: Date.now() + 5000,
65
+ });
66
+ }
67
+ /**
68
+ * 检查是否有 route_error 并尝试 replan
69
+ */
70
+ async checkAndHandleRouteError(msgId, originalMessage, sessionKey) {
71
+ try {
72
+ const routeError = await this.readSharedState(msgId, "route_error");
73
+ if (!routeError)
74
+ return null;
75
+ this.logger.info(`Route error detected: ${routeError}`);
76
+ // 解析 route_error JSON
77
+ let errorInfo = { reason: routeError };
78
+ try {
79
+ errorInfo = JSON.parse(routeError);
80
+ }
81
+ catch { /* use raw string */ }
82
+ // 发布 route_error 事件
83
+ this.eventBus.publish({
84
+ id: "",
85
+ type: "router.route_error",
86
+ source: "router",
87
+ data: { msgId, error: errorInfo },
88
+ timestamp: Date.now(),
89
+ });
90
+ // 清除 route_error
91
+ await this.writeSharedState(msgId, "route_error", "");
92
+ // 使用错误信息重新分析
93
+ const correctedMessage = `${originalMessage}\n\n[系统提示: 上次路由出现问题: ${errorInfo.reason},请重新分析并修正路由]`;
94
+ // 重新路由
95
+ const newIntent = await this.analyzer.analyze(correctedMessage, { msgId, isReplan: true });
96
+ const topicId = this.getOrCreateTopic(sessionKey);
97
+ const plan = this.analyzer.generateExecutionPlan(newIntent, topicId);
98
+ const taskId = this.createTaskId();
99
+ this.contextTree.addTask(topicId, taskId, newIntent.required_agents[0], newIntent.task_desc);
100
+ this.contextTree.updateTaskState(taskId, "routed");
101
+ // 重新派发
102
+ await this.dispatchWithRetry(plan, sessionKey);
103
+ return {
104
+ success: true,
105
+ intent: newIntent,
106
+ plan,
107
+ topicId,
108
+ taskId,
109
+ reason: `Replanned due to route_error: ${errorInfo.reason}`,
110
+ };
111
+ }
112
+ catch (error) {
113
+ this.logger.error(`Route error handling failed: ${error}`);
114
+ return null;
115
+ }
116
+ }
117
+ setOpenClawAPI(api) {
118
+ this.openclawApi = api;
119
+ }
120
+ setLLMClient(client) {
121
+ this.analyzer.setLLMClient(client);
122
+ }
123
+ setWorkspaceLoader(loader) {
124
+ this.analyzer.setWorkspaceLoader(loader);
125
+ }
126
+ /**
127
+ * 核心路由方法
128
+ * 接收用户消息,自动分析意图并派发到对应 Agent
129
+ */
130
+ async route(userMessage, sessionKey, context = {}) {
131
+ const startTime = Date.now();
132
+ // 检查熔断器
133
+ const cbResult = await this.circuitBreaker.execute(async () => {
134
+ return this.doRoute(userMessage, sessionKey, context, startTime);
135
+ }, async () => {
136
+ // 熔断时的降级处理
137
+ return {
138
+ success: false,
139
+ intent: {
140
+ task_type: "unknown",
141
+ task_desc: userMessage,
142
+ complexity: "medium",
143
+ required_agents: ["coordinator"],
144
+ workflow: "EXECUTE",
145
+ acceptance_criteria: "",
146
+ confidence: 0,
147
+ reasoning: "Circuit breaker open",
148
+ suggested_steps: [],
149
+ },
150
+ reason: "Circuit breaker is open",
151
+ rejected: true,
152
+ };
153
+ });
154
+ if (cbResult.rejected) {
155
+ metrics.increment(MetricNames.ROUTING_FAILURE, 1, { reason: "circuit_open" });
156
+ }
157
+ return cbResult.result || {
158
+ success: false,
159
+ intent: cbResult.error ? {
160
+ task_type: "unknown",
161
+ task_desc: userMessage,
162
+ complexity: "medium",
163
+ required_agents: [],
164
+ workflow: "EXECUTE",
165
+ acceptance_criteria: "",
166
+ confidence: 0,
167
+ reasoning: cbResult.error?.message || "Unknown error",
168
+ suggested_steps: [],
169
+ } : {
170
+ task_type: "unknown",
171
+ task_desc: userMessage,
172
+ complexity: "medium",
173
+ required_agents: [],
174
+ workflow: "EXECUTE",
175
+ acceptance_criteria: "",
176
+ confidence: 0,
177
+ reasoning: "No result returned",
178
+ suggested_steps: [],
179
+ },
180
+ reason: cbResult.error?.message || "Circuit breaker rejected",
181
+ requiresConfirmation: false,
182
+ };
183
+ }
184
+ async doRoute(userMessage, sessionKey, context, startTime) {
185
+ // 1. 创建 Topic(如果不存在)
186
+ const topicId = this.getOrCreateTopic(sessionKey);
187
+ // 2. 意图分析
188
+ const intent = await this.analyzer.analyze(userMessage, context);
189
+ // 记录意图分析延迟
190
+ const analysisLatency = Date.now() - startTime;
191
+ metrics.record(MetricNames.INTENT_ANALYSIS_LATENCY, analysisLatency);
192
+ metrics.record(MetricNames.INTENT_CONFIDENCE, intent.confidence);
193
+ metrics.increment(MetricNames.INTENT_TASK_TYPE, 1, { task_type: intent.task_type });
194
+ // 3. 发布路由分析事件
195
+ this.eventBus.emitRouterAnalysis(userMessage, {
196
+ task_type: intent.task_type,
197
+ complexity: intent.complexity,
198
+ required_agents: intent.required_agents,
199
+ workflow: intent.workflow,
200
+ }, intent.confidence);
201
+ // 4. 置信度检查
202
+ if (intent.confidence < this.config.confidenceThreshold) {
203
+ this.logger.info(`Low confidence: ${intent.confidence}`);
204
+ return {
205
+ success: false,
206
+ intent,
207
+ reason: `Confidence ${intent.confidence} below threshold ${this.config.confidenceThreshold}`,
208
+ requiresConfirmation: true,
209
+ suggestedAgents: intent.required_agents,
210
+ };
211
+ }
212
+ // 5. 生成执行计划
213
+ const plan = this.analyzer.generateExecutionPlan(intent, topicId);
214
+ // 6. 创建 Task
215
+ const taskId = this.createTaskId();
216
+ this.contextTree.addTask(topicId, taskId, intent.required_agents[0], intent.task_desc);
217
+ this.contextTree.updateTaskState(taskId, "routed");
218
+ metrics.increment(MetricNames.TASK_CREATED, 1, { agent: intent.required_agents[0] });
219
+ // 7. 派发到 Agent(带重试和 route_error 回退)
220
+ try {
221
+ // 从 intent 中提取 msgId(如果有)
222
+ const msgId = context.msgId || intent.task_desc.match(/MSG[\w-]+/)?.[0];
223
+ const dispatchResult = await this.dispatchWithRetry(plan, sessionKey, msgId);
224
+ // 记录成功
225
+ this.circuitBreaker.recordSuccess();
226
+ metrics.increment(MetricNames.ROUTING_SUCCESS, 1, { replanned: dispatchResult.replanned ? "1" : "0" });
227
+ metrics.record(MetricNames.ROUTING_LATENCY, Date.now() - startTime);
228
+ return {
229
+ success: true,
230
+ intent,
231
+ plan,
232
+ topicId,
233
+ taskId,
234
+ reason: dispatchResult.replanned ? "Replanned via route_error" : undefined,
235
+ };
236
+ }
237
+ catch (error) {
238
+ // 记录失败
239
+ this.circuitBreaker.recordFailure();
240
+ metrics.increment(MetricNames.ROUTING_FAILURE, 1, { reason: "dispatch_failed" });
241
+ this.contextTree.updateTaskState(taskId, "stale");
242
+ return {
243
+ success: false,
244
+ intent,
245
+ reason: `Dispatch failed: ${error}`,
246
+ requiresConfirmation: false,
247
+ suggestedAgents: intent.required_agents,
248
+ };
249
+ }
250
+ }
251
+ /**
252
+ * 带重试的派发
253
+ */
254
+ async dispatchWithRetry(plan, sessionKey, msgId) {
255
+ let lastError = null;
256
+ for (let attempt = 1; attempt <= this.config.dispatchRetries; attempt++) {
257
+ // 检查 circuit breaker 状态,OPEN 时跳过重试直接进入 replan
258
+ if (this.circuitBreaker.getState() === CircuitState.OPEN) {
259
+ this.logger.warn("Circuit breaker OPEN, skipping retry attempts");
260
+ break;
261
+ }
262
+ try {
263
+ await this.dispatch(plan, sessionKey);
264
+ return { success: true }; // 成功,直接返回
265
+ }
266
+ catch (error) {
267
+ lastError = error;
268
+ this.logger.warn(`Dispatch attempt ${attempt} failed:`, error);
269
+ if (attempt < this.config.dispatchRetries) {
270
+ // 指数退避
271
+ const delay = Math.min(1000 * Math.pow(2, attempt - 1), 10000);
272
+ await this.sleep(delay);
273
+ }
274
+ }
275
+ }
276
+ // 所有重试都失败,检查是否有 route_error 可以触发 replan
277
+ if (msgId) {
278
+ const replanResult = await this.checkAndHandleRouteError(msgId, plan.intent.task_desc, sessionKey);
279
+ if (replanResult && replanResult.success) {
280
+ return { success: true, replanned: true };
281
+ }
282
+ }
283
+ // 回退到抛出错误
284
+ throw lastError || new Error("Dispatch failed after retries");
285
+ }
286
+ sleep(ms) {
287
+ return new Promise((resolve) => setTimeout(resolve, ms));
288
+ }
289
+ /**
290
+ * 派发执行计划到 Agent
291
+ */
292
+ async dispatch(plan, sessionKey) {
293
+ if (!this.openclawApi) {
294
+ throw new Error("OpenClaw API not configured");
295
+ }
296
+ const { steps, intent } = plan;
297
+ // 根据工作流类型执行
298
+ switch (intent.workflow) {
299
+ case Workflow.EXECUTE:
300
+ await this.dispatchSingle(steps[0], sessionKey);
301
+ break;
302
+ case Workflow.PIPELINE:
303
+ for (const step of steps) {
304
+ await this.dispatchSingle(step, sessionKey);
305
+ }
306
+ break;
307
+ case Workflow.PARALLEL:
308
+ await Promise.all(steps.map((step) => this.dispatchSingle(step, sessionKey)));
309
+ break;
310
+ case Workflow.ITERATE:
311
+ for (const step of steps) {
312
+ await this.dispatchSingle(step, sessionKey);
313
+ }
314
+ break;
315
+ case Workflow.COLLABORATE:
316
+ for (const step of steps) {
317
+ await this.dispatchSingle(step, sessionKey);
318
+ }
319
+ break;
320
+ default:
321
+ this.logger.error(`Unknown workflow type: ${intent.workflow}, falling back to EXECUTE`);
322
+ if (steps.length > 0) {
323
+ await this.dispatchSingle(steps[0], sessionKey);
324
+ }
325
+ }
326
+ }
327
+ async dispatchSingle(step, sessionKey) {
328
+ if (!this.openclawApi) {
329
+ this.logger.error(`dispatchSingle: OpenClaw API not configured, cannot dispatch to ${step.agent}`);
330
+ return;
331
+ }
332
+ metrics.increment(MetricNames.AGENT_DISPATCH, 1, { agent: step.agent });
333
+ // 检查 agent 是否需要独立 Session
334
+ const agentConfig = await this.getAgentConfig(step.agent);
335
+ if (agentConfig?.session_mode === "isolated") {
336
+ // 独立 Session:使用 sessionsSpawn 创建新 session,不传入历史消息
337
+ // 仅传入产出物或任务描述(artifact_only)
338
+ const isolatedContent = agentConfig.isolation?.context === "artifact_only"
339
+ ? `[产出物]\n${step.task_desc}`
340
+ : step.task_desc;
341
+ await this.openclawApi.sessionsSpawn(step.agent, {
342
+ parentSessionKey: sessionKey,
343
+ thread: false,
344
+ });
345
+ // 向新 session 发送初始消息
346
+ const newSessionKey = `${step.agent}-${Date.now()}`;
347
+ await this.openclawApi.sessionsSend(newSessionKey, {
348
+ content: isolatedContent,
349
+ role: "user",
350
+ });
351
+ this.logger.info(`Dispatched ${step.agent} in isolated session (artifact_only)`);
352
+ }
353
+ else {
354
+ // 共享 Session:直接发送到父 session
355
+ await this.openclawApi.sessionsSend(sessionKey, {
356
+ content: step.task_desc,
357
+ agentId: step.agent,
358
+ thread: true,
359
+ });
360
+ }
361
+ this.eventBus.emitAgentDispatch("router", step.agent, `step-${step.step}`, {
362
+ action: step.action,
363
+ task_desc: step.task_desc,
364
+ isolated: agentConfig?.session_mode === "isolated",
365
+ });
366
+ }
367
+ async getAgentConfig(agentId) {
368
+ if (!this.workspaceLoader) {
369
+ // 如果没有 workspace loader,回退到检测 agent_type
370
+ const isolatedAgents = ["reviewer", "qa", "security", "evaluator"];
371
+ if (isolatedAgents.includes(agentId)) {
372
+ return { agent_id: agentId, agent_type: "review", session_mode: "isolated" };
373
+ }
374
+ return null;
375
+ }
376
+ const workspace = await this.workspaceLoader.load(agentId);
377
+ return workspace?.config ?? null;
378
+ }
379
+ getOrCreateTopic(sessionKey) {
380
+ const existingTopics = this.contextTree.getActiveTopics();
381
+ const existing = existingTopics.find((t) => t.data.session_key === sessionKey);
382
+ if (existing) {
383
+ return existing.id;
384
+ }
385
+ const topicId = this.createTopicId();
386
+ const node = this.contextTree.addTopic(topicId, `Session: ${sessionKey}`);
387
+ node.data.session_key = sessionKey;
388
+ this.contextTree.save();
389
+ metrics.increment(MetricNames.TOPIC_CREATED);
390
+ return topicId;
391
+ }
392
+ createTopicId() {
393
+ const now = new Date();
394
+ const datePart = now.toISOString().replace(/[-:T.Z]/g, "").slice(0, 12);
395
+ const seq = String(Date.now() % 1000).padStart(3, "0");
396
+ return `${datePart}-T${seq}`;
397
+ }
398
+ createTaskId() {
399
+ const now = new Date();
400
+ const datePart = now.toISOString().replace(/[-:T.Z]/g, "").slice(0, 12);
401
+ const seq = String(Date.now() % 1000).padStart(3, "0");
402
+ return `${datePart}-W${seq}`;
403
+ }
404
+ /**
405
+ * 确认路由(用于置信度不足时)
406
+ */
407
+ async confirmAndRoute(userMessage, sessionKey, confirmedAgents, context = {}) {
408
+ const topicId = this.getOrCreateTopic(sessionKey);
409
+ // 使用用户确认的 Agent 重新分析
410
+ const intent = await this.analyzer.analyze(userMessage, context);
411
+ intent.required_agents = confirmedAgents;
412
+ const plan = this.analyzer.generateExecutionPlan(intent, topicId);
413
+ const taskId = this.createTaskId();
414
+ this.contextTree.addTask(topicId, taskId, confirmedAgents[0], intent.task_desc);
415
+ try {
416
+ await this.dispatchWithRetry(plan, sessionKey);
417
+ return { success: true, intent, plan, topicId, taskId };
418
+ }
419
+ catch (error) {
420
+ return {
421
+ success: false,
422
+ intent,
423
+ reason: `Dispatch failed: ${error}`,
424
+ requiresConfirmation: false,
425
+ suggestedAgents: confirmedAgents,
426
+ };
427
+ }
428
+ }
429
+ /**
430
+ * 获取熔断器状态
431
+ */
432
+ getCircuitBreakerStats() {
433
+ return this.circuitBreaker.getStats();
434
+ }
435
+ }
436
+ // 全局 Router 实例
437
+ let globalRouter = null;
438
+ export function getRouter() {
439
+ if (!globalRouter) {
440
+ globalRouter = new Router();
441
+ }
442
+ return globalRouter;
443
+ }
444
+ export function setRouter(router) {
445
+ globalRouter = router;
446
+ }
447
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAU,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAY,WAAW,EAAa,MAAM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AAW,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAEhF,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAC1D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,MAAM;gBACN,MAAM,EAAE,oBAAoB,KAAK,EAAE;gBACnC,oBAAoB,EAAE,KAAK;gBAC3B,eAAe,EAAE,eAAe;aACjC,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,sBAAsB;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IACxC,CAAC;CACF;AAcD,eAAe;AACf,IAAI,YAAY,GAAkB,IAAI,CAAC;AAEvC,MAAM,UAAU,SAAS;IACvB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,IAAI,MAAM,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAqB;IAC7C,YAAY,GAAG,MAAM,CAAC;AACxB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * MycoHive-Claw v4.0.0
3
+ * Setup Entry Point
4
+ *
5
+ * 轻量级设置入口,在插件安装时调用
6
+ */
7
+ import { OpenClawAPI } from "./openclaw-api.js";
8
+ export interface SetupResult {
9
+ success: boolean;
10
+ message: string;
11
+ config?: Record<string, unknown>;
12
+ }
13
+ export declare function setup(openclawApi: OpenClawAPI): Promise<SetupResult>;
14
+ declare const _default: {
15
+ setup: typeof setup;
16
+ };
17
+ export default _default;
18
+ //# sourceMappingURL=setup-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-entry.d.ts","sourceRoot":"","sources":["../src/setup-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,wBAAsB,KAAK,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CA6D1E;;;;AAED,wBAAyB"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * MycoHive-Claw v4.0.0
3
+ * Setup Entry Point
4
+ *
5
+ * 轻量级设置入口,在插件安装时调用
6
+ */
7
+ export async function setup(openclawApi) {
8
+ console.log("[MycoHive-Claw] Setting up v4.0.0...");
9
+ try {
10
+ // 验证 OpenClaw API 版本
11
+ const config = await openclawApi.getConfig();
12
+ console.log("[MycoHive-Claw] Current config:", JSON.stringify(config).slice(0, 200));
13
+ // 检查必要的配置项
14
+ const requiredConfig = [
15
+ "agentsDir",
16
+ "sessionsDatabase",
17
+ ];
18
+ const missing = [];
19
+ for (const key of requiredConfig) {
20
+ if (!config || !config[key]) {
21
+ missing.push(key);
22
+ }
23
+ }
24
+ if (missing.length > 0) {
25
+ console.warn("[MycoHive-Claw] Missing config:", missing);
26
+ }
27
+ // 注册 Agent workspace 配置
28
+ // 确保 workspaces/{agent}/ 目录结构就位
29
+ console.log("[MycoHive-Claw] Setup complete");
30
+ console.log("[MycoHive-Claw] 24 Agent system:");
31
+ console.log("[MycoHive-Claw] Entry Layer: front_director, router");
32
+ console.log("[MycoHive-Claw] Management: coordinator, planner, observer");
33
+ console.log("[MycoHive-Claw] Architecture: architect");
34
+ console.log("[MycoHive-Claw] Execution: coder, frontend_dev, backend_dev, ...");
35
+ console.log("[MycoHive-Claw] Review: reviewer, qa, security, evaluator");
36
+ console.log("[MycoHive-Claw] Tool: browser, scraper, deployer");
37
+ console.log("[MycoHive-Claw] Autonomous: builder, dreamer");
38
+ return {
39
+ success: true,
40
+ message: "MycoHive-Claw v4.0.0 setup complete",
41
+ config: {
42
+ version: "4.0.0",
43
+ agents: 24,
44
+ routingMode: "llm_intent",
45
+ features: [
46
+ "llm_intent_analysis",
47
+ "auto_routing",
48
+ "context_tree",
49
+ "event_bus",
50
+ "openclaw_plugin",
51
+ ],
52
+ },
53
+ };
54
+ }
55
+ catch (error) {
56
+ console.error("[MycoHive-Claw] Setup failed:", error);
57
+ return {
58
+ success: false,
59
+ message: `Setup failed: ${error}`,
60
+ };
61
+ }
62
+ }
63
+ export default { setup };
64
+ //# sourceMappingURL=setup-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-entry.js","sourceRoot":"","sources":["../src/setup-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,WAAwB;IAClD,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IAEpD,IAAI,CAAC;QACH,qBAAqB;QACrB,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,EAAE,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAErF,WAAW;QACX,MAAM,cAAc,GAAG;YACrB,WAAW;YACX,kBAAkB;SACnB,CAAC;QAEF,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;YACjC,IAAI,CAAC,MAAM,IAAI,CAAE,MAAkC,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;QACH,CA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+ * 用于 prompt 工程优化和消耗监控。
7
+ */
8
+ export interface TokenCountOptions {
9
+ model: string;
10
+ }
11
+ export interface MessageTokenCount {
12
+ role: string;
13
+ content: string;
14
+ tokens: number;
15
+ }
16
+ export declare class TokenCounter {
17
+ private logger;
18
+ /**
19
+ * 计算文本的 token 数量
20
+ * 使用估算公式,实际使用需考虑模型分词器
21
+ */
22
+ count(text: string, options?: TokenCountOptions): number;
23
+ /**
24
+ * Claude 系列模型 token 估算
25
+ * 公式:中文 ~2 chars/token,英文 ~4 chars/token
26
+ */
27
+ private countClaude;
28
+ /**
29
+ * GPT 系列模型 token 估算
30
+ * 公式:约 4 chars per token(英文为主)
31
+ */
32
+ private countGPT;
33
+ /**
34
+ * 计算消息数组的总 token 数
35
+ */
36
+ countMessages(messages: Array<{
37
+ role: string;
38
+ content: string;
39
+ }>, options: TokenCountOptions): number;
40
+ /**
41
+ * 计算 prompt 模板的 token 数(带变量替换)
42
+ */
43
+ countPromptTemplate(template: string, variables: Record<string, string>, options: TokenCountOptions): number;
44
+ /**
45
+ * 估算剩余 context window
46
+ */
47
+ getRemainingContext(text: string, maxTokens: number, options: TokenCountOptions): {
48
+ remaining: number;
49
+ percentage: number;
50
+ };
51
+ /**
52
+ * 估算能否在 context 内完成
53
+ */
54
+ canFit(text: string, maxTokens: number, options: TokenCountOptions): boolean;
55
+ }
56
+ export declare function getTokenCounter(): TokenCounter;
57
+ //# sourceMappingURL=token-counter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-counter.d.ts","sourceRoot":"","sources":["../src/token-counter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAQD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAuC;IAErD;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAkD,GAAG,MAAM;IAexF;;;OAGG;IACH,OAAO,CAAC,WAAW;IAenB;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAchB;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM;IAiBrG;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM;IAQ5G;;OAEG;IACH,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,iBAAiB,GACzB;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;IAY5C;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO;CAG7E;AAKD,wBAAgB,eAAe,IAAI,YAAY,CAK9C"}