| 1 | import type { GeneratedImageAsset } from '@shared/image-generation.js' |
| 2 | import type { GeneratedPage } from '@renderer/store/sessionStore' |
| 3 | import type { GenerateProgress } from '@renderer/store/generateStore' |
| 4 | import type { DeckEditRetry, PendingPageEditPlan } from '@renderer/store/generateStore' |
| 5 | import type { ArtTextTemplateId } from '@renderer/lib/artTextTemplates' |
| 6 | import type { InsertShapeType } from '@renderer/components/session-detail/workspace/insert-shapes' |
| 7 | import type { InsertChartType } from '@renderer/components/session-detail/workspace/insert-charts' |
| 8 | |
| 9 | export type SessionDetailChatType = 'main' | 'page' |
| 10 | export type SessionDetailAiPanelMode = 'chat' | 'image' |
| 11 | export type InteractionMode = 'preview' | 'ai-inspect' | 'animation-select' | 'edit' |
| 12 | export type SessionWorkspaceTab = |
| 13 | | 'preview' |
| 14 | | 'browse' |
| 15 | | 'style' |
| 16 | | 'edit' |
| 17 | | 'animation' |
| 18 | | 'speech' |
| 19 | | 'ai' |
| 20 | export type ChatType = SessionDetailChatType |
| 21 | export type InsertAssetType = 'image' | 'video' |
| 22 | |
| 23 | export type ImageGenerationMessage = { |
| 24 | id: string |
| 25 | role: 'user' | 'assistant' |
| 26 | content: string |
| 27 | assets?: GeneratedImageAsset[] |
| 28 | createdAt: number |
| 29 | } |
| 30 | |
| 31 | export type SessionPreviewPage = GeneratedPage & { |
| 32 | id: string |
| 33 | pageId: string |
| 34 | } |
| 35 | |
| 36 | export interface AddSessionElementOptions { |
| 37 | persistImmediately?: boolean |
| 38 | prompt?: string |
| 39 | asBackground?: boolean |
| 40 | } |
| 41 | |
| 42 | export type AddSessionElementHandler = ( |
| 43 | relativePath: string, |
| 44 | fileName: string, |
| 45 | options?: AddSessionElementOptions |
| 46 | ) => Promise<boolean> |
| 47 | |
| 48 | export interface WorkspaceRibbonRegisteredActions { |
| 49 | onUndo: () => void |
| 50 | onRedo: () => void |
| 51 | onSaveCurrentPage: () => void |
| 52 | onDiscardAllEdits: () => void |
| 53 | onApplySelectedToAllPages: () => void |
| 54 | onCopySelectedElement: () => void |
| 55 | onDeleteSelectedElement: () => void |
| 56 | onBackToSessions: () => void |
| 57 | onAddFromLibrary: (type: InsertAssetType) => void |
| 58 | onAddFromLocal: (type: InsertAssetType) => void |
| 59 | onAddText: () => void |
| 60 | onAddArtText: (templateId: ArtTextTemplateId) => void |
| 61 | onAddShape: (type: InsertShapeType) => void |
| 62 | onAddIcon: (iconId: string) => void |
| 63 | onAddChart: (type: InsertChartType) => void |
| 64 | onAddFormula: () => void |
| 65 | } |
| 66 | |
| 67 | export interface ChatPanelController { |
| 68 | selectedPageExists: boolean |
| 69 | selectedPageNumber?: number |
| 70 | isGenerating: boolean |
| 71 | isPageEditing: boolean |
| 72 | isDeckEditing: boolean |
| 73 | deckEditRetry: DeckEditRetry | null |
| 74 | isPlanningPageEdit: boolean |
| 75 | pendingPageEditPlan: PendingPageEditPlan | null |
| 76 | hasActivePageEditJob: boolean |
| 77 | progress: GenerateProgress | null |
| 78 | error: string | null |
| 79 | uploadFiles: (files: File[]) => Promise<void> |
| 80 | chooseAssets: (assetType: 'image' | 'video') => Promise<void> |
| 81 | send: (modelConfigId: string, selectPageIds?: string[]) => Promise<boolean> |
| 82 | confirmPageEditPlan: () => Promise<boolean> |
| 83 | cancelPageEditPlan: () => void |
| 84 | retryDeckEdit: (modelConfigId: string) => Promise<boolean> |
| 85 | cancel: () => Promise<void> |
| 86 | } |
| 87 | |
| 88 | export interface ChatSendGuardInput { |
| 89 | sessionId: string |
| 90 | sending: boolean |
| 91 | generating: boolean |
| 92 | input: string |
| 93 | pendingAssetCount: number |
| 94 | } |
| 95 | |
| 96 | export interface ResolveChatSendContextInput { |
| 97 | selectedSelector: string | null |
| 98 | chatType: SessionDetailChatType |
| 99 | selectedPage: SessionPreviewPage | null |
| 100 | firstPage: SessionPreviewPage | null |
| 101 | } |
| 102 | |
| 103 | export type ChatSendContext = |
| 104 | | { ready: false } |
| 105 | | { |
| 106 | ready: true |
| 107 | hasSelector: boolean |
| 108 | selector: string | null |
| 109 | chatType: SessionDetailChatType |
| 110 | targetPageId?: string |
| 111 | targetPagePath?: string |
| 112 | messagePageId: string | null |
| 113 | } |
| 114 |