@fish-under-sea/dsh-agent-teams-fish 2.0.1 → 2.0.2

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.en.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # @fish-under-sea/dsh-agent-teams-fish
2
2
 
3
- **2.0.1 · Upstream v0.1.29 synced · dsh-fish bundle member · Durable teams with Fish vendor artwork**
3
+ **2.0.2 · Upstream v0.1.29 synced · dsh-fish bundle member · Durable teams with Fish vendor artwork**
4
4
 
5
5
  [简体中文](README.md)
6
6
 
7
7
  ## Installation and Compatibility
8
8
 
9
- Since 2.0.1 this package lives in the [Fish-under-sea/dsh-fish](https://github.com/Fish-under-sea/dsh-fish) bundle repository as the workspace member `packages/dsh-agent-teams-fish`, built, versioned and released together with the other members; the former standalone repository no longer evolves separately.
9
+ Since 2.0.2 this package lives in the [Fish-under-sea/dsh-fish](https://github.com/Fish-under-sea/dsh-fish) bundle repository as the workspace member `packages/dsh-agent-teams-fish`, built, versioned and released together with the other members; the former standalone repository no longer evolves separately.
10
10
 
11
11
  ```sh
12
12
  # Bundle install (recommended, includes every member)
13
- dsh plugin --profile <profile> add @fish-under-sea/dsh-fish@2.0.1
13
+ dsh plugin --profile <profile> add @fish-under-sea/dsh-fish@2.0.2
14
14
 
15
15
  # Or install this member alone
16
- dsh plugin --profile <profile> add @fish-under-sea/dsh-agent-teams-fish@2.0.1
16
+ dsh plugin --profile <profile> add @fish-under-sea/dsh-agent-teams-fish@2.0.2
17
17
  ```
18
18
 
19
19
  The bundle already includes this member; do not mount twice. Restart DSH after installation. Requires Node `>=24.9`. Recommended Host: `0.2.2-rc.1`; older targets such as `0.2.1-rc.2` and `0.2.1-alpha.2` remain supported. [compatibility.json](compatibility.json) is the exact support authority; desktop and core versions are distinct.
@@ -47,9 +47,9 @@ Maintainers decide when to build and check before a release. Runtime approvals a
47
47
 
48
48
  ## Attribution and History
49
49
 
50
- Based on [NanmiCoder/dsh-agent-teams](https://github.com/NanmiCoder/dsh-agent-teams) (original author Relakkes / 程序员阿江). MIT. Upstream READMEs, NOTICE and release history are preserved. The source baseline follows upstream tag v0.1.29 (commit 369c278); since 2.0.1 the package is vendored into the dsh-fish bundle repository and versioned with it.
50
+ Based on [NanmiCoder/dsh-agent-teams](https://github.com/NanmiCoder/dsh-agent-teams) (original author Relakkes / 程序员阿江). MIT. Upstream READMEs, NOTICE and release history are preserved. The source baseline follows upstream tag v0.1.29 (commit 369c278); since 2.0.2 the package is vendored into the dsh-fish bundle repository and versioned with it.
51
51
 
52
- - [2.0.1](release-notes/v2.0.1.md)
52
+ - [2.0.2](release-notes/v2.0.2.md)
53
53
  - [1.1.0](release-notes/v1.1.0.md)
54
54
  - [1.0.2](release-notes/v1.0.2.md)
55
55
  - [1.0.1](release-notes/v1.0.1.md)
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # @fish-under-sea/dsh-agent-teams-fish
2
2
 
3
- **2.0.1 · 同步上游 v0.1.29 · dsh-fish 聚合成员 · 持久团队协作与 Fish 厂商美术**
3
+ **2.0.2 · 同步上游 v0.1.29 · dsh-fish 聚合成员 · 持久团队协作与 Fish 厂商美术**
4
4
 
5
5
  [English](README.en.md)
6
6
 
7
7
  ## 安装与兼容
8
8
 
9
- 自 2.0.1 起,本包并入 [Fish-under-sea/dsh-fish](https://github.com/Fish-under-sea/dsh-fish) 聚合仓库,作为工作区成员 `packages/dsh-agent-teams-fish` 与其它成员统一构建、统一版本、统一发布;原独立仓库不再单独演进。
9
+ 自 2.0.2 起,本包并入 [Fish-under-sea/dsh-fish](https://github.com/Fish-under-sea/dsh-fish) 聚合仓库,作为工作区成员 `packages/dsh-agent-teams-fish` 与其它成员统一构建、统一版本、统一发布;原独立仓库不再单独演进。
10
10
 
11
11
  ```sh
12
12
  # 聚合安装(推荐,含全部成员)
13
- dsh plugin --profile <profile> add @fish-under-sea/dsh-fish@2.0.1
13
+ dsh plugin --profile <profile> add @fish-under-sea/dsh-fish@2.0.2
14
14
 
15
15
  # 或单独安装本成员
16
- dsh plugin --profile <profile> add @fish-under-sea/dsh-agent-teams-fish@2.0.1
16
+ dsh plugin --profile <profile> add @fish-under-sea/dsh-agent-teams-fish@2.0.2
17
17
  ```
18
18
 
19
19
  聚合已包含本成员,不要重复挂载。安装后重启 DSH。Node 要求 `>=24.9`。推荐宿主 `0.2.2-rc.1`;`0.2.1-rc.2`、`0.2.1-alpha.2` 等旧版本仍在支持列表内。精确支持列表以 [compatibility.json](compatibility.json) 为唯一事实源,不以桌面应用版本推断核心版本。
@@ -47,9 +47,9 @@ pnpm --filter @fish-under-sea/dsh-agent-teams-fish verify
47
47
 
48
48
  ## 来源与记录
49
49
 
50
- 基于 [NanmiCoder/dsh-agent-teams](https://github.com/NanmiCoder/dsh-agent-teams)(原作者 Relakkes / 程序员阿江)。MIT。保留上游 README、NOTICE 和历史发布说明。源码基线为上游 tag v0.1.29(commit 369c278);自 2.0.1 起并入 dsh-fish 聚合仓库,版本随聚合统一。
50
+ 基于 [NanmiCoder/dsh-agent-teams](https://github.com/NanmiCoder/dsh-agent-teams)(原作者 Relakkes / 程序员阿江)。MIT。保留上游 README、NOTICE 和历史发布说明。源码基线为上游 tag v0.1.29(commit 369c278);自 2.0.2 起并入 dsh-fish 聚合仓库,版本随聚合统一。
51
51
 
52
- - [2.0.1](release-notes/v2.0.1.md)
52
+ - [2.0.2](release-notes/v2.0.2.md)
53
53
  - [1.1.0](release-notes/v1.1.0.md)
54
54
  - [1.0.2](release-notes/v1.0.2.md)
55
55
  - [1.0.1](release-notes/v1.0.1.md)
package/lib/index.js CHANGED
@@ -59,8 +59,10 @@ const toolPolicyConfig = z.union([
59
59
  export const Config = z.object({
60
60
  stateDir: z.string().default('.agent-teams'),
61
61
  memberProvider: z.string().default('spawn'),
62
- memberModel: z.string(),
63
- memberLlmProvider: z.string(),
62
+ // Optional: when absent, the member route comes from the official subagent
63
+ // policy (or the captain's current route when no policy was captured).
64
+ memberModel: z.union([z.string(), z.const(undefined)]),
65
+ memberLlmProvider: z.union([z.string(), z.const(undefined)]),
64
66
  executionPrompt: z.string(),
65
67
  fallback: fallbackRouteConfig,
66
68
  profiles: z.dict(z.object({
package/lib/members.js CHANGED
@@ -16,7 +16,7 @@ import { foldSubagentDescriptor } from '@deepseek-ai/dsh-subagent';
16
16
  import { createUserMessage, LlmError, ReasoningEffortId } from '@deepseek-ai/dsh-llm';
17
17
  import { randomUUID } from 'node:crypto';
18
18
  import { join } from 'node:path';
19
- import { agentTeamsSource, assertMemberModelSelection, observedSessionFormatVersion, outputLimitTurn, guardSubagentCreation, installMemberModelSelection, startMember, usesManagedActivations, guardSubagentDelivery, installContinuableMemberSetup, memberToolFilter, queueMemberPrompt, restrictableToolNames, startMemberWithLenientFilter, steerMemberPrompt, sessionOwnEvents } from "./harness-compat.js";
19
+ import { agentTeamsSource, assertMemberModelSelection, memberModelSelectionPolicy, observedSessionFormatVersion, outputLimitTurn, guardSubagentCreation, installMemberModelSelection, startMember, usesManagedActivations, guardSubagentDelivery, installContinuableMemberSetup, memberToolFilter, queueMemberPrompt, restrictableToolNames, startMemberWithLenientFilter, steerMemberPrompt, sessionOwnEvents } from "./harness-compat.js";
20
20
  import { markMailboxDelivered, appendMailbox, CAPTAIN_KEY, createMessage, readRetiredMemberIds, readTeamSync, readTeam, releaseMailboxDelivery, withTeamLock, writeTeam } from "./state.js";
21
21
  import { mailboxPrompt } from "./mailbox.js";
22
22
  import { nearestLiveLead } from "./lineage.js";
@@ -432,17 +432,39 @@ export async function resolveMemberLlmSelection(ctx, captain, request, signal) {
432
432
  // catalogs. A named provider (explicit or configured) is authoritative — a
433
433
  // model it does not advertise is a hard error, never a silent switch — and a
434
434
  // model the caller named keeps that caller's route.
435
- const provider = composed.derivedProvider
435
+ const preferredProvider = composed.derivedProvider
436
436
  ? await resolveMemberModelOwner(ctx, currentProvider, composed.model.value, signal)
437
437
  : composed.provider.value;
438
438
  // Effort ids belong to one exact provider/model capability. Preserve the
439
439
  // captain's effort only on the same route; a changed route must resolve its
440
440
  // own default. Explicit effort still wins, while "default" forces that
441
441
  // target-default behavior even when the route did not change.
442
- const model = composed.model.value;
442
+ let provider = preferredProvider;
443
+ let model = composed.model.value;
444
+ // The official subagent policy is the single source of truth for member
445
+ // routes. A configured/member-inherited route that falls outside the list is
446
+ // replaced by the first allowed route; an explicitly requested route is
447
+ // never silently re-routed and still fails the assertion below.
448
+ const policyRoutes = memberModelSelectionPolicy(ctx, captain.session);
449
+ const allowed = (candidate) => (policyRoutes === undefined
450
+ || policyRoutes.some((route) => route.provider === candidate.provider && route.model === candidate.model));
451
+ const explicitRoute = composed.provider.source === 'request' || composed.model.source === 'request';
452
+ if (policyRoutes !== undefined && !allowed({ provider, model }) && !explicitRoute) {
453
+ const first = policyRoutes[0];
454
+ if (first !== undefined) {
455
+ provider = first.provider;
456
+ model = first.model;
457
+ }
458
+ }
443
459
  assertMemberModelSelection(ctx, captain, { provider, model });
444
- if (fallback !== undefined)
445
- assertMemberModelSelection(ctx, captain, fallback);
460
+ // Fallback is derived from the same allowlist: keep the configured route when
461
+ // it is allowed, otherwise pick another allowed route, and drop it when none
462
+ // exists. This removes the need to synchronise a static fallback in the
463
+ // profile by hand.
464
+ let effectiveFallback = fallback;
465
+ if (policyRoutes !== undefined && fallback !== undefined && !allowed(fallback)) {
466
+ effectiveFallback = policyRoutes.find((candidate) => candidate.provider !== provider || candidate.model !== model);
467
+ }
446
468
  const sameRoute = provider === currentProvider && model === currentModel;
447
469
  const reasoningEffort = explicitEffort === undefined
448
470
  ? sameRoute
@@ -471,7 +493,7 @@ export async function resolveMemberLlmSelection(ctx, captain, request, signal) {
471
493
  ...resolved.reasoningEffort === undefined
472
494
  ? {}
473
495
  : { reasoningEffort: String(resolved.reasoningEffort) },
474
- ...fallback === undefined ? {} : { fallback },
496
+ ...effectiveFallback === undefined ? {} : { fallback: effectiveFallback },
475
497
  };
476
498
  }
477
499
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fish-under-sea/dsh-agent-teams-fish",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "AgentTeams 多智能体团队协作(DeepSeek Harness 插件):自然语言组队、成员与任务依赖 DAG、信箱通信、右侧栏树状监测 —— 上游 NanmiCoder/dsh-agent-teams 的补充版,新增自定义美术目录、十八厂商头像(十个有厂商 × 岗位全套)与厂商商标徽标。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -97,8 +97,9 @@
97
97
  "sync:skill": "node scripts/sync-skill.mjs",
98
98
  "update:skills": "node scripts/update-skills.mjs",
99
99
  "test:skills-updater": "node --test scripts/update-skills.test.mjs",
100
+ "verify:model-policy": "node --test scripts/model-policy-tdd.mjs",
100
101
  "verify:skill": "node scripts/sync-skill.mjs --check",
101
- "verify": "node scripts/verify.mjs && node scripts/fallback-tdd.mjs && node scripts/inline-plan-blank-optional-tdd.mjs && node scripts/member-failure-tdd.mjs && pnpm verify:issue-regressions && pnpm verify:quality-gates && node scripts/lifecycle-verify.mjs && node scripts/stress-verify.mjs && node --test scripts/issue-159.test.mjs && pnpm verify:issue-203 && pnpm verify:corrupt-state && pnpm verify:web-routes && pnpm verify:release && pnpm verify:readme && pnpm verify:skill && pnpm verify:harness-contract && pnpm verify:http-body && pnpm verify:compatibility && pnpm verify:capabilities && pnpm verify:tool-policies && pnpm verify:member-spawn-recovery && pnpm test:git-install && pnpm verify:source-runner && pnpm verify:lineage-identity && pnpm verify:legacy-session-repair && pnpm verify:git-artifact",
102
+ "verify": "node scripts/verify.mjs && node scripts/fallback-tdd.mjs && node scripts/inline-plan-blank-optional-tdd.mjs && node scripts/member-failure-tdd.mjs && pnpm verify:issue-regressions && pnpm verify:quality-gates && node scripts/lifecycle-verify.mjs && node scripts/stress-verify.mjs && node --test scripts/issue-159.test.mjs && pnpm verify:issue-203 && pnpm verify:corrupt-state && pnpm verify:web-routes && pnpm verify:release && pnpm verify:readme && pnpm verify:skill && pnpm verify:harness-contract && pnpm verify:http-body && pnpm verify:compatibility && pnpm verify:capabilities && pnpm verify:tool-policies && pnpm verify:member-spawn-recovery && pnpm test:git-install && pnpm verify:source-runner && pnpm verify:lineage-identity && pnpm verify:legacy-session-repair && pnpm verify:model-policy && pnpm verify:git-artifact",
102
103
  "verify:quality-gates": "node scripts/quality-gates-tdd.mjs && node --test scripts/quality-gates-repair-scope.test.mjs scripts/quality-gates-amend.test.mjs scripts/quality-gates-content-bound.test.mjs scripts/quality-gates-work-order.test.mjs scripts/quality-gates-repair-wiring.test.mjs scripts/quality-gates-excluded-scope.test.mjs scripts/quality-gates-cross-binding.test.mjs",
103
104
  "verify:issue-203": "node --test scripts/issue-203-card.test.mjs",
104
105
  "verify:corrupt-state": "node --test scripts/corrupt-teamjson.test.mjs",
@@ -0,0 +1,70 @@
1
+ /** 官方 subagent 策略是成员路由与 fallback 的唯一名单来源。 */
2
+ import assert from 'node:assert/strict'
3
+ import { test } from 'node:test'
4
+ import { resolveMemberLlmSelection } from '../lib/members.js'
5
+
6
+ const POLICY = [
7
+ { provider: 'magpie', model: 'group/deepseek' },
8
+ { provider: 'magpie', model: 'group/qwen-p' },
9
+ { provider: 'magpie', model: 'group/glm' },
10
+ ]
11
+
12
+ function fixture(policy = POLICY) {
13
+ const captain = {
14
+ id: 'captain',
15
+ options: { provider: 'magpie', model: 'group/deepseek' },
16
+ session: {
17
+ requestHeader: () => ({ config: { provider: 'magpie', model: 'group/deepseek' } }),
18
+ append() {},
19
+ },
20
+ }
21
+ const ctx = {
22
+ get: (name) => name === 'sessionProjections'
23
+ ? { stateOf: () => policy }
24
+ : undefined,
25
+ llm: {
26
+ resolveCallConfig: async (route) => route,
27
+ },
28
+ }
29
+ return { ctx, captain }
30
+ }
31
+
32
+ test('名单内 fallback 保留原值', async () => {
33
+ const { ctx, captain } = fixture()
34
+ const selection = await resolveMemberLlmSelection(ctx, captain, {
35
+ fallback: { provider: 'magpie', model: 'group/qwen-p' },
36
+ })
37
+ assert.equal(selection.provider, 'magpie')
38
+ assert.equal(selection.model, 'group/deepseek')
39
+ assert.deepEqual(selection.fallback, { provider: 'magpie', model: 'group/qwen-p' })
40
+ })
41
+
42
+ test('名单外 fallback 自动改成名单内另一条路由', async () => {
43
+ const { ctx, captain } = fixture()
44
+ const selection = await resolveMemberLlmSelection(ctx, captain, {
45
+ fallback: { provider: 'magpie', model: 'group/hy4-m' },
46
+ })
47
+ assert.deepEqual(selection.fallback, { provider: 'magpie', model: 'group/qwen-p' })
48
+ })
49
+
50
+ test('captain 默认路由不在名单内时自动改用名单首项(未配置 fallback 则不降级)', async () => {
51
+ const { ctx, captain } = fixture([
52
+ { provider: 'magpie', model: 'group/qwen-p' },
53
+ { provider: 'magpie', model: 'group/glm' },
54
+ ])
55
+ const selection = await resolveMemberLlmSelection(ctx, captain, {})
56
+ assert.equal(selection.provider, 'magpie')
57
+ assert.equal(selection.model, 'group/qwen-p')
58
+ assert.equal(selection.fallback, undefined)
59
+ })
60
+
61
+ test('显式选择名单外路由仍然报错,不静默改路', async () => {
62
+ const { ctx, captain } = fixture()
63
+ await assert.rejects(
64
+ () => resolveMemberLlmSelection(ctx, captain, {
65
+ provider: 'magpie',
66
+ model: 'group/hy4-m',
67
+ }),
68
+ /not allowed for this Session/,
69
+ )
70
+ })
package/src/index.ts CHANGED
@@ -141,8 +141,10 @@ const toolPolicyConfig = z.union([
141
141
  export const Config: z<Config> = z.object({
142
142
  stateDir: z.string().default('.agent-teams'),
143
143
  memberProvider: z.string().default('spawn'),
144
- memberModel: z.string(),
145
- memberLlmProvider: z.string(),
144
+ // Optional: when absent, the member route comes from the official subagent
145
+ // policy (or the captain's current route when no policy was captured).
146
+ memberModel: z.union([z.string(), z.const(undefined)]),
147
+ memberLlmProvider: z.union([z.string(), z.const(undefined)]),
146
148
  executionPrompt: z.string(),
147
149
  fallback: fallbackRouteConfig,
148
150
  profiles: z.dict(z.object({
package/src/members.ts CHANGED
@@ -20,7 +20,7 @@ import { createUserMessage, LlmError, ReasoningEffortId } from '@deepseek-ai/dsh
20
20
  import type { Session, SessionId } from '@deepseek-ai/dsh-session'
21
21
  import { randomUUID } from 'node:crypto'
22
22
  import { join } from 'node:path'
23
- import { agentTeamsSource, assertMemberModelSelection, observedSessionFormatVersion, outputLimitTurn, type SessionFormatBearer, guardSubagentCreation, installMemberModelSelection, startMember, usesManagedActivations, guardSubagentDelivery, installContinuableMemberSetup, memberToolFilter, queueMemberPrompt, restrictableToolNames, startMemberWithLenientFilter, steerMemberPrompt, sessionOwnEvents } from './harness-compat.ts'
23
+ import { agentTeamsSource, assertMemberModelSelection, memberModelSelectionPolicy, observedSessionFormatVersion, outputLimitTurn, type SessionFormatBearer, guardSubagentCreation, installMemberModelSelection, startMember, usesManagedActivations, guardSubagentDelivery, installContinuableMemberSetup, memberToolFilter, queueMemberPrompt, restrictableToolNames, startMemberWithLenientFilter, steerMemberPrompt, sessionOwnEvents } from './harness-compat.ts'
24
24
  import { markMailboxDelivered, appendMailbox, CAPTAIN_KEY, createMessage, readRetiredMemberIds, readTeamSync, readTeam, releaseMailboxDelivery, withTeamLock, writeTeam } from './state.ts'
25
25
  import { mailboxPrompt } from './mailbox.ts'
26
26
  import { nearestLiveLead } from './lineage.ts'
@@ -569,7 +569,7 @@ export async function resolveMemberLlmSelection(
569
569
  // catalogs. A named provider (explicit or configured) is authoritative — a
570
570
  // model it does not advertise is a hard error, never a silent switch — and a
571
571
  // model the caller named keeps that caller's route.
572
- const provider = composed.derivedProvider
572
+ const preferredProvider = composed.derivedProvider
573
573
  ? await resolveMemberModelOwner(ctx, currentProvider, composed.model.value, signal)
574
574
  : composed.provider.value
575
575
 
@@ -577,9 +577,34 @@ export async function resolveMemberLlmSelection(
577
577
  // captain's effort only on the same route; a changed route must resolve its
578
578
  // own default. Explicit effort still wins, while "default" forces that
579
579
  // target-default behavior even when the route did not change.
580
- const model = composed.model.value
580
+ let provider = preferredProvider
581
+ let model = composed.model.value
582
+ // The official subagent policy is the single source of truth for member
583
+ // routes. A configured/member-inherited route that falls outside the list is
584
+ // replaced by the first allowed route; an explicitly requested route is
585
+ // never silently re-routed and still fails the assertion below.
586
+ const policyRoutes = memberModelSelectionPolicy(ctx, captain.session)
587
+ const allowed = (candidate: { provider: string; model: string }): boolean => (
588
+ policyRoutes === undefined
589
+ || policyRoutes.some((route) => route.provider === candidate.provider && route.model === candidate.model)
590
+ )
591
+ const explicitRoute = composed.provider.source === 'request' || composed.model.source === 'request'
592
+ if (policyRoutes !== undefined && !allowed({ provider, model }) && !explicitRoute) {
593
+ const first = policyRoutes[0]
594
+ if (first !== undefined) {
595
+ provider = first.provider
596
+ model = first.model
597
+ }
598
+ }
581
599
  assertMemberModelSelection(ctx, captain, { provider, model })
582
- if (fallback !== undefined) assertMemberModelSelection(ctx, captain, fallback)
600
+ // Fallback is derived from the same allowlist: keep the configured route when
601
+ // it is allowed, otherwise pick another allowed route, and drop it when none
602
+ // exists. This removes the need to synchronise a static fallback in the
603
+ // profile by hand.
604
+ let effectiveFallback = fallback
605
+ if (policyRoutes !== undefined && fallback !== undefined && !allowed(fallback)) {
606
+ effectiveFallback = policyRoutes.find((candidate) => candidate.provider !== provider || candidate.model !== model)
607
+ }
583
608
  const sameRoute = provider === currentProvider && model === currentModel
584
609
  const reasoningEffort = explicitEffort === undefined
585
610
  ? sameRoute
@@ -607,7 +632,7 @@ export async function resolveMemberLlmSelection(
607
632
  ...resolved.reasoningEffort === undefined
608
633
  ? {}
609
634
  : { reasoningEffort: String(resolved.reasoningEffort) },
610
- ...fallback === undefined ? {} : { fallback },
635
+ ...effectiveFallback === undefined ? {} : { fallback: effectiveFallback },
611
636
  }
612
637
  }
613
638