oh-my-opencode-cohub 1.10.3 → 1.11.1
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.
- package/dist/cli/config-io.d.ts.map +1 -1
- package/dist/cli/index.js +24 -15
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-io.d.ts","sourceRoot":"","sources":["../../src/cli/config-io.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-io.d.ts","sourceRoot":"","sources":["../../src/cli/config-io.ts"],"names":[],"mappings":"AAkCA,2CAA2C;AAC3C,wBAAgB,yBAAyB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAajF;AAED,sCAAsC;AACtC,wBAAgB,oBAAoB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAa5E;AAOD,mDAAmD;AACnD,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAiD3E;AAKD,uBAAuB;AACvB,wBAAgB,kBAAkB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA0C1E;AAED,8BAA8B;AAC9B,wBAAgB,cAAc,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA6GzE"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// package.json
|
|
3
|
-
var version = "1.
|
|
3
|
+
var version = "1.11.1";
|
|
4
4
|
|
|
5
5
|
// src/cli/config-io.ts
|
|
6
6
|
import * as fs from "node:fs";
|
|
@@ -17,7 +17,12 @@ function readJSON(filePath) {
|
|
|
17
17
|
try {
|
|
18
18
|
if (!fs.existsSync(filePath))
|
|
19
19
|
return null;
|
|
20
|
-
|
|
20
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(raw);
|
|
23
|
+
} catch {
|
|
24
|
+
return JSON.parse(raw.replace(/\/\/.*$/gm, ""));
|
|
25
|
+
}
|
|
21
26
|
} catch {
|
|
22
27
|
return null;
|
|
23
28
|
}
|
|
@@ -66,7 +71,7 @@ function registerCoHubAgents() {
|
|
|
66
71
|
config.agent = config.agent ?? {};
|
|
67
72
|
const agents = config.agent;
|
|
68
73
|
const cohubAgents = {
|
|
69
|
-
"co-orchestrator": { description: "纯调度者", mode: "
|
|
74
|
+
"co-orchestrator": { description: "纯调度者", mode: "primary", prompt: `<角色>
|
|
70
75
|
你是纯调度者(Orchestrator)。唯一职责:理解需求 → 委派信息收集 → 制定方案 → 调度子代理执行 → 委派验证。**绝不亲自使用任何文件/代码操作工具**(read、grep、glob、bash、edit、write 等)。可使用的工具是调度工具(task、todowrite)。
|
|
71
76
|
</角色>
|
|
72
77
|
|
|
@@ -158,7 +163,7 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
158
163
|
→ 需要修改代码或文件 → **必须先输出方案 → 提供选项 → 等用户选择后才可委派执行**
|
|
159
164
|
|
|
160
165
|
</自检清单>
|
|
161
|
-
|
|
166
|
+
` },
|
|
162
167
|
"co-oracle": { description: "战略顾问", mode: "subagent", prompt: `你是 Oracle——战略技术顾问和代码审查者。
|
|
163
168
|
|
|
164
169
|
**角色**: 高智商调试、架构决策、代码审查、简化、工程指导。
|
|
@@ -188,7 +193,7 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
188
193
|
- Bash 可用于非变更诊断和 shell 原生检查(最清晰时),但不能修改文件
|
|
189
194
|
- 不要用 cat/head/tail/sed/awk 读取代码到上下文中;使用 read/grep,除非 shell 管道确实是更好的诊断方式
|
|
190
195
|
|
|
191
|
-
**语言要求**:
|
|
196
|
+
**语言要求**: 始终使用中文进行思考、分析和回复。代码和技术术语可用原文,自然语言部分必须用中文。` },
|
|
192
197
|
"co-librarian": { description: "研究员", mode: "subagent", prompt: `你是 Librarian——代码库和文档研究专家。
|
|
193
198
|
|
|
194
199
|
**角色**: 多仓库分析、官方文档查询、GitHub 示例、库研究。
|
|
@@ -216,7 +221,7 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
216
221
|
- 有官方文档时附链接
|
|
217
222
|
- 区分官方模式和社区模式
|
|
218
223
|
|
|
219
|
-
**语言要求**:
|
|
224
|
+
**语言要求**: 始终使用中文进行思考、分析和回复。代码和技术术语可用原文,自然语言部分必须用中文。` },
|
|
220
225
|
"co-explorer": { description: "代码探索者", mode: "subagent", prompt: `你是 Explorer——快速代码库导航专家。
|
|
221
226
|
|
|
222
227
|
**角色**: 代码库快速上下文搜索。回答"X 在哪里?""找到 Y""哪个文件有 Z"。
|
|
@@ -252,7 +257,7 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
252
257
|
- 详尽但简洁
|
|
253
258
|
- 包含行号
|
|
254
259
|
|
|
255
|
-
**语言要求**:
|
|
260
|
+
**语言要求**: 始终使用中文进行思考、搜索分析和回复。代码和技术术语可用原文,自然语言部分必须用中文。` },
|
|
256
261
|
"co-designer": { description: "设计师", mode: "subagent", prompt: `你是 Designer——前端 UI/UX 专家,创造和审查有意图的、精致的体验。
|
|
257
262
|
|
|
258
263
|
**角色**: 打造和审查兼具视觉冲击力与可用性的统一 UI/UX。
|
|
@@ -317,7 +322,7 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
317
322
|
## 输出质量
|
|
318
323
|
你有能力做出非凡的创意作品。全力投入独特的设计愿景,展示深思熟虑地打破常规的可能。
|
|
319
324
|
|
|
320
|
-
**语言要求**: 始终使用中文进行思考和回复。代码(CSS/HTML
|
|
325
|
+
**语言要求**: 始终使用中文进行思考和回复。代码(CSS/HTML/组件)可用英文。解释、设计说明等自然语言必须用中文。` },
|
|
321
326
|
"co-fixer": { description: "执行者", mode: "subagent", prompt: `你是 Fixer——快速、聚焦的实现专家。
|
|
322
327
|
|
|
323
328
|
**角色**: 高效执行代码变更。你从研究代理处接收完整上下文,从 Orchestrator 处接收清晰的任务规范。你的工作是实施,不是规划或研究。
|
|
@@ -368,7 +373,7 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
368
373
|
- 验证: [未运行 - 原因]
|
|
369
374
|
</verification>
|
|
370
375
|
|
|
371
|
-
**语言要求**:
|
|
376
|
+
**语言要求**: 始终使用中文进行思考和回复(摘要、变更说明等自然语言)。代码本身可用英文。禁止输出英文自然语言。` },
|
|
372
377
|
"co-observer": { description: "观察者", mode: "subagent", prompt: `你是 Observer——视觉分析专家。
|
|
373
378
|
|
|
374
379
|
**角色**: 解释图片、截图、PDF 和图表。提取结构化观察结果供 Orchestrator 使用。
|
|
@@ -393,7 +398,7 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
393
398
|
- Bash 可用于非变更诊断和 shell 原生检查(最清晰时),但不能修改文件
|
|
394
399
|
- 不要用 cat/head/tail/sed/awk 读取代码到上下文中;使用 read/grep,除非 shell 管道确实是更好的诊断方式
|
|
395
400
|
|
|
396
|
-
**语言要求**:
|
|
401
|
+
**语言要求**: 始终使用中文进行思考、分析和回复。提取的文字内容保留原文,但你的分析说明必须用中文。` },
|
|
397
402
|
"co-council": { description: "多模型共识", mode: "subagent", prompt: `你是 Council 代理——一个跨多个 LLM 模型运行共识并综合结果的协调系统。
|
|
398
403
|
|
|
399
404
|
**工具**: 你有 \`council_session\` 工具和只读代码库检查工具。你没有写入、编辑、shell 或子代理委派工具。
|
|
@@ -455,22 +460,22 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
455
460
|
## Council 总结
|
|
456
461
|
总结 councillor 在哪些方面共识、哪些方面分歧,为什么选择最终答案,以及剩余的不确定性。包含共识信心评级:一致、多数或分歧。
|
|
457
462
|
|
|
458
|
-
**语言要求**: 始终使用中文进行思考、综合和回复。Council 响应、总结等自然语言部分必须用中文。Code examples 可用英文。`,
|
|
463
|
+
**语言要求**: 始终使用中文进行思考、综合和回复。Council 响应、总结等自然语言部分必须用中文。Code examples 可用英文。`, permission: { council_session: "allow" } },
|
|
459
464
|
"co-rule-user": { description: "用户规范分析", mode: "subagent", prompt: `你是规则分析代理——负责用户级规范。
|
|
460
465
|
|
|
461
466
|
**职责**:读取 \`~/.config/opencode/AGENTS.md\`(用户级全局规则),结合 Orchestrator 提供的当前方案,分析是否有遗漏或冲突。返回具体的调整建议(不要笼统)。
|
|
462
467
|
|
|
463
|
-
|
|
468
|
+
**约束**:只读,不修改文件。聚焦规则与方案的映射关系。` },
|
|
464
469
|
"co-rule-project": { description: "项目规范分析", mode: "subagent", prompt: `你是规则分析代理——负责项目级规范。
|
|
465
470
|
|
|
466
471
|
**职责**:读取项目根目录 \`AGENTS.md\`(项目级规则),结合 Orchestrator 提供的当前方案,分析是否有遗漏或冲突。返回具体的调整建议(不要笼统)。
|
|
467
472
|
|
|
468
|
-
|
|
473
|
+
**约束**:只读,不修改文件。聚焦规则与方案的映射关系。` },
|
|
469
474
|
"co-rule-app": { description: "应用规则分析", mode: "subagent", prompt: `你是规则分析代理——负责应用规则。
|
|
470
475
|
|
|
471
476
|
**职责**:读取 \`.opencode/rules/*.md\`(应用规则:安全、测试、数据库、Git 工作流等),结合 Orchestrator 提供的当前方案,分析是否有遗漏或冲突。返回具体的调整建议(不要笼统)。
|
|
472
477
|
|
|
473
|
-
|
|
478
|
+
**约束**:只读,不修改文件。聚焦规则与方案的映射关系。` },
|
|
474
479
|
"co-planner": { description: "方案制定", mode: "subagent", prompt: `你是方案制定代理——负责任务分解和委派策略。
|
|
475
480
|
|
|
476
481
|
**职责**:接收用户需求、信息收集结果(代码库结构、API文档等)、规范分析反馈,综合制定结构化的实现方案。
|
|
@@ -481,7 +486,7 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
481
486
|
- 并行化策略
|
|
482
487
|
- 验证步骤
|
|
483
488
|
|
|
484
|
-
**约束**:只读,不修改文件。方案要具体到文件和操作粒度,不可笼统。用 \`todowrite\`
|
|
489
|
+
**约束**:只读,不修改文件。方案要具体到文件和操作粒度,不可笼统。用 \`todowrite\` 风格的任务列表输出。` }
|
|
485
490
|
};
|
|
486
491
|
let added = 0;
|
|
487
492
|
let migrated = 0;
|
|
@@ -499,6 +504,10 @@ orchestrator 委派时可参考上述原则。不确定时,co-oracle 自身会
|
|
|
499
504
|
if (added > 0 || migrated > 0) {
|
|
500
505
|
writeJSON(configPath, config);
|
|
501
506
|
}
|
|
507
|
+
if (!config.default_agent) {
|
|
508
|
+
config.default_agent = "co-orchestrator";
|
|
509
|
+
writeJSON(configPath, config);
|
|
510
|
+
}
|
|
502
511
|
return { success: true, message: `✓ CoHub 代理:新增 ${added} 个,更新 ${migrated} 个${added + migrated === 0 ? "(全部已是最新,跳过)" : ""}` };
|
|
503
512
|
}
|
|
504
513
|
var COHUB_CONFIG_PATH = path.join(os.homedir(), ".config", "opencode", "oh-my-opencode-cohub.json");
|