import type { NodeCategory, PortDataType, ValidationSeverity } from "../graph/types"; import type { EditorDiagnosticCode } from "./diagnosticCodes"; export type { EditorDiagnosticCode } from "./diagnosticCodes"; export { getEditorDiagnosticMessage, toEditorDiagnosticCode } from "./diagnosticCodes"; export type EditorInteractionSource = "api" | "canvas" | "context-menu" | "keyboard" | "library" | "template" | "toolbar" | "unknown"; export type ValidationSuggestionType = "add-compatible-node" | "break-cycle" | "configure-required-field" | "connect-compatible-node" | "remove-invalid-edge" | "replace-node" | "retry-execution"; export interface EditorDiagnostic { code: EditorDiagnosticCode; severity: ValidationSeverity; message: string; timestamp: string; nodeType?: string; sourcePortType?: PortDataType; targetPortType?: PortDataType; expectedPortTypes?: PortDataType[]; issueCount?: number; } interface GraphStructure { nodeCount: number; edgeCount: number; } export interface EditorEventPayloadMap { "editor:ready": GraphStructure; "node:add": { nodeType: string; category?: NodeCategory; source: EditorInteractionSource; nodeCount: number; }; "node:remove": { nodeType?: string; category?: NodeCategory; source: EditorInteractionSource; nodeCount: number; }; "node:duplicate": { nodeTypes: string[]; source: EditorInteractionSource; nodeCount: number; }; "connection:start": { sourcePortType?: PortDataType; reconnecting: boolean; }; "connection:success": { sourcePortType: PortDataType; targetPortType: PortDataType; edgeCount: number; }; "connection:rejected": { code: EditorDiagnosticCode; message: string; sourcePortType?: PortDataType; targetPortType?: PortDataType; expectedPortTypes?: PortDataType[]; suggestedNodeTypes?: string[]; }; "connection:reconnect": { sourcePortType: PortDataType; targetPortType: PortDataType; edgeCount: number; }; "template:open": { templateCount: number; }; "template:use": { templateId: string; category?: string; nodeCount: number; edgeCount: number; }; "validation:start": GraphStructure; "validation:complete": { valid: boolean; errorCount: number; warningCount: number; issueCodes: EditorDiagnosticCode[]; }; "validation:suggestion_shown": { issueCode: EditorDiagnosticCode; suggestionType: ValidationSuggestionType; }; "validation:suggestion_applied": { issueCode: EditorDiagnosticCode; suggestionType: ValidationSuggestionType; }; "execution:start": GraphStructure; "execution:success": GraphStructure & { durationMs?: number; }; "execution:error": { code: EditorDiagnosticCode; failedNodeType?: string; durationMs?: number; }; "execution:cancel": { durationMs?: number; }; "execution:retry": { nodeType?: string; attempt: number; }; "workflow:save": GraphStructure & { format?: string; }; "workflow:load": GraphStructure & { format?: string; }; "workflow:serialize": GraphStructure & { schemaVersion: string; }; "library:open": { nodeTypeCount: number; }; "inspector:open": { nodeType?: string; }; "editor:error": { code: EditorDiagnosticCode; message: string; operation?: string; }; "editor:diagnostic": { diagnostic: EditorDiagnostic; }; } export type EditorEventType = keyof EditorEventPayloadMap; export type EditorEvent = { [K in T]: { type: K; timestamp: string; } & EditorEventPayloadMap[K]; }[T]; export type EditorEventHandler = (event: EditorEvent) => void; export type EditorDiagnosticHandler = (diagnostic: EditorDiagnostic) => void; export interface EditorEventSink { onEvent?: EditorEventHandler; onDiagnostic?: EditorDiagnosticHandler; debug?: boolean; } export declare function getValidationSuggestionType(code: string): ValidationSuggestionType; export declare function createEditorEvent(type: T, payload: EditorEventPayloadMap[T], timestamp?: string): EditorEvent; export declare function createEditorDiagnostic(diagnostic: Omit, timestamp?: string): EditorDiagnostic; export declare function dispatchEditorEvent(sink: EditorEventSink, type: T, payload: EditorEventPayloadMap[T]): EditorEvent; export declare function dispatchEditorDiagnostic(sink: EditorEventSink, input: Omit): EditorDiagnostic; //# sourceMappingURL=editorEvents.d.ts.map