dsh-switchman 1.3.1 → 1.6.0

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/cordis.patch.yml CHANGED
@@ -3,12 +3,20 @@
3
3
  #
4
4
  # One bundle, four preset overrides: each of the four shipped Web presets
5
5
  # (standard / ptc / minimal / cordis) keeps its exact shipped plugin list and
6
- # gains, in its persona suffix, the dsh-switchman autonomous Agent Teams
7
- # doctrine. The persona suffix renders as the LAST system-prompt section
6
+ # gains, in its persona suffix, the dsh-switchman base dispatch doctrine
7
+ # (delegation discipline, orchestration/token rules, tiered verification).
8
+ # The persona suffix renders as the LAST system-prompt section
8
9
  # (DEPLOYMENT_PERSONA_SUFFIX, order 10200), after the conservative TEAM_POLICY
9
10
  # section (order 600) contributed by the Host-level
10
11
  # @deepseek-ai/dsh-experimental-tool-agent-team, so this doctrine is the
11
- # operative team policy for sessions of every preset.
12
+ # operative discipline for sessions of every preset.
13
+ #
14
+ # The Agent Teams clauses (conservative-policy reversal, spawn_teammate
15
+ # trigger conditions, shared task-board discipline) are NOT static: the Host
16
+ # half (host/teams.js) carries them in a dynamic `[SWITCHMAN:TEAMS]` section
17
+ # (order 10250, between this suffix and the language section) that is only
18
+ # injected while the teamsMode setting is ON. OFF leaves the factory
19
+ # conservative team policy in charge; nothing here changes.
12
20
  #
13
21
  # The Agent Teams tools themselves (spawn_teammate, team_task_*, send_message,
14
22
  # wait_agent, …) come from the Host composition, i.e. the shipped
@@ -25,6 +33,17 @@
25
33
  # the shipped presets, re-sync these lists from the new preset files, then
26
34
  # reinstall this bundle.
27
35
  #
36
+ # NEVER set `modelSelectionSettings: true` on the tool-subagent-fork row (any
37
+ # preset). Only the spawn row may carry it: while the subagent model-selection
38
+ # whitelist is enabled, every `@deepseek-ai/dsh-tool-subagent` instance with
39
+ # modelSelectionSettings registers `list_subagent_models` into each new Agent's
40
+ # scope, and a second instance makes session composition throw
41
+ # `tool "list_subagent_models" is already registered in this scope` — breaking
42
+ # creation of ALL new sessions and the recomposition of old ones. The shipped
43
+ # presets (verified against installed dsh-web-app 0.2.0-rc.2 and the fork's
44
+ # 0.2.1-alpha.1) enable it on the spawn row only; fork-side explicit routing
45
+ # is not a factory capability.
46
+ #
28
47
  # Known consequences of overriding:
29
48
  # - plugin_manager `set_plugin` on these preset rows reports `overridden`.
30
49
  # - An edit saved from the Web preset editor lands in the profile patch layer,
@@ -52,14 +71,11 @@
52
71
 
53
72
  总纲:在准确理解需求、严谨思考、最优质量、最低返工率的前提下最小化总 token 消耗。返工是最贵的 token——过程与铺陈可以省,验证与关键推理绝不省。
54
73
 
55
- 系统提示词前文的默认团队策略写的是「仅当用户明确要求时才创建 teammate」。该默认策略在当前 profile 下不适用:用户安装 dsh-switchman 即预先授权,你应当自主判断、自主触发,无需再询问用户。
56
-
57
74
  ## 一、默认委派,例外亲做(delegate by default)
58
75
  - 委派只消耗一个全新子上下文、只收回一份摘要;亲自读写每一份都会膨胀本会话上下文,长期更贵。长或重的上下文偏向委派,琐碎小事留在手里。
59
76
  - 仅当满足全部条件才亲自做:认知负载低或中、读取合计 <200 行、改动 <50 行;强迭代小步试错(每步都要立刻用上一步结果);期望收益 <3k token 的收尾。
60
77
  - 位置不确定的检索、跨多文件调查、大范围重构、独立研究或方案对比:一律委派,侦察优先派 economy 泳道。
61
78
  - 任务开始时判断一次,中途规模或结构变化时重做;结论不必请示用户。
62
- - 需要多成员持久协作、共享任务板、消息往来的用 Agent Teams(满足任一即触发 spawn_teammate:可并行的多个独立子任务;量大且自包含;主上下文水位已高;需要角色分离);一次性、无需共享状态的单点调查用 subagent。
63
79
 
64
80
  ## 二、编排与 token 纪律(Lead 职责)
65
81
  - prompt 必须自包含:目标、已知事实与结论、文件路径、期望输出与验收标准;已查明的事实不让对方重查;固定段在前、可变段在后。
@@ -68,11 +84,11 @@
68
84
  - 禁止复活死会话:子智能体达 cap 终止后,用自包含 prompt 新派一个,不 resume 旧壳。
69
85
  - 广搜先问:首次整项目范围的搜索先向用户澄清范围,定点检索不受此限。
70
86
  - 大额派发先估成本:预计 ≥3 个成员或总消耗 >100k token 时,先报规模与预估请用户确认。
71
- - 写作域隔离:共享任务上写明互不重叠的 write_scopes;用 team_task_* 维护任务板与依赖顺序;Lead 汇总最终 diff、复核关键改动并运行测试;用 wait_agent 等到必需的 teammate 完成,绝不在结果未回前下最终结论。
87
+ - 子路由两通道:显式传 provider/model/effort 任一字段会经 DSH 会话级授权白名单校验(设置页「允许 Agent 为子智能体选择模型」勾选的授权列表,与泳道池无关);被拒时用 list_subagent_models 查实际可用路由再派,或改为完全不传三字段走隐式继承(不受校验,子智能体用默认值或继承主会话路由)。泳道池只是偏好排序,授权边界以 DSH 设置为准,不试图改写它。
72
88
 
73
89
  ## 三、分级验证(质量下限,不可省)
74
90
  - 改动 >20 行或涉及多个调用点:交 tester 验证。
75
- - 改动 >300 行,或触及核心/安全/数据一致性逻辑:交 reviewer 独立复审。复审池有多个模型时优先选与主会话不同的模型;复审池只有与主会话相同的模型、或确需复用时,允许同模型复审,只需在结论中声明 DOWNGRADED。
91
+ - 改动 >300 行,或触及核心/安全/数据一致性逻辑:交 reviewer 独立复审。复审独立性以「代码作者」为锚而非主会话:作者模型 = 写出该改动的智能体的模型(子智能体按派发时显式路由记,未显式指定按继承记为主会话模型)。优先选与作者模型不同的复审模型;能同时避开主会话模型更佳(其集成复核视角已覆盖)。池内确实避不开作者模型时允许同模型复审,在结论中声明 DOWNGRADED 并注明相对作者还是相对主会话降级。
76
92
  - 任何降到更弱模型或更省验证的决定都必须显式声明;沉默放弃验证禁止。
77
93
 
78
94
  ## 四、边界
package/host/config.js CHANGED
@@ -11,6 +11,7 @@
11
11
  * - lang* project language preference (Phase 1)
12
12
  * - pool/rank dispatch pools and capability ranking (Phase 2)
13
13
  * - wm* context watermark control (Phase 3)
14
+ * - teams* Agent Teams doctrine mode + whitelist sync (teams mode)
14
15
  *
15
16
  * Ported from opencode-switchman's opencode-switchman.jsonc surface
16
17
  * (oc/src/config.ts:23-51, oc/src/types.ts:281-344) onto DSH settings.
@@ -45,7 +46,19 @@ export const EffortEntrySchema = z.object({
45
46
 
46
47
  /** All dsh-switchman settings. Field names are the settings mutation paths. */
47
48
  export const Config = z.object({
49
+ // --- Phase 0: UI locale ------------------------------------------------
50
+ /** Display language for this plugin's own UI (badge, panel, settings
51
+ * page): "auto" follows the DSH app language; any other value forces
52
+ * the plugin UI into that locale (extra locales resolve
53
+ * client-side from the inline EXTRA_UI_DICTS table, falling back
54
+ * to English). */
55
+ uiLocale: z.union(["auto", "en", "zh", "zh-TW", "ja", "ko", "de", "es", "fr", "it", "pt", "ru"]).default("auto").volatile(),
56
+
48
57
  // --- Phase 1: project language preference -----------------------------
58
+ /** Where the three language slots live: "global" = these profile-level
59
+ * fields below; "project" = each project's .switchman/lang.json (per
60
+ * session cwd; missing file = ask once per session and save there). */
61
+ langScope: z.union(["global", "project"]).default("global").volatile(),
49
62
  /** Language for conversational replies. Empty = ask once, then remember. */
50
63
  langConversation: z.string().default("").volatile(),
51
64
  /** Language for code comments. Empty = follow langConversation. */
@@ -101,6 +114,24 @@ export const Config = z.object({
101
114
  wmSubagentCap: z.boolean().default(true).volatile(),
102
115
  /** Subagent hard cap; 0 = share wmForceTokens. */
103
116
  wmSubagentForceTokens: z.number().min(0).default(0).volatile(),
117
+
118
+ // --- Teams mode: doctrine injection + whitelist sync -------------------
119
+ /** Agent Teams master switch. ON = inject the `[SWITCHMAN:TEAMS]` doctrine
120
+ * section (order 10250), keep the DSH child-model whitelist detection in
121
+ * the pools table, and asynchronously ensure the agent-team-profile
122
+ * bundle is enabled. OFF = plain subagent dispatch mode: no teams
123
+ * doctrine, no whitelist detection (the DSH factory conservative team
124
+ * policy takes over); the bundle is never disabled and the whitelist is
125
+ * never cleared. */
126
+ teamsMode: z.boolean().default(false).volatile(),
127
+ /** Replace-sync the six-pool union into DSH's subagent model-selection
128
+ * whitelist (`subagent-model-selection-settings`) whenever the teams
129
+ * orchestration runs — an INDEPENDENT switch: it does not require
130
+ * teamsMode, and teamsMode alone does not sync. switchman is the single
131
+ * source of truth: the deduplicated union overwrites allowedModels
132
+ * wholesale. The whitelist only applies to top-level sessions composed
133
+ * afterwards. */
134
+ syncWhitelist: z.boolean().default(false).volatile(),
104
135
  });
105
136
 
106
137
  /** The six dispatch lanes, in display order. */