/** * Codex rollout JSONL → Claude-shaped conversation lines for WS clients. * * Mobile's `parseLineToMessage` only understands Claude Code JSONL * (`type: "user"|"assistant"`, `message.role`, text blocks). Codex writes * `response_item` / `event_msg` / `session_meta` instead, so raw Codex lines * never become live bubbles. This helper normalizes chat-bearing Codex lines * into the Claude shape and drops everything else (including the duplicate * `event_msg` copies of each turn and `developer` role payloads). */ import type { NormalizeResult } from "../services/providers/capabilities"; /** * Classify one Codex rollout line (C2). * * Distinguishes "recognized, deliberately not rendered" (`ignored`) from "this * adapter has never seen this shape" (`unknown`). Both were `null` before, which * is why provider schema drift used to surface as an empty screen with no error. * * `index` is the line's message_index in its FILE, which is what the leading-turn * bound needs. The default of 0 treats an unknown position as leading, so a * caller that cannot say keeps the injected-context filter rather than * rendering a fake AGENTS.md bubble. */ export declare function classifyCodexLine(line: string, index?: number): NormalizeResult; /** * Returns a Claude-shaped JSONL line, or null when the input is not a * user/assistant chat message that clients should render. * * Thin wrapper over classifyCodexLine so existing callers keep their signature. * New code should prefer classifyCodexLine, which explains WHY a line produced * nothing. */ export declare function normalizeCodexLineToClaudeShape(line: string, index?: number): string | null; /** True when a Codex rollout line is Codex-shaped (not Claude JSONL). */ export declare function isCodexRolloutLine(line: string): boolean; /** * Map a batch of raw JSONL lines to client-facing lines. Codex and Cursor * batches are normalized (and filtered); Claude batches pass through unchanged. * * `seqs` are the offset index's message_index per line (extendMessageIndex), * and they are the only position this batch can be trusted with: a batch is one * watcher read, which may start anywhere in the file, so "first in batch" is not * "first in conversation". The index numbers from its persisted * last_message_index and declines a read that does not start where it left off, * so a seq is a file position, never a batch-relative guess. A line with no seq * (the index dropped it, cannot index this file, or declined the read) falls * back to leading, which keeps the injected-context filter. * * The returned `seqs` stay parallel to the returned `lines` — filtered with * them — or are null when the caller passed none that line up with `lines`. */ export declare function toClientConversationLines(lines: string[], seqs?: (number | null)[] | null): { lines: string[]; seqs: (number | null)[] | null; }; /** * Text that is machinery rather than a turn the user typed. * * Two concerns, one question. The Codex-format preambles (AGENTS.md dumps, * sandbox blobs) come from the scanner, which owns the rollout format and * applies the same predicate when it counts messages — importing it is what * keeps its index space and ours identical. The argv prompts above are ours. * * Callers MUST bound this to the leading turn (see isLeadingInjectedContext). */ export declare function isCodexInjectedContext(text: string): boolean; /** * The form every caller should actually use. * * Codex only injects at the head of a rollout, so the skip is bounded to the * leading turn — otherwise a human who pastes instruction text mid-conversation * has their message silently eaten, and message_count stops matching what they * can see. The scanner bounds it the same way (`acc.messageCount === 0`), and * the two must agree or the index counts in a different space than we serve. */ export declare function isLeadingInjectedContext(index: number, role: string, text: string | undefined): boolean; //# sourceMappingURL=codexConversationLine.d.ts.map