oh-my-opencode-cohub 1.12.6 → 1.12.7

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/README.md CHANGED
@@ -194,6 +194,65 @@ CLI 会精确清理所有 `co-*` 代理和相关配置,不影响其他插件
194
194
  - 可用代理列表中出现 12 个 `co-*` 前缀代理(`co-orchestrator`、`co-oracle`、`co-librarian`、`co-explorer`、`co-designer`、`co-fixer`、`co-observer`、`co-council`、`co-rule-user`、`co-rule-project`、`co-rule-app`、`co-planner`)
195
195
  - Orchestrator 自动进入纯调度模式(只做规划、委派、验证,不直接操作文件)
196
196
 
197
+ ### 故障排查:代理模型未生效?
198
+
199
+ 如果重启后代理可见但 model/variant 未应用,或子代理仍然不可见,复制以下文案交给 AI 自动诊断修复:
200
+
201
+ > **适用场景**:`@` 列表中缺少某些 co-* 代理,或代理使用的 model 与预期不符。
202
+
203
+ ````
204
+ ## 你的任务
205
+
206
+ 帮我在当前环境中诊断并修复 oh-my-opencode-cohub 的代理配置问题。
207
+
208
+ **诊断步骤(按顺序执行,执行完向我报告结果):**
209
+
210
+ ### 第一步:检查 opencode.json 的 agent 条目
211
+
212
+ 读取 `~/.config/opencode/opencode.json`,检查 `agent` 字段中是否存在以下 12 个条目:
213
+ - co-orchestrator (mode: primary) + 其余 11 个 (mode: subagent)
214
+
215
+ 如果缺少某些条目,说明插件未正确安装,运行以下命令重新安装:
216
+ ```bash
217
+ bun pm cache rm && bunx oh-my-opencode-cohub@latest install
218
+ ```
219
+
220
+ ### 第二步:检查 model/variant 配置
221
+
222
+ 读取 `~/.config/opencode/oh-my-opencode-cohub.json`,确认 `agents` 字段下每个代理都有 `model` 和 `variant`。
223
+
224
+ 如果 agent 条目有 model 但 opencode.json 中缺少 model,手动将 model/variant 补入 opencode.json 对应条目:
225
+ ```json
226
+ "co-explorer": {
227
+ "mode": "subagent",
228
+ "description": "...",
229
+ "model": "deepseek-anthropic/deepseek-v4-flash",
230
+ "variant": "low"
231
+ }
232
+ ```
233
+
234
+ ### 第三步:验证 config hook(仅诊断)
235
+
236
+ 检查 `~/.local/share/opencode/storage/oh-my-opencode-cohub/config-hook-ran.json` 是否存在且 `count` 为 12。如果不存在或 count < 12,说明插件未正常加载,检查:
237
+ - opencode.json 的 `plugin` 数组是否包含 `"oh-my-opencode-cohub"`
238
+ - OpenCode 版本是否 >= 1.17
239
+
240
+ ### 第四步:最终修复
241
+
242
+ 如果以上检查都通过但代理仍无 model/variant,执行完整重装:
243
+ ```bash
244
+ bunx oh-my-opencode-cohub uninstall && bun pm cache rm && bunx oh-my-opencode-cohub@latest install
245
+ ```
246
+ 重启 OpenCode 后验证。
247
+
248
+ ### 第五步:验证修复
249
+
250
+ 请确认以下内容后告诉我结果:
251
+ - TAB 切换列表中有 co-orchestrator
252
+ - `@` 输入时能看到至少 11 个子代理名称
253
+ - 随便 @ 某个子代理(如 `@co-explorer 搜索src目录`),确认它能正常工作
254
+ ````
255
+
197
256
  ### 从源码安装(本地开发)
198
257
 
199
258
  如果需要修改源码或使用开发版本:
@@ -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,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"}
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,CA+F3E;AA2FD,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.6";
3
+ var version = "1.12.7";
4
4
 
5
5
  // src/cli/config-io.ts
6
6
  import * as fs from "node:fs";
@@ -73,31 +73,32 @@ function registerCoHubAgents() {
73
73
  let cleaned = 0;
74
74
  let preserved = 0;
75
75
  if (config.agent && typeof config.agent === "object") {
76
- const agents2 = config.agent;
77
- for (const key of Object.keys(agents2)) {
76
+ const agents = config.agent;
77
+ for (const key of Object.keys(agents)) {
78
78
  if (!key.startsWith("co-"))
79
79
  continue;
80
- const value = agents2[key];
80
+ const value = agents[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 agents2[key];
87
+ delete agents[key];
88
88
  cleaned++;
89
89
  }
90
90
  } else {
91
- delete agents2[key];
91
+ delete agents[key];
92
92
  cleaned++;
93
93
  }
94
94
  }
95
95
  if (cleaned > 0 || preserved > 0)
96
96
  needUpdate = true;
97
- if (Object.keys(agents2).length === 0) {
97
+ if (Object.keys(agents).length === 0) {
98
98
  delete config.agent;
99
99
  }
100
100
  }
101
+ const hubConfig = loadHubConfig();
101
102
  const TEMPLATE_AGENTS = [
102
103
  { name: "co-orchestrator", mode: "primary", description: "纯调度者——编排任务、委派执行" },
103
104
  { name: "co-oracle", mode: "subagent", description: "战略顾问——架构审查、复杂调试" },
@@ -113,15 +114,19 @@ function registerCoHubAgents() {
113
114
  { name: "co-rule-app", mode: "subagent", description: "应用规则分析——.opencode/rules/*.md" }
114
115
  ];
115
116
  config.agent = config.agent ?? {};
116
- const agents = config.agent;
117
+ const agentTarget = config.agent;
117
118
  for (const tpl of TEMPLATE_AGENTS) {
118
- const existing = agents[tpl.name];
119
+ const existing = agentTarget[tpl.name];
120
+ const hubOverride = hubConfig[tpl.name];
121
+ const base = { mode: tpl.mode, description: tpl.description };
122
+ if (hubOverride?.model)
123
+ base.model = hubOverride.model;
124
+ if (hubOverride?.variant)
125
+ base.variant = hubOverride.variant;
119
126
  if (existing) {
120
- existing.mode = tpl.mode;
121
- if (!existing.description)
122
- existing.description = tpl.description;
127
+ agentTarget[tpl.name] = { ...base, ...existing, mode: tpl.mode };
123
128
  } else {
124
- agents[tpl.name] = { mode: tpl.mode, description: tpl.description };
129
+ agentTarget[tpl.name] = base;
125
130
  }
126
131
  }
127
132
  needUpdate = true;
@@ -141,6 +146,17 @@ function registerCoHubAgents() {
141
146
  return { success: true, message: `✓ ${msgParts.join(",")}` };
142
147
  }
143
148
  var COHUB_CONFIG_PATH = path.join(os.homedir(), ".config", "opencode", "oh-my-opencode-cohub.json");
149
+ function loadHubConfig() {
150
+ try {
151
+ if (!fs.existsSync(COHUB_CONFIG_PATH))
152
+ return {};
153
+ const raw = fs.readFileSync(COHUB_CONFIG_PATH, "utf-8");
154
+ const data = JSON.parse(raw);
155
+ return data.agents ?? {};
156
+ } catch {
157
+ return {};
158
+ }
159
+ }
144
160
  var HEAVY_KEYWORDS = ["pro", "preview", "opus", "max", "sonnet", "gpt-5.6"];
145
161
  var LIGHT_KEYWORDS = ["flash", "mini", "haiku", "gpt-5.4", "gpt-5.3"];
146
162
  var DESIGN_KEYWORDS = ["minimax", "m3", "sonnet", "claude"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-opencode-cohub",
3
- "version": "1.12.6",
3
+ "version": "1.12.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Mr-cjf/oh-my-opencode-cohub.git"