Files
orca/src/shared/queued-message-edit-command.ts
T
Brennan Benson 969c5ddd3a Support native Plan mode in chat (#38286)
* Add session Build and Plan choices to native chat

* Refresh planning choices across connected composers

* Give composer catalog tests a complete transport fixture

* Preserve planning choices through fresh turns and older hosts

* Type planning delivery fixture choices explicitly

* Honor mode capability for retained queued command picks

* Update existing native mode contract expectations

* Keep proposed plans visible in completed chat turns

* Group chat mode with permissions and goal controls

* Keep chat composer controls accessible in narrow panes

* Preserve composer overflow ownership and editor focus

* Complete composer localization catalog and subscription checks

* Keep chat composer controls contained in narrow panes

* Use the button spacing for compact Save

* Place chat mode immediately before Goal

* Restore Plan status test dependencies after main sync

* Show an exit pill only while chat Plan mode is active

* Remove obsolete composer tooltip translations

* Remove unused Build toggle catalog entries

* Apply Plan commands immediately from composer picks

* Preserve picked skill origin in composer admission

* Supply phone platform to composer regression fixture

* Preserve mode picks until their writer admits them

* Narrow the phone mode command before its draft transform

* Document the option fixture mutation shape

* Match phone Plan controls to the composer mode pills

* Assert optimistic mode feedback in the phone fixture

* Retain the phone mode pick recovery regression proof

* Use the relocated observation imports after the main merge

* Restore the composer IME module import after merging

* Read the queue assertion helper from its relocated owner

* Point the mode fixture at the relocated selection controller

* Register the phone Plan pill localization keys
2026-11-06 12:42:48 -08:00

35 lines
1.4 KiB
TypeScript

import { agentSessionInteractionCommand } from './agent-session/options/agent-session-interaction-mode'
import type { AgentType } from './agent-status/contracts/agent-status-types'
import type { AgentSessionSlashCommand } from './agent-session/agent-session-wire'
import {
prepareStructuredAgentSessionComposerCommand,
isStructuredAgentSessionGoalCommand
} from './agent-session/view/structured-agent-session-composer'
/** Provider prompt commands remain content; host actions cannot replace a queued body. */
export function queuedMessageEditAcceptsText(
text: string,
agent: AgentType,
reported: readonly AgentSessionSlashCommand[] | undefined,
hostSetsGoals: boolean,
hostSetsInteractionMode: boolean
): boolean {
return prepareQueuedMessageEditText(agent, reported, hostSetsGoals, hostSetsInteractionMode)(text)
}
export function prepareQueuedMessageEditText(
agent: AgentType,
reported: readonly AgentSessionSlashCommand[] | undefined,
hostSetsGoals: boolean,
hostSetsInteractionMode: boolean
): (text: string) => boolean {
const hostCommand = prepareStructuredAgentSessionComposerCommand(agent, reported)
return (text) =>
!(
hostCommand(text) ||
(hostSetsInteractionMode && agentSessionInteractionCommand(agent, text) !== null) ||
(hostSetsGoals && isStructuredAgentSessionGoalCommand(text)) ||
/^\/resume(?:\s|$)/i.test(text)
)
}