dsh-cohub 0.4.2 → 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.
Files changed (2) hide show
  1. package/lib/index.js +25 -6
  2. 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)。本会话运行在 Native 模式(工具由模型直接调用),无 run_code / TypeScript 执行器。单条消息可同时发出多个 delegate tool_use 块,由 agent loop 并发执行。
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 自动注入)
@@ -88,6 +95,8 @@ co-explorer 搜索定位 → co-librarian 外部研究 → co-observer 多媒体
88
95
 
89
96
  ## 4. 调度执行
90
97
 
98
+ **⚠️ 从 planner 方案中读取并行分组**:planner 已在方案中标注了每个子任务的 \`[可并行]\` / \`→ 依赖任务X\` 标记和批次号。审核通过后,**直接按 planner 的批次分组组织派发**,不要重新分析依赖关系。并行检查清单用于**验证** planner 的分组是否合理(而非重建分组),发现不一致时修正后执行,但不得推翻 planner 已确认的并行决策(除非确实存在写冲突或数据依赖错误)。
99
+
91
100
  **⚠️ 执行前并行检查清单——每次准备派发 delegate 前,必须逐条确认(不可跳过):**
92
101
 
93
102
  □ **列出所有待执行任务**:逐个写出本轮需要委派的 delegate(skill + 对象 + 作用文件)
@@ -178,6 +187,11 @@ co-fixer 编译测试 →(编译通过后)co-oracle 代码审查 与 co-desi
178
187
 
179
188
  □ **本轮是否提议新增能力?** → 有 → 先过规则 4 三问(低频/重叠/为用而用),任一不过则不新增,先复用现有代理与调度工具
180
189
 
190
+ □ **本轮 delegate 调用参数是否完整?**
191
+ → 每个 delegate 调用是否都包含 skill(必填)和 prompt(必填)?
192
+ → skill 值是否在可用代理列表中?
193
+ → prompt 是否自包含(目标/路径/约束/输出格式)?
194
+
181
195
  </自检清单>
182
196
  `
183
197
  },
@@ -1432,8 +1446,8 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
1432
1446
  parameters: {
1433
1447
  skill: {
1434
1448
  type: "string",
1435
- required: true,
1436
- description: "专职代理技能名,如 co-fixer/co-explorer/co-oracle"
1449
+ required: false,
1450
+ description: "专职代理技能名,如 co-fixer/co-explorer/co-oracle。缺省时默认 co-fixer"
1437
1451
  },
1438
1452
  prompt: {
1439
1453
  type: "string",
@@ -1453,9 +1467,14 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
1453
1467
  const { retry, stall, schedule } = resolveRuntimeConfig();
1454
1468
  const RETRYABLE = new Set(retry.retryableReasons);
1455
1469
  ctx.logger?.info?.("[cohub schedule] 生效调度参数:batch=" + (schedule?.maxParallelBatch ?? 3) + " wallMs=" + (schedule?.wallClockBudgetMs ?? 600000) + " jobTracking=" + (schedule?.useJobTracking ?? "auto") + " adaptiveBatch=" + (schedule?.adaptiveBatch ?? "auto"));
1456
- const skill = COHUB_SKILLS.find((s) => s.name === args.skill);
1457
- if (!skill)
1458
- throw new Error('delegate: unknown skill "' + args.skill + '"');
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
+ }
1459
1478
  const route = (getRoutes() ?? []).find((s) => s.name === args.skill);
1460
1479
  const brief = skill.brief?.trim();
1461
1480
  if (!brief) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cohub",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "DeepSeek Harness 版 CoHub:中文智能体编排——双 preset 模式(co-orchestrator 纯调度 + cohub-standard 标准)/ 12 技能(11 专职代理 + orchestrator)/ 多模型共识",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",