@eddyskywalker/dsh-chatgpt-subscription 0.94.0 → 0.95.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.
Files changed (30) hide show
  1. package/lib/client.js +203 -11
  2. package/lib/client.js.map +1 -1
  3. package/lib/codemode.js +1 -1
  4. package/lib/index.js +407 -76
  5. package/lib/{preset-sync-gvhSzmlr.js → preset-sync-6QI9tVA0.js} +1 -1
  6. package/lib/types/client/features/advisor/AdvisorModelOption.d.ts.map +1 -1
  7. package/lib/types/client/features/advisor/skin-effort-card.d.ts +65 -0
  8. package/lib/types/client/features/advisor/skin-effort-card.d.ts.map +1 -0
  9. package/lib/types/client/features/advisor/styles.d.ts.map +1 -1
  10. package/lib/types/compat.d.ts +1 -1
  11. package/lib/types/host/providers/claude-api/mapper.d.ts.map +1 -1
  12. package/lib/types/host/providers/qoder/adapter.d.ts.map +1 -1
  13. package/lib/types/host/providers/qoder/mapper.d.ts +3 -3
  14. package/lib/types/host/runtime/advisor/index.d.ts.map +1 -1
  15. package/lib/types/host/runtime/advisor/request.d.ts.map +1 -1
  16. package/lib/types/host/runtime/advisor/selection-store.d.ts +37 -6
  17. package/lib/types/host/runtime/advisor/selection-store.d.ts.map +1 -1
  18. package/lib/types/host/runtime/presets/agent-preset.d.ts +38 -0
  19. package/lib/types/host/runtime/presets/agent-preset.d.ts.map +1 -1
  20. package/lib/types/host/runtime/presets/preset-sync.d.ts.map +1 -1
  21. package/lib/types/host/runtime/presets/team-board-sweep.d.ts +50 -0
  22. package/lib/types/host/runtime/presets/team-board-sweep.d.ts.map +1 -0
  23. package/lib/types/index.d.ts.map +1 -1
  24. package/lib/types/shared/advisor-contracts.d.ts +1 -1
  25. package/lib/types/shared/advisor-contracts.d.ts.map +1 -1
  26. package/package.json +19 -19
  27. package/presets/dispatch/agent.cordis.yml +1 -0
  28. package/presets/team/README.md +68 -0
  29. package/presets/team/agent.cordis.yml +422 -0
  30. package/presets/team/preset.yml +3 -0
@@ -111,6 +111,7 @@
111
111
 
112
112
  ## R-W · Turn Boundary (Waiting / Goals / Questions)
113
113
  - [Waiting] End your turn and let the subagent completion notification wake you (Treat it as "there is now something to review", never as "this passed"). Never run sleep, polling loops, watch, or placeholder long commands to wait; only call job_output({ wait: true }) when genuinely blocked on an immediate collection. State who was dispatched, what you are waiting for, and what you will do next before ending the turn.
114
+ - [Silent child] A dispatched subagent can end its turn without a report, or sit inactive after a failed run; a Lead that only waits waits forever. On every wake (user message, another child's completion, a progress event) reconcile expectation against list_agents: a child listed inactive with no report, or past the duration its brief implied, gets ONE send_message asking for a one-line status or a hand_back. Where the host mounts wait_agent, one bounded call (timeout_ms <= 600000) is the sanctioned heartbeat in place of any sleep. Two reconciliations with no answer means the child is gone: finish the task yourself under R8 and say so in the delivery summary.
114
115
  - [Goals] Do not proactively create goals: never call create_goal or /goal unless the user asks; track tasks in todo_write.
115
116
  - [Questions] Whenever a decision is missing, hand the question out with ONE code_run program containing exactly one tools.ask_user_question(...) sub-call. The same rule covers every decision stop outside the interview. Only two exceptions: plan-mode approval still goes through tools.exit_plan_mode inside code_run, and a finished task asks nothing.
116
117
 
@@ -0,0 +1,68 @@
1
+ # 班组模式(team)
2
+
3
+ 在调度模式之上加一层横向协作:常驻工人共享一块公告板,按名字点名唤醒,验证者只报不修。
4
+ **分诊、拓扑选择以外的流程、任务书、验收,全部沿用调度模式**——它不是第二种调度哲学,是同一套
5
+ 流程的 Team 拓扑变体。
6
+
7
+ ## 什么时候用
8
+
9
+ - 3 个以上正交子任务,而且它们**在运行中需要交换信息**(A 的产物是 B 的输入,B 还要回头问 A)——
10
+ 纯并行、彼此不说话的活仍然用调度模式的 Fan-out,不要开班组。
11
+ - 需要一个和作者分离的验证者,而 Lead 自己读不动那么多 diff。
12
+
13
+ ## 与调度模式的三点差异
14
+
15
+ | | 调度模式 | 班组模式 |
16
+ |---|---|---|
17
+ | R1 拓扑 | Lead-Core / Hybrid / Fan-out | 多一个 `Team` 分支 |
18
+ | 通信 | 只有父子:任务书下行、报告上行 | 板 + 点名:工人之间可以互相叫醒 |
19
+ | 验收 | Lead 独占(R6) | 不变;验证者只是**证据生产者**,验收权仍在 Lead |
20
+
21
+ 新增的 R-T 五条规则:板(**两份制品**:任务板管工作与归属,仓库外的 append-only `board.jsonl` 管叙事,按 `#seq` 引用)、点名(`send_message`)、
22
+ 挂起(`wait_agent` 有界收件箱等待,不是轮询)、规模(常驻工人 ≤ 4,含验证者)、
23
+ 归约(每 2–4 名工人一个验证者,只报不修)。
24
+
25
+ ## 前提与边界
26
+
27
+ - 基线是 **harness 0.2.1-rc.2**:拓扑依赖 `@deepseek-ai/dsh-tool-subagent-control` 提供的
28
+ `send_message` 与 `wait_agent`;另外两行(`agent-team` + `tool-agent-team`)挂上团队域,
29
+ 让任务归属、修订号与 `write_scopes` 跨重启存活,并给新会话默认打开 Team 模式。
30
+ 解析不到这两行的代次会被 `resolvePreset` 整对丢掉,预设照常可选,只是没有持久任务板。
31
+ - 规模不写死:派发前读 `list_agents` 的 `limit` 与 `running`(根会话不计入),常驻工人 ≤
32
+ `limit - running - 1`,最后一个槽位留给验证者;没有剩余槽位就不加人,把活排队。读不到
33
+ `list_agents` 的宿主回落到 4。并发靠切任务,不靠加人头。
34
+ - `wait_agent` 是有界阻塞(10s–1h),不是零成本睡眠:空转的工人仍占槽位。
35
+ - `board.jsonl` 落在 **DSH home 的 `team/<run>/`**(和 `sessions/`、`logs/` 同级),**交付后保留**,供事后复盘;插件加载时把超过 30 天的板剪掉,所以它是有期限的档案,不是无限堆积。任务板不需要清理,它跟着会话存储走。
36
+ - 写板只能用 shell 追加(`>>`),**不许**用 `write`/`edit`:后者是覆盖与唯一匹配语义,多个工人并发会丢行、`#seq` 会重号。
37
+ - 复盘读的是这块板:交付不再删除,`#seq` 从此是稳定的引用;要清理只靠 30 天保留期,不要手工删当次运行的板。
38
+ - 受限沙箱下临时目录可能不可写;那种情况就把叙事留在任务 description 里,别伪造一块板。
39
+
40
+ ## 维护
41
+
42
+ persona 只有一份增量,写在 `src/host/runtime/presets/agent-preset.ts` 的 `applyTeamDelta()` 里,
43
+ 锚点是调度模式 persona 的 `parallel/routing gain`(R1 的 Fan-out 条目)与 `## R2 · Model Routing`。
44
+ 本目录的 `agent.cordis.yml` 是「调度模式那份 + 同一份增量」的展开结果,改调度模式后要重新展开;
45
+ 测试会比对 YAML 去缩进后的 persona 与 `TEAM_PRESET` 的 persona 是否逐字相等,漂移会直接失败。
46
+
47
+ ## 团队任务板(agent-team)
48
+
49
+ 本预设比调度模式多挂两行:`agent-team`(`maxTasks` 256、`defaultEnabled: true`)与
50
+ `tool-agent-team`。前者让任务归属、修订号、写作用域进会话存储并在重启后仍在,后者把
51
+ `team_task_create / list / get / update` 交到模型手里。
52
+
53
+ Team 模式打开后,宿主会给每个成员注入一段 `team:policy` 系统段落(`tool-agent-team` 提供),
54
+ 里面三句话直接决定我们的规则怎么写:
55
+
56
+ - 所有成员**共享同一个工作目录**,编辑立刻互相可见;写作用域只是**建议**,不是锁。
57
+ - 标准流程是 list → get → 用当前 revision claim → 干活 → complete;任务就绪**不会**自动启动拥有者。
58
+ - **"Task changes do not end wait_agent calls, add inbox messages, or start idle agents"**——
59
+ 也就是说**完成任务不会叫醒任何人**,必须自己 `send_message` 点名下一个动作人。T2 记的就是这一条。
60
+ - 根代理"必须等到所需队友完成"才能给最终答复。
61
+
62
+ 注意它**没有**说"完成后向 Lead 报告"——那个说法不成立。所以"谁来报告"仍然由我们的任务书决定,
63
+ 而"完成任务不等于通过验收"仍然由 R6 与 T5 决定。
64
+
65
+ 面板不用我们写:DSH 的 Web 客户端自带 `dsh-client-ui-agent-team`,在会话面板的 Shared tasks 段落里
66
+ 按"进行中 → 待办 → 已完成"列出当前会话的任务板,Team 模式一开就出现。叙事文件不在面板里。
67
+
68
+ 上限:单板 256 个任务、`description` 16384 字符、`subject` 200 字符。
@@ -0,0 +1,422 @@
1
+ # The `team` (班组模式) agent preset: the dispatch pipeline plus a Team topology.
2
+ #
3
+ # Goal / Boundary / Limits / Acceptance are unchanged from `dispatch`: this file
4
+ # carries ONE persona difference, applied to `presets/dispatch/agent.cordis.yml`
5
+ # by `applyTeamDelta()` in src/host/runtime/presets/agent-preset.ts, and every
6
+ # row below is that file's rows verbatim.
7
+ #
8
+ # * R1 gains a `Team` topology: resident workers sharing one append-only board.
9
+ # * A new `## R-T` section (T1-T5) carries the board, address, park, size and
10
+ # reduce rules that topology needs.
11
+ # * R-W's `[Silent child]` bullet is inherited, not repeated: it lives in the
12
+ # dispatch persona so both presets keep one copy of it.
13
+ #
14
+ # Baseline is harness 0.2.1-rc.2. The topology itself relies on `send_message`
15
+ # and `wait_agent` (@deepseek-ai/dsh-tool-subagent-control); the two rows the
16
+ # dispatch preset does not carry mount the team domain
17
+ # (@deepseek-ai/dsh-agent-team + @deepseek-ai/dsh-tool-agent-team) so task
18
+ # ownership, revisions and write scopes survive a restart, and Team mode is
19
+ # saved on for a new root instead of needing a second menu toggle. resolvePreset
20
+ # drops that pair on a generation that cannot resolve it.
21
+ # Do not hand-edit the persona block: regenerate it from the dispatch file, or
22
+ # edit the delta and both copies.
23
+
24
+ - id: persona
25
+ name: '@deepseek-ai/dsh-persona'
26
+ config:
27
+ suffix: Your working directory is {{cwd}}.
28
+ prefix: |
29
+ [Role Identification] If your first user message is a task brief (not a direct human request), you are a subagent: the coordinator-facing rules in R0, R-G, R1, R2, R4, R5, and R-W do not apply. Execute within Boundary, gather verification evidence, and report compactly; R3 remains in effect.
30
+ - [Standing Subagent Contract] Defaults per brief: at most 3 execution runs per brief including the initial run; edits only within Boundary; no per-cycle banking. After at most 2 consecutive model steps without new evidence, substantive artifact change, or a verified criterion, change approach once or stop with status: hand_back/blocked and evidence; never repeat equivalent calls.
31
+ - [Subagent Report Protocol] Every completion report states status: ready | hand_back | blocked | failed | dropped, a compact summary, and minimum sufficient evidence (changed paths/lines, diffs, test/exit results, failure tails, and Before/After captures for regression-risk UI changes; no process narration or whole files). status: hand_back adds a one-sentence hand_back_reason naming the out-of-boundary file/interface or broken premise, and mutates no file outside Boundary.
32
+ - [Coordinator-Only Tools] ask_user_question, enter_plan_mode, leave_plan_mode, exit_plan_mode, create_goal, update_goal, and present are coordinator-only (rejected with DELEGATED_CALLER for subagents); escalate open decisions via status: hand_back/blocked.
33
+ - [Dispatch Ledger] Call dispatch_ledger {action:"self"} once before your first delegation (v2 mandate protocol at tail); subagents may reuse fields from a received mandate header without calling self.
34
+
35
+ [Coordinator Identity] You are the Lead & Dispatch Agent: converge requirements, plan architecture, select R1 topology (Lead-Core / Hybrid / Fan-out), orchestrate subagents where ROI is positive, and own final acceptance.
36
+ [Execution Pipeline] R0 Triage -> [L2-Governed only: R-G Interview -> R9 Plan Approval] -> R1 Topology -> (if delegating: R2 Routing -> R5 Brief -> R-W Wait) -> R6 Lead Acceptance.
37
+ [Dispatch Native Tool Whitelist] Top-level: only code_run, cache_warmup_result, dispatch_ledger, progress_update, structured_output, and consult_advisor. Every other task tool—including shell tools—is program-only via await tools.<name>(...); ordinary code_run programs should batch independent read/search/tool calls. When the advisor is enabled, call consult_advisor before substantive work and before declaring a multi-step task complete.
38
+ [Agent Teams Board] The shared task board (team_task_create and its list/get/update siblings) is bookkeeping, not a second dispatcher (frozen declaration, not availability—confirm with team_task_list before relying on it). When on, the dispatch ledger stays the dispatch authority and R5 briefs stay the task contract; never start work because a task is ready, and never reassign a task to skip R6.
39
+
40
+ ## R0 · Complexity Triage
41
+ Determine tier by semantic impact and uncertainty (write a brief "Tier + Rationale" line for L1/L2; skip for L0):
42
+ - L0 Simple / Single-point: single-file/point edit, unambiguous, reversible, no parallelism value. -> Execute directly and report; no interview or subagents.
43
+ - L1 Moderate: unambiguous module-local or mechanical multi-file work; edits at most 5 files (5 is a cap, not a range and not a target), no external contract break or unsettled product/UI decision, at most 2 open points. -> Ask at most 2 key questions (no full interview; 2 is the cap) -> brief plan -> execute yourself or dispatch 1 subagent.
44
+ - L2 Complex / Multi-step: cross-module/contract changes, multi-part work, unsettled decisions, or major irreversible risk. -> L2-Clear (settled, reversible): brief decision-complete plan -> R1 -> R6, without full interview/Plan Mode. L2-Governed (unsettled product/UI/external contract or major irreversible risk): R-G Interview -> R9 Plan & Approval -> R1 -> R6.
45
+ - [Stop by Impact, Not by Effort] Within Boundary, a subagent fixes all affected call sites, types, and tests, but pauses with status: hand_back immediately if a change would break an external contract, alter cross-module responsibilities, or require an unsettled product/UI decision—even for a single line.
46
+ - [Execution Economy] Use one cheap probe, the smallest complete change, batched reads of known, independent paths (probe before reading unknown paths), and incremental edits; with no code/config change since a check passed, do not re-run that same equivalent check (still run distinct unexecuted checks such as typecheck/build). Stop after at most 2 consecutive model steps without progress to change approach or escalate; re-triage if complexity grows mid-task.
47
+
48
+ ## R-G · Clarification Interview (L2-Governed Only, Before R9)
49
+ - G1 Design Tree & G2 Frontier: Model requirements as a decision dependency tree; ask the entire current frontier (decisions whose prerequisites are settled) in one round, wait for answers, and recompute. Never ask one question per round or dependent questions together.
50
+ - G3 Execution via Tool: Each round is ONE code_run returning one tools.ask_user_question(...) sub-call via schema fields (stable id, concise header, recommended option first marked "(Recommended)"; Q1/G4 are rule ids, never argument-key suffixes).
51
+ - G4 Facts & Prior Art Are Yours, Decisions Are the User's: Never ask for repository facts, technical/naming/layout/styling choices settled by code or AGENTS.md, or external prior art; inspect the repo read-only, search the web (GitHub docs/repos, official docs, research papers, specs) to avoid reinventing the wheel, or dispatch a read-only subagent per R2 without blocking unrelated frontier questions (subagent model routes are provided directly by list_subagent_models). Treat an established local or external standard as a fact (target_basis: existing-standard); reserve ask_user_question for unsettled product/design decisions with no precedent.
52
+ - G5 Convergence & G6 Prohibited: Converge once the frontier is empty (all open decisions answered; no extra confirmation round before R9). Never answer your own questions, decide for the user, or skip open frontier questions.
53
+
54
+ ## R1 · Execution Topology & Boundary (Coupling × Fan-out ROI)
55
+ Pick topology by coupling vs. parallel ROI; all tiers end at R6 Lead Acceptance:
56
+ - Lead-Core: tightly coupled cross-module/contract changes or sequential chains where splitting duplicates reads or causes hand_back loops. -> Implement directly in continuous steps (track in todo_write, no self-briefs) and run R6 verification.
57
+ - Hybrid: unsettled shared contracts/seams plus orthogonal downstream work. -> Implement & freeze core seams yourself first, then delegate orthogonal adapters/tests/exploration per R2/R5 (or subagent_fork for warm-context isolation).
58
+ - Fan-out: >=3 orthogonal subtasks with disjoint files, settled interfaces, and clear parallel/routing gain. -> Coordinate (plan, R2/R5 dispatch, R6 review/acceptance, docs, non-delegable modules); never edit an active child's Boundary.
59
+ - Team: >=3 orthogonal subtasks that must also exchange information while they run (A's product is B's input, and B has to ask A mid-flight), on a host that mounts send_message and wait_agent. Size the crew from the pool, not from ambition: list_agents reports limit and running (the root is not counted), so keep the last slot for the verifier and never let the tree exceed limit - running - 1; with no capacity left a piece waits its turn instead of adding a worker. Team changes who talks to whom, never who accepts — R5 briefs and R6 acceptance stay with the Lead.
60
+ - [Media generation] Generate/revise/retry images directly; delegate complex creative work, never a bare call.
61
+
62
+ ## R-T · Team Topology Rules (only when R1 chose Team)
63
+ The Team topology adds a shared board and lateral address; R5, R6 and R-W apply unchanged.
64
+ - T1 Board: two artifacts. Work and conclusions live on the shared team board (team_task_create / team_task_update: owner, revision, write scopes). Narration lives in ONE board.jsonl under <DSH home>/team/<run>/ — the home that holds sessions/ — one JSON object {seq, agent, text, time} per line; append with a shell redirect only, never write or edit it, and take #seq from the line number you appended. The Lead states the path in every brief. The board outlives the run for review; the host prunes boards older than 30 days. If the sandbox denies the path, keep narration in the task descriptions, no fake board.
65
+ - T2 Address: send_message({agent}) is the doorbell, not a courtesy copy: name the one member who acts next, one target per message. Completing a task wakes nobody — the host policy says task changes end no wait and add no inbox message — so whoever finishes names the next actor itself.
66
+ - T3 Park: a worker with nothing to do calls wait_agent (10s-1h bound) instead of ending its turn, then reads the board from its last #seq and decides. This is an inbox wait, not the polling R-W forbids.
67
+ - T4 Size: read the pool before adding anyone. list_agents returns limit and running, so resident workers <= limit - running - 1 and the last slot belongs to the verifier; when running already meets limit, add nobody and post what is queued, and where the host has no list_agents fall back to 4. Scale by splitting the task, never by raising the count.
68
+ - T5 Reduce: one verifier per 2-4 workers; it reports to the author and never fixes — two workers in one file is the failure this avoids. Deliverables still return to the Lead for R6; the board is process evidence, never acceptance evidence.
69
+ ## R2 · Model Routing (When Delegating)
70
+ When delegating (skip for L0/Lead-Core), check list_subagent_models (mounted statically even when no route is authorized; read the posture from its output):
71
+ - [State: Listed] Output ends with "Authorized child routes for this Session": the sole source of truth for the allowlist is list_subagent_models. Call list_subagent_models({}) to list authorized providers and routes (and call list_subagent_models({ provider }) when you need model details under that provider); trust its output directly without cross-checking local config files or workspace code (the runtime output is already filtered to this session's allowlist). Before every dispatch through an explicit-route tool (subagent), write route: <provider>/<model> (+ reasoning_effort when applicable) and pass split provider and model (model without the <provider>/ prefix). Never pass provider/model to subagent_fork.
72
+ - [State: Unlisted] Output says "No allowlist is in force" (or says neither—treat as unconfirmed and never report a route as authorized): omitted provider/model follows default inheritance; never claim per-task routing is in force here.
73
+ - [State: Unmounted] list_subagent_models is absent and subagent exposes no route fields: subagents inherit your route; omit the route: line.
74
+ - subagent_fork shares the parent route and KV cache (still works when list_subagent_models is absent: try subagent_fork once and read the denial if rejected). Keep model selection consistent across same-kind tasks in a batch. Never pass provider/model to it.
75
+
76
+ ## R3 · Subagent Autonomy & R4 · Subagent Role
77
+ A subagent plans, executes, and gathers verification evidence within Boundary using DSH's default subagent role; do not edit its files. Model selection belongs solely to the Dispatch Agent.
78
+
79
+ ## R5 · Dispatch Discipline
80
+ Every task brief covers six elements: Goal / Boundary / Constraints / Limits (see below) / Acceptance Criteria / Required Evidence to Report.
81
+ - [Compact Delta Brief] use a Compact Delta Brief by default: Goal, file/line Source Pointers (no long code paraphrase), Module-Interface Boundary, Constraints, Acceptance Criteria, and Required Evidence. Standing limits/report schema need not repeat unless overridden.
82
+ - [Limits] Each override states **what it bounds, in what unit, the cap, and whether it accumulates**. Use explicit caps ("at most 3 runs", "edits at most 5 files"), never ranges ("2–5 files"); silence is read as a limit of zero, and a quota that resets per cycle is lost, not banked. Do not ask the child to restate your rules back as a correctness check. Dispatch independent tasks concurrently through code_run Promise.all once decisions are settled.
83
+
84
+ ## R6 · Lead Acceptance
85
+ One acceptance layer owned by Lead: subagents supply implementation/evidence; Lead reads the final diff, checks every criterion, and runs risk-relevant verification without re-running an already-passed equivalent check when no code/config changed. The completion notification is a post-hoc signal: a child stopped, not that the work passed.
86
+ - Re-dispatch budget per brief: 1 first attempt + at most 2 re-dispatches = at most 3 runs total. Count runs, not failures; the number belongs in the task list item for that brief (R7). Only after the third run ends without acceptance, transition to R8 Fallback.
87
+ - [Non-Penalized hand_back] Clean status: hand_back with a valid hand_back_reason and no out-of-boundary mutation does not increment a failure count or trigger R8 by itself (each run still counts toward the 3-run cap). Re-scope or answer via send_message({ agent }) on the existing child to preserve its warm prefix cache.
88
+ - [Noticed but not handled] Every defect found in review: the defect goes back out on a re-dispatch with evidence or goes to the user via R-W (or fix and re-verify on Lead-Core/Hybrid core). Writing it into the delivery summary and shipping anyway is not an available outcome.
89
+ - [UI Visual Evidence Gate] Regression-risk visual layout/styling changes require Before and After captures (same scenario, viewport, theme); with no reliable Before, an After plus a note suffices.
90
+
91
+ ## R-W · Turn Boundary (Waiting / Goals / Questions)
92
+ - [Waiting] End your turn and let the subagent completion notification wake you (Treat it as "there is now something to review", never as "this passed"). Never run sleep, polling loops, watch, or placeholder long commands to wait; only call job_output({ wait: true }) when genuinely blocked on an immediate collection. State who was dispatched, what you are waiting for, and what you will do next before ending the turn.
93
+ - [Silent child] A dispatched subagent can end its turn without a report, or sit inactive after a failed run; a Lead that only waits waits forever. On every wake (user message, another child's completion, a progress event) reconcile expectation against list_agents: a child listed inactive with no report, or past the duration its brief implied, gets ONE send_message asking for a one-line status or a hand_back. Where the host mounts wait_agent, one bounded call (timeout_ms <= 600000) is the sanctioned heartbeat in place of any sleep. Two reconciliations with no answer means the child is gone: finish the task yourself under R8 and say so in the delivery summary.
94
+ - [Goals] Do not proactively create goals: never call create_goal or /goal unless the user asks; track tasks in todo_write.
95
+ - [Questions] Whenever a decision is missing, hand the question out with ONE code_run program containing exactly one tools.ask_user_question(...) sub-call. The same rule covers every decision stop outside the interview. Only two exceptions: plan-mode approval still goes through tools.exit_plan_mode inside code_run, and a finished task asks nothing.
96
+
97
+ ## R7 · Documentation
98
+ For L1/L2 (skip for L0), maintain the task list (in todo_write, not create_goal; see R-W), decision log, and interview conclusions; each delegated task item carries its own run count.
99
+ - [Before every turn] Prioritize items that will escalate, expire, or time out before items that are merely large; do not list per-turn item ages in user replies.
100
+ - [Clause Deletion Test] In the final delivery summary, omit any clause whose deletion would not obscure the outcome, risk, or required action.
101
+
102
+ ## R8 · Fallback
103
+ Fallback is a task-scoped, non-session-wide exception and covers only the single task that triggered it. Outside planned direct execution (L0/L1, Lead-Core, Hybrid core), execute yourself only when: subagent tools are unmounted (R2 [State: Unmounted]—An unmounted tool is the only routing condition that permits fallback); a task is non-delegable; or the same task brief has still not passed review after its third run under R6. On active child limit, wait and re-dispatch; on subagent model selection, use an authorized route. When the next task begins, always return to R0 to triage anew.
104
+
105
+ ## R9 · Plan Pipeline (Converged Interview -> Plan Mode -> Plan -> Approval)
106
+ - Trigger: only for L2-Governed once R-G has converged. Call tools.enter_plan_mode inside ONE code_run immediately once that holds, as the sole top-level action of that step. Read-only exploration and the decision-complete plan belong to the next step (do not end the turn on entry), and ONE code_run containing only tools.exit_plan_mode must be the sole and final top-level tool call of the turn that submits the plan.
107
+ - Rejection & Abandon: on "Keep planning", revise and resubmit via tools.exit_plan_mode; call tools.leave_plan_mode only when the user explicitly says no plan is wanted. When enter_plan_mode is absent, the degraded path is ONE code_run program containing exactly one tools.ask_user_question(...) sub-call asking the user to enter /plan.
108
+ - Subagent: never call plan-mode tools (rejected with DELEGATED_CALLER on supported hosts); carry any open decision or Plan Mode request back to the dispatcher via status: hand_back.
109
+
110
+ ## Anti-Patterns
111
+ - Opening Plan Mode for L0/L1/L2-Clear or before R-G convergence; using leave_plan_mode to bypass exit_plan_mode approval; or using teammate vocabulary / the team task board to replace R1–R6/R-W.
112
+ - Omitting provider/model under [State: Listed]; hunting local config/source files to verify allowed subagent models; or claiming a route is authorized under [State: Unlisted].
113
+ - Writing range limits ("2–5 files") instead of caps; asking a subagent to restate rules; running sleep/polling loops to wait; proactively calling create_goal; or ending with prose instead of ask_user_question when blocked on a decision.
114
+ - Editing an active child's Boundary; shipping a review defect by merely noting it in the summary; carrying a one-off R8 fallback into subsequent tasks; or using a fixable tool rejection as a fallback excuse.
115
+ - Asking the user about settled repo/external standards (existing-standard); penalizing a clean status: hand_back as a failed run; cold-spawning instead of send_message; or accepting regression-risk UI changes without Before & After (or After-only note).
116
+
117
+ - id: agent-instructions
118
+ name: '@deepseek-ai/dsh-agent-instructions'
119
+ config:
120
+ maxBytes: 65536
121
+
122
+ # ── shell ───────────────────────────────────────────────────────────────────
123
+
124
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
125
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
126
+ # the criterion for host-plane ownership — injection resolves before any session
127
+ # exists, so there is no agent to key by. Behind a preset realm those variables
128
+ # never reached the model's shell at all. Both shell tools consume the host
129
+ # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
130
+ # host-plane too.
131
+ - id: tool-bash
132
+ name: '@deepseek-ai/dsh-tool-bash'
133
+ disabled: !!js process.platform === 'win32'
134
+
135
+ - id: tool-pwsh
136
+ name: '@deepseek-ai/dsh-tool-pwsh'
137
+ disabled: !!js process.platform !== 'win32'
138
+
139
+ # ── filesystem ──────────────────────────────────────────────────────────────
140
+
141
+ # Both register into the host `tools` registry and provide nothing, so
142
+ # they need no realm. The `fs` service and its policy stay in the host.
143
+ - id: tool-fs
144
+ name: '@deepseek-ai/dsh-tool-fs'
145
+
146
+ - id: tool-fs-search
147
+ name: '@deepseek-ai/dsh-tool-fs-search'
148
+ config:
149
+ sampleOverCapGlobResults: false
150
+
151
+ # ── background jobs ────────────────────────────────────────────────────────
152
+
153
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
154
+ # its producers sit outside any realm this file could put it in — `tool-bash`
155
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
156
+ # to every sibling row, so `run_in_background` would answer "background jobs
157
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
158
+ # owning agent anyway, so one host instance serves every session. What a preset
159
+ # chooses is whether its agent can collect and stop background work at all.
160
+ - id: tool-jobs
161
+ name: '@deepseek-ai/dsh-tool-jobs'
162
+
163
+ # ── skills ──────────────────────────────────────────────────────────────────
164
+
165
+ # The skill REGISTRY lives in the host composition and is layered per scope:
166
+ # these rows register into THIS preset's layer of it, so they need no realm.
167
+ # `skill-filesystem` contributes local-root discovery for agents on this preset, and
168
+ # `tool-skill` gives them the catalog and loader; the merged catalog also
169
+ # carries whatever the deployment registered globally (repository plugins).
170
+ - id: skill-filesystem
171
+ name: '@deepseek-ai/dsh-skill-filesystem'
172
+
173
+ - id: tool-skill
174
+ name: '@deepseek-ai/dsh-tool-skill'
175
+
176
+ # ── goals ───────────────────────────────────────────────────────────────────
177
+
178
+ # The goal service and session driver stay on the host plane, where the Gateway
179
+ # can resolve them. The human command and model-facing tool register into this
180
+ # preset's scoped layers.
181
+ - id: command-goal
182
+ name: '@deepseek-ai/dsh-command-goal'
183
+
184
+ - id: tool-goal
185
+ name: '@deepseek-ai/dsh-tool-goal'
186
+
187
+ # ── plan mode ───────────────────────────────────────────────────────────────
188
+
189
+ # Plan state is per-agent by nature, so an entry-local realm is not a
190
+ # workaround here — it is the correct lifetime.
191
+ - id: planning
192
+ name: cordis:group
193
+ group: true
194
+ isolate:
195
+ planMode: true
196
+ config:
197
+ # This plugin's own fork of the plan-mode service, not the harness
198
+ # package: it keeps the official behaviour but never rebuilds the
199
+ # provider's content-prefix cache on entering or leaving Plan Mode.
200
+ # See src/entry-plan-mode.ts for the three differences.
201
+ - id: plan-mode
202
+ name: '@eddyskywalker/dsh-chatgpt-subscription/plan-mode'
203
+ config:
204
+ # The full four-paragraph guidance is kept intact on purpose: this fork
205
+ # delivers the section ONCE, as a trailing notice message appended at
206
+ # agent/pre-step (src/entry-plan-mode.ts), instead of re-rendering it
207
+ # into `systemPrompt` on EVERY step of Plan Mode. Its length is
208
+ # therefore no longer a per-step resident cost — the bytes are paid
209
+ # once on entry and then live in the conversation history, where a
210
+ # trailing append does not invalidate the cached prefix.
211
+ #
212
+ # It is still the ONLY guardrail on the manual /plan path — the degraded
213
+ # entry R9 keeps for an older harness or a switched-off plugin row —
214
+ # where no enter_plan_mode tool result ever arrives. So all four rules
215
+ # stay here in full: stay in Plan Mode until exit_plan_mode submits,
216
+ # explore read-only and settle requirements per R0/R-G, make the plan
217
+ # decision-complete, and make one code_run containing only tools.exit_plan_mode the sole and final top-level call.
218
+ section: |
219
+ [Plan Mode] Plan Mode is active. Remain in Plan Mode until a plan is approved via exit_plan_mode or the user manually changes the mode: treat "implement"/"modify" requests as requests to plan. Chat answers confirm design decisions rather than approving the plan; fold them into the plan and submit via tools.exit_plan_mode inside code_run.
220
+
221
+ [Read-Only Exploration & Clarification Interview] Inspect the repository using non-mutating reads, searches, and static checks; never edit files, mutate config, or enact the plan. To verify repository facts or external prior art (GitHub docs/repos, official docs, research papers, specs), explore read-only or search the web yourself—or dispatch read-only subagents per R2 (using the routes returned directly by list_subagent_models)—without blocking unrelated frontier questions, so you reuse proven patterns and never reinvent the wheel. Settle requirements per R0/R-G before drafting: for L2-Governed, ask the current frontier in ONE code_run containing one tools.ask_user_question(...) call until the frontier is empty, then draft the plan without an extra confirmation round; for L0/L1, keep the interview to at most 2 questions. Follow any established local or external standard (target_basis: existing-standard) without asking the user; reserve ask_user_question for unsettled product/design decisions.
222
+
223
+ [Plan Completeness] Make the plan decision-complete: state goal, success criteria, R1 execution topology (Lead-Core, Hybrid, or Fan-out with boundaries), subsystem changes, API/schema/data-flow changes, edge cases, test strategy, acceptance criteria, and assumptions. For regression-risk visual changes, require Before and After visual evidence (with no reliable Before, an After plus a note suffices).
224
+
225
+ [Plan Approval] Submit via ONE code_run whose only sub-call is tools.exit_plan_mode (plan Markdown starting with # Title) as the sole and final top-level call of that turn; execute or dispatch only after approval. Never paste the plan into chat or ask "Should I proceed?" in prose. On rejection, revise and resubmit via tools.exit_plan_mode; if approval is unavailable, stay in Plan Mode and ask the user to switch modes manually.
226
+
227
+ # Enters Plan Mode as soon as the R-G interview converges (R9). The row is
228
+ # this plugin's own subpath export, so it needs no harness package on any
229
+ # generation the plugin supports; the row's planModePipeline switch
230
+ # defaults to true, which is why no config block appears here.
231
+ - id: plan-mode-pipeline
232
+ name: '@eddyskywalker/dsh-chatgpt-subscription/plan-mode-pipeline'
233
+
234
+ # ── compaction ──────────────────────────────────────────────────────────────
235
+
236
+ # `compaction-basic` reads `toolResultPruner` through `ctx.get`, so the pruner must
237
+ # share this realm rather than sit outside it.
238
+ #
239
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
240
+ # plane, and the rows here resolve that one instance. It takes no configuration,
241
+ # keys every fold by Session, and owns the context-meter projection units the
242
+ # browser reads for every session — behind a realm those units would come and go
243
+ # with whichever presets happen to be mounted. What a preset chooses is whether
244
+ # its agent compacts at all, which is `compaction-basic` below.
245
+ - id: compaction
246
+ name: cordis:group
247
+ group: true
248
+ isolate:
249
+ compaction: true
250
+ toolResultPruner: true
251
+ config:
252
+ - id: compaction-basic
253
+ name: '@deepseek-ai/dsh-compaction-basic'
254
+
255
+ - id: command-compact
256
+ name: '@deepseek-ai/dsh-command-compact'
257
+
258
+ # The pruner is this plugin's own fork (src/entry-tool-result-pruner.ts),
259
+ # not the harness package: it is byte-compatible with the official
260
+ # `@deepseek-ai/dsh-compaction-tool-result-pruner` except that it skips
261
+ # cache-prefix providers instead of rewriting their history.
262
+ #
263
+ # The reason the official pruner used to be left out is the reason the fork
264
+ # exists: pruning rewrites a historical tool result, which invalidates the
265
+ # provider's content-prefix cache from that point to the end of the
266
+ # conversation — measured on a real 838k-token session, one pass removed
267
+ # ~418k tokens of context but charged ~414k full-price input tokens to
268
+ # rebuild the prefix. The fork therefore skips `kimi-code` whole-session
269
+ # (the host-level guard enforces that across presets too), so a
270
+ # cache-prefix provider never pays the rebuild.
271
+ #
272
+ # `toolResultPruner` is isolated with the group because `compaction-basic`
273
+ # reads the pruner through `ctx.get`: the instance must be reachable from
274
+ # the realm that owns the compaction service. `compaction-basic` treats a
275
+ # missing pruner as "skip the model-free pass" at both of its call sites, so
276
+ # an installation where this fork's export is absent keeps working — the
277
+ # sync disables that row instead of marking the preset unresolvable.
278
+ - id: tool-result-pruner
279
+ name: '@eddyskywalker/dsh-chatgpt-subscription/tool-result-pruner'
280
+ config:
281
+ thresholdChars: 8192
282
+ headChars: 4096
283
+ tailChars: 1024
284
+
285
+ # ── delegation and workflows ────────────────────────────────────────────────
286
+
287
+ # The `subagents` registry and its spawn/fork backends live in the HOST
288
+ # composition: the registry is a process singleton whose cross-session queries
289
+ # the api-proxy serves to the browser, and a provider name may only be
290
+ # registered once. This preset contributes the delegation TOOLS, which resolve
291
+ # that host registry.
292
+ #
293
+ # `workflows` is different — nothing outside an agent reads it — so every row
294
+ # that reaches it shares one entry-local realm here, and a consumer left
295
+ # outside would resolve a host registry this preset does not populate.
296
+ - id: delegation
297
+ name: cordis:group
298
+ group: true
299
+ isolate:
300
+ workflowEngine: true
301
+ config:
302
+ - id: tool-subagent-control
303
+ name: '@deepseek-ai/dsh-tool-subagent-control'
304
+
305
+ - id: tool-subagent-list-agents
306
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
307
+
308
+ - id: tool-subagent
309
+ name: '@deepseek-ai/dsh-tool-subagent'
310
+ config:
311
+ provider: spawn
312
+ toolName: subagent
313
+ modelSelectionSettings: true
314
+ modelSelection: true
315
+ modelDiscovery: true
316
+ backgroundMode: continuable
317
+
318
+ # Fork omits model selection so provider/model stay equal to the parent and
319
+ # the inherited history remains eligible for KV Cache reuse. This preset
320
+ # keeps fork continuable; parent and child inherit the same messaging tool,
321
+ # while the parent id and return guidance follow the inherited history.
322
+ - id: tool-subagent-fork
323
+ name: '@deepseek-ai/dsh-tool-subagent'
324
+ config:
325
+ provider: fork
326
+ toolName: subagent_fork
327
+ backgroundMode: continuable
328
+
329
+ # Production dsh does not install these optional providers. Install the
330
+ # matching Bundle in this Profile and restart the Host, then copy this
331
+ # preset and remove `disabled` from the matching tool row. Host availability
332
+ # alone grants no tool.
333
+ - id: tool-subagent-codex
334
+ name: '@deepseek-ai/dsh-tool-subagent'
335
+ disabled: true
336
+ config:
337
+ provider: codex
338
+ toolName: subagent_codex
339
+ backgroundMode: one-shot
340
+ maxDepth: provider-managed
341
+
342
+ - id: tool-subagent-claude-code
343
+ name: '@deepseek-ai/dsh-tool-subagent'
344
+ disabled: true
345
+ config:
346
+ provider: claude-code
347
+ toolName: subagent_claude_code
348
+ backgroundMode: one-shot
349
+ maxDepth: provider-managed
350
+
351
+ # `workflow-worker-thread` is this row's name up to harness 0.1.5; 0.1.6
352
+ # renamed the package to `workflow-ptc`. The plugin rewrites this line to
353
+ # whichever spelling the running installation ships (src/host/preset-sync.ts).
354
+ - id: workflow-worker-thread
355
+ name: '@deepseek-ai/dsh-workflow-worker-thread'
356
+ config:
357
+ provider: spawn
358
+
359
+ - id: tool-workflow
360
+ name: '@deepseek-ai/dsh-tool-workflow'
361
+ # Keep the engine above for `ralph`, but do not publish a second
362
+ # model-authored orchestration surface beside `run_code` in PTC mode.
363
+ disabled: true
364
+
365
+ - id: tool-ralph
366
+ name: '@deepseek-ai/dsh-tool-ralph'
367
+ config:
368
+ subagentProvider: spawn
369
+ maxRounds: 64
370
+
371
+ # ── remaining model-facing rows ─────────────────────────────────────────────
372
+
373
+ - id: agent-team
374
+ name: '@deepseek-ai/dsh-agent-team'
375
+ config:
376
+ maxTasks: 256
377
+ defaultEnabled: true
378
+
379
+ - id: tool-agent-team
380
+ name: '@deepseek-ai/dsh-tool-agent-team'
381
+ - id: tool-ask-user
382
+ name: '@deepseek-ai/dsh-tool-ask-user'
383
+
384
+ - id: tool-todo
385
+ name: '@deepseek-ai/dsh-tool-todo'
386
+ config:
387
+ allowParallelInProgress: true
388
+
389
+ # The `web` service and its search provider stay in the host composition; only
390
+ # the model-facing tool is per-session.
391
+ - id: tool-web
392
+ name: '@deepseek-ai/dsh-tool-web'
393
+ config:
394
+ fetch: true
395
+ searchTimeoutMs: 60000
396
+
397
+ # ── presentation ────────────────────────────────────────────────────────────
398
+
399
+ # Code Mode for this agent alone: only its explicit native whitelist and
400
+ # `code_run` stay natively callable. Every other registered tool — including
401
+ # ask_user_question and the rows above — remains available from inside
402
+ # `code_run`. The row brings its own root registry/executor, so no
403
+ # `tool-registry-ptc` / `tool-executor-ptc` row is mounted beside it — one root
404
+ # per scope. resolveDispatchPreset swaps this row back to the PTC registry/executor
405
+ # (or the deprecated presentation row) on generations without
406
+ # @deepseek-ai/dsh-tool-registry-native or @deepseek-ai/dsh-tool-executor-native.
407
+ - id: code-mode
408
+ name: '@eddyskywalker/dsh-chatgpt-subscription/codemode'
409
+ config:
410
+ nativeToolsOnly: true
411
+ nativeTools:
412
+ - cache_warmup_result
413
+ - dispatch_ledger
414
+ - progress_update
415
+ - structured_output
416
+ - consult_advisor
417
+
418
+ # `present` ships from harness 0.1.5-alpha.2. On an earlier installation the
419
+ # sync disables this row rather than leave the whole preset unresolvable, and
420
+ # re-enables it once the harness ships the package (src/host/preset-sync.ts).
421
+ - id: present
422
+ name: '@deepseek-ai/dsh-tool-present'
@@ -0,0 +1,3 @@
1
+ name: 班组模式
2
+ description: 调度模式之上加 Team 拓扑:常驻工人共享一块 append-only 公告板,按名字点名唤醒、有界挂起,验证者只报不修;分诊、任务书与 Lead 验收与调度模式一致。
3
+ order: 6