@linxin666/dsh-liangshen 0.4.7 → 0.4.9
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 +10 -8
- package/README.zh.md +10 -8
- package/lib/client.js +102 -55
- package/lib/client.js.map +1 -1
- package/lib/index.js +9 -1
- package/lib/types/client/PluginSettingsCard.d.ts +60 -0
- package/package.json +15 -15
- package/presets/liangshen/agent.cordis.yml +76 -18
- package/presets/liangshen/dispatcher-rules.mjs +128 -47
- package/presets/liangshen/fact-ledger.mjs +14 -0
- package/presets/liangshen/subagent-routes.mjs +396 -0
- package/presets/liangshen/tool-catalog.mjs +7 -4
- package/src/client/PluginSettingsCard.tsx +140 -20
- package/src/client/settings-card.module.css +141 -11
- package/src/composition.test.ts +20 -0
- package/src/composition.ts +10 -2
- package/tools/benchmark-live-run.mjs +116 -14
- package/tools/benchmark-report.mjs +44 -0
- package/tools/check-dispatcher-rules.mjs +130 -0
- package/tools/probe-selftest.mjs +130 -0
- package/tools/probes/budget-ledger/env.mjs +103 -0
- package/tools/probes/budget-ledger/grade.mjs +31 -0
- package/tools/probes/budget-ledger/strategies.mjs +25 -0
- package/tools/probes/oncall-backlog/env.mjs +141 -0
- package/tools/probes/oncall-backlog/grade.mjs +28 -0
- package/tools/probes/oncall-backlog/strategies.mjs +37 -0
- package/tools/probes/prior-override/env.mjs +153 -0
- package/tools/probes/prior-override/grade.mjs +31 -0
- package/tools/probes/prior-override/strategies.mjs +30 -0
- package/tools/probes/refresh-quota/env.mjs +140 -0
- package/tools/probes/refresh-quota/grade.mjs +30 -0
- package/tools/probes/refresh-quota/strategies.mjs +29 -0
- package/tools/probes/shared.mjs +75 -0
- package/tools/tasks/liangshen-v41-probes.json +59 -0
package/lib/index.js
CHANGED
|
@@ -397,7 +397,15 @@ function readPresetDefinition(id, dir) {
|
|
|
397
397
|
plugins: readCompositionRows(read("agent.cordis.yml"), dir)
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* The overlay table: settings field to composition row and config key.
|
|
402
|
+
*
|
|
403
|
+
* `presentation` writes the `tool-catalog` row alone, because that row's
|
|
404
|
+
* declaration IS the wire: the plugin hands the value to
|
|
405
|
+
* `agent.ctx.tools.presentAs` and re-assembles, so the catalog text and the
|
|
406
|
+
* declared presentation always travel together. The composition carries no
|
|
407
|
+
* executor row to mount or unmount.
|
|
408
|
+
*/
|
|
401
409
|
function overrideTargets(overrides) {
|
|
402
410
|
return [["tool-catalog", { ...overrides.presentation === void 0 ? {} : { presentation: overrides.presentation } }], ["minimal-prompt", { ...overrides.dispatcher === void 0 ? {} : { dispatcher: overrides.dispatcher } }]];
|
|
403
411
|
}
|
|
@@ -24,6 +24,14 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
24
24
|
descriptionKey: TKey;
|
|
25
25
|
/** Optional rich header description rendered instead of the plain t(descriptionKey) text (the plain text stays as the tooltip). */
|
|
26
26
|
descriptionNode?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Locale key of the full sentence behind a shortened description: when
|
|
29
|
+
* present, the header's native `title` takes this text while the visible
|
|
30
|
+
* line keeps `descriptionKey`/`descriptionNode`, so a compact card can
|
|
31
|
+
* compress the sentence without keeping a second visible copy of it.
|
|
32
|
+
* Defaults to the description key.
|
|
33
|
+
*/
|
|
34
|
+
descriptionTitleKey?: TKey;
|
|
27
35
|
/**
|
|
28
36
|
* Optional leading mark identifying the plugin. A card without one keeps the
|
|
29
37
|
* plain official header shape, so the chrome stays a readable sibling of the
|
|
@@ -37,6 +45,19 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
37
45
|
onSave: () => void;
|
|
38
46
|
/** Drop every staged edit. */
|
|
39
47
|
onDiscard: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* Id applied to the card's title element, so a header control (an immediate
|
|
50
|
+
* toggle in `headerAction`) can name itself through `aria-labelledby`
|
|
51
|
+
* instead of repeating the title as a string.
|
|
52
|
+
*/
|
|
53
|
+
titleId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Render the header only, with no body region. A card whose whole setting is
|
|
56
|
+
* the header control (a switch whose explanation is the description) has no
|
|
57
|
+
* controls to lay out below it, and an empty body would draw a divider line
|
|
58
|
+
* with nothing under it.
|
|
59
|
+
*/
|
|
60
|
+
headerOnly?: boolean;
|
|
40
61
|
/**
|
|
41
62
|
* Render the controls expanded on arrival (still collapsible). Defaults to
|
|
42
63
|
* true: promoted first-level sections show their settings immediately.
|
|
@@ -54,10 +75,24 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
54
75
|
* edits, so the footer would sit there permanently disabled.
|
|
55
76
|
*/
|
|
56
77
|
hideFooter?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Optional control rendered at the header's trailing edge, before the pending
|
|
80
|
+
* badge and the chevron. A card whose setting is one immediate flip (it
|
|
81
|
+
* applies outside the staged form) puts its ToggleSwitch here, so the control
|
|
82
|
+
* is reachable without opening the card and matches a plugin card's shape.
|
|
83
|
+
*/
|
|
84
|
+
headerAction?: ReactNode;
|
|
57
85
|
/** Render children even when the settings namespace is not exposed by the host. */
|
|
58
86
|
renderChildrenWhenNotExposed?: boolean;
|
|
59
87
|
/** Hide the 'not exposed' warning banner when the settings namespace is not exposed. */
|
|
60
88
|
hideNotExposedNotice?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Compact chrome for a topic card rendered inside another card's body: a
|
|
91
|
+
* smaller title, a tighter header and body inset, and a one-line description
|
|
92
|
+
* whose full text stays on the header's own title. Defaults to the
|
|
93
|
+
* first-level chrome, which is unchanged.
|
|
94
|
+
*/
|
|
95
|
+
density?: 'nested';
|
|
61
96
|
/** The plugin's controls. */
|
|
62
97
|
children: ReactNode;
|
|
63
98
|
}
|
|
@@ -75,6 +110,12 @@ export interface FieldProps {
|
|
|
75
110
|
label: string;
|
|
76
111
|
/** One-line explanation rendered under the control. */
|
|
77
112
|
hint: string;
|
|
113
|
+
/**
|
|
114
|
+
* Full sentence behind the visible hint, exposed as the paragraph's native
|
|
115
|
+
* `title` so a card can shorten the line without losing the text. Omitted:
|
|
116
|
+
* the paragraph carries no title attribute at all.
|
|
117
|
+
*/
|
|
118
|
+
hintTitle?: string;
|
|
78
119
|
/** Draft text this control renders. */
|
|
79
120
|
text: string;
|
|
80
121
|
/** True when saving would leave a user-layer entry for this field. */
|
|
@@ -141,4 +182,23 @@ export declare function ChoiceField(props: FieldProps & {
|
|
|
141
182
|
label: string;
|
|
142
183
|
}>;
|
|
143
184
|
}): import("react").JSX.Element;
|
|
185
|
+
/**
|
|
186
|
+
* An immediate boolean toggle drawn as a switch track, for a setting that
|
|
187
|
+
* applies on flip rather than through a staged save. It is a real button with
|
|
188
|
+
* `role="switch"` and `aria-checked`, so keyboard and assistive activation
|
|
189
|
+
* arrive as a click and the state is announced instead of inferred from a
|
|
190
|
+
* checkbox tick.
|
|
191
|
+
*/
|
|
192
|
+
export declare function ToggleSwitch(props: {
|
|
193
|
+
/** Id of the element naming the switch (the card's title). */
|
|
194
|
+
labelledBy?: string;
|
|
195
|
+
/** Accessible name when no element labels it. */
|
|
196
|
+
ariaLabel?: string;
|
|
197
|
+
/** Current state. */
|
|
198
|
+
checked: boolean;
|
|
199
|
+
/** Disables the switch while a write is in flight or the Host refuses writes. */
|
|
200
|
+
disabled?: boolean;
|
|
201
|
+
/** Called with the requested next state. */
|
|
202
|
+
onChange: (next: boolean) => void;
|
|
203
|
+
}): import("react").JSX.Element;
|
|
144
204
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-liangshen",
|
|
3
3
|
"description": "LiangShen (梁神) agent preset plus its composer lever for the dsh web GUI. The host half declares the bundled preset to the harness's agent-preset registry at activation (declare = enabled), so the preset is selectable for new sessions without writing anything into the harness home; the preset keeps a minimal persona with standing working discipline while the harness's own user-role agent-instructions injection delivers the workspace instructions (the optional `instructionSource: system-prompt` mode lifts them into the prompt instead), and declares one tool presentation for the session's whole lifetime: `ptc` by default (the wire collapses to `run_code` and every other tool is reached through the generated SDK), with `native` as the explicit assembled-roster option. High-fan-out tool families (default `mcp__*`) stay paged out of the wire until the preset's own `tool_activate` tool loads their namespace (LRU cap three, state replayed from the durable session event stream), and the tool catalog — exactly the reachable tools plus paged-out namespace summaries — and a one-line working-context projection travel as durable user messages republished only on change. The browser half adds a slot-machine lever left of the model selector on the new-session screen to toggle the mode. Hot-pluggable via cordis.patch.yml + profile symlink, no dsh source changes.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.9",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dsh": {
|
|
25
25
|
"engines": {
|
|
26
|
-
"dsh": ">=0.2.1-rc.
|
|
26
|
+
"dsh": ">=0.2.1-rc.3"
|
|
27
27
|
},
|
|
28
28
|
"bundle": {
|
|
29
29
|
"patch": "./cordis.patch.yml"
|
|
@@ -40,25 +40,25 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@deepseek-ai/dsh": ">=0.2.1-rc.
|
|
43
|
+
"@deepseek-ai/dsh": ">=0.2.1-rc.3"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@deepseek-ai/schemastery": "^3.18.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
50
|
-
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.1-rc.
|
|
51
|
-
"@deepseek-ai/dsh-api-remotes": "^0.2.1-rc.
|
|
52
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.2.1-rc.
|
|
53
|
-
"@deepseek-ai/dsh-client-connection": "^0.2.1-rc.
|
|
54
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.
|
|
55
|
-
"@deepseek-ai/dsh-client-store": "^0.2.1-rc.
|
|
56
|
-
"@deepseek-ai/dsh-client-ui-conversation": "^0.2.1-rc.
|
|
57
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.
|
|
58
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.
|
|
60
|
-
"@deepseek-ai/dsh-settings": "^0.2.1-rc.
|
|
61
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.
|
|
50
|
+
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.1-rc.3",
|
|
51
|
+
"@deepseek-ai/dsh-api-remotes": "^0.2.1-rc.3",
|
|
52
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.2.1-rc.3",
|
|
53
|
+
"@deepseek-ai/dsh-client-connection": "^0.2.1-rc.3",
|
|
54
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.3",
|
|
55
|
+
"@deepseek-ai/dsh-client-store": "^0.2.1-rc.3",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.2.1-rc.3",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.3",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.3",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.3",
|
|
60
|
+
"@deepseek-ai/dsh-settings": "^0.2.1-rc.3",
|
|
61
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.3",
|
|
62
62
|
"@testing-library/react": "^16.1.0",
|
|
63
63
|
"@types/node": "^22.20.0",
|
|
64
64
|
"@types/react": "~18.3.1",
|
|
@@ -79,6 +79,11 @@
|
|
|
79
79
|
# (decide the next operation, never pre-rehearse implementations in thought),
|
|
80
80
|
# and YAGNI/PDCA with no redundant comments. Runtime context snapshots stay
|
|
81
81
|
# enabled: they are durable user-role messages, not system-prompt text.
|
|
82
|
+
#
|
|
83
|
+
# The convergence bound is stated as "stop repeating an inspection whose answer
|
|
84
|
+
# you already hold", not as a turn count: a numeric cap is read at its strictest
|
|
85
|
+
# end and swallows the cheap check that would settle an open question, which is
|
|
86
|
+
# the opposite of what the fuse is for (2026-10-18).
|
|
82
87
|
- id: persona
|
|
83
88
|
name: '@deepseek-ai/dsh-persona'
|
|
84
89
|
config:
|
|
@@ -90,7 +95,7 @@
|
|
|
90
95
|
- Parallel Inspection: When several independent inspections, searches, or checks are needed, emit all of their tool calls in a single turn rather than across sequential rounds. The harness executes independent read-only calls in parallel. When two or more of those targets are the same kind of step, batch them into one run_code program instead and keep only its conclusion.
|
|
91
96
|
- Shell Discipline: Shell processes are ephemeral; directory changes do not persist across tool calls. Use compound commands (e.g. cd <path> && <cmd>) or pass workdir explicitly for operations in subdirectories.
|
|
92
97
|
- Development Standard: Follow YAGNI and the PDCA loop. Each step verifies a single assumption. Do not write redundant comments.
|
|
93
|
-
- Bounded Inspection & Convergence: Do not traverse dependency chains unbounded.
|
|
98
|
+
- Bounded Inspection & Convergence: Do not traverse dependency chains unbounded. Stop repeating an inspection whose answer you already hold: re-reading the same target to answer the same question is not progress. A concrete hypothesis with a cheap check is different: run it. Once core context is understood, immediately converge and begin answering or making edits. Verify edge cases during post-edit testing rather than over-reading upfront.
|
|
94
99
|
- Bounded Output: never dump a large or unbounded command output into the conversation. Filter at the source with grep/head/tail/wc and read the narrow range you actually need; the model's long-range attention is a bounded budget and raw logs evict the session's own constraints from it.
|
|
95
100
|
|
|
96
101
|
# The mode's preset-local plugins:
|
|
@@ -180,6 +185,25 @@
|
|
|
180
185
|
pagedToolPatterns: ['mcp__*']
|
|
181
186
|
maxResidentTokens: 8000
|
|
182
187
|
|
|
188
|
+
# ── the wire ────────────────────────────────────────────────────────────────
|
|
189
|
+
#
|
|
190
|
+
# `presentation` on the `tool-catalog` row above IS the wire. The plugin
|
|
191
|
+
# declares it on each agent scope through `agent.ctx.tools.presentAs` as soon
|
|
192
|
+
# as the scope exists, then re-assembles so the declaration reaches the
|
|
193
|
+
# request the model actually receives; `native` keeps the assembled roster,
|
|
194
|
+
# `ptc` collapses it to the single `run_code` transport. A deployment with no
|
|
195
|
+
# PTC runtime, a host that declines the declaration, or a wire that offers no
|
|
196
|
+
# schema projection keeps the native surface and warns once.
|
|
197
|
+
#
|
|
198
|
+
# The composition carries NO executor row. The 0.2.1-rc.3 SDK ships the
|
|
199
|
+
# presentation as a tool property selected through `presentAs`; it publishes no
|
|
200
|
+
# `@deepseek-ai/dsh-tool-executor-ptc`, so a row naming it never starts and the
|
|
201
|
+
# preset's load audit reports it alongside the rows that did mount (2026-10-26).
|
|
202
|
+
#
|
|
203
|
+
# The row ships `presentation: 'ptc'` because that is the shipped default, and
|
|
204
|
+
# the settings overlay rewrites the SAME key, so the settings switch and the
|
|
205
|
+
# composition never disagree.
|
|
206
|
+
|
|
183
207
|
- id: working-context
|
|
184
208
|
name: ./working-context.mjs
|
|
185
209
|
|
|
@@ -198,6 +222,19 @@
|
|
|
198
222
|
- id: fact-ledger
|
|
199
223
|
name: ./fact-ledger.mjs
|
|
200
224
|
|
|
225
|
+
# The child-route guard. The harness records a Session's authorized child
|
|
226
|
+
# routes as a durable `subagent/model-selection-policy` event, but its own
|
|
227
|
+
# delegation tool only rejects an EXPLICIT route outside that list: a call that
|
|
228
|
+
# names no `provider`/`model` inherits the parent route unchecked, and an
|
|
229
|
+
# inherit-only tool such as `subagent_fork` cannot name one at all. This row
|
|
230
|
+
# closes that gap on the preset plane — an allowlist-carrying Session must
|
|
231
|
+
# resolve every policed delegation to an authorized route, and a refusal names
|
|
232
|
+
# the routes that would work. It fails open on every fact it cannot read (no
|
|
233
|
+
# policy event, no session registry, no registry probe), so a Host that cannot
|
|
234
|
+
# answer keeps the harness's own delegation behavior.
|
|
235
|
+
- id: subagent-routes
|
|
236
|
+
name: ./subagent-routes.mjs
|
|
237
|
+
|
|
201
238
|
# The harness's workspace-instruction loader. Under the default
|
|
202
239
|
# `instructionSource: host` this row owns the channel: its baseline and dynamic
|
|
203
240
|
# user-role messages reach the model untouched. Under
|
|
@@ -367,33 +404,54 @@
|
|
|
367
404
|
- id: tool-subagent-control
|
|
368
405
|
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
369
406
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
#
|
|
374
|
-
#
|
|
375
|
-
|
|
376
|
-
#
|
|
377
|
-
#
|
|
378
|
-
#
|
|
379
|
-
#
|
|
407
|
+
# Do not add a `@deepseek-ai/dsh-tool-subagent-control/list-agents` row
|
|
408
|
+
# back: DSH 0.2.1-rc.3 dropped that subpath export, and the control row above
|
|
409
|
+
# registers `list_agents` from its own `apply()`. A row naming the removed
|
|
410
|
+
# subpath makes the whole preset fail to mount
|
|
411
|
+
# (`tool-subagent-list-agents ... never started`), issue #1940.
|
|
412
|
+
|
|
413
|
+
# Child-model selection is TWO upstream knobs and this row sets both:
|
|
414
|
+
# `modelSelection` publishes the `provider` / `model` /
|
|
415
|
+
# `reasoning_effort` parameters on `subagent` (an explicit route is
|
|
416
|
+
# checked against the Session's allowed list, falling back to the parent
|
|
417
|
+
# route when no policy was recorded), and `modelDiscovery` registers the
|
|
418
|
+
# `list_subagent_models` discovery tool. Without them an explicit
|
|
419
|
+
# selection fails with `child model selection is disabled for this tool
|
|
420
|
+
# instance` and the settings page's subagent toggle reads as dead.
|
|
421
|
+
#
|
|
422
|
+
# `modelSelectionSettings: true` is the PRE-SPLIT spelling of the same
|
|
423
|
+
# opt-in: one boolean that published the route fields AND registered
|
|
424
|
+
# discovery. The SDK pinned in this package's devDependencies
|
|
425
|
+
# (0.2.1-rc.3) still ships only that key, while the harness checkout this
|
|
426
|
+
# repository runs against has replaced it with the pair above. That
|
|
427
|
+
# loader's schema does not declare the retired name, so nothing reads it:
|
|
428
|
+
# Schemastery keeps the undeclared field but fills `modelSelection` and
|
|
429
|
+
# `modelDiscovery` with `false`, leaving the opt-in inert with no error
|
|
430
|
+
# to notice. Both spellings therefore ship together: each generation
|
|
431
|
+
# reads the key it knows and ignores the other, and neither host loses
|
|
432
|
+
# the opt-in. Delete `modelSelectionSettings` once no supported cohort
|
|
433
|
+
# predates the split.
|
|
380
434
|
#
|
|
381
|
-
# EXACTLY ONE delegation row per composition scope may
|
|
382
|
-
#
|
|
435
|
+
# EXACTLY ONE delegation row per composition scope may enable
|
|
436
|
+
# `modelDiscovery`: it registers the discovery tool under the FIXED name
|
|
383
437
|
# `list_subagent_models` in the scope the row composes into, and the tool
|
|
384
438
|
# registry refuses a second registration of one name in one scope, so a
|
|
385
|
-
# second
|
|
439
|
+
# second discovery owner fails the whole session with `tool
|
|
386
440
|
# 'list_subagent_models' is already registered in this scope`. The fork
|
|
387
|
-
# row below therefore
|
|
388
|
-
# PTC, and Cordis presets ship: their `tool-subagent` row opts
|
|
389
|
-
# their `tool-subagent-fork` row does not. Do not complete the
|
|
390
|
-
# fork row to match;
|
|
441
|
+
# row below therefore leaves discovery off, exactly as the builtin
|
|
442
|
+
# Standard, PTC, and Cordis presets ship: their `tool-subagent` row opts
|
|
443
|
+
# in and their `tool-subagent-fork` row does not. Do not complete the
|
|
444
|
+
# fork row to match; discovery belongs to the spawn row alone. The route
|
|
445
|
+
# fields alone are per instance upstream, and the fork row leaves those
|
|
446
|
+
# off too, matching the shipped official roster.
|
|
391
447
|
- id: tool-subagent
|
|
392
448
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
393
449
|
config:
|
|
394
450
|
provider: spawn
|
|
395
451
|
toolName: subagent
|
|
396
452
|
modelSelectionSettings: true
|
|
453
|
+
modelSelection: true
|
|
454
|
+
modelDiscovery: true
|
|
397
455
|
backgroundMode: continuable
|
|
398
456
|
|
|
399
457
|
- id: tool-subagent-fork
|