import { type SessionEvent, type SessionStatus } from "@opengeni/sdk"; import { isTurnExecutionEvidence } from "@opengeni/sdk/timeline-order"; import { type CreditRefusalKind } from "../lib/format.js"; import { type ToolOutputReader } from "../hooks/tool-output-reads.js"; import type { TimelineGroup, TimelineItem, TurnStepsItem } from "./types.js"; import { type OpenGeniText } from "../messages/runtime.js"; export { toolDisplayName, mcpToolLeaf, toolMatchesLeaf } from "./tool-display-name.js"; /** Message identity only: queue placement needs the surrounding turn history. */ export declare function isTimelineUserQuestion(event: SessionEvent): boolean; export type BuildTimelineOptions = { partialStart?: boolean; /** * Turns whose steps are not all loaded, keyed by turn id. Each becomes a * `turn-steps` item placed at the turn's start (its `turn.started`, or its * first event), so the readable grouping gives the turn an expandable work * row even when none of its steps are in the browser. */ turnSteps?: ReadonlyMap>; /** * Exact reads of tool outputs a step page delivered as previews, by output * event. A previewed tool row carries its read's state and loader in * `outputPreview`; without a reader it is still marked as a preview. */ toolOutputs?: ToolOutputReader | undefined; }; export declare function buildTimeline(t: OpenGeniText, events: SessionEvent[], options?: BuildTimelineOptions): TimelineItem[]; /** * Codex subscription web search can return private citation handles without * the URL annotation table that would make them resolvable. Keep the canonical * model-history item untouched, but never expose those unusable handles in the * human timeline. Ordinary markdown links and structured URL citations remain. * * A handle is U+E200, `cite` or `filecite`, U+E202-separated references such * as `turn0search3`, then U+E201. It also reaches the timeline without its * delimiters (`citeturn0search3turn1view0`, when a model writes it as plain * text), cut short, or still streaming at the end of the text. * * Claude's web-search citation tags (a `cite` tag with an `index="N-M"` * attribute) become their quoted text. The Claude transport already links them to their * search results where it can; any tag left over, for example in an answer * stored before that, would otherwise show as raw markup. Code keeps them. */ export declare function stripOpaqueCitationTokens(text: string): string; /** * Whether the session's most recent turn ended in credit exhaustion — the * terminal credit state apps key their "add credits" affordances on. Derived * from the LAST turn-end event (completed/failed/cancelled): a later turn that * settles any other way (someone topped up and kept working) clears it. */ export declare function creditExhaustedFromEvents(events: SessionEvent[]): boolean; /** * The one-fix refusal (own-key fee or API use) the session's most recent turn * ended on, or null. Read from the same LAST turn-end as * `creditExhaustedFromEvents`, so a stop between model calls (a completed, * budget-exhausted turn) names its fix too, and an older failure never does. */ export declare function creditRefusalFromEvents(events: SessionEvent[]): CreditRefusalKind | null; /** The latest session status carried in the event log, if any. */ export declare function sessionStatusFromEvents(events: SessionEvent[]): SessionStatus | null; export type GroupTimelineOptions = { /** Readable assistant prose with an independent work summary for each turn. */ readableTurns?: boolean; /** @deprecated Use readableTurns. Cross-turn exchange folding has been removed. */ foldExchanges?: boolean; }; export declare function groupTimeline(t: OpenGeniText, items: TimelineItem[], options?: GroupTimelineOptions): TimelineGroup[]; export { isTurnExecutionEvidence }; /** Navigation uses the same queue/start/withdrawal rules as transcript ordering. */ export declare function timelineQuestionPlacement(question: SessionEvent, evidence: SessionEvent[]): { kind: "visible"; sequence: number; } | { sequence?: never; kind: "withdrawn"; } | { sequence?: never; kind: "pending"; }; /** * Find a session id in orchestration tool arguments or output. Handles raw * objects, JSON strings, and MCP tool results (`{ content: [{ type: "text", * text: "{...}" }], structuredContent? }`). */ export declare function extractSessionRef(value: unknown, depth?: number): string | null;