@almadar/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +72 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1595 -0
- package/dist/index.js.map +1 -0
- package/dist/src/types/index.d.ts +14302 -0
- package/dist/src/types/index.js +1595 -0
- package/dist/src/types/index.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/types/field.ts","../../../src/types/asset.ts","../../../src/types/entity.ts","../../../src/types/page.ts","../../../src/types/effect.ts","../../../src/types/expression.ts","../../../src/types/state-machine.ts","../../../src/types/trait.ts","../../../src/types/domain.ts","../../../src/types/service.ts","../../../src/types/orbital.ts","../../../src/types/schema.ts","../../../src/types/operators.ts","../../../src/types/bindings.ts","../../../src/types/interaction-model.ts","../../../src/types/pattern.ts","../../../src/types/ir.ts"],"names":["z"],"mappings":";;;AAkCO,IAAM,eAAA,GAAkB,EAAE,IAAA,CAAK;AAAA,EAClC,QAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACJ,CAAC;AAoBM,IAAM,oBAAA,GAAuB,EAAE,MAAA,CAAO;AAAA,EACzC,QAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,GAAG,2BAA2B,CAAA;AAAA,EACrD,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC3B,WAAA,EAAa,EAAE,IAAA,CAAK,CAAC,OAAO,MAAM,CAAC,EAAE,QAAA,EAAS;AAAA,EAC9C,QAAA,EAAU,EAAE,IAAA,CAAK,CAAC,WAAW,SAAA,EAAW,UAAU,CAAC,CAAA,CAAE,QAAA;AACzD,CAAC;AAaM,IAAM,iBAA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AM,IAAA;AAAA,IACZ,MAAM,KAAA,CAAM,IAAA;AAAA,IACZ,MAAA,EAAQ,WAAA,CAAY,KAAA,CAAM,IAAI,CAAA;AAAA,IAC9B,aAAa,KAAA,CAAM,WAAA;AAAA,IACnB,SAAS,KAAA,CAAM,OAAA;AAAA,IACf,QAAA,EAAU,MAAM,QAAA,IAAY,KAAA;AAAA,IAC5B,YAAY,KAAA,CAAM,UAAA;AAAA,IAClB,QAAQ,KAAA,CAAM;AAAA,GAChB;AACF;AAMO,SAAS,aAAa,EAAA,EAA+B;AAC1D,EAAA,IAAI,CAAC,EAAA,IAAM,OAAO,EAAA,KAAO,UAAU,OAAO,KAAA;AAC1C,EAAA,MAAM,CAAA,GAAI,EAAA;AACV,EAAA,OAAO,OAAO,EAAE,OAAA,KAAY,QAAA,IAAY,EAAE,MAAA,YAAkB,GAAA,IAAO,EAAE,KAAA,YAAiB,GAAA;AACxF","file":"index.js","sourcesContent":["/**\n * Field Types for Orbital Units\n *\n * Extracted from schema/data-entities.ts for the orbitals module.\n * These types define the field structure within orbital entities.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Field Types\n// ============================================================================\n\n/**\n * Supported field types for entity fields.\n *\n * @example\n * { name: 'status', type: 'enum', values: ['draft', 'published'] }\n * { name: 'authorId', type: 'relation', relation: { entity: 'User', cardinality: 'one' } }\n */\nexport type FieldType =\n | 'string'\n | 'number'\n | 'boolean'\n | 'date'\n | 'timestamp'\n | 'datetime'\n | 'array'\n | 'object'\n | 'enum'\n | 'relation';\n\nexport const FieldTypeSchema = z.enum([\n 'string',\n 'number',\n 'boolean',\n 'date',\n 'timestamp',\n 'datetime',\n 'array',\n 'object',\n 'enum',\n 'relation',\n]);\n\n// ============================================================================\n// Relation Configuration\n// ============================================================================\n\n/**\n * Configuration for relation fields (foreign keys).\n */\nexport interface RelationConfig {\n /** Target entity name (e.g., 'User', 'Task') */\n entity: string;\n /** Field on target entity (defaults to 'id') */\n field?: string;\n /** Cardinality: one-to-one or one-to-many */\n cardinality?: 'one' | 'many';\n /** Delete behavior */\n onDelete?: 'cascade' | 'nullify' | 'restrict';\n}\n\nexport const RelationConfigSchema = z.object({\n entity: z.string().min(1, 'Target entity is required'),\n field: z.string().optional(),\n cardinality: z.enum(['one', 'many']).optional(),\n onDelete: z.enum(['cascade', 'nullify', 'restrict']).optional(),\n});\n\nexport type RelationConfigInput = z.input<typeof RelationConfigSchema>;\n\n// ============================================================================\n// Field Format\n// ============================================================================\n\n/**\n * Field format validators for string fields.\n */\nexport type FieldFormat = 'email' | 'url' | 'phone' | 'date' | 'datetime' | 'uuid';\n\nexport const FieldFormatSchema = z.enum([\n 'email',\n 'url',\n 'phone',\n 'date',\n 'datetime',\n 'uuid',\n]);\n\n// ============================================================================\n// Entity Field\n// ============================================================================\n\n/**\n * Entity field definition.\n */\nexport interface EntityField {\n /** Field name (camelCase) */\n name: string;\n /** Data type */\n type: FieldType;\n /** Whether the field is required */\n required?: boolean;\n /** Default value */\n default?: unknown;\n /** Allowed values for enum types */\n values?: string[];\n /** @deprecated Use 'values' instead */\n enum?: string[];\n /** Validation format */\n format?: FieldFormat;\n /** Minimum value (for number) or length (for string) */\n min?: number;\n /** Maximum value or length */\n max?: number;\n /** Array item schema (for array type) */\n items?: EntityField;\n /** Relation configuration (required when type is 'relation') */\n relation?: RelationConfig;\n}\n\nexport const EntityFieldSchema: z.ZodType<EntityField> = z.lazy(() =>\n z.object({\n name: z.string().min(1, 'Field name is required'),\n type: FieldTypeSchema,\n required: z.boolean().optional(),\n default: z.unknown().optional(),\n values: z.array(z.string()).optional(),\n enum: z.array(z.string()).optional(),\n format: FieldFormatSchema.optional(),\n min: z.number().optional(),\n max: z.number().optional(),\n items: EntityFieldSchema.optional(),\n relation: RelationConfigSchema.optional(),\n }).refine(\n (field) => field.type !== 'relation' || field.relation !== undefined,\n { message: 'Relation config is required when type is \"relation\"', path: ['relation'] }\n )\n);\n\nexport type EntityFieldInput = z.input<typeof EntityFieldSchema>;\n\n// ============================================================================\n// Type Aliases (for cleaner imports)\n// ============================================================================\n\n/** Alias for EntityField - preferred name */\nexport type Field = EntityField;\n\n/** Alias for EntityFieldSchema - preferred name */\nexport const FieldSchema = EntityFieldSchema;\n","/**\n * Asset Types for Semantic Asset References\n *\n * Defines types for abstracting asset paths into semantic references.\n * Assets are resolved from SemanticAssetRef to actual paths at compile time.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Entity Roles\n// ============================================================================\n\n/**\n * Entity roles in game contexts\n */\nexport const ENTITY_ROLES = [\n 'player',\n 'enemy',\n 'npc',\n 'item',\n 'tile',\n 'projectile',\n 'effect',\n 'ui',\n 'decoration',\n 'vehicle',\n] as const;\n\nexport type EntityRole = (typeof ENTITY_ROLES)[number];\n\nexport const EntityRoleSchema = z.enum(ENTITY_ROLES);\n\n// ============================================================================\n// Visual Styles\n// ============================================================================\n\n/**\n * Visual art styles for games\n */\nexport const VISUAL_STYLES = ['pixel', 'vector', 'hd', '1-bit', 'isometric'] as const;\n\nexport type VisualStyle = (typeof VISUAL_STYLES)[number];\n\nexport const VisualStyleSchema = z.enum(VISUAL_STYLES);\n\n// ============================================================================\n// Game Types\n// ============================================================================\n\n/**\n * Game type classifications\n */\nexport const GAME_TYPES = [\n 'platformer',\n 'roguelike',\n 'top-down',\n 'puzzle',\n 'racing',\n 'card',\n 'board',\n 'shooter',\n 'rpg',\n] as const;\n\nexport type GameType = (typeof GAME_TYPES)[number];\n\nexport const GameTypeSchema = z.enum(GAME_TYPES);\n\n// ============================================================================\n// Animation Definition\n// ============================================================================\n\n/**\n * Animation definition for sprites\n */\nexport interface AnimationDef {\n /** Frame indices or file names */\n frames: number[] | string[];\n /** Frames per second */\n fps: number;\n /** Whether animation loops */\n loop: boolean;\n}\n\nexport const AnimationDefSchema = z.object({\n frames: z.union([z.array(z.number()), z.array(z.string())]),\n fps: z.number().positive(),\n loop: z.boolean(),\n});\n\n// ============================================================================\n// Semantic Asset Reference\n// ============================================================================\n\n/**\n * Semantic reference to an asset (not a hardcoded path).\n * Resolved to actual paths at compile time via asset maps.\n */\nexport interface SemanticAssetRef {\n /** Entity role (player, enemy, item, etc.) */\n role: EntityRole;\n /** Sub-category within role (hero, slime, coin, etc.) */\n category: string;\n /** Required animations for this entity */\n animations?: string[];\n /** Visual style preference */\n style?: VisualStyle;\n /** Variant identifier (for multiple versions) */\n variant?: string;\n}\n\nexport const SemanticAssetRefSchema = z.object({\n role: EntityRoleSchema,\n category: z.string().min(1),\n animations: z.array(z.string()).optional(),\n style: VisualStyleSchema.optional(),\n variant: z.string().optional(),\n});\n\n// ============================================================================\n// Resolved Asset\n// ============================================================================\n\n/**\n * Result of resolving a SemanticAssetRef to actual asset paths\n */\nexport interface ResolvedAsset {\n /** Base path to the asset pack */\n basePath: string;\n /** Relative path within the pack */\n path: string;\n /** Tile indices for tilesheet-based assets */\n tiles?: number[];\n /** Size of each tile in pixels */\n tileSize?: number;\n /** List of individual files (for non-tilesheet assets) */\n files?: string[];\n /** Animation definitions by name */\n animations?: Record<string, AnimationDef>;\n}\n\nexport const ResolvedAssetSchema = z.object({\n basePath: z.string(),\n path: z.string(),\n tiles: z.array(z.number()).optional(),\n tileSize: z.number().positive().optional(),\n files: z.array(z.string()).optional(),\n animations: z.record(AnimationDefSchema).optional(),\n});\n\n// ============================================================================\n// Asset Mapping\n// ============================================================================\n\n/**\n * Single asset mapping entry in an asset map\n */\nexport interface AssetMapping {\n /** Relative path to the asset */\n path: string;\n /** Tile indices for tilesheets */\n tiles?: number[];\n /** Tile size in pixels */\n tileSize?: number;\n /** Individual file patterns */\n files?: string[];\n /** Animation definitions */\n animations?: Record<string, AnimationDef>;\n}\n\nexport const AssetMappingSchema = z.object({\n path: z.string(),\n tiles: z.array(z.number()).optional(),\n tileSize: z.number().positive().optional(),\n files: z.array(z.string()).optional(),\n animations: z.record(AnimationDefSchema).optional(),\n});\n\n// ============================================================================\n// Asset Map\n// ============================================================================\n\n/**\n * Asset map for a specific game type and visual style.\n * Maps semantic keys (role:category) to asset paths.\n */\nexport interface AssetMap {\n /** Game type this map is for */\n gameType: GameType;\n /** Visual style this map is for */\n style: VisualStyle;\n /** Base path to the asset pack */\n basePath: string;\n /** Mappings from semantic keys to asset paths */\n mappings: Record<string, AssetMapping>;\n}\n\nexport const AssetMapSchema = z.object({\n gameType: GameTypeSchema,\n style: VisualStyleSchema,\n basePath: z.string(),\n mappings: z.record(AssetMappingSchema),\n});\n\n// ============================================================================\n// Type Exports\n// ============================================================================\n\nexport type SemanticAssetRefInput = z.input<typeof SemanticAssetRefSchema>;\nexport type ResolvedAssetInput = z.input<typeof ResolvedAssetSchema>;\nexport type AssetMappingInput = z.input<typeof AssetMappingSchema>;\nexport type AssetMapInput = z.input<typeof AssetMapSchema>;\nexport type AnimationDefInput = z.input<typeof AnimationDefSchema>;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Create a semantic asset key from role and category\n */\nexport function createAssetKey(role: EntityRole, category: string): string {\n return `${role}:${category}`;\n}\n\n/**\n * Parse an asset key into role and category\n */\nexport function parseAssetKey(key: string): { role: string; category: string } | null {\n const parts = key.split(':');\n if (parts.length !== 2) return null;\n return { role: parts[0], category: parts[1] };\n}\n\n/**\n * Get common animations for an entity role\n */\nexport function getDefaultAnimationsForRole(role: EntityRole): string[] {\n switch (role) {\n case 'player':\n return ['idle', 'run', 'jump', 'fall', 'attack', 'hurt', 'die'];\n case 'enemy':\n return ['idle', 'walk', 'attack', 'hurt', 'die'];\n case 'npc':\n return ['idle', 'walk', 'talk'];\n case 'item':\n return ['idle', 'collected'];\n case 'tile':\n return ['static'];\n case 'projectile':\n return ['fly', 'hit', 'expire'];\n case 'effect':\n return ['play'];\n case 'ui':\n return ['normal', 'hover', 'pressed', 'disabled'];\n case 'decoration':\n return ['idle'];\n case 'vehicle':\n return ['idle', 'move', 'brake'];\n default:\n return ['idle'];\n }\n}\n\n/**\n * Validate that an asset ref has required animations\n */\nexport function validateAssetAnimations(\n assetRef: SemanticAssetRef,\n requiredAnimations: string[]\n): { valid: boolean; missing: string[] } {\n const provided = assetRef.animations || [];\n const missing = requiredAnimations.filter((anim) => !provided.includes(anim));\n return { valid: missing.length === 0, missing };\n}\n","/**\n * Entity Types for Orbital Units\n *\n * Defines the OrbitalEntity type - the nucleus of an Orbital Unit.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\nimport { EntityFieldSchema, type EntityField } from './field.js';\nimport { SemanticAssetRefSchema, type SemanticAssetRef } from './asset.js';\n\n// ============================================================================\n// Entity Persistence\n// ============================================================================\n\n/**\n * Entity persistence types.\n *\n * - persistent: Stored in database (has collection)\n * - runtime: Exists only at runtime (not persisted)\n * - singleton: Single global instance\n * - instance: Static data (read-only instances)\n */\nexport type EntityPersistence = 'persistent' | 'runtime' | 'singleton' | 'instance';\n\nexport const EntityPersistenceSchema = z.enum([\n 'persistent',\n 'runtime',\n 'singleton',\n 'instance',\n]);\n\n// ============================================================================\n// Orbital Entity\n// ============================================================================\n\n/**\n * OrbitalEntity - the nucleus of an Orbital Unit.\n *\n * This is a simplified entity definition optimized for orbital composition.\n * Collection names are derived automatically from persistence type if not provided.\n */\nexport interface OrbitalEntity {\n /** Entity name (PascalCase, e.g., \"Task\", \"User\") */\n name: string;\n\n /** Entity persistence type (defaults to 'persistent' if not specified) */\n persistence?: EntityPersistence;\n\n /** Collection name (auto-derived if not provided for persistent entities) */\n collection?: string;\n\n /** Entity fields */\n fields: EntityField[];\n\n /** Auto-add createdAt/updatedAt timestamps */\n timestamps?: boolean;\n\n /** Soft delete support */\n softDelete?: boolean;\n\n /** Human-readable description */\n description?: string;\n\n /** Visual prompt for AI generation */\n visual_prompt?: string;\n\n /** Semantic asset reference for visual representation (games) */\n assetRef?: SemanticAssetRef;\n}\n\nexport const OrbitalEntitySchema = z.object({\n name: z.string().min(1, 'Entity name is required'),\n persistence: EntityPersistenceSchema.default('persistent'),\n collection: z.string().optional(),\n fields: z.array(EntityFieldSchema).min(1, 'At least one field is required'),\n timestamps: z.boolean().optional(),\n softDelete: z.boolean().optional(),\n description: z.string().optional(),\n visual_prompt: z.string().optional(),\n assetRef: SemanticAssetRefSchema.optional(),\n});\n\nexport type OrbitalEntityInput = z.input<typeof OrbitalEntitySchema>;\n\n// ============================================================================\n// Type Aliases (for cleaner imports)\n// ============================================================================\n\n/** Alias for OrbitalEntity - preferred name */\nexport type Entity = OrbitalEntity;\n\n/** Alias for OrbitalEntitySchema - preferred name */\nexport const EntitySchema = OrbitalEntitySchema;\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Derive collection name from entity.\n * Only persistent entities have collections.\n */\nexport function deriveCollection(entity: OrbitalEntity): string | undefined {\n if (entity.persistence !== 'persistent') {\n return undefined;\n }\n // Lowercase + 's' suffix (simple pluralization)\n return entity.name.toLowerCase() + 's';\n}\n\n/**\n * Check if entity is runtime-only (not persisted).\n */\nexport function isRuntimeEntity(entity: OrbitalEntity): boolean {\n return entity.persistence === 'runtime';\n}\n\n/**\n * Check if entity is a singleton.\n */\nexport function isSingletonEntity(entity: OrbitalEntity): boolean {\n return entity.persistence === 'singleton';\n}\n","/**\n * Page Types for Orbital Units\n *\n * Defines OrbitalPage type for pages within an Orbital Unit.\n *\n * IMPORTANT: Trait-driven UI architecture requires pages to have traits.\n * Static sections are NO LONGER SUPPORTED.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// View Type\n// ============================================================================\n\n/**\n * Page view types.\n * Note: viewType may be deprecated in favor of trait-driven UI.\n */\nexport type ViewType = 'list' | 'detail' | 'create' | 'edit' | 'dashboard' | 'custom';\n\nexport const ViewTypeSchema = z.enum([\n 'list',\n 'detail',\n 'create',\n 'edit',\n 'dashboard',\n 'custom',\n]);\n\n// ============================================================================\n// Trait Reference\n// ============================================================================\n\n/**\n * Trait reference on a page.\n */\nexport interface PageTraitRef {\n /** Trait name from library */\n ref: string;\n /** Entity this trait operates on */\n linkedEntity?: string;\n /** Additional trait configuration */\n config?: Record<string, unknown>;\n}\n\nexport const PageTraitRefSchema = z.object({\n ref: z.string().min(1, 'Trait ref is required'),\n linkedEntity: z.string().optional(),\n config: z.record(z.unknown()).optional(),\n});\n\n// ============================================================================\n// Orbital Page\n// ============================================================================\n\n/**\n * OrbitalPage - a page definition within an Orbital Unit.\n *\n * TRAIT-DRIVEN: Pages must have traits array. Sections are NOT supported.\n */\nexport interface OrbitalPage {\n /** Page name (PascalCase, e.g., \"TasksPage\") */\n name: string;\n\n /** URL path (e.g., \"/tasks\", \"/tasks/:id\") */\n path: string;\n\n /** View type (optional in trait-driven mode) */\n viewType?: ViewType;\n\n /** Page title (optional, defaults to derived from name) */\n title?: string;\n\n /** Primary entity for this page */\n primaryEntity?: string;\n\n /**\n * Traits that drive UI for this page.\n * REQUIRED in trait-driven architecture.\n */\n traits?: PageTraitRef[];\n\n /** Is this the initial page for navigation? */\n isInitial?: boolean;\n}\n\n/**\n * Strict Zod schema for trait-driven pages.\n * Rejects unknown properties like 'sections'.\n */\nexport const OrbitalPageStrictSchema = z.object({\n name: z.string().min(1, 'Page name is required'),\n path: z.string().min(1, 'Page path is required').startsWith('/', 'Path must start with /'),\n primaryEntity: z.string().min(1, 'Primary entity is required'),\n traits: z.array(PageTraitRefSchema).min(1, 'Page must have at least one trait'),\n title: z.string().optional(),\n}).strict(); // Reject unknown keys like 'sections'\n\n/**\n * Zod schema for OrbitalPage.\n * Trait-driven: pages have traits instead of static sections/patterns.\n * Uses .strict() to reject unknown keys like 'sections'.\n */\nexport const OrbitalPageSchema = z.object({\n name: z.string().min(1, 'Page name is required'),\n path: z.string().min(1, 'Page path is required').startsWith('/', 'Path must start with /'),\n viewType: ViewTypeSchema.optional(),\n title: z.string().optional(),\n primaryEntity: z.string().optional(),\n traits: z.array(PageTraitRefSchema).optional(),\n isInitial: z.boolean().optional(),\n}).strict(); // Reject unknown keys like 'sections' - use traits with render_ui effects\n\nexport type OrbitalPageInput = z.input<typeof OrbitalPageSchema>;\nexport type OrbitalPageStrictInput = z.input<typeof OrbitalPageStrictSchema>;\n\n// ============================================================================\n// Type Aliases (for cleaner imports)\n// ============================================================================\n\n/** Alias for OrbitalPage - preferred name */\nexport type Page = OrbitalPage;\n\n/** Alias for OrbitalPageSchema - preferred name */\nexport const PageSchema = OrbitalPageSchema;\n","/**\n * Effect Types (Self-Contained)\n *\n * Defines effect types for trait transitions and ticks.\n * Effects are S-expressions (arrays) that describe actions to perform.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\nimport { type SExpr } from './expression.js';\n\n// ============================================================================\n// UI Slots\n// ============================================================================\n\n/**\n * Known UI slots where content can be rendered\n */\nexport const UI_SLOTS = [\n 'main',\n 'sidebar',\n 'modal',\n 'drawer',\n 'overlay',\n 'center',\n 'toast',\n 'hud-top',\n 'hud-bottom',\n 'floating',\n 'system', // For invisible system components (InputListener, CollisionDetector)\n] as const;\n\nexport type UISlot = (typeof UI_SLOTS)[number];\n\nexport const UISlotSchema = z.enum(UI_SLOTS);\n\n// ============================================================================\n// Pattern Config (for render-ui effects)\n// ============================================================================\n\n/**\n * Pattern configuration for render-ui effect\n */\nexport interface PatternConfig {\n type: string;\n [key: string]: unknown;\n}\n\n// ============================================================================\n// Service Config (for call-service effects)\n// ============================================================================\n\n/**\n * Configuration extracted from call-service effects\n */\nexport interface CallServiceConfig {\n service: string;\n action: string;\n endpoint?: string;\n method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n params?: Record<string, unknown>;\n onSuccess?: string;\n onError?: string;\n}\n\n// ============================================================================\n// Effect Type (S-Expression Only)\n// ============================================================================\n\n/**\n * Effect type - S-expression format (array form).\n *\n * Effects are arrays where the first element is the operator name (string)\n * and subsequent elements are the arguments.\n *\n * @example\n * [\"set\", \"@entity.health\", 100]\n * [\"emit\", \"PLAYER_DIED\", { \"playerId\": \"@entity.id\" }]\n * [\"render-ui\", \"main\", { \"type\": \"entity-table\", \"entity\": \"Task\" }]\n * [\"call-service\", \"WeatherAPI\", { \"action\": \"getWeather\", \"onSuccess\": \"OK\", \"onError\": \"ERR\" }]\n * [\"navigate\", \"/tasks\"]\n * [\"persist\", \"create\", \"Task\", { \"title\": \"@payload.title\" }]\n */\nexport type Effect = SExpr[];\n\n/**\n * Schema for Effect - validates S-expression format\n */\nexport const EffectSchema = z.array(z.unknown()).min(1).refine(\n (arr) => typeof arr[0] === 'string',\n { message: 'Effect must be an S-expression with a string operator as first element' }\n);\n\nexport type EffectInput = z.input<typeof EffectSchema>;\n\n/**\n * Type guard to check if a value is a valid Effect (S-expression).\n */\nexport function isEffect(value: unknown): value is Effect {\n return Array.isArray(value) && value.length > 0 && typeof value[0] === 'string';\n}\n\n/**\n * Alias for isEffect (for clarity when working with S-expressions)\n */\nexport const isSExprEffect = isEffect;\n\n// ============================================================================\n// Effect Builder Helpers\n// ============================================================================\n\n/**\n * Create a set effect\n * @example [\"set\", \"@entity.health\", 100]\n */\nexport function set(binding: string, value: SExpr): Effect {\n return ['set', binding, value];\n}\n\n/**\n * Create an emit effect\n * @example [\"emit\", \"PLAYER_DIED\", { \"playerId\": \"@entity.id\" }]\n */\nexport function emit(event: string, payload?: Record<string, unknown>): Effect {\n return payload ? ['emit', event, payload] : ['emit', event];\n}\n\n/**\n * Create a navigate effect\n * @example [\"navigate\", \"/tasks\"]\n */\nexport function navigate(path: string, params?: Record<string, string>): Effect {\n return params ? ['navigate', path, params] : ['navigate', path];\n}\n\n/**\n * Create a render-ui effect\n * @example [\"render-ui\", \"main\", { \"type\": \"entity-table\", \"entity\": \"Task\" }]\n */\nexport function renderUI(\n target: UISlot,\n pattern: PatternConfig | null,\n props?: Record<string, unknown>\n): Effect {\n const patternObj = pattern ? { ...pattern } : null;\n return props\n ? ['render-ui', target, patternObj as SExpr, props]\n : ['render-ui', target, patternObj as SExpr];\n}\n\n/**\n * Create a persist effect\n * @example [\"persist\", \"create\", \"Task\", { \"title\": \"@payload.title\" }]\n */\nexport function persist(\n action: 'create' | 'update' | 'delete' | 'clear',\n entity: string,\n data?: Record<string, unknown>\n): Effect {\n return data ? ['persist', action, entity, data] : ['persist', action, entity];\n}\n\n/**\n * Create a call-service effect\n * @example [\"call-service\", \"stripe\", { \"action\": \"charge\", \"onSuccess\": \"OK\", \"onError\": \"ERR\" }]\n */\nexport function callService(\n service: string,\n config: { action: string; onSuccess: string; onError: string; params?: Record<string, unknown> }\n): Effect {\n return ['call-service', service, config];\n}\n\n/**\n * Create a spawn effect (games)\n * @example [\"spawn\", \"Bullet\", { \"x\": \"@entity.x\", \"y\": \"@entity.y\" }]\n */\nexport function spawn(\n entity: string,\n initialState?: Record<string, unknown>\n): Effect {\n return initialState ? ['spawn', entity, initialState] : ['spawn', entity];\n}\n\n/**\n * Create a despawn effect (games)\n * @example [\"despawn\", \"@entity.id\"]\n */\nexport function despawn(entityId: string): Effect {\n return ['despawn', entityId];\n}\n\n/**\n * Create a do effect (multiple effects)\n * @example [\"do\", [\"set\", \"@entity.x\", 0], [\"set\", \"@entity.y\", 0]]\n */\nexport function doEffects(...effects: Effect[]): Effect {\n return ['do', ...effects];\n}\n\n/**\n * Create a notify effect\n * @example [\"notify\", \"in_app\", \"Task created successfully\"]\n */\nexport function notify(\n channel: 'email' | 'push' | 'sms' | 'in_app',\n message: string,\n recipient?: string\n): Effect {\n return recipient\n ? ['notify', channel, message, recipient]\n : ['notify', channel, message];\n}\n\n/**\n * Fetch options for entity data retrieval\n */\nexport interface FetchOptions {\n /** Fetch a single entity by ID */\n id?: string;\n /** Filter expression (S-expression) */\n filter?: SExpr;\n /** Maximum number of entities to return */\n limit?: number;\n /** Number of entities to skip */\n offset?: number;\n /** Allow additional properties for flexibility */\n [key: string]: unknown;\n}\n\n/**\n * Create a fetch effect (server-side data retrieval)\n * @example [\"fetch\", \"User\"] - fetch all users\n * @example [\"fetch\", \"User\", { \"id\": \"@payload.userId\" }] - fetch by ID\n * @example [\"fetch\", \"User\", { \"filter\": [\"=\", \"@entity.status\", \"active\"], \"limit\": 10 }]\n */\nexport function fetch(\n entity: string,\n options?: FetchOptions\n): Effect {\n return options ? ['fetch', entity, options as SExpr] : ['fetch', entity];\n}\n","/**\n * S-Expression Types\n *\n * Defines the S-Expression type system for guards, effects, and computed values.\n * S-expressions are JSON arrays where the first element is an operator string.\n *\n * @example\n * // Guard: health > 0\n * [\">\", \"@entity.health\", 0]\n *\n * // Effect: set x to x + vx\n * [\"set\", \"@entity.x\", [\"+\", \"@entity.x\", \"@entity.vx\"]]\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// S-Expression Type\n// ============================================================================\n\n/**\n * S-Expression type - recursive structure representing expressions.\n *\n * An S-expression is either:\n * - A literal value (string, number, boolean, null)\n * - An object literal (for payload data, props, etc.)\n * - A binding reference (string starting with @)\n * - A call expression (array with operator as first element)\n */\nexport type SExprAtom = string | number | boolean | null | Record<string, unknown>;\nexport type SExpr = SExprAtom | SExpr[];\n\n/**\n * Expression type - S-expressions only.\n * Used for guards, computed values, and effect expressions.\n *\n * NOTE: Legacy string format is no longer supported.\n * All expressions must be S-expression arrays.\n */\nexport type Expression = SExpr;\n\n// ============================================================================\n// S-Expression Schema (Zod)\n// ============================================================================\n\n/**\n * Schema for atomic S-expression values (non-array)\n * Includes objects for payload data, props, etc.\n */\nexport const SExprAtomSchema: z.ZodType<SExprAtom> = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.record(z.unknown()), // Objects for payload data\n]);\n\n/**\n * Recursive schema for S-expressions.\n * Validates that arrays have at least one element and first element is a string (operator).\n */\nexport const SExprSchema: z.ZodType<SExpr> = z.lazy(() =>\n z.union([\n SExprAtomSchema,\n z\n .array(z.lazy(() => SExprSchema))\n .min(1)\n .refine(\n (arr) => typeof arr[0] === 'string',\n { message: 'S-expression array must have a string operator as first element' }\n ),\n ])\n);\n\n/**\n * Schema for Expression type - S-expressions only.\n * S-expressions are arrays with operator as first element.\n *\n * NOTE: Legacy string format is no longer supported.\n */\nexport const ExpressionSchema: z.ZodType<Expression> = SExprSchema;\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\n/**\n * Type guard for S-expression detection.\n * 100% reliable - structural check, no regex or keyword matching.\n *\n * @param value - Value to check\n * @returns true if value is an S-expression (array with string operator)\n */\nexport function isSExpr(value: unknown): value is SExpr[] {\n return (\n Array.isArray(value) &&\n value.length > 0 &&\n typeof value[0] === 'string'\n );\n}\n\n/**\n * Type guard for S-expression atoms (non-array values).\n * Includes objects (for payload data, props, etc.)\n */\nexport function isSExprAtom(value: unknown): value is SExprAtom {\n if (value === null) return true;\n if (Array.isArray(value)) return false;\n const type = typeof value;\n return type === 'string' || type === 'number' || type === 'boolean' || type === 'object';\n}\n\n/**\n * Check if a value is a binding reference.\n * Bindings start with @ (e.g., @entity.health, @payload.amount, @now)\n */\nexport function isBinding(value: unknown): value is string {\n return typeof value === 'string' && value.startsWith('@');\n}\n\n/**\n * Check if a value is a valid S-expression call (array with operator).\n * Use this to distinguish between S-expression calls and atom values.\n */\nexport function isSExprCall(value: unknown): value is SExpr[] {\n return isSExpr(value);\n}\n\n// ============================================================================\n// Binding Parsing\n// ============================================================================\n\n/**\n * Parsed binding reference\n */\nexport interface ParsedBinding {\n /** Type of binding: core (@entity, @payload, @state, @now) or entity (@EntityName) */\n type: 'core' | 'entity';\n /** The root binding name (entity, payload, state, now, or EntityName) */\n root: string;\n /** Path segments after the root (e.g., ['health'] for @entity.health) */\n path: string[];\n /** Full original binding string */\n original: string;\n}\n\n/**\n * Core bindings that are always available.\n * Phase 4.5 adds: config, computed, trait (for behavior support)\n */\nexport const CORE_BINDINGS = ['entity', 'payload', 'state', 'now', 'config', 'computed', 'trait'] as const;\nexport type CoreBinding = (typeof CORE_BINDINGS)[number];\n\n/**\n * Parse a binding reference into its components.\n * Does NOT use regex - uses structured string operations.\n *\n * @param binding - Binding string starting with @\n * @returns Parsed binding object or null if invalid\n */\nexport function parseBinding(binding: string): ParsedBinding | null {\n if (!binding.startsWith('@')) {\n return null;\n }\n\n // Remove @ prefix\n const withoutPrefix = binding.slice(1);\n\n // Split by dots\n const parts = withoutPrefix.split('.');\n\n if (parts.length === 0 || parts[0] === '') {\n return null;\n }\n\n const root = parts[0];\n const path = parts.slice(1);\n\n // Determine if core binding or entity reference\n const isCore = (CORE_BINDINGS as readonly string[]).includes(root);\n\n return {\n type: isCore ? 'core' : 'entity',\n root,\n path,\n original: binding,\n };\n}\n\n/**\n * Validate a binding reference format.\n *\n * @param binding - Binding string to validate\n * @returns true if valid binding format\n */\nexport function isValidBinding(binding: string): boolean {\n const parsed = parseBinding(binding);\n if (!parsed) return false;\n\n // Core bindings: @entity, @payload, @state, @now (optionally with path)\n // @state and @now don't have paths\n if (parsed.type === 'core') {\n if (parsed.root === 'state' || parsed.root === 'now') {\n return parsed.path.length === 0;\n }\n // @entity and @payload can have paths\n return true;\n }\n\n // Entity bindings: @EntityName.field - must have at least one path segment\n return parsed.path.length > 0;\n}\n\n// ============================================================================\n// S-Expression Utilities\n// ============================================================================\n\n/**\n * Get the operator from an S-expression call.\n *\n * @param expr - S-expression array\n * @returns The operator string or null if not a valid call\n */\nexport function getOperator(expr: SExpr): string | null {\n if (!isSExpr(expr)) return null;\n return expr[0] as string;\n}\n\n/**\n * Get the arguments from an S-expression call.\n *\n * @param expr - S-expression array\n * @returns Array of arguments (empty if not a valid call)\n */\nexport function getArgs(expr: SExpr): SExpr[] {\n if (!isSExpr(expr)) return [];\n return expr.slice(1);\n}\n\n/**\n * Create an S-expression call.\n *\n * @param operator - The operator string\n * @param args - Arguments to the operator\n * @returns S-expression array\n */\nexport function sexpr(operator: string, ...args: SExpr[]): SExpr[] {\n return [operator, ...args];\n}\n\n/**\n * Walk an S-expression tree and apply a visitor function to each node.\n *\n * @param expr - S-expression to walk\n * @param visitor - Function to call on each node\n */\nexport function walkSExpr(\n expr: SExpr,\n visitor: (node: SExpr, parent: SExpr[] | null, index: number) => void,\n parent: SExpr[] | null = null,\n index: number = 0\n): void {\n visitor(expr, parent, index);\n\n if (isSExpr(expr)) {\n for (let i = 0; i < expr.length; i++) {\n walkSExpr(expr[i], visitor, expr, i);\n }\n }\n}\n\n/**\n * Collect all bindings referenced in an S-expression.\n *\n * @param expr - S-expression to analyze\n * @returns Array of binding strings found\n */\nexport function collectBindings(expr: SExpr): string[] {\n const bindings: string[] = [];\n\n walkSExpr(expr, (node) => {\n if (isBinding(node)) {\n bindings.push(node);\n }\n });\n\n return bindings;\n}\n\n// ============================================================================\n// Type Exports\n// ============================================================================\n\nexport type SExprInput = z.input<typeof SExprSchema>;\nexport type ExpressionInput = z.input<typeof ExpressionSchema>;\n","/**\n * State Machine Types (Self-Contained)\n *\n * Defines state machine types for traits.\n * Copied from schema/state-machine.ts to make orbitals/ self-contained.\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\nimport type { Effect } from \"./effect.js\";\nimport { EffectSchema } from \"./effect.js\";\nimport type { Expression } from \"./expression.js\";\nimport { ExpressionSchema } from \"./expression.js\";\n\n// ============================================================================\n// State\n// ============================================================================\n\n/**\n * Represents a state in the state machine\n */\nexport interface State {\n /** State name (unique identifier) */\n name: string;\n /** Whether this is the initial state */\n isInitial?: boolean;\n /** Whether this is a terminal state (no outgoing transitions expected) */\n isTerminal?: boolean;\n /** Whether this is a final state (legacy alias for isTerminal) */\n isFinal?: boolean;\n /** Human-readable description */\n description?: string;\n /** Effect names to run on entry */\n onEntry?: string[];\n /** Effect names to run on exit */\n onExit?: string[];\n}\n\nexport const StateSchema = z.object({\n name: z.string().min(1, \"State name is required\"),\n isInitial: z.boolean().optional(),\n isTerminal: z.boolean().optional(),\n isFinal: z.boolean().optional(),\n description: z.string().optional(),\n onEntry: z.array(z.string()).optional(),\n onExit: z.array(z.string()).optional(),\n});\n\n// ============================================================================\n// Event\n// ============================================================================\n\n/**\n * Payload field definition for events\n */\nexport interface PayloadField {\n name: string;\n type: \"string\" | \"number\" | \"boolean\" | \"object\" | \"array\";\n required?: boolean;\n}\n\nexport const PayloadFieldSchema = z.object({\n name: z.string().min(1),\n type: z.enum([\"string\", \"number\", \"boolean\", \"object\", \"array\"]),\n required: z.boolean().optional(),\n});\n\n/**\n * Represents an event that can trigger transitions\n */\nexport interface Event {\n /** Event key (UPPER_SNAKE_CASE) */\n key: string;\n /** Human-readable name */\n name: string;\n /** Description */\n description?: string;\n /** Expected payload structure */\n payloadSchema?: PayloadField[];\n /** Domain vs System classification (optional, for analysis) */\n classification?: \"domain\" | \"system\";\n /** Semantic role of this event (optional, for analysis) */\n semanticRole?: string;\n}\n\nexport const EventSchema = z.object({\n key: z.string().min(1, \"Event key is required\"),\n name: z.string().min(1, \"Event name is required\"),\n description: z.string().optional(),\n payloadSchema: z.array(PayloadFieldSchema).optional(),\n classification: z.enum([\"domain\", \"system\"]).optional(),\n semanticRole: z.string().optional(),\n});\n\n// ============================================================================\n// Guard\n// ============================================================================\n\n/**\n * Represents a named guard condition.\n * Expression must be an S-expression.\n *\n * @example\n * {\n * name: \"hasHealth\",\n * expression: [\">\", \"@entity.health\", 0],\n * description: \"Check if entity has health remaining\"\n * }\n */\nexport interface Guard {\n name: string;\n /** Guard expression - S-expression array only */\n expression: Expression;\n description?: string;\n}\n\nexport const GuardSchema = z.object({\n name: z.string().min(1, \"Guard name is required\"),\n expression: ExpressionSchema,\n description: z.string().optional(),\n});\n\n// ============================================================================\n// Transition (Effect imported separately to avoid circular deps)\n// ============================================================================\n\n/**\n * Represents a transition between states.\n * Guards and effects must be S-expressions.\n *\n * @example\n * {\n * from: \"idle\",\n * to: \"running\",\n * event: \"START\",\n * guard: [\">\", \"@entity.fuel\", 0],\n * effects: [\n * [\"set\", \"@entity.status\", \"running\"],\n * [\"emit\", \"ENGINE_STARTED\"]\n * ]\n * }\n */\nexport interface Transition {\n /** Source state name */\n from: string;\n /** Target state name */\n to: string;\n /** Event key that triggers this transition */\n event: string;\n /** Guard expression - S-expression array */\n guard?: Expression | null;\n /** Effects to execute - S-expression arrays */\n effects?: Effect[];\n /** Description */\n description?: string | null;\n}\n\nexport const TransitionSchema = z.object({\n from: z.string().min(1, \"Transition source state is required\"),\n to: z.string().min(1, \"Transition target state is required\"),\n event: z.string().min(1, \"Transition event is required\"),\n guard: ExpressionSchema.nullish(),\n effects: z.array(EffectSchema).optional(),\n description: z.string().nullish(),\n});\n\n// ============================================================================\n// State Machine\n// ============================================================================\n\n/**\n * Complete state machine definition\n */\nexport interface StateMachine {\n /** All states in the machine */\n states: State[];\n /** All events that can be triggered */\n events: Event[];\n /** All transitions between states */\n transitions: Transition[];\n /** Named guard definitions */\n guards?: Guard[];\n}\n\nexport const StateMachineSchema = z.object({\n states: z.array(StateSchema).min(1, \"At least one state is required\"),\n events: z.array(EventSchema),\n transitions: z.array(TransitionSchema),\n guards: z.array(GuardSchema).optional(),\n});\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type StateInput = z.input<typeof StateSchema>;\nexport type EventInput = z.input<typeof EventSchema>;\nexport type GuardInput = z.input<typeof GuardSchema>;\nexport type TransitionInput = z.input<typeof TransitionSchema>;\nexport type StateMachineInput = z.input<typeof StateMachineSchema>;\n","/**\n * Trait Types (Self-Contained)\n *\n * Defines trait types for behavioral patterns.\n * Self-contained - imports only from local orbital types.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\nimport type { StateMachine } from './state-machine.js';\nimport { StateMachineSchema } from './state-machine.js';\nimport type { Effect } from './effect.js';\nimport { EffectSchema } from './effect.js';\nimport type { Expression } from './expression.js';\nimport { ExpressionSchema } from './expression.js';\n\n// ============================================================================\n// Trait Categories\n// ============================================================================\n\n/**\n * Categories for organizing traits\n */\nexport type TraitCategory =\n | 'lifecycle'\n | 'temporal'\n | 'validation'\n | 'notification'\n | 'integration'\n | 'interaction'\n | 'game-core'\n | 'game-character'\n | 'game-ai'\n | 'game-combat'\n | 'game-items'\n | 'game-cards'\n | 'game-board'\n | 'game-puzzle';\n\nexport const TraitCategorySchema = z.enum([\n 'lifecycle',\n 'temporal',\n 'validation',\n 'notification',\n 'integration',\n 'interaction',\n 'game-core',\n 'game-character',\n 'game-ai',\n 'game-combat',\n 'game-items',\n 'game-cards',\n 'game-board',\n 'game-puzzle',\n]);\n\n// ============================================================================\n// Trait Entity Field (simplified)\n// ============================================================================\n\n/**\n * Field types for trait data entities\n */\nexport type TraitFieldType = 'string' | 'number' | 'boolean' | 'date' | 'array' | 'object' | 'timestamp' | 'datetime' | 'enum';\n\n/**\n * Simplified field for trait data entities\n */\nexport interface TraitEntityField {\n name: string;\n type: TraitFieldType;\n required?: boolean;\n default?: unknown;\n values?: string[];\n}\n\nexport const TraitEntityFieldSchema = z.object({\n name: z.string().min(1),\n type: z.enum([\n 'string',\n 'number',\n 'boolean',\n 'date',\n 'array',\n 'object',\n 'timestamp',\n 'datetime',\n 'enum',\n ]),\n required: z.boolean().optional(),\n default: z.unknown().optional(),\n values: z.array(z.string()).optional(),\n});\n\n// ============================================================================\n// Trait Data Entity\n// ============================================================================\n\n/**\n * Simplified data entity for traits\n */\nexport interface TraitDataEntity {\n name: string;\n collection?: string;\n fields: TraitEntityField[];\n timestamps?: boolean;\n description?: string;\n runtime?: boolean;\n singleton?: boolean;\n pages?: string[];\n}\n\nexport const TraitDataEntitySchema = z.object({\n name: z.string().min(1),\n collection: z.string().optional(),\n fields: z.array(TraitEntityFieldSchema).min(1),\n timestamps: z.boolean().optional(),\n description: z.string().optional(),\n runtime: z.boolean().optional(),\n singleton: z.boolean().optional(),\n pages: z.array(z.string()).optional(),\n});\n\n// ============================================================================\n// Trait Tick\n// ============================================================================\n\n/**\n * Tick rule for traits.\n * Guards can be legacy strings or S-expressions.\n * Effects can be typed Effect objects or S-expressions.\n */\nexport interface TraitTick {\n name: string;\n description?: string;\n priority?: number;\n interval: string | number;\n appliesTo?: string[];\n pages?: string[];\n /** Guard expression - string (legacy) or S-expression array */\n guard?: Expression;\n /** Effects to execute (S-expressions) */\n effects: Effect[];\n /**\n * Events this tick emits.\n * Must reference events defined in trait's emits array.\n * Used for validation and documentation.\n */\n emits?: string[];\n}\n\nexport const TraitTickSchema = z.object({\n name: z.string().min(1),\n description: z.string().optional(),\n priority: z.number().optional(),\n interval: z.union([z.literal('frame'), z.number().positive()]),\n appliesTo: z.array(z.string()).optional(),\n pages: z.array(z.string()).optional(),\n guard: ExpressionSchema.optional(),\n effects: z.array(EffectSchema).min(1),\n emits: z.array(z.string()).optional(),\n});\n\n// ============================================================================\n// Event Scope\n// ============================================================================\n\n/**\n * Event scope determines visibility:\n * - 'internal': Trait-to-trait within same orbital (default)\n * - 'external': Exposed for cross-orbital communication\n */\nexport type EventScope = 'internal' | 'external';\n\nexport const EventScopeSchema = z.enum(['internal', 'external']);\n\n// ============================================================================\n// Event Payload Field\n// ============================================================================\n\n/**\n * Payload field definition for events.\n * Defines the structure of data carried by events.\n */\nexport interface EventPayloadField {\n /** Field name */\n name: string;\n /** Field type */\n type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'entity';\n /** Whether field is required in payload */\n required?: boolean;\n /** Human-readable description */\n description?: string;\n /** For 'entity' type: the entity type name */\n entityType?: string;\n}\n\nexport const EventPayloadFieldSchema = z.object({\n name: z.string().min(1),\n type: z.enum(['string', 'number', 'boolean', 'object', 'array', 'entity']),\n required: z.boolean().optional(),\n description: z.string().optional(),\n entityType: z.string().optional(),\n});\n\n// ============================================================================\n// Trait Event Contract\n// ============================================================================\n\n/**\n * Event contract for events a trait emits.\n * Declares the event name, scope, and payload schema.\n */\nexport interface TraitEventContract {\n /** Event name (UPPER_SNAKE_CASE) */\n event: string;\n /** Human-readable description */\n description?: string;\n /** Payload schema - what data this event carries */\n payload?: EventPayloadField[];\n /**\n * Event scope:\n * - 'internal': Trait-to-trait within same orbital (default)\n * - 'external': Exposed for cross-orbital communication\n */\n scope?: EventScope;\n}\n\nexport const TraitEventContractSchema = z.object({\n event: z.string().min(1).regex(\n /^[A-Z][A-Z0-9_]*$/,\n 'Event name must be UPPER_SNAKE_CASE'\n ),\n description: z.string().optional(),\n payload: z.array(EventPayloadFieldSchema).optional(),\n scope: EventScopeSchema.optional(),\n});\n\n// ============================================================================\n// Trait Event Listener\n// ============================================================================\n\n/**\n * Event listener for trait communication.\n * Guards can be legacy strings or S-expressions.\n * Enhanced with scope and payloadMapping for cross-orbital communication.\n */\nexport interface TraitEventListener {\n /** Event key to listen for (may be namespaced: TraitName.EVENT_NAME) */\n event: string;\n /** State machine event to trigger */\n triggers: string;\n /** Guard expression - string (legacy) or S-expression array */\n guard?: Expression;\n /**\n * Listener scope:\n * - 'internal': Listen to events within same orbital (default)\n * - 'external': Listen to events from other orbitals\n */\n scope?: EventScope;\n /** Map event payload fields to transition payload */\n payloadMapping?: Record<string, string>;\n}\n\nexport const TraitEventListenerSchema = z.object({\n event: z.string().min(1),\n triggers: z.string().min(1),\n guard: ExpressionSchema.optional(),\n scope: EventScopeSchema.optional(),\n payloadMapping: z.record(z.string()).optional(),\n});\n\n// ============================================================================\n// Required Field\n// ============================================================================\n\n/**\n * Field required by a trait from its linkedEntity\n */\nexport interface RequiredField {\n name: string;\n type: 'string' | 'number' | 'boolean' | 'date' | 'array' | 'object' | 'timestamp' | 'datetime' | 'enum';\n description?: string;\n}\n\nexport const RequiredFieldSchema = z.object({\n name: z.string().min(1),\n type: z.enum(['string', 'number', 'boolean', 'date', 'array', 'object', 'timestamp', 'datetime', 'enum']),\n description: z.string().optional(),\n});\n\n// ============================================================================\n// Trait Reference\n// ============================================================================\n\n/**\n * Reference to a trait from an entity or page\n */\nexport interface TraitReference {\n ref: string;\n linkedEntity?: string;\n config?: Record<string, Record<string, unknown>>;\n appliesTo?: string[];\n}\n\nexport const TraitReferenceSchema = z.object({\n ref: z.string().min(1),\n linkedEntity: z.string().optional(),\n config: z.record(z.record(z.unknown())).optional(),\n appliesTo: z.array(z.string()).optional(),\n});\n\n/**\n * Simplified trait reference - supports string, reference object, or inline Trait definition\n * - string: \"TraitName\" - reference to a trait by name\n * - { ref: \"TraitName\" }: reference object with optional config\n * - { name: \"TraitName\", stateMachine: {...} }: inline trait definition\n */\nexport type TraitRef = string | { ref: string; config?: Record<string, unknown>; linkedEntity?: string } | Trait;\n\n// TraitRefSchema is defined after TraitSchema (see below) to avoid forward reference\n\n// ============================================================================\n// Trait UI Binding\n// ============================================================================\n\nexport type PresentationType = 'modal' | 'drawer' | 'popover' | 'inline' | 'confirm-dialog';\n\nexport interface TraitUIBinding {\n [stateName: string]: {\n presentation: PresentationType;\n content: Record<string, unknown> | Record<string, unknown>[];\n props?: {\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';\n position?: 'left' | 'right' | 'top' | 'bottom' | 'center';\n title?: string;\n closable?: boolean;\n width?: string;\n showProgress?: boolean;\n step?: number;\n totalSteps?: number;\n };\n };\n}\n\n// ============================================================================\n// Trait Definition\n// ============================================================================\n\n/**\n * A Trait is a reusable behavioral module with state machine.\n *\n * Traits declare their event contracts via `emits` and `listens`:\n * - `emits`: Events this trait can emit (with scope and payload schema)\n * - `listens`: Events this trait listens for (with optional payloadMapping)\n */\nexport interface Trait {\n name: string;\n description?: string;\n description_visual_prompt?: string;\n category?: TraitCategory;\n requiredFields?: RequiredField[];\n dataEntities?: TraitDataEntity[];\n stateMachine?: StateMachine;\n initialEffects?: Effect[];\n ticks?: TraitTick[];\n /**\n * Events this trait emits.\n * Each event can be scoped as internal or external.\n * External events are namespaced at orbital level (TraitName.EVENT_NAME).\n */\n emits?: TraitEventContract[];\n /**\n * Events this trait listens for.\n * External listeners reference namespaced events (TraitName.EVENT_NAME).\n */\n listens?: TraitEventListener[];\n ui?: TraitUIBinding;\n}\n\nexport const TraitSchema = z.object({\n name: z.string().min(1),\n description: z.string().optional(),\n description_visual_prompt: z.string().optional(),\n category: TraitCategorySchema.optional(),\n requiredFields: z.array(RequiredFieldSchema).optional(),\n dataEntities: z.array(TraitDataEntitySchema).optional(),\n stateMachine: StateMachineSchema.optional(),\n initialEffects: z.array(EffectSchema).optional(),\n ticks: z.array(TraitTickSchema).optional(),\n emits: z.array(TraitEventContractSchema).optional(),\n listens: z.array(TraitEventListenerSchema).optional(),\n ui: z.record(z.unknown()).optional(),\n});\n\n// TraitRefSchema defined here after TraitSchema to avoid forward reference\nexport const TraitRefSchema = z.union([\n z.string().min(1),\n z.object({\n ref: z.string().min(1),\n config: z.record(z.unknown()).optional(),\n linkedEntity: z.string().optional(),\n }),\n TraitSchema, // Allow inline trait definitions\n]);\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Check if a trait ref is an inline Trait definition\n */\nexport function isInlineTrait(traitRef: TraitRef): traitRef is Trait {\n return typeof traitRef === 'object' && 'name' in traitRef && !('ref' in traitRef);\n}\n\n/**\n * Get trait name from a trait reference\n */\nexport function getTraitName(traitRef: TraitRef): string {\n if (typeof traitRef === 'string') {\n return traitRef;\n }\n if (isInlineTrait(traitRef)) {\n return traitRef.name;\n }\n return traitRef.ref;\n}\n\n/**\n * Get trait config from a trait reference\n */\nexport function getTraitConfig(traitRef: TraitRef): Record<string, unknown> | undefined {\n if (typeof traitRef === 'string') {\n return undefined;\n }\n if (isInlineTrait(traitRef)) {\n return undefined; // Inline traits don't have config\n }\n return traitRef.config;\n}\n\n/**\n * Normalize trait reference to object form\n */\nexport function normalizeTraitRef(traitRef: TraitRef): { ref: string; config?: Record<string, unknown> } {\n if (typeof traitRef === 'string') {\n return { ref: traitRef };\n }\n if (isInlineTrait(traitRef)) {\n return { ref: traitRef.name };\n }\n return traitRef;\n}\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type TraitInput = z.input<typeof TraitSchema>;\nexport type TraitReferenceInput = z.input<typeof TraitReferenceSchema>;\n\n// Backward compatibility aliases\nexport type OrbitalTraitRef = TraitRef;\nexport const OrbitalTraitRefSchema = TraitRefSchema;\n","/**\n * Domain Context Types (Self-Contained)\n *\n * Defines domain classification types for applications.\n * Copied from schema/domain-context.ts to make orbitals/ self-contained.\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\n\n// ============================================================================\n// Domain Categories\n// ============================================================================\n\n/**\n * High-level domain categories\n */\nexport type DomainCategory =\n | \"healthcare\"\n | \"education\"\n | \"finance\"\n | \"ecommerce\"\n | \"real-estate\"\n | \"logistics\"\n | \"hospitality\"\n | \"hr-management\"\n | \"project-management\"\n | \"social\"\n | \"content-management\"\n | \"iot\"\n | \"analytics\"\n | \"game\"\n | \"custom\";\n\nexport const DomainCategorySchema = z.enum([\n \"healthcare\",\n \"education\",\n \"finance\",\n \"ecommerce\",\n \"real-estate\",\n \"logistics\",\n \"hospitality\",\n \"hr-management\",\n \"project-management\",\n \"social\",\n \"content-management\",\n \"iot\",\n \"analytics\",\n \"game\",\n \"custom\",\n]);\n\n// ============================================================================\n// Game Sub-Categories\n// ============================================================================\n\n/**\n * Game genre sub-categories\n */\nexport type GameSubCategory =\n | \"platformer\"\n | \"shooter\"\n | \"puzzle\"\n | \"rpg\"\n | \"board\"\n | \"racing\"\n | \"fighting\"\n | \"tower-defense\"\n | \"endless-runner\"\n | \"simulation\"\n | \"arcade\"\n | \"adventure\";\n\nexport const GameSubCategorySchema = z.enum([\n \"platformer\",\n \"shooter\",\n \"puzzle\",\n \"rpg\",\n \"board\",\n \"racing\",\n \"fighting\",\n \"tower-defense\",\n \"endless-runner\",\n \"simulation\",\n \"arcade\",\n \"adventure\",\n]);\n\n// ============================================================================\n// Node Classification\n// ============================================================================\n\n/**\n * Domain vs System classification\n */\nexport type NodeClassification = \"domain\" | \"system\";\n\nexport const NodeClassificationSchema = z.enum([\"domain\", \"system\"]);\n\n// ============================================================================\n// Semantic Roles\n// ============================================================================\n\nexport type StateSemanticRole =\n | \"pending\"\n | \"active\"\n | \"completed\"\n | \"cancelled\"\n | \"error\"\n | \"suspended\"\n | \"blocked\"\n | \"domain_workflow\"\n | \"domain_status\"\n | \"system_loading\"\n | \"system_error\"\n | \"system_idle\"\n | \"system_editing\"\n | \"system_confirming\";\n\nexport const StateSemanticRoleSchema = z.enum([\n \"pending\",\n \"active\",\n \"completed\",\n \"cancelled\",\n \"error\",\n \"suspended\",\n \"blocked\",\n \"domain_workflow\",\n \"domain_status\",\n \"system_loading\",\n \"system_error\",\n \"system_idle\",\n \"system_editing\",\n \"system_confirming\",\n]);\n\nexport type EventSemanticRole =\n | \"domain_action\"\n | \"domain_trigger\"\n | \"system_crud\"\n | \"system_navigation\"\n | \"system_form\"\n | \"system_ui\";\n\nexport const EventSemanticRoleSchema = z.enum([\n \"domain_action\",\n \"domain_trigger\",\n \"system_crud\",\n \"system_navigation\",\n \"system_form\",\n \"system_ui\",\n]);\n\nexport type EntitySemanticRole =\n | \"domain_core\"\n | \"domain_supporting\"\n | \"domain_reference\"\n | \"system_user\"\n | \"system_config\"\n | \"system_audit\";\n\nexport const EntitySemanticRoleSchema = z.enum([\n \"domain_core\",\n \"domain_supporting\",\n \"domain_reference\",\n \"system_user\",\n \"system_config\",\n \"system_audit\",\n]);\n\n// ============================================================================\n// Domain Vocabulary\n// ============================================================================\n\n/**\n * Domain-specific vocabulary for naming conventions.\n * Maps generic terms to domain-appropriate labels.\n */\nexport interface DomainVocabulary {\n /** Label for items (e.g., \"Task\", \"Cargo\", \"Patient\") */\n item?: string;\n /** Label for collections (e.g., \"Tasks\", \"Inventory\", \"Patients\") */\n collection?: string;\n /** Label for create action (e.g., \"Add\", \"Recruit\", \"Admit\") */\n create?: string;\n /** Label for delete action (e.g., \"Remove\", \"Discharge\", \"Archive\") */\n delete?: string;\n /** Label for container (e.g., \"List\", \"Hold\", \"Ward\") */\n container?: string;\n /** Additional custom vocabulary */\n [key: string]: string | undefined;\n}\n\nexport const DomainVocabularySchema = z\n .record(z.string(), z.string())\n .optional();\n\n// ============================================================================\n// Domain Context (Simplified for Design System)\n// ============================================================================\n\n/**\n * User persona for UX decisions\n */\nexport interface UserPersona {\n /** Persona name */\n name: string;\n /** Role for RBAC */\n role?: string;\n /** Primary device */\n device?: \"mobile\" | \"tablet\" | \"desktop\";\n}\n\nexport const UserPersonaSchema = z.object({\n name: z.string().min(1),\n role: z.string().optional(),\n device: z.enum([\"mobile\", \"tablet\", \"desktop\"]).optional(),\n});\n\n/**\n * Domain context - user request + classification\n */\nexport interface DomainContext {\n /** Original user request - verbatim (typically at schema level) */\n request: string;\n /**\n * The verbatim excerpt or summary of the user request that produced THIS orbital.\n *\n * Purpose: Traceability - know exactly what the user asked for that led to this orbital.\n *\n * Can be:\n * - Exact quote: \"...with a calendar that syncs with Google Calendar...\"\n * - Summarized: \"Calendar integration with Google Calendar sync\"\n *\n * Examples:\n * - Request: \"Build a project management app with tasks, team collaboration, and Gantt charts\"\n * - Task orbital: requestFragment: \"tasks\"\n * - Team orbital: requestFragment: \"team collaboration\"\n * - Timeline orbital: requestFragment: \"Gantt charts\"\n *\n * This enables:\n * - Understanding WHY this orbital exists\n * - Regenerating with original context preserved\n * - Validating the orbital matches user intent\n */\n requestFragment?: string;\n /** Domain category */\n category: \"game\" | \"business\" | \"dashboard\" | \"form\" | \"content\" | \"social\";\n /** Sub-domain for more specific classification */\n subDomain?: string;\n /** User personas */\n personas?: UserPersona[];\n /** Domain-specific vocabulary for naming */\n vocabulary?: DomainVocabulary;\n}\n\nexport const DomainContextSchema = z.object({\n request: z.string().min(1, \"Original request is required\"),\n requestFragment: z.string().optional(),\n category: z.enum([\n \"game\",\n \"business\",\n \"dashboard\",\n \"form\",\n \"content\",\n \"social\",\n ]),\n subDomain: z.string().optional(),\n personas: z.array(UserPersonaSchema).optional(),\n vocabulary: DomainVocabularySchema.optional(),\n});\n\n// ============================================================================\n// UX Hints\n// ============================================================================\n\n/**\n * UX hints for guiding UI generation.\n * These inform pattern selection and layout decisions.\n */\n/**\n * UX hints for guiding UI generation.\n * These inform pattern selection and layout decisions.\n *\n * Note: These are HINTS, not strict requirements. LLMs may use any string value\n * including 'dashboard-grid', 'none', etc. The subagent generator interprets these\n * flexibly to produce appropriate render-ui effects.\n */\nexport interface UXHints {\n /** Overall user flow pattern (e.g., 'hub-spoke', 'crud-cycle', 'linear') */\n flowPattern?: string;\n /** Pattern for displaying lists (e.g., 'entity-table', 'entity-cards', 'dashboard-grid', 'none') */\n listPattern?: string;\n /** Pattern for create/edit forms (e.g., 'modal', 'drawer', 'page', 'none') */\n formPattern?: string;\n /** Pattern for entity detail views (e.g., 'drawer', 'page', 'split', 'none') */\n detailPattern?: string;\n /** Cross-orbital navigation links */\n relatedLinks?: RelatedLink[];\n}\n\n// UX hints use flexible string types - they are guidance, not strict validation\nexport const UXHintsSchema = z.object({\n flowPattern: z.string().optional(),\n listPattern: z.string().optional(),\n formPattern: z.string().optional(),\n detailPattern: z.string().optional(),\n relatedLinks: z.array(z.lazy(() => RelatedLinkSchema)).optional(),\n});\n\n/**\n * Related link for cross-orbital navigation.\n */\nexport interface RelatedLink {\n /** Field name of the relation (e.g., \"customerId\") */\n relation: string;\n /** Button/link text (e.g., \"View Customer\") */\n label: string;\n /** Target view type */\n targetView?: \"list\" | \"detail\";\n}\n\nexport const RelatedLinkSchema = z.object({\n relation: z.string().min(1),\n label: z.string().min(1),\n targetView: z.enum([\"list\", \"detail\"]).optional(),\n});\n\n// ============================================================================\n// Suggested Guards (Pre-Generation)\n// ============================================================================\n\n/**\n * Suggested guard - natural language description for decomposition phase.\n * Generator converts these to S-expressions during generation.\n */\nexport interface SuggestedGuard {\n /** Unique identifier */\n id: string;\n /** Natural language description (e.g., \"Weight must be under 1000kg\") */\n description: string;\n /** Events this guard applies to (e.g., [\"Cargo.CREATE\", \"Cargo.UPDATE\"]) */\n appliesTo: string[];\n}\n\nexport const SuggestedGuardSchema = z.object({\n id: z.string().min(1),\n description: z.string().min(1),\n appliesTo: z.array(z.string().min(1)),\n});\n\n// ============================================================================\n// Design Preferences\n// ============================================================================\n\n/**\n * Design preferences for visual styling\n */\nexport interface DesignPreferences {\n /** Design style */\n style?: \"minimal\" | \"modern\" | \"playful\" | \"data-driven\" | \"immersive\";\n /** Primary color (hex) */\n primaryColor?: string;\n /** Target device */\n device?: \"mobile\" | \"tablet\" | \"desktop\" | \"all\";\n /** Dark mode */\n darkMode?: boolean;\n /** UX hints for pattern selection */\n uxHints?: UXHints;\n}\n\nexport const DesignPreferencesSchema = z.object({\n style: z\n .enum([\"minimal\", \"modern\", \"playful\", \"data-driven\", \"immersive\"])\n .optional(),\n primaryColor: z\n .string()\n .regex(/^#[0-9A-Fa-f]{6}$/, \"Must be valid hex color\")\n .optional(),\n device: z.enum([\"mobile\", \"tablet\", \"desktop\", \"all\"]).optional(),\n darkMode: z.boolean().optional(),\n uxHints: UXHintsSchema.optional(),\n});\n\n// ============================================================================\n// Theme Definition\n// ============================================================================\n\n/**\n * Theme tokens - CSS custom properties for design system.\n */\nexport interface ThemeTokens {\n /** Color tokens (e.g., primary, background, foreground) */\n colors?: Record<string, string>;\n /** Border radius tokens */\n radii?: Record<string, string>;\n /** Spacing tokens */\n spacing?: Record<string, string>;\n /** Typography tokens */\n typography?: Record<string, string>;\n /** Shadow tokens */\n shadows?: Record<string, string>;\n}\n\nexport const ThemeTokensSchema = z.object({\n colors: z.record(z.string(), z.string()).optional(),\n radii: z.record(z.string(), z.string()).optional(),\n spacing: z.record(z.string(), z.string()).optional(),\n typography: z.record(z.string(), z.string()).optional(),\n shadows: z.record(z.string(), z.string()).optional(),\n});\n\n/**\n * Theme variant - overrides for a specific mode (e.g., dark mode).\n */\nexport interface ThemeVariant {\n /** Color overrides */\n colors?: Record<string, string>;\n /** Radius overrides */\n radii?: Record<string, string>;\n /** Spacing overrides */\n spacing?: Record<string, string>;\n /** Typography overrides */\n typography?: Record<string, string>;\n /** Shadow overrides */\n shadows?: Record<string, string>;\n}\n\nexport const ThemeVariantSchema = z.object({\n colors: z.record(z.string(), z.string()).optional(),\n radii: z.record(z.string(), z.string()).optional(),\n spacing: z.record(z.string(), z.string()).optional(),\n typography: z.record(z.string(), z.string()).optional(),\n shadows: z.record(z.string(), z.string()).optional(),\n});\n\n/**\n * Theme definition - design system for an orbital.\n */\nexport interface ThemeDefinition {\n /** Theme name */\n name: string;\n /** Base tokens */\n tokens: ThemeTokens;\n /** Named variants (e.g., \"dark\", \"high-contrast\") */\n variants?: Record<string, ThemeVariant>;\n}\n\nexport const ThemeDefinitionSchema = z.object({\n name: z.string().min(1, \"Theme name is required\"),\n tokens: ThemeTokensSchema,\n variants: z.record(z.string(), ThemeVariantSchema).optional(),\n});\n\n/**\n * ThemeRef - Theme can be inline definition OR reference to imported theme.\n *\n * Reference format: \"Alias.theme\"\n */\nexport type ThemeRef = ThemeDefinition | string;\n\n/**\n * Check if ThemeRef is a reference string.\n */\nexport function isThemeReference(theme: ThemeRef): theme is string {\n return typeof theme === \"string\";\n}\n\n/**\n * Validate theme reference format: \"Alias.theme\"\n */\nexport const ThemeRefStringSchema = z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*\\.theme$/,\n 'Theme reference must be in format \"Alias.theme\" (e.g., \"Ocean.theme\")',\n );\n\nexport const ThemeRefSchema = z.union([\n ThemeDefinitionSchema,\n ThemeRefStringSchema,\n]);\n\n// ============================================================================\n// Design Tokens (Legacy)\n// ============================================================================\n\n/**\n * Design tokens - reusable Tailwind class collections.\n * @deprecated Use ThemeDefinition instead for new code.\n *\n * Instead of repeating raw Tailwind classes everywhere, define once and reference by name.\n * Example: `token: \"surfaces.glass\"` resolves to the Tailwind classes defined here.\n */\nexport interface DesignTokens {\n /** Surface styles: backgrounds, borders, shadows */\n surfaces?: Record<string, string>;\n /** Text styles: typography, colors */\n text?: Record<string, string>;\n /** Interactive element styles: buttons, links */\n interactive?: Record<string, string>;\n /** Effect styles: shadows, animations, transitions */\n effects?: Record<string, string>;\n /** Additional custom categories */\n [category: string]: Record<string, string> | undefined;\n}\n\nexport const DesignTokensSchema = z\n .record(z.string(), z.record(z.string(), z.string()))\n .optional();\n\n// ============================================================================\n// Custom Pattern Definitions\n// ============================================================================\n\n/**\n * Allowed HTML elements for custom patterns.\n * These are safe, semantic elements for building custom UIs.\n */\nexport const ALLOWED_CUSTOM_COMPONENTS = [\n \"div\",\n \"span\",\n \"button\",\n \"a\",\n \"p\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"header\",\n \"footer\",\n \"section\",\n \"article\",\n \"nav\",\n \"main\",\n \"aside\",\n \"ul\",\n \"ol\",\n \"li\",\n \"img\",\n \"label\",\n \"input\",\n \"form\",\n] as const;\n\nexport type AllowedCustomComponent = (typeof ALLOWED_CUSTOM_COMPONENTS)[number];\n\n/**\n * Custom pattern definition for app-specific reusable patterns.\n *\n * Register custom designs that can be referenced by name throughout the schema.\n */\nexport interface CustomPatternDefinition {\n /** Always 'custom' for custom patterns */\n type: \"custom\";\n /** HTML element to render */\n component: AllowedCustomComponent;\n /** Base Tailwind classes (can include {prop} placeholders) */\n className: string;\n /** Named content slots for nested content */\n slots?: string[];\n /** Configurable props that can be passed when using the pattern */\n props?: string[];\n}\n\nexport const CustomPatternDefinitionSchema = z.object({\n type: z.literal(\"custom\"),\n component: z.enum(ALLOWED_CUSTOM_COMPONENTS),\n className: z.string(),\n slots: z.array(z.string()).optional(),\n props: z.array(z.string()).optional(),\n});\n\n/**\n * Map of custom pattern names to their definitions.\n */\nexport type CustomPatternMap = Record<string, CustomPatternDefinition>;\n\nexport const CustomPatternMapSchema = z\n .record(z.string(), CustomPatternDefinitionSchema)\n .optional();\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type DomainContextInput = z.input<typeof DomainContextSchema>;\nexport type DesignPreferencesInput = z.input<typeof DesignPreferencesSchema>;\nexport type UserPersonaInput = z.input<typeof UserPersonaSchema>;\nexport type DesignTokensInput = z.input<typeof DesignTokensSchema>;\nexport type CustomPatternDefinitionInput = z.input<\n typeof CustomPatternDefinitionSchema\n>;\nexport type CustomPatternMapInput = z.input<typeof CustomPatternMapSchema>;\n","/**\n * Service Types for Orbital Schema\n *\n * Defines external service integrations (REST APIs, WebSockets, MCP servers)\n * that can be used by orbital units via the `call_service` effect.\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\n\n// ============================================================================\n// Service Type Enum\n// ============================================================================\n\n/**\n * Types of external services that can be integrated.\n */\nexport const SERVICE_TYPES = [\"rest\", \"socket\", \"mcp\"] as const;\n\nexport type ServiceType = (typeof SERVICE_TYPES)[number];\n\nexport const ServiceTypeSchema = z.enum(SERVICE_TYPES);\n\n// ============================================================================\n// REST Service Definition\n// ============================================================================\n\n/**\n * Configuration for a REST API service.\n *\n * @example\n * ```typescript\n * const weatherService: RestServiceDef = {\n * name: 'WeatherAPI',\n * type: 'rest',\n * baseUrl: 'https://api.openweathermap.org/data/2.5',\n * headers: {\n * 'Content-Type': 'application/json',\n * },\n * auth: {\n * type: 'api-key',\n * keyName: 'appid',\n * location: 'query',\n * },\n * };\n * ```\n */\nexport interface RestServiceDef {\n /** Unique service name (used in call_service effect) */\n name: string;\n\n /** Service type */\n type: \"rest\";\n\n /** Optional description */\n description?: string;\n\n /** Base URL for the API */\n baseUrl: string;\n\n /** Default headers to include in all requests */\n headers?: Record<string, string>;\n\n /** Authentication configuration */\n auth?: RestAuthConfig;\n\n /** Timeout in milliseconds (default: 30000) */\n timeout?: number;\n}\n\n/**\n * Authentication configuration for REST services.\n */\nexport interface RestAuthConfig {\n /** Authentication type */\n type: \"api-key\" | \"bearer\" | \"basic\" | \"oauth2\";\n\n /** For api-key: the query parameter or header name */\n keyName?: string;\n\n /** For api-key: where to place the key */\n location?: \"query\" | \"header\";\n\n /** Environment variable name containing the secret (for secure storage) */\n secretEnv?: string;\n}\n\nexport const RestAuthConfigSchema = z.object({\n type: z.enum([\"api-key\", \"bearer\", \"basic\", \"oauth2\"]),\n keyName: z.string().optional(),\n location: z.enum([\"query\", \"header\"]).optional(),\n secretEnv: z.string().optional(),\n});\n\nexport const RestServiceDefSchema = z.object({\n name: z.string().min(1, \"Service name is required\"),\n type: z.literal(\"rest\"),\n description: z.string().optional(),\n baseUrl: z.string().url(\"Base URL must be a valid URL\"),\n headers: z.record(z.string()).optional(),\n auth: RestAuthConfigSchema.optional(),\n timeout: z.number().positive().optional(),\n});\n\n// ============================================================================\n// Socket Service Definition\n// ============================================================================\n\n/**\n * Configuration for a WebSocket service.\n *\n * @example\n * ```typescript\n * const chatService: SocketServiceDef = {\n * name: 'ChatSocket',\n * type: 'socket',\n * url: 'wss://chat.example.com',\n * events: {\n * inbound: ['message_received', 'user_joined', 'user_left'],\n * outbound: ['send_message', 'join_room', 'leave_room'],\n * },\n * };\n * ```\n */\nexport interface SocketServiceDef {\n /** Unique service name */\n name: string;\n\n /** Service type */\n type: \"socket\";\n\n /** Optional description */\n description?: string;\n\n /** WebSocket URL */\n url: string;\n\n /** Event definitions */\n events: SocketEvents;\n\n /** Reconnection configuration */\n reconnect?: {\n /** Enable automatic reconnection */\n enabled: boolean;\n /** Maximum reconnection attempts */\n maxAttempts?: number;\n /** Delay between attempts in ms */\n delayMs?: number;\n };\n}\n\n/**\n * Socket event definitions.\n */\nexport interface SocketEvents {\n /** Events received from server (maps to orbital events) */\n inbound: string[];\n\n /** Events sent to server (triggered by effects) */\n outbound: string[];\n}\n\nexport const SocketEventsSchema = z.object({\n inbound: z.array(z.string()),\n outbound: z.array(z.string()),\n});\n\nexport const SocketServiceDefSchema = z.object({\n name: z.string().min(1, \"Service name is required\"),\n type: z.literal(\"socket\"),\n description: z.string().optional(),\n url: z.string().url(\"WebSocket URL must be valid\"),\n events: SocketEventsSchema,\n reconnect: z\n .object({\n enabled: z.boolean(),\n maxAttempts: z.number().positive().optional(),\n delayMs: z.number().positive().optional(),\n })\n .optional(),\n});\n\n// ============================================================================\n// MCP Service Definition\n// ============================================================================\n\n/**\n * Configuration for an MCP (Model Context Protocol) server.\n *\n * @example\n * ```typescript\n * const mcpService: McpServiceDef = {\n * name: 'DatabaseMCP',\n * type: 'mcp',\n * serverPath: './mcp-servers/database',\n * capabilities: ['query', 'insert', 'update'],\n * };\n * ```\n */\nexport interface McpServiceDef {\n /** Unique service name */\n name: string;\n\n /** Service type */\n type: \"mcp\";\n\n /** Optional description */\n description?: string;\n\n /** Path to MCP server executable or module */\n serverPath: string;\n\n /** List of capabilities/tools exposed by the MCP server */\n capabilities: string[];\n\n /** Environment variables to pass to the MCP server */\n env?: Record<string, string>;\n}\n\nexport const McpServiceDefSchema = z.object({\n name: z.string().min(1, \"Service name is required\"),\n type: z.literal(\"mcp\"),\n description: z.string().optional(),\n serverPath: z.string().min(1, \"Server path is required\"),\n capabilities: z\n .array(z.string())\n .min(1, \"At least one capability is required\"),\n env: z.record(z.string()).optional(),\n});\n\n// ============================================================================\n// Union Type: ServiceDefinition\n// ============================================================================\n\n/**\n * Union type for all service definitions.\n */\nexport type ServiceDefinition =\n | RestServiceDef\n | SocketServiceDef\n | McpServiceDef;\n\nexport const ServiceDefinitionSchema = z.discriminatedUnion(\"type\", [\n RestServiceDefSchema,\n SocketServiceDefSchema,\n McpServiceDefSchema,\n]);\n\n// ============================================================================\n// Service Reference (Inline OR Reference)\n// ============================================================================\n\n/**\n * ServiceRef - Service can be inline definition OR reference to imported service.\n *\n * Reference format: \"Alias.services.ServiceName\"\n */\nexport type ServiceRef = ServiceDefinition | string;\n\n/**\n * Check if ServiceRef is a reference string.\n */\nexport function isServiceReference(service: ServiceRef): service is string {\n return typeof service === \"string\";\n}\n\n/**\n * Validate service reference format: \"Alias.services.ServiceName\"\n */\nexport const ServiceRefStringSchema = z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*\\.services\\.[a-zA-Z][a-zA-Z0-9]*$/,\n 'Service reference must be in format \"Alias.services.ServiceName\" (e.g., \"Weather.services.openweather\")',\n );\n\nexport const ServiceRefSchema = z.union([\n ServiceDefinitionSchema,\n ServiceRefStringSchema,\n]);\n\n/**\n * Parse a service reference.\n * @returns { alias, serviceName } or null if not a valid reference\n */\nexport function parseServiceRef(\n ref: string,\n): { alias: string; serviceName: string } | null {\n const match = ref.match(\n /^([A-Z][a-zA-Z0-9]*)\\.services\\.([a-zA-Z][a-zA-Z0-9]*)$/,\n );\n if (!match) return null;\n return { alias: match[1], serviceName: match[2] };\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Check if a service definition is a REST service.\n */\nexport function isRestService(\n service: ServiceDefinition,\n): service is RestServiceDef {\n return service.type === \"rest\";\n}\n\n/**\n * Check if a service definition is a Socket service.\n */\nexport function isSocketService(\n service: ServiceDefinition,\n): service is SocketServiceDef {\n return service.type === \"socket\";\n}\n\n/**\n * Check if a service definition is an MCP service.\n */\nexport function isMcpService(\n service: ServiceDefinition,\n): service is McpServiceDef {\n return service.type === \"mcp\";\n}\n\n/**\n * Get all service names from a list of services.\n */\nexport function getServiceNames(services: ServiceDefinition[]): string[] {\n return services.map((s) => s.name);\n}\n\n/**\n * Find a service by name.\n */\nexport function findService(\n services: ServiceDefinition[],\n name: string,\n): ServiceDefinition | undefined {\n return services.find((s) => s.name.toLowerCase() === name.toLowerCase());\n}\n\n/**\n * Check if a service name exists (case-insensitive).\n */\nexport function hasService(\n services: ServiceDefinition[],\n name: string,\n): boolean {\n return services.some((s) => s.name.toLowerCase() === name.toLowerCase());\n}\n","/**\n * Orbital Type (Self-Contained)\n *\n * Defines the Orbital - the atomic building block of applications.\n * Formula: Orbital = Entity × Traits × Pages\n *\n * An Orbital is a module that exports { entity, traits, pages }.\n * Use `uses` to import other Orbitals and access their components via:\n * - Alias.entity\n * - Alias.traits.TraitName\n * - Alias.pages.PageName\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\nimport type { Entity } from \"./entity.js\";\nimport { EntitySchema } from \"./entity.js\";\nimport type { Page } from \"./page.js\";\nimport { PageSchema } from \"./page.js\";\nimport type {\n TraitRef,\n EventPayloadField,\n EventScope,\n Trait,\n} from \"./trait.js\";\nimport {\n TraitRefSchema,\n EventPayloadFieldSchema,\n EventScopeSchema,\n TraitSchema,\n} from \"./trait.js\";\nimport type {\n DomainContext,\n DesignPreferences,\n SuggestedGuard,\n ThemeRef,\n} from \"./domain.js\";\nimport {\n DomainContextSchema,\n DesignPreferencesSchema,\n SuggestedGuardSchema,\n ThemeRefSchema,\n} from \"./domain.js\";\nimport type { ServiceRef } from \"./service.js\";\nimport { ServiceRefSchema } from \"./service.js\";\nimport type { Expression } from \"./expression.js\";\nimport { ExpressionSchema } from \"./expression.js\";\n\n// ============================================================================\n// Use Declaration (Import System)\n// ============================================================================\n\n/**\n * UseDeclaration - Import an external Orbital as a namespace.\n *\n * After importing, access components via:\n * - Alias.entity - The entity definition\n * - Alias.traits.TraitName - A specific trait\n * - Alias.pages.PageName - A specific page\n *\n * @example\n * ```json\n * {\n * \"uses\": [\n * { \"from\": \"./health.orb\", \"as\": \"Health\" },\n * { \"from\": \"std/behaviors/game-core\", \"as\": \"GameCore\" }\n * ]\n * }\n * ```\n */\nexport interface UseDeclaration {\n /**\n * Import source path:\n * - \"std/behaviors/game-core\" - Standard library\n * - \"./shared/health.orb\" - Local .orb file (relative path)\n * - \"../common/physics.orb\" - Parent directory .orb file\n * - \"@game-lib/enemies.orb\" - Scoped package (configured base)\n */\n from: string;\n\n /**\n * Alias for accessing imported components.\n * Used as namespace: Alias.entity, Alias.traits.X, Alias.pages.X\n */\n as: string;\n}\n\nexport const UseDeclarationSchema = z.object({\n from: z.string().min(1, \"Import source is required\"),\n as: z\n .string()\n .min(1, \"Alias is required\")\n .regex(\n /^[A-Z][a-zA-Z0-9]*$/,\n 'Alias must be PascalCase (e.g., \"Health\", \"GameCore\")',\n ),\n});\n\n// ============================================================================\n// Entity Reference (Inline OR Reference)\n// ============================================================================\n\n/**\n * EntityRef - Entity can be inline definition OR reference to imported entity.\n *\n * Reference format: \"Alias.entity\"\n *\n * @example\n * ```json\n * // Inline\n * { \"entity\": { \"name\": \"Player\", \"fields\": [...] } }\n *\n * // Reference\n * { \"entity\": \"Goblin.entity\" }\n * ```\n */\nexport type EntityRef = Entity | string;\n\n/**\n * Check if EntityRef is a reference string.\n */\nexport function isEntityReference(entity: EntityRef): entity is string {\n return typeof entity === \"string\";\n}\n\n/**\n * Validate entity reference format: \"Alias.entity\"\n */\nexport const EntityRefStringSchema = z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*\\.entity$/,\n 'Entity reference must be in format \"Alias.entity\" (e.g., \"Goblin.entity\")',\n );\n\nexport const EntityRefSchema = z.union([EntitySchema, EntityRefStringSchema]);\n\n// ============================================================================\n// Page Reference (Inline OR Reference)\n// ============================================================================\n\n/**\n * PageRefObject - Reference to imported page with optional path override.\n */\nexport interface PageRefObject {\n /**\n * Reference to imported page: \"Alias.pages.PageName\"\n */\n ref: string;\n\n /**\n * Optional path override.\n * If provided, overrides the original page's path.\n */\n path?: string;\n}\n\n/**\n * PageRef - Page can be inline definition OR reference to imported page.\n *\n * Reference formats:\n * - \"Alias.pages.PageName\" - Simple reference (keeps original path)\n * - { ref: \"Alias.pages.PageName\", path: \"/custom\" } - Reference with path override\n *\n * @example\n * ```json\n * // Inline\n * { \"name\": \"Dashboard\", \"path\": \"/\", ... }\n *\n * // Simple reference\n * \"User.pages.Profile\"\n *\n * // Reference with path override\n * { \"ref\": \"User.pages.Profile\", \"path\": \"/my-profile\" }\n * ```\n */\nexport type PageRef = Page | string | PageRefObject;\n\n/**\n * Check if PageRef is a reference string.\n */\nexport function isPageReferenceString(page: PageRef): page is string {\n return typeof page === \"string\";\n}\n\n/**\n * Check if PageRef is a reference object.\n */\nexport function isPageReferenceObject(page: PageRef): page is PageRefObject {\n return typeof page === \"object\" && \"ref\" in page && !(\"name\" in page);\n}\n\n/**\n * Check if PageRef is a reference (string or object).\n */\nexport function isPageReference(page: PageRef): page is string | PageRefObject {\n return isPageReferenceString(page) || isPageReferenceObject(page);\n}\n\n/**\n * Validate page reference format: \"Alias.pages.PageName\"\n */\nexport const PageRefStringSchema = z\n .string()\n .regex(\n /^[A-Z][a-zA-Z0-9]*\\.pages\\.[A-Z][a-zA-Z0-9]*$/,\n 'Page reference must be in format \"Alias.pages.PageName\" (e.g., \"User.pages.Profile\")',\n );\n\nexport const PageRefObjectSchema = z.object({\n ref: PageRefStringSchema,\n path: z.string().startsWith(\"/\").optional(),\n});\n\nexport const PageRefSchema = z.union([\n PageSchema,\n PageRefStringSchema,\n PageRefObjectSchema,\n]);\n\n// ============================================================================\n// Trait Reference Extensions\n// ============================================================================\n\n/**\n * Extended trait reference format for imported traits.\n *\n * Formats:\n * - \"TraitName\" - Local trait (inline or from uses without alias)\n * - \"Alias.traits.TraitName\" - Imported trait with namespace\n *\n * The existing TraitRef type already supports these via string.\n */\n\n/**\n * Validate trait reference format for imported traits.\n */\nexport const ImportedTraitRefStringSchema = z\n .string()\n .regex(\n /^([A-Z][a-zA-Z0-9]*\\.traits\\.)?[A-Z][a-zA-Z0-9]*$/,\n 'Trait reference must be \"TraitName\" or \"Alias.traits.TraitName\"',\n );\n\n/**\n * Check if a trait reference is an imported reference (has Alias.traits. prefix)\n */\nexport function isImportedTraitRef(ref: string): boolean {\n return /^[A-Z][a-zA-Z0-9]*\\.traits\\.[A-Z][a-zA-Z0-9]*$/.test(ref);\n}\n\n/**\n * Parse an imported trait reference.\n * @returns { alias, traitName } or null if not an imported ref\n */\nexport function parseImportedTraitRef(\n ref: string,\n): { alias: string; traitName: string } | null {\n const match = ref.match(/^([A-Z][a-zA-Z0-9]*)\\.traits\\.([A-Z][a-zA-Z0-9]*)$/);\n if (!match) return null;\n return { alias: match[1], traitName: match[2] };\n}\n\n/**\n * Parse an entity reference.\n * @returns { alias } or null if not a valid reference\n */\nexport function parseEntityRef(ref: string): { alias: string } | null {\n const match = ref.match(/^([A-Z][a-zA-Z0-9]*)\\.entity$/);\n if (!match) return null;\n return { alias: match[1] };\n}\n\n/**\n * Parse a page reference.\n * @returns { alias, pageName } or null if not a valid reference\n */\nexport function parsePageRef(\n ref: string,\n): { alias: string; pageName: string } | null {\n const match = ref.match(/^([A-Z][a-zA-Z0-9]*)\\.pages\\.([A-Z][a-zA-Z0-9]*)$/);\n if (!match) return null;\n return { alias: match[1], pageName: match[2] };\n}\n\n// ============================================================================\n// Event Listener (Legacy)\n// ============================================================================\n\n/**\n * Event listener for cross-orbital communication (legacy format).\n * @deprecated Use trait-level listens with scope instead.\n */\nexport interface EventListener {\n /** Event key to listen for */\n event: string;\n /** Action to trigger */\n triggers: string;\n /** Optional guard condition */\n guard?: string;\n}\n\nexport const EventListenerSchema = z.object({\n event: z.string().min(1),\n triggers: z.string().min(1),\n guard: z.string().optional(),\n});\n\n// ============================================================================\n// Computed Event Contract (Trait-Centric Model)\n// ============================================================================\n\n/**\n * Source of an event - which trait/transition/tick emits it.\n */\nexport interface EventSource {\n /** Trait that emits this event */\n trait: string;\n /** Transition that emits this event (if applicable) */\n transition?: string;\n /** Tick that emits this event (if applicable) */\n tick?: string;\n}\n\nexport const EventSourceSchema = z.object({\n trait: z.string().min(1),\n transition: z.string().optional(),\n tick: z.string().optional(),\n});\n\n/**\n * Computed event contract with source tracking.\n * Generated by aggregating trait-level emits with namespacing.\n */\nexport interface ComputedEventContract {\n /** Namespaced event: \"TraitName.EVENT_NAME\" */\n event: string;\n /** Original event name without namespace */\n originalEvent: string;\n /** Source trait that emits this event */\n source: EventSource;\n /** Human-readable description */\n description?: string;\n /** Payload schema */\n payload?: EventPayloadField[];\n}\n\nexport const ComputedEventContractSchema = z.object({\n event: z.string().min(1),\n originalEvent: z.string().min(1),\n source: EventSourceSchema,\n description: z.string().optional(),\n payload: z.array(EventPayloadFieldSchema).optional(),\n});\n\n/**\n * Computed event listener with source tracking.\n * Generated by aggregating trait-level listens.\n */\nexport interface ComputedEventListener {\n /** Event to listen for (may be namespaced) */\n event: string;\n /** Source trait that defines this listener */\n source: EventSource;\n /** State machine event to trigger */\n triggers: string;\n /** Guard expression */\n guard?: Expression;\n /** Payload field mapping */\n payloadMapping?: Record<string, string>;\n}\n\nexport const ComputedEventListenerSchema = z.object({\n event: z.string().min(1),\n source: EventSourceSchema,\n triggers: z.string().min(1),\n guard: ExpressionSchema.optional(),\n payloadMapping: z.record(z.string()).optional(),\n});\n\n// ============================================================================\n// Orbital\n// ============================================================================\n\n/**\n * Orbital - The atomic building block of applications.\n *\n * Formula: Orbital = Entity × Traits × Pages\n *\n * An orbital is a self-contained feature unit that groups:\n * - One entity (the data nucleus) - inline OR referenced via \"Alias.entity\"\n * - Zero or more traits (behavioral patterns) - inline OR referenced via \"Alias.traits.X\"\n * - Zero or more pages (UI entry points) - inline OR referenced via \"Alias.pages.X\"\n *\n * Use `uses` to import other orbitals and access their components.\n */\nexport type Orbital = OrbitalDefinition;\n\nexport interface OrbitalDefinition {\n /** Human-readable name */\n name: string;\n\n /** Optional description */\n description?: string;\n\n /** Visual prompt override */\n visual_prompt?: string;\n\n // ========================================================================\n // Import System (Unified Reference)\n // ========================================================================\n\n /**\n * Import external orbitals as namespaces.\n *\n * After importing, access components via:\n * - Alias.entity - The entity definition\n * - Alias.traits.TraitName - A specific trait\n * - Alias.pages.PageName - A specific page\n * - Alias.theme - The theme definition\n * - Alias.services.ServiceName - A specific service\n *\n * @example\n * ```json\n * \"uses\": [\n * { \"from\": \"./health.orb\", \"as\": \"Health\" },\n * { \"from\": \"std/behaviors/game-core\", \"as\": \"GameCore\" }\n * ]\n * ```\n */\n uses?: UseDeclaration[];\n\n // ========================================================================\n // Theme & Services\n // ========================================================================\n\n /**\n * Theme definition (inline OR reference via \"Alias.theme\").\n *\n * @example\n * ```json\n * // Inline\n * \"theme\": { \"name\": \"ocean\", \"tokens\": { \"colors\": { \"primary\": \"#0ea5e9\" } } }\n *\n * // Reference\n * \"theme\": \"Ocean.theme\"\n * ```\n */\n theme?: ThemeRef;\n\n /**\n * Service definitions (inline OR reference via \"Alias.services.ServiceName\").\n *\n * @example\n * ```json\n * // Inline\n * \"services\": [{ \"name\": \"weather\", \"type\": \"rest\", \"baseUrl\": \"...\" }]\n *\n * // Reference\n * \"services\": [\"Weather.services.openweather\"]\n * ```\n */\n services?: ServiceRef[];\n\n // ========================================================================\n // Components (Inline OR Reference)\n // ========================================================================\n\n /**\n * Entity definition (nucleus).\n *\n * Can be:\n * - Inline: Full entity definition\n * - Reference: \"Alias.entity\" (from uses)\n *\n * Entity sharing depends on persistence type:\n * - persistent: Shared (same DB collection)\n * - runtime: Isolated (each orbital gets own instances)\n * - singleton: Shared (single global instance)\n */\n entity: EntityRef;\n\n /** Trait references (local or imported via \"Alias.traits.TraitName\") */\n traits: TraitRef[];\n\n /**\n * Page definitions.\n *\n * Can be:\n * - Inline: Full page definition\n * - Reference string: \"Alias.pages.PageName\"\n * - Reference object: { ref: \"Alias.pages.PageName\", path: \"/custom\" }\n */\n pages: PageRef[];\n\n // ========================================================================\n // Event Interface (Trait-Centric Model)\n // ========================================================================\n\n /**\n * Events this orbital emits.\n *\n * COMPUTED from trait-level emits:\n * - Aggregated from all traits with `scope: 'external'`\n * - Namespaced as \"TraitName.EVENT_NAME\"\n * - Filtered by `exposes` if present\n *\n * Do not author directly - computed by resolver.\n */\n emits?: ComputedEventContract[];\n\n /**\n * Events this orbital listens for.\n *\n * COMPUTED from trait-level listens:\n * - Aggregated from all traits with `scope: 'external'`\n *\n * Do not author directly - computed by resolver.\n */\n listens?: ComputedEventListener[];\n\n /**\n * Filter which trait events are exposed externally.\n * If omitted, all external-scoped trait events are exposed.\n * Format: [\"TraitName.EVENT_NAME\", ...]\n */\n exposes?: string[];\n\n // ========================================================================\n // Context fields - persisted throughout orbital lifecycle\n // ========================================================================\n\n /** Domain context - category, vocabulary, personas */\n domainContext?: DomainContext;\n\n /** Design preferences - style, colors, UX hints */\n design?: DesignPreferences;\n\n /**\n * Suggested guards (decomposition phase only).\n * Natural language descriptions that generator converts to S-expressions.\n * Removed after generation - guards live in traits.\n */\n suggestedGuards?: SuggestedGuard[];\n}\n\nexport const OrbitalDefinitionSchema = z.object({\n name: z.string().min(1, \"Orbital name is required\"),\n description: z.string().optional(),\n visual_prompt: z.string().optional(),\n // Import system\n uses: z.array(UseDeclarationSchema).optional(),\n // Theme & Services\n theme: ThemeRefSchema.optional(),\n services: z.array(ServiceRefSchema).optional(),\n // Components (inline or reference)\n entity: EntityRefSchema,\n traits: z.array(TraitRefSchema),\n pages: z.array(PageRefSchema),\n // Event interface (trait-centric model) - computed by resolver\n emits: z.array(ComputedEventContractSchema).optional(),\n listens: z.array(ComputedEventListenerSchema).optional(),\n // Filter for exposed events (trait-centric model)\n exposes: z.array(z.string()).optional(),\n // Context fields - persisted throughout orbital lifecycle\n domainContext: DomainContextSchema.optional(),\n design: DesignPreferencesSchema.optional(),\n suggestedGuards: z.array(SuggestedGuardSchema).optional(),\n});\n\nexport const OrbitalSchema = OrbitalDefinitionSchema;\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\n/**\n * Type guard to check if an Orbital is a full definition.\n * @deprecated No longer needed since Orbital is always OrbitalDefinition now.\n */\nexport function isOrbitalDefinition(\n orbital: Orbital,\n): orbital is OrbitalDefinition {\n return \"entity\" in orbital;\n}\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type OrbitalInput = z.input<typeof OrbitalSchema>;\n\n// Backward compatibility\nexport type OrbitalUnit = Orbital;\nexport const OrbitalUnitSchema = OrbitalSchema;\n","/**\n * Orbital Schema Type (Self-Contained)\n *\n * Defines the OrbitalSchema - the top-level application definition.\n * An application is a composition of orbitals: App = Σ(Orbitals)\n *\n * @packageDocumentation\n */\n\nimport { z } from \"zod\";\nimport type { Orbital } from \"./orbital.js\";\nimport { OrbitalSchema as OrbitalZodSchema } from \"./orbital.js\";\nimport type {\n DomainContext,\n DesignPreferences,\n DesignTokens,\n CustomPatternMap,\n} from \"./domain.js\";\nimport {\n DomainContextSchema,\n DesignPreferencesSchema,\n DesignTokensSchema,\n CustomPatternMapSchema,\n} from \"./domain.js\";\nimport type { ServiceDefinition } from \"./service.js\";\nimport { ServiceDefinitionSchema } from \"./service.js\";\n\n// ============================================================================\n// Orbital Config\n// ============================================================================\n\n/**\n * Global configuration for the application\n */\nexport interface OrbitalConfig {\n /** Theme configuration */\n theme?: {\n primary?: string;\n secondary?: string;\n mode?: \"light\" | \"dark\" | \"system\";\n };\n /** Feature flags */\n features?: Record<string, boolean>;\n /** API configuration */\n api?: {\n baseUrl?: string;\n timeout?: number;\n };\n}\n\nexport const OrbitalConfigSchema = z.object({\n theme: z\n .object({\n primary: z.string().optional(),\n secondary: z.string().optional(),\n mode: z.enum([\"light\", \"dark\", \"system\"]).optional(),\n })\n .optional(),\n features: z.record(z.boolean()).optional(),\n api: z\n .object({\n baseUrl: z.string().optional(),\n timeout: z.number().optional(),\n })\n .optional(),\n});\n\n// ============================================================================\n// Orbital Schema\n// ============================================================================\n\n/**\n * OrbitalSchema - The top-level application definition.\n *\n * An application is a composition of orbitals:\n * App = Σ(Orbitals)\n *\n * Custom traits can be defined at the schema level and referenced\n * by orbitals via TraitRef. This allows LLMs to generate custom\n * traits that aren't in the trait library.\n */\nexport interface OrbitalSchema {\n /** Application name */\n name: string;\n\n /** Description */\n description?: string;\n\n /** Version (semver) */\n version?: string;\n\n /** Domain context - user request + classification */\n domainContext?: DomainContext;\n\n /** Design preferences */\n design?: DesignPreferences;\n\n /**\n * Design tokens - reusable Tailwind class collections.\n * Reference via `token: \"surfaces.glass\"` in patterns.\n */\n designTokens?: DesignTokens;\n\n /**\n * Custom pattern definitions for app-specific reusable patterns.\n * Register custom designs that can be referenced by name.\n */\n customPatterns?: CustomPatternMap;\n\n /** Array of orbitals */\n orbitals: Orbital[];\n\n /** External services */\n services?: ServiceDefinition[];\n\n /** Global config */\n config?: OrbitalConfig;\n}\n\nexport const OrbitalSchemaSchema = z.object({\n name: z.string().min(1, \"Schema name is required\"),\n description: z.string().optional(),\n version: z.string().optional(),\n domainContext: DomainContextSchema.optional(),\n design: DesignPreferencesSchema.optional(),\n designTokens: DesignTokensSchema,\n customPatterns: CustomPatternMapSchema,\n orbitals: z\n .array(OrbitalZodSchema)\n .min(1, \"At least one orbital is required\"),\n services: z.array(ServiceDefinitionSchema).optional(),\n config: OrbitalConfigSchema.optional(),\n});\n\n// ============================================================================\n// Parsing Functions\n// ============================================================================\n\n/**\n * Parse an OrbitalSchema with Zod validation\n */\nexport function parseOrbitalSchema(data: unknown): OrbitalSchema {\n return OrbitalSchemaSchema.parse(data) as OrbitalSchema;\n}\n\n/**\n * Safe parse an OrbitalSchema\n */\nexport function safeParseOrbitalSchema(data: unknown) {\n return OrbitalSchemaSchema.safeParse(data);\n}\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type OrbitalSchemaInput = z.input<typeof OrbitalSchemaSchema>;\nexport type OrbitalConfigInput = z.input<typeof OrbitalConfigSchema>;\n","/**\n * S-Expression Operators\n *\n * Defines all operators available in the S-expression language.\n * This is the single source of truth for operator metadata.\n *\n * Operators are organized by category:\n * - Arithmetic: +, -, *, /, %, abs, min, max, floor, ceil, round\n * - Comparison: =, !=, <, >, <=, >=\n * - Logic: and, or, not, if\n * - Control: let, do, when\n * - Effects: set, emit, persist, navigate, notify, spawn, despawn\n * - Collections: map, filter, find, count, sum, first, last, nth, concat, includes\n * - Standard Library: std-math, std-str, std-array, std-object, std-validate, std-time, std-format, std-async\n *\n * @packageDocumentation\n */\n\n// ============================================================================\n// Operator Categories\n// ============================================================================\n\nexport const OPERATOR_CATEGORIES = [\n 'arithmetic',\n 'comparison',\n 'logic',\n 'control',\n 'effect',\n 'collection',\n // Standard library categories\n 'std-math',\n 'std-str',\n 'std-array',\n 'std-object',\n 'std-validate',\n 'std-time',\n 'std-format',\n 'std-async',\n 'std-nn',\n 'std-tensor',\n 'std-train',\n] as const;\n\nexport type OperatorCategory = (typeof OPERATOR_CATEGORIES)[number];\n\n// ============================================================================\n// Operator Metadata\n// ============================================================================\n\n/**\n * Basic return types for core operators.\n */\nexport type BasicReturnType = 'number' | 'boolean' | 'string' | 'any' | 'void' | 'array';\n\n/**\n * Metadata for an operator\n */\nexport interface OperatorMeta {\n /** Operator category */\n category: OperatorCategory;\n /** Minimum number of arguments */\n minArity: number;\n /** Maximum number of arguments (null = unlimited) */\n maxArity: number | null;\n /** Human-readable description */\n description: string;\n /** Whether this operator has side effects (only valid in effect context) */\n hasSideEffects: boolean;\n /** Return type hint - basic types for core operators, extended types for std modules */\n returnType: string;\n}\n\n/**\n * Operator registry - single source of truth for all operators.\n */\nexport const OPERATORS: Record<string, OperatorMeta> = {\n // ============================================================================\n // Arithmetic Operators\n // ============================================================================\n '+': {\n category: 'arithmetic',\n minArity: 2,\n maxArity: null,\n description: 'Add numbers',\n hasSideEffects: false,\n returnType: 'number',\n },\n '-': {\n category: 'arithmetic',\n minArity: 1,\n maxArity: 2,\n description: 'Subtract numbers or negate',\n hasSideEffects: false,\n returnType: 'number',\n },\n '*': {\n category: 'arithmetic',\n minArity: 2,\n maxArity: null,\n description: 'Multiply numbers',\n hasSideEffects: false,\n returnType: 'number',\n },\n '/': {\n category: 'arithmetic',\n minArity: 2,\n maxArity: 2,\n description: 'Divide numbers',\n hasSideEffects: false,\n returnType: 'number',\n },\n '%': {\n category: 'arithmetic',\n minArity: 2,\n maxArity: 2,\n description: 'Modulo (remainder)',\n hasSideEffects: false,\n returnType: 'number',\n },\n abs: {\n category: 'arithmetic',\n minArity: 1,\n maxArity: 1,\n description: 'Absolute value',\n hasSideEffects: false,\n returnType: 'number',\n },\n min: {\n category: 'arithmetic',\n minArity: 2,\n maxArity: null,\n description: 'Minimum of values',\n hasSideEffects: false,\n returnType: 'number',\n },\n max: {\n category: 'arithmetic',\n minArity: 2,\n maxArity: null,\n description: 'Maximum of values',\n hasSideEffects: false,\n returnType: 'number',\n },\n floor: {\n category: 'arithmetic',\n minArity: 1,\n maxArity: 1,\n description: 'Round down to integer',\n hasSideEffects: false,\n returnType: 'number',\n },\n ceil: {\n category: 'arithmetic',\n minArity: 1,\n maxArity: 1,\n description: 'Round up to integer',\n hasSideEffects: false,\n returnType: 'number',\n },\n round: {\n category: 'arithmetic',\n minArity: 1,\n maxArity: 1,\n description: 'Round to nearest integer',\n hasSideEffects: false,\n returnType: 'number',\n },\n clamp: {\n category: 'arithmetic',\n minArity: 3,\n maxArity: 3,\n description: 'Clamp value between min and max',\n hasSideEffects: false,\n returnType: 'number',\n },\n\n // ============================================================================\n // Comparison Operators\n // ============================================================================\n '=': {\n category: 'comparison',\n minArity: 2,\n maxArity: 2,\n description: 'Equal to',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n '!=': {\n category: 'comparison',\n minArity: 2,\n maxArity: 2,\n description: 'Not equal to',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n '<': {\n category: 'comparison',\n minArity: 2,\n maxArity: 2,\n description: 'Less than',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n '>': {\n category: 'comparison',\n minArity: 2,\n maxArity: 2,\n description: 'Greater than',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n '<=': {\n category: 'comparison',\n minArity: 2,\n maxArity: 2,\n description: 'Less than or equal to',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n '>=': {\n category: 'comparison',\n minArity: 2,\n maxArity: 2,\n description: 'Greater than or equal to',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n\n // ============================================================================\n // Logic Operators\n // ============================================================================\n and: {\n category: 'logic',\n minArity: 2,\n maxArity: null,\n description: 'Logical AND (short-circuit)',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n or: {\n category: 'logic',\n minArity: 2,\n maxArity: null,\n description: 'Logical OR (short-circuit)',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n not: {\n category: 'logic',\n minArity: 1,\n maxArity: 1,\n description: 'Logical NOT',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n if: {\n category: 'logic',\n minArity: 3,\n maxArity: 3,\n description: 'Conditional expression (if condition then else)',\n hasSideEffects: false,\n returnType: 'any',\n },\n\n // ============================================================================\n // Control Operators\n // ============================================================================\n let: {\n category: 'control',\n minArity: 2,\n maxArity: 2,\n description: 'Bind local variables: [let, [[name, value], ...], body]',\n hasSideEffects: false,\n returnType: 'any',\n },\n do: {\n category: 'control',\n minArity: 1,\n maxArity: null,\n description: 'Execute expressions in sequence, return last',\n hasSideEffects: true,\n returnType: 'any',\n },\n when: {\n category: 'control',\n minArity: 2,\n maxArity: 2,\n description: 'Execute effect only when condition is true',\n hasSideEffects: true,\n returnType: 'void',\n },\n fn: {\n category: 'control',\n minArity: 2,\n maxArity: 2,\n description: 'Lambda expression: [fn, varName, body] or [fn, [vars], body]',\n hasSideEffects: false,\n returnType: 'any',\n },\n\n // ============================================================================\n // Effect Operators\n // ============================================================================\n set: {\n category: 'effect',\n minArity: 2,\n maxArity: 2,\n description: 'Set a binding to a value',\n hasSideEffects: true,\n returnType: 'void',\n },\n emit: {\n category: 'effect',\n minArity: 1,\n maxArity: 2,\n description: 'Emit an event with optional payload',\n hasSideEffects: true,\n returnType: 'void',\n },\n persist: {\n category: 'effect',\n minArity: 2,\n maxArity: 3,\n description: 'Persist data (create/update/delete)',\n hasSideEffects: true,\n returnType: 'void',\n },\n navigate: {\n category: 'effect',\n minArity: 1,\n maxArity: 2,\n description: 'Navigate to a route',\n hasSideEffects: true,\n returnType: 'void',\n },\n notify: {\n category: 'effect',\n minArity: 1,\n maxArity: 2,\n description: 'Show a notification',\n hasSideEffects: true,\n returnType: 'void',\n },\n spawn: {\n category: 'effect',\n minArity: 1,\n maxArity: 2,\n description: 'Spawn a new entity instance',\n hasSideEffects: true,\n returnType: 'void',\n },\n despawn: {\n category: 'effect',\n minArity: 0,\n maxArity: 1,\n description: 'Despawn an entity instance',\n hasSideEffects: true,\n returnType: 'void',\n },\n 'call-service': {\n category: 'effect',\n minArity: 2,\n maxArity: 3,\n description: 'Call an external service',\n hasSideEffects: true,\n returnType: 'void',\n },\n 'render-ui': {\n category: 'effect',\n minArity: 2,\n maxArity: 3,\n description: 'Render UI to a slot',\n hasSideEffects: true,\n returnType: 'void',\n },\n\n // ============================================================================\n // Collection Operators\n // ============================================================================\n map: {\n category: 'collection',\n minArity: 2,\n maxArity: 2,\n description: 'Transform each element in collection',\n hasSideEffects: false,\n returnType: 'array',\n },\n filter: {\n category: 'collection',\n minArity: 2,\n maxArity: 2,\n description: 'Filter collection by predicate',\n hasSideEffects: false,\n returnType: 'array',\n },\n find: {\n category: 'collection',\n minArity: 2,\n maxArity: 2,\n description: 'Find first element matching predicate',\n hasSideEffects: false,\n returnType: 'any',\n },\n count: {\n category: 'collection',\n minArity: 1,\n maxArity: 1,\n description: 'Count elements in collection',\n hasSideEffects: false,\n returnType: 'number',\n },\n sum: {\n category: 'collection',\n minArity: 1,\n maxArity: 2,\n description: 'Sum values in collection',\n hasSideEffects: false,\n returnType: 'number',\n },\n first: {\n category: 'collection',\n minArity: 1,\n maxArity: 1,\n description: 'Get first element',\n hasSideEffects: false,\n returnType: 'any',\n },\n last: {\n category: 'collection',\n minArity: 1,\n maxArity: 1,\n description: 'Get last element',\n hasSideEffects: false,\n returnType: 'any',\n },\n nth: {\n category: 'collection',\n minArity: 2,\n maxArity: 2,\n description: 'Get element at index',\n hasSideEffects: false,\n returnType: 'any',\n },\n concat: {\n category: 'collection',\n minArity: 2,\n maxArity: null,\n description: 'Concatenate collections',\n hasSideEffects: false,\n returnType: 'array',\n },\n includes: {\n category: 'collection',\n minArity: 2,\n maxArity: 2,\n description: 'Check if collection includes element',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n empty: {\n category: 'collection',\n minArity: 1,\n maxArity: 1,\n description: 'Check if collection is empty',\n hasSideEffects: false,\n returnType: 'boolean',\n },\n} as const;\n\n// ============================================================================\n// Operator Helpers\n// ============================================================================\n\n/**\n * Get operator metadata by name.\n *\n * @param operator - Operator name\n * @returns Operator metadata or undefined if not found\n */\nexport function getOperatorMeta(operator: string): OperatorMeta | undefined {\n return OPERATORS[operator];\n}\n\n/**\n * Check if an operator exists.\n *\n * @param operator - Operator name\n * @returns true if operator exists\n */\nexport function isKnownOperator(operator: string): boolean {\n return operator in OPERATORS;\n}\n\n/**\n * Check if an operator has side effects.\n *\n * @param operator - Operator name\n * @returns true if operator has side effects\n */\nexport function isEffectOperator(operator: string): boolean {\n const meta = OPERATORS[operator];\n return meta?.hasSideEffects ?? false;\n}\n\n/**\n * Check if an operator is valid in a guard context (no side effects).\n *\n * @param operator - Operator name\n * @returns true if operator can be used in guards\n */\nexport function isGuardOperator(operator: string): boolean {\n const meta = OPERATORS[operator];\n return meta !== undefined && !meta.hasSideEffects;\n}\n\n/**\n * Get all operators in a category.\n *\n * @param category - Operator category\n * @returns Array of operator names\n */\nexport function getOperatorsByCategory(category: OperatorCategory): string[] {\n return Object.entries(OPERATORS)\n .filter(([_, meta]) => meta.category === category)\n .map(([name]) => name);\n}\n\n/**\n * Get all operator names.\n *\n * @returns Array of all operator names\n */\nexport function getAllOperators(): string[] {\n return Object.keys(OPERATORS);\n}\n\n/**\n * Validate operator arity.\n *\n * @param operator - Operator name\n * @param argCount - Number of arguments provided\n * @returns Error message if invalid, null if valid\n */\nexport function validateOperatorArity(operator: string, argCount: number): string | null {\n const meta = OPERATORS[operator];\n if (!meta) {\n return `Unknown operator: ${operator}`;\n }\n\n if (argCount < meta.minArity) {\n return `Operator '${operator}' requires at least ${meta.minArity} argument(s), got ${argCount}`;\n }\n\n if (meta.maxArity !== null && argCount > meta.maxArity) {\n return `Operator '${operator}' accepts at most ${meta.maxArity} argument(s), got ${argCount}`;\n }\n\n return null;\n}\n\n// ============================================================================\n// Type Exports\n// ============================================================================\n\nexport type OperatorName = keyof typeof OPERATORS;\n","/**\n * S-Expression Bindings\n *\n * Defines binding types and utilities for S-expression context.\n * Bindings are references to values that are resolved at runtime.\n *\n * Core Bindings:\n * - @entity - The linked entity for this trait (e.g., @entity.health)\n * - @payload - Event payload data (e.g., @payload.amount)\n * - @state - Current state machine state\n * - @now - Current timestamp (Date.now())\n *\n * Entity Bindings:\n * - @EntityName.field - Reference to singleton/runtime entity (e.g., @GameConfig.gravity)\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// Re-export core binding utilities from expression.ts\nexport {\n isBinding,\n parseBinding,\n isValidBinding,\n CORE_BINDINGS,\n type CoreBinding,\n type ParsedBinding,\n} from './expression.js';\n\n// ============================================================================\n// Binding Schema\n// ============================================================================\n\n/**\n * Schema for a binding string.\n * Validates that the string starts with @ and has valid format.\n */\nexport const BindingSchema = z.string().refine(\n (val) => {\n if (!val.startsWith('@')) return false;\n const parts = val.slice(1).split('.');\n if (parts.length === 0 || parts[0] === '') return false;\n // All parts must be valid identifiers (alphanumeric + underscore)\n return parts.every((part) => /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(part));\n },\n { message: 'Invalid binding format. Must be @name or @name.path.to.field' }\n);\n\n// ============================================================================\n// Binding Constants\n// ============================================================================\n\n/**\n * Binding documentation for LLM prompts and validation messages.\n */\nexport const BINDING_DOCS = {\n entity: {\n description: 'Reference to the linked entity for this trait',\n examples: ['@entity.health', '@entity.x', '@entity.status'],\n requiresPath: true,\n },\n payload: {\n description: 'Reference to the event payload data',\n examples: ['@payload.amount', '@payload.targetId', '@payload.action'],\n requiresPath: true,\n },\n state: {\n description: 'Current state machine state name',\n examples: ['@state'],\n requiresPath: false,\n },\n now: {\n description: 'Current timestamp in milliseconds',\n examples: ['@now'],\n requiresPath: false,\n },\n} as const;\n\n/**\n * Validation rules for bindings in different contexts.\n */\nexport const BINDING_CONTEXT_RULES = {\n guard: {\n allowed: ['entity', 'payload', 'state', 'now'] as const,\n description: 'Guards can access entity fields, event payload, current state, and time',\n },\n effect: {\n allowed: ['entity', 'payload', 'state', 'now'] as const,\n description: 'Effects can access and modify entity fields, use payload data',\n },\n tick: {\n allowed: ['entity', 'state', 'now'] as const,\n description: 'Ticks can access entity fields, current state, and time (no payload)',\n },\n} as const;\n\nexport type BindingContext = keyof typeof BINDING_CONTEXT_RULES;\n\n// ============================================================================\n// Binding Validation Helpers\n// ============================================================================\n\n/**\n * Check if a binding is valid in a given context.\n *\n * @param binding - Parsed binding\n * @param context - Context where binding is used\n * @returns Error message if invalid, null if valid\n */\nexport function validateBindingInContext(\n binding: { type: 'core' | 'entity'; root: string },\n context: BindingContext\n): string | null {\n const rules = BINDING_CONTEXT_RULES[context];\n\n if (binding.type === 'core') {\n if (!(rules.allowed as readonly string[]).includes(binding.root)) {\n return `Binding @${binding.root} is not allowed in ${context} context. Allowed: ${rules.allowed.join(', ')}`;\n }\n }\n\n // Entity bindings are always allowed (they reference singletons/runtime entities)\n return null;\n}\n\n/**\n * Get all valid binding examples for a context.\n *\n * @param context - Context to get examples for\n * @returns Array of example binding strings\n */\nexport function getBindingExamples(context: BindingContext): string[] {\n const rules = BINDING_CONTEXT_RULES[context];\n const examples: string[] = [];\n\n for (const binding of rules.allowed) {\n const doc = BINDING_DOCS[binding];\n examples.push(...doc.examples);\n }\n\n // Add entity binding example\n examples.push('@GameConfig.gravity', '@Filter.searchTerm');\n\n return examples;\n}\n","/**\n * Interaction Model Types\n *\n * Defines how users interact with entities in the application.\n * Used to drive trait selection and UI slot usage.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Flow Types\n// ============================================================================\n\n/**\n * Create flow - how new items are created\n */\nexport type CreateFlow = 'modal' | 'page' | 'inline' | 'none';\n\n/**\n * Edit flow - how items are edited\n */\nexport type EditFlow = 'modal' | 'page' | 'inline' | 'none';\n\n/**\n * View flow - how item details are viewed\n */\nexport type ViewFlow = 'drawer' | 'page' | 'modal' | 'inline' | 'none';\n\n/**\n * Delete flow - how items are deleted\n */\nexport type DeleteFlow = 'confirm' | 'instant' | 'none';\n\n/**\n * List interaction - what happens when clicking list items\n */\nexport type ListInteraction = 'click-to-view' | 'click-to-edit' | 'inline-edit';\n\n// ============================================================================\n// Interaction Model\n// ============================================================================\n\n/**\n * InteractionModel - defines how users interact with entities.\n *\n * This drives:\n * - Which traits to attach (EntityManagement, ModalEdit, etc.)\n * - How render_ui effects target slots (modal, drawer, page)\n * - What UI patterns to use\n */\nexport interface InteractionModel {\n /** How new items are created */\n createFlow: CreateFlow;\n\n /** How items are edited */\n editFlow: EditFlow;\n\n /** How item details are viewed */\n viewFlow: ViewFlow;\n\n /** How items are deleted */\n deleteFlow: DeleteFlow;\n\n /** What happens when clicking list items */\n listInteraction?: ListInteraction;\n\n /** Enable bulk actions (select multiple, delete all) */\n bulkActions?: boolean;\n\n /** Enable real-time updates */\n realtime?: boolean;\n}\n\nexport const InteractionModelSchema = z.object({\n createFlow: z.enum(['modal', 'page', 'inline', 'none']),\n editFlow: z.enum(['modal', 'page', 'inline', 'none']),\n viewFlow: z.enum(['drawer', 'page', 'modal', 'inline', 'none']),\n deleteFlow: z.enum(['confirm', 'instant', 'none']),\n listInteraction: z.enum(['click-to-view', 'click-to-edit', 'inline-edit']).optional(),\n bulkActions: z.boolean().optional(),\n realtime: z.boolean().optional(),\n});\n\n// ============================================================================\n// Default Models per Domain\n// ============================================================================\n\n/**\n * Default interaction models for each domain type\n */\nexport const DEFAULT_INTERACTION_MODELS: Record<string, InteractionModel> = {\n business: {\n createFlow: 'modal',\n editFlow: 'modal',\n viewFlow: 'drawer',\n deleteFlow: 'confirm',\n listInteraction: 'click-to-view',\n bulkActions: true,\n },\n game: {\n createFlow: 'none',\n editFlow: 'none',\n viewFlow: 'none',\n deleteFlow: 'none',\n realtime: true,\n },\n form: {\n createFlow: 'inline',\n editFlow: 'inline',\n viewFlow: 'none',\n deleteFlow: 'none',\n },\n dashboard: {\n createFlow: 'modal',\n editFlow: 'modal',\n viewFlow: 'drawer',\n deleteFlow: 'confirm',\n listInteraction: 'click-to-view',\n },\n content: {\n createFlow: 'page',\n editFlow: 'page',\n viewFlow: 'page',\n deleteFlow: 'confirm',\n listInteraction: 'click-to-view',\n },\n};\n\n/**\n * Get the default interaction model for a domain\n */\nexport function getInteractionModelForDomain(domain: string): InteractionModel {\n return DEFAULT_INTERACTION_MODELS[domain] ?? DEFAULT_INTERACTION_MODELS.business;\n}\n\n// ============================================================================\n// Type exports\n// ============================================================================\n\nexport type InteractionModelInput = z.input<typeof InteractionModelSchema>;\n","/**\n * Pattern Type for Orbital Units\n *\n * Defines pattern type validation.\n * The actual pattern definitions come from @almadar/patterns.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Pattern Type\n// ============================================================================\n\n/**\n * Common pattern types.\n * The full list is defined in @almadar/patterns registry.\n */\nexport const PATTERN_TYPES = [\n // Display patterns\n 'entity-table',\n 'entity-list',\n 'entity-cards',\n 'entity-grid',\n // Form patterns\n 'form',\n 'form-section',\n // Header patterns\n 'page-header',\n // Stats patterns\n 'stats',\n 'stat-card',\n // Layout patterns\n 'master-detail',\n 'dashboard-grid',\n // Game patterns\n 'game-canvas',\n 'game-hud',\n 'game-controls',\n] as const;\n\n/**\n * Pattern type union.\n * This is a string type to allow for custom/extended patterns.\n */\nexport type PatternType = string;\n\n/**\n * Zod schema for pattern types.\n * Accepts any string - validation against full registry happens at runtime.\n */\nexport const PatternTypeSchema = z.string();\n\n// ============================================================================\n// Pattern Type Functions\n// ============================================================================\n\n/**\n * Get the common pattern types.\n * For the full registry, import from @almadar/patterns.\n */\nexport function getAllPatternTypes(): string[] {\n return [...PATTERN_TYPES];\n}\n\n/**\n * Check if a pattern type is in the common list.\n * For comprehensive validation, use @almadar/patterns registry.\n */\nexport function isValidPatternType(patternType: string): patternType is PatternType {\n return (PATTERN_TYPES as readonly string[]).includes(patternType);\n}\n","/**\n * Shared Intermediate Representation Types\n *\n * Unified IR types used by both the compiler and runtime.\n * This is the single source of truth for IR structures.\n *\n * @packageDocumentation\n */\n\nimport type { SExpr } from './expression.js';\n\n// ============================================================================\n// Transition Types\n// ============================================================================\n\n/**\n * Transition source state specification.\n * - string: Single state name (e.g., 'Idle')\n * - '*': Wildcard - matches any current state\n * - string[]: Array of states - matches any of the listed states\n */\nexport type TransitionFrom = string | '*' | string[];\n\n// ============================================================================\n// Field Types\n// ============================================================================\n\nexport interface ResolvedField {\n name: string;\n type: string;\n tsType: string;\n description?: string;\n default?: unknown;\n required: boolean;\n validation?: unknown;\n /** Enum values for enum or constrained string fields */\n values?: string[];\n /** Enum values (alias for values, for compatibility) */\n enumValues?: string[];\n /** Relation configuration for foreign key references */\n relation?: {\n entity: string;\n cardinality?: string;\n field?: string;\n };\n}\n\n// ============================================================================\n// Entity Types\n// ============================================================================\n\nexport interface ResolvedEntity {\n name: string;\n description?: string;\n icon?: string;\n collection: string;\n fields: ResolvedField[];\n\n /** Whether this entity only exists in runtime (not persisted to Firestore) */\n runtime?: boolean;\n\n /** Whether this is a singleton entity (only one instance exists) */\n singleton?: boolean;\n\n /** Whether this entity has pre-authored instances in the schema */\n hasInstances?: boolean;\n\n /** Default field values from schema (for spawning singletons) */\n defaults?: Record<string, unknown>;\n\n // Cross-references\n usedByTraits: string[];\n usedByPages: string[];\n}\n\nexport interface ResolvedEntityBinding {\n /** Binding name in code */\n name: string;\n\n /** Entity being bound */\n entity: ResolvedEntity;\n\n /** CRUD operations to generate */\n operations: ('list' | 'get' | 'create' | 'update' | 'delete')[];\n}\n\n// ============================================================================\n// Trait Types\n// ============================================================================\n\nexport interface ResolvedTraitState {\n name: string;\n isInitial: boolean;\n isFinal: boolean;\n}\n\nexport interface ResolvedTraitEvent {\n key: string;\n name: string;\n payload?: Record<string, string>;\n}\n\nexport interface ResolvedTraitTransition {\n /** Source state(s): string, '*' for wildcard, or array of states */\n from: TransitionFrom;\n to: string;\n event: string;\n guard?: SExpr;\n effects: SExpr[];\n}\n\nexport interface ResolvedTraitGuard {\n name: string;\n condition: SExpr;\n}\n\nexport interface ResolvedTraitTick {\n name: string;\n interval: number | 'frame';\n guard?: SExpr;\n effects: SExpr[];\n priority: number;\n appliesTo: string[];\n}\n\nexport interface ResolvedTraitListener {\n event: string;\n triggers: string;\n guard?: SExpr;\n}\n\nexport interface ResolvedTraitDataEntity {\n name: string;\n fields: ResolvedField[];\n runtime: boolean;\n singleton: boolean;\n}\n\n/**\n * UI binding for interaction traits - maps states to presentations\n */\nexport interface ResolvedTraitUIBinding {\n [stateName: string]: {\n /** Presentation type: modal, drawer, popover, inline, confirm-dialog */\n presentation: string;\n /** Content pattern(s) to render */\n content: Record<string, unknown> | Record<string, unknown>[];\n /** Presentation props */\n props?: {\n size?: string;\n position?: string;\n title?: string;\n closable?: boolean;\n width?: string;\n showProgress?: boolean;\n step?: number;\n totalSteps?: number;\n };\n };\n}\n\n/**\n * Fully resolved trait - expanded from schema OR library.\n * The compiler generates code from this structure universally,\n * without knowing which specific trait it is.\n */\nexport interface ResolvedTrait {\n /** Unique trait identifier */\n name: string;\n\n /** Human-readable description */\n description?: string;\n\n /** Where this trait came from */\n source: 'schema' | 'library' | 'inline';\n\n /** Category for organizing traits */\n category?: 'lifecycle' | 'temporal' | 'validation' | 'notification' | 'integration' | 'interaction' |\n 'game-core' | 'game-character' | 'game-ai' | 'game-combat' | 'game-items' | 'game-cards' | 'game-board' | 'game-puzzle';\n\n // State Machine (all optional - not all traits have state machines)\n states: ResolvedTraitState[];\n events: ResolvedTraitEvent[];\n transitions: ResolvedTraitTransition[];\n guards: ResolvedTraitGuard[];\n\n // Behavior\n ticks: ResolvedTraitTick[];\n\n // Communication\n listens: ResolvedTraitListener[];\n\n // Data\n dataEntities: ResolvedTraitDataEntity[];\n\n // Instance configuration (from page binding)\n config?: Record<string, unknown>;\n\n // UI Bindings for interaction traits\n ui?: ResolvedTraitUIBinding;\n}\n\n/**\n * Trait binding on a page - links a resolved trait to the page\n */\nexport interface ResolvedTraitBinding {\n /** Reference name */\n ref?: string;\n\n /** Fully resolved trait */\n trait: ResolvedTrait;\n\n /** Entity this trait operates on (if any) */\n linkedEntity?: string;\n\n /** Instance configuration */\n config?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Pattern & Section Types\n// ============================================================================\n\nexport interface ResolvedPattern {\n /** Pattern type (e.g., 'page-header', 'entity-list', 'game-canvas') */\n type: string;\n\n /** Pattern configuration */\n config: Record<string, unknown>;\n\n /** Shell component to use */\n shellComponent?: string;\n}\n\nexport interface ResolvedSectionEvent {\n event: string;\n action: string;\n target?: string;\n}\n\nexport interface ResolvedSection {\n /** Section identifier */\n id: string;\n\n /** Resolved pattern */\n pattern: ResolvedPattern;\n\n /** Events emitted by this section */\n events: ResolvedSectionEvent[];\n\n /** Position in page layout */\n position?: number;\n\n /** Entity binding for this section */\n binding?: ResolvedEntityBinding;\n}\n\n// ============================================================================\n// Page Types\n// ============================================================================\n\nexport interface ResolvedNavigation {\n event?: string;\n from?: string;\n to: string;\n trigger?: string;\n params?: Record<string, string>;\n label?: string;\n path?: string;\n icon?: string;\n}\n\nexport interface ResolvedPage {\n /** Page identifier */\n name: string;\n\n /** URL path */\n path: string;\n\n /** Feature folder name */\n featureName: string;\n\n /** Layout component */\n layout?: string;\n\n /** View type (dashboard, list, detail, create, edit) */\n viewType?: 'dashboard' | 'list' | 'detail' | 'create' | 'edit';\n\n /** Resolved sections */\n sections: ResolvedSection[];\n\n /** Resolved trait bindings */\n traits: ResolvedTraitBinding[];\n\n /** Entity data bindings */\n entityBindings: ResolvedEntityBinding[];\n\n /** Navigation wiring */\n navigation: ResolvedNavigation[];\n\n /** Singleton entities to spawn on this page (runtime singletons) */\n singletonEntities: ResolvedEntity[];\n}\n\n// ============================================================================\n// IR Types\n// ============================================================================\n\n/**\n * Complete resolved IR - all references expanded\n */\nexport interface ResolvedIR {\n /** App name */\n appName: string;\n\n /** App description */\n description?: string;\n\n /** App version */\n version?: string;\n\n /** All resolved entities (Map for lookup) */\n entities: Map<string, ResolvedEntity>;\n\n /** All resolved traits (Map for lookup) */\n traits: Map<string, ResolvedTrait>;\n\n /** All resolved pages (Map for lookup) */\n pages: Map<string, ResolvedPage>;\n\n /** Entity bindings (used for data hook generation) */\n entityBindings: ResolvedEntityBinding[];\n\n /** Raw data entities (used for instance data generation) */\n rawEntities?: unknown[];\n\n /** Generation timestamp */\n generatedAt: string;\n}\n\n// ============================================================================\n// Factory Functions\n// ============================================================================\n\n/**\n * Create an empty resolved trait with defaults\n */\nexport function createEmptyResolvedTrait(name: string, source: 'schema' | 'library' | 'inline'): ResolvedTrait {\n return {\n name,\n source,\n states: [],\n events: [],\n transitions: [],\n guards: [],\n ticks: [],\n listens: [],\n dataEntities: [],\n };\n}\n\n/**\n * Create an empty resolved page with defaults\n */\nexport function createEmptyResolvedPage(name: string): ResolvedPage {\n return {\n name,\n path: `/${name.toLowerCase()}`,\n featureName: name.toLowerCase(),\n sections: [],\n traits: [],\n entityBindings: [],\n navigation: [],\n singletonEntities: [],\n };\n}\n\n/**\n * Infer TypeScript type from schema type\n */\nexport function inferTsType(schemaType: string): string {\n const typeMap: Record<string, string> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n date: 'Date',\n datetime: 'Date',\n timestamp: 'number',\n array: 'unknown[]',\n object: 'Record<string, unknown>',\n any: 'unknown',\n };\n\n // Handle array types like \"string[]\"\n if (schemaType.endsWith('[]')) {\n const baseType = schemaType.slice(0, -2);\n return `${typeMap[baseType] || baseType}[]`;\n }\n\n return typeMap[schemaType] || schemaType;\n}\n\n/**\n * Create a resolved field with TypeScript type inference\n */\nexport function createResolvedField(field: {\n name: string;\n type: string;\n description?: string;\n default?: unknown;\n required?: boolean;\n validation?: unknown;\n values?: string[];\n}): ResolvedField {\n return {\n name: field.name,\n type: field.type,\n tsType: inferTsType(field.type),\n description: field.description,\n default: field.default,\n required: field.required ?? false,\n validation: field.validation,\n values: field.values,\n };\n}\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\nexport function isResolvedIR(ir: unknown): ir is ResolvedIR {\n if (!ir || typeof ir !== 'object') return false;\n const r = ir as ResolvedIR;\n return typeof r.appName === 'string' && r.traits instanceof Map && r.pages instanceof Map;\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@almadar/core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Core schema types and definitions for Almadar",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./types": {
|
|
15
|
+
"import": "./dist/src/types/index.js",
|
|
16
|
+
"types": "./dist/src/types/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"zod": "^3.22.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"tsup": "^8.0.0",
|
|
30
|
+
"typescript": "^5.4.0"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/almadar-io/almadar.git",
|
|
35
|
+
"directory": "packages/almadar-core"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"keywords": [
|
|
39
|
+
"almadar",
|
|
40
|
+
"orbital",
|
|
41
|
+
"schema",
|
|
42
|
+
"types"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"build:watch": "tsup --watch",
|
|
47
|
+
"typecheck": "tsc --noEmit"
|
|
48
|
+
}
|
|
49
|
+
}
|