fix(repl): queue prompt guidance for next turn (#333)

Keep normal prompt submissions during generation queued instead of interrupting the current turn. Add a visible next-turn banner in the prompt area so users can tell their follow-up guidance was accepted, and cover the new behavior with focused tests.

Fixes #328

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
KRATOS
2026-04-04 17:57:59 +05:30
committed by GitHub
parent fbf3385395
commit cdc92d16e4
4 changed files with 147 additions and 8 deletions

View File

@@ -0,0 +1,35 @@
import React from 'react'
import { afterEach, beforeEach, describe, expect, it, mock } from 'bun:test'
import { renderToString } from '../../utils/staticRender.js'
describe('PromptInputQueuedCommands', () => {
beforeEach(() => {
mock.module('../../hooks/useCommandQueue.js', () => ({
useCommandQueue: () => [
{
value: 'Use another library',
mode: 'prompt',
},
],
}))
mock.module('src/state/AppState.js', () => ({
useAppState: (
selector: (state: { viewingAgentTaskId?: string; isBriefOnly: boolean }) => unknown,
) => selector({ viewingAgentTaskId: undefined, isBriefOnly: false }),
}))
})
afterEach(() => {
mock.restore()
})
it('shows a next-turn guidance banner for queued prompt messages', async () => {
const { PromptInputQueuedCommands } = await import('./PromptInputQueuedCommands.js')
const output = await renderToString(<PromptInputQueuedCommands />, 100)
expect(output).toContain('1 message queued for next turn')
expect(output).toContain('Use another library')
})
})