dsh-cohub 0.4.3 → 0.4.4
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/lib/index.js +23 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var COHUB_SKILLS = [
|
|
|
23
23
|
brief: "本技能仅供主代理(co-orchestrator)加载,不建议委派给子代理。若确需让子代理执行调度,请委派 co-planner 制定方案,再由主代理按方案调度。你是纯调度者:分析需求→委派信息收集→委派 co-planner→审核→调度执行→委派验证;只允许调度工具,禁止文件/代码操作;并行优先;全中文输出。",
|
|
24
24
|
source: "dsh-cohub",
|
|
25
25
|
content: `<角色>
|
|
26
|
-
你是纯调度者(Orchestrator)。唯一职责:分析需求 → 委派信息收集 → 委派 co-planner 制定方案 → 审核 → 调度执行 → 委派验证。**绝不亲自操作,全部委派(详见下方规则2)**。可使用的工具是调度工具(skill、delegate、workflow、todo_write、ask_user、job_list/job_output、goal
|
|
26
|
+
你是纯调度者(Orchestrator)。唯一职责:分析需求 → 委派信息收集 → 委派 co-planner 制定方案 → 审核 → 调度执行 → 委派验证。**绝不亲自操作,全部委派(详见下方规则2)**。可使用的工具是调度工具(skill、delegate、workflow、todo_write、ask_user、job_list/job_output、goal)。delegate 调用必须包含 skill 和 prompt 两个必填参数,缺一不可。本会话运行在 Native 模式(工具由模型直接调用),无 run_code / TypeScript 执行器。单条消息可同时发出多个 delegate tool_use 块,由 agent loop 并发执行。
|
|
27
27
|
</角色>
|
|
28
28
|
|
|
29
29
|
<子代理>
|
|
@@ -43,6 +43,13 @@ co-planner - 只读。综合需求+信息+规范输出结构化任务分解方
|
|
|
43
43
|
|
|
44
44
|
### 委派方式(delegate 工具)
|
|
45
45
|
- 委派统一用 delegate({ skill, prompt }):skill 传专职代理名(co-explorer / co-fixer / co-oracle 等),prompt 写具体任务;skill 的精简指令由 delegate 自动注入,无需先 load skill 再手动拼 prompt
|
|
46
|
+
- **调用示例**:
|
|
47
|
+
\`\`\`json
|
|
48
|
+
{"skill": "co-explorer", "prompt": "在 src/ 下搜索所有 .tsx 文件中的 useState"}
|
|
49
|
+
\`\`\`
|
|
50
|
+
- \`skill\`(**必填**,不可省略):专职代理名,必须是子代理列表中的值(co-explorer / co-fixer / co-oracle / co-designer / co-observer / co-council / co-librarian / co-planner / co-rule-user / co-rule-project / co-rule-app)
|
|
51
|
+
- \`prompt\`(**必填**,不可省略):自包含的任务描述,含目标/路径/约束/输出格式
|
|
52
|
+
- **⚠️ 常见错误**:省略 \`skill\` 参数会导致 delegate 返回 \`Error: invalid arguments: missing required property "skill"\`,子代理无法路由到正确的专职代理。每次派发前请确认两个必填参数均已提供。
|
|
46
53
|
- delegate 前台同步返回子代理最终输出;单个委派直接调用
|
|
47
54
|
- 并行派发按下方「并行派发方式(原则 + 参数,禁止超预算大并行)」执行:优先并发:单条 assistant 消息里同时发出 N 个 delegate tool_use 块(N ≤ schedule.maxParallelBatch),由 agent loop 并发执行;单批规模受 \`schedule.maxParallelBatch\` 约束,禁止把可能超出墙钟预算的整批压进一次执行单元
|
|
48
55
|
- delegate 按 cordis.patch.yml 的 skills 配置路由 provider/model 并 spawn 子代理;子代理不共享本会话,prompt 必须自包含(写全任务目标、相关文件路径、约束、期望输出格式;角色身份由 delegate 自动注入)
|
|
@@ -180,6 +187,11 @@ co-fixer 编译测试 →(编译通过后)co-oracle 代码审查 与 co-desi
|
|
|
180
187
|
|
|
181
188
|
□ **本轮是否提议新增能力?** → 有 → 先过规则 4 三问(低频/重叠/为用而用),任一不过则不新增,先复用现有代理与调度工具
|
|
182
189
|
|
|
190
|
+
□ **本轮 delegate 调用参数是否完整?**
|
|
191
|
+
→ 每个 delegate 调用是否都包含 skill(必填)和 prompt(必填)?
|
|
192
|
+
→ skill 值是否在可用代理列表中?
|
|
193
|
+
→ prompt 是否自包含(目标/路径/约束/输出格式)?
|
|
194
|
+
|
|
183
195
|
</自检清单>
|
|
184
196
|
`
|
|
185
197
|
},
|
|
@@ -1434,8 +1446,8 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
|
|
|
1434
1446
|
parameters: {
|
|
1435
1447
|
skill: {
|
|
1436
1448
|
type: "string",
|
|
1437
|
-
required:
|
|
1438
|
-
description: "专职代理技能名,如 co-fixer/co-explorer/co-oracle"
|
|
1449
|
+
required: false,
|
|
1450
|
+
description: "专职代理技能名,如 co-fixer/co-explorer/co-oracle。缺省时默认 co-fixer"
|
|
1439
1451
|
},
|
|
1440
1452
|
prompt: {
|
|
1441
1453
|
type: "string",
|
|
@@ -1455,9 +1467,14 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
|
|
|
1455
1467
|
const { retry, stall, schedule } = resolveRuntimeConfig();
|
|
1456
1468
|
const RETRYABLE = new Set(retry.retryableReasons);
|
|
1457
1469
|
ctx.logger?.info?.("[cohub schedule] 生效调度参数:batch=" + (schedule?.maxParallelBatch ?? 3) + " wallMs=" + (schedule?.wallClockBudgetMs ?? 600000) + " jobTracking=" + (schedule?.useJobTracking ?? "auto") + " adaptiveBatch=" + (schedule?.adaptiveBatch ?? "auto"));
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1460
|
-
|
|
1470
|
+
const requestedSkill = args.skill || "co-fixer";
|
|
1471
|
+
let skill = COHUB_SKILLS.find((s) => s.name === requestedSkill);
|
|
1472
|
+
if (!skill) {
|
|
1473
|
+
ctx.logger?.warn?.('delegate: unknown skill "' + requestedSkill + '", falling back to co-fixer');
|
|
1474
|
+
skill = COHUB_SKILLS.find((s) => s.name === "co-fixer");
|
|
1475
|
+
} else if (!args.skill) {
|
|
1476
|
+
ctx.logger?.info?.("delegate: skill not specified, defaulting to co-fixer");
|
|
1477
|
+
}
|
|
1461
1478
|
const route = (getRoutes() ?? []).find((s) => s.name === args.skill);
|
|
1462
1479
|
const brief = skill.brief?.trim();
|
|
1463
1480
|
if (!brief) {
|
package/package.json
CHANGED