feat: add TypeScript types for editor-embedded AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-06 23:27:22 -05:00
parent d1d21152d7
commit 955a63a131
2 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
export type AIActionType =
| 'generate_full'
| 'generate_branch'
| 'modify_node'
| 'add_steps'
| 'quick_action'
| 'open_chat'
| 'variable_inference'
export interface AIDelta {
action: 'add' | 'modify' | 'delete'
target_node_id: string
nodes: Record<string, unknown>[]
explanation: string
}
export interface AISuggestion {
id: string
action_type: AIActionType
target_node_id: string | null
changes_json: {
before?: Record<string, unknown>
after?: Record<string, unknown>
delta?: AIDelta
}
status: 'pending' | 'accepted' | 'dismissed'
created_at: string
resolved_at: string | null
}
export interface EditorAIChatMessage {
role: 'user' | 'assistant'
content: string
timestamp: string
action_type?: AIActionType
delta?: AIDelta
knowledge?: KnowledgeCitation[]
}
export interface KnowledgeCitation {
title: string
url: string
excerpt: string
}
export interface ContextMenuAction {
id: string
label: string
icon: string
action_type: AIActionType
description?: string
}
export interface ContextMenuPosition {
x: number
y: number
}
export interface SuggestionMarker {
_suggestion?: true
_suggestion_id?: string
}

View File

@@ -71,3 +71,14 @@ export type {
FlowExportCategory,
FlowImportResponse,
} from './flowTransfer'
export type {
AIActionType,
AIDelta,
AISuggestion,
EditorAIChatMessage,
KnowledgeCitation,
ContextMenuAction,
ContextMenuPosition,
SuggestionMarker,
} from './editor-ai'