fix(cua-mcp): refuse unlisted tools before the executor and release the Agent after a failed close

A `tools/call` that names anything but the listed `cua_run_code` registration or
`cua_reset` now fails as an unknown tool before it reaches the tool executor, so a
tool another row registers for the connection's Agent cannot be called without
being listed, and the sandbox-escalation refusal applies to every program call.
`dispose()` releases the connection's Agent even when closing the protocol server
rejects. The `cua_reset` description states that a running program is cancelled,
and an `isEscalationField` guard replaces the two type assertions.

Documentation follows the code: the README states that a Host without a provider
lists only `cua_reset`, that the Web plugin page hides the bundle while the Host
inventory still reports it, that the documented Codex configuration carries the
output budget, which client entries were exercised, that the sandbox root is the
client's launch directory, and that the registration's escalation guidance has no
effect in this profile. The unused `zod` dependency is removed.
This commit is contained in:
Yichen Jiang committed 2026-11-10 18:12:20 +08:00
1 parent 1adc552f86
commit 2085a236cc
14 files changed
+92 -59

No files matched your search

+2 -2
View File
@@ -32,7 +32,7 @@ function bundle(name: string): { dir: string; patches: ReturnType<typeof loadOve
return { dir: entry.dir, patches: bundlePatchPaths(entry.dir, entry.manifest.dsh.bundle).flatMap(path => loadOverlayPatches('test', path)) }
}
/** Optional bundles that compose a profile of their own; the plugin page lists them without a switch. */
/** Optional bundles that compose a profile of their own; the plugin page hides them, the Host inventory still reports them. */
const STANDALONE_PROFILE_BUNDLES: readonly string[] = ['@deepseek-ai/dsh-cua-mcp']
const lightweight = [
@@ -109,7 +109,7 @@ describe('optional bundles', () => {
expect(OPTIONAL_BUNDLES).not.toContain('@deepseek-ai/dsh-experimental-inspector')
})
// A bundle that composes a profile of its own is never layered over a GUI profile; the plugin page lists it without a switch.
// A bundle that composes a profile of its own is never layered over a GUI profile; HIDDEN_BUNDLES keeps it off the plugin page.
const standalone = OPTIONAL_BUNDLES.filter(name => STANDALONE_PROFILE_BUNDLES.includes(name))
const layered = OPTIONAL_BUNDLES.filter(name => !standalone.includes(name))