Files
orca/src/shared/agent-session-host-status-rows.ts
T
Brennan Benson d4a7494c47 A Codex chat shows the turns made outside it (#30883)
* feat(native-chat): a Codex chat shows the turns made outside it

When a Codex chat's agent opens its conversation, Orca reads Codex's own saved
turns and adds the ones the chat doesn't have, after the chat's rows, behind a
quiet "Continued outside this chat." divider. Turns are matched by Codex's own
turn ids, read whole before anything is written, and never re-imported; a chat
imported from a transcript gets only turns started after the import. A failed
or partial read adds nothing and the next open tries again.

* chore: remove accidental package manager lockfile churn

* test(codex): expect restored turns with optional timestamps

* test(codex): run catch-up SQLite fixtures under Node

* Make Codex history catch-up atomic and preserve adoption origin

* Keep imported Codex history separate from send delivery

* Derive Codex history reconciliation from saved journal facts

* Validate saved Codex turn identity before planning its notice

* Align Codex catch-up fixtures with current journal contracts

* Check oversized item echo declarations by their saved identity

* test: retain Codex catch-up flow and concrete regressions
2026-10-21 10:57:20 -07:00

31 lines
1.5 KiB
TypeScript

// Status rows a host writes in its own words. Each names itself with a presentation so a client can
// say it in the reader's language; its `text` stays the words for a client that can't.
import type { AgentJournalPlainStatusItem } from './agent-session-journal-types'
export const AGENT_SESSION_HOST_STATUS_COPY = {
/** A repair skipped rows it could not read. */
'history-repaired': "Part of this chat's history couldn't be loaded.",
/** In place of an item too large for any history page. */
'history-item-too-large': 'This part of the chat was too large to show.',
/** Before turns the agent's own history has that were made outside this chat. */
'continued-outside': 'Continued outside this chat.',
/** The same, when replies above were dropped from the agent's history elsewhere. */
'continued-outside-rewound':
"Continued outside this chat. Earlier replies above are no longer in this conversation's history."
} as const
export type AgentSessionHostStatusPresentation = keyof typeof AGENT_SESSION_HOST_STATUS_COPY
export function agentSessionHostStatusBody(
presentation: AgentSessionHostStatusPresentation
): AgentJournalPlainStatusItem {
return { kind: 'status', text: AGENT_SESSION_HOST_STATUS_COPY[presentation], presentation }
}
export function isAgentSessionHostStatusPresentation(
presentation: string | undefined
): presentation is AgentSessionHostStatusPresentation {
return presentation !== undefined && Object.hasOwn(AGENT_SESSION_HOST_STATUS_COPY, presentation)
}