@linxin666/dsh-liangshen 0.4.15 → 0.4.17
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.i18n.yaml +2 -2
- package/README.md +19 -18
- package/README.zh.md +19 -18
- package/lib/client.js +286 -2
- package/lib/client.js.map +1 -1
- package/lib/index.js +31 -6
- package/lib/types/client/LiangShenSettingsCard.d.ts +10 -1
- package/lib/types/client/locales.d.ts +3 -0
- package/lib/types/composition.d.ts +13 -0
- package/lib/types/index.d.ts +14 -2
- package/package.json +16 -16
- package/presets/liangshen/agent.cordis.yml +60 -28
- package/presets/liangshen/dispatch-guard.mjs +24 -8
- package/presets/liangshen/fact-ledger.mjs +47 -11
- package/presets/liangshen/paging.mjs +44 -18
- package/presets/liangshen/tool-activate.mjs +10 -7
- package/presets/liangshen/tool-catalog.mjs +163 -335
- package/src/client/LiangShenSettingsCard.tsx +38 -2
- package/src/client/locales.ts +6 -0
- package/src/composition.test.ts +52 -1
- package/src/composition.ts +33 -1
- package/src/index.test.ts +1 -0
- package/src/index.ts +15 -2
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: debd18453ed073d0c0bc0368f6dde92ec60c0393
|
|
6
|
+
README.zh.md: 7036c7bf31c4384683c56a553d3ea0196b6b592d
|
package/README.md
CHANGED
|
@@ -5,35 +5,35 @@ English | [中文](README.zh.md)
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="https://img.shields.io/npm/v/@linxin666/dsh-liangshen?style=flat-square" alt="Version">
|
|
7
7
|
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.2-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
9
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<strong>Minimal LiangShen Persona & Programmatic Tool Transport for DeepSeek Harness (DSH)</strong><br>
|
|
15
|
-
<em>Minimal Persona · run_code Program Transport ·
|
|
15
|
+
<em>Minimal Persona · run_code Program Transport · On-Demand Tool-Family Paging · Fact Register</em>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
|
-
An all-in-one plugin for DeepSeek Harness (DSH) Web GUI and desktop client: declares the built-in "LiangShen Mode" preset to the official agent-preset registry upon activation and offers a slot-machine lever toggle alongside the model selector in the blank conversation page. Keeps system prompts concise to a minimal persona with strict operational disciplines while workspace instructions arrive via user turns. Tools operate under a unified presentation contract (defaulting to `ptc`: the wire collapses to the official `run_code` transport and every other tool is reached through the generated SDK; `native` keeps the assembled roster alone).
|
|
18
|
+
An all-in-one plugin for DeepSeek Harness (DSH) Web GUI and desktop client: declares the built-in "LiangShen Mode" preset to the official agent-preset registry upon activation and offers a slot-machine lever toggle alongside the model selector in the blank conversation page. Keeps system prompts concise to a minimal persona with strict operational disciplines while workspace instructions arrive via user turns, and injects the request's live tool catalog from the first user message on. Tools operate under a unified presentation contract (defaulting to `ptc`: the wire collapses to the official `run_code` transport and every other tool is reached through the generated SDK; `native` keeps the assembled roster alone, and deployments without a code runtime fall back to the native surface with a one-time warning). On-demand tool-family paging holds matched families (by default `['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`, leaving all host builtins resident) out of both the wire and the generated SDK via registry-level restriction — announcing them as namespace summaries in the catalog — until `tool_activate` loads a namespace back, paired with a key fact register for long-horizon context retention.
|
|
19
19
|
|
|
20
20
|
## Why
|
|
21
21
|
|
|
22
22
|
DeepSeek V4.1 Flash is post-trained against its native DSML tool-call surface, and the official scaffold comparison for code-agent benchmarks places a native minimal surface ahead of a programmatic (PTC) one (DeepSWE v1.1: 72.6% native minimal vs 67.6% PTC; Terminal-Bench 2.1: 90.6% vs 85.8%). Real engineering sessions, meanwhile, depend on MCP servers and plugins that a closed four-tool surface cannot reach, while a flat roster carrying every external schema buries the conversation under tool definitions.
|
|
23
23
|
|
|
24
|
-
LiangShen mode therefore keeps the whole session on one presentation, chosen by the `presentation` key. The shipped default is `ptc`: the wire collapses to the single `run_code` transport and every other tool is reached from inside the program through the generated SDK — the cheapest static context, though the official scaffold comparison ranks that surface below the native one (the native surface leads PTC on DeepSWE v1.1 and Terminal-Bench 2.1: 72.6 against 67.6 and 90.6 against 85.8) — while `native` (the assembled roster alone, no program transport) remains the one-line opt-in. An older profile that still names the removed `both` presentation is refused outright: the SDK dropped the mode, this preset ships no compatibility mapping, and the migration path is to pick `ptc` or `native`. The anchoring part (the system prompt) stays a compact persona with an action-triggered working discipline; the capability part is announced from the first user message on as a durable skill-catalog-style injection that names exactly the tools the request opens.
|
|
24
|
+
LiangShen mode therefore keeps the whole session on one presentation, chosen by the `presentation` key. The shipped default is `ptc`: the wire collapses to the single `run_code` transport and every other tool is reached from inside the program through the generated SDK — the cheapest static context, though the official scaffold comparison ranks that surface below the native one (the native surface leads PTC on DeepSWE v1.1 and Terminal-Bench 2.1: 72.6 against 67.6 and 90.6 against 85.8) — while `native` (the assembled roster alone, no program transport) remains the one-line opt-in. An older profile that still names the removed `both` presentation is refused outright: the SDK dropped the mode, this preset ships no compatibility mapping, and the migration path is to pick `ptc` or `native`. The anchoring part (the system prompt) stays a compact persona with an action-triggered working discipline; the capability part is announced from the first user message on as a durable skill-catalog-style injection that names exactly the tools the request opens. Without paging, a LiangShen session's system prompt reaches 104,945 characters, with PTC's `interface ToolArgsMap` block taking 73,675 characters (about 70% — led by `task_board_*` at ~5.6k tokens, `browser_*` at ~3k, and `squads_*` plus `squad_*` at ~2.2k). High-fan-out tool families matched by the paging patterns (default `['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`, while every host builtin stays resident) are therefore announced as namespace summaries and stay off the wire — and, under `ptc`, out of the generated SDK, because the page is applied to the registry a program dispatches against — until `tool_activate`, keeping the static schema surface small. The mode makes no overcommitment of benchmark superiority; it guarantees that the declared surface and the request's own wire never disagree.
|
|
25
25
|
|
|
26
26
|
## How it works
|
|
27
27
|
|
|
28
28
|
1. `minimal-prompt` narrows every assembled prompt to the persona section — the one-line persona, the mode's standing working discipline (close a repeated hypothesis after two reasoning passes and call an inspection tool instead of speculating; think only about the next concrete operation rather than pre-rehearsing code; emit multiple tool calls concurrently in a single turn for independent inspections; treat shell processes as ephemeral with no directory persistence across calls and use compound commands or explicit workdir for subdirectories; verify against actual tool output during execution; YAGNI and PDCA; no redundant comments), and one appended orientation line, `Your working directory is <cwd>.` read from the session header — so the harness identity, web-surface, tool-guidance, file-reference, and structured-output sections do not reach the model by default; plan mode's `plan:policy` is kept, because that section is the only thing that enforces plan mode (its exit tool stays registered in every mode);
|
|
29
29
|
2. AGENTS.md-style workspace instructions reach the model through `instructionSource`: by default (`host`) the preset appends no section of its own and leaves the harness's own delivery of those instructions untouched, so they arrive as its user-role messages — one persistent baseline plus incremental additions, replacements, and removals as directories are touched; under `system-prompt` they join the system prompt itself: at assembly time `minimal-prompt` reads the harness's baseline chain (`$DSH_HOME/AGENTS.md`, then `AGENTS.md` / `CLAUDE.md` and their `.local` overlays from the project root down to the session cwd) and appends the content as one `workspace-instructions` section after the stable prefix, under a byte budget that omits broadest files first and truncates the most specific last; the read happens on every assembly, so file edits propagate without durable messages, and the harness's own agent-instructions injections are dropped instead of duplicating the prompt. Subdirectory dynamic rules will subsequently support registered file tools (including `str_replace_editor`) and `run_code` sub-calls reaching target directories; arbitrary bash or program code is not parsed, and automatic discovery of file accesses performed directly within shell commands is not guaranteed;
|
|
30
|
-
3. the wire keeps one presentation for the entire session, selected by `presentation`: `ptc` (the default) collapses the wire to `run_code` with every other tool reached through the generated SDK, and `native` carries the assembled native roster; `ptc` needs a mounted code runtime — without one
|
|
30
|
+
3. the wire keeps one presentation for the entire session, selected by `presentation`: `ptc` (the default) collapses the wire to `run_code` with every other tool reached through the generated SDK, and `native` carries the assembled native roster; `ptc` needs a mounted code runtime — without one no PTC executor can be mounted, so the session simply runs the native surface. The legacy `ptcPresentation` key maps onto `ptc`/`native` with a deprecation warning, and the retired `anchorTools` first-turn narrowing no longer engages — setting it warns;
|
|
31
31
|
4. `tool-catalog` appends the tool list as a durable user message after the user's message, preserving complete input and output key parameter semantics (`descriptionMaxLength: 200` caps only the one-line summaries). The plugin carries a hand-written one-line summary for each host builtin this preset mounts: a curated tool renders that line whole, so a length cut never slices off the sentence that says what the tool is for, and `descriptionMaxLength` remains the fallback for every tool the table does not name. It names exactly the tools the current request opens — the native roster, or the SDK-reachable projection under `ptc` — and, under tool paging, adds one-line summaries for the namespaces whose tools are held back. Under `ptc` the summaries name namespaces that are genuinely unreachable — neither listed in the request's `tools:sdk` section nor callable from inside a `run_code` program — until `tool_activate`; It republishes only when that surface changes or the published copy left the visible surface (a compaction, a resume);
|
|
32
|
-
5.
|
|
33
|
-
6. a minimal working-context line — plan-mode state, active paged namespaces,
|
|
34
|
-
7. the catalog groups the tools of an activated paged family under a `namespace `<name>` (activated):` heading instead of scattering one
|
|
32
|
+
5. on-demand tool-family paging ships on (`pagedToolPatterns: ['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`): the MCP bridge and the six mounted plugin tool families stay off the wire, out of the generated SDK, and unreachable to `run_code` dispatches — announced as one-line namespace summaries in the catalog — while every host builtin (shell, filesystem/read/write/edit/`str_replace_editor`, `glob`/`grep`, background jobs, `skill`, `ask_user_question`, `todo_write`, `web_search`, subagent delegation, plan, goal, `fact_register`, `tool_activate`, and MCP resource readers) stays resident. Each pattern's literal head determines how `patternNamespace` derives the namespace: a head ending in `__` is an MCP bridge and takes the first `__`-delimited segment of the remaining tool name (`mcp__codegraph__codegraph_explore` -> `codegraph`); any other head names a plugin family literally with at most one trailing `_` dropped (`task_board_*` -> `task_board`, `squad*` -> `squad`, grouping `squads_*` and `squad_member_*` under one namespace). Calling `tool_activate({ namespace })` brings that namespace back from the next request on; at most three paged namespaces stay active simultaneously (`maxActiveNamespaces`, default `3`), refreshing recency on activation or on any non-errored call into an active namespace and evicting the least recently used back to summary when a fourth is activated, with activation state replayed from the durable session event stream across compactions and resumes;
|
|
33
|
+
6. a minimal working-context line — plan-mode state, active paged namespaces, in-progress todos, and the key-fact register — is injected at the tail of the latest message only when its sources are readable, keeping current state inside the model's local attention window; runtime contexts (the sandbox and approval snapshots) and the skill catalog flow as in Standard mode;
|
|
34
|
+
7. the catalog groups the tools of an activated paged family under a `namespace `<name>` (activated):` heading instead of scattering one family's tools through the alphabetical list, while every non-paged tool keeps its flat entry;
|
|
35
35
|
8. `maxResidentTokens` (default 8000) estimates the always-on-wire surface and warns once when it is crossed, naming the heaviest tools and `pagedToolPatterns` as the remedy. The threshold was re-estimated for V4.1 (its KV cache is a quarter of V4-Flash's, so the same schema load occupies a quarter of the sparse-index slots and the budget moved from 6000 to 8000), still calibrated above the shipped roster so only real growth trips it. The guard never truncates: silently dropping a tool the session needs would trade a measurable context cost for an unmeasurable capability loss.
|
|
36
|
-
9. a key-fact register (`fact_register`) lets the model pin a hard user constraint, a confirmed decision, or a failed path as one short line; the register is folded from the durable event stream and rides the `[Working Context: ...]` line — the surface that lands inside the guaranteed local attention window every step — as the counter to V4.1's long-session forgetting.
|
|
36
|
+
9. a key-fact register (`fact_register`) lets the model pin a hard user constraint, a confirmed decision, or a failed path as one short line; the register is folded from the durable event stream and rides the `[Working Context: ...]` line — the surface that lands inside the guaranteed local attention window every step — as the counter to V4.1's long-session forgetting. Both wire shapes feed that one fold: `ptc` records the call as a `tool/ptc-dispatch` (object arguments, own `isError`), `native` as a `tool/call` (JSON-string arguments), and a dispatch that reported an error is never applied.
|
|
37
37
|
|
|
38
38
|
## Security model
|
|
39
39
|
|
|
@@ -66,8 +66,8 @@ The preset-local plugins are configured in `agent.cordis.yml`:
|
|
|
66
66
|
| `instructionSource` | `host` | Where workspace instructions reach the model. `host` (the default) appends no section of its own and leaves the harness's agent-instructions injection untouched, so the instructions arrive as the harness's own user-role messages: one persistent baseline plus incremental additions, replacements, and removals as directories are touched; `system-prompt` reads the AGENTS.md-style chain at assembly time and appends it to the system prompt (the harness's own injections are dropped); `hint` replaces the first injection with a one-time non-imperative reference-file hint and drops later ones. |
|
|
67
67
|
| `instructionMaxBytes` | `65536` | Byte budget for the rendered workspace-instructions section, used only in `system-prompt` mode: broadest files are omitted first, the most specific file is truncated last. |
|
|
68
68
|
| `descriptionMaxLength` | `200` | Cap for one tool's one-line summary in the injected catalog, applied to every tool the curated table does not name. A curated host builtin renders its hand-written line whole. Complete key parameter semantics remain fully preserved. |
|
|
69
|
-
| `presentation` | `ptc` | Wire presentation for the whole session. `ptc` (the shipped default) collapses the wire to `run_code` with every other tool reached through the generated SDK; `native` keeps the assembled native roster. The
|
|
70
|
-
| `pagedToolPatterns` | `['mcp__*']` |
|
|
69
|
+
| `presentation` | `ptc` | Wire presentation for the whole session. `ptc` (the shipped default) collapses the wire to `run_code` with every other tool reached through the generated SDK; `native` keeps the assembled native roster. The settings overlay writes the value into the composition: the official `@deepseek-ai/dsh-tool-executor-ptc` row stays mounted for `ptc` and is disabled for `native`, so that row IS the wire (0.2.2 retired the per-scope `agent.ctx.tools.presentAs` declaration). A deployment with no PTC runtime keeps the native surface. The removed `both` mode is not accepted: an old profile naming it fails registration, so migrate the key to `ptc` or `native`. |
|
|
70
|
+
| `pagedToolPatterns` | `['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']` | On-demand gentle paging ships on: each entry is a non-empty literal head without `*` ending in one trailing `*` (a bare `*` is rejected). Matching MCP and plugin tools stay off the wire and out of the generated SDK until activated via `tool_activate({ namespace })`, appearing in the catalog as one-line namespace summaries while all host builtins stay resident. A head ending in `__` derives the namespace from the first `__` segment of the remainder (MCP server); any other head drops at most one trailing `_` (`task_board_*` -> `task_board`, `squad*` -> `squad`). At most three paged namespaces stay active at once (`maxActiveNamespaces`, default `3`, integer `>= 1`), with LRU recency and active state replayed from the durable event stream. |
|
|
71
71
|
| `maxResidentTokens` | `8000` | Estimated-token ceiling for the always-on-wire surface (the serialized schemas at roughly four characters per token), re-estimated for V4.1's compressed KV cache and still calibrated above the shipped roster so it flags real growth rather than the factory configuration. Crossing it warns once, names the heaviest tools, and points at `pagedToolPatterns`; it never truncates the roster. |
|
|
72
72
|
| `ptcPresentation` | (retired) | Legacy alias: `true` maps to `presentation: 'ptc'` and `false` to `'native'`, both with a deprecation warning. |
|
|
73
73
|
| `anchorTools` | (retired) | First-turn anchor narrowing is removed; setting this key warns and no longer narrows the wire. |
|
|
@@ -94,9 +94,9 @@ Export the session JSONL and inspect `request/header`:
|
|
|
94
94
|
|
|
95
95
|
- with `instructionSource: host` the first header's `system` should be exactly the persona block (the minimal persona, the working-discipline list, and the workspace line `Your working directory is <cwd>.`) plus plan mode's policy while plan mode is on — while the AGENTS.md chain arrives as the harness's own user-role message; under `instructionSource: system-prompt` the `system` carries one extra `workspace-instructions` section instead;
|
|
96
96
|
- every header keeps the same presentation for the whole session: under the default `presentation: 'ptc'` the wire collapses to `run_code`, and no turn boundary ever re-expands it;
|
|
97
|
-
- the admitted messages hold one `plugin`-sourced message from `liangshen-tool-catalog` after the user message, naming
|
|
97
|
+
- the admitted messages hold one `plugin`-sourced message from `liangshen-tool-catalog` after the user message, naming the resident host builtins the request opens by argument signature while paged MCP servers and plugin families (`browser`, `task_board`, `team`, `squad`, `ui`, `ssh`) appear as one-line summaries under `<inactive_namespaces>`;
|
|
98
98
|
- under `ptc` an unactivated namespace is absent from the request's `tools:sdk` section and cannot be called from inside a `run_code` program — from the FIRST request on, not one request later;
|
|
99
|
-
- after `tool_activate({ namespace })` succeeds, that namespace's tools join the wire from the next request, and no more than three paged namespaces
|
|
99
|
+
- after `tool_activate({ namespace })` succeeds (for example `"codegraph"`, `"task_board"`, or `"squad"`), that namespace's tools join the wire and the generated SDK from the next request under a `namespace `<name>` (activated):` heading, and no more than three paged namespaces stay active at once (activating a fourth evicts the least recently used back to summary);
|
|
100
100
|
- after a compaction the catalog is republished once as a replacement list, paged activations are rebuilt from the durable event stream, and the presentation mode is unchanged;
|
|
101
101
|
- file writes obey the host file sandbox policy — there is no bare local-filesystem bypass.
|
|
102
102
|
|
|
@@ -117,10 +117,11 @@ When validating mode behavior and evaluating performance, verification tiers mus
|
|
|
117
117
|
| --- | --- | --- |
|
|
118
118
|
| `enabled` | `true` | Master switch: when false, the preset is not declared and the announcement does not run. |
|
|
119
119
|
| `announceToAgent` | `false` | Opt-in: when true, a system-prompt section announces the plugin. Off by default so agent system prompts stay clean. |
|
|
120
|
-
| `presentation` | `ptc` | Wire presentation of the preset this plugin declares. The value is written into the `tool-catalog` row
|
|
120
|
+
| `presentation` | `ptc` | Wire presentation of the preset this plugin declares. The value is written into the `tool-catalog` row and drives the composition: the `@deepseek-ai/dsh-tool-executor-ptc` row it enables IS the wire, so `ptc` collapses it to `run_code` and `native` keeps the roster, and the catalog text describes the surface that composition produces. A change re-declares the preset as soon as the Host commits it, so the next session picks it up; a session that already started keeps the composition it declared. The removed `both` mode is rejected at registration — migrate an old profile to `ptc` or `native`. |
|
|
121
121
|
| `dispatcher` | `true` | Identity switch: when true (the shipped default), the declared preset appends the dispatcher rules section after the persona — complexity triage (L0/L1 direct, L2 through the full flow), the R0.5 compatibility gate that separates the legacy Agent Teams runtime (spawn_teammate plus team-scoped coordination tools) from the current one (a shared task board over ordinary subagents), an interview before planning on an L2 task, the Lead & Dispatch identity with its three execution topologies (Lead-Core, Hybrid, Fan-out) chosen by coupling against parallel ROI, the R9 plan pipeline (plan mode is the user's switch: inside it the plan is explored, written, and submitted through `exit_plan_mode`; outside it the dispatcher plans and then executes), delegation with layer-by-layer review and acceptance, and task tracking in `todo_write` — then a local English supplement with the interview additions, one rule that keeps the task board a tracking surface rather than a dispatch path, and one that keeps a pinned fact an anchor rather than current state. The block is maintained in this repository: it was re-extracted on 2026-10-18 and re-synced on 2026-11-02 against 0.55.0 and again on 2026-11-03 against 0.56.0 plus that package's unreleased Agent Teams pass (twenty-five anti-patterns; the R1 execution topologies; the Lead & Dispatch identity; R2's Harness 0.2.2 note that an explicit route may still be limited to the parent route; R8 restated against the planned direct execution R1 authorizes; R6's fix-and-reverify duty on a Lead-Core or Hybrid core; R0.5 rewritten for the current built-in team, whose only addition over plain subagents is a shared task board that stays bookkeeping under the R5 brief; R2's three allowlist states; R8's withdrawn empty-allowlist fallback; R6's record-backed re-dispatch count, non-penalized hand_back and UI Before/After evidence gate; R7's per-turn sweep and clause deletion test; R5's [Limits] rule that every cap states what it bounds, in what unit, the cap, and whether it accumulates, plus the [Compact Delta Brief] default; R0's impact-not-effort stop; the standing subagent contract, report protocol and coordinator-only tool list; and R9, adapted so plan mode stays the user's switch—this deployment mounts no enter_plan_mode row, and the dispatcher never asks the user for it); the text is written one decision sentence per rule (upstream's compact register, which took the block from about 35,000 to 24,600 characters while every correction and addition stayed), corrections are applied in place rather than appended as a contradicting second copy, `DISPATCHER_RULES_PROVENANCE` records every correction and every addition along with the upstream commit it came from, `DISPATCHER_RULES_PROVENANCE.omissions` records the two upstream entries this preset deliberately does not carry, because each names a tool it does not mount (the `dispatch_ledger` tool and the `enter_plan_mode`/`leave_plan_mode` rows), and `node tools/check-dispatcher-rules.mjs` reports drift against an installed copy of the origin package. Switching it off returns the session to the bare persona with its working discipline. It is orthogonal to `presentation`: `presentation` decides the tool surface, `dispatcher` decides the identity and the process discipline. |
|
|
122
|
+
| `pagedToolPatterns` | `''` | On-demand tool families ("On-demand tool families" text field in the plugin settings card): comma-separated prefix patterns, each a non-empty literal head without `*` ending in one trailing `*` (for example `mcp__*, browser_*, task_board_*`). `parsePagedToolPatterns` trims entries, skips empty segments, and writes the parsed array into the declared preset's `tool-catalog`, `tool-activate`, and `working-context` rows together (all three replay the session event log against `pagedToolPatterns`, so keeping one shared list prevents catalog eviction, `tool_activate` admission, and the rendered working-context line from diverging and stranding a withheld namespace). Leaving the field empty or resetting it writes no override and inherits the preset's shipped seven-pattern list (`['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`); in the settings card, any malformed entry holds the draft unwritten, and on the Host any malformed string is ignored in favor of the shipped list. |
|
|
122
123
|
|
|
123
|
-
All fields are editable in the web settings surface (plugin config) or through the profile patch (`dsh plugin` / `cordis.patch.yml`). Under the 0.1.7 settings contract a plugin's own Config IS its settings page: the Host serves one form per profile entry (the entry id `liangshen`, or the aggregate's generated `web-ui-liangshen` row) and every field is declared `volatile()`, so a write is committed into the running plugin instead of remounting its row. The preset-shaping presentation
|
|
124
|
+
All fields are editable in the web settings surface (plugin config) or through the profile patch (`dsh plugin` / `cordis.patch.yml`). Under the 0.1.7 settings contract a plugin's own Config IS its settings page: the Host serves one form per profile entry (the entry id `liangshen`, or the aggregate's generated `web-ui-liangshen` row) and every field is declared `volatile()`, so a write is committed into the running plugin instead of remounting its row. The preset-shaping fields (`presentation`, `dispatcher`, and `pagedToolPatterns`) then reach a session through the declaration: the plugin applies the committed values to the composition rows of `presets/liangshen/agent.cordis.yml` and re-declares the preset, so the settings surface — not the bundled file — is what the operator's sessions actually run. A row or key the composition does not carry is never invented: the overlay only narrows the shipped configuration. A change applies to sessions created after it; a session that already started keeps the composition it declared, because the registry refuses to recompose a started conversation.
|
|
124
125
|
|
|
125
126
|
## Behavior and limits
|
|
126
127
|
|
|
@@ -131,10 +132,10 @@ All fields are editable in the web settings surface (plugin config) or through t
|
|
|
131
132
|
- A step whose prompt assembly was not observed injects nothing — the catalog is never guessed from a stale view;
|
|
132
133
|
- A composition exposing none of the accepted persona section names (`deployment:persona-prefix`, `deployment:persona`, `persona`) keeps the assembled prompt and warns once instead of sending an empty system prompt;
|
|
133
134
|
- Plan mode is supported through its `plan:policy` section; with `keepPlanPolicy: false` the mode keeps its tool but loses the policy text that enforces it;
|
|
134
|
-
- Paged tools (default
|
|
135
|
+
- Paged tools (default patterns `['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`, while every host builtin stays resident) stay off the wire until the model activates their namespace through `tool_activate({ namespace })` (an MCP server name under `__`-headed patterns, or the pattern head minus at most one trailing `_` for plugin families); at most three paged namespaces stay active at once, refreshing recency on activation or tool call and evicting the least recently used one back to its summary when a fourth is activated, with activation state rebuilt from the durable event stream after compactions and resumes. Under `ptc` the page also restricts the scope's tool registry, so an unactivated namespace is absent from `tools:sdk` and unreachable from inside a `run_code` program too;
|
|
135
136
|
- The working-context line is injected only when its sources (plan-mode state, active paged namespaces, in-progress todos) are readable, and omitted otherwise;
|
|
136
137
|
- Tool results are pruned once they exceed 4096 characters, keeping a 2048-character head and a 1024-character tail (guarding the sparse-index slots while preserving the error tail and exit code), so oversized outputs do not crowd the context;
|
|
137
|
-
- `run_code` needs a mounted PTC runtime (the shipped web and headless compositions mount `@deepseek-ai/dsh-ptc-runtime-node` as the `ptc-runtime` row); without one
|
|
138
|
+
- `run_code` needs a mounted PTC runtime (the shipped web and headless compositions mount `@deepseek-ai/dsh-ptc-runtime-node` as the `ptc-runtime` row); without one no PTC executor can be mounted, so the session runs the native surface;
|
|
138
139
|
- The spawn delegation row enables child-model selection (`modelSelection: true` with `modelDiscovery: true`), so the settings page's subagent model-selection toggle is honored under this preset: the model sees `provider` / `model` / `reasoning_effort` on `subagent` and the `list_subagent_models` discovery tool, and an explicit route is checked against the Session's allowed list (without a recorded policy the effective route falls back to the parent's); the row also keeps the pre-split spelling `modelSelectionSettings: true`, because the SDK pinned in `devDependencies` reads only that key while the harness checkout this repository runs against no longer declares it, and each generation reads the key it knows while the other stays inert;
|
|
139
140
|
- Exactly one delegation row in a composition scope may enable discovery. The upstream `modelDiscovery` flag registers `list_subagent_models` under a fixed tool name in the scope the row composes into, and the registry refuses a second registration of that name in one scope, so a second discovery owner fails the whole session instead of adding a second opt-in. The fork row therefore ships without it (as the builtin Standard, PTC, and Cordis presets ship it, which leave the route fields off there too), and the composition test counts the discovery owners structurally;
|
|
140
141
|
- The `subagent-routes` row is the child-route guard. Once a Session recorded an allowed-route list, every delegation the row polices must resolve to an authorized route: an explicit `provider`/`model` pair on `subagent`, or the caller's own route on `subagent_fork` (and any teammate creator), whose inherited route is checked precisely because the tool cannot choose one. A refusal names the routes that would work; a route named on an inherit-only tool is refused as an override attempt; and a tool mounted without route fields is policed through the route its child would inherit instead of being asked for a pair no call could satisfy. The guard fails open on every fact it cannot read (no recorded policy, no session registry, no registry probe), so a Host that cannot answer keeps the harness's own delegation behavior, and `enabled: false` on the row turns it off entirely;
|
|
@@ -145,7 +146,7 @@ All fields are editable in the web settings surface (plugin config) or through t
|
|
|
145
146
|
- The preset carries the same trust level as shell access — review `presets/liangshen/` before installing;
|
|
146
147
|
- The plugin makes no network requests and adds no telemetry;
|
|
147
148
|
- Do not switch presets mid-conversation;
|
|
148
|
-
- Requires DSH 0.2.2-rc.
|
|
149
|
+
- Requires DSH 0.2.2-rc.2+ (preset mechanism, the `system-prompt/assemble` waterfall, the persona `prefix` schema, and the PTC presentation API).
|
|
149
150
|
|
|
150
151
|
## License
|
|
151
152
|
|
package/README.zh.md
CHANGED
|
@@ -5,35 +5,35 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="https://img.shields.io/npm/v/@linxin666/dsh-liangshen?style=flat-square" alt="Version">
|
|
7
7
|
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.2-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
9
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<strong>DeepSeek Harness(DSH)官方 Web GUI 与桌面客户端极简 Agent 预设与高效代码工具传输引擎</strong><br>
|
|
15
|
-
<em>极简 Persona 系统提示词 · run_code 程序化工具传输 ·
|
|
15
|
+
<em>极简 Persona 系统提示词 · run_code 程序化工具传输 · 按需工具族温和分页 · 关键事实登记簿</em>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
|
-
把梁神模式做成 DSH 全家桶里的一键安装插件:Host 半区在激活时把内置 preset 直接声明给 harness 的 agent-preset registry(声明即启用),新建会话即可在预设选择器中选择「梁神模式」,浏览器半区还在新建会话页的模型选择器旁提供一台老虎机拨杆来开关该模式。该 preset 让系统提示词保持极简 persona——外加本模式的固定工作纪律与会话工作区目录——AGENTS.md 类工作区指令交由 harness 以自己的 user 角色消息送达;工具面则从第一条用户消息起作为持久 user 消息注入在用户消息之后——形状与 harness 注入 skill 目录一致,且只宣告该次请求实际开放的工具。wire 在整个会话中保持由 `presentation` 选定的同一种呈现(出厂默认 `presentation: 'ptc'`):wire 收拢为唯一的 `run_code` 传输工具,其余工具经生成的 SDK 在程序内调用;未挂载 code runtime
|
|
18
|
+
把梁神模式做成 DSH 全家桶里的一键安装插件:Host 半区在激活时把内置 preset 直接声明给 harness 的 agent-preset registry(声明即启用),新建会话即可在预设选择器中选择「梁神模式」,浏览器半区还在新建会话页的模型选择器旁提供一台老虎机拨杆来开关该模式。该 preset 让系统提示词保持极简 persona——外加本模式的固定工作纪律与会话工作区目录——AGENTS.md 类工作区指令交由 harness 以自己的 user 角色消息送达;工具面则从第一条用户消息起作为持久 user 消息注入在用户消息之后——形状与 harness 注入 skill 目录一致,且只宣告该次请求实际开放的工具。wire 在整个会话中保持由 `presentation` 选定的同一种呈现(出厂默认 `presentation: 'ptc'`):wire 收拢为唯一的 `run_code` 传输工具,其余工具经生成的 SDK 在程序内调用;未挂载 code runtime 的部署回退为原生呈现并一次性告警,而不是宣告一个该请求无法承载的传输工具。被按需分页扣留的匹配工具族(出厂默认 `['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`,宿主内建工具全部常驻)在激活前不可达:它们以命名空间摘要出现在目录里,`ptc` 下同时不出现在生成的 SDK 中——分页是注册表级限制,不只是 wire 过滤。`tool_activate` 把一个命名空间挂回整个可达面,并配合关键事实登记簿守护长会话上下文。全部通过官方 NPM SDK 实现,不修改 DSH 源码。
|
|
19
19
|
|
|
20
20
|
## 原理
|
|
21
21
|
|
|
22
22
|
DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官方脚手架横评中代码 Agent 基准上原生极简面领先于程序化(PTC)面(DeepSWE v1.1:72.6% 对 67.6%;Terminal-Bench 2.1:90.6% 对 85.8%)。而真实工程会话依赖 MCP 服务与插件生态——封闭的 4 工具极简面在物理上够不到它们,无边界平铺的全量清单又会把会话内容埋在工具定义之下。
|
|
23
23
|
|
|
24
|
-
梁神模式因此在整个会话中保持由 `presentation` 选定的同一种呈现。出厂默认为 `ptc`:wire 收拢为唯一的 `run_code` 传输工具,其余工具经生成的 SDK 在程序内调用——静态上下文最省,但官方横评把该面排在原生面之后(原生面在 DeepSWE v1.1 与 Terminal-Bench 2.1 上均领先 PTC:72.6% 对 67.6%、90.6% 对 85.8%);`native`(仅组装出的原生清单、无程序化传输)保留为一行切换的选项。官方 SDK 已删除 `both` 呈现,本插件不做兼容映射:旧配置里仍写着 `both` 的 profile 会被直接拒绝注册,迁移路径是把它改为 `ptc` 或 `native
|
|
24
|
+
梁神模式因此在整个会话中保持由 `presentation` 选定的同一种呈现。出厂默认为 `ptc`:wire 收拢为唯一的 `run_code` 传输工具,其余工具经生成的 SDK 在程序内调用——静态上下文最省,但官方横评把该面排在原生面之后(原生面在 DeepSWE v1.1 与 Terminal-Bench 2.1 上均领先 PTC:72.6% 对 67.6%、90.6% 对 85.8%);`native`(仅组装出的原生清单、无程序化传输)保留为一行切换的选项。官方 SDK 已删除 `both` 呈现,本插件不做兼容映射:旧配置里仍写着 `both` 的 profile 会被直接拒绝注册,迁移路径是把它改为 `ptc` 或 `native`。实测一个未分页的梁神系会话系统提示词达 104,945 字符,其中 PTC 的 `interface ToolArgsMap` 段占 73,675 字符(约 70%,最重的 `task_board_*` 约 5.6k tokens、`browser_*` 约 3k、`squads_*` 与 `squad_*` 合计约 2.2k)。被分页模式匹配的高扇出工具族(出厂默认 `['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`,宿主内建工具全部常驻)因此先以命名空间摘要宣告,`tool_activate` 激活前既不在 wire 上、`ptc` 下也不在生成的 SDK 中(分页施加在程序分派所依据的注册表上),静态 Schema 面由此保持小巧。本模式不承诺基准领先,只保证「目录宣告的面」与「请求 wire 实际携带的面」永不矛盾。
|
|
25
25
|
|
|
26
26
|
## 工作机制
|
|
27
27
|
|
|
28
28
|
1. `minimal-prompt` 把每次组装出的提示词收窄到 persona 一段——一行 persona、本模式的固定工作纪律(同一假设的思考推演不超过两轮,缺少事实时立即闭合思考并调用检查工具而非空想;思考只决定下一步具体操作,不预演完整代码实现;多处独立检查或搜索在单轮内并发发射多个工具调用;Shell 为无状态进程,跨调用目录不保留,子目录操作使用复合命令或显式 workdir;正确性一律在执行阶段以工具实际输出验证;YAGNI 与 PDCA;不写冗余注释)、以及一行从会话头读取的方位信息 `Your working directory is <cwd>.`——因此 harness identity、web surface、工具用法、文件引用与结构化输出等 section 默认不会到达模型;plan mode 的 `plan:policy` 保留,因为该 section 是 plan mode 唯一的执行依据(它的退出工具在任何模式下都保持注册);
|
|
29
29
|
2. AGENTS.md 类工作区指令经 `instructionSource` 送达模型:默认(`host`)下 preset 不追加任何自有段,也不改动宿主自己的送达,工作区指令以宿主的 user 角色消息抵达——一条持久基线,加上触碰目录后的增量、替换与移除;`system-prompt` 下它们直接进入系统提示词本身:组装时 `minimal-prompt` 读取 harness 的基线链(`$DSH_HOME/AGENTS.md`,再从项目根到会话 cwd 沿途的 `AGENTS.md` / `CLAUDE.md` 及其 `.local` 覆盖层),把内容作为一段 `workspace-instructions` 追加在稳定前缀之后,受字节预算约束——放不下时先省略最宽的文件、最后才截断最具体的文件;读取在每次组装时都发生,文件改动无需持久消息即可在下次请求生效,harness 自己的 agent-instructions 注入则被丢弃以免与提示词重复。工作区子目录动态规则后续将支持注册文件工具(含 `str_replace_editor`)及 `run_code` 内子调用触达的目录;不解析任意 bash/program 代码,不保证 shell 自行文件访问的自动发现;
|
|
30
|
-
3. wire 在整个会话中保持由 `presentation` 选定的同一种呈现:`ptc`(出厂默认)把 wire 收拢为 `run_code`、其余工具经生成的 SDK 调用;`native` 携带组装出的原生清单;`ptc` 需要挂载的 code runtime
|
|
30
|
+
3. wire 在整个会话中保持由 `presentation` 选定的同一种呈现:`ptc`(出厂默认)把 wire 收拢为 `run_code`、其余工具经生成的 SDK 调用;`native` 携带组装出的原生清单;`ptc` 需要挂载的 code runtime;没有时无法挂载 PTC 执行器,会话直接运行原生工具面。旧键 `ptcPresentation` 映射到 `ptc`/`native` 并发出弃用告警,已退役的 `anchorTools` 首回合收窄不再生效——设置它会收到告警;
|
|
31
31
|
4. `tool-catalog` 把工具清单作为持久 user 消息追加在用户消息之后,保留完整输入输出关键参数语义(`descriptionMaxLength: 200` 仅限制一行摘要长度)。插件为该预设挂载的每个宿主内置工具配有一行手写短描述:被策展的工具直接使用整行策展文,长度截断不会切掉说明工具用途的那句话,`descriptionMaxLength` 只作为未被策展工具的兜底。目录只宣告该次请求实际开放的工具——原生清单,或 `ptc` 下经 SDK 可达的投影——并在分页开启时为被扣留的命名空间附上一行摘要;`ptc` 下这些摘要代表真正不可达的命名空间——既不在该请求的 `tools:sdk` 段中,也不能在 `run_code` 程序内调用——直到 `tool_activate`;只在工具面变化、或已发布副本离开可见面(压缩、恢复)时重发;
|
|
32
|
-
5.
|
|
33
|
-
6. 最小版 working-context 行——plan-mode 状态、已激活的分页命名空间、进行中的 todo
|
|
34
|
-
7. 目录把已激活分页家族的工具归在 `namespace `<名称>` (activated):`
|
|
32
|
+
5. 按需工具族温和分页出厂开启(`pagedToolPatterns: ['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`):MCP 桥接与六个挂载的插件工具族默认扣留在 wire、生成的 SDK 与 `run_code` 程序分派之外,在目录中以一行命名空间摘要宣告;宿主内建工具(shell、文件系统/read/write/edit/`str_replace_editor`、`glob`/`grep`、后台作业、`skill`、`ask_user_question`、`todo_write`、`web_search`、子代理委派、plan、goal、`fact_register`、`tool_activate` 与 MCP 资源读取工具)全部常驻。每个模式的字面头部决定 `patternNamespace` 如何推导命名空间:头部以 `__` 结尾时视为 MCP 桥接,取余下工具名的第一个 `__` 分段(`mcp__codegraph__codegraph_explore` -> `codegraph`);其余头部直接命名插件工具族并去掉至多一个结尾 `_`(`task_board_*` -> `task_board`,`squad*` -> `squad`,使 `squads_*` 与 `squad_member_*` 归入同一命名空间)。调用 `tool_activate({ namespace })` 后,该命名空间从下一个请求起重新可达;同时最多保持三个活跃的分页命名空间(`maxActiveNamespaces`,默认 `3`),激活或对已激活命名空间内工具的非报错调用都会刷新新近度,激活第四个时将最近最少使用的逐回摘要状态,激活状态从持久会话事件流重建,压缩与恢复均可还原;
|
|
33
|
+
6. 最小版 working-context 行——plan-mode 状态、已激活的分页命名空间、进行中的 todo、以及关键事实登记簿——只在其来源可读时注入到最新消息尾部,让当前状态落在模型的局部注意力窗口内;运行时上下文(sandbox 与 approval 快照)与 skill 目录按 Standard 模式正常注入;
|
|
34
|
+
7. 目录把已激活分页家族的工具归在 `namespace `<名称>` (activated):` 标题之下,而不是把同一工具族的工具散落在字母序清单里;未被分页的工具仍保持扁平条目;
|
|
35
35
|
8. `maxResidentTokens`(默认 8000)估算常驻 wire 面并在超过时告警一次,列出最重的工具并把 `pagedToolPatterns` 指为处置手段。该阈值按 V4.1 的 KV 压缩重新校准(其 KV cache 为 V4-Flash 的 1/4,同样的 schema 负载只占 1/4 的稀疏索引槽位,阈值由 6000 上调至 8000),仍校准在出厂清单之上,用于发现真实增长而非出厂配置本身。该守卫从不截断:静默丢掉会话需要的工具,等于用可度量的上下文成本换取不可度量的能力损失。
|
|
36
|
-
9. 关键事实登记簿(`fact_register`)让模型把用户硬性约束、已确认的架构决策、失败过的路径登记为一行短事实;登记簿从持久事件流折叠,随 `[Working Context: ...]` 行投射——每步都落在保证命中的局部注意力窗口内——以此对抗 V4.1
|
|
36
|
+
9. 关键事实登记簿(`fact_register`)让模型把用户硬性约束、已确认的架构决策、失败过的路径登记为一行短事实;登记簿从持久事件流折叠,随 `[Working Context: ...]` 行投射——每步都落在保证命中的局部注意力窗口内——以此对抗 V4.1 的长会话遗忘。两种 wire 形态喂给同一份折叠:`ptc` 下该调用记为 `tool/ptc-dispatch`(对象形态的 arguments、自带的 `isError`),`native` 下记为 `tool/call`(JSON 字符串形态的 arguments),报错的 dispatch 一律不生效。
|
|
37
37
|
|
|
38
38
|
## 安全模型
|
|
39
39
|
|
|
@@ -66,8 +66,8 @@ DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官
|
|
|
66
66
|
| `instructionSource` | `host` | 工作区指令送达模型的方式。`host`(默认)不追加任何自有段,也不改动宿主的 agent-instructions 注入,工作区指令以宿主自己的 user 角色消息送达:一条持久基线,加上触碰目录后的增量、替换与移除;`system-prompt` 在组装时读取 AGENTS.md 链并追加进系统提示词(harness 自己的注入被丢弃);`hint` 把首次注入替换为一次性的、非命令式的参考文件提示,后续注入丢弃。 |
|
|
67
67
|
| `instructionMaxBytes` | `65536` | 渲染后的 workspace-instructions 段的字节预算,仅在 `system-prompt` 模式下生效:最宽的文件先被省略,最具体的文件最后被截断。 |
|
|
68
68
|
| `descriptionMaxLength` | `200` | 注入目录中单个工具一行摘要的长度上限,作用于所有未被策展表覆盖的工具;被策展的宿主内置工具直接使用整行手写短描述。完整关键参数语义保持完整。 |
|
|
69
|
-
| `presentation` | `ptc` | 整个会话的 wire 呈现方式。`ptc`(出厂默认)把 wire 收拢为 `run_code`,其余工具经生成的 SDK 调用;`native`
|
|
70
|
-
| `pagedToolPatterns` | `['mcp__*']` |
|
|
69
|
+
| `presentation` | `ptc` | 整个会话的 wire 呈现方式。`ptc`(出厂默认)把 wire 收拢为 `run_code`,其余工具经生成的 SDK 调用;`native` 保持组装出的原生清单。设置覆盖层把该取值写进组合:`ptc` 时保留官方 `@deepseek-ai/dsh-tool-executor-ptc` 行并借此执行 PTC 程序,`native` 时停用该行——**那一行就是 wire**(0.2.2 已移除按 scope 的 `agent.ctx.tools.presentAs` 声明)。部署没有 PTC runtime 时保持原生面。已删除的 `both` 取值不被接受:旧 profile 写明它会在注册时被拒绝,请迁移为 `ptc` 或 `native`。 |
|
|
70
|
+
| `pagedToolPatterns` | `['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']` | 出厂开启按需温和分页:每项为不含 `*` 的非空字面头部加单个结尾 `*`(裸 `*` 会被拒绝)。命中的 MCP 与插件工具被扣留在 wire 与生成的 SDK 之外,直到模型经 `tool_activate({ namespace })` 激活其命名空间,期间在目录中以一行摘要出现,宿主内建工具全部常驻。以 `__` 结尾的头部取余下工具名的第一个 `__` 段作为命名空间(MCP server);其余头部去掉至多一个结尾 `_`(`task_board_*` -> `task_board`,`squad*` -> `squad`)。同时最多保持三个活跃的分页命名空间(`maxActiveNamespaces`,默认 `3`,`>= 1` 的整数),LRU 新近度与激活状态均从持久事件流重建。 |
|
|
71
71
|
| `maxResidentTokens` | `8000` | 常驻 wire 面的估算 token 上限(按序列化 schema 约四字符一 token),按 V4.1 的 KV 压缩重新校准后仍高于出厂清单,用于发现真实增长而非出厂配置本身。超过时告警一次、列出最重的工具并指向 `pagedToolPatterns`;不会截断工具清单。 |
|
|
72
72
|
| `ptcPresentation` | (已退役) | 旧别名:`true` 映射为 `presentation: 'ptc'`,`false` 映射为 `'native'`,两者都伴随弃用告警。 |
|
|
73
73
|
| `anchorTools` | (已退役) | 首回合锚定收窄已移除;设置该键会收到告警,且不再收窄 wire。 |
|
|
@@ -94,9 +94,9 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
94
94
|
|
|
95
95
|
- `instructionSource: host` 下第一份 header 的 `system` 应恰好是 persona 块(极简 persona、工作纪律清单、工作区目录行 `Your working directory is <cwd>.`)加上 plan mode 开启时的策略段——AGENTS.md 链则以宿主自己的 user 角色消息抵达;`instructionSource: system-prompt` 下 `system` 改为多出一段 `workspace-instructions`;
|
|
96
96
|
- 每份 header 在整个会话中保持同一种呈现:默认 `presentation: 'ptc'` 下 wire 收拢为 `run_code`,任何回合边界都不会再展开 wire;
|
|
97
|
-
- 放行的消息里应有一条来自 `liangshen-tool-catalog` 的 `plugin`
|
|
97
|
+
- 放行的消息里应有一条来自 `liangshen-tool-catalog` 的 `plugin` 消息,位于用户消息之后,按参数签名恰好列出该次请求常驻开放的宿主内建工具;被分页扣留的 MCP 服务与插件工具族(`browser`、`task_board`、`team`、`squad`、`ui`、`ssh`)以一行摘要出现在 `<inactive_namespaces>` 下;
|
|
98
98
|
- `ptc` 下未激活的命名空间既不出现在该请求的 `tools:sdk` 段中,也不能在 `run_code` 程序内调用——**从第一个请求起**成立,而不是晚一个请求;
|
|
99
|
-
- `tool_activate({ namespace })`
|
|
99
|
+
- `tool_activate({ namespace })` 成功后(例如 `"codegraph"`、`"task_board"` 或 `"squad"`),该命名空间的工具从下一个请求起进入 wire 与生成的 SDK,归在 `namespace `<名称>` (activated):` 标题之下,且同时激活的分页命名空间不超过三个(激活第四个会把最近最少使用的逐回摘要状态);
|
|
100
100
|
- 压缩之后目录会重发一次,形式为替换清单,分页激活状态从持久事件流重建,呈现模式保持不变;
|
|
101
101
|
- 文件写入受宿主文件沙箱策略约束,不存在裸本地文件系统绕过。
|
|
102
102
|
|
|
@@ -117,10 +117,11 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
117
117
|
| --- | --- | --- |
|
|
118
118
|
| `enabled` | `true` | 总开关:关闭后不声明预设、也不发公告。 |
|
|
119
119
|
| `announceToAgent` | `false` | 按需开启:开启后向 agent 系统提示注入本插件公告。默认关闭,保持系统提示词干净。 |
|
|
120
|
-
| `presentation` | `ptc` | 本插件所声明 preset 的 wire 呈现。取值写进 `tool-catalog`
|
|
120
|
+
| `presentation` | `ptc` | 本插件所声明 preset 的 wire 呈现。取值写进 `tool-catalog` 行并驱动组合:它启用的 `@deepseek-ai/dsh-tool-executor-ptc` 行**就是** wire,`ptc` 因此收拢为 `run_code`、`native` 保持原生清单,目录文本描述的就是该组合产生的面。Host 提交改动后立即重新声明 preset,此后新建的会话即采用新值;已开始的会话保持其已声明的组合。已删除的 `both` 取值在注册时被拒绝——旧 profile 请迁移为 `ptc` 或 `native`。 |
|
|
121
121
|
| `dispatcher` | `true` | 身份开关:开启时(出厂默认)所声明的 preset 在 persona 之后追加调度者规则段——复杂度分诊(L0/L1 直接执行,L2 走完整流程)、区分两代 Agent Teams 的 R0.5 兼容性闸门(legacy 运行期带 spawn_teammate 并顶替协调工具,现行运行期只是在原生子代理之上加一块共享任务板)、L2 任务先澄清访谈再规划、Lead & Dispatch 身份与按「耦合度 × 并行收益」三选一的执行拓扑(Lead-Core / Hybrid / Fan-out)、R9 计划模式管线(计划模式是用户的开关:已经在该模式里就只读探索、写计划、经 `exit_plan_mode` 提交;不在就照常规划后执行,不向用户索要这个模式)、派发子代理并逐层审查与验收,以及落在 `todo_write` 的任务跟踪——其后是本地英文补充:访谈类新增内容,加上让任务看板停在做跟踪的表面、而不是派发路径的那一条,以及让登记的事实保持为锚点、而不是当前状态的那一条。这个块在本仓维护:2026-10-18 重新抽取,2026-11-02 按 0.55.0 同步,2026-11-03 再按 0.56.0 及该包尚未发布的 Agent Teams 改动同步一次(二十五条反模式;R1 的三套执行拓扑;Lead & Dispatch 身份;R2 补上 Harness 0.2.2 起显式路由可能仍受父路由限制;R8 改为相对 R1 授权的计划内直执来定义;R6 补上 Lead-Core / Hybrid 主干上「先修后交付」;R0.5 按现行内置 team 重写——它对原生子代理只多加一块共享任务板,且该任务板始终是 R5 任务书之下的记账面;R2 的 allowlist 三态;R8 被撤回的空 allowlist 兜底;R6 记录化的重派次数、不罚 hand_back、以及界面的 Before/After 证据门;R7 每轮扫描即将升级或过期的项,以及删除测试;R5 的 [Limits] 规则——每个上限都写明它约束什么、单位、上限值、以及是否累计,外加 [Compact Delta Brief] 的精简任务书默认形态;R0 的「按影响而非按工作量停手」;常设子代理契约、报告协议与主控专用工具清单;以及 R9——按「计划模式是用户的开关」做了适配:本部署没有 enter_plan_mode 行,调度者也不主动向用户索要它);行文按上游那套精简写法处理——每条规则一句判定,正文从约 35,000 字符压到 24,600 字符,而每一条更正与新增都保留;更正就地应用,而不是作为一条自相矛盾的第二份副本追加;`DISPATCHER_RULES_PROVENANCE` 逐条记录每一次更正与每一处新增,并带上它来自的上游提交;`DISPATCHER_RULES_PROVENANCE.omissions` 记录本预设有意不带的两条上游内容,它们各自指向本预设没挂的工具(`dispatch_ledger` 工具,以及 `enter_plan_mode` / `leave_plan_mode` 两行);`node tools/check-dispatcher-rules.mjs` 对已安装的来源包报告漂移。关闭后回到仅含工作纪律的极简 persona。它与 `presentation` 正交:`presentation` 决定工具面,`dispatcher` 决定身份与流程纪律。 |
|
|
122
|
+
| `pagedToolPatterns` | `''` | 按需工具族(插件设置卡片中的「按需工具族」文本字段):逗号分隔的前缀模式,每项为不含 `*` 的非空字面头部加单个结尾 `*`(例如 `mcp__*, browser_*, task_board_*`)。`parsePagedToolPatterns` 去空白、跳过空项后把解析出的数组同时写入所声明 preset 的 `tool-catalog`、`tool-activate` 与 `working-context` 三行(三行都按各自的 `pagedToolPatterns` 重放同一份会话日志,必须保持同源,否则目录的驱逐限制、`tool_activate` 的激活判定与 working-context 的状态投影会发生分叉,导致被扣留的命名空间无法再被重新激活)。留空或重置时不写覆盖项,继承 preset 出厂的 7 项清单(`['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`);在设置卡片中,任一条目格式非法时草稿保持未写入状态,Host 侧收到含非法条目的文本时同样忽略并沿用出厂清单。 |
|
|
122
123
|
|
|
123
|
-
各字段都可在 Web 设置界面(插件配置)或 profile patch(`dsh plugin` / `cordis.patch.yml`)中编辑。0.1.7 的设置契约下,插件自身的 Config 就是它的设置页:Host 为每个 profile entry 生成一张表单(entry id 为 `liangshen`,聚合安装下为生成的 `web-ui-liangshen` 行),每个字段都声明为 `volatile()`,因此写入被提交进运行中的插件实例,而不是重挂该行。塑造 preset
|
|
124
|
+
各字段都可在 Web 设置界面(插件配置)或 profile patch(`dsh plugin` / `cordis.patch.yml`)中编辑。0.1.7 的设置契约下,插件自身的 Config 就是它的设置页:Host 为每个 profile entry 生成一张表单(entry id 为 `liangshen`,聚合安装下为生成的 `web-ui-liangshen` 行),每个字段都声明为 `volatile()`,因此写入被提交进运行中的插件实例,而不是重挂该行。塑造 preset 的字段(`presentation`、`dispatcher` 与 `pagedToolPatterns`)再经声明抵达会话:插件把已提交的取值应用到 `presets/liangshen/agent.cordis.yml` 的对应行并重新声明 preset,因此真正被会话运行的是设置界面的取值,而不是包内文件。组合里没有的行或键绝不会被凭空写入——覆写只会收窄出厂配置。改动对之后新建的会话生效;已开始的会话保持其已声明的组合,因为 registry 拒绝重组已开始的会话。
|
|
124
125
|
|
|
125
126
|
## 行为与限制
|
|
126
127
|
|
|
@@ -131,10 +132,10 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
131
132
|
- 未观测到 prompt 组装的步不注入任何内容——目录绝不会由过期视图推测;
|
|
132
133
|
- 若组合中不存在任何被接受的 persona section 名(`deployment:persona-prefix`、`deployment:persona`、`persona`),过滤器会保留组装结果并只告警一次,而不是发出空系统提示词;
|
|
133
134
|
- plan mode 通过其 `plan:policy` 段支持;置 `keepPlanPolicy: false` 后该模式仍有工具,但失去约束它的策略文本;
|
|
134
|
-
- 被分页扣留的工具(出厂模式 `mcp__
|
|
135
|
+
- 被分页扣留的工具(出厂模式 `['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`,宿主内建工具全部常驻)在模型经 `tool_activate({ namespace })` 激活其命名空间(`__` 结尾头部取余下首个 `__` 段作为 MCP 服务名,其余头部去掉至多一个结尾 `_` 作为插件工具族名)之前不进 wire;同时最多三个分页命名空间保持激活,激活或调用已激活命名空间内的工具都会刷新新近度,激活第四个会把最近最少使用的逐回摘要状态,激活状态在压缩与恢复后从持久事件流重建。`ptc` 下分页同时限制作用域的工具注册表,未激活的命名空间既不进 `tools:sdk`,在 `run_code` 程序内同样不可达;
|
|
135
136
|
- working-context 行只在其来源(plan-mode 状态、已激活的分页命名空间、进行中的 todo)可读时注入,否则省略;
|
|
136
137
|
- 工具结果超过 4096 字符即被修剪,保留 2048 字符头部与 1024 字符尾部(守护稀疏索引槽位的同时保住错误尾部与退出码),避免超大输出挤占上下文;
|
|
137
|
-
- `run_code` 需要挂载的 PTC runtime(随包发布的 web 与 headless 组合以 `ptc-runtime` 行挂载 `@deepseek-ai/dsh-ptc-runtime-node
|
|
138
|
+
- `run_code` 需要挂载的 PTC runtime(随包发布的 web 与 headless 组合以 `ptc-runtime` 行挂载 `@deepseek-ai/dsh-ptc-runtime-node`);没有时无法挂载 PTC 执行器,会话运行原生工具面;
|
|
138
139
|
- spawn 委派行已开启子 agent 模型选择(`modelSelection: true` 与 `modelDiscovery: true`),因此设置界面的子智能体模型选择开关在本预设下生效:模型在 `subagent` 上看到 `provider` / `model` / `reasoning_effort` 参数与 `list_subagent_models` 发现工具,显式路由会按会话的允许清单校验(没有已记录的策略时退回父会话当前路由);该行同时保留拆分前的写法 `modelSelectionSettings: true`:`devDependencies` 里钉的 SDK 只认这一个键,而本仓库运行所对的 harness checkout 已不再声明它,两代各读自己认识的键,另一个保持惰性;
|
|
139
140
|
- 同一组合 scope 内只允许一行委派工具开启发现:上游 `modelDiscovery` 以固定工具名在该行所合入的 scope 中注册 `list_subagent_models`,而注册表拒绝同一 scope 内同名工具的第二次注册,因此第二个开启行会让整个会话创建失败而不是多出一份能力。fork 行因此不带它(官方 Standard、PTC、Cordis 预设同样如此,且它们连路由字段也不开),组合测试按结构统计发现工具的所有者;
|
|
140
141
|
- `subagent-routes` 行是子路由守卫。一旦会话记录了允许路由清单,本行所管辖的每次委派都必须落到已授权路由上:`subagent` 上显式的 `provider`/`model` 对,或 `subagent_fork`(以及任何创建 teammate 的工具)上调用方自己的路由——后者的继承路由正是因为工具无法自选才需要校验。拒绝时会列出可用路由;在只继承的工具上点名路由会作为越权重路由被拒;没挂路由字段的工具不索要它给不出的参数,而是按子代理将要继承的路由校验。守卫对任何读不到的事实一律放行(未记录策略、无会话注册表、无注册表探针),因此答不出来的宿主保持 harness 原本的委派行为;行上的 `enabled: false` 可整体关闭;
|
|
@@ -145,7 +146,7 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
145
146
|
- preset 与 shell 访问具有相同信任等级,安装前可自行审阅 `presets/liangshen/`;
|
|
146
147
|
- 插件不发起网络请求,也不增加遥测;
|
|
147
148
|
- 不要在已经产生内容的会话中途切换 preset;
|
|
148
|
-
- 需要 DSH 0.2.2-rc.
|
|
149
|
+
- 需要 DSH 0.2.2-rc.2+(preset 机制、`system-prompt/assemble` 瀑布、persona 的 `prefix` schema,以及 PTC 呈现 API)。
|
|
149
150
|
|
|
150
151
|
## 许可
|
|
151
152
|
|