fix(web): stop leaking ask_user_question into every preset
`ui-question`'s node half called `ctx.tools.register` on the host context. `ScopedLayers.merge()` combines the global layer with the agent's exact-scope layer, and an unscoped registration lands in the global one — so the tool reached every agent no matter which preset composed it. `core-web`, sold as a two-tool benchmark surface, really presented three. Rendering a question is a host UI capability; having the tool is an agent capability, and only a preset decides that. The node half is now empty and the `tool-ask-user` row moved into the preset that wants it. The TUI keeps its own row, having no presets. The composition tests now assert the global tool layer is EMPTY, which is the invariant that would have caught this: any tool outside a preset reaches every agent. The browser lane's composition, seeded-history, and hermetic-skill assertions address their registries through a composed agent for the same reason — those services are per session now, and the host cannot resolve an `isolate` realm by name.
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
/**
|
||||
* Web question plugin, node half: enabling this UI feature also exposes the
|
||||
* model-facing ask_user_question tool on the host composition.
|
||||
* Web question plugin, node half.
|
||||
*
|
||||
* Deliberately empty. Mounting `ask_user_question` here put it in the tools
|
||||
* registry's GLOBAL layer, so every agent saw it no matter which preset
|
||||
* composed it — a two-tool benchmark preset actually presented three, and a
|
||||
* locally authored `bash-only` preset presented two. Rendering a question is
|
||||
* a host UI capability; having the tool is an agent capability, and only a
|
||||
* preset decides that. The `tool-ask-user` row belongs in the presets that
|
||||
* want it (and in the TUI composition, which has no presets).
|
||||
*/
|
||||
import type { Context } from 'cordis'
|
||||
import * as toolAskUser from '@deepseek-ai/dsh-tool-ask-user'
|
||||
|
||||
/** Host services required by the model-facing tool. */
|
||||
export const inject = ['tools', 'userInteraction']
|
||||
|
||||
/**
|
||||
* Mount ask_user_question for hosts that selected the Web question plugin.
|
||||
* @param ctx - Host plugin context carrying tools and userInteraction.
|
||||
*/
|
||||
export function apply(ctx: Context): void {
|
||||
toolAskUser.apply(ctx)
|
||||
}
|
||||
/** Host plugin body — the model-facing tool is composed per preset, not here. */
|
||||
export function apply(): void {}
|
||||
|
||||
Reference in New Issue
Block a user