fix(web): address review — placeholder key family, menu-open gate, plan precedence, note wording

This commit is contained in:
_Kerman
2026-08-07 14:20:14 +08:00
parent f79db87d8d
commit 4ede2798fe
6 changed files with 38 additions and 8 deletions

View File

@@ -22,7 +22,7 @@ export const zh = {
'input.commands': '命令',
'input.stop': '停止生成',
'input.send': '发送消息',
'input.steerQueueShortcut': 'Cmd/Ctrl+Enter 插话发送全部排队消息',
'placeholder.steerQueue': 'Cmd/Ctrl+Enter 插话发送全部排队消息',
'input.accessMode': '访问模式,当前:{name}',
'context.aria': '上下文已用 {percent}',
'context.used': '上下文已用',
@@ -163,7 +163,7 @@ export const en = {
'input.commands': 'Commands',
'input.stop': 'Stop generating',
'input.send': 'Send message',
'input.steerQueueShortcut': 'Cmd/Ctrl+Enter steers all queued messages',
'placeholder.steerQueue': 'Cmd/Ctrl+Enter steers all queued messages',
'input.accessMode': 'Access mode, current: {name}',
'context.aria': '{percent} of context used',
'context.used': 'of context used',

View File

@@ -89,7 +89,7 @@ export function InputBar({
const disabled = removed || inert || !live
const locked = disabled
const machineBusy = input?.phase === 'adjudicating' || input?.phase === 'submitting'
const canSteerQueue = !locked && !machineBusy && empty && running && subagent === null
const canSteerQueue = !locked && !machineBusy && !commandMenuOpen && empty && running && subagent === null
&& input.queue.some(row => row.placement === 'queued')
// Scroll the draft scrollport the minimum that brings `caret` into view — the
@@ -486,8 +486,11 @@ export function InputBar({
data-phase={input?.phase ?? 'inert'}
placeholder={placeholder ?? (disabled
? t('placeholder.unavailable')
// The steer hint deliberately outranks the plan placeholder:
// while it shows, the whole-queue gesture is genuinely available
// (the gate never consults plan mode), so the actionable hint wins.
: canSteerQueue
? t('input.steerQueueShortcut')
? t('placeholder.steerQueue')
: planActive ? t('placeholder.plan') : t('placeholder.default'))}
rows={2}
onChange={onChange}

View File

@@ -191,6 +191,33 @@ describe('Enter semantics', () => {
queue: [row('q-1')],
placeholder: '上层指定提示',
}).textarea.placeholder).toBe('上层指定提示')
// The command menu owns Enter while open: neither the hint nor the
// gesture may claim the chord.
expect(bench({
running: true,
queue: [row('q-1')],
commandMenuOpen: true,
}).textarea.placeholder).toBe('给智能体发消息')
// The steer hint intentionally outranks the plan placeholder: while it
// shows, the whole-queue gesture is genuinely available in plan mode.
expect(bench({
running: true,
queue: [row('q-1')],
plan: { active: true, pending: false },
}).textarea.placeholder).toBe('Cmd/Ctrl+Enter 插话发送全部排队消息')
})
it('an open command menu withholds the whole-queue steering gesture', () => {
const steerQueue = vi.fn()
const { textarea, sink } = bench({
running: true,
queue: [row('q-1')],
commandMenuOpen: true,
steerQueue,
})
fireEvent.keyDown(textarea, { key: 'Enter', metaKey: true })
expect(steerQueue).not.toHaveBeenCalled()
expect(sink).not.toHaveBeenCalled()
})
it('plain Enter submits queue mode through the machine; repeat and empty are suppressed', () => {