import { type SessionEvent, type SessionStatus } from "@opengeni/sdk"; 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. */ 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 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[]; /** 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"; }; /** * Evidence that a queued prompt crossed the execution boundary when an older * or partially recovered ledger is missing its canonical `turn.started`. * Queue/control bookkeeping intentionally does not qualify: moving, editing, * steering, or deleting a waiting row must never make its prompt appear in the * transcript as though inference had begun. */ export declare function isTurnExecutionEvidence(type: string): boolean; /** * 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;