dsh-lean-router 2.2.4 → 2.2.5

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/cordis.patch.yml CHANGED
@@ -93,9 +93,13 @@
93
93
 
94
94
  5. Tool choice. Inspect files with read/glob/grep; never use the shell to browse a file
95
95
  (no cat/head/tail/sed -n/find/ls -R). Piping a command's own output through head is fine.
96
- 6. Output budget. Batch independent calls into one step; pipe or redirect long output
96
+ 6. Output budget. Pipe or redirect long output
97
97
  (| head -40; redirect to $env:TEMP/out.log on PowerShell, %TEMP%\out.log in cmd, /tmp/out.log on POSIX).
98
98
  Never print a dump you could grep.
99
+ PARALLEL CALLS (tool calls sent together run concurrently)
100
+ read-only read/grep/glob/read_image: independent calls in ONE message overlap truly.
101
+ pwsh/edit/write run serially, yet batched they still cost one round trip.
102
+ Never batch a masked tool name: it rejects the whole batch, siblings never run.
99
103
  7. Programmatic tool mode, adaptively. Fold 3+ independent calls of one logical step into ONE
100
104
  run_code program; a single call may still go through a one-line program so its noise stays out
101
105
  of context. Measured: pays off on multi-file/repo work (up to 8x fewer turns) and is neutral on
@@ -616,9 +620,13 @@
616
620
 
617
621
  5. Tool choice. Inspect files with read/glob/grep; never use the shell to browse a file
618
622
  (no cat/head/tail/sed -n/find/ls -R). Piping a command's own output through head is fine.
619
- 6. Output budget. Batch independent calls into one step; pipe or redirect long output
623
+ 6. Output budget. Pipe or redirect long output
620
624
  (| head -40; redirect to $env:TEMP/out.log on PowerShell, %TEMP%\out.log in cmd, /tmp/out.log on POSIX).
621
625
  Never print a dump you could grep.
626
+ PARALLEL CALLS (tool calls sent together run concurrently)
627
+ read-only read/grep/glob/read_image: independent calls in ONE message overlap truly.
628
+ pwsh/edit/write run serially, yet batched they still cost one round trip.
629
+ Never batch a masked tool name: it rejects the whole batch, siblings never run.
622
630
  7. Programmatic tool mode, adaptively. Fold 3+ independent calls of one logical step into ONE
623
631
  run_code program; a single call may still go through a one-line program so its noise stays out
624
632
  of context. Measured: pays off on multi-file/repo work (up to 8x fewer turns) and is neutral on
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
- > English version of [changelog.md](./changelog.md). Versions follow package.json (currently 2.2.4).
3
+ > English version of [changelog.md](./changelog.md). Versions follow package.json (currently 2.2.5).
4
+
5
+ ## 2.2.5 (2026-11-29)
6
+
7
+ ### Changed
8
+
9
+ - **Concrete parallel-call guidance**: the generic "Batch independent calls into one step" line in persona rule 6 proved ineffective in practice — across 22165 assistant messages in the corpus, 91.65% carried a single tool call and only 4.68% carried two or more (10.88% under the lean-router preset). It is replaced by a 306-character block: independent `read`/`grep`/`glob`/`read_image` calls in one message really do overlap; `pwsh`/`edit`/`write` are serialized within a batch but still cost only one round trip; and a masked tool name must never be batched, because it rejects the whole batch and no sibling call runs.
10
+ - **No façade tool added**: tool calls are already a first-class batch primitive in the host (array input, default concurrency cap 10, results written back in model order) and nothing in this repo restricts parallelism, so this release changes guidance text only.
11
+ - persona suffix grows from 3862 to 4130 characters (+268), still inside the 4200-character ceiling.
12
+
13
+ ### Tests
14
+
15
+ - 12 new assertions (four read-only tool names, three write-oriented names, masked-name whole-batch rejection, block ≤320 characters, suffix ≤4200); the full suite is 240 tests, 239 passing, 0 failing, 1 skipped.
4
16
 
5
17
  ## 2.2.4 (2026-11-29)
6
18
 
package/docs/changelog.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # 变更记录(changelog)
2
2
 
3
- > 中文为主,英文版:[changelog.en.md](./changelog.en.md)。版本号遵循 package.json(当前 2.2.4)。
3
+ > 中文为主,英文版:[changelog.en.md](./changelog.en.md)。版本号遵循 package.json(当前 2.2.5)。
4
+
5
+ ## 2.2.5 (2026-11-29)
6
+
7
+ ### 变更
8
+
9
+ - **并行调用引导具体化**:persona 第 6 条里那句泛泛的 "Batch independent calls into one step" 实测无效——全语料 22165 条 assistant 消息中 91.65% 只携带一个工具调用,带两个及以上的仅 4.68%(lean-router 预设下 10.88%)。现改为一段 306 字符的具体引导:只读工具 `read`/`grep`/`glob`/`read_image` 的独立调用放进同一条消息可以真正重叠执行;`pwsh`/`edit`/`write` 同批虽被串行,但仍只花一次往返;不要把被遮挡的工具名混进同一批,否则整批被拒、兄弟调用都不执行。
10
+ - **不新增 façade 工具**:宿主侧 tool-calls 本身就是批量原语(数组入参、默认并发上限 10、结果按模型顺序写回),仓库侧没有任何代码限制并行,因此这一版只改引导文本。
11
+ - persona suffix 3862 → 4130 字符(+268),仍在 4200 字符上限内。
12
+
13
+ ### 测试
14
+
15
+ - 新增 12 条断言(四个只读工具名、三个写向工具名、遮挡整批拒绝、并行块 ≤320 字符、suffix ≤4200);全量 240 项、239 通过、0 失败、1 skip。
4
16
 
5
17
  ## 2.2.4 (2026-11-29)
6
18
 
@@ -56,9 +56,13 @@ export const LEAN_PERSONA_SUFFIX = [
56
56
  '',
57
57
  '5. Tool choice. Inspect files with read/glob/grep; never use the shell to browse a file',
58
58
  ' (no cat/head/tail/sed -n/find/ls -R). Piping a command\'s own output through head is fine.',
59
- '6. Output budget. Batch independent calls into one step; pipe or redirect long output',
59
+ '6. Output budget. Pipe or redirect long output',
60
60
  ' (| head -40; redirect to $env:TEMP/out.log on PowerShell, %TEMP%\\out.log in cmd, /tmp/out.log on POSIX).',
61
61
  ' Never print a dump you could grep.',
62
+ 'PARALLEL CALLS (tool calls sent together run concurrently)',
63
+ ' read-only read/grep/glob/read_image: independent calls in ONE message overlap truly.',
64
+ ' pwsh/edit/write run serially, yet batched they still cost one round trip.',
65
+ ' Never batch a masked tool name: it rejects the whole batch, siblings never run.',
62
66
  '7. Programmatic tool mode, adaptively. Fold 3+ independent calls of one logical step into ONE',
63
67
  ' run_code program; a single call may still go through a one-line program so its noise stays out',
64
68
  ' of context. Measured: pays off on multi-file/repo work (up to 8x fewer turns) and is neutral on',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-lean-router",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "description": "lean 省 token × 思考链路由 × code_run 工具遮蔽的 DSH cordis 插件(单 bundle:预设)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -46,9 +46,13 @@
46
46
 
47
47
  5. Tool choice. Inspect files with read/glob/grep; never use the shell to browse a file
48
48
  (no cat/head/tail/sed -n/find/ls -R). Piping a command's own output through head is fine.
49
- 6. Output budget. Batch independent calls into one step; pipe or redirect long output
49
+ 6. Output budget. Pipe or redirect long output
50
50
  (| head -40; redirect to $env:TEMP/out.log on PowerShell, %TEMP%\out.log in cmd, /tmp/out.log on POSIX).
51
51
  Never print a dump you could grep.
52
+ PARALLEL CALLS (tool calls sent together run concurrently)
53
+ read-only read/grep/glob/read_image: independent calls in ONE message overlap truly.
54
+ pwsh/edit/write run serially, yet batched they still cost one round trip.
55
+ Never batch a masked tool name: it rejects the whole batch, siblings never run.
52
56
  7. Programmatic tool mode, adaptively. Fold 3+ independent calls of one logical step into ONE
53
57
  run_code program; a single call may still go through a one-line program so its noise stays out
54
58
  of context. Measured: pays off on multi-file/repo work (up to 8x fewer turns) and is neutral on
@@ -36,9 +36,13 @@
36
36
 
37
37
  5. Tool choice. Inspect files with read/glob/grep; never use the shell to browse a file
38
38
  (no cat/head/tail/sed -n/find/ls -R). Piping a command's own output through head is fine.
39
- 6. Output budget. Batch independent calls into one step; pipe or redirect long output
39
+ 6. Output budget. Pipe or redirect long output
40
40
  (| head -40; redirect to $env:TEMP/out.log on PowerShell, %TEMP%\out.log in cmd, /tmp/out.log on POSIX).
41
41
  Never print a dump you could grep.
42
+ PARALLEL CALLS (tool calls sent together run concurrently)
43
+ read-only read/grep/glob/read_image: independent calls in ONE message overlap truly.
44
+ pwsh/edit/write run serially, yet batched they still cost one round trip.
45
+ Never batch a masked tool name: it rejects the whole batch, siblings never run.
42
46
  7. Programmatic tool mode, adaptively. Fold 3+ independent calls of one logical step into ONE
43
47
  run_code program; a single call may still go through a one-line program so its noise stays out
44
48
  of context. Measured: pays off on multi-file/repo work (up to 8x fewer turns) and is neutral on
@@ -50,6 +50,29 @@ test('persona-text.js 独立加载:lean 13 条 + 2 软门 + 自检题钩子 +
50
50
  assert.equal(m.PERSONA_PREFIX, 'You are a coding agent powered by the {{model}} model.');
51
51
  });
52
52
 
53
+ test('persona 并行调用引导:只读并发 + 写向同批省往返 + 遮挡整批拒绝(块 <=320,suffix <=4200)', async () => {
54
+ const m = await mod('persona-text.js');
55
+ const s = m.LEAN_PERSONA_SUFFIX;
56
+ // 事实 1:只读工具可真正重叠执行(tool-concurrency.js 给 glob/grep 打了 isConcurrencySafe)
57
+ for (const t of ['read', 'grep', 'glob', 'read_image']) {
58
+ assert.ok(s.includes(t), '并行引导缺只读工具名:' + t);
59
+ }
60
+ // 事实 2:写向/独占工具同批仍只算一次往返
61
+ for (const t of ['pwsh', 'edit', 'write']) {
62
+ assert.ok(s.includes(t), '并行引导缺写向工具名:' + t);
63
+ }
64
+ // 事实 3:混入被遮挡(masked)名字会让整批被拒、兄弟调用不执行
65
+ assert.ok(s.includes('masked'), '需提醒不要在同批混入被遮挡(masked)工具名');
66
+ // 体积上界:引导块本身极度精简,且 suffix 总长受控
67
+ const start = s.indexOf('PARALLEL CALLS');
68
+ assert.ok(start >= 0, '需有并行调用引导块');
69
+ const end = s.indexOf('7. Programmatic tool mode');
70
+ assert.ok(end > start, '并行引导块须位于规则 6 与规则 7 之间');
71
+ const block = s.slice(start, end).replace(/\n+$/, '');
72
+ assert.ok(block.length <= 320, '并行引导块须 <=320 字符,实为 ' + block.length);
73
+ assert.ok(s.length <= 4200, 'persona suffix 总长须 <=4200,实为 ' + s.length);
74
+ });
75
+
53
76
  test('plan-mode.js 独立加载:v1 政策段原文要点', async () => {
54
77
  const m = await mod('plan-mode.js');
55
78
  for (const needle of ['You are in plan mode.', 'exit_plan_mode', 'Do not use todo_write to track this planning phase', 'Make the plan decision-complete']) {