import { type ActionChatUIConfig } from "../action-ui.js"; import type { CodeAgentTranscriptEvent } from "../cli/code-agent-runs.js"; import type { AgentMcpAppPayload } from "../mcp-client/app-result.js"; export type { CodeAgentTranscriptEvent } from "../cli/code-agent-runs.js"; export type NormalizedCodeAgentTranscriptItem = NormalizedCodeAgentUserTurn | NormalizedCodeAgentAssistantTurn | NormalizedCodeAgentToolEvent | NormalizedCodeAgentStatusEvent | NormalizedCodeAgentThinkingEvent; export interface NormalizedCodeAgentTranscript { items: NormalizedCodeAgentTranscriptItem[]; rawEvents: CodeAgentTranscriptEvent[]; hiddenEvents: CodeAgentTranscriptEvent[]; } export interface NormalizedCodeAgentTranscriptBase { id: string; createdAt: string; updatedAt: string; eventIds: string[]; events: CodeAgentTranscriptEvent[]; turnIndex: number; } export interface NormalizedCodeAgentUserTurn extends NormalizedCodeAgentTranscriptBase { type: "user"; role: "user"; text: string; } export interface NormalizedCodeAgentAssistantTurn extends NormalizedCodeAgentTranscriptBase { type: "assistant"; role: "assistant"; text: string; source: "system" | "runner-stdout"; suppressedDuplicateEventIds?: string[]; } export interface NormalizedCodeAgentToolEvent extends NormalizedCodeAgentTranscriptBase { type: "tool"; tool?: string; label: string; state: "activity" | "running" | "completed"; input?: unknown; result?: unknown; mcpApp?: AgentMcpAppPayload; chatUI?: ActionChatUIConfig; activities: string[]; startedAt?: string; completedAt?: string; /** * Structured metadata from the tool execution side-channel. Present on * bash/edit/write/read tool events when the executor is new enough to emit * it. Absent on old transcript events — UI must handle both cases. */ structuredMeta?: Record; /** * Stable approval id extracted from the synthetic "Approval required..." * bash result (see `requestCodeAgentApproval` in `cli/code-agent-executor.ts`) * when this exact approval has not yet been resolved elsewhere in the * transcript (approved / denied / allowlisted / forbidden). Consumers attach * this as `approval: { approvalKey }` on the rendered tool-call content part * so the shared `ApprovalAffordance` can render inline. Absent once a later * transcript event records a resolution for this approval id. */ pendingApprovalKey?: string; } export interface NormalizedCodeAgentStatusEvent extends NormalizedCodeAgentTranscriptBase { type: "status"; level: "info" | "warning" | "error" | "approval"; text: string; statusKind: CodeAgentTranscriptEvent["kind"]; status?: string; phase?: string; signal?: CodeAgentTranscriptEvent["signal"]; metadata?: Record; } /** * Accumulated reasoning/thinking text emitted during a model's extended * thinking phase. Rendered as a collapsed-by-default "Thinking…" cell. */ export interface NormalizedCodeAgentThinkingEvent extends NormalizedCodeAgentTranscriptBase { type: "thinking"; text: string; } /** Structured signal value stamped on the "no LLM provider key" status event. */ export declare const CREDENTIAL_GAP_SIGNAL: NonNullable; /** * Shared "credential gap" detection for code-agent transcript events and the * normalized status items built from them. Prefers the structured `signal` * field the executor stamps on the event (see `code-agent-executor.ts`); only * falls back to matching the legacy hint text for transcripts persisted * before the structured signal existed. Accepts either a raw * `CodeAgentTranscriptEvent` (`message`) or a `NormalizedCodeAgentStatusEvent` * (`text`), and any of the other UI-facing transcript event shapes that carry * the same field names, so every consumer can share one implementation * instead of re-implementing the regex. */ export declare function isCredentialGapCodeAgentEvent(event: { signal?: string; text?: string; message?: string; }): boolean; export declare function normalizeCodeAgentTranscript(events: readonly CodeAgentTranscriptEvent[]): NormalizedCodeAgentTranscript; //# sourceMappingURL=transcript-normalizer.d.ts.map