@linxin666/dsh-liangshen 0.1.15 → 0.1.16

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 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: ca2af81f8226b37d66dc3398fa5945d5383fbaba
6
- README.zh.md: 1f3aba838fe2af1296e400fe6aa6bfa66141738a
5
+ README.md: b7f13d1e7027a3f9fdf40f53d15bb96a736f8cf2
6
+ README.zh.md: 27da5569dd9068c83f7a64f8faa5f46683b8c3ad
package/README.md CHANGED
@@ -22,7 +22,8 @@ The preset ships with extra safeguards on top of the reference mechanism, all co
22
22
  - `maxBootstrapSteps` — fallback promotion after N steps when no anchored block appeared;
23
23
  - `promoteAfterFirstResponse` — a tool-less first response promotes once it has responded; an anchor-gated session also releases when its first turn ends (`turn/end`), so the next user turn already sees the promoted catalog;
24
24
  - `promotedPresentation: code` — after promotion the wire is Code Mode (PTC): one `run_code` tool with the full registry available through the generated SDK, switched at the step boundary so the current step's native calls are never interrupted;
25
- - `deferredSources` + `deferredGraceSteps` — workspace instructions and the skill catalog wait one extra step after promotion, so the tool-catalog switch and the injection shock do not land in the same step.
25
+ - `deferredSources` + `deferredGraceSteps` — workspace instructions and the skill catalog wait one extra step after promotion, so the tool-catalog switch and the injection shock do not land in the same step;
26
+ - `bootstrapMaxTokens` — caps the phase-1 request output budget (community measurements put `max_tokens=1024` in the high-hit "We need" window, versus 0/5 at the 256k DSH default), and the cap is stripped again after promotion so `requestProposal` never solders 1024 into every later request.
26
27
 
27
28
  Plan mode is supported: phase 1 filters the assembled prompt sections down to the one-line `deployment:persona`, and promotion restores all sections and appends the session's working directory to the persona, so the agent knows its workspace and the plan-mode `plan:policy` section takes effect for every step after promotion.
28
29
 
package/README.zh.md CHANGED
@@ -22,7 +22,8 @@ preset 在参考机制之上内置了额外保护,全部在 `agent.cordis.yml`
22
22
  - `maxBootstrapSteps`:N 步后仍无锚定块时强制晋升;
23
23
  - `promoteAfterFirstResponse`:首轮无工具调用的回答在响应后自动晋升;锚定门控中的会话也会在首轮结束时(`turn/end`)释放,因此新用户轮次一开始就拿到晋升后的目录;
24
24
  - `promotedPresentation: code`:晋升后 wire 为 Code Mode(PTC)——一个 `run_code` 工具、完整注册表通过生成 SDK 调用;切换发生在 step 边界,不会打断当前步的原生工具调用;
25
- - `deferredSources` + `deferredGraceSteps`:workspace 指令与 skill 目录在晋升后再等一步注入,工具目录切换和注入冲击不同时落地。
25
+ - `deferredSources` + `deferredGraceSteps`:workspace 指令与 skill 目录在晋升后再等一步注入,工具目录切换和注入冲击不同时落地;
26
+ - `bootstrapMaxTokens`:phase 1 请求的输出预算封顶(社区实测 `max_tokens=1024` 是 "We need" 轨迹的高命中窗口,DSH 默认 256k 命中率为 0),晋升后自动剥离该封顶,避免 `requestProposal` 把 1024 焊进后续每个请求。
26
27
 
27
28
  已支持 plan mode:phase 1 会把 prompt sections 过滤为仅剩一行 `deployment:persona`,晋升后恢复全部 sections 并在 persona 末尾追加所选工作区路径,因此 Agent 明确自己的工作目录,plan-mode 的 `plan:policy` 也在晋升后的每一步都生效。
28
29
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-liangshen",
3
3
  "description": "LiangShen (梁神) agent preset for the dsh web GUI: a two-phase anchored-standard preset — the first model request exposes only the builtin Minimal exact two-tool surface (persistent bash plus str_replace_editor) with no runtime contexts or injected instructions (Minimal-aligned trajectory anchor), promotion is gated on the first minimal-like reasoning block with a fallback, and the wire then switches to Code Mode (PTC, a single run_code tool over the full registry) with the ordinary injections returning afterwards. The preset files are synced into ~/.dsh/.agent-presets on host startup. Hot-pluggable — mounted via cordis.patch.yml + a profile node_modules symlink, no dsh source changes.",
4
- "version": "0.1.15",
4
+ "version": "0.1.16",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": "^22.19.0 || >=24.0.0"
@@ -52,7 +52,9 @@
52
52
  # first turn ends (`turn/end`). After promotion the catalog is presented as
53
53
  # Code Mode (PTC): a single `run_code` tool on the wire, switched at the step
54
54
  # boundary; workspace instructions and the skill catalog are deferred one
55
- # step after promotion.
55
+ # step after promotion. `bootstrapMaxTokens` caps the phase-1 request output
56
+ # budget (community-observed "We need" trigger window, 1024) and is stripped
57
+ # again after promotion so the cap never solders into later requests.
56
58
  - id: tool-bootstrap
57
59
  name: ./tool-bootstrap.mjs
58
60
  config:
@@ -62,6 +64,7 @@
62
64
  anchorGate: true
63
65
  maxBootstrapSteps: 4
64
66
  promoteAfterFirstResponse: true
67
+ bootstrapMaxTokens: 1024
65
68
  deferredSources: [agent-instructions, skill-catalog]
66
69
  deferredGraceSteps: 1
67
70
  promotedPresentation: code
@@ -1,3 +1,3 @@
1
1
  name: 梁神模式
2
- description: V4 Pro 专属,小南梁进化,梁神,启动!
2
+ description: 那模式一启动,使用者当场双腿一软瘫坐在地,仿佛看见原子弹爆炸——三秒,三辈子的代码,外加文言文、二进制、摩斯电码三语解说轮番轰炸,凡人最后只能趴在地上用下巴磕出两个字:梁神!
3
3
  order: 4
@@ -253,12 +253,16 @@ export function apply(ctx, config) {
253
253
  if (presentation !== 'native' && presentation !== 'code') {
254
254
  throw new TypeError(`${name}: promotedPresentation must be "native" or "code"`)
255
255
  }
256
+ const bootstrapMaxTokens = config.bootstrapMaxTokens === undefined
257
+ ? undefined
258
+ : integerAtLeast(config.bootstrapMaxTokens, 'bootstrapMaxTokens', 1)
256
259
  const policy = {
257
260
  anchorGate: config.anchorGate === true,
258
261
  promoteAfterFirstResponse: config.promoteAfterFirstResponse === true,
259
262
  maxBootstrapSteps: integerAtLeast(config.maxBootstrapSteps ?? 4, 'maxBootstrapSteps', 1),
260
263
  deferredGraceSteps: integerAtLeast(config.deferredGraceSteps ?? 0, 'deferredGraceSteps', 0),
261
264
  promotedPresentation: presentation,
265
+ bootstrapMaxTokens,
262
266
  }
263
267
 
264
268
  // Promotion is applied at step/turn boundaries, never while a step is still
@@ -333,4 +337,24 @@ export function apply(ctx, config) {
333
337
  }
334
338
  return decision
335
339
  }, { prepend: true })
340
+
341
+ // Phase 1 caps the next request output budget to bootstrapMaxTokens, the
342
+ // community-observed We-need trigger window (dsh-anchored-standard issue 6),
343
+ // and strips the cap again after promotion. The strip is mandatory:
344
+ // requestProposal(persistedHeader) carries a plain maxTokens from the
345
+ // previous header into the next request unless the adapter marked it a
346
+ // default, so an un-stripped cap would be soldered into every request.
347
+ ctx.on('agent/request', async (payload, next) => {
348
+ const resolved = await next()
349
+ const agent = payload?.agent
350
+ if (agent === undefined || policy.bootstrapMaxTokens === undefined) return resolved
351
+ const state = refresh(agent, policy)
352
+ if (state.promoted) {
353
+ if (resolved.maxTokens !== policy.bootstrapMaxTokens) return resolved
354
+ const rest = { ...resolved }
355
+ delete rest.maxTokens
356
+ return rest
357
+ }
358
+ return { ...resolved, maxTokens: policy.bootstrapMaxTokens }
359
+ }, { prepend: true })
336
360
  }