fix(tools): resolve the collapse through the scope, not the deployment default

`collapses()` read `defaultMode`, so the collapse only applied when the
DEPLOYMENT was `code`. An agent handed `code` by an agent preset under a
native default announced `[run_code]` on the wire and still executed a
model-direct native call -- the bypass this collapse exists to close,
reopened for exactly the composition `dsh-agent-tool-mode` produces.

`modeFor(scope)` is the same resolution `wireSchemas` and the SDK section
already use, so presentation and execution cannot disagree, and a mode
inherited from a standing preset scope collapses like a declared one.

The per-agent and preset tests asserted only the wire, which is why the
regression passed them. They now assert through the executor: the body
never runs, the call resolves UNKNOWN_TOOL, and the native sibling beside
it still executes.
This commit is contained in:
Yichen Jiang
2026-08-11 22:53:17 +08:00
parent 5d2c943d38
commit e258cf7a2d
5 changed files with 58 additions and 10 deletions
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/config-catalog.md
config-catalog.md: 6362022dd1b80e17997684574d9dc7f14372e23a
config-catalog.zh.md: 3fd335ee2b1ec6d1526f75ed9667f1d9286faafe
config-catalog.md: 39433b697588ede7b36f878490f4e0b095e8d67a
config-catalog.zh.md: d76b289f8a7ffbc434b2adeefd5f16142fdffc99
+1 -1
View File
@@ -2505,7 +2505,7 @@ export interface Config {
export type ToolPresentationMode = 'native' | 'code' | 'both'
```
Source: [`packages/core/tools/src/index.ts:629`](../packages/core/tools/src/index.ts)
Source: [`packages/core/tools/src/index.ts:654`](../packages/core/tools/src/index.ts)
## `@deepseek-ai/dsh-typert-loader`
+1 -1
View File
@@ -2506,7 +2506,7 @@ export interface Config {
export type ToolPresentationMode = 'native' | 'code' | 'both'
```
来源:[`packages/core/tools/src/index.ts:617`](../packages/core/tools/src/index.ts)
来源:[`packages/core/tools/src/index.ts:654`](../packages/core/tools/src/index.ts)
## `@deepseek-ai/dsh-typert-loader`