import { GenerateWorkflowMessage, GeneratedWorkflowData, GenerateModel, GenerateStatusReason, GenerationPhase, AIWorkflowOperation, ConflictDetectionResult } from '@teamflojo/floimg-studio-shared'; /** * Canvas snapshot - serializable representation of current workflow state * Sent with each AI request so the AI knows what's on the canvas */ export interface CanvasSnapshot { nodes: { id: string; type: string; label?: string; parameters?: Record; }[]; edges: { source: string; target: string; }[]; nodeCount: number; hasContent: boolean; } /** * Extended snapshot stored after AI operations are applied * Used to detect user edits between AI operations */ export interface AppliedSnapshot extends CanvasSnapshot { /** Timestamp when the snapshot was taken */ timestamp: number; /** Operations that were applied to create this state */ appliedOperations?: AIWorkflowOperation[]; } /** * Last execution results context for AI awareness * Note: timestamp is optional and set when sending to AI, not when computing */ export interface ExecutionContext { status: "idle" | "completed" | "error"; nodeCount: number; outputs: { nodeId: string; nodeName: string; hasImage: boolean; hasText: boolean; }[]; error?: string; } interface AIChatState { isOpen: boolean; openPanel: () => void; closePanel: () => void; togglePanel: () => void; messages: GenerateWorkflowMessage[]; addUserMessage: (content: string) => void; addAssistantMessage: (content: string, workflow?: GeneratedWorkflowData) => void; clearMessages: () => void; isLoading: boolean; generationPhase: GenerationPhase | null; generationMessage: string; error: string | null; setLoading: (loading: boolean) => void; setGenerationProgress: (phase: GenerationPhase | null, message: string) => void; setError: (error: string | null) => void; clearError: () => void; isAvailable: boolean | null; statusMessage: string; statusReason: GenerateStatusReason | undefined; isCloudDeployment: boolean; supportUrl: string | undefined; setAvailability: (available: boolean, message: string, reason?: GenerateStatusReason, isCloud?: boolean, supportUrl?: string) => void; availableModels: GenerateModel[]; selectedModel: string; setAvailableModels: (models: GenerateModel[]) => void; setSelectedModel: (modelId: string) => void; canvasSnapshot: CanvasSnapshot | null; setCanvasSnapshot: (snapshot: CanvasSnapshot | null) => void; executionContext: ExecutionContext | null; setExecutionContext: (context: ExecutionContext | null) => void; lastAppliedSnapshot: AppliedSnapshot | null; setLastAppliedSnapshot: (snapshot: AppliedSnapshot | null) => void; /** Detect conflicts between user edits and incoming AI operations */ detectConflicts: (currentSnapshot: CanvasSnapshot, operations: AIWorkflowOperation[]) => ConflictDetectionResult; resetSession: () => void; } export declare const useAIChatStore: import('zustand').UseBoundStore, "setState" | "persist"> & { setState(partial: AIChatState | Partial | ((state: AIChatState) => AIChatState | Partial), replace?: false | undefined): unknown; setState(state: AIChatState | ((state: AIChatState) => AIChatState), replace: true): unknown; persist: { setOptions: (options: Partial>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: AIChatState) => void) => () => void; onFinishHydration: (fn: (state: AIChatState) => void) => () => void; getOptions: () => Partial>; }; }>; export {};