dsh-cohub 0.13.12 → 0.13.13
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 +1 -1
- package/lib/index.js +38 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-cohub
|
|
2
2
|
|
|
3
|
-
> 本文对应 **v0.13.
|
|
3
|
+
> 本文对应 **v0.13.13**;完整变更历史见 [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,7 +629,13 @@ function materializeJsTags(node, logger, platform = process.platform, path = "pl
|
|
|
629
629
|
}
|
|
630
630
|
return node;
|
|
631
631
|
}
|
|
632
|
-
var TEAM_OWNED_PRESET_IDS = [
|
|
632
|
+
var TEAM_OWNED_PRESET_IDS = [
|
|
633
|
+
"co-orchestrator",
|
|
634
|
+
"cohub-subagent-readonly",
|
|
635
|
+
"cohub-subagent-readonly-net",
|
|
636
|
+
"cohub-subagent-write",
|
|
637
|
+
"cohub-subagent-write-shell"
|
|
638
|
+
];
|
|
633
639
|
function isSafePresetId2(id) {
|
|
634
640
|
return /^[a-z0-9][a-z0-9._-]*$/i.test(id) && !id.includes("..");
|
|
635
641
|
}
|
|
@@ -2034,13 +2040,6 @@ Orchestrator 会在 prompt 中明确指定:
|
|
|
2034
2040
|
|
|
2035
2041
|
// src/roles.ts
|
|
2036
2042
|
var ALL_TIERS = ["ro", "ro-net", "rw", "rw-shell", "cordis"];
|
|
2037
|
-
var TIER_TO_PRESET = {
|
|
2038
|
-
ro: "cohub-subagent-readonly",
|
|
2039
|
-
"ro-net": "cohub-subagent-readonly-net",
|
|
2040
|
-
rw: "cohub-subagent-write",
|
|
2041
|
-
"rw-shell": "cohub-subagent-write-shell",
|
|
2042
|
-
cordis: "cohub-cordis"
|
|
2043
|
-
};
|
|
2044
2043
|
var BUILTIN_ROLE_TIERS = {
|
|
2045
2044
|
"co-explorer": "ro",
|
|
2046
2045
|
"co-oracle": "ro",
|
|
@@ -2106,10 +2105,6 @@ function resolveTier(roleName, customRoles) {
|
|
|
2106
2105
|
const builtin = BUILTIN_ROLE_TIERS[key];
|
|
2107
2106
|
return builtin ?? null;
|
|
2108
2107
|
}
|
|
2109
|
-
function presetForTier(tier) {
|
|
2110
|
-
const preset = TIER_TO_PRESET[tier];
|
|
2111
|
-
return typeof preset === "string" && preset.length > 0 ? preset : TIER_TO_PRESET["rw-shell"];
|
|
2112
|
-
}
|
|
2113
2108
|
var PRIMARY_AGENT_ROLE = "co-orchestrator";
|
|
2114
2109
|
function resolveActiveTeam(config) {
|
|
2115
2110
|
const id = (config?.activeTeam ?? "").trim();
|
|
@@ -5791,9 +5786,6 @@ var UNIVERSAL_DENY2 = [
|
|
|
5791
5786
|
"weather",
|
|
5792
5787
|
"video_search"
|
|
5793
5788
|
];
|
|
5794
|
-
function fallbackPresetForTier(tier) {
|
|
5795
|
-
return tier === "rw" || tier === "rw-shell" || tier === "cordis" ? SUBAGENT_WRITE_PRESET : SUBAGENT_READONLY_PRESET;
|
|
5796
|
-
}
|
|
5797
5789
|
var DEFAULT_FALLBACK_SKILL = "co-fixer";
|
|
5798
5790
|
function resolveSkillToolFilter(skillName, enabled = true, logger, customRoles) {
|
|
5799
5791
|
if (!enabled)
|
|
@@ -5811,24 +5803,14 @@ function resolveSkillToolFilter(skillName, enabled = true, logger, customRoles)
|
|
|
5811
5803
|
return;
|
|
5812
5804
|
}
|
|
5813
5805
|
}
|
|
5814
|
-
var
|
|
5815
|
-
|
|
5816
|
-
function resolveSkillAgentPreset(skillName, enabled = true, customRoles, logger) {
|
|
5806
|
+
var CORDIS_PRESET = "cohub-cordis";
|
|
5807
|
+
function resolveSkillAgentPreset(skillName, enabled = true, customRoles, _logger) {
|
|
5817
5808
|
if (!enabled)
|
|
5818
5809
|
return;
|
|
5819
5810
|
const key = (skillName ?? "").trim();
|
|
5820
5811
|
if (key === "co-orchestrator")
|
|
5821
5812
|
return;
|
|
5822
|
-
|
|
5823
|
-
if (tier === null)
|
|
5824
|
-
return SUBAGENT_WRITE_PRESET;
|
|
5825
|
-
const mapped = TIER_TO_PRESET[tier];
|
|
5826
|
-
if (typeof mapped !== "string" || mapped.length === 0) {
|
|
5827
|
-
const fallback = fallbackPresetForTier(tier);
|
|
5828
|
-
logger?.warn?.('[cohub preset] 档位 "' + tier + '"(skill=' + key + ")没有对应的子代理 preset," + "已降级为 " + fallback + "(不扩大权限)");
|
|
5829
|
-
return fallback;
|
|
5830
|
-
}
|
|
5831
|
-
return presetForTier(tier);
|
|
5813
|
+
return resolveTier(key, customRoles) === "cordis" ? CORDIS_PRESET : undefined;
|
|
5832
5814
|
}
|
|
5833
5815
|
function intersectWithRestrictable(filter, restrictableNames) {
|
|
5834
5816
|
if (!filter || !restrictableNames)
|
|
@@ -5955,6 +5937,8 @@ async function spawnWithToolFilterFallout(ctx, provider, spec) {
|
|
|
5955
5937
|
}
|
|
5956
5938
|
return handle;
|
|
5957
5939
|
} catch (error) {
|
|
5940
|
+
if (isToolFilterEnforced(error))
|
|
5941
|
+
throw error;
|
|
5958
5942
|
const message = error instanceof Error ? error.message : String(error);
|
|
5959
5943
|
const aborted = spec.signal?.aborted === true || /abort/i.test(message);
|
|
5960
5944
|
if (filter === undefined || wanted === undefined || aborted || !TOOL_FILTER_REJECTED.test(message)) {
|
|
@@ -5989,6 +5973,19 @@ function resolveAgentsService(ctx) {
|
|
|
5989
5973
|
return viaReflect;
|
|
5990
5974
|
return pick(() => ctx?.agents);
|
|
5991
5975
|
}
|
|
5976
|
+
|
|
5977
|
+
class ToolFilterEnforcedError extends Error {
|
|
5978
|
+
code = TOOL_FILTER_ENFORCED_CODE;
|
|
5979
|
+
constructor(message) {
|
|
5980
|
+
super(message);
|
|
5981
|
+
this.name = "ToolFilterEnforcedError";
|
|
5982
|
+
}
|
|
5983
|
+
}
|
|
5984
|
+
var TOOL_FILTER_ENFORCED_CODE = "cohub/toolfilter-enforced";
|
|
5985
|
+
function isToolFilterEnforced(error) {
|
|
5986
|
+
const code = error?.code;
|
|
5987
|
+
return code === TOOL_FILTER_ENFORCED_CODE;
|
|
5988
|
+
}
|
|
5992
5989
|
function applyChildToolFilterDirectly(ctx, childId, filter, degradeNotes) {
|
|
5993
5990
|
if (filter === undefined)
|
|
5994
5991
|
return;
|
|
@@ -6032,12 +6029,11 @@ function applyChildToolFilterDirectly(ctx, childId, filter, degradeNotes) {
|
|
|
6032
6029
|
tools.restrict(next);
|
|
6033
6030
|
return;
|
|
6034
6031
|
} catch (retryError) {
|
|
6035
|
-
|
|
6036
|
-
return;
|
|
6032
|
+
throw new ToolFilterEnforcedError("cohub: 子代理工具裁剪未能施加(restrict 被拒),已 fail-closed 终止本次派发:" + describeDegradeReason(retryError));
|
|
6037
6033
|
}
|
|
6038
6034
|
}
|
|
6039
6035
|
}
|
|
6040
|
-
|
|
6036
|
+
throw new ToolFilterEnforcedError("cohub: 子代理工具裁剪未能施加(restrict 被拒),已 fail-closed 终止本次派发:" + describeDegradeReason(error));
|
|
6041
6037
|
}
|
|
6042
6038
|
}
|
|
6043
6039
|
async function startSubagentRunOnce(ctx, provider, spec) {
|
|
@@ -6080,7 +6076,14 @@ ${attribution}`);
|
|
|
6080
6076
|
wrapped.stack = err.stack;
|
|
6081
6077
|
throw wrapped;
|
|
6082
6078
|
}
|
|
6083
|
-
|
|
6079
|
+
try {
|
|
6080
|
+
applyChildToolFilterDirectly(ctx, receipt.childId, spec.toolFilter, spec.degradeNotes);
|
|
6081
|
+
} catch (error) {
|
|
6082
|
+
try {
|
|
6083
|
+
receipt?.dispose?.();
|
|
6084
|
+
} catch {}
|
|
6085
|
+
throw error;
|
|
6086
|
+
}
|
|
6084
6087
|
return {
|
|
6085
6088
|
id: receipt.childId,
|
|
6086
6089
|
result: receipt.result,
|
|
@@ -6400,10 +6403,10 @@ function resolveSkillAndRoute(requestedSkill, getRoutes, ctx, logger, snapshot)
|
|
|
6400
6403
|
tier: resolveTier(DEFAULT_FALLBACK_SKILL),
|
|
6401
6404
|
builtin: true
|
|
6402
6405
|
};
|
|
6403
|
-
note = reason === "disabled" ? '传入的 skill 名 "' + echoName + '" 存在但已被禁用(config.disabledSkills),已兜底为 ' + DEFAULT_FALLBACK_SKILL + "
|
|
6406
|
+
note = reason === "disabled" ? '传入的 skill 名 "' + echoName + '" 存在但已被禁用(config.disabledSkills),已兜底为 ' + DEFAULT_FALLBACK_SKILL + ",子代理档位同步回退为 rw-shell(继承父组合 + restrict 裁剪)" + ";如需使用请从禁用清单中移除,而不是改名" : '传入的 skill 名 "' + echoName + '" 未匹配任何角色(内置角色 + config.customRoles),已兜底为 ' + DEFAULT_FALLBACK_SKILL + ",子代理档位同步回退为 rw-shell(继承父组合 + restrict 裁剪)";
|
|
6404
6407
|
} else if (fallback) {
|
|
6405
6408
|
(logger ?? ctx.logger)?.warn?.("delegate: skill 未提供(缺字段/空串/纯空白),已兜底为 " + DEFAULT_FALLBACK_SKILL + ";schema 已要求必填,出现本告警说明调用绕过了参数校验");
|
|
6406
|
-
note = "skill 未提供(缺字段/空串/纯空白),已兜底为 " + DEFAULT_FALLBACK_SKILL + "
|
|
6409
|
+
note = "skill 未提供(缺字段/空串/纯空白),已兜底为 " + DEFAULT_FALLBACK_SKILL + ",子代理档位回退为 rw-shell(继承父组合 + restrict 裁剪)";
|
|
6407
6410
|
}
|
|
6408
6411
|
const route = (getRoutes() ?? []).find((s) => s.name === requested);
|
|
6409
6412
|
return { skill: role.skill, role, route, fallback, ...note === undefined ? {} : { note } };
|
|
@@ -10604,6 +10607,7 @@ export {
|
|
|
10604
10607
|
DelegateBackgroundConfig,
|
|
10605
10608
|
ResultBudgetConfig,
|
|
10606
10609
|
ScheduleConfig,
|
|
10610
|
+
TEAM_OWNED_PRESET_IDS,
|
|
10607
10611
|
TEAM_PRESET_ORDER_BASE,
|
|
10608
10612
|
Team,
|
|
10609
10613
|
apply,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cohub",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.13",
|
|
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",
|