/** * Copyright 2025 quietloudlab * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ interface Meta { title: string; description: string; version: string; schema_version: string; } interface LayerGuidance { when_to_use: string; typical_position: string; red_flags: string[]; } interface Layer { id: string; name: string; slug: string; label: string; role: string; description: string; color: string; guidance?: LayerGuidance; } type IOItem = string | { id: string; label: string; isArray?: boolean; }; interface IOSpec { inputs: { required: IOItem[]; optional: IOItem[]; }; constraints?: { optional: IOItem[]; }; outputs: { primary: IOItem; metadata: IOItem[]; }; } interface ImplementationNotes { maturity: 'emerging' | 'established' | 'commoditized'; typical_latency: 'realtime' | 'interactive' | 'batch'; data_requirements: 'none' | 'small' | 'medium' | 'large' | 'continuous'; human_oversight: 'none' | 'optional' | 'recommended' | 'required'; } interface UxNotes { risk: string; tip: string; anti_patterns: string[]; } interface Capability { name: string; tag: string; example: string; } interface Relation { target_id: string; type: string; strength: string; reason: string; } interface BaseTask { id: string; layer_id: string; name: string; slug: string; elevator_pitch: string; example_usage: string; io_spec: IOSpec; } interface AiTask extends BaseTask { task_type: 'ai'; implementation_notes: ImplementationNotes; ux_notes: UxNotes; capabilities: Capability[]; relations: Relation[]; } interface HumanTask extends BaseTask { task_type: 'human'; common_variants: string[]; relations: Relation[]; } interface SystemTask extends BaseTask { task_type: 'system'; common_variants: string[]; relations: Relation[]; } type Task = AiTask | HumanTask | SystemTask; type DataCategory = 'text' | 'visual' | 'audio' | 'structured' | 'compound' | 'user_input' | 'system' | 'generic'; interface DataArtifactDefinition { id: string; name: string; category: DataCategory; icon: string; description?: string; examples?: string[]; compatible_with?: string[]; format_notes?: string; } type ConstraintCategory = 'quality_safety' | 'performance_resource' | 'model_technical' | 'ux_interaction' | 'data_context' | 'execution_behavior' | 'code_philosophy' | 'attribution'; interface ConstraintDefinition { id: string; name: string; category: ConstraintCategory; icon: string; description?: string; type?: string; applies_to?: string[]; ux_note?: string; example_values?: string; } type TouchpointCategory = 'screen_interface' | 'conversational' | 'voice_audio' | 'spatial_computing' | 'technical' | 'physical_devices'; interface TouchpointDefinition { id: string; name: string; category: TouchpointCategory; icon: string; description: string; examples: string[]; } interface TemplateAttachment { id: string; referenceId: string; type: 'data' | 'constraint'; direction?: 'input' | 'output'; notes?: string; } interface WorkflowTaskStep { task_id: string; position: number; label: string; optional?: boolean; conditional?: string; notes?: string; id?: string; node_type?: 'task' | 'data' | 'constraint' | 'annotation' | 'touchpoint' | 'actor'; row?: number; col?: number; width?: number; height?: number; attachments?: TemplateAttachment[]; personaId?: string; subType?: 'note' | 'zone'; customLabel?: string; capability?: string; color?: string; customDefinition?: { name: string; description?: string; icon?: string; task_type?: 'ai' | 'human' | 'system'; layer_id?: string; }; } interface WorkflowTemplateEdge { source: string; target: string; label?: string; attachments?: TemplateAttachment[]; customX?: number; customY?: number; sourceX?: number; targetX?: number; sourceHandle?: 'left' | 'right' | 'top' | 'bottom'; targetHandle?: 'left' | 'right' | 'top' | 'bottom'; } interface WorkflowTemplate { id: string; name: string; description: string; primary_use_case: string; nodes: BuilderNode[]; edges: BuilderEdge[]; common_variations: string[]; complexity?: string; tags?: string[]; personas?: Persona[]; } interface Node { task_id: string; x: number; y: number; label: string; } interface Example { id: string; primary_task_id: string; title: string; description: string; industry: string; complexity: 'Low' | 'Medium' | 'High'; tags: string[]; image_url: string; nodes: Node[]; } interface AtlasData { meta: Meta; layers: Layer[]; ai_tasks: AiTask[]; human_tasks: HumanTask[]; system_tasks: SystemTask[]; data_artifacts: DataArtifactDefinition[]; constraints: ConstraintDefinition[]; touchpoints: TouchpointDefinition[]; workflow_templates: WorkflowTemplate[]; examples: Example[]; } type NodeType = 'task' | 'data' | 'constraint' | 'annotation' | 'touchpoint' | 'actor'; type ActorCategory = 'human' | 'ai' | 'system' | 'other'; interface Persona { id: string; name: string; role?: string; color: string; initials: string; category: ActorCategory; } interface NodeAttachment { id: string; referenceId: string; customLabel?: string; customDescription?: string; customIcon?: string; type: 'data' | 'constraint'; direction?: 'input' | 'output'; notes?: string; examples?: string; status?: 'pending' | 'approved' | 'failed' | 'not-applicable'; } interface BuilderNode { id: string; type: NodeType; referenceId: string; x: number; y: number; width?: number; height?: number; measuredW?: number; measuredH?: number; color?: string; subType?: 'note' | 'zone'; semanticType?: 'data' | 'constraint' | 'touchpoint' | 'task'; classId?: string; instanceName?: string; instanceNotes?: string; customLabel?: string; className?: string; notes?: string; designerDescription?: string; personaId?: string; capability?: string; attachments?: NodeAttachment[]; suppressedValidations?: string[]; customDefinition?: { name: string; description?: string; icon?: string; task_type?: 'ai' | 'human' | 'system'; layer_id?: string; }; } interface BuilderEdge { id: string; source: string; target: string; label?: string; attachments?: NodeAttachment[]; sourceHandle?: 'left' | 'right' | 'top' | 'bottom'; targetHandle?: 'left' | 'right' | 'top' | 'bottom'; sourcePortId?: string; targetPortId?: string; /** @deprecated Use waypoints instead. Migrated automatically on project load. */ customX?: number; /** @deprecated Use waypoints instead. Migrated automatically on project load. */ customY?: number; /** @deprecated Use waypoints instead. Migrated automatically on project load. */ sourceX?: number; /** @deprecated Use waypoints instead. Migrated automatically on project load. */ targetX?: number; /** Manual waypoints for custom edge routing. Replaces legacy customX/Y/sourceX/targetX. */ waypoints?: Array<{ x: number; y: number; }>; /** Parametric label position along eligible path segments. t ∈ [0,1]. */ labelAnchor?: { t: number; segmentIndex?: number; segmentT?: number; }; _isTransitive?: boolean; _viaDataNodes?: string[]; } interface NodeClass { id: string; type: NodeType; referenceId?: string; name: string; properties: Record; notes?: string; createdAt: number; updatedAt: number; } interface BuilderState { nodes: BuilderNode[]; edges: BuilderEdge[]; personas: Persona[]; nodeClasses?: NodeClass[]; /** Schema version for migrations - set automatically on save */ schemaVersion?: number; } interface Project { id: string; name: string; description: string; lastModified: number; data: BuilderState; tags?: string[]; } export type { ActorCategory, AiTask, AtlasData, BaseTask, BuilderEdge, BuilderNode, BuilderState, Capability, ConstraintCategory, ConstraintDefinition, DataArtifactDefinition, DataCategory, Example, HumanTask, IOItem, IOSpec, ImplementationNotes, Layer, LayerGuidance, Meta, Node, NodeAttachment, NodeClass, NodeType, Persona, Project, Relation, SystemTask, Task, TemplateAttachment, TouchpointCategory, TouchpointDefinition, UxNotes, WorkflowTaskStep, WorkflowTemplate, WorkflowTemplateEdge };