import type { SessionFileOperation } from '../types/api'; export interface ToolActivityHighlight { startLine?: number; endLine?: number; reason: 'read' | 'write' | 'apply_patch'; callId?: string; status: 'streaming' | 'success' | 'error'; } export interface ToolActivityAnnotation { id: string; reason: 'write' | 'apply_patch'; callId?: string; status: 'streaming' | 'success' | 'error'; lineTones?: Array<[number, 'add' | 'remove']>; lineToneRanges?: LineToneRange[]; createdAt: number; } export interface ToolChangeCount { additions: number; removals: number; } export interface LineToneRange { from: number; to: number; tone: 'add' | 'remove'; } export type ToolPatchPreviewName = 'apply_patch' | 'edit' | 'multiedit'; export interface ToolPreviewTabInput { path: string; toolName: 'write' | ToolPatchPreviewName; callId?: string; content?: string; baseContent?: string; baseContentHash?: string; baseContentCacheKey?: string; patch?: string; changedLines?: number[]; previewContent?: string; previewContentHash?: string; previewContentCacheKey?: string; resultContent?: string; resultContentHash?: string; resultContentCacheKey?: string; previewLineTones?: Array<[number, 'add' | 'remove']>; previewLineToneRanges?: LineToneRange[]; previewFirstLine?: number; previewLatestLine?: number; changeCount?: ToolChangeCount; status: 'streaming' | 'success' | 'error'; error?: string; } export type ToolPatchPreview = Omit & { toolName: ToolPatchPreviewName; }; export type ToolWritePreview = Omit & { toolName: 'write'; }; export type ViewerTab = { id: string; type: 'git-diff'; title: string; path: string; staged: boolean; } | { id: string; type: 'session-file-diff'; title: string; path: string; operations: SessionFileOperation[]; selectedOperationIndex: number; } | { id: string; type: 'file'; title: string; path: string; createdBy?: 'user' | 'follow'; pinned?: boolean; lastAccessedAt?: number; highlight?: ToolActivityHighlight; annotations?: ToolActivityAnnotation[]; patchPreview?: ToolPatchPreview; writePreview?: ToolWritePreview; } | { id: string; type: 'agent-activity'; title: string; path: string; lastAccessedAt?: number; highlight?: ToolActivityHighlight; annotations?: ToolActivityAnnotation[]; patchPreview?: ToolPatchPreview; writePreview?: ToolWritePreview; } | { id: string; type: 'tool-preview'; title: string; path: string; toolName: 'write' | ToolPatchPreviewName; callId?: string; content?: string; baseContent?: string; baseContentHash?: string; baseContentCacheKey?: string; patch?: string; changedLines?: number[]; previewContent?: string; previewContentHash?: string; previewContentCacheKey?: string; resultContent?: string; resultContentHash?: string; resultContentCacheKey?: string; previewLineTones?: Array<[number, 'add' | 'remove']>; previewLineToneRanges?: LineToneRange[]; previewFirstLine?: number; previewLatestLine?: number; changeCount?: ToolChangeCount; status: 'streaming' | 'success' | 'error'; error?: string; } | { id: string; type: 'skill-file'; title: string; skill: string; file: string | null; } | { id: string; type: 'browser'; title: string; url: string; kind: 'browser' | 'simulator'; reloadKey: number; } | { id: string; type: 'terminal'; title: string; terminalId: string; }; export type ViewerMode = 'work' | 'preview' | 'terminal'; export interface ViewerTabPayloadCache { patchPreviews: Record; writePreviews: Record; } export interface ViewerTurnFileChange { baselineContent: string; latestContent: string; } export interface ViewerTabsState { tabs: ViewerTab[]; tabOrder: string[]; tabsById: Record; tabPayloads: ViewerTabPayloadCache; turnFileChanges: Record; markdownPreviewPaths: Record; activeTabId: string | null; activeMode: ViewerMode; activeWorkTabId: string | null; activePreviewTabId: string | null; activeTerminalTabId: string | null; isCollapsed: boolean; followToolActivity: boolean; followReadActivity: boolean; toggleFollowToolActivity: () => void; toggleFollowReadActivity: () => void; setFollowToolActivity: (enabled: boolean) => void; setFollowReadActivity: (enabled: boolean) => void; collapseViewer: () => void; setViewerMode: (mode: ViewerMode) => void; openGitDiffTab: (path: string, staged: boolean) => void; openSessionFileDiffTab: (path: string, operations: SessionFileOperation[]) => void; openFileTab: (path: string) => void; openToolReadTab: (path: string, highlight: ToolActivityHighlight) => void; openToolPreviewTab: (preview: ToolPreviewTabInput) => void; resetFollowTurnChanges: () => void; setMarkdownPreviewEnabled: (path: string, enabled: boolean) => void; openSkillFileTab: (skill: string, file: string | null) => void; openBrowserTab: (url?: string, options?: { id?: string; kind?: 'browser' | 'simulator'; title?: string; newTab?: boolean; }) => void; openTerminalTab: (terminalId: string, title?: string) => void; syncTerminalTabs: (terminals: Array<{ id: string; title: string; }>) => void; updateBrowserTabUrl: (id: string, url: string) => void; reloadBrowserTab: (id: string) => void; toggleFileTabPinned: (id: string) => void; setActiveTab: (id: string) => void; closeTab: (id: string) => void; updateSessionFileOperationIndex: (id: string, index: number) => void; closeAllTabs: () => void; } /** Deterministic viewer tab id for a daemon terminal. */ export declare function terminalViewerTabId(terminalId: string): string; /** * Cancelable window CustomEvent asking the viewer to close its active tab. * Dispatchers should treat a `false` return from `window.dispatchEvent` (i.e. * defaultPrevented) as "a tab consumed the close"; otherwise no tab was open * and the host may close the window itself. */ export declare const VIEWER_CLOSE_ACTIVE_TAB_EVENT = "otto-viewer:close-active-tab"; export declare function modeForViewerTab(tab: ViewerTab): ViewerMode; export declare function hydrateViewerTab(tab: ViewerTab | undefined, payloads: ViewerTabPayloadCache): ViewerTab | undefined; export declare function getHydratedViewerTab(state: ViewerTabsState, id: string | null): ViewerTab | undefined; export declare function getHydratedViewerTabs(state: ViewerTabsState): ViewerTab[]; export declare function hashViewerText(content: string | undefined): string | undefined; export declare function resolvePatchPreviewBodies(preview: Pick): { baseContent?: string; previewContent?: string; resultContent?: string; }; export declare function lineToneEntriesToRanges(lineTones: Array<[number, 'add' | 'remove']> | undefined): LineToneRange[] | undefined; export declare const useViewerTabsStore: import("zustand").UseBoundStore>; //# sourceMappingURL=viewerTabsStore.d.ts.map