test(plan): cover the final-state tails and refresh the TUI golden
The idle /plan and /plan off command paths pin the immediate-commit copy; the chip's dead leaving/locked guard is deleted (both states disable the button, so no click reaches the handler); the multi-turn TUI golden is re-recorded keyless over the idle-commit wording and the standalone plan/mode narration ordering.
This commit is contained in:
@@ -15,8 +15,8 @@ buffer
|
|||||||
style 0-2 fg=bright-blue bold underline
|
style 0-2 fg=bright-blue bold underline
|
||||||
5| "Reply with exactly the word: ONE. No tools. "
|
5| "Reply with exactly the word: ONE. No tools. "
|
||||||
6| <blank>
|
6| <blank>
|
||||||
7| "Entering plan mode (applies from the next step). Use /plan off to leave. "
|
7| "Plan mode on. Use /plan off to leave. "
|
||||||
style 0-71 fg=bright-black
|
style 0-36 fg=bright-black
|
||||||
8| <blank>
|
8| <blank>
|
||||||
9| "Assistant "
|
9| "Assistant "
|
||||||
style 0-8 fg=bright-magenta bold underline
|
style 0-8 fg=bright-magenta bold underline
|
||||||
@@ -28,17 +28,17 @@ buffer
|
|||||||
13| "Model wait 0.0s · Completed 2026-07-21 12:00:00 "
|
13| "Model wait 0.0s · Completed 2026-07-21 12:00:00 "
|
||||||
style 0-46 dim
|
style 0-46 dim
|
||||||
14| <blank>
|
14| <blank>
|
||||||
15| "Leaving plan mode (applies from the next step). "
|
15| "Context · plan-mode "
|
||||||
style 0-46 fg=bright-black
|
|
||||||
16| <blank>
|
|
||||||
17| "You "
|
|
||||||
style 0-2 fg=bright-blue bold underline
|
|
||||||
18| "Reply with exactly the word: TWO. No tools. "
|
|
||||||
19| <blank>
|
|
||||||
20| "Context · plan-mode "
|
|
||||||
style 0-18 dim
|
style 0-18 dim
|
||||||
21| "The user switched this session back to the default mode. "
|
16| "The user switched this session back to the default mode. "
|
||||||
style 0-55 fg=bright-black
|
style 0-55 fg=bright-black
|
||||||
|
17| <blank>
|
||||||
|
18| "Plan mode off. "
|
||||||
|
style 0-13 fg=bright-black
|
||||||
|
19| <blank>
|
||||||
|
20| "You "
|
||||||
|
style 0-2 fg=bright-blue bold underline
|
||||||
|
21| "Reply with exactly the word: TWO. No tools. "
|
||||||
22| <blank>
|
22| <blank>
|
||||||
23| "Assistant "
|
23| "Assistant "
|
||||||
style 0-8 fg=bright-magenta bold underline
|
style 0-8 fg=bright-magenta bold underline
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export function PlanChip({ useProjection, locked, exitPlanMode }: PlanChipProps)
|
|||||||
if (!target) return null
|
if (!target) return null
|
||||||
|
|
||||||
const off = (): void => {
|
const off = (): void => {
|
||||||
if (leaving || locked) return
|
// No leaving/locked guard: both disable the button, so no click arrives.
|
||||||
setLeaving(true)
|
setLeaving(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
void exitPlanMode().then((failure) => {
|
void exitPlanMode().then((failure) => {
|
||||||
|
|||||||
@@ -607,6 +607,20 @@ describe('/plan', () => {
|
|||||||
expect(ctx.planMode.get(active)).toEqual({ active: false })
|
expect(ctx.planMode.get(active)).toEqual({ active: false })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('idle sessions get the immediate-commit copy on both /plan and /plan off', async () => {
|
||||||
|
const ctx = await setup()
|
||||||
|
await ctx.plugin(CommandService)
|
||||||
|
await new Promise(resolve => setImmediate(resolve))
|
||||||
|
const signal = new AbortController().signal
|
||||||
|
const agent = await agentWithSession(ctx, 'idle-plan-command', { status: 'idle' })
|
||||||
|
expect((await ctx.commands.execute(agent, '/plan', signal))?.result)
|
||||||
|
.toEqual({ kind: 'success', text: 'Plan mode on. Use /plan off to leave.' })
|
||||||
|
expect(foldPlanMode(agent.session.events)).toBe(true)
|
||||||
|
expect((await ctx.commands.execute(agent, '/plan off', signal))?.result)
|
||||||
|
.toEqual({ kind: 'success', text: 'Plan mode off.' })
|
||||||
|
expect(foldPlanMode(agent.session.events)).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
it('removes the contributed command when the plan-mode plugin is disposed', async () => {
|
it('removes the contributed command when the plan-mode plugin is disposed', async () => {
|
||||||
const ctx = new Context()
|
const ctx = new Context()
|
||||||
await ctx.plugin(SystemPrompt)
|
await ctx.plugin(SystemPrompt)
|
||||||
|
|||||||
Reference in New Issue
Block a user