@linxin666/dsh-liangshen 0.4.21 → 0.4.22
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 +2 -2
- package/README.zh.md +2 -2
- package/lib/client.js +5 -19
- package/lib/client.js.map +1 -1
- package/package.json +18 -18
- package/presets/liangshen/agent.cordis.yml +9 -7
- package/presets/liangshen/subagent-routes.mjs +52 -4
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`, while every host builtin stays resident; customizable via `pagedToolPatterns`) stay paged out of the wire and generated SDK 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.22",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "
|
|
8
|
+
"node": "^24.22.3 || >=26.13.1"
|
|
9
9
|
},
|
|
10
10
|
"main": "lib/index.js",
|
|
11
11
|
"types": "lib/types/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dsh": {
|
|
27
27
|
"engines": {
|
|
28
|
-
"dsh": ">=0.2.
|
|
28
|
+
"dsh": ">=0.2.3-alpha.2"
|
|
29
29
|
},
|
|
30
30
|
"bundle": {
|
|
31
31
|
"patch": "./cordis.patch.yml"
|
|
@@ -42,25 +42,25 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh": ">=0.2.
|
|
45
|
+
"@deepseek-ai/dsh": ">=0.2.3-alpha.2"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@deepseek-ai/schemastery": "
|
|
48
|
+
"@deepseek-ai/schemastery": "~3.20.0-alpha.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@deepseek-ai/cordis": "
|
|
52
|
-
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.
|
|
53
|
-
"@deepseek-ai/dsh-api-remotes": "^0.2.
|
|
54
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.2.
|
|
55
|
-
"@deepseek-ai/dsh-client-connection": "^0.2.
|
|
56
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.
|
|
57
|
-
"@deepseek-ai/dsh-client-store": "^0.2.
|
|
58
|
-
"@deepseek-ai/dsh-client-ui-conversation": "^0.2.
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.
|
|
62
|
-
"@deepseek-ai/dsh-settings": "^0.2.
|
|
63
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.
|
|
51
|
+
"@deepseek-ai/cordis": "~4.2.0-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.3-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-api-remotes": "^0.2.3-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.2.3-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-client-connection": "^0.2.3-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.3-alpha.2",
|
|
57
|
+
"@deepseek-ai/dsh-client-store": "^0.2.3-alpha.2",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.2.3-alpha.2",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.3-alpha.2",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.3-alpha.2",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.3-alpha.2",
|
|
62
|
+
"@deepseek-ai/dsh-settings": "^0.2.3-alpha.2",
|
|
63
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.3-alpha.2",
|
|
64
64
|
"@testing-library/react": "^16.1.0",
|
|
65
65
|
"@types/node": "^22.20.0",
|
|
66
66
|
"@types/react": "~18.3.1",
|
|
@@ -266,16 +266,18 @@
|
|
|
266
266
|
- id: fact-ledger
|
|
267
267
|
name: ./fact-ledger.mjs
|
|
268
268
|
|
|
269
|
-
# The child-route guard. The harness
|
|
270
|
-
#
|
|
269
|
+
# The child-route guard. The harness exposes a live `subagentModelSelection`
|
|
270
|
+
# service (`allowedRoutes()`) starting in 0.2.3-alpha.2 (and on older cohorts
|
|
271
|
+
# records `subagent/model-selection-policy` Session events), while its own
|
|
271
272
|
# delegation tool only rejects an EXPLICIT route outside that list: a call that
|
|
272
273
|
# names no `provider`/`model` inherits the parent route unchecked, and an
|
|
273
274
|
# inherit-only tool such as `subagent_fork` cannot name one at all. This row
|
|
274
|
-
# closes that gap on the preset plane — an allowlist
|
|
275
|
-
#
|
|
276
|
-
#
|
|
277
|
-
# policy event,
|
|
278
|
-
# answer keeps the harness's own
|
|
275
|
+
# closes that gap on the preset plane — whenever an allowlist is active, every
|
|
276
|
+
# policed delegation must resolve to an authorized route, and a refusal names the
|
|
277
|
+
# routes that would work. It fails open on every fact it cannot read (no live
|
|
278
|
+
# service / policy event, invalid settings error, no session registry, no
|
|
279
|
+
# registry probe), so a Host that cannot answer keeps the harness's own
|
|
280
|
+
# delegation behavior.
|
|
279
281
|
- id: subagent-routes
|
|
280
282
|
name: ./subagent-routes.mjs
|
|
281
283
|
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
* nobody named one — or, for `subagent_fork`, because the tool cannot name one
|
|
12
12
|
* at all.
|
|
13
13
|
*
|
|
14
|
-
* This row closes that gap from the preset plane.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* This row closes that gap from the preset plane. Starting in 0.2.3-alpha.2,
|
|
15
|
+
* the live `subagentModelSelection` service exposes `allowedRoutes()` directly;
|
|
16
|
+
* on older Hosts without that service it falls back to the recorded
|
|
17
|
+
* `subagent/model-selection-policy` Session event. Whenever an allowlist is in
|
|
18
|
+
* force, every delegation the row polices must resolve to an authorized route:
|
|
17
19
|
*
|
|
18
20
|
* - `explicit` tools publish `provider`/`model`; the call must name a complete
|
|
19
21
|
* pair, and that pair must be on the list;
|
|
@@ -140,6 +142,46 @@ export function policyRoutesOf(session) {
|
|
|
140
142
|
return undefined
|
|
141
143
|
}
|
|
142
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Normalize a raw route array returned by a live `subagentModelSelection` service.
|
|
147
|
+
* @param entries - Raw route entries.
|
|
148
|
+
* @returns normalized routes, or undefined when invalid.
|
|
149
|
+
*/
|
|
150
|
+
function normalizeRoutes(entries) {
|
|
151
|
+
if (!Array.isArray(entries)) return undefined
|
|
152
|
+
const routes = []
|
|
153
|
+
for (const entry of entries) {
|
|
154
|
+
const route = asRecord(entry)
|
|
155
|
+
const provider = asString(route?.['provider'])
|
|
156
|
+
const model = asString(route?.['model'])
|
|
157
|
+
if (provider === undefined || model === undefined) return undefined
|
|
158
|
+
routes.push({ provider, model })
|
|
159
|
+
}
|
|
160
|
+
return routes
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Resolve authorized routes when the optional live `subagentModelSelection`
|
|
165
|
+
* service is mounted; when mounted, it is authoritative (returning `undefined`
|
|
166
|
+
* or throwing fails open without consulting stale session events).
|
|
167
|
+
* @param service - Optional `ctx.get('subagentModelSelection')` service instance.
|
|
168
|
+
* @returns `{ handled: true, routes }` when the live service is mounted, or
|
|
169
|
+
* `{ handled: false, routes: undefined }` when absent.
|
|
170
|
+
*/
|
|
171
|
+
export function liveServiceRoutes(service) {
|
|
172
|
+
if (typeof service?.allowedRoutes !== 'function') {
|
|
173
|
+
return { handled: false, routes: undefined }
|
|
174
|
+
}
|
|
175
|
+
let raw
|
|
176
|
+
try {
|
|
177
|
+
raw = service.allowedRoutes()
|
|
178
|
+
} catch {
|
|
179
|
+
return { handled: true, routes: undefined }
|
|
180
|
+
}
|
|
181
|
+
if (raw === undefined) return { handled: true, routes: undefined }
|
|
182
|
+
return { handled: true, routes: normalizeRoutes(raw) }
|
|
183
|
+
}
|
|
184
|
+
|
|
143
185
|
/**
|
|
144
186
|
* Resolve the allowlist a delegation from this agent must respect: the agent's
|
|
145
187
|
* own recorded policy, else the nearest ancestor Session that recorded one.
|
|
@@ -306,13 +348,17 @@ export function unauthorizedReason(toolName, provider, model, allowed) {
|
|
|
306
348
|
export function delegationDenialReason(input) {
|
|
307
349
|
const {
|
|
308
350
|
agent, toolName, args, sessions,
|
|
351
|
+
modelSelection,
|
|
352
|
+
getModelSelection,
|
|
309
353
|
explicitToolNames = DEFAULT_EXPLICIT_TOOLS,
|
|
310
354
|
inheritToolNames = DEFAULT_INHERIT_TOOLS,
|
|
311
355
|
probe,
|
|
312
356
|
} = input ?? {}
|
|
313
357
|
const mode = delegationModeOf(toolName, explicitToolNames, inheritToolNames)
|
|
314
358
|
if (mode === undefined) return undefined
|
|
315
|
-
const
|
|
359
|
+
const liveService = typeof getModelSelection === 'function' ? getModelSelection() : modelSelection
|
|
360
|
+
const live = liveServiceRoutes(liveService)
|
|
361
|
+
const allowed = live.handled ? live.routes : authorizedRoutesFor(agent, sessions)
|
|
316
362
|
if (allowed === undefined) return undefined
|
|
317
363
|
const named = namedRouteOf(args)
|
|
318
364
|
const complete = named.provider !== undefined && named.model !== undefined
|
|
@@ -358,11 +404,13 @@ export function installSubagentRoutes(ctx, config = {}) {
|
|
|
358
404
|
const explicitToolNames = Array.isArray(config.explicitTools) ? config.explicitTools : DEFAULT_EXPLICIT_TOOLS
|
|
359
405
|
const inheritToolNames = Array.isArray(config.inheritTools) ? config.inheritTools : DEFAULT_INHERIT_TOOLS
|
|
360
406
|
const sessions = typeof ctx?.get === 'function' ? ctx.get('sessions') : undefined
|
|
407
|
+
const getModelSelection = typeof ctx?.get === 'function' ? () => ctx.get('subagentModelSelection') : undefined
|
|
361
408
|
return tools.guard(execution => delegationDenialReason({
|
|
362
409
|
agent: execution?.agent,
|
|
363
410
|
toolName: execution?.name,
|
|
364
411
|
args: execution?.arguments,
|
|
365
412
|
sessions,
|
|
413
|
+
getModelSelection,
|
|
366
414
|
explicitToolNames,
|
|
367
415
|
inheritToolNames,
|
|
368
416
|
probe: (agent, toolName) => routeParameterProbe(tools, agent, toolName),
|