oh-my-opencode-cohub 1.12.4 → 1.12.6
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 +37 -9
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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;;wDAEwD;AACxD,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,
|
|
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;;wDAEwD;AACxD,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAwF3E;AA+ED,4DAA4D;AAC5D,wBAAgB,kBAAkB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA2G1E;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.12.
|
|
3
|
+
var version = "1.12.6";
|
|
4
4
|
|
|
5
5
|
// src/cli/config-io.ts
|
|
6
6
|
import * as fs from "node:fs";
|
|
@@ -73,31 +73,58 @@ function registerCoHubAgents() {
|
|
|
73
73
|
let cleaned = 0;
|
|
74
74
|
let preserved = 0;
|
|
75
75
|
if (config.agent && typeof config.agent === "object") {
|
|
76
|
-
const
|
|
77
|
-
for (const key of Object.keys(
|
|
76
|
+
const agents2 = config.agent;
|
|
77
|
+
for (const key of Object.keys(agents2)) {
|
|
78
78
|
if (!key.startsWith("co-"))
|
|
79
79
|
continue;
|
|
80
|
-
const value =
|
|
80
|
+
const value = agents2[key];
|
|
81
81
|
if (typeof value === "object" && value !== null) {
|
|
82
82
|
const fields = Object.keys(value).filter((k) => k !== "prompt");
|
|
83
83
|
const hasCustomFields = fields.some((f) => !COHUB_BUILTIN_FIELDS.has(f));
|
|
84
84
|
if (hasCustomFields) {
|
|
85
85
|
preserved++;
|
|
86
86
|
} else {
|
|
87
|
-
delete
|
|
87
|
+
delete agents2[key];
|
|
88
88
|
cleaned++;
|
|
89
89
|
}
|
|
90
90
|
} else {
|
|
91
|
-
delete
|
|
91
|
+
delete agents2[key];
|
|
92
92
|
cleaned++;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
if (cleaned > 0 || preserved > 0)
|
|
96
96
|
needUpdate = true;
|
|
97
|
-
if (Object.keys(
|
|
97
|
+
if (Object.keys(agents2).length === 0) {
|
|
98
98
|
delete config.agent;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
const TEMPLATE_AGENTS = [
|
|
102
|
+
{ name: "co-orchestrator", mode: "primary", description: "纯调度者——编排任务、委派执行" },
|
|
103
|
+
{ name: "co-oracle", mode: "subagent", description: "战略顾问——架构审查、复杂调试" },
|
|
104
|
+
{ name: "co-planner", mode: "subagent", description: "方案制定——综合需求+信息+规范输出任务分解" },
|
|
105
|
+
{ name: "co-council", mode: "subagent", description: "多模型共识——并行LLM综合" },
|
|
106
|
+
{ name: "co-librarian", mode: "subagent", description: "研究员——查文档、搜索、Web检索" },
|
|
107
|
+
{ name: "co-explorer", mode: "subagent", description: "代码探索者——项目结构、grep/glob搜索" },
|
|
108
|
+
{ name: "co-designer", mode: "subagent", description: "设计师——UI/UX设计实现、视觉润色" },
|
|
109
|
+
{ name: "co-fixer", mode: "subagent", description: "执行者——代码修改、构建、测试" },
|
|
110
|
+
{ name: "co-observer", mode: "subagent", description: "观察者——图片/PDF/截图视觉分析" },
|
|
111
|
+
{ name: "co-rule-user", mode: "subagent", description: "用户规范分析——用户级AGENTS.md" },
|
|
112
|
+
{ name: "co-rule-project", mode: "subagent", description: "项目规范分析——项目AGENTS.md" },
|
|
113
|
+
{ name: "co-rule-app", mode: "subagent", description: "应用规则分析——.opencode/rules/*.md" }
|
|
114
|
+
];
|
|
115
|
+
config.agent = config.agent ?? {};
|
|
116
|
+
const agents = config.agent;
|
|
117
|
+
for (const tpl of TEMPLATE_AGENTS) {
|
|
118
|
+
const existing = agents[tpl.name];
|
|
119
|
+
if (existing) {
|
|
120
|
+
existing.mode = tpl.mode;
|
|
121
|
+
if (!existing.description)
|
|
122
|
+
existing.description = tpl.description;
|
|
123
|
+
} else {
|
|
124
|
+
agents[tpl.name] = { mode: tpl.mode, description: tpl.description };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
needUpdate = true;
|
|
101
128
|
if (!config.default_agent) {
|
|
102
129
|
config.default_agent = "co-orchestrator";
|
|
103
130
|
needUpdate = true;
|
|
@@ -390,8 +417,9 @@ async function main() {
|
|
|
390
417
|
console.log(r4.message);
|
|
391
418
|
console.log(`
|
|
392
419
|
✅ CoHub 安装完成!`);
|
|
393
|
-
console.log(' 重启 OpenCode 后,TAB 选择 "co-orchestrator"
|
|
394
|
-
console.log("
|
|
420
|
+
console.log(' 重启 OpenCode 后,TAB 选择 "co-orchestrator" 主控代理。');
|
|
421
|
+
console.log(" 12 个 co-* 子代理可在对话中通过 @名称 或 task() 派发调用。");
|
|
422
|
+
console.log(" 模型和 variant 配置通过 config hook 从 oh-my-opencode-cohub.json 注入。");
|
|
395
423
|
console.log(`
|
|
396
424
|
${"=".repeat(60)}`);
|
|
397
425
|
console.log("\uD83D\uDCCB 已自动生成默认代理模型配置。如需自定义,可复制以下文案让 AI 帮你优化:");
|