Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

A message is not typed into the engines' own screens that take the composer's place (#828)

Deedbef7f6f63fd
diff --git a/cli/e2e/harness/fakeEngine.mjs b/cli/e2e/harness/fakeEngine.mjs
index f4343e9bc..33f782d02 100644
--- a/cli/e2e/harness/fakeEngine.mjs
+++ b/cli/e2e/harness/fakeEngine.mjs
@@ -21,12 +21,14 @@
// process is, `!goal` and `!goal done` (Codex) start and achieve a goal the way Codex 0.160 shows one
// under its composer, `!browse` (Codex) leaves Codex browsing its transcript in its default fullscreen
// mode, and `!browse scrollback` in its scrollback mode, `!transcript` (Claude Code) leaves it in its
-// transcript view, as ctrl+o does, `!exit` ends the process.
+// transcript view, as ctrl+o does, `!overlay` (Codex) in its transcript overlay, as ctrl+t does in its
+// scrollback mode, `!search` searching its prompt history, as ctrl+r does, `!exit` ends the process.
// Everything else is echoed as the answer.
//
// Which release is installed is the config's business, so a test can update an engine in place by
// rewriting its wrapper: `version` is what it reports and writes, `without` lists the flags and
-// subcommands that release no longer has, and `startDelayMs` is how long it takes, once started, before
+// subcommands that release no longer has, `updateAvailable` (Codex) names a newer release it asks to update
+// to before it starts, and `startDelayMs` is how long it takes, once started, before
// it draws or announces anything (an engine's first run after an update). `firstHookDelayMs` is how long
// its first SessionStart takes to reach the daemon once the engine is up: the hook command starting on a
// loaded machine, while the daemon has already found the engine and its conversation. `realHooks` runs
@@ -82,6 +84,32 @@ export async function run(engine, config) {
// Slow to start, as an engine is on its first run after an update: the process is there and holds
// the terminal, and nothing is drawn, announced or read until it is ready.
if (config.startDelayMs) await new Promise((resolve) => setTimeout(resolve, config.startDelayMs))
+ // A newer release out (`updateAvailable`): Codex 0.160 asks first, before its session starts
+ // (update_prompt.rs, snapshot `update_prompt_modal`). It drops a paste; Enter takes the highlighted row,
+ // `Update now`, runs the update and asks to be restarted; Esc, 2 or ctrl+c skip it.
+ if (engine === 'codex' && config.updateAvailable) {
+ process.stdout.write(`\r\n \x1b[1mUpdate available\x1b[0m\x1b[2m · \x1b[0m${config.version ?? '0.159.0'} → ${config.updateAvailable}\r\n`
+ + ' \x1b[2mRelease notes: \x1b[0mhttps://github.com/openai/codex/releases/latest\r\n\r\n'
+ + '\x1b[36m› 1. Update now (runs `npm install -g @openai/codex`)\x1b[39m\r\n 2. Skip\r\n 3. Skip until next version\r\n\r\n'
+ + ' enter\x1b[2m continue · \x1b[0mesc\x1b[2m skip\x1b[0m\r\n')
+ // Input that came before the prompt was drawn is thrown away, as Codex does
+ // (`discard_pending_input_before_interactive_screen`).
+ while (process.stdin.read() !== null) { /* discarded */ }
+ const updateNow = await new Promise((resolve) => {
+ const keys = (chunk) => {
+ for (const token of String(chunk).match(/\x1b\[200~[\s\S]*?(?:\x1b\[201~|$)|\x1b\[[0-9;]*[A-Za-z~]|\x1b|[\s\S]/g) ?? []) {
+ if (token === '\r' || token === '\n' || token === '1') { process.stdin.off('data', keys); resolve(true); return }
+ if (token === '\x1b' || token === '2' || token === '3' || token === '\x03') { process.stdin.off('data', keys); resolve(false); return }
+ }
+ }
+ process.stdin.on('data', keys)
+ })
+ if (updateNow) {
+ process.stdout.write('\x1b[H\x1b[2JUpdating Codex via `npm install -g @openai/codex`...\r\n\r\n🎉 Update ran successfully! Please restart Codex.\r\n')
+ process.exit(0)
+ }
+ process.stdout.write('\x1b[H\x1b[2J')
+ }
const resumeAt = engine === 'claude' ? args.indexOf('--resume') : args.indexOf('resume')
const resumed = resumeAt >= 0 && args[resumeAt + 1] && !args[resumeAt + 1].startsWith('-') ? args[resumeAt + 1] : null
@@ -219,6 +247,22 @@ export async function run(engine, config) {
// hidden, and its footer row under a dim rule.
const transcriptBottom = (prompt, answer) => ({ transcript: true, pager: `\x1b[?1049h\x1b[H\x1b[2J\x1b[48;5;237m❯ ${prompt}\x1b[49m`
+ `\r\n\r\n⏺ ${answer}\x1b[998;1H\x1b[2m${'─'.repeat(60)}\x1b[0m\x1b[999;1H \x1b[2mShowing detailed transcript · ctrl+o to toggle · ctrl+e to show all\x1b[0m` })
+ // Codex's transcript overlay, ctrl+t, in its scrollback mode (pager_overlay/transcript.rs, snapshot
+ // `transcript_flag_off_viewer`): over the whole pane, its hints on the last rows.
+ const overlayBottom = (prompt, answer) => ({ overlay: true, prompt, answer, pager: `\x1b[?1049h\x1b[H\x1b[2J\x1b[2m/ T R A N S C R I P T ${'/ '.repeat(30)}\x1b[0m`
+ + `\r\n\r\n\x1b[1m›\x1b[0m ${prompt}\r\n\r\n\x1b[2m•\x1b[0m ${answer}\x1b[997;1H\x1b[2mCtrl+Space select\x1b[0m`
+ + '\x1b[998;1H\x1b[2m ↑/↓ to scroll · pgup/pgdn to page · home/end to jump\x1b[0m\x1b[999;1H\x1b[2m q close · f3 find · esc browse prompts\x1b[0m' })
+ // The prompts sent so far, newest last, which a search through the prompt history (ctrl+r) looks in.
+ const history = []
+ // Searching them, as each engine draws it under its composer: the match in the composer, and Claude
+ // Code's `search prompts: …` (or `no matching prompt: …`) or Codex's `reverse-i-search: …` footer.
+ const searchBottom = (query) => {
+ const match = query ? history.findLast((sent) => sent.toLowerCase().includes(query.toLowerCase())) ?? null : null
+ const footer = engine === 'claude'
+ ? ` \x1b[2m${query && !match ? 'no matching prompt:' : 'search prompts:'}\x1b[0m ${query}`
+ : ` \x1b[2mreverse-i-search: \x1b[0m${query} \x1b[2menter accept · esc cancel\x1b[0m`
+ return { search: true, query, match, composer: `› ${match ?? ''}`, footer }
+ }
const draw = (line = '') => {
if (bottom?.pager) { process.stdout.write(bottom.pager); return }
if (bottom && !line) {
@@ -341,6 +385,7 @@ export async function run(engine, config) {
const handle = async (raw) => {
const prompt = raw.trim()
if (!prompt) { draw(); return }
+ history.push(prompt)
if (prompt === '!exit') { process.stdout.write('\x1b[?2004l\r\n'); process.exit(0) }
if (prompt === '!compact') {
// `/compact` is a command, not a turn: a summary replaces the history, and Claude Code announces
@@ -487,6 +532,16 @@ export async function run(engine, config) {
finish(`answer ${turn}: ${prompt}`)
return
}
+ if (engine === 'codex' && directive?.[1] === 'overlay') {
+ bottom = overlayBottom(prompt, `answer ${turn}: ${prompt}`)
+ finish(`answer ${turn}: ${prompt}`)
+ return
+ }
+ if (directive?.[1] === 'search') {
+ bottom = searchBottom(directive[2] ?? '')
+ finish(`answer ${turn}: ${prompt}`)
+ return
+ }
if (engine === 'codex' && directive?.[1] === 'browse') {
// Reached in Codex by Esc twice on an empty composer; the directive goes straight there.
bottom = directive[2] === 'scrollback' ? pagerBottom(prompt, `answer ${turn}: ${prompt}`) : browsingBottom
@@ -519,6 +574,44 @@ export async function run(engine, config) {
if (!rest) return
chunk = rest
}
+ if (bottom?.overlay) {
+ // As Codex 0.160 takes input in its transcript overlay: q, ctrl+c or ctrl+t close it, Esc starts
+ // browsing prompts in it; a paste is dropped and Enter does nothing, so a message is lost there.
+ let rest = ''
+ for (const token of chunk.match(/\x1b\[200~[\s\S]*?(?:\x1b\[201~|$)|\x1b\[[0-9;]*[A-Za-z~]|\x1b|[\s\S]/g) ?? []) {
+ if (!bottom?.overlay) rest += token
+ else if (token === 'q' || token === '\x03' || token === '\x14') { process.stdout.write('\x1b[?1049l'); bottom = null; draw() }
+ else if (token === '\x1b') { bottom = pagerBottom(bottom.prompt, bottom.answer); draw() }
+ }
+ if (!rest) return
+ chunk = rest
+ }
+ if (bottom?.search) {
+ // As each engine takes input while searching its prompt history. A paste and typing extend the
+ // search. Claude Code's Enter SENDS the earlier prompt found (2.1.289, historySearch:execute), its Esc
+ // puts it in the prompt, its ctrl+c leaves the prompt as it was; Codex's Enter puts the match in the
+ // composer (chat_composer/history_search.rs), its Esc and ctrl+c leave the composer as it was.
+ let rest = ''
+ const leave = (draft) => {
+ process.stdout.write('\r\n\x1b[2K\x1b[1A')
+ bottom = null
+ buffer = draft
+ draw(buffer)
+ }
+ for (const token of chunk.match(/\x1b\[200~[\s\S]*?(?:\x1b\[201~|$)|\x1b\[[0-9;]*[A-Za-z~]|\x1b|[\s\S]/g) ?? []) {
+ if (!bottom?.search) { rest += token; continue }
+ const { query, match } = bottom
+ if (token.startsWith('\x1b[200~')) { bottom = searchBottom(query + token.slice(6).replace(/\x1b\[201~$/, '')); draw() }
+ else if (token === '\r' || token === '\n') {
+ if (engine === 'claude') { leave(''); if (query && match) queue = queue.then(() => handle(match)) }
+ else leave(match ?? '')
+ } else if (token === '\x03') leave('')
+ else if (token === '\x1b') leave(engine === 'claude' ? match ?? '' : '')
+ else if (token.length === 1 && token >= ' ') { bottom = searchBottom(query + token); draw() }
+ }
+ if (!rest) return
+ chunk = rest
+ }
if (bottom?.browsing) {
// As Codex 0.160 takes input while browsing (app.rs, app_backtrack): Esc goes back to the composer
// and Enter reverts the conversation to the prompt in view, in both modes; arrows and hjkl move
diff --git a/cli/e2e/input-safety.e2e.ts b/cli/e2e/input-safety.e2e.ts
index 431367c20..e3ece525c 100644
--- a/cli/e2e/input-safety.e2e.ts
+++ b/cli/e2e/input-safety.e2e.ts
@@ -117,6 +117,49 @@ describe('what a message must never do', () => {
client.close()
})
+ it('codex: a message is not lost in its transcript overlay (ctrl+t): refused with the reason, it goes through once the overlay is closed', async () => {
+ const d = await fresh()
+ const client = await LocalClient.connect(d)
+ const agent = await create(d, client, 'codex', 'transcript-overlay')
+ await turn(client, agent.id, '!overlay')
+ await until('the overlay to be drawn', async () => (await d.capture(agent.tmuxPane)).includes('T R A N S C R I P T') || null, 15_000, 250)
+ const from = client.frames.length
+ const refused = client.next((frame) => frame.type === 'error' && frame.agentId === agent.id, 15_000, 'the refusal')
+ client.send('message', { agentId: agent.id, content: 'and the logout bug?' })
+ expect(String((await refused).payload?.message)).toBe('Codex is showing its transcript (ctrl+t), where a message is not typed. Close it with q in its terminal, then send the message again.')
+ expect(client.frames.slice(from).some(isTurn('turn_started', agent.id))).toBe(false)
+ // Closed with q, as the refusal says, the same message goes through.
+ await d.tmux.run('send-keys', '-t', agent.tmuxPane, 'q')
+ await until('the composer to be back', async () => !(await d.capture(agent.tmuxPane)).includes('T R A N S C R I P T') || null, 15_000, 250)
+ await turn(client, agent.id, 'and the logout bug?')
+ client.close()
+ })
+
+ it.each(engines)('%s: a message is not typed into a search of the prompt history (ctrl+r), where it would become the search, and Claude Code\'s Enter would send an earlier prompt', async (engine) => {
+ const d = await fresh()
+ const client = await LocalClient.connect(d)
+ const agent = await create(d, client, engine, `history-search-${engine}`)
+ await turn(client, agent.id, 'fix the login bug please')
+ await turn(client, agent.id, '!search')
+ const footer = engine === 'claude' ? 'search prompts:' : 'reverse-i-search:'
+ await until('the search to be drawn', async () => (await d.capture(agent.tmuxPane)).includes(footer) || null, 15_000, 250)
+ const from = client.frames.length
+ const refused = client.next((frame) => frame.type === 'error' && frame.agentId === agent.id, 15_000, 'the refusal')
+ client.send('message', { agentId: agent.id, content: 'fix the login bug' })
+ expect(String((await refused).payload?.message)).toBe(engine === 'claude'
+ ? 'Claude Code is searching its prompt history (ctrl+r), where Enter would send an earlier prompt. Close it with ctrl+c in its terminal, then send the message again.'
+ : 'Codex has a search open, where a message would become what it searches for. Close it with Esc in its terminal, then send the message again.')
+ expect(client.frames.slice(from).some(isTurn('turn_started', agent.id))).toBe(false)
+ // Closed as the refusal says, the same message goes through, as itself.
+ await d.tmux.run('send-keys', '-t', agent.tmuxPane, engine === 'claude' ? 'C-c' : 'Escape')
+ await until('the search to be closed', async () => !(await d.capture(agent.tmuxPane)).includes(footer) || null, 15_000, 250)
+ const started = client.next(isTurn('turn_started', agent.id), 45_000, 'turn_started')
+ await turn(client, agent.id, 'fix the login bug')
+ expect(JSON.stringify((await started).payload)).toContain('fix the login bug')
+ expect(JSON.stringify((await started).payload)).not.toContain('please')
+ client.close()
+ })
+
it.each(engines)('%s: keystrokes queued for a terminal whose engine exited are the person\'s own to send', async (engine) => {
// The terminal is a terminal: what a person types into the pane goes to whatever runs there. The
// composer is what must never type into a shell; this pins that the two stay apart.
diff --git a/cli/e2e/updates.e2e.ts b/cli/e2e/updates.e2e.ts
index fa2a6b7a4..6b013becb 100644
--- a/cli/e2e/updates.e2e.ts
+++ b/cli/e2e/updates.e2e.ts
@@ -18,7 +18,7 @@ type Row = Record<string, any>
const engines: Engine[] = ['claude', 'codex']
/** A release of the fake engine, as e2e/harness/fakeEngine.mjs reads it from its config. */
-interface Release { version?: string; without?: string[]; startDelayMs?: number }
+interface Release { version?: string; without?: string[]; startDelayMs?: number; updateAvailable?: string }
const OLD: Record<Engine, string> = { claude: '2.1.270', codex: '0.159.0' }
const NEW: Record<Engine, string> = { claude: '2.1.271', codex: '0.160.0' }
const versionLine = (engine: Engine, version: string) => engine === 'claude' ? `${version} (Claude Code)` : `codex-cli ${version}`
@@ -313,4 +313,33 @@ describe('engines updated in place', () => {
expect(await runningVersion(client, id)).toBe(versionLine(engine, NEW[engine]))
client.close()
})
+
+ it('codex: a message sent while Codex asks whether to update does not update it: refused with the reason, it goes through once the question is answered', async () => {
+ // Codex asks at startup when a newer release is out, before its conversation starts; the prompt drops
+ // a paste and takes the Enter behind it as `Update now`, the highlighted row.
+ const d = await fresh()
+ const client = await LocalClient.connect(d)
+ install(d, 'codex', { version: OLD.codex, updateAvailable: NEW.codex })
+ const cwd = join(d.projectsDir, 'update-prompt')
+ mkdirSync(cwd, { recursive: true })
+ const created = await client.request('agent_create', { engine: 'codex', cwd, bypassPermission: true }, 90_000)
+ expect(created.error, JSON.stringify(created)).toBeUndefined()
+ const id: string = created.agent.id
+ const pane = String((await until('the engine process', async () => {
+ const now = await row(client, id)
+ return now?.tmuxPane && now.launch?.state === 'ready' ? now : null
+ }, 30_000, 100)).tmuxPane)
+ await until('the update prompt to be drawn', async () => (await d.capture(pane)).includes('Update available') || null, 30_000, 250)
+ const from = client.frames.length
+ const refused = client.next((frame) => frame.type === 'error' && frame.agentId === id, 15_000, 'the refusal')
+ client.send('message', { agentId: id, content: 'what changed?' })
+ expect(String((await refused).payload?.message)).toBe('Codex is asking whether to update. Answer it in its terminal, then send the message again.')
+ expect(await d.capture(pane)).not.toContain('Update ran successfully')
+ // Skipped in its terminal, Codex starts, and the same message goes through.
+ await d.tmux.run('send-keys', '-t', pane, 'Escape')
+ await bound(client, id)
+ await turn(client, id, 'what changed?')
+ expect(errorsFor(client, id, from)).toHaveLength(1)
+ client.close()
+ })
})
diff --git a/cli/src/lib/__fixtures__/takeoverScreens.ts b/cli/src/lib/__fixtures__/takeoverScreens.ts
new file mode 100644
index 000000000..9873a7641
--- /dev/null
+++ b/cli/src/lib/__fixtures__/takeoverScreens.ts
@@ -0,0 +1,168 @@
+/**
+ * Screens that take the composer's place in Claude Code 2.1.289 and Codex 0.160, where a pasted message
+ * and its Enter do something other than send it. Built from the engines' own code, read only: Codex's
+ * insta snapshots and render code at rust-v0.160.0 (the text and layout are theirs), Claude Code's
+ * bundled components (its Dialog pane: a rule in the dialog's colour, the bold title, the body, the dim
+ * italic key hints; its Select rows: `❯` on the highlighted row). Not captures: the engines were not run.
+ */
+
+const RULE = '─'.repeat(100)
+
+/** Codex at startup with a newer release out (update_prompt.rs, snapshot `update_prompt_modal`). Enter
+ * runs the update: its own test `update_prompt_confirm_selects_update`. A paste is ignored. */
+export const CODEX_UPDATE_PROMPT = [
+ '',
+ ' \u001b[1mUpdate available\u001b[0m\u001b[2m · \u001b[0m0.160.0 → 0.161.0',
+ ' \u001b[2mRelease notes: \u001b[0mhttps://github.com/openai/codex/releases/latest',
+ '',
+ '\u001b[36m› 1. Update now (runs `npm install -g @openai/codex`)\u001b[39m',
+ ' 2. Skip',
+ ' 3. Skip until next version',
+ '',
+ ' enter\u001b[2m continue · \u001b[0mesc\u001b[2m skip\u001b[0m',
+].join('\n')
+
+/** Codex asked to trust the folder it starts in (onboarding/trust_directory.rs). `Trust and continue` is
+ * highlighted, Enter saves the trust; a paste is ignored. */
+export const CODEX_TRUST_PROMPT = [
+ '> You are in \u001b[1m/tmp/project\u001b[0m',
+ '',
+ ' Trust this folder? Codex can read, edit, and run files here, subject to your permission settings.',
+ ' Folder settings can run code automatically, even without a model request. Continue only if you',
+ ' trust these files. Your trust decision will be saved.',
+ '',
+ '\u001b[36m› 1. Trust and continue\u001b[39m',
+ ' 2. Quit',
+ '',
+ ' enter\u001b[2m continue · \u001b[0mesc\u001b[2m quit\u001b[0m',
+].join('\n')
+
+/** The same question as 0.147 words it, captured live (`permission-codex.txt`). */
+export const CODEX_TRUST_PROMPT_0147 = [
+ '> \u001b[1mYou are in \u001b[0m/tmp/project',
+ '',
+ ' Do you trust the contents of this directory? Working with untrusted contents comes with higher risk of prompt injection.',
+ '',
+ '\u001b[38;5;6m› 1. Yes, continue\u001b[39m',
+ ' 2. No, quit',
+ '',
+ ' \u001b[2mPress enter to continue\u001b[0m',
+].join('\n')
+
+/** Codex offering a newer model at startup (model_migration.rs, snapshot `model_migration_prompt`).
+ * Enter, and Esc too, confirm the highlighted row, `Try new model`; a paste is ignored. */
+export const CODEX_MODEL_MIGRATION = [
+ '',
+ ' \u001b[1mCodex just got an upgrade. Introducing\u001b[0m',
+ ' \u001b[1mgpt-5.1-codex-max.\u001b[0m',
+ '',
+ ' Upgrade to gpt-5.2-codex for the latest and greatest',
+ ' agentic coding model.',
+ '',
+ ' You can continue using gpt-5.1-codex-mini if you prefer.',
+ '',
+ '\u001b[36m› 1. Try new model\u001b[39m',
+ ' 2. Use existing model',
+ '',
+ ' enter/esc\u001b[2m confirm · \u001b[0mctrl + c\u001b[2m quit\u001b[0m',
+].join('\n')
+
+/** Codex asking how to sign in (onboarding/auth.rs, its inline snapshot). Enter starts the highlighted
+ * sign-in; a paste is ignored. */
+export const CODEX_SIGN_IN = [
+ ' Choose how you want to use Codex.',
+ '',
+ '\u001b[36m> 1. Sign in with ChatGPT\u001b[39m',
+ ' \u001b[2mUsage included with Plus, Pro, Business, and Enterprise plans\u001b[0m',
+ '',
+ ' 2. Sign in with Device Code',
+ ' \u001b[2mSign in from another device with a one-time code\u001b[0m',
+ '',
+ ' 3. Use an OpenAI API key',
+ ' \u001b[2mPay for what you use\u001b[0m',
+ '',
+ ' \u001b[2mPress enter to continue\u001b[0m',
+].join('\n')
+
+/** Codex searching its prompt history, ctrl+r (chat_composer/history_search.rs, snapshot
+ * `history_search_pasted_query`): a paste extends the search and Enter only accepts the match into the
+ * composer, so the message becomes the search and an earlier prompt the draft. */
+export const CODEX_HISTORY_SEARCH = [
+ '\u001b[1m›\u001b[0m git status',
+ '',
+ '',
+ ' \u001b[2mreverse-i-search: \u001b[0mgit status \u001b[2menter accept · esc cancel\u001b[0m',
+].join('\n')
+
+/** Codex finding text in its transcript, F3 (transcript_view/search.rs): a paste becomes what it finds,
+ * and Enter goes to the next match. */
+export const CODEX_TRANSCRIPT_FIND = [
+ '\u001b[1m›\u001b[0m fix the login bug',
+ '',
+ '\u001b[2m•\u001b[0m Fixed: the session cookie was never refreshed.',
+ '',
+ '\u001b[1m›\u001b[0m \u001b[2mAsk Codex to do anything\u001b[0m',
+ '',
+ '\u001b[2mFind: \u001b[0mlogin \u001b[2menter next · ctrl+p previous · esc close\u001b[0m',
+].join('\n')
+
+/** Codex's transcript overlay, ctrl+t, in its scrollback mode (pager_overlay/transcript.rs, snapshot
+ * `transcript_flag_off_viewer`): over the whole pane, a paste is dropped and Enter does nothing. */
+export const CODEX_TRANSCRIPT_OVERLAY = [
+ `\u001b[2m/ T R A N S C R I P T ${'/ '.repeat(39)}\u001b[0m`,
+ '',
+ '\u001b[1m›\u001b[0m fix the login bug',
+ '',
+ '\u001b[2m•\u001b[0m Fixed: the session cookie was never refreshed.',
+ '',
+ '\u001b[2mCtrl+Space select\u001b[0m',
+ '\u001b[2m ↑/↓ to scroll · pgup/pgdn to page · home/end to jump\u001b[0m',
+ '\u001b[2m q close · f3 find · esc browse prompts\u001b[0m',
+].join('\n')
+
+/** Claude Code searching its prompt history, ctrl+r (2.1.289): the search line under the prompt, which
+ * shows the match. A paste extends the search and Enter SENDS the match, an earlier prompt; Esc puts it
+ * in the prompt, ctrl+c closes the search as it was. */
+export const CLAUDE_HISTORY_SEARCH = [
+ `\u001b[38;5;244m${RULE}\u001b[39m`,
+ '\u001b[39m❯ fix the login bug',
+ `\u001b[38;5;244m${RULE}\u001b[39m`,
+ ' \u001b[2msearch prompts:\u001b[0m login',
+].join('\n')
+
+/** The same with no match yet. */
+export const CLAUDE_HISTORY_SEARCH_NO_MATCH = CLAUDE_HISTORY_SEARCH.replace('search prompts:', 'no matching prompt:')
+
+/** Claude Code asked to trust the folder it starts in (2.1.289): its confirm lists `No, exit` first and
+ * highlights it, unnumbered, so Enter quits Claude Code. A paste is dropped. */
+export const CLAUDE_TRUST_PROMPT = [
+ `\u001b[38;5;220m${RULE}\u001b[39m`,
+ ' \u001b[1m\u001b[38;5;220mAccessing workspace:\u001b[0m',
+ '',
+ ' \u001b[1m/tmp/project\u001b[0m',
+ '',
+ ' Quick safety check: Is this a project you created or one you trust? (Like your own code, a well-known open',
+ ' source project, or work from your team). If not, take a moment to review what’s in this folder first.',
+ '',
+ ' Claude Code’ll be able to read, edit, and execute files here.',
+ '',
+ ' \u001b[2mSecurity guide\u001b[0m',
+ '',
+ ' \u001b[38;5;153m❯\u001b[39m \u001b[38;5;153mNo, exit\u001b[39m',
+ ' Yes, I trust this folder',
+ '',
+ ' \u001b[2m\u001b[3mEnter to confirm · Esc to cancel\u001b[0m',
+].join('\n')
+
+/** Claude Code asking how to sign in (2.1.289): Enter starts the highlighted sign-in. */
+export const CLAUDE_SIGN_IN = [
+ ' Claude Code can be used with your Claude subscription or billed based on API usage through your Console account.',
+ '',
+ ' Select login method:',
+ '',
+ ' \u001b[38;5;153m❯\u001b[39m \u001b[38;5;153m1. Claude account with subscription · \u001b[2mPro, Max, Team, or Enterprise\u001b[0m',
+ '',
+ ' 2. Anthropic Console account · \u001b[2mAPI usage billing\u001b[0m',
+ '',
+ ' 3. 3rd-party platform · \u001b[2mAmazon Bedrock, Microsoft Foundry, or Vertex AI\u001b[0m',
+].join('\n')
diff --git a/cli/src/lib/messageHold.spec.ts b/cli/src/lib/messageHold.spec.ts
index 19d4046a9..98bba4f78 100644
--- a/cli/src/lib/messageHold.spec.ts
+++ b/cli/src/lib/messageHold.spec.ts
@@ -4,6 +4,7 @@ import { isMessageHold, messageHold, messageHoldText, type MessageHold } from '.
import {
CLAUDE_PROMPT, CLAUDE_REWIND_CONFIRM, CLAUDE_REWIND_LIST, CODEX_BROWSING_FULLSCREEN, CODEX_BROWSING_SCROLLBACK, CODEX_PROMPT,
} from './__fixtures__/rewindPickers.js'
+import * as TAKEOVER from './__fixtures__/takeoverScreens.js'
const fixture = (name: string) => readFileSync(new URL(`./__fixtures__/${name}`, import.meta.url), 'utf8')
const RULE = '─'.repeat(100)
@@ -69,8 +70,63 @@ describe('what a message is not typed into', () => {
})
})
+describe('the engines\' own screens that take the composer\'s place', () => {
+ it('holds a message back from each one, where its Enter would do something else or it would be lost', () => {
+ const expected: Record<keyof typeof TAKEOVER, MessageHold> = {
+ CODEX_UPDATE_PROMPT: 'update_prompt_open',
+ CODEX_TRUST_PROMPT: 'trust_open',
+ CODEX_TRUST_PROMPT_0147: 'trust_open',
+ CODEX_MODEL_MIGRATION: 'model_prompt_open',
+ CODEX_SIGN_IN: 'sign_in_open',
+ CODEX_HISTORY_SEARCH: 'search_open',
+ CODEX_TRANSCRIPT_FIND: 'search_open',
+ CODEX_TRANSCRIPT_OVERLAY: 'transcript_open',
+ CLAUDE_HISTORY_SEARCH: 'search_open',
+ CLAUDE_HISTORY_SEARCH_NO_MATCH: 'search_open',
+ CLAUDE_TRUST_PROMPT: 'trust_open',
+ CLAUDE_SIGN_IN: 'sign_in_open',
+ }
+ for (const [name, hold] of Object.entries(expected)) {
+ const engine = name.startsWith('CLAUDE') ? 'claude' : 'codex'
+ expect(messageHold(engine, TAKEOVER[name as keyof typeof TAKEOVER]), name).toBe(hold)
+ }
+ })
+
+ it('is not fooled by their words in the conversation, above a ready composer', () => {
+ // The conversation can say anything; the screens are matched on their own rows and footers.
+ // (The pager's header counts only as the top row of the screen, which is the pager's own.)
+ const said = [
+ '• Its transcript pager has this header:',
+ '/ T R A N S C R I P T',
+ ' reverse-i-search: is what ctrl+r shows',
+ 'Find: the cookie bug',
+ ' Update available · 0.160.0 → 0.161.0',
+ '› 1. Update now (runs `npm install -g @openai/codex`)',
+ ' Trust this folder? Codex can read, edit, and run files here, it said.',
+ '› 1. Try new model',
+ '› 1. Sign in with ChatGPT',
+ ].join('\n')
+ expect(messageHold('codex', `${said}\n\n${CODEX_PROMPT}`)).toBeNull()
+ const claudeSaid = [
+ '⏺ search prompts: is what ctrl+r shows',
+ ' Quick safety check: Is this a project you created or one you trust?',
+ ' Select login method:',
+ ].join('\n')
+ expect(messageHold('claude', `${claudeSaid}\n${CLAUDE_PROMPT}`)).toBeNull()
+ // A startup question answered, the composer below it, is no longer open.
+ expect(messageHold('codex', `${TAKEOVER.CODEX_TRUST_PROMPT}\n\n${CODEX_PROMPT}`)).toBeNull()
+ expect(messageHold('codex', `${TAKEOVER.CODEX_UPDATE_PROMPT}\n\n${CODEX_PROMPT}`)).toBeNull()
+ expect(messageHold('claude', `${TAKEOVER.CLAUDE_TRUST_PROMPT}\n${CLAUDE_PROMPT}`)).toBeNull()
+ expect(messageHold('claude', `${TAKEOVER.CLAUDE_SIGN_IN}\n${CLAUDE_PROMPT}`)).toBeNull()
+ // Another engine's pane is not read for them.
+ expect(messageHold('cursor', TAKEOVER.CODEX_UPDATE_PROMPT)).toBeNull()
+ expect(messageHold('cursor', TAKEOVER.CLAUDE_HISTORY_SEARCH)).toBeNull()
+ })
+})
+
describe('what the person is told', () => {
- const holds: MessageHold[] = ['permission_open', 'question_open', 'menu_open', 'rewind_picker_open', 'transcript_open']
+ const holds: MessageHold[] = ['permission_open', 'question_open', 'menu_open', 'rewind_picker_open', 'transcript_open',
+ 'search_open', 'trust_open', 'update_prompt_open', 'model_prompt_open', 'sign_in_open']
it('names the engine, what is open, and exactly what lets the message through', () => {
expect(holds.map((hold) => messageHoldText('claude', hold))).toEqual([
@@ -79,7 +135,15 @@ describe('what the person is told', () => {
'Claude Code has a menu open, where Enter would pick from it. Close it with Esc in its terminal, then send the message again.',
'Claude Code has its Rewind menu open, where Enter would pick a point to rewind to. Close it with Esc in its terminal, then send the message again.',
'Claude Code is showing its transcript (ctrl+o), where a message is not typed. Close it with Esc in its terminal, then send the message again.',
+ 'Claude Code is searching its prompt history (ctrl+r), where Enter would send an earlier prompt. Close it with ctrl+c in its terminal, then send the message again.',
+ 'Claude Code is asking whether to trust this folder. Answer it in its terminal, then send the message again.',
+ 'Claude Code is asking whether to update. Answer it in its terminal, then send the message again.',
+ 'Claude Code is asking whether to switch to a new model. Answer it in its terminal, then send the message again.',
+ 'Claude Code is asking how to sign in. Sign in in its terminal, then send the message again.',
])
+ expect(messageHoldText('codex', 'transcript_open')).toBe('Codex is showing its transcript (ctrl+t), where a message is not typed. Close it with q in its terminal, then send the message again.')
+ expect(messageHoldText('codex', 'search_open')).toBe('Codex has a search open, where a message would become what it searches for. Close it with Esc in its terminal, then send the message again.')
+ expect(messageHoldText('codex', 'update_prompt_open')).toBe('Codex is asking whether to update. Answer it in its terminal, then send the message again.')
expect(messageHoldText('codex', 'permission_open')).toBe('Codex is asking for approval. Answer it first, in the app or in its terminal, then send the message again.')
expect(messageHoldText('codex', 'rewind_picker_open')).toBe('Codex is browsing its transcript, where Enter would rewind the conversation. Close it with Esc in its terminal, then send the message again.')
expect(messageHoldText('commandcode', 'permission_open')).toBe('Command Code is asking for permission. Answer it first, in the app or in its terminal, then send the message again.')
diff --git a/cli/src/lib/messageHold.ts b/cli/src/lib/messageHold.ts
index f2ee0346f..bdb60389d 100644
--- a/cli/src/lib/messageHold.ts
+++ b/cli/src/lib/messageHold.ts
@@ -13,7 +13,13 @@
* - a menu (model, effort and the other pickers) picks its highlighted row;
* - a picker for a point to rewind to rewinds, or loses the message (Codex's transcript browser,
* Claude Code's Rewind menu);
- * - Claude Code's transcript view (ctrl+o) loses it.
+ * - a transcript view loses it (Claude Code's, ctrl+o; Codex's overlay, ctrl+t, in its scrollback
+ * mode);
+ * - a search takes it as what to search for, and Claude Code's prompt-history search then SENDS the
+ * earlier prompt it found (ctrl+r);
+ * - the questions asked at startup take the Enter as their highlighted answer: trust the folder
+ * (Claude Code's highlights `No, exit`, and quits), run Codex's update, switch Codex's model, start
+ * a sign-in.
* So none of them is typed into. A question is answered through its own path (`question_response`),
* never by a message.
*
@@ -26,33 +32,28 @@ import { paneModal } from './runtimeProfileController.js'
/** Why a message was not typed, as the reason its delivery is refused with. */
export type MessageHold = 'permission_open' | 'question_open' | 'menu_open' | 'rewind_picker_open' | 'transcript_open'
+ | 'search_open' | 'trust_open' | 'update_prompt_open' | 'model_prompt_open' | 'sign_in_open'
-const HOLDS: ReadonlySet<string> = new Set<MessageHold>(['permission_open', 'question_open', 'menu_open', 'rewind_picker_open', 'transcript_open'])
+const HOLDS: ReadonlySet<string> = new Set<MessageHold>(['permission_open', 'question_open', 'menu_open', 'rewind_picker_open',
+ 'transcript_open', 'search_open', 'trust_open', 'update_prompt_open', 'model_prompt_open', 'sign_in_open'])
+
+/** The hold for each of the engines' own screens and modals (runtimeProfileController.ts `paneModal`). */
+const MODAL_HOLDS: Record<NonNullable<ReturnType<typeof paneModal>>, MessageHold> = {
+ rewind: 'rewind_picker_open', transcript: 'transcript_open', search: 'search_open', trust: 'trust_open',
+ update: 'update_prompt_open', model: 'model_prompt_open', sign_in: 'sign_in_open', permission: 'permission_open', menu: 'menu_open',
+}
/** The engines whose screens are read for more than a question: the menus, rewind pickers and views. */
const MODAL_ENGINES: ReadonlySet<string> = new Set(['claude', 'codex'])
-/**
- * Claude Code's transcript view (ctrl+o): the prompt is hidden, and the footer row starts
- * `Showing detailed transcript · ctrl+o to toggle`, after `dialog waiting · ` when a dialog sits behind
- * it (2.1.289). It has no Enter, so a message typed there is lost. Esc, q or ctrl+c close it.
- */
-const CLAUDE_TRANSCRIPT_FOOTER = /^\s*(?:dialog waiting · )?Showing detailed transcript\b/
-
-function claudeTranscriptOpen(capture: string): boolean {
- const lines = capture.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, '').split('\n').filter((line) => line.trim())
- return lines.slice(-3).some((line) => CLAUDE_TRANSCRIPT_FOOTER.test(line))
-}
-
/** What the pane shows that a message must not be typed into, or null when it can be typed. */
export function messageHold(engine: RegisteredSession['engine'], capture: string | null): MessageHold | null {
if (!capture) return null
const view = parseEngineQuestionPane(engine, capture)
if (view) return view.kind === 'question' && isApprovalDialog(view) ? 'permission_open' : 'question_open'
if (!MODAL_ENGINES.has(engine)) return null
- if (engine === 'claude' && claudeTranscriptOpen(capture)) return 'transcript_open'
const modal = paneModal(engine, capture)
- return modal === 'rewind' ? 'rewind_picker_open' : modal === 'permission' ? 'permission_open' : modal === 'menu' ? 'menu_open' : null
+ return modal ? MODAL_HOLDS[modal] : null
}
export function isMessageHold(reason: string): reason is MessageHold {
@@ -78,6 +79,20 @@ export function messageHoldText(engine: string, hold: MessageHold): string {
? 'Codex is browsing its transcript, where Enter would rewind the conversation. Close it with Esc in its terminal, then send the message again.'
: `${name} has its Rewind menu open, where Enter would pick a point to rewind to. Close it with Esc in its terminal, then send the message again.`
case 'transcript_open':
- return `${name} is showing its transcript (ctrl+o), where a message is not typed. Close it with Esc in its terminal, then send the message again.`
+ return engine === 'codex'
+ ? 'Codex is showing its transcript (ctrl+t), where a message is not typed. Close it with q in its terminal, then send the message again.'
+ : `${name} is showing its transcript (ctrl+o), where a message is not typed. Close it with Esc in its terminal, then send the message again.`
+ case 'search_open':
+ return engine === 'codex'
+ ? 'Codex has a search open, where a message would become what it searches for. Close it with Esc in its terminal, then send the message again.'
+ : `${name} is searching its prompt history (ctrl+r), where Enter would send an earlier prompt. Close it with ctrl+c in its terminal, then send the message again.`
+ case 'trust_open':
+ return `${name} is asking whether to trust this folder. Answer it in its terminal, then send the message again.`
+ case 'update_prompt_open':
+ return `${name} is asking whether to update. Answer it in its terminal, then send the message again.`
+ case 'model_prompt_open':
+ return `${name} is asking whether to switch to a new model. Answer it in its terminal, then send the message again.`
+ case 'sign_in_open':
+ return `${name} is asking how to sign in. Sign in in its terminal, then send the message again.`
}
}
diff --git a/cli/src/lib/runtimeProfileController.spec.ts b/cli/src/lib/runtimeProfileController.spec.ts
index 0c95ce902..91f1a2393 100644
--- a/cli/src/lib/runtimeProfileController.spec.ts
+++ b/cli/src/lib/runtimeProfileController.spec.ts
@@ -16,6 +16,7 @@ import {
CLAUDE_PROMPT, CLAUDE_REWIND_CONFIRM, CLAUDE_REWIND_EMPTY, CLAUDE_REWIND_LIST, CLAUDE_REWIND_LIST_MESSAGE_FOCUSED,
CODEX_BROWSING_FULLSCREEN, CODEX_BROWSING_SCROLLBACK, CODEX_PROMPT,
} from './__fixtures__/rewindPickers.js'
+import { CLAUDE_HISTORY_SEARCH, CLAUDE_TRUST_PROMPT, CODEX_TRANSCRIPT_FIND, CODEX_TRANSCRIPT_OVERLAY, CODEX_UPDATE_PROMPT } from './__fixtures__/takeoverScreens.js'
// The id inside a `runtime-v1:` string is the AGENT id ('h1' here) — a client only ever echoes back an id
// the catalog minted, and the catalog is agent-scoped. `setProfile` is still addressed with either id.
@@ -90,6 +91,18 @@ describe('runtime pane parsing', () => {
expect(paneModal('claude', '')).toBeNull()
})
+ it('reads the engines\' own screens that take the composer\'s place as dialogs, so no work is typed into them', () => {
+ // A ready-looking composer stays on screen under Codex's find and Claude Code's history search.
+ expect(inspectRuntimePane('codex', CODEX_TRANSCRIPT_FIND)).toMatchObject({ dialog: true, idle: false })
+ expect(paneModal('codex', CODEX_TRANSCRIPT_FIND)).toBe('search')
+ expect(inspectRuntimePane('claude', CLAUDE_HISTORY_SEARCH)).toMatchObject({ dialog: true, idle: false })
+ expect(paneModal('codex', CODEX_TRANSCRIPT_OVERLAY)).toBe('transcript')
+ expect(paneModal('codex', CODEX_UPDATE_PROMPT)).toBe('update')
+ expect(paneModal('claude', CLAUDE_TRUST_PROMPT)).toBe('trust')
+ // Codex browsing its transcript in its scrollback mode draws the same header: a rewind picker still.
+ expect(paneModal('codex', CODEX_BROWSING_SCROLLBACK)).toBe('rewind')
+ })
+
it('tells an approval prompt and a menu from the MCP boot notice, which takes typing and is no modal for a message', () => {
expect(paneModal('claude', ' Bash command\n printf hi\n Do you want to proceed?\n ❯ 1. Yes\n 2. No')).toBe('permission')
expect(paneModal('codex', 'Select Model and Effort\n› 1. gpt-5.6-sol (current)')).toBe('menu')
diff --git a/cli/src/lib/runtimeProfileController.ts b/cli/src/lib/runtimeProfileController.ts
index bd8109ca0..27ad07ba1 100644
--- a/cli/src/lib/runtimeProfileController.ts
+++ b/cli/src/lib/runtimeProfileController.ts
@@ -301,7 +301,7 @@ export function inspectRuntimePane(engine: RegisteredSession['engine'], capture:
const promptIndex = latestPromptLine(rawLines, marks)
const prompt = promptIndex >= 0 ? rawLines[promptIndex] : ''
const currentUi = currentPaneUi(rawLines, promptIndex)
- const dialog = DIALOG_UI.test(currentUi) || rewindPickerIn(engine, capture, currentUi)
+ const dialog = DIALOG_UI.test(currentUi) || takeoverIn(engine, capture, currentUi) !== null
const plan = engine === 'codex' ? /\bplan mode\b/i.test(currentUi) : /\bplan mode on\b/i.test(currentUi)
const marker = stripAnsi(prompt).search(marks)
let visible = marker >= 0 ? stripAnsi(prompt).slice(marker + 1).replace(/\u00a0/g, ' ').trim() : ''
@@ -330,27 +330,94 @@ function currentPaneUi(rawLines: string[], promptIndex: number): string {
return stripAnsi((promptIndex >= 0 ? rawLines.slice(promptIndex) : rawLines).join('\n')).replace(/\u00a0/g, ' ')
}
+/** A screen of Claude Code's or Codex's own that takes its composer's place (see [takeoverIn]). */
+export type PaneTakeover = 'rewind' | 'transcript' | 'search' | 'trust' | 'update' | 'model' | 'sign_in'
+
/**
* The modal over a Claude Code or Codex pane, read for a message about to be typed into it
- * (messageHold.ts): a picker for a point in the conversation to go back to (Codex browsing its
- * transcript, Claude Code's Rewind menu), an approval prompt, or another menu. Every one of them is a
- * dialog to [inspectRuntimePane], except the MCP boot notice: Claude Code takes typing while it shows,
- * so a message sent the moment an agent starts still goes in.
+ * (messageHold.ts): one of their own screens that takes the composer's place ([takeoverIn]), an
+ * approval prompt, or another menu. Every one of them is a dialog to [inspectRuntimePane], except the
+ * MCP boot notice: Claude Code takes typing while it shows, so a message sent the moment an agent
+ * starts still goes in.
*/
-export function paneModal(engine: RegisteredSession['engine'], capture: string): 'rewind' | 'permission' | 'menu' | null {
+export function paneModal(engine: RegisteredSession['engine'], capture: string): PaneTakeover | 'permission' | 'menu' | null {
const rawLines = capture.split('\n')
const currentUi = currentPaneUi(rawLines, latestPromptLine(rawLines, promptMarker(engine)))
- if (rewindPickerIn(engine, capture, currentUi)) return 'rewind'
+ const takeover = takeoverIn(engine, capture, currentUi)
+ if (takeover) return takeover
if (PERMISSION_UI.test(currentUi)) return 'permission'
return DIALOG_UI.test(currentUi.replace(/Starting MCP servers?/gi, '')) ? 'menu' : null
}
-function rewindPickerIn(engine: RegisteredSession['engine'], capture: string, currentUi: string): boolean {
- if (engine === 'codex') return CODEX_TRANSCRIPT_BROWSING.test(currentUi)
- if (engine === 'claude') return claudeRewindMenuOpen(capture)
- return false
+/**
+ * The screens of Claude Code 2.1.289 and Codex 0.160 that take the composer's place, where a pasted
+ * message and its Enter do something other than send it (read from their code, not run; the screens
+ * are in __fixtures__/rewindPickers.ts and takeoverScreens.ts):
+ * - rewind: a picker for a point in the conversation to go back to, whose Enter picks one;
+ * - transcript: Claude Code's transcript view (ctrl+o) and Codex's transcript overlay (ctrl+t, in its
+ * scrollback mode), which drop the paste and have no Enter: the message is lost;
+ * - search: a search through the prompt history (ctrl+r), or Codex's find in its transcript (F3),
+ * which takes the paste as what to search for; Claude Code's Enter then SENDS the earlier prompt it
+ * found, Codex's puts it in the composer or goes to the next match;
+ * - trust, update, model, sign_in: the questions Codex asks at startup (trust this folder, update
+ * now, switch to a new model, how to sign in) and Claude Code's trust and sign-in screens, which
+ * drop the paste and take the Enter as the highlighted answer: trust the folder (Claude Code's
+ * highlights `No, exit`, so it quits), run the update, switch the model, start a sign-in.
+ * Each is matched on its own wording and rows, not on a guess at what is missing from the screen.
+ */
+function takeoverIn(engine: RegisteredSession['engine'], capture: string, currentUi: string): PaneTakeover | null {
+ if (engine !== 'claude' && engine !== 'codex') return null
+ const lines = stripAnsi(capture).replace(/\u00a0/g, ' ').split('\n')
+ const bottom = lines.filter((line) => line.trim()).slice(-3)
+ // A startup screen is the last thing on the pane: one with a composer below it was answered.
+ const composer = engine === 'codex'
+ ? lines.findLastIndex((line) => /^\s*›/.test(line) && !/^\s*›\s*\d+\.\s/.test(line))
+ : lines.findLastIndex((line, index) => /^\s*❯/.test(line) && index > 0 && /^\s*[─━]{8,}\s*$/.test(lines[index - 1]))
+ const shown = (...patterns: RegExp[]) => patterns.every((pattern) => lines.findLastIndex((line) => pattern.test(line)) > composer)
+ if (engine === 'codex') {
+ if (CODEX_TRANSCRIPT_BROWSING.test(currentUi)) return 'rewind'
+ if (CODEX_PAGER_HEADER.test(lines.find((line) => line.trim()) ?? '')) return 'transcript'
+ if (bottom.some((line) => CODEX_SEARCH_FOOTER.test(line))) return 'search'
+ if (shown(CODEX_TRUST_QUESTION, CODEX_TRUST_ROW)) return 'trust'
+ if (shown(/^\s*Update available\b/, CODEX_UPDATE_ROW)) return 'update'
+ if (shown(/^\s*[›>]?\s*1\. Try new model\s*$/, /^\s*[›>]?\s*2\. Use existing model\s*$/)) return 'model'
+ if (shown(/^\s*[›>]?\s*1\. Sign in with ChatGPT\s*$/)) return 'sign_in'
+ return null
+ }
+ if (claudeRewindMenuOpen(capture)) return 'rewind'
+ if (bottom.some((line) => CLAUDE_TRANSCRIPT_FOOTER.test(line))) return 'transcript'
+ if (bottom.some((line) => CLAUDE_HISTORY_SEARCH.test(line))) return 'search'
+ if (shown(/Quick safety check: Is this a project you created or one you trust\?/, /^\s*(?:❯\s*)?Yes, I trust this folder\s*$/)) return 'trust'
+ if (shown(/^\s*Select login method:\s*$/, /^\s*(?:❯\s*)?1\. Claude account with subscription\b/)) return 'sign_in'
+ return null
}
+/** The header of Codex's pager over the whole pane, its top row: its transcript (ctrl+t) when it is not
+ * on the composer's screen (pager_overlay/transcript.rs). Closed with q or ctrl+t; Esc browses prompts. */
+const CODEX_PAGER_HEADER = /^\/ T R A N S C R I P T(?: \/)*\s*$/
+
+/** Codex's search footers: through its prompt history (`reverse-i-search: … enter accept · esc cancel`,
+ * chat_composer/history_search.rs) and through its transcript (`Find: …`, transcript_view/search.rs). */
+const CODEX_SEARCH_FOOTER = /^\s*(?:reverse-i-search:|Find: )/
+
+/** Codex's trust question, as 0.160 words it (onboarding/trust_directory.rs) and as 0.147 did. */
+const CODEX_TRUST_QUESTION = /Trust this folder\? Codex can read, edit, and run files here|Do you trust the contents of this directory\?/
+const CODEX_TRUST_ROW = /^\s*[›>]?\s*1\. (?:Trust and continue|Yes, continue|Open restricted|Open existing task)\s*$/
+
+/** Codex's update prompt (update_prompt.rs): its first row runs the update. */
+const CODEX_UPDATE_ROW = /^\s*[›>]?\s*1\. Update now \(runs /
+
+/**
+ * Claude Code's transcript view (ctrl+o): the prompt is hidden, and the footer row starts
+ * `Showing detailed transcript · ctrl+o to toggle`, after `dialog waiting · ` when a dialog sits behind
+ * it (2.1.289). It has no Enter, so a message typed there is lost. Esc, q or ctrl+c close it.
+ */
+const CLAUDE_TRANSCRIPT_FOOTER = /^\s*(?:dialog waiting · )?Showing detailed transcript\b/
+
+/** Claude Code's prompt-history search (ctrl+r), under the prompt: `search prompts: <query>`, or
+ * `no matching prompt: <query>` (2.1.289). */
+const CLAUDE_HISTORY_SEARCH = /^\s*(?:search prompts|no matching prompt): /
+
/**
* A modal drawn over the pane — a picker, a permission prompt, an MCP boot notice.
*