chore(examples): make todo_write opt-in for the tui-agent example

Make todo_write opt-in for the tui-agent example (disabled by default; TUI
still renders plans when the tool is loaded). Both enabled and disabled cases
covered by tests.
This commit is contained in:
Turtle
2026-07-22 10:55:20 +08:00
parent f503d838e9
commit a5dfffcbe5
4 changed files with 70 additions and 1 deletions

View File

@@ -47,6 +47,12 @@ interface Scenario {
childSessions?: number
recorded: boolean
seedWorkspace?: boolean
/**
* Load the opt-in `todo_write` tool for this scenario. The shipped tui-agent
* config omits it, so only the todo-plan scenario (the enabled-path proof)
* mounts it; the rest cover the default, todo-free composition.
*/
enableTodo?: boolean
}
const SCENARIOS: Scenario[] = [
@@ -62,6 +68,7 @@ const SCENARIOS: Scenario[] = [
expectedTools: ['todo_write'],
expectedEventCounts: { 'todo/write': 1 },
recorded: true,
enableTodo: true,
},
{
name: 'bash-terminal-card',
@@ -196,7 +203,9 @@ async function mountScenarioContext(
await ctx.plugin(FsPolicy)
await ctx.plugin(ToolFs)
await ctx.plugin(UserInteractionService)
await ctx.plugin(ToolTodo)
// todo_write is opt-in: only the todo-plan scenario mounts it, matching the shipped
// config that omits it. The other scenarios prove the default todo-free composition.
if (scenario.enableTodo === true) await ctx.plugin(ToolTodo)
await ctx.plugin(SubagentService)
await ctx.plugin(SubagentSpawn, { providerName: 'spawn' })
await ctx.plugin(ToolSubagent, { provider: 'spawn', toolName: 'subagent', enableRunInBackground: false })