/** * 共享类型:宿主专属模型定义 + 领域类型 re-export。 * * 领域类型(Catalog/Flow/RunError/RunEvent 等)已迁入 @rpa/core(packages/rpa-core/src/types.ts), * 此处 type-only re-export 保持既有 import 路径(@shared/types)不变,全仓单一来源、无复制。 */ export type { CatalogWidget, CatalogField, CatalogOutput, CatalogComponent, CatalogGroup, Catalog, FlowVariable, FlowNodeOptions, FlowNode, FlowEdge, FlowDefinition, RunError, RunEvent } from "@rpa/core"; import type { FlowDefinition, RunError } from "@rpa/core"; export interface FlowSaveOptions { /** 编辑器加载任务时磁盘上的 updatedAt,用于外部修改冲突检测 */ expectedUpdatedAt?: string; /** 为 true 时跳过冲突检测,强制覆盖磁盘 */ force?: boolean; } export type FlowSaveResult = | { conflict: false; flow: FlowDefinition } | { conflict: true; diskFlow: FlowDefinition }; /** 批量导入任务的结果:成功与失败分开汇报,单文件失败不阻塞其余 */ export interface FlowsImportResult { imported: FlowSummary[]; failed: Array<{ file: string; reason: string }>; } export interface FlowSummary { id: string; name: string; updatedAt: string; nodeCount: number; enabled?: boolean; triggerLabel?: string; lastRunAt?: string; lastRunStatus?: "succeeded" | "failed" | "cancelled" | "never"; lastRunDurationMs?: number; lastRunError?: string; } export interface AppInfo { version: string; electron: string; chrome: string; node: string; userData: string; catalogPath: string; packaged: boolean; fixtureUrl?: string; } export interface AiServiceConfig { baseUrl: string; apiKey: string; model: string; /** 桌面 AI 拾取使用的视觉模型;留空时复用 model。 */ visionModel?: string; } export interface AppSettings { browserElementWaitMs: number; aiConfig: AiServiceConfig; } export interface ElementPickResult { selector: string; tag: string; id?: string; className?: string; name?: string; type?: string; placeholder?: string; label?: string; text?: string; value?: string; url: string; } export interface RunNodeState { nodeId: string; status: "idle" | "running" | "succeeded" | "failed" | "skipped" | "cancelled"; startedAt?: string; finishedAt?: string; durationMs?: number; output?: unknown; error?: RunError; evidence?: string[]; attempt?: number; } export interface VisionLabSource { id: string; kind: "window" | "screen"; name: string; thumbnail: string; icon?: string; } export interface VisionLabBox { x: number; y: number; width: number; height: number; category: string; confidence: number; } export interface VisionLabDetectRequest { sourceId: string; modelPath?: string; scoreThreshold?: number; iouThreshold?: number; } export interface VisionLabDetection { image: string; width: number; height: number; boxes: VisionLabBox[]; captureMs: number; detectMs: number; modelPath: string; sourceName: string; }