dsh-cohub 0.13.9 → 0.13.12

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
@@ -1,6 +1,6 @@
1
1
  # dsh-cohub
2
2
 
3
- > 本文对应 **v0.13.9**;完整变更历史见 [CHANGELOG.md](./CHANGELOG.md)。
3
+ > 本文对应 **v0.13.12**;完整变更历史见 [CHANGELOG.md](./CHANGELOG.md)。
4
4
 
5
5
  DeepSeek Harness 版(对照 [OpenCode 版](../oh-my-opencode-cohub/)):中文智能体编排插件。
6
6
  把「纯调度模式 + 内置技能(代理编排体系 + co-cordis 组合创作 + 写作组)+ 多模型共识 + 运行期调度韧性」移植到 DSH 原生能力之上。
package/lib/index.js CHANGED
@@ -629,6 +629,7 @@ function materializeJsTags(node, logger, platform = process.platform, path = "pl
629
629
  }
630
630
  return node;
631
631
  }
632
+ var TEAM_OWNED_PRESET_IDS = ["co-orchestrator"];
632
633
  function isSafePresetId2(id) {
633
634
  return /^[a-z0-9][a-z0-9._-]*$/i.test(id) && !id.includes("..");
634
635
  }
@@ -658,6 +659,10 @@ function loadCohubPresetDefs(presetsDir = COHUB_PRESETS_DIR, logger) {
658
659
  for (const entry of entries) {
659
660
  if (!entry.isDirectory() || !isSafePresetId2(entry.name))
660
661
  continue;
662
+ if (TEAM_OWNED_PRESET_IDS.includes(entry.name)) {
663
+ logger?.info?.(`cohub: preset ${entry.name} 由团队注册接管(内置 dev 团队),档位注册跳过`);
664
+ continue;
665
+ }
661
666
  const dir = join2(presetsDir, entry.name);
662
667
  const agentFile = join2(dir, "agent.cordis.yml");
663
668
  if (!existsSync2(agentFile))
@@ -810,6 +815,7 @@ var BUILTIN_TEAMS = [
810
815
  id: "dev",
811
816
  name: "开发团队",
812
817
  description: "通用软件开发团队:调度 + 12 个专职子代理",
818
+ presetId: "co-orchestrator",
813
819
  members: [
814
820
  "co-fixer",
815
821
  "co-designer",
@@ -5760,6 +5766,20 @@ function formatContractViolation(errors) {
5760
5766
  }
5761
5767
 
5762
5768
  // src/delegate.ts
5769
+ function normalizeAdvisorySignals(value) {
5770
+ if (value === undefined || value === null)
5771
+ return ["S2", "S3"];
5772
+ const raw = Array.isArray(value) ? value : [];
5773
+ const out = [];
5774
+ for (const item of raw) {
5775
+ if (typeof item !== "string")
5776
+ continue;
5777
+ const sig = item.trim().toUpperCase();
5778
+ if ((sig === "S2" || sig === "S3") && !out.includes(sig))
5779
+ out.push(sig);
5780
+ }
5781
+ return out;
5782
+ }
5763
5783
  var PARALLEL_TOOL_DISCIPLINE = "【并行工具纪律】① 同一条消息内一次性发起全部独立只读查询,不要发一个等一个。" + "② 真并发的只读工具:read、read_image、web_search、web_fetch、subagent。" + "注意 glob、grep 虽然只读但不可并发(会被串行执行),别指望它们并行。" + "③ 可并发调用必须连续相邻,中间不要插 bash、edit、write、grep 等串行调用," + "否则其后调用另起一组、并发度归零([read, bash, read] 并发度=1,[read, read, read, bash] 并发度=3)。" + "④ 不要依赖平台真并发:需要 N 个互不依赖的子任务时,优先用 delegate_batch" + "(内部 Promise.allSettled,不依赖 agent loop 调度;该工具可用时)。";
5764
5784
  var DELEGATE_PERSONA = "你是被委派的专职代理:严格遵循任务消息中的角色定义、关键约束、输出格式与工具指令,并完成末尾的具体任务。" + "你的首条用户消息(下方任务书)已含 `--- 你的具体任务 ---` 分隔符,即身份判据成立:不要调用 skill 工具加载 co-orchestrator 技能——技能指令已由 brief 注入。" + PARALLEL_TOOL_DISCIPLINE;
5765
5785
  var DEFAULT_SPAWN_TRANSPORT = "spawn";
@@ -6100,6 +6120,9 @@ function normalizeArguments(args) {
6100
6120
  }
6101
6121
  return raw.replace(/\s+/g, " ").trim().slice(0, 200);
6102
6122
  }
6123
+ function maskSecrets(text) {
6124
+ return text.replace(/\bsk-[A-Za-z0-9_-]{8,}/g, "sk-***").replace(/\bBearer\s+[A-Za-z0-9._-]{8,}/g, "Bearer ***").replace(/\b(api[_-]?key|token|secret|password)(\s*[:=]\s*)[^\s&,"']{6,}/gi, (_m, key, sep) => key + sep + "***").replace(/([?&](?:api[_-]?key|key|token|secret|password)=)[^&\s"']{6,}/gi, (_m, prefix) => prefix + "***");
6125
+ }
6103
6126
  function describeFailureDetail(value) {
6104
6127
  const seen = new Set;
6105
6128
  let cur = value;
@@ -6117,7 +6140,7 @@ function describeFailureDetail(value) {
6117
6140
  text = String(cur);
6118
6141
  if (text === undefined)
6119
6142
  return;
6120
- const oneLine = text.replace(/\s+/g, " ").trim();
6143
+ const oneLine = maskSecrets(text.replace(/\s+/g, " ").trim());
6121
6144
  if (oneLine.length === 0)
6122
6145
  return;
6123
6146
  return oneLine.length > 200 ? oneLine.slice(0, 200) + "…" : oneLine;
@@ -6126,12 +6149,14 @@ function describeFailureDetail(value) {
6126
6149
  class StallWatchdog {
6127
6150
  cfg;
6128
6151
  onStall;
6152
+ onAdvisory;
6129
6153
  off = null;
6130
6154
  timer = null;
6131
6155
  boundId = null;
6132
6156
  buffer = new Map;
6133
6157
  triggered = false;
6134
6158
  maxBuffer = 5000;
6159
+ advisory = { sent: false, since: 0, signals: [] };
6135
6160
  s = {
6136
6161
  lastToolAt: 0,
6137
6162
  lastToolResultAt: 0,
@@ -6147,18 +6172,22 @@ class StallWatchdog {
6147
6172
  lastCallKey: null,
6148
6173
  pendingCall: null
6149
6174
  };
6150
- constructor(cfg, onStall) {
6175
+ constructor(cfg, onStall, onAdvisory) {
6176
+ const idleMs = Math.max(0, cfg.idleMs ?? 600000);
6151
6177
  this.cfg = {
6152
6178
  enabled: cfg.enabled ?? false,
6153
6179
  consecutiveErrors: Math.max(1, Math.trunc(cfg.consecutiveErrors ?? 3)),
6154
- idleMs: Math.max(0, cfg.idleMs ?? 600000),
6180
+ idleMs,
6155
6181
  reasoningWithoutAction: Math.max(1, Math.trunc(cfg.reasoningWithoutAction ?? 50)),
6156
6182
  loopCount: Math.max(1, Math.trunc(cfg.loopCount ?? 3)),
6157
6183
  graceMs: Math.max(0, cfg.graceMs ?? 30000),
6158
6184
  recoverable: cfg.recoverable ?? true,
6185
+ advisorySignals: normalizeAdvisorySignals(cfg.advisorySignals),
6186
+ advisoryMaxMs: Math.max(0, cfg.advisoryMaxMs ?? idleMs * 2),
6159
6187
  checkIntervalMs: Math.max(50, cfg.checkIntervalMs ?? 1000)
6160
6188
  };
6161
6189
  this.onStall = onStall;
6190
+ this.onAdvisory = onAdvisory;
6162
6191
  }
6163
6192
  attach(ctx) {
6164
6193
  if (this.off)
@@ -6270,6 +6299,11 @@ class StallWatchdog {
6270
6299
  }
6271
6300
  this.check();
6272
6301
  }
6302
+ resetAdvisory() {
6303
+ if (!this.advisory.sent && this.advisory.since === 0)
6304
+ return;
6305
+ this.advisory = { sent: false, since: 0, signals: [] };
6306
+ }
6273
6307
  check() {
6274
6308
  if (this.triggered)
6275
6309
  return;
@@ -6280,27 +6314,71 @@ class StallWatchdog {
6280
6314
  const s2 = s.lastActivityAt > 0 && now - s.lastActivityAt > cfg.idleMs;
6281
6315
  const s3 = s.reasoningStreak >= cfg.reasoningWithoutAction;
6282
6316
  const s4 = s.loopStreak >= cfg.loopCount;
6283
- const fired = [];
6317
+ if (!s1 && !s2 && !s3 && !s4) {
6318
+ this.resetAdvisory();
6319
+ return;
6320
+ }
6321
+ const graceOk = s.lastSuccessAt === 0 || now - s.lastSuccessAt > cfg.graceMs;
6322
+ if (!graceOk) {
6323
+ this.resetAdvisory();
6324
+ return;
6325
+ }
6326
+ const advisoryOn = new Set(cfg.advisorySignals);
6327
+ const fatal = [];
6328
+ const advisoryNow = [];
6284
6329
  if (s1)
6285
- fired.push("S1:连续同类错误x" + s.consecutiveErrors);
6330
+ fatal.push("S1:连续同类错误x" + s.consecutiveErrors);
6331
+ if (s4)
6332
+ fatal.push("S4:重复调用循环x" + s.loopStreak);
6286
6333
  if (s2)
6287
- fired.push("S2:无结果空转");
6334
+ (advisoryOn.has("S2") ? advisoryNow : fatal).push("S2:无结果空转");
6288
6335
  if (s3)
6289
- fired.push("S3:纯推理无动作x" + s.reasoningStreak);
6290
- if (s4)
6291
- fired.push("S4:重复调用循环x" + s.loopStreak);
6292
- if (fired.length === 0)
6336
+ (advisoryOn.has("S3") ? advisoryNow : fatal).push("S3:纯推理无动作x" + s.reasoningStreak);
6337
+ const silentMs = s.lastActivityAt > 0 ? now - s.lastActivityAt : -1;
6338
+ const sinceSuccess = s.lastSuccessAt === 0 ? "无" : now - s.lastSuccessAt + "ms";
6339
+ if (fatal.length > 0) {
6340
+ const escalated = this.advisory.sent;
6341
+ const fired = [...new Set(fatal.concat(advisoryNow).concat(this.advisory.signals))];
6342
+ const diag = "停滞检测触发 [" + fired.join(", ") + "];距最近成功工具结果 " + sinceSuccess + ";最近工具结果 " + (s.lastToolResultAt === 0 ? "无" : now - s.lastToolResultAt + "ms 前") + (escalated ? ";已由停滞告警升级(告警持续 " + (now - this.advisory.since) + "ms)" : "");
6343
+ this.triggered = true;
6344
+ const info = {
6345
+ signals: fired,
6346
+ diagnostics: diag,
6347
+ ...escalated ? { escalated: true } : {}
6348
+ };
6349
+ queueMicrotask(() => {
6350
+ if (this.triggered && this.off)
6351
+ this.onStall(info);
6352
+ });
6293
6353
  return;
6294
- const graceOk = s.lastSuccessAt === 0 || now - s.lastSuccessAt > cfg.graceMs;
6295
- if (!graceOk)
6354
+ }
6355
+ if (!this.advisory.sent) {
6356
+ this.advisory = { sent: true, since: now, signals: advisoryNow.slice() };
6357
+ const info = {
6358
+ signals: advisoryNow.slice(),
6359
+ diagnostics: "停滞告警(未中止)[" + advisoryNow.join(", ") + "];距最近活动 " + (silentMs < 0 ? "无" : silentMs + "ms") + ";持续满足超过 " + cfg.advisoryMaxMs + "ms 未恢复将升级为中止;距最近成功工具结果 " + sinceSuccess,
6360
+ advisory: true
6361
+ };
6362
+ queueMicrotask(() => {
6363
+ if (this.off && !this.triggered)
6364
+ this.onAdvisory?.(info);
6365
+ });
6296
6366
  return;
6297
- this.triggered = true;
6298
- const diag = "停滞检测触发 [" + fired.join(", ") + "];距最近成功工具结果 " + (s.lastSuccessAt === 0 ? "无" : now - s.lastSuccessAt + "ms") + ";最近工具结果 " + (s.lastToolResultAt === 0 ? "无" : now - s.lastToolResultAt + "ms 前");
6299
- const info = { signals: fired, diagnostics: diag };
6300
- queueMicrotask(() => {
6301
- if (this.triggered && this.off)
6302
- this.onStall(info);
6303
- });
6367
+ }
6368
+ const heldMs = now - this.advisory.since;
6369
+ if (heldMs > cfg.advisoryMaxMs) {
6370
+ const fired = [...new Set(this.advisory.signals.concat(advisoryNow))];
6371
+ this.triggered = true;
6372
+ const info = {
6373
+ signals: fired,
6374
+ diagnostics: "停滞检测触发(告警超上限,已升级为中止)[" + fired.join(", ") + "];告警已持续 " + heldMs + "ms(上限 " + cfg.advisoryMaxMs + "ms);距最近活动 " + (silentMs < 0 ? "无" : silentMs + "ms") + ";距最近成功工具结果 " + sinceSuccess,
6375
+ escalated: true
6376
+ };
6377
+ queueMicrotask(() => {
6378
+ if (this.triggered && this.off)
6379
+ this.onStall(info);
6380
+ });
6381
+ }
6304
6382
  }
6305
6383
  }
6306
6384
  function resolveSkillAndRoute(requestedSkill, getRoutes, ctx, logger, snapshot) {
@@ -6668,14 +6746,17 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
6668
6746
  retryDelayMs: Math.max(0, retryCfg?.retryDelayMs ?? 1000),
6669
6747
  retryableReasons: retryCfg?.retryableReasons ?? ["aborted"]
6670
6748
  };
6749
+ const stallIdleMs = Math.max(0, retryCfg?.stall?.idleMs ?? 600000);
6671
6750
  const stall = {
6672
6751
  enabled: retryCfg?.stall?.enabled ?? false,
6673
6752
  consecutiveErrors: Math.max(1, Math.trunc(retryCfg?.stall?.consecutiveErrors ?? 3)),
6674
- idleMs: Math.max(0, retryCfg?.stall?.idleMs ?? 600000),
6753
+ idleMs: stallIdleMs,
6675
6754
  reasoningWithoutAction: Math.max(1, Math.trunc(retryCfg?.stall?.reasoningWithoutAction ?? 50)),
6676
6755
  loopCount: Math.max(1, Math.trunc(retryCfg?.stall?.loopCount ?? 3)),
6677
6756
  graceMs: Math.max(0, retryCfg?.stall?.graceMs ?? 30000),
6678
6757
  recoverable: retryCfg?.stall?.recoverable ?? true,
6758
+ advisorySignals: normalizeAdvisorySignals(retryCfg?.stall?.advisorySignals),
6759
+ advisoryMaxMs: Math.max(0, retryCfg?.stall?.advisoryMaxMs ?? stallIdleMs * 2),
6679
6760
  checkIntervalMs: Math.max(50, retryCfg?.stall?.checkIntervalMs ?? 1000)
6680
6761
  };
6681
6762
  const scheduleCfg = settingsNow.schedule ?? config.schedule;
@@ -6771,7 +6852,6 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
6771
6852
  const runAttempts = async (outerSignal) => {
6772
6853
  let lastReason = "unknown";
6773
6854
  let lastDiagnostic;
6774
- let lastRunError;
6775
6855
  let lastPartial = "";
6776
6856
  let lastPartialBudget = "";
6777
6857
  const stallState = { last: null };
@@ -6833,6 +6913,8 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
6833
6913
  stallInfo = info;
6834
6914
  ctx.logger?.info?.("[cohub stall] " + JSON.stringify(info));
6835
6915
  forwardAbort();
6916
+ }, (info) => {
6917
+ ctx.logger?.warn?.("[cohub stall advisory] " + JSON.stringify(info));
6836
6918
  });
6837
6919
  const attached = watchdog.attach(ctx);
6838
6920
  if (!attached) {
@@ -6885,7 +6967,6 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
6885
6967
  await new Promise((r) => setTimeout(r, retry.retryDelayMs));
6886
6968
  continue;
6887
6969
  }
6888
- lastRunError = describeFailureDetail(error) ?? lastRunError;
6889
6970
  reportAttempt("", "failed", String(error?.message ?? error));
6890
6971
  throw error;
6891
6972
  }
@@ -6922,7 +7003,6 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
6922
7003
  await safeDispose();
6923
7004
  outcome = { stopReason: "aborted", output: [], diagnostic: "raced abort(result 未结算)" };
6924
7005
  } else {
6925
- lastRunError = describeFailureDetail(error) ?? lastRunError;
6926
7006
  reportAttempt(String(run?.id ?? ""), "failed", "error");
6927
7007
  throw error;
6928
7008
  }
@@ -6974,7 +7054,7 @@ function createDelegateTool(ctx, getRoutes, config = {}, getSettings) {
6974
7054
  lastReason = String(outcome?.stopReason ?? "unknown");
6975
7055
  const outcomeDiag = typeof outcome?.diagnostic === "string" && outcome.diagnostic.length > 0 ? outcome.diagnostic : undefined;
6976
7056
  const residualDetail = describeFailureDetail(outcome);
6977
- lastDiagnostic = outcomeDiag ?? (residualDetail !== undefined ? "subagent error: " + residualDetail : lastRunError === undefined ? undefined : "run error: " + lastRunError);
7057
+ lastDiagnostic = outcomeDiag ?? (residualDetail === undefined ? undefined : "subagent error: " + residualDetail);
6978
7058
  const partialRaw = contentText(outcome?.output ?? []);
6979
7059
  lastPartial = partialRaw.slice(0, 500);
6980
7060
  lastPartialBudget = budget.enabled && partialRaw.length > budget.partialMaxChars ? applyResultBudget(partialRaw, {
@@ -10270,7 +10350,9 @@ var StallDetector = z2.object({
10270
10350
  reasoningWithoutAction: z2.number().default(50),
10271
10351
  loopCount: z2.number().default(3),
10272
10352
  graceMs: z2.number().default(30000),
10273
- recoverable: z2.boolean().default(true)
10353
+ recoverable: z2.boolean().default(true),
10354
+ advisorySignals: z2.array(z2.string()).default(["S2", "S3"]),
10355
+ advisoryMaxMs: z2.number().description("告警升级上限毫秒;省略 = idleMs × 2;0 = 告警后立即升级")
10274
10356
  }).default({});
10275
10357
  var DelegateRetry = z2.object({
10276
10358
  maxRetries: z2.number().default(0),
@@ -10350,26 +10432,7 @@ function readPackageVersion() {
10350
10432
  }
10351
10433
  }
10352
10434
  function installAgentPresets(logger) {
10353
- const r = installShippedPresets(SHIPPED_PRESETS_DIR, dshHomePath5(".agent-presets"), readPackageVersion(), logger);
10354
- try {
10355
- const patchPath = resolveProfilePatchPath(dshHomePath5());
10356
- if (patchPath === null) {
10357
- logger?.info?.("cohub: 无法判定活动 profile($DSH_PROFILE 未设置且 profiles 下不止一个),跳过 preset 声明写入");
10358
- } else {
10359
- const p = applyPresetPatchDeclarations(SHIPPED_PRESETS_DIR, patchPath, logger);
10360
- if (p.appended.length > 0) {
10361
- logger?.info?.(`cohub: 已向 ${patchPath} 追加 ${p.appended.length} 条 preset 声明(${p.appended.join(", ")})${p.backup ? `,原文件已备份为 ${p.backup}` : ""}`);
10362
- }
10363
- if (p.conflicts.length > 0) {
10364
- logger?.info?.(`cohub: ${p.conflicts.length} 条 preset 声明保留你的版本:${p.conflicts.join(", ")}`);
10365
- }
10366
- if (p.degraded !== undefined)
10367
- logger?.info?.(`cohub: preset 声明写入已跳过(${p.degraded})`);
10368
- }
10369
- } catch (error) {
10370
- logger?.warn?.("cohub: 写入 profile patch 的 preset 声明失败(不影响插件启动)", error);
10371
- }
10372
- return r;
10435
+ return installShippedPresets(SHIPPED_PRESETS_DIR, dshHomePath5(".agent-presets"), readPackageVersion(), logger);
10373
10436
  }
10374
10437
  function readVolatile(value) {
10375
10438
  const holder = value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cohub",
3
- "version": "0.13.9",
3
+ "version": "0.13.12",
4
4
  "description": "DeepSeek Harness 版 CoHub:中文智能体编排——用户可选 2 种工作模式(co-orchestrator 纯调度 / cohub-cordis 创造模式)+ 13 个专职代理技能 + 多模型共识;另由 cohub-subagent-readonly / cohub-subagent-write 两个支撑 preset 实现子代理读写硬隔离(共 4 个 preset)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -1,3 +1,3 @@
1
- name: CoHub 调度者(带 Cordis)(cohub-cordis)
2
- description: co-orchestrator 主代理 + co_* 运行时工具(co_inspect_list / co_define / co_run 等),可直接委派 co-cordis 子代理修插件、试挂载、审核 harness 组合。纯调度纪律 + cordis 能力。需要无 cordis 的纯调度版本请用 co-orchestrator。co-cordis 子代理
3
- order: 5
1
+ name: 内部 · CoHub 调度者(带 Cordis)(cohub-cordis)
2
+ description: 内部工具集,供 cohub 编排自动选择,请勿手动选择。co-orchestrator 主代理 + co_* 运行时工具(co_inspect_list / co_define / co_run 等),可直接委派 co-cordis 子代理修插件、试挂载、审核 harness 组合。纯调度纪律 + cordis 能力。需要无 cordis 的纯调度版本请用 co-orchestrator。co-cordis 子代理
3
+ order: 900
@@ -1,2 +1,3 @@
1
- name: CoHub 子代理·只读(cohub-subagent-readonly)
2
- description: cohub 编排体系的只读子代理专用 preset:co-explorer / co-librarian / co-observer / co-oracle / co-planner / co-council / co-rule-* 使用;无写盘、无 Shell、无委派类工具。
1
+ name: 内部 · CoHub 子代理·只读(cohub-subagent-readonly)
2
+ description: 内部工具集,供 cohub 编排自动选择,请勿手动选择。cohub 编排体系的只读子代理专用 preset:co-explorer / co-librarian / co-observer / co-oracle / co-planner / co-council / co-rule-* 使用;无写盘、无 Shell、无委派类工具。
3
+ order: 900
@@ -1,2 +1,3 @@
1
- name: CoHub 子代理·只读+联网(cohub-subagent-readonly-net)
2
- description: cohub 编排体系的联网只读子代理专用 preset:co-librarian / co-observer / co-planner / co-council 使用;在 readonly 基础上接通外网抓取(web 检索类工具可用),仍无写盘、无 Shell、无委派类工具。
1
+ name: 内部 · CoHub 子代理·只读+联网(cohub-subagent-readonly-net)
2
+ description: 内部工具集,供 cohub 编排自动选择,请勿手动选择。cohub 编排体系的联网只读子代理专用 preset:co-librarian / co-observer / co-planner / co-council 使用;在 readonly 基础上接通外网抓取(web 检索类工具可用),仍无写盘、无 Shell、无委派类工具。
3
+ order: 900
@@ -1,2 +1,3 @@
1
- name: CoHub 子代理·可写(cohub-subagent-write)
2
- description: cohub 编排体系的实施类子代理专用 preset:co-fixer / co-designer / co-cordis 使用;含文件读写与 Shell,但不含任何委派类工具。
1
+ name: 内部 · CoHub 子代理·可写(cohub-subagent-write)
2
+ description: 内部工具集,供 cohub 编排自动选择,请勿手动选择。cohub 编排体系的实施类子代理专用 preset:co-fixer / co-designer / co-cordis 使用;含文件读写与 Shell,但不含任何委派类工具。
3
+ order: 900
@@ -1,2 +1,3 @@
1
- name: CoHub 子代理·读写+Shell(cohub-subagent-write-shell)
2
- description: cohub 编排体系的全能实施类子代理专用 preset:co-fixer / co-designer / co-cordis 使用;文件读写 + Shell + 外网抓取,但不含任何委派类工具。
1
+ name: 内部 · CoHub 子代理·读写+Shell(cohub-subagent-write-shell)
2
+ description: 内部工具集,供 cohub 编排自动选择,请勿手动选择。cohub 编排体系的万能实施类子代理专用 preset:co-fixer / co-designer / co-cordis 使用;文件读写 + Shell + 外网抓取,但不含任何委派类工具。
3
+ order: 900
@@ -1,179 +1,17 @@
1
- # cohub 子代理 preset 的 **profile patch 声明片段**(供 profile 的 cordis.patch.yml 使用)
1
+ # ⚠️ 已废弃(deprecated)——本文件不再被任何代码读取,仅作为迁移说明保留。
2
2
  #
3
- # 为什么需要这个文件:新版宿主(0.2.1-rc.5 实测)对 profile 里的 agent preset 采用
4
- # `@deepseek-ai/dsh-agent-preset` **声明行**注册,而不是扫描 ~/.dsh/.agent-presets/ 目录。
5
- # 因此只把 presets/<id>/ 复制进用户目录不够 —— 还必须在 profile 的 cordis.patch.yml
6
- # 里以 `- insert: { id: preset-<id>, ... }` 的形式声明,否则 delegate 传
7
- # agentPreset: '<id>' 时 presets.mount 找不到,cohub 会 fail-soft 降级为继承父 preset。
3
+ # 历史:0.13.6 之前,cohub 生成 profile patch 声明(`- insert: { id: preset-<id>, name:
4
+ # '@deepseek-ai/dsh-agent-preset', ... }`)追加到 profile 的 cordis.patch.yml,靠宿主启动时
5
+ # 加载声明来注册 agent preset。本文件是那段声明的模板/片段留存。
8
6
  #
9
- # 用法:把下面的 `- insert:` 段原样追加到目标 profile 的 cordis.patch.yml 顶层
10
- # (与既有的 preset-co-orchestrator / preset-cohub-cordis /
11
- # preset-cohub-subagent-readonly / preset-cohub-subagent-write 同级)。
12
- # 本文件本身不被 installShippedPresets 安装(它只复制 presets/ 下的**目录**)。
7
+ # 现在(0.13.6 起 → 0.13.12 彻底停用):preset 的唯一正源是**运行时注册**
8
+ # `ctx.agentPresets.register()`(见 packages/dsh-cohub/src/index.ts 的 ②c / ②d)。
9
+ # 声明写入已从 installAgentPresets() 中移除,原因:
10
+ # · profile patch 声明先于插件 apply 被宿主加载 → 旧的 preset id/内容胜出;
11
+ # · 运行时注册随后覆盖不掉已由声明挂载的 preset,实例里一度残留 6 条旧名声明。
13
12
  #
14
- # 源文件(plugins 段与之一一对应,改一处必须同时改另一处):
15
- # packages/dsh-cohub/presets/cohub-subagent-readonly-net/agent.cordis.yml
16
- # packages/dsh-cohub/presets/cohub-subagent-write-shell/agent.cordis.yml
17
- # 与既有两条声明的差异仅在 tool-web 的 fetch 开关,其余工具行逐行照抄。
18
- - insert:
19
- - id: preset-cohub-subagent-readonly-net
20
- name: '@deepseek-ai/dsh-agent-preset'
21
- config:
22
- id: cohub-subagent-readonly-net
23
- name: "CoHub 子代理·只读+联网(cohub-subagent-readonly-net)"
24
- description: "cohub 编排体系的联网只读子代理专用 preset:co-librarian / co-observer
25
- / co-planner / co-council 使用;在 readonly 基础上接通外网抓取(web 检索类工具可用),
26
- 仍无写盘、无 Shell、无委派类工具。"
27
- order: 12
28
- plugins:
29
- # ── 身份(精简:子代理不需要调度纪律,技能指令已由任务书 brief 注入)──
30
- - id: persona
31
- name: '@deepseek-ai/dsh-persona'
32
- config:
33
- # 字段名必须是 prefix(required)/ suffix;旧版 text 字段会让整行挂载失败。
34
- prefix: |-
35
- 你是 cohub 编排体系的专职子代理——只负责完成当前这一件具体任务。
36
- 不要试图调度、委派或拆分给其他代理;你的技能指令已由任务书注入,不要调用 skill 工具加载 co-orchestrator。
37
- 事实与证据优先:结论前置,证据用 path:line 形式。
38
-
39
- # ── 技能 ────────────────────────────────────────────────────────────
40
- - id: tool-skill
41
- name: '@deepseek-ai/dsh-tool-skill'
42
-
43
- # ── 任务面板 ────────────────────────────────────────────────────────
44
- - id: tool-todo
45
- name: '@deepseek-ai/dsh-tool-todo'
46
- config:
47
- allowParallelInProgress: true
48
-
49
- # ── 文件(只读)/ 搜索 / 外网(联网)────────────────────────────────
50
- # write / edit 显式关掉 —— 与 readonly 版一致,只读保证的硬边界。
51
- - id: tool-fs
52
- name: '@deepseek-ai/dsh-tool-fs'
53
- config:
54
- write: false
55
- edit: false
56
-
57
- - id: tool-fs-search
58
- name: '@deepseek-ai/dsh-tool-fs-search'
59
- config:
60
- sampleOverCapGlobResults: false
61
-
62
- # ★ 与 readonly 的唯一差异:fetch 打开(readonly 为 false)。
63
- - id: tool-web
64
- name: '@deepseek-ai/dsh-tool-web'
65
- config:
66
- fetch: true
67
-
68
- - id: skill-filesystem
69
- name: '@deepseek-ai/dsh-skill-filesystem'
70
-
71
- # 不挂:delegation / delegation-subagents / tool-subagent* / tool-workflow /
72
- # tool-goal / tool-ask-user / tool-jobs / tool-cordis / mcp-github。
73
- # 不挂 shell:联网代理不需要执行命令(真正的只读保证)。
74
-
75
- # ── 上下文压缩(参数照 co-orchestrator 现有值)─────────────────────
76
- - id: compaction
77
- name: cordis:group
78
- group: true
79
- isolate:
80
- compaction: true
81
- toolResultPruner: true
82
- config:
83
- - id: compaction-basic
84
- name: '@deepseek-ai/dsh-compaction-basic'
85
- config:
86
- thresholdRatio: 0.5
87
-
88
- - id: command-compact
89
- name: '@deepseek-ai/dsh-command-compact'
90
-
91
- - id: tool-result-pruner
92
- name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
93
- config:
94
- thresholdChars: 8192
95
- headChars: 4096
96
- tailChars: 1024
97
-
98
- - insert:
99
- - id: preset-cohub-subagent-write-shell
100
- name: '@deepseek-ai/dsh-agent-preset'
101
- config:
102
- id: cohub-subagent-write-shell
103
- name: "CoHub 子代理·读写+Shell(cohub-subagent-write-shell)"
104
- description: "cohub 编排体系的全能实施类子代理专用 preset:co-fixer / co-designer
105
- / co-cordis 使用;文件读写 + Shell + 外网抓取,但不含任何委派类工具。"
106
- order: 13
107
- plugins:
108
- # ── 身份(精简)─────────────────────────────────────────────────────
109
- - id: persona
110
- name: '@deepseek-ai/dsh-persona'
111
- config:
112
- # 字段名必须是 prefix(required)/ suffix;旧版 text 字段会让整行挂载失败。
113
- prefix: |-
114
- 你是 cohub 编排体系的专职子代理——只负责完成当前这一件具体任务。
115
- 不要试图调度、委派或拆分给其他代理;你的技能指令已由任务书注入,不要调用 skill 工具加载 co-orchestrator。
116
- 事实与证据优先:结论前置,证据用 path:line 形式。
117
-
118
- # ── 技能 ────────────────────────────────────────────────────────────
119
- - id: tool-skill
120
- name: '@deepseek-ai/dsh-tool-skill'
121
-
122
- # ── 任务面板 ────────────────────────────────────────────────────────
123
- - id: tool-todo
124
- name: '@deepseek-ai/dsh-tool-todo'
125
- config:
126
- allowParallelInProgress: true
127
-
128
- # ── 文件(读写)/ 搜索 / 外网(联网)────────────────────────────────
129
- - id: tool-fs
130
- name: '@deepseek-ai/dsh-tool-fs'
131
-
132
- - id: tool-fs-search
133
- name: '@deepseek-ai/dsh-tool-fs-search'
134
- config:
135
- sampleOverCapGlobResults: false
136
-
137
- # ★ 相对 cohub-subagent-write 的唯一差异:fetch 打开(write 为 false)。
138
- - id: tool-web
139
- name: '@deepseek-ai/dsh-tool-web'
140
- config:
141
- fetch: true
142
-
143
- - id: skill-filesystem
144
- name: '@deepseek-ai/dsh-skill-filesystem'
145
-
146
- # ── Shell(平台互斥,写法照 co-orchestrator)────────────────────────
147
- - id: tool-bash
148
- name: '@deepseek-ai/dsh-tool-bash'
149
- disabled: !!js process.platform === 'win32'
150
-
151
- - id: tool-pwsh
152
- name: '@deepseek-ai/dsh-tool-pwsh'
153
- disabled: !!js process.platform !== 'win32'
154
-
155
- # 不挂(见文件头):delegation / delegation-subagents / tool-subagent* /
156
- # tool-workflow / tool-goal / tool-ask-user / tool-jobs / tool-cordis / mcp-github。
157
-
158
- # ── 上下文压缩(参数照 co-orchestrator 现有值)─────────────────────
159
- - id: compaction
160
- name: cordis:group
161
- group: true
162
- isolate:
163
- compaction: true
164
- toolResultPruner: true
165
- config:
166
- - id: compaction-basic
167
- name: '@deepseek-ai/dsh-compaction-basic'
168
- config:
169
- thresholdRatio: 0.5
170
-
171
- - id: command-compact
172
- name: '@deepseek-ai/dsh-command-compact'
173
-
174
- - id: tool-result-pruner
175
- name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
176
- config:
177
- thresholdChars: 8192
178
- headChars: 4096
179
- tailChars: 1024
13
+ # 迁移:若某个 profile 的 cordis.patch.yml 里仍残留 `- insert:` 的
14
+ # `@deepseek-ai/dsh-agent-preset` 声明块,请直接删除这些块(保留
15
+ # `@deepseek-ai/dsh-agent-preset-registry` 那一行,它是 registry 配置而非 preset 声明)。
16
+ # 声明写入的实现(applyPresetPatchDeclarations / buildPresetPatchDeclarations)仍保留在
17
+ # packages/dsh-cohub/src/preset-install.ts 中,供外部脚本显式调用,插件启动路径不再触发。