| 1 | import type { HistoryMessage, TurnEventReplayView, TurnStatus, WireEvent, WireCompletionSummary } from "./types"; |
| 2 | import type { TranscriptIdentity, TranscriptSnapshotBoundary } from "./turnEventProjection"; |
| 3 | import type { HistorySwitchPhases } from "./sessionDiagnostics"; |
| 4 | |
| 5 | export interface TranscriptContentRef { |
| 6 | snapshotId: string; |
| 7 | recordId: string; |
| 8 | path: string[]; |
| 9 | bytes: number; |
| 10 | } |
| 11 | |
| 12 | export interface TranscriptRecord { |
| 13 | id: string; |
| 14 | order: number; |
| 15 | message: HistoryMessage; |
| 16 | refs: TranscriptContentRef[]; |
| 17 | } |
| 18 | |
| 19 | export interface TranscriptSnapshot extends TranscriptSnapshotBoundary { |
| 20 | records: TranscriptRecord[]; |
| 21 | activeRecords: TranscriptRecord[]; |
| 22 | runtime: { turnId?: string; submissionId?: string; status?: TurnStatus; phase?: string; startedAt?: number; completionSummary?: WireCompletionSummary; pendingEvents: WireEvent[] }; |
| 23 | activeAttempts: Array<{ id: string; messageId: string }>; |
| 24 | before: number; |
| 25 | hasOlder: boolean; |
| 26 | totalRecords: number; |
| 27 | totalTurns: number; |
| 28 | stale: boolean; |
| 29 | notFound?: boolean; |
| 30 | } |
| 31 | |
| 32 | export interface TranscriptPageRequest { |
| 33 | snapshotId?: string; |
| 34 | messageId?: string; |
| 35 | before?: number; |
| 36 | records?: number; |
| 37 | bytes?: number; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * One user turn of the complete conversation. `id` is the stable record |
| 42 | * identity shared with the body records; `order` is only this snapshot's |
| 43 | * pagination position and must never be used as cross-snapshot identity or as |
| 44 | * a React key. |
| 45 | */ |
| 46 | export interface TranscriptOutlineEntry { |
| 47 | id: string; |
| 48 | messageId?: string; |
| 49 | turn: number; |
| 50 | order: number; |
| 51 | prompt: string; |
| 52 | answer?: string; |
| 53 | } |
| 54 | |
| 55 | export interface TranscriptOutlinePage { |
| 56 | protocolVersion: number; |
| 57 | snapshotId: string; |
| 58 | entries: TranscriptOutlineEntry[]; |
| 59 | nextOffset: number; |
| 60 | done: boolean; |
| 61 | total: number; |
| 62 | stale: boolean; |
| 63 | } |
| 64 | |
| 65 | export interface TranscriptOutlineRequest { snapshotId: string; offset?: number; entries?: number; bytes?: number } |
| 66 | |
| 67 | export interface TranscriptContentChunk { data: string; nextOffset: number; done: boolean; stale: boolean } |
| 68 | export interface TranscriptReplayRequest { identity: TranscriptIdentity; after: number } |
| 69 | export interface TranscriptReplay extends TranscriptSnapshotBoundary, TurnEventReplayView {} |
| 70 | |
| 71 | export interface TranscriptProtocolBindings { |
| 72 | TranscriptFollowForTab(tabId: string, request: import("../generated/desktopContract.generated").FollowRequest): Promise<import("../generated/desktopContract.generated").TranscriptFollowResponse>; |
| 73 | RemoteTranscriptFollowForTab(tabId: string, request: import("../generated/desktopContract.generated").FollowRequest): Promise<import("../generated/desktopContract.generated").TranscriptFollowResponse>; |
| 74 | TranscriptSnapshotForTab?(tabId: string, request: TranscriptPageRequest): Promise<TranscriptSnapshot>; |
| 75 | TranscriptPageForTab?(tabId: string, request: TranscriptPageRequest): Promise<TranscriptSnapshot>; |
| 76 | TranscriptContentForTab?(tabId: string, request: TranscriptContentRef & { offset: number }): Promise<TranscriptContentChunk>; |
| 77 | /** Optional beside the body protocol: an absent method means no outline. */ |
| 78 | TranscriptOutlineForTab?(tabId: string, request: TranscriptOutlineRequest): Promise<TranscriptOutlinePage>; |
| 79 | TranscriptReplayForTab?(tabId: string, request: TranscriptReplayRequest): Promise<TranscriptReplay>; |
| 80 | RemoteTranscriptSnapshotForTab?(tabId: string, request: TranscriptPageRequest): Promise<{ supported: boolean; snapshot?: TranscriptSnapshot }>; |
| 81 | RemoteTranscriptPageForTab?(tabId: string, request: TranscriptPageRequest): Promise<TranscriptSnapshot>; |
| 82 | RemoteTranscriptContentForTab?(tabId: string, request: TranscriptContentRef & { offset: number }): Promise<TranscriptContentChunk>; |
| 83 | RemoteTranscriptOutlineForTab?(tabId: string, request: TranscriptOutlineRequest): Promise<TranscriptOutlinePage>; |
| 84 | RemoteTranscriptReplayForTab?(tabId: string, request: TranscriptReplayRequest): Promise<TranscriptReplay>; |
| 85 | ResumeTranscriptSessionForTab?(tabID: string, path: string): Promise<HistorySwitchPhases | void>; |
| 86 | OpenChannelTranscriptSessionForTab?(tabID: string, path: string): Promise<HistorySwitchPhases | void>; |
| 87 | } |
| 88 | |
| 89 | export interface TranscriptTurnMetadata { |
| 90 | samplingCount?: number; |
| 91 | toolCount?: number; |
| 92 | turnFinal?: boolean; |
| 93 | } |
| 94 |