@linxin666/dsh-liangshen 0.3.24 → 0.4.1
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 +24 -17
- package/README.zh.md +25 -18
- package/cordis.patch.yml +3 -2
- package/icon.svg +3 -0
- package/lib/client.js +381 -77
- package/lib/client.js.map +1 -1
- package/lib/index.js +594 -428
- package/lib/types/announce.test.d.ts +10 -0
- package/lib/types/client/LiangShenSettingsCard.d.ts +27 -10
- package/lib/types/client/PluginSettingsCard.d.ts +4 -0
- package/lib/types/client/index.d.ts +32 -13
- package/lib/types/client/lever-controller.d.ts +16 -2
- package/lib/types/client/locales.d.ts +13 -0
- package/lib/types/client/main-session.d.ts +32 -0
- package/lib/types/client/plugin-card-seat.d.ts +23 -16
- package/lib/types/client/settings-form.d.ts +17 -17
- package/lib/types/composition.d.ts +116 -0
- package/lib/types/composition.test.d.ts +7 -0
- package/lib/types/index.d.ts +146 -31
- package/lib/types/index.test.d.ts +5 -0
- package/package.json +25 -20
- package/presets/liangshen/agent.cordis.yml +44 -10
- package/presets/liangshen/fact-ledger.mjs +141 -0
- package/presets/liangshen/guard.mjs +426 -0
- package/presets/liangshen/minimal-prompt.mjs +2 -2
- package/presets/liangshen/tool-catalog.mjs +24 -20
- package/presets/liangshen/working-context.mjs +10 -2
- package/src/announce.test.ts +248 -55
- package/src/client/LiangShenLever.module.css +2 -0
- package/src/client/LiangShenLever.tsx +37 -9
- package/src/client/LiangShenSettingsCard.tsx +96 -12
- package/src/client/PluginSettingsCard.tsx +7 -2
- package/src/client/index.ts +61 -23
- package/src/client/lever-controller.ts +76 -9
- package/src/client/locales.ts +30 -4
- package/src/client/main-session.ts +43 -0
- package/src/client/plugin-card-seat.ts +24 -17
- package/src/client/settings-form.ts +34 -31
- package/src/composition.test.ts +294 -0
- package/src/composition.ts +554 -0
- package/src/index.test.ts +68 -1
- package/src/index.ts +278 -107
- package/tools/benchmark-live-run.mjs +171 -32
- package/lib/types/schema.d.ts +0 -18
- package/lib/types/schema.test.d.ts +0 -1
- package/lib/types/sync.d.ts +0 -74
- package/lib/types/sync.test.d.ts +0 -1
- package/src/schema.test.ts +0 -64
- package/src/schema.ts +0 -110
- package/src/sync.test.ts +0 -303
- package/src/sync.ts +0 -324
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: 7812a1d2e0d7afe91640c8287bedeae85810dc56
|
|
6
|
+
README.zh.md: 0849beef44b789bf7f34c87a3f3fc3c0dab2374a
|
package/README.md
CHANGED
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
Ships the LiangShen preset as a one-command plugin of the dsh-web family:
|
|
5
|
+
Ships the LiangShen preset as a one-command plugin of the dsh-web family: at activation the host half declares the bundled preset to the harness's agent-preset registry (declare = enabled), so new sessions can pick "梁神模式" from the preset picker, and its browser half adds a slot-machine lever beside the model selector on the new-session screen for switching that mode on and off. The preset keeps a minimal persona with standing working discipline and the session workspace directory in the system prompt, lets the harness deliver AGENTS.md-style workspace instructions as its own user-role messages, and delivers its tool surface as a durable user message after the user's message — the way the harness injects the skill catalog, naming exactly the tools that request opens. The wire keeps one presentation for the whole session (`presentation: 'both'` by default): the native roster and the `run_code` transport sit co-resident — ordinary single-step work goes through direct native calls, while programmatic batch computation, wide fan-out, and multi-step data shaping go through `run_code`. A deployment without a mounted code runtime degrades to the native surface with a one-time warning instead of presenting a transport the request cannot carry. Tools held back by paging (default pattern `mcp__*`) are unreachable until activated: they appear in the catalog as namespace summaries, and under `ptc` they stay out of the generated SDK as well, because the page is a registry restriction rather than only a wire filter. `tool_activate` loads one namespace back onto the whole surface. Built entirely on the official NPM SDK — no dsh source changes.
|
|
6
6
|
|
|
7
7
|
## Why
|
|
8
8
|
|
|
9
9
|
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.
|
|
10
10
|
|
|
11
|
-
LiangShen mode therefore keeps the whole session on one presentation, chosen by the `presentation` key. The shipped default is `
|
|
11
|
+
LiangShen mode therefore keeps the whole session on one presentation, chosen by the `presentation` key. The shipped default is `both`: the native roster and the `run_code` transport sit co-resident — the direction the official scaffold comparison supports (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 keeping `run_code` as the specialized outlet for programmatic batch work and wide fan-out. `native` (the roster alone) and `ptc` (the wire collapsed to `run_code`: the cheapest static context but the comparison's lowest-ranked surface) remain one-line opt-ins. 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. External tools matched by the paging patterns (default `mcp__*`) are 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`, so the static schema surface stays small. The mode makes no overcommitment of benchmark superiority; it guarantees that the declared surface and the request's own wire never disagree.
|
|
12
12
|
|
|
13
13
|
## How it works
|
|
14
14
|
|
|
15
15
|
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);
|
|
16
16
|
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;
|
|
17
|
-
3. the wire keeps one presentation for the entire session, selected by `presentation`: `both` (the default) keeps the native roster and the `run_code` transport co-resident,
|
|
17
|
+
3. the wire keeps one presentation for the entire session, selected by `presentation`: `both` (the default) keeps the native roster and the `run_code` transport co-resident, with catalog guidance that direct native calls come first and `run_code` is reserved for programmatic batch computation, wide fan-out, and heavy computation; `native` carries the assembled native roster; `ptc` collapses the wire to `run_code` with every other tool reached through the generated SDK; `ptc` and `both` need a mounted code runtime; without one the plugin declares no presentation at all and 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;
|
|
18
18
|
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). It names exactly the tools the current request opens — the native roster, plus `run_code` when it is co-resident — 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);
|
|
19
|
-
5. tools stay
|
|
19
|
+
5. gentle tool paging ships on (`pagedToolPatterns: ['mcp__*']`): matching MCP tools stay off the wire and out of the generated SDK, announced as namespace summaries in the catalog, until the model activates one through `tool_activate({ namespace })` — the namespace returns from the next request on, at most three stay active (a fourth evicts the least recently used back to summary). Activation state is rebuilt from the durable event stream across compactions and resumes;
|
|
20
20
|
6. a minimal working-context line — plan-mode state, active paged namespaces, and in-progress todos — 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;
|
|
21
21
|
7. the catalog groups the tools of an activated paged family under a `namespace `<name>` (activated):` heading instead of scattering one server's tools through the alphabetical list, while every non-paged tool keeps its flat entry;
|
|
22
|
-
8. `maxResidentTokens` (default
|
|
22
|
+
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.
|
|
23
|
+
9. a runtime degeneration circuit breaker (`guard`) folds the session event stream each step and fires once per episode on either signal — a stall (consecutive zero-output long-reasoning steps) or an echo (the same tool call failing repeatedly with identical arguments) — injecting a breaker message and stepping the reasoning effort one notch down for the next few requests (max → high → low); with no signal it never rewrites a request, so the route's explicit effort and the prefix cache stay untouched. This is the outside force the persona's reflection fuse cannot be (DSH discussion #5976);
|
|
24
|
+
10. 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.
|
|
23
25
|
|
|
24
26
|
## Security model
|
|
25
27
|
|
|
@@ -50,9 +52,9 @@ The preset-local plugins are configured in `agent.cordis.yml`:
|
|
|
50
52
|
| `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. |
|
|
51
53
|
| `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. |
|
|
52
54
|
| `descriptionMaxLength` | `200` | Cap for one tool's one-line summary in the injected catalog. Complete key parameter semantics remain fully preserved. |
|
|
53
|
-
| `presentation` | `both` | Wire presentation for the whole session. `both` (the shipped default) keeps the full native roster and adds `run_code` co-resident
|
|
54
|
-
| `pagedToolPatterns` | `[]` |
|
|
55
|
-
| `maxResidentTokens` | `
|
|
55
|
+
| `presentation` | `both` | Wire presentation for the whole session. `both` (the shipped default) keeps the full native roster and adds `run_code` co-resident (direct native calls first, the transport for programmatic batch computation and wide fan-out); `native` keeps the assembled native roster; `ptc` collapses the wire to `run_code`. `ptc` and `both` need a mounted code runtime and degrade to `native` with a one-time warning when missing. |
|
|
56
|
+
| `pagedToolPatterns` | `['mcp__*']` | Gentle paging ships on: matching MCP tools are held back from the wire and the generated SDK until activated through `tool_activate({ namespace })`. Held-back namespaces appear in the catalog as one-line summaries. At most three paged namespaces stay active at once, rebuilt from the event stream. |
|
|
57
|
+
| `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. |
|
|
56
58
|
| `ptcPresentation` | (retired) | Legacy alias: `true` maps to `presentation: 'ptc'` and `false` to `'native'`, both with a deprecation warning. |
|
|
57
59
|
| `anchorTools` | (retired) | First-turn anchor narrowing is removed; setting this key warns and no longer narrows the wire. |
|
|
58
60
|
|
|
@@ -70,14 +72,14 @@ dsh plugin --profile web add @linxin666/dsh-liangshen@latest
|
|
|
70
72
|
dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
Fully restart `dsh web`, open a NEW empty session, and pick "梁神模式" as the preset. The plugin
|
|
75
|
+
Fully restart `dsh web`, open a NEW empty session, and pick "梁神模式" as the preset. The plugin declares the preset from its own bundled files at activation and releases the declaration when the plugin (or its row) unloads; nothing is written into `~/.dsh/.agent-presets`, and an upgrade takes effect on the next start.
|
|
74
76
|
|
|
75
77
|
## Verify
|
|
76
78
|
|
|
77
79
|
Export the session JSONL and inspect `request/header`:
|
|
78
80
|
|
|
79
81
|
- 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;
|
|
80
|
-
- every header keeps the same presentation for the whole session: under the default `presentation: '
|
|
82
|
+
- every header keeps the same presentation for the whole session: under the default `presentation: 'both'` the wire carries the native roster plus `run_code`, and no turn boundary ever collapses the wire further;
|
|
81
83
|
- the admitted messages hold one `plugin`-sourced message from `liangshen-tool-catalog` after the user message, naming exactly the tools the request opens by argument signature; tools held back by paging appear as one-line namespace summaries instead;
|
|
82
84
|
- 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;
|
|
83
85
|
- after `tool_activate({ namespace })` succeeds, that namespace's tools join the wire from the next request, and no more than three paged namespaces are active at once;
|
|
@@ -92,30 +94,35 @@ When validating mode behavior and evaluating performance, verification tiers mus
|
|
|
92
94
|
- **Real inference probe**: Verifies only transport connectivity and minimal model response capability to specific formats (e.g. using a headless probe to verify output parsing); a single successful probe demonstrates absence of blockers, but never that mode integration has succeeded.
|
|
93
95
|
- **Mode integration pass**: Requires full session verification of complete headers, the configured presentation behavior, paged activation and eviction, SDK parameter semantics under `run_code`, and sandbox policy enforcement.
|
|
94
96
|
- **Statistical improvement**: Must be evaluated across multiple comparative benchmark rounds in an isolated environment with recorded fixed routes and source hashes, evaluating task completion rate, tool failure rate, rule violation rate, human intervention frequency, and time/token costs. Single or few smoke runs do not constitute evidence of performance improvement.
|
|
95
|
-
2. **Benchmark tooling**: the isolated runner is `packages/dsh-liangshen/tools/benchmark-live-run.mjs`. It
|
|
97
|
+
2. **Benchmark tooling**: the isolated runner is `packages/dsh-liangshen/tools/benchmark-live-run.mjs`. It materializes the evaluated preset into a temporary directory and declares it from the run's own agent-preset registry through a variant patch, redirects session persistence into the run directory, and records a baseline (repository commit, shipped preset hash, DSH version, fixed route, task revision) with every run. The candidate matrix isolates the persona and the presentation strategy: `B` (shipped defaults), `P` (candidate persona), the presentation arms `T` (candidate persona, PTC from the first turn) and `N` (candidate persona, full native roster throughout), and `M` (the bundle's official Minimal preset, an external reference rather than a single-factor arm). Run one smoke case with `node tools/benchmark-live-run.mjs --variant B`, or the bounded matrix over the seed corpus with `node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,T,N,M --repeat 3 --max-sessions 60 --budget-usd 5`; aggregate the run records in a results directory with `node tools/benchmark-report.mjs .benchmark-results`, which reports per-group success rates with Wilson intervals, paired per-task deltas with confidence intervals, token and cost totals, infrastructure failures separately, and the recorded baseline. Smoke runs validate the protocol and the cost estimate; they are not evidence of a general coding gain.
|
|
96
98
|
|
|
97
99
|
## Configuration
|
|
98
100
|
|
|
99
101
|
| Key | Default | Behavior |
|
|
100
102
|
| --- | --- | --- |
|
|
101
|
-
| `enabled` | `true` | Master switch: when false,
|
|
103
|
+
| `enabled` | `true` | Master switch: when false, the preset is not declared and the announcement does not run. |
|
|
102
104
|
| `announceToAgent` | `false` | Opt-in: when true, a system-prompt section announces the plugin. Off by default so agent system prompts stay clean. |
|
|
103
|
-
| `presentation` | `both` | Wire presentation written into the
|
|
105
|
+
| `presentation` | `both` | Wire presentation written into the `tool-catalog` row of the preset this plugin declares: `both` (default) keeps the roster and transport co-resident; `native` keeps the assembled roster; `ptc` collapses the wire to `run_code`. 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. |
|
|
106
|
+
| `guardEnabled` | `true` | Master switch for the runtime degeneration circuit breaker: detects consecutive zero-output long reasoning and repeated identical-argument failures, injecting a breaker message and stepping the reasoning effort down when it fires; disabled means requests are never touched. |
|
|
107
|
+
| `guardSensitivity` | `balanced` | Sensitivity preset scaling every breaker threshold: `conservative` (fewer interruptions, x1.5), `balanced` (the calibrated defaults), `aggressive` (fires earlier, x0.5). |
|
|
108
|
+
| `guardStallReasoningChars` | `8000` | **Override** for the per-step runaway floor: the floor adapts to the reasoning effort by default (8000 at max / 12000 at high / 20000 at low, calibrated against V4.1's official 384K max output); setting this field wins over the adaptive table for every effort level. |
|
|
109
|
+
| `guardGlobalStallCap` | `4` | **Override** for the slow-burn step count: the cap scales with the sensitivity preset by default (4 at balanced); setting this field wins. |
|
|
110
|
+
| `guardEchoFailures` | `3` | **Override** for the echo ladder: identical-argument failures of the same tool in a row that fire the breaker. All guard fields reach a session through the declared preset, exactly like `presentation`. |
|
|
104
111
|
|
|
105
|
-
All fields are editable in the web settings surface (plugin config) or through the profile patch (`dsh plugin` / `cordis.patch.yml`). The preset-shaping presentation field reaches a session through the
|
|
112
|
+
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 field then reaches 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.
|
|
106
113
|
|
|
107
114
|
## Behavior and limits
|
|
108
115
|
|
|
109
116
|
- The system prompt is stable for the whole session: the persona block (persona, working discipline, workspace directory), plus plan mode's policy while plan mode is on, plus the workspace-instructions section in `system-prompt` mode. Nothing is appended after a tool call, and no output-token cap is applied;
|
|
110
117
|
- In `system-prompt` mode the workspace-instructions section is re-read at every assembly, so instruction-file edits propagate on the next request without a durable message; the section renders last, after the stable prefix, so the cache prefix stays intact. 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;
|
|
111
|
-
- The wire keeps
|
|
118
|
+
- The wire keeps one presentation for the entire session with no turn-boundary transition: `both` (default) keeps the native roster and one `run_code` co-resident, `native` carries the assembled roster, and `ptc` collapses the wire to the single `run_code` with every other tool reached through the generated SDK;
|
|
112
119
|
- The injected catalog is durable: it is written once per session, plus one replacement when the tool surface changes (a paged activation, a presentation change) or a compaction shadows the published copy, and it stays in the history for later requests;
|
|
113
120
|
- A step whose prompt assembly was not observed injects nothing — the catalog is never guessed from a stale view;
|
|
114
121
|
- 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;
|
|
115
122
|
- 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;
|
|
116
123
|
- Paged tools (default pattern `mcp__*`) stay off the wire until the model activates their namespace through `tool_activate`; at most three paged namespaces are active at once, activating a fourth evicts the least recently used one back to its summary, and activation state is rebuilt from the durable event stream after compactions and resumes;
|
|
117
124
|
- The working-context line is injected only when its sources (plan-mode state, active paged namespaces, in-progress todos) are readable, and omitted otherwise;
|
|
118
|
-
- Tool results are pruned once they exceed 4096 characters, keeping a
|
|
125
|
+
- 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;
|
|
119
126
|
- `run_code` needs a mounted code runtime (the shipped web and headless compositions mount `dsh-code-runtime-worker-thread`); without one, `ptc` and `both` declare nothing and the session runs the native surface;
|
|
120
127
|
- The roster does not publish the `workflow` tool, while the workflow engine stays mounted for `ralph`;
|
|
121
128
|
- The shell mounts the upstream standard Stdio stack, registering `bash` on POSIX and `pwsh` on win32 — each host mounts exactly one shell tool, featuring concise description title cards and deterministic exit codes;
|
|
@@ -123,7 +130,7 @@ All fields are editable in the web settings surface (plugin config) or through t
|
|
|
123
130
|
- The preset carries the same trust level as shell access — review `presets/liangshen/` before installing;
|
|
124
131
|
- The plugin makes no network requests and adds no telemetry;
|
|
125
132
|
- Do not switch presets mid-conversation;
|
|
126
|
-
- Requires DSH 0.1.
|
|
133
|
+
- Requires DSH 0.1.7-rc.1+ (preset mechanism, the `system-prompt/assemble` waterfall, the persona `prefix` schema, and the PTC presentation API).
|
|
127
134
|
|
|
128
135
|
## License
|
|
129
136
|
|
package/README.zh.md
CHANGED
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
把梁神模式做成 DSH 全家桶里的一键安装插件:Host
|
|
5
|
+
把梁神模式做成 DSH 全家桶里的一键安装插件:Host 半区在激活时把内置 preset 直接声明给 harness 的 agent-preset registry(声明即启用),新建会话即可在预设选择器中选择「梁神模式」,浏览器半区还在新建会话页的模型选择器旁提供一台老虎机拨杆来开关该模式。该 preset 让系统提示词保持极简 persona——外加本模式的固定工作纪律与会话工作区目录——AGENTS.md 类工作区指令交由 harness 以自己的 user 角色消息送达;工具面则从第一条用户消息起作为持久 user 消息注入在用户消息之后——形状与 harness 注入 skill 目录一致,且只宣告该次请求实际开放的工具。wire 在整个会话中保持由 `presentation` 选定的同一种呈现(出厂默认 `presentation: 'both'`):原生清单与 `run_code` 传输工具同驻——日常单步工作走原生直调,程序化批处理、并发扇出与多步数据塑形走 `run_code`;未挂载 code runtime 的部署回退为原生呈现并一次性告警,而不是宣告一个该请求无法承载的传输工具。被分页扣留的匹配工具(默认 `mcp__*`)在激活前不可达:它们以命名空间摘要出现在目录里,`ptc` 下同时不出现在生成的 SDK 中——分页是注册表级限制,不只是 wire 过滤。`tool_activate` 把一个命名空间挂回整个可达面。全部通过官方 NPM SDK 实现,不修改 DSH 源码。
|
|
6
6
|
|
|
7
7
|
## 原理
|
|
8
8
|
|
|
9
9
|
DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官方脚手架横评中代码 Agent 基准上原生极简面领先于程序化(PTC)面(DeepSWE v1.1:72.6% 对 67.6%;Terminal-Bench 2.1:90.6% 对 85.8%)。而真实工程会话依赖 MCP 服务与插件生态——封闭的 4 工具极简面在物理上够不到它们,无边界平铺的全量清单又会把会话内容埋在工具定义之下。
|
|
10
10
|
|
|
11
|
-
梁神模式因此在整个会话中保持由 `presentation` 选定的同一种呈现。出厂默认为 `
|
|
11
|
+
梁神模式因此在整个会话中保持由 `presentation` 选定的同一种呈现。出厂默认为 `both`:原生清单与 `run_code` 传输工具同驻——这是官方横评数据支持的方向(原生面在 DeepSWE v1.1 与 Terminal-Bench 2.1 上均领先 PTC:72.6% 对 67.6%、90.6% 对 85.8%),同时保留 `run_code` 作为程序化批处理与并发扇出的特化出口。`native`(去掉传输工具的纯原生面)与 `ptc`(wire 收拢为 `run_code`,静态上下文最省但官方横评垫底的呈现)都保留为一行切换的选项。被分页模式匹配的外部工具(默认 `mcp__*`)先以命名空间摘要宣告,`tool_activate` 激活前既不在 wire 上、`ptc` 下也不在生成的 SDK 中(分页施加在程序分派所依据的注册表上),静态 Schema 面因此保持小巧。本模式不承诺基准领先,只保证「目录宣告的面」与「请求 wire 实际携带的面」永不矛盾。
|
|
12
12
|
|
|
13
13
|
## 工作机制
|
|
14
14
|
|
|
15
15
|
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 唯一的执行依据(它的退出工具在任何模式下都保持注册);
|
|
16
16
|
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 自行文件访问的自动发现;
|
|
17
|
-
3. wire 在整个会话中保持由 `presentation` 选定的同一种呈现:`both
|
|
17
|
+
3. wire 在整个会话中保持由 `presentation` 选定的同一种呈现:`both`(出厂默认)让原生清单与 `run_code` 传输工具同驻,目录文案明确「原生直调优先、`run_code` 仅用于程序化批处理/并发扇出/重计算」;`native` 携带组装出的原生清单;`ptc` 把 wire 收拢为 `run_code`、其余工具经生成的 SDK 调用;`ptc` 与 `both` 需要挂载的 code runtime;没有时插件不做声明,会话直接运行原生工具面。旧键 `ptcPresentation` 映射到 `ptc`/`native` 并发出弃用告警,已退役的 `anchorTools` 首回合收窄不再生效——设置它会收到告警;
|
|
18
18
|
4. `tool-catalog` 把工具清单作为持久 user 消息追加在用户消息之后,保留完整输入输出关键参数语义(`descriptionMaxLength: 200` 仅限制一行摘要长度)。目录只宣告该次请求实际开放的工具——原生清单加上同驻时的 `run_code`——并在分页开启时为被扣留的命名空间附上一行摘要;`ptc` 下这些摘要代表真正不可达的命名空间——既不在该请求的 `tools:sdk` 段中,也不能在 `run_code` 程序内调用——直到 `tool_activate`;只在工具面变化、或已发布副本离开可见面(压缩、恢复)时重发;
|
|
19
|
-
5.
|
|
19
|
+
5. 温和分页出厂开启(`pagedToolPatterns: ['mcp__*']`):匹配的 MCP 工具被扣留在 wire 与生成的 SDK 之外,以命名空间摘要出现在目录中,直到模型经 `tool_activate({ namespace })` 激活——激活的命名空间从下一个请求起重新可达,最多保持三个已激活的分页命名空间(激活第四个时将最久未用的逐回摘要状态)。激活状态从持久事件流重建,压缩与恢复均可还原;
|
|
20
20
|
6. 最小版 working-context 行——plan-mode 状态、已激活的分页命名空间、进行中的 todo——只在其来源可读时注入到最新消息尾部,让当前状态落在模型的局部注意力窗口内;运行时上下文(sandbox 与 approval 快照)与 skill 目录按 Standard 模式正常注入;
|
|
21
21
|
7. 目录把已激活分页家族的工具归在 `namespace `<名称>` (activated):` 标题之下,而不是把一个服务端的工具散落在字母序清单里;未被分页的工具仍保持扁平条目;
|
|
22
|
-
8. `maxResidentTokens`(默认
|
|
22
|
+
8. `maxResidentTokens`(默认 8000)估算常驻 wire 面并在超过时告警一次,列出最重的工具并把 `pagedToolPatterns` 指为处置手段。该阈值按 V4.1 的 KV 压缩重新校准(其 KV cache 为 V4-Flash 的 1/4,同样的 schema 负载只占 1/4 的稀疏索引槽位,阈值由 6000 上调至 8000),仍校准在出厂清单之上,用于发现真实增长而非出厂配置本身。该守卫从不截断:静默丢掉会话需要的工具,等于用可度量的上下文成本换取不可度量的能力损失。
|
|
23
|
+
9. 运行时退化熔断器(`guard`)每步从会话事件流折叠信号,在两类形态下每个 episode 触发一次——停摆(连续零产出的长思考回合)或空转(同一工具以相同参数连续失败)——注入熔断消息,并在接下来几个请求内把推理档位临时下调一档(max → high → low);无信号时它从不改写任何请求,路由的显式档位与前缀缓存都不受影响。这是 persona 反思熔断无法充当的外力(DSH discussion #5976);
|
|
24
|
+
10. 关键事实登记簿(`fact_register`)让模型把用户硬性约束、已确认的架构决策、失败过的路径登记为一行短事实;登记簿从持久事件流折叠,随 `[Working Context: ...]` 行投射——每步都落在保证命中的局部注意力窗口内——以此对抗 V4.1 的长会话遗忘。
|
|
23
25
|
|
|
24
26
|
## 安全模型
|
|
25
27
|
|
|
@@ -50,9 +52,9 @@ DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官
|
|
|
50
52
|
| `instructionSource` | `host` | 工作区指令送达模型的方式。`host`(默认)不追加任何自有段,也不改动宿主的 agent-instructions 注入,工作区指令以宿主自己的 user 角色消息送达:一条持久基线,加上触碰目录后的增量、替换与移除;`system-prompt` 在组装时读取 AGENTS.md 链并追加进系统提示词(harness 自己的注入被丢弃);`hint` 把首次注入替换为一次性的、非命令式的参考文件提示,后续注入丢弃。 |
|
|
51
53
|
| `instructionMaxBytes` | `65536` | 渲染后的 workspace-instructions 段的字节预算,仅在 `system-prompt` 模式下生效:最宽的文件先被省略,最具体的文件最后被截断。 |
|
|
52
54
|
| `descriptionMaxLength` | `200` | 注入目录中单个工具一行摘要的长度上限。完整关键参数语义保持完整。 |
|
|
53
|
-
| `presentation` | `both` | 整个会话的 wire 呈现方式。`both`(出厂默认)保持完整原生清单并同驻一个 `run_code
|
|
54
|
-
| `pagedToolPatterns` | `[]` |
|
|
55
|
-
| `maxResidentTokens` | `
|
|
55
|
+
| `presentation` | `both` | 整个会话的 wire 呈现方式。`both`(出厂默认)保持完整原生清单并同驻一个 `run_code`(原生直调优先、传输工具用于程序化批处理与并发扇出);`native` 保持组装出的原生清单;`ptc` 把 wire 收拢为 `run_code`,其余工具经生成的 SDK 调用。`ptc` 与 `both` 需要挂载的 code runtime;没有时插件根本不做声明,会话直接运行原生工具面。 |
|
|
56
|
+
| `pagedToolPatterns` | `['mcp__*']` | 出厂开启温和分页:命中的 MCP 工具被扣留在 wire 与生成的 SDK 之外,直到模型通过 `tool_activate({ namespace })` 激活其命名空间。被扣留的命名空间在目录中以一行摘要出现。最多同时保持三个已激活的分页命名空间,激活状态从持久事件流重建。 |
|
|
57
|
+
| `maxResidentTokens` | `8000` | 常驻 wire 面的估算 token 上限(按序列化 schema 约四字符一 token),按 V4.1 的 KV 压缩重新校准后仍高于出厂清单,用于发现真实增长而非出厂配置本身。超过时告警一次、列出最重的工具并指向 `pagedToolPatterns`;不会截断工具清单。 |
|
|
56
58
|
| `ptcPresentation` | (已退役) | 旧别名:`true` 映射为 `presentation: 'ptc'`,`false` 映射为 `'native'`,两者都伴随弃用告警。 |
|
|
57
59
|
| `anchorTools` | (已退役) | 首回合锚定收窄已移除;设置该键会收到告警,且不再收窄 wire。 |
|
|
58
60
|
|
|
@@ -70,14 +72,14 @@ dsh plugin --profile web add @linxin666/dsh-liangshen@latest
|
|
|
70
72
|
dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
装完**完整重启 `dsh web`**,新建空 session
|
|
75
|
+
装完**完整重启 `dsh web`**,新建空 session,预设选择「梁神模式」。插件在激活时用包内自带文件声明该 preset,插件(或其行)卸载时注销;不会向 `~/.dsh/.agent-presets` 写入任何内容,升级后在下次启动即生效。
|
|
74
76
|
|
|
75
77
|
## 验证
|
|
76
78
|
|
|
77
79
|
导出 session JSONL,检查 `request/header`:
|
|
78
80
|
|
|
79
81
|
- `instructionSource: host` 下第一份 header 的 `system` 应恰好是 persona 块(极简 persona、工作纪律清单、工作区目录行 `Your working directory is <cwd>.`)加上 plan mode 开启时的策略段——AGENTS.md 链则以宿主自己的 user 角色消息抵达;`instructionSource: system-prompt` 下 `system` 改为多出一段 `workspace-instructions`;
|
|
80
|
-
- 每份 header 在整个会话中保持同一种呈现:默认 `presentation: '
|
|
82
|
+
- 每份 header 在整个会话中保持同一种呈现:默认 `presentation: 'both'` 下 wire 同驻原生清单与 `run_code`,任何回合边界都不会再收窄 wire;
|
|
81
83
|
- 放行的消息里应有一条来自 `liangshen-tool-catalog` 的 `plugin` 消息,位于用户消息之后,按参数签名恰好列出该次请求开放的工具;被分页扣留的工具以一行命名空间摘要出现;
|
|
82
84
|
- `ptc` 下未激活的命名空间既不出现在该请求的 `tools:sdk` 段中,也不能在 `run_code` 程序内调用——**从第一个请求起**成立,而不是晚一个请求;
|
|
83
85
|
- `tool_activate({ namespace })` 成功后,该命名空间的工具从下一个请求起进入 wire,且同时激活的分页命名空间不超过三个;
|
|
@@ -92,30 +94,35 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
92
94
|
- **真实推理探针**:仅验证链路连通性与模型对特定格式的最小响应能力(例如使用 headless 探针验证模型是否能正常解析输出);单次探针成功仅代表功能未阻断,绝不证明模式集成已达标。
|
|
93
95
|
- **模式集成通过**:要求在真实完整会话中,验证完整 header、所配置呈现行为、分页激活与驱逐、`run_code` 下的 SDK 参数语义解析与沙箱策略执行无误。
|
|
94
96
|
- **统计显著性提升**:必须在固定 route 与源码 hash 记录的隔离环境中进行多轮对比评测,综合评估任务完成率、工具失败率、规则违反率、人工介入次数与耗时/token 开销。单次或少数 smoke 运行不构成效果提升的证据。
|
|
95
|
-
2. **评测工具**:隔离 runner 位于 `packages/dsh-liangshen/tools/benchmark-live-run.mjs`:它把被评测 preset
|
|
97
|
+
2. **评测工具**:隔离 runner 位于 `packages/dsh-liangshen/tools/benchmark-live-run.mjs`:它把被评测 preset 物化到临时目录,并通过 variant patch 在本轮自己的 agent-preset registry 中声明它,把会话持久化改写到本次运行目录,并为每次运行记录基线(仓库提交、出厂 preset hash、DSH 版本、固定 route、任务版本)。候选矩阵隔离 persona 与呈现策略两个因素:`B`(出厂默认)、`P`(候选 persona)、呈现臂 `T`(候选 persona,首轮即 PTC)与 `N`(候选 persona,全程原生清单)、以及 `M`(内置包官方 Minimal preset,仅作外部参照而非单因素对照)。单次 smoke 用 `node tools/benchmark-live-run.mjs --variant B`,按种子任务集跑有界矩阵用 `node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,T,N,M --repeat 3 --max-sessions 60 --budget-usd 5`,再用 `node tools/benchmark-report.mjs .benchmark-results` 汇总结果目录:按组给出成功率与 Wilson 区间、按任务配对差值与置信区间、token 与费用合计、单独列出的基础设施失败以及记录的基线。smoke 只验证协议与费用估算,不构成通用编码能力提升的证据。
|
|
96
98
|
|
|
97
99
|
## 配置
|
|
98
100
|
|
|
99
101
|
| 键 | 默认值 | 行为 |
|
|
100
102
|
| --- | --- | --- |
|
|
101
|
-
| `enabled` | `true` |
|
|
103
|
+
| `enabled` | `true` | 总开关:关闭后不声明预设、也不发公告。 |
|
|
102
104
|
| `announceToAgent` | `false` | 按需开启:开启后向 agent 系统提示注入本插件公告。默认关闭,保持系统提示词干净。 |
|
|
103
|
-
| `presentation` | `both` |
|
|
105
|
+
| `presentation` | `both` | 写入本插件所声明 preset 之 `tool-catalog` 行的 wire 呈现:`both`(默认)让原生清单与 `run_code` 同驻;`native` 保持组装出的原生清单;`ptc` 把 wire 收拢为 `run_code`。Host 提交改动后立即重新声明 preset,此后新建的会话即采用新值;已开始的会话保持其已声明的组合。 |
|
|
106
|
+
| `guardEnabled` | `true` | 运行时退化熔断器总开关:检测连续零产出长思考与同参重复失败,触发时注入熔断提示并临时下调推理档位;关闭后不干预任何请求。 |
|
|
107
|
+
| `guardSensitivity` | `balanced` | 熔断灵敏度预设:整体缩放阈值——`conservative`(更少打断,×1.5)、`balanced`(出厂校准值)、`aggressive`(更早触发,×0.5)。 |
|
|
108
|
+
| `guardStallReasoningChars` | `8000` | 单步暴走梯字符阈值的**覆写值**:阈值默认随推理档位自适应(max 档 8000 / high 档 12000 / low 档 20000,按 V4.1 官方 384K 最大输出校准),设置本字段则以本值为准、覆盖所有档位的自适应表。 |
|
|
109
|
+
| `guardGlobalStallCap` | `4` | 熔断器慢烧梯连续步数的**覆写值**:默认随灵敏度预设缩放(balanced 为 4),设置本字段则以本值为准。 |
|
|
110
|
+
| `guardEchoFailures` | `3` | 熔断器空转梯的**覆写值**:同一工具以相同参数连续失败多少次触发。以上熔断字段与 `presentation` 一样写入所声明的 preset 生效。 |
|
|
104
111
|
|
|
105
|
-
各字段都可在 Web 设置界面(插件配置)或 profile patch(`dsh plugin` / `cordis.patch.yml
|
|
112
|
+
各字段都可在 Web 设置界面(插件配置)或 profile patch(`dsh plugin` / `cordis.patch.yml`)中编辑。0.1.7 的设置契约下,插件自身的 Config 就是它的设置页:Host 为每个 profile entry 生成一张表单(entry id 为 `liangshen`,聚合安装下为生成的 `web-ui-liangshen` 行),每个字段都声明为 `volatile()`,因此写入被提交进运行中的插件实例,而不是重挂该行。塑造 preset 的 presentation 字段再经声明抵达会话:插件把已提交的取值应用到 `presets/liangshen/agent.cordis.yml` 的对应行并重新声明 preset,因此真正被会话运行的是设置界面的取值,而不是包内文件。组合里没有的行或键绝不会被凭空写入——覆写只会收窄出厂配置。改动对之后新建的会话生效;已开始的会话保持其已声明的组合,因为 registry 拒绝重组已开始的会话。
|
|
106
113
|
|
|
107
114
|
## 行为与限制
|
|
108
115
|
|
|
109
116
|
- 系统提示词在整个会话中保持稳定:persona 块(persona、工作纪律、工作区目录),plan mode 开启时另加其策略段,`system-prompt` 模式下另加 workspace-instructions 段。工具调用后不会再追加内容,也不施加任何输出预算上限;
|
|
110
117
|
- `system-prompt` 模式下 workspace-instructions 段在每次组装时重新读取,指令文件的改动无需持久消息即可在下一次请求生效;该段渲染在稳定前缀之后的最后位置,缓存前缀不受影响。工作区子目录动态规则后续将扩展支持注册文件工具(含 `str_replace_editor`)及 `run_code` 内子调用触达的目录;不解析任意 bash/program 代码,不保证 shell 自行文件访问的自动发现;
|
|
111
|
-
- wire 在整个会话中保持同一种呈现——不存在回合边界跃迁:`native` 携带组装出的原生清单,`
|
|
118
|
+
- wire 在整个会话中保持同一种呈现——不存在回合边界跃迁:`both`(出厂默认)同驻原生清单与一个 `run_code`,`native` 携带组装出的原生清单,`ptc` 把 wire 收拢为 `run_code` 一条,其余工具经生成的 SDK 调用;
|
|
112
119
|
- 注入的目录是持久消息:每个会话写入一次,另在工具面变化(分页激活、呈现变更)或压缩遮蔽已发布副本时替换一次,并留在历史中供后续请求使用;
|
|
113
120
|
- 未观测到 prompt 组装的步不注入任何内容——目录绝不会由过期视图推测;
|
|
114
121
|
- 若组合中不存在任何被接受的 persona section 名(`deployment:persona-prefix`、`deployment:persona`、`persona`),过滤器会保留组装结果并只告警一次,而不是发出空系统提示词;
|
|
115
122
|
- plan mode 通过其 `plan:policy` 段支持;置 `keepPlanPolicy: false` 后该模式仍有工具,但失去约束它的策略文本;
|
|
116
|
-
-
|
|
123
|
+
- 被分页扣留的工具(出厂模式 `mcp__*`)在模型经 `tool_activate` 激活其命名空间之前不进 wire、也不进生成的 SDK;同时最多三个分页命名空间保持激活,激活第四个会把最近最少使用的逐回摘要状态,激活状态在压缩与恢复后从持久事件流重建;
|
|
117
124
|
- working-context 行只在其来源(plan-mode 状态、已激活的分页命名空间、进行中的 todo)可读时注入,否则省略;
|
|
118
|
-
- 工具结果超过 4096 字符即被修剪,保留
|
|
125
|
+
- 工具结果超过 4096 字符即被修剪,保留 2048 字符头部与 1024 字符尾部(守护稀疏索引槽位的同时保住错误尾部与退出码),避免超大输出挤占上下文;
|
|
119
126
|
- `run_code` 需要挂载的 code runtime(随包发布的 web 与 headless 组合都挂载 `dsh-code-runtime-worker-thread`);没有时 `ptc` 与 `both` 不做声明,会话运行原生工具面;
|
|
120
127
|
- 清单不发布 `workflow` 工具,而 workflow 引擎仍为 `ralph` 保留挂载;
|
|
121
128
|
- shell 挂载上游标准 Stdio 栈,POSIX 注册 `bash`,win32 注册 `pwsh`——每个宿主恰好挂一个 shell 工具,带简短功能描述标题卡片与确定性退出码;
|
|
@@ -123,7 +130,7 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
123
130
|
- preset 与 shell 访问具有相同信任等级,安装前可自行审阅 `presets/liangshen/`;
|
|
124
131
|
- 插件不发起网络请求,也不增加遥测;
|
|
125
132
|
- 不要在已经产生内容的会话中途切换 preset;
|
|
126
|
-
- 需要 DSH 0.1.
|
|
133
|
+
- 需要 DSH 0.1.7-rc.1+(preset 机制、`system-prompt/assemble` 瀑布、persona 的 `prefix` schema,以及 PTC 呈现 API)。
|
|
127
134
|
|
|
128
135
|
## 许可
|
|
129
136
|
|
package/cordis.patch.yml
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
# `dsh plugin --profile <name> add link:~/code/dsh-web-ui/packages/dsh-liangshen`.
|
|
5
5
|
#
|
|
6
6
|
# The row is a bare plugin by package name: the node half (exports ".") runs
|
|
7
|
-
# in the host process and
|
|
8
|
-
#
|
|
7
|
+
# in the host process and declares the bundled LiangShen agent preset to the
|
|
8
|
+
# agent-preset registry at activation. No browser half beyond the composer
|
|
9
|
+
# lever and the settings card.
|
|
9
10
|
- insert:
|
|
10
11
|
- id: liangshen
|
|
11
12
|
name: '@linxin666/dsh-liangshen'
|
package/icon.svg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<path fill="#4d6bfe" fill-rule="evenodd" d="M 67.5 120 L 70.5 120 L 72.5 121 L 80.5 129 L 81.5 129 L 84.5 132 L 85.5 132 L 90.5 136 L 93.5 137 L 95.5 139 L 101.5 142 L 103.5 142 L 106.5 144 L 111.5 145 L 112.5 146 L 115.5 146 L 119.5 148 Q 122.75 147.25 123.5 149 L 127.5 149 L 128.5 150 L 133.5 150 L 134.5 151 L 140.5 151 L 141.5 152 L 150.5 152 L 151.5 153 L 160.5 153 L 161.5 154 L 171.5 154 L 172.5 155 L 178.5 155 L 179.5 156 Q 183.5 155 184.5 157 L 189.5 157 Q 190.5 159 194.5 158 L 195.5 159 L 197.5 159 L 198.5 160 L 200.5 160 L 201.5 161 L 206.5 162 L 209.5 164 L 211.5 164 L 219.5 168 L 224.5 172 L 227.5 173 L 247 191.5 L 247 192.5 L 253 199.5 L 255.5 204 L 258 201.5 L 263 193.5 L 272.5 183 L 273.5 183 L 280.5 176 L 281.5 176 L 292.5 168 L 300.5 164 L 302.5 164 L 305.5 162 L 307.5 162 L 308.5 161 L 310.5 161 L 314.5 159 L 317.5 159 L 318.5 158 Q 321.75 158.75 322.5 157 L 326.5 157 L 327.5 156 L 331.5 156 L 332.5 155 L 337.5 155 L 338.5 154 L 348.5 154 L 349.5 153 L 358.5 153 L 359.5 152 L 368.5 152 L 369.5 151 L 376.5 151 L 377.5 150 L 383.5 150 L 384.5 149 L 388.5 149 L 389.5 148 L 392.5 148 L 393.5 147 L 396.5 147 L 397.5 146 L 399.5 146 L 400.5 145 L 405.5 144 L 423.5 135 L 426.5 132 L 431.5 129 L 439.5 121 L 441.5 120 L 444.5 120 L 448 123.5 L 448 140.5 L 447 141.5 L 447 149.5 L 446 150.5 L 446 154.5 L 445 155.5 Q 445.75 158.75 444 159.5 L 444 163.5 Q 442.25 164.25 443 167.5 L 440 173.5 L 439 178.5 L 435 185.5 L 435 187.5 L 432 193.5 L 430 195.5 L 429 198.5 L 427 200.5 L 425 204.5 L 419 211.5 L 419 212.5 L 402.5 229 L 401.5 229 L 394.5 235 L 393.5 235 L 388.5 239 L 385.5 240 L 383.5 242 L 371.5 248 L 369.5 248 L 364.5 251 L 362.5 251 L 361.5 252 L 359.5 252 L 358.5 253 L 356.5 253 L 355.5 254 L 353.5 254 L 349.5 256 L 342.5 257 L 338.5 259 L 335.5 259 L 334.5 260 L 327.5 261 L 326.5 262 L 324.5 262 L 323.5 263 L 321.5 263 L 320.5 264 L 318.5 264 L 317.5 265 L 312.5 266 L 309.5 268 L 307.5 268 L 295.5 275 L 288 282.5 Q 287.5 286 285 287.5 Q 285.5 290 284 290.5 L 284 293.5 L 283 294.5 L 283 311.5 L 284 312.5 L 284 318.5 L 285 319.5 L 285 323.5 L 286 324.5 L 286 328.5 Q 288 329.5 287 333.5 L 288 334.5 L 288 337.5 L 289 338.5 L 289 341.5 L 290 342.5 L 290 345.5 L 291 346.5 L 292 353.5 L 293 354.5 L 293 356.5 L 295 360.5 L 295 363.5 L 296 364.5 L 296 367.5 L 297 368.5 L 297 370.5 L 298 371.5 L 298 373.5 L 299 374.5 L 299 376.5 L 301 380.5 L 301 386.5 L 298.5 389 L 294.5 391 Q 292 390.5 291.5 392 L 286.5 392 L 285.5 393 L 272.5 393 L 271.5 394 L 240.5 394 L 239.5 393 L 227.5 393 L 226.5 392 L 221.5 392 Q 220.75 390.25 217.5 391 L 212 387.5 L 211 385.5 L 211 381.5 L 212 380.5 Q 211.5 378 213 377.5 L 213 374.5 L 214 373.5 L 214 371.5 L 216 367.5 L 216 364.5 L 217 363.5 L 217 361.5 L 219 357.5 L 219 354.5 L 221 350.5 L 221 347.5 L 222 346.5 L 222 343.5 L 223 342.5 L 223 339.5 L 224 338.5 L 224 335.5 L 225 334.5 Q 224.25 331.25 226 330.5 L 226 326.5 L 227 325.5 Q 226 321.5 228 320.5 L 228 315.5 L 229 314.5 L 229 292.5 L 228 291.5 L 227 286.5 L 225 284.5 L 223 280.5 L 219.5 277 L 218.5 277 L 212.5 272 L 202.5 267 L 200.5 267 L 197.5 265 L 194.5 265 L 193.5 264 L 191.5 264 L 190.5 263 L 188.5 263 L 184.5 261 L 181.5 261 L 180.5 260 L 173.5 259 L 172.5 258 L 170.5 258 L 166.5 256 L 159.5 255 L 158.5 254 L 156.5 254 L 155.5 253 L 150.5 252 L 147.5 250 L 145.5 250 L 142.5 248 L 140.5 248 L 128.5 242 L 123.5 238 L 120.5 237 L 109.5 228 L 108.5 228 L 95 214.5 L 95 213.5 L 87 204.5 L 84 198.5 L 82 196.5 L 80 191.5 L 77 187.5 L 77 185.5 L 72 175.5 L 72 173.5 L 71 172.5 L 71 170.5 L 69 166.5 L 69 163.5 L 68 162.5 Q 68.75 159.25 67 158.5 L 67 154.5 L 66 153.5 L 66 148.5 L 65 147.5 L 65 139.5 L 64 138.5 L 64 124.5 L 67.5 120 Z"/>
|
|
3
|
+
</svg>
|