@almadar/core 11.3.0 → 11.5.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/dist/behavior-package.js +1 -3
- package/dist/{builders-DXPLnmJy.d.ts → builders-JiXD6W1T.d.ts} +2266 -98
- package/dist/builders.d.ts +5 -5
- package/dist/builders.js +8 -10
- package/dist/{bus-CRxTnebm.d.ts → bus-__zVNcsp.d.ts} +133 -438
- package/dist/{chunk-DNS4GKQV.js → chunk-27Y5AXHB.js} +71 -45
- package/dist/chunk-2WLRKYD5.js +3823 -0
- package/dist/{chunk-B4MNHGBP.js → chunk-5IRZ6ROW.js} +0 -2
- package/dist/{chunk-7NDAXM2Z.js → chunk-6XYHVJ4J.js} +1 -3
- package/dist/{chunk-RGACZEYC.js → chunk-DDBAQMWA.js} +0 -2
- package/dist/{chunk-7GHJU5WI.js → chunk-GNLND5O2.js} +0 -2
- package/dist/{chunk-M4S2B5VJ.js → chunk-IU3WGC6Q.js} +0 -2
- package/dist/{chunk-LPJ7GKRM.js → chunk-J64IR3DR.js} +17 -9
- package/dist/{chunk-PYYHDYTD.js → chunk-J64YVVB4.js} +1 -3
- package/dist/{chunk-7B4JRMRL.js → chunk-JN3MMQTB.js} +15 -7
- package/dist/{chunk-VIHQKKTZ.js → chunk-LQZXCL47.js} +66 -32
- package/dist/{chunk-6H3UIZR2.js → chunk-OQ3Y5SL3.js} +4 -6
- package/dist/{chunk-3DZOFI53.js → chunk-Q4OJQNYY.js} +5 -4
- package/dist/{chunk-347APWFM.js → chunk-R3Y7ABF4.js} +2 -4
- package/dist/{chunk-N3CK4AYW.js → chunk-VC3HXUWQ.js} +7929 -404
- package/dist/{chunk-2NKK2X53.js → chunk-VQWE3FCB.js} +1 -3
- package/dist/{chunk-VG7BRFUD.js → chunk-W3UJRSYC.js} +0 -2
- package/dist/{chunk-XBWV3DXX.js → chunk-XYHBAUWE.js} +242 -10
- package/dist/{effect-C2VKm6kk.d.ts → effect-gddySYLX.d.ts} +215 -18
- package/dist/{effect-result-BFNANDJ-.d.ts → effect-result-BvBwmspK.d.ts} +131 -43
- package/dist/{expression-DirYKz-f.d.ts → expression-DxY6ct3t.d.ts} +1 -1
- package/dist/factory/index.d.ts +3 -3
- package/dist/factory/index.js +8 -10
- package/dist/factory-runtime/index.d.ts +3 -3
- package/dist/factory-runtime/index.js +15 -17
- package/dist/fixtures.d.ts +8 -7
- package/dist/fixtures.js +6 -8
- package/dist/i18n/index.js +2 -4
- package/dist/{index-DuHpwitt.d.ts → index-h6KrpmjR.d.ts} +23 -10
- package/dist/index.d.ts +15 -17
- package/dist/index.js +23 -25
- package/dist/kernel-wire.d.ts +3 -3
- package/dist/kernel-wire.js +3 -5
- package/dist/language/constructs.json +18 -3
- package/dist/language/program-types.json +28 -1
- package/dist/language/validation-codes.json +231 -1
- package/dist/language/vocabulary.json +63 -1
- package/dist/language-data.js +3 -5
- package/dist/lolo-document/index.js +0 -2
- package/dist/patterns/component-mapping.json +11 -1
- package/dist/patterns/definitions.d.ts +2 -2
- package/dist/patterns/definitions.js +1 -3
- package/dist/patterns/event-contracts.json +1 -1
- package/dist/patterns/index.d.ts +47 -3
- package/dist/patterns/index.js +3 -5
- package/dist/patterns/patterns-registry.json +7929 -402
- package/dist/patterns/registry.json +7929 -402
- package/dist/themes/index.js +2 -4
- package/dist/{trait-Cv3HTGFL.d.ts → trait-Oun4JgeZ.d.ts} +52 -22
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.js +12 -14
- package/dist/{types-wWEqi7vj.d.ts → types-B-r7Z7Lf.d.ts} +3 -3
- package/package.json +6 -6
- package/dist/behavior-package.js.map +0 -1
- package/dist/builders.js.map +0 -1
- package/dist/chunk-2NKK2X53.js.map +0 -1
- package/dist/chunk-347APWFM.js.map +0 -1
- package/dist/chunk-3DZOFI53.js.map +0 -1
- package/dist/chunk-6H3UIZR2.js.map +0 -1
- package/dist/chunk-7B4JRMRL.js.map +0 -1
- package/dist/chunk-7GHJU5WI.js.map +0 -1
- package/dist/chunk-7NDAXM2Z.js.map +0 -1
- package/dist/chunk-B4MNHGBP.js.map +0 -1
- package/dist/chunk-DNS4GKQV.js.map +0 -1
- package/dist/chunk-LPJ7GKRM.js.map +0 -1
- package/dist/chunk-M4S2B5VJ.js.map +0 -1
- package/dist/chunk-N3CK4AYW.js.map +0 -1
- package/dist/chunk-PYYHDYTD.js.map +0 -1
- package/dist/chunk-RGACZEYC.js.map +0 -1
- package/dist/chunk-VG7BRFUD.js.map +0 -1
- package/dist/chunk-VIHQKKTZ.js.map +0 -1
- package/dist/chunk-XBWV3DXX.js.map +0 -1
- package/dist/chunk-ZDIHVDTW.js +0 -3810
- package/dist/chunk-ZDIHVDTW.js.map +0 -1
- package/dist/factory/index.js.map +0 -1
- package/dist/factory-runtime/index.js.map +0 -1
- package/dist/fixtures.js.map +0 -1
- package/dist/i18n/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kernel-wire.js.map +0 -1
- package/dist/language-data.js.map +0 -1
- package/dist/lolo-document/index.js.map +0 -1
- package/dist/patterns/definitions.js.map +0 -1
- package/dist/patterns/index.js.map +0 -1
- package/dist/themes/index.js.map +0 -1
- package/dist/types/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/projection.ts","../src/types/field.ts","../src/types/asset.ts","../src/types/entity.ts","../src/types/effect.ts"],"names":["z"],"mappings":";;;;;AAaO,IAAM,qBAAA,GAAoD,EAAE,MAAA,CAAO;AAAA,EACtE,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACtB,OAAO,CAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA;AAC7B,CAAC;ACmBM,IAAM,cAAA,GAAiB,CAAC,IAAA,EAAM,KAAA,EAAO,OAAO,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,KAAK;AAsE5E,IAAM,WAA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AM,sBAA0DA,CAAAA,CAAE,MAAA;AAAA,EACrE,CAAC,KAAA,KAAU,KAAA,KAAU,IAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,IAAQ,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAAA,EACjG,EAAE,SAAS,0CAAA;AACf;AAGO,IAAM,sBAAmDA,CAAAA,CAAE,MAAA;AAAA,EAC9D,CAAC,KAAA,KAAU,OAAO,KAAA,KAAU,QAAA,IAAY,UAAU,IAAA,IAAQ,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAAA,EAC9E,EAAE,SAAS,kCAAA;AACf;AAGO,IAAM,6BAA8DA,CAAAA,CAAE,MAAA;AAAA,EACzE,CAAC,KAAA,KAAU,OAAO,KAAA,KAAU,QAAA,IAAY,UAAU,IAAA,IAAQ,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAAA,EAC9E,EAAE,SAAS,0CAAA;AACf","file":"chunk-7B4JRMRL.js","sourcesContent":["import { z } from 'zod';\n\n/**\n * `.lolo` `T` or `T.f` in any type position: the authored entity or struct type `type`, or its declared field `field`.\n * A field carrying it holds that type itself; `projectedFrom` records where it came from, so a value can be drawn from\n * `T`'s own rows or `f` (the mock seeder draws from `T`'s seeded rows). Mirrors Rust `FieldProjection`, whose `field`\n * is absent for a named type.\n */\nexport type FieldProjection = {\n type: string;\n field?: string;\n};\n\nexport const FieldProjectionSchema: z.ZodType<FieldProjection> = z.object({\n type: z.string().min(1),\n field: z.string().min(1).optional(),\n});\n","/**\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 { FieldProjectionSchema, type FieldProjection } from './projection.js';\nimport { z } from 'zod';\nimport type { EntityId } from './identity.js';\nimport { EntityIdSchema } from './identity.js';\nimport type { JsonValue, RuntimeValue } from './json.js';\nimport { JsonValueSchema } from './json.js';\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 = FieldTag | TypeVariable;\n\n/** An unbound type variable (`t` of `type Page t` or a trait's `(t : Type)`),\n * written `$t` — the `.orb` spelling the Rust `FieldType::TypeVar` serializes to. */\nexport type TypeVariable = `$${string}`;\n\n/** The fixed widths other than `int` (i64) and `number` (f64), the Rust `FieldType::Sized`: a checked range over\n * an int or a number at run time. */\nexport const NUM_WIDTH_TAGS = ['i8', 'i16', 'i32', 'u8', 'u16', 'u32', 'u64', 'f32'] as const;\nexport type NumWidthTag = (typeof NUM_WIDTH_TAGS)[number];\n\n/** The concrete field-type tags (every `FieldType` but a type variable). */\nexport type FieldTag =\n | 'string'\n | 'number'\n | 'int'\n | NumWidthTag\n | 'boolean'\n | 'date'\n | 'timestamp'\n | 'datetime'\n | 'instant'\n // Semantic string domains. `.lolo` already types `date`/`datetime` rather\n // than annotating them, so these belong in the type system for the same\n // reason: a field's domain is a declared fact, not a decoration. They\n // replaced the optional `format` property, which had zero producers.\n | 'email'\n | 'url'\n | 'phone'\n | 'uuid'\n | 'image'\n // Promoted value types (2026-08-20). `money` is numeric at rest - the\n // declared type (never a field-name heuristic) drives currency inputs\n // and formatting. `file` is the canonical struct value\n // {name, url, mimeType, sizeBytes} - an uploaded artifact, not a\n // validated string; `url` is a data: URI in mock mode.\n | 'money'\n | 'file'\n // `bytes` is binary data; at rest a standard padded base64 string.\n | 'bytes'\n | 'array'\n | 'object'\n | 'enum'\n | 'relation'\n | 'trait'\n | 'orbital'\n | 'behavior'\n | 'slot'\n | 'pattern'\n // Renderable UI content — a pattern node (or array of them), the same\n // shape `render-ui` effects carry (`PatternNode` in render-ui-edit.ts).\n // First-class so view-fragment fields stop hiding behind `object`/`json`.\n | 'node'\n // Event-name reference — a string at rest, but the TYPE marks it as an\n // event key rather than free text (Phase B / SCAN-EVENT-KNOB-2). Legal\n // on struct-alias fields consumed by config knobs (e.g. `ItemAction.event`).\n | 'event'\n // A value addressing a declared external input (`Trait.EVENT`,\n // `Orbital.Trait.EVENT`) — never a bare name. See `EventAddress` in access/externalInputs.\n | 'EventAddress'\n // A call key — a string at rest, but nominal: a bare string never converts to it\n // implicitly, only `(as v CallKey)` does. Names the keyed call a `cancel-call` aborts.\n | 'CallKey'\n // An S-expression as data — atom, list or options object (a transition's\n // guard / effect args); config-only (G-ORB-093).\n | 'SExpr'\n // Tagged struct union (`type DrawItem = DrawShape | DrawText`) — a real\n // .lolo/.orb type the Rust compiler accepts; the TS mirror must carry it\n // or generated factories fail DTS (docs/Almadar_LOLO_Gaps.md L-6).\n | 'union'\n // Fixed-length tuple (`.lolo` `[T1, T2, …]`); slots ride `properties`, keyed by index.\n | 'tuple'\n // The name of a field of a record (`.lolo` `field R T`); a string at rest. `record` is `R`, `items` the type\n // the named field must have, absent for any field. Config-only.\n | 'field';\n\n/** Every `FieldType`, as a runtime array. Downstream imports this instead of\n * re-listing the union — five copies had already drifted apart. */\nexport const FIELD_TYPES = [\n 'string',\n 'number',\n 'int',\n ...NUM_WIDTH_TAGS,\n 'boolean',\n 'date',\n 'timestamp',\n 'datetime',\n 'instant',\n 'email',\n 'url',\n 'phone',\n 'uuid',\n 'image',\n 'money',\n 'file',\n 'bytes',\n 'array',\n 'object',\n 'enum',\n 'relation',\n 'trait',\n 'orbital',\n 'behavior',\n 'slot',\n 'pattern',\n 'node',\n 'event',\n 'EventAddress',\n 'CallKey',\n 'SExpr',\n 'union',\n 'tuple',\n 'field',\n] as const satisfies readonly FieldTag[];\n\n/** The semantic string domains — constrained strings, validatable by value. */\nexport const SEMANTIC_STRING_TYPES = ['email', 'url', 'phone', 'uuid', 'image'] as const;\n\nexport type SemanticStringType = (typeof SEMANTIC_STRING_TYPES)[number];\n\n/** Is this a semantic string domain (as opposed to a bare `string`)? */\nexport function isSemanticStringType(type: FieldType): type is SemanticStringType {\n return (SEMANTIC_STRING_TYPES as readonly string[]).includes(type);\n}\n\nexport const FieldTagSchema = z.enum(FIELD_TYPES);\n\nexport function isTypeVariable(type: string): type is TypeVariable {\n return /^\\$.+$/.test(type);\n}\n\nexport const TypeVariableSchema = z.custom<TypeVariable>(\n (v) => typeof v === 'string' && isTypeVariable(v),\n { message: 'a type variable is `$<name>`' },\n);\n\nexport const FieldTypeSchema = z.union([FieldTagSchema, TypeVariableSchema]);\n\n/** Words legal in a `.lolo`/`.orb` TYPE POSITION that are not entity field\n * types (config/param/return annotations, primitives with no field-level\n * meaning, etc.) — declared so the i18n `types` vocabulary section is\n * `FIELD_TYPES ∪ TYPE_POSITION_ONLY` exactly, not a hand-maintained superset\n * held together by a one-directional pinned test (see G-i18n-5). */\nexport const TYPE_POSITION_ONLY = [\n 'Map',\n 'any',\n 'asset',\n 'bool',\n 'component',\n 'duration',\n 'entity',\n 'f64',\n 'float',\n 'i64',\n 'icon',\n 'null',\n 'secret',\n 'void',\n] as const;\n\n// ============================================================================\n// Relation Configuration\n// ============================================================================\n\n/**\n * Cardinality for relation fields.\n * Matches Rust compiler's Cardinality enum.\n */\nexport type RelationCardinality = \n | 'one' \n | 'many' \n | 'one-to-many' \n | 'many-to-one' \n | 'many-to-many';\n\nexport const RelationCardinalitySchema = z.enum([\n 'one',\n 'many',\n 'one-to-many',\n 'many-to-one',\n 'many-to-many',\n]);\n\n/**\n * Configuration for relation fields (foreign keys).\n * Matches Rust compiler's RelationDefinition format.\n */\nexport type RelationConfig = {\n /** Target entity name (e.g., 'User', 'Task') - matches Rust's `entity` field */\n entity: string;\n /** V4 dual-carry id sibling of `entity` — optional until the Phase-7 flip. */\n entityId?: EntityId;\n /** Field on target entity (defaults to 'id') */\n field?: string;\n /** \n * Cardinality: one, many, one-to-many, many-to-one, many-to-many\n * Matches Rust compiler's cardinality format\n */\n cardinality?: RelationCardinality;\n /** Delete behavior */\n onDelete?: 'cascade' | 'nullify' | 'restrict';\n /** The target field a related record is shown by (`@display <field>`); the record id when absent. */\n display?: string;\n /** \n * Foreign key field name (for legacy compatibility).\n * @deprecated Use field instead\n */\n foreignKey?: string;\n /**\n * Target entity name (for legacy compatibility).\n * @deprecated Use entity instead\n */\n target?: string;\n /**\n * Cardinality type alias (for legacy compatibility).\n * @deprecated Use cardinality instead\n */\n type?: RelationCardinality;\n};\n\nexport const RelationConfigSchema = z.object({\n entity: z.string().min(1, 'Target entity is required'),\n entityId: EntityIdSchema.optional(),\n field: z.string().optional(),\n cardinality: RelationCardinalitySchema.optional(),\n onDelete: z.enum(['cascade', 'nullify', 'restrict']).optional(),\n display: z.string().min(1).optional(),\n // Legacy compatibility fields\n foreignKey: z.string().optional(),\n target: z.string().optional(),\n type: RelationCardinalitySchema.optional(),\n}).transform((data) => {\n // Normalize legacy format to standard format\n const cardinality = data.cardinality || data.type;\n const normalized: RelationConfig = {\n entity: data.entity || data.target || '',\n ...(data.entityId !== undefined ? { entityId: data.entityId } : {}),\n ...(cardinality !== undefined ? { cardinality } : {}),\n ...(data.field !== undefined ? { field: data.field } : {}),\n ...(data.onDelete !== undefined ? { onDelete: data.onDelete } : {}),\n ...(data.display !== undefined ? { display: data.display } : {}),\n };\n return normalized;\n});\n\nexport type RelationConfigInput = z.input<typeof RelationConfigSchema>;\n\n// ============================================================================\n// Field Format\n// ============================================================================\n\n/**\n * Value rules for the semantic string domains — one owner, so the seeders, the\n * validators and the verifiers cannot drift apart on what counts as valid.\n *\n * These replaced the old optional `format` property, which had zero producers\n * anywhere in the repo and no Rust counterpart at all: `format` was unreachable\n * from `.lolo`, so every consumer fell back to guessing from field names.\n */\n/**\n * The one definition of the semantic string patterns, in the shared regex dialect (`validate/pattern`). The\n * `@almadar/std` `validate/email|url|phone|uuid` operators carry these exact strings in `canonical-operators.json`\n * (generated from here), so the kernel's validators and these readers cannot disagree. `image` is a URL.\n */\nexport const SEMANTIC_STRING_PATTERNS = {\n email: '^[^\\\\s@]+@[^\\\\s@.]+\\\\.[^\\\\s@]+$',\n url: '^https?://[^\\\\s]+$',\n phone: '^[+]?[\\\\d\\\\s().-]{7,}$',\n uuid: '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$',\n} as const;\n\nconst EMAIL_RE = new RegExp(SEMANTIC_STRING_PATTERNS.email);\nconst URL_RE = new RegExp(SEMANTIC_STRING_PATTERNS.url);\nconst PHONE_RE = new RegExp(SEMANTIC_STRING_PATTERNS.phone);\nconst UUID_RE = new RegExp(SEMANTIC_STRING_PATTERNS.uuid);\n\nexport function isEmailValue(value: string): boolean {\n return EMAIL_RE.test(value);\n}\n\nexport function isUrlValue(value: string): boolean {\n return URL_RE.test(value);\n}\n\nexport function isPhoneValue(value: string): boolean {\n return PHONE_RE.test(value);\n}\n\nexport function isUuidValue(value: string): boolean {\n return UUID_RE.test(value);\n}\n\n// ============================================================================\n// File value — the canonical struct a `file`-typed field holds at rest.\n// ONE owner for the shape; mirrors `file_value_fields()` in orbital-core\n// (ir/render.rs) and the codegen zod emitter.\n// ============================================================================\n\n/** The value a `file`-typed entity field holds: an uploaded artifact.\n * `url` is a `data:` URI in mock/playground mode (size-ceilinged by the\n * mock adapter) or an object-storage URL in production. */\nexport type FileValue = {\n name: string;\n url: string;\n mimeType: string;\n sizeBytes: number;\n};\n\n/** Zod schema for {@link FileValue}. */\nexport const FileValueSchema = z.object({\n name: z.string(),\n url: z.string(),\n mimeType: z.string(),\n sizeBytes: z.number(),\n});\n\n/** Is `value` a well-formed {@link FileValue}? The `file` twin of\n * `isSemanticStringValue` — the seeder's output must satisfy this. */\nexport function isFileValue(value: unknown): value is FileValue {\n return FileValueSchema.safeParse(value).success;\n}\n\n/** Does `value` satisfy the declared semantic domain? `image` is a URL. */\nexport function isSemanticStringValue(type: SemanticStringType, value: string): boolean {\n switch (type) {\n case 'email':\n return isEmailValue(value);\n case 'url':\n case 'image':\n return isUrlValue(value);\n case 'phone':\n return isPhoneValue(value);\n case 'uuid':\n return isUuidValue(value);\n }\n}\n\n// ============================================================================\n// Entity Field — discriminated union by `type`\n// ============================================================================\n\n/**\n * Field-type tags that don't carry a type-dependent payload. The base\n * `EntityField` shape applies as-is.\n */\ntype ScalarFieldType =\n | 'string'\n | 'number'\n | 'int'\n | NumWidthTag\n | 'boolean'\n | 'date'\n | 'timestamp'\n | 'datetime'\n | 'instant'\n | 'email'\n | 'url'\n | 'phone'\n | 'uuid'\n | 'image'\n | 'money'\n | 'file'\n | 'bytes'\n | 'trait'\n | 'orbital'\n | 'behavior'\n | 'slot'\n | 'pattern'\n | 'node'\n | 'event'\n | 'EventAddress'\n | 'CallKey'\n | 'SExpr';\n\n/** Fields shared across every variant. */\ntype EntityFieldBase = {\n /**\n * Field name (camelCase). Optional for nested item/property descriptors\n * where the name is implied by the parent (`items`, `properties[k]`).\n * Mirrors Rust's `FieldDefinition.name: Option<String>`.\n */\n name?: string;\n /** Whether the field is required */\n required?: boolean;\n nullable?: boolean;\n additionalProperties?: EntityField;\n /** Primary-key marker. Mirrors Rust's `FieldDefinition.primary_key`\n * (serde `primaryKey`). */\n primaryKey?: boolean;\n /** Default value — parsed from `.orb`, always JSON-shaped. */\n default?: JsonValue;\n /** Minimum value (for number) or length (for string) */\n min?: number;\n /** Maximum value or length */\n max?: number;\n /** Object property schemas keyed by property name (for object type).\n * Mirrors Rust's `FieldDefinition.properties: Option<HashMap<String,\n * FieldDefinition>>`. Populated by the lolo lowerer when a field /\n * config slot's type expression resolves to a struct shape\n * (`TypeExpr::Object`), including named-type aliases like `[MetricSpec]`. */\n properties?: Record<string, EntityField>;\n /** Runtime-managed widget state (authored `@intrinsic` in `.lolo`). Exempt\n * from the explicit-binding rule and never a domain-data bind target. */\n intrinsic?: boolean;\n /** Stored computed field (authored `@derived <expr>` in `.lolo`): the kernel evaluates the expression on every write. */\n derived?: JsonValue;\n /** Human/semantic description (authored `@description \"...\"` in `.lolo`).\n * Authoring/build-time metadata — factory-signature catalog, embeddings,\n * curation field-matching; the runtime ignores it. */\n description?: string;\n /** User-vocabulary synonyms (authored `@synonyms \"...\"` in `.lolo`).\n * Free text feeding catalog search / curation field-matching. */\n synonyms?: string;\n /** Declared mock value(s) (authored `@mock \"...\"` in `.lolo`), used\n * LITERALLY by the seeder (`sampleValue.ts`, `seed.rs`) — never mapped\n * through a domain-name lookup table. Comma-separated is an explicit\n * candidate list rotated by row index (`@mock \"Acme Corp, Globex Inc\"`);\n * no comma is a single literal value, index-suffixed per row\n * (`@mock \"person-name\"` -> \"person-name-1\", \"person-name-2\", ...). */\n mock?: string;\n /**\n * The imported entity this field was merged from on a rebind (sibling\n * pull / entity contract). Absent on author-declared fields — a merged\n * field's `required` is the ATOM's own write contract, never the host\n * writer's.\n */\n mergedFrom?: string;\n /** `.lolo` `T.f`: the declared field this field's type was projected from. */\n projectedFrom?: FieldProjection;\n};\n\n/**\n * Scalar / structural fields — no type-dependent payload required.\n * `values?` is permitted as an OPTIONAL UI/validation hint (e.g. lolo's\n * `'a' | 'b' | 'c'` string-union sugar lowers to `type: 'string', values:\n * [...]`). Only `EnumEntityField` MANDATES values.\n */\nexport type ScalarEntityField = EntityFieldBase & {\n type: ScalarFieldType;\n /** Optional vocabulary hint for scalar fields (e.g. string unions\n * authored as `'a'|'b'|'c'` in lolo). Not required at this variant. */\n values?: string[];\n};\n\n/** `type: 'enum'` REQUIRES the closed vocabulary in `values`. */\nexport type EnumEntityField = EntityFieldBase & {\n type: 'enum';\n /** Closed string vocabulary the field accepts. */\n values: string[];\n};\n\n/** `type: 'relation'` REQUIRES the relation target binding. */\nexport type RelationEntityField = EntityFieldBase & {\n type: 'relation';\n /** Relation target binding (entity + cardinality). */\n relation: RelationConfig;\n};\n\n/**\n * `type: 'union'` — a TAGGED union of struct variants (`.lolo`\n * `type DrawItem = DrawShape | DrawText`). `values` carries the variant NAMES\n * in declaration order; `properties` (from the base shape) carries each\n * variant's shape keyed by that name. A value selects its variant by the\n * variant's literal-typed tag field, else by the one closed shape it fits\n * (orbital-core `select_union_variant`). Recursion is carried\n * BY NAME: a variant referring back to the union gets `values` with no\n * `properties` (mirrors `FieldType::Union` in orbital-core).\n */\nexport type UnionEntityField = EntityFieldBase & {\n type: 'union';\n /** Variant type names in declaration order. */\n values: string[];\n};\n\n/** `type: 'array'` — element schema in `items` strongly preferred but\n * optional for legacy compatibility with codegen-emitted scalar-array\n * fields (e.g. `{type: 'array', default: []}`). The lolo lowerer + Rust\n * validator catch typed-element-required cases downstream. */\nexport type ArrayEntityField = EntityFieldBase & {\n type: 'array';\n /** Element schema for the array. */\n items?: EntityField;\n};\n\n/** `type: 'tuple'` — a fixed-length tuple (`.lolo` `[T1, T2, …]`, Rust\n * `FieldType::Tuple`): each slot's schema rides `properties`, keyed `\"0\"`, `\"1\"`, …. */\nexport type TupleEntityField = EntityFieldBase & {\n type: 'tuple';\n properties: Record<string, EntityField>;\n};\n\n/** `type: 'field'` — the name of a field of the record `record` (`.lolo` `field R T`); `items` is the type that field\n * must have (absent: any field). `record` is `R` as a type string: `@entity`, `@entity(knob)`, `@payload(knob)`, an\n * entity or alias name, or `$r`; an alias's shape rides `properties`. Mirrors Rust's `FieldType::Field`. */\nexport type FieldRefEntityField = EntityFieldBase & {\n type: 'field';\n record?: string;\n items?: EntityField;\n};\n\n/**\n * `type: 'object'` — a fixed-key struct (fields in `properties`) OR a\n * dynamic-key map (`Map K V` in `.lolo`; the uniform value schema lives in\n * `items`, mirroring an array's element schema). A distinct variant so `items`\n * is statically allowed only on object/array fields, never on scalars.\n */\nexport type ObjectEntityField = EntityFieldBase & {\n type: 'object';\n /** Uniform value schema for a dynamic-key map (`Map K V`). */\n items?: EntityField;\n /** `@payload(.<sibling>)`: with no `properties`, the object is the declared payload of the event the sibling member\n * of the same struct names (`.lolo` `payload : @payload event`). Mirrors Rust `FieldDefinition.record`. */\n record?: string;\n};\n\n/**\n * Entity field definition — discriminated union by `type`. Each variant\n * statically enforces its dependent payload (`values` for enum,\n * `relation` for relation, `items` for array) so TS / Zod / JSON Schema\n * consumers all agree on the dependency, not just the Rust validator.\n *\n * @example\n * { name: 'status', type: 'enum', values: ['draft', 'published'] }\n * { name: 'authorId', type: 'relation', relation: { entity: 'User', cardinality: 'one' } }\n * { name: 'tags', type: 'array', items: { type: 'string' } }\n */\n/** A field typed by an unbound type variable; binding substitutes it. */\nexport type TypeVariableEntityField = EntityFieldBase & {\n type: TypeVariable;\n};\n\nexport function isTypeVariableField(f: EntityField): f is TypeVariableEntityField {\n return isTypeVariable(f.type);\n}\n\nexport type EntityField =\n | TypeVariableEntityField\n | ScalarEntityField\n | EnumEntityField\n | RelationEntityField\n | UnionEntityField\n | ArrayEntityField\n | TupleEntityField\n | FieldRefEntityField\n | ObjectEntityField;\n\n/**\n * Alias map for legacy/loose field-type spellings. Preprocessed into the\n * canonical `FieldType` enum before zod validates. Without this, agent-produced\n * schemas using `text`/`int`/`float`/`ts` were rejected at parse time — this\n * normalizes them so the rest of the pipeline sees only canonical types.\n */\nconst FIELD_TYPE_ALIASES: Record<string, FieldType> = {\n text: 'string',\n float: 'number',\n ts: 'timestamp',\n};\n\n/**\n * Zod schema for `EntityField`. Preprocess normalizes:\n * - legacy `type` aliases (text → string, int → number, etc.)\n * - legacy `enum: string[]` alias → `values: string[]`\n *\n * Branches on `type` so TS narrows the parsed output to the matching\n * discriminated-union variant.\n */\n// The input type param stays `unknown`: `z.preprocess` bakes `unknown` into\n// its input type, and the recursion needs the explicit annotation.\nexport const EntityFieldSchema: z.ZodType<EntityField, unknown> = z.lazy(() => {\n const baseFieldShape = {\n name: z.string().min(1, 'Field name is required').optional(),\n required: z.boolean().optional(),\n nullable: z.boolean().optional(),\n additionalProperties: EntityFieldSchema.optional(),\n primaryKey: z.boolean().optional(),\n default: JsonValueSchema.optional(),\n min: z.number().optional(),\n max: z.number().optional(),\n properties: z.record(z.string(), EntityFieldSchema).optional(),\n intrinsic: z.boolean().optional(),\n derived: JsonValueSchema.optional(),\n description: z.string().optional(),\n synonyms: z.string().optional(),\n mock: z.string().optional(),\n mergedFrom: z.string().optional(),\n projectedFrom: FieldProjectionSchema.optional(),\n };\n\n /** Build a scalar variant schema. `values?` is permitted as a hint;\n * only the enum variant mandates a non-empty values array. */\n function scalarVariant<T extends ScalarFieldType>(t: T) {\n return z.object({\n ...baseFieldShape,\n type: z.literal(t),\n values: z.array(z.string()).optional(),\n });\n }\n\n return z.preprocess(\n (input) => {\n if (\n input === null ||\n typeof input !== 'object' ||\n !('type' in input) ||\n typeof (input as { type?: RuntimeValue }).type !== 'string'\n ) {\n return input;\n }\n const obj = input as { type: string; enum?: RuntimeValue; values?: RuntimeValue };\n const next: { type: string; enum?: RuntimeValue; values?: RuntimeValue } = { ...obj };\n const aliased = FIELD_TYPE_ALIASES[obj.type];\n if (aliased !== undefined) next.type = aliased;\n // Fold legacy `enum: string[]` into `values: string[]`.\n if (next.enum !== undefined && next.values === undefined) {\n next.values = next.enum;\n }\n delete next.enum;\n return next;\n },\n z.union([\n z.object({ ...baseFieldShape, type: TypeVariableSchema }),\n z.discriminatedUnion('type', [\n scalarVariant('string'),\n scalarVariant('number'),\n scalarVariant('int'),\n scalarVariant('i8'),\n scalarVariant('i16'),\n scalarVariant('i32'),\n scalarVariant('u8'),\n scalarVariant('u16'),\n scalarVariant('u32'),\n scalarVariant('u64'),\n scalarVariant('f32'),\n scalarVariant('boolean'),\n scalarVariant('date'),\n scalarVariant('timestamp'),\n scalarVariant('datetime'),\n scalarVariant('instant'),\n scalarVariant('email'),\n scalarVariant('url'),\n scalarVariant('phone'),\n scalarVariant('uuid'),\n scalarVariant('image'),\n scalarVariant('trait'),\n scalarVariant('orbital'),\n scalarVariant('behavior'),\n scalarVariant('slot'),\n scalarVariant('pattern'),\n scalarVariant('node'),\n scalarVariant('event'),\n scalarVariant('EventAddress'),\n scalarVariant('CallKey'),\n scalarVariant('money'),\n scalarVariant('file'),\n scalarVariant('bytes'),\n scalarVariant('SExpr'),\n // Enum variant — REQUIRES non-empty values.\n z.object({\n ...baseFieldShape,\n type: z.literal('enum'),\n values: z.array(z.string()).min(1, 'Enum field requires a non-empty `values` array'),\n }),\n // Union variant — tagged struct union; values = variant names,\n // per-variant shapes in `properties` (absent on named recursion).\n z.object({\n ...baseFieldShape,\n type: z.literal('union'),\n values: z.array(z.string()).min(1, 'Union field requires a non-empty `values` array'),\n }),\n // Relation variant — REQUIRES relation config.\n z.object({\n ...baseFieldShape,\n type: z.literal('relation'),\n relation: RelationConfigSchema,\n }),\n // Array variant — items optional to match relaxed TS shape.\n z.object({\n ...baseFieldShape,\n type: z.literal('array'),\n items: EntityFieldSchema.optional(),\n }),\n // Field-reference variant — `items` is the type the named field must have.\n z.object({\n ...baseFieldShape,\n type: z.literal('field'),\n record: z.string().optional(),\n items: EntityFieldSchema.optional(),\n }),\n // Tuple variant — slots in `properties`, keyed by index (at least one).\n z.object({\n ...baseFieldShape,\n type: z.literal('tuple'),\n properties: z.record(z.string(), EntityFieldSchema).refine((p) => Object.keys(p).length > 0, 'Tuple field requires slots in `properties`'),\n }),\n // Object variant — fixed-key struct (`properties`) or dynamic-key\n // map (`Map K V`, uniform value schema in `items`).\n z.object({\n ...baseFieldShape,\n type: z.literal('object'),\n items: EntityFieldSchema.optional(),\n record: z.string().optional(),\n values: z.array(z.string()).optional(),\n }),\n ]),\n ]),\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// Asset Dimension + Aspect (render metadata carried with the asset / the need)\n// ============================================================================\n\n/**\n * Whether the asset is a 2D sprite/image or a 3D model. Set by the consuming\n * canvas: the same entity role is a 2D sprite-sheet on a tile board and a 3D\n * rigged model on a 3D board.\n */\nexport const ASSET_DIMENSIONS = ['2d', '3d'] as const;\n\nexport type AssetDimension = (typeof ASSET_DIMENSIONS)[number];\n\nexport const AssetDimensionSchema = z.enum(ASSET_DIMENSIONS);\n\n/**\n * Rendering aspect ratio of an asset: square (tiles/sprites/portraits/icons),\n * 16:9 (scene backdrops), 5:7 (cards), 8:1 (effect frame strips),\n * 4:1 (wide paddles/bars), 5:3 (wide scenes), 1:2 (tall banners).\n */\nexport const ASSET_ASPECTS = ['1:1', '16:9', '5:7', '8:1', '4:1', '5:3', '1:2'] as const;\n\nexport type AssetAspect = (typeof ASSET_ASPECTS)[number];\n\nexport const AssetAspectSchema = z.enum(ASSET_ASPECTS);\n\n// ============================================================================\n// Effect Kind\n// ============================================================================\n\n/**\n * Stage-table kind of an effect (`role: 'effect'`) asset. Absent means `burst`.\n */\nexport const FX_KINDS = ['slash', 'puff', 'heal', 'trap', 'burst'] as const;\n\nexport type FxKind = (typeof FX_KINDS)[number];\n\nexport const FxKindSchema = z.enum(FX_KINDS);\n\n// ============================================================================\n// Animation Name + Sheet Direction\n// ============================================================================\n\n/**\n * Animation names matching a sprite sheet's row layout. Canonical home for\n * this vocabulary — `@almadar/ui`'s `spriteAnimationTypes.ts` re-exports it\n * rather than redeclaring, so board `.lolo` config and the render library\n * agree on one enum.\n */\nexport const ANIMATION_NAMES = ['idle', 'walk', 'skate', 'jump', 'fall', 'attack', 'hit', 'death'] as const;\n\nexport type AnimationName = (typeof ANIMATION_NAMES)[number];\n\nexport const AnimationNameSchema = z.enum(ANIMATION_NAMES);\n\n/**\n * Sheet file directions (physical PNG files a sprite sheet ships as).\n * Legacy hand-drawn packs ship only se/sw and mirror-flip for ne/nw (a cheat\n * that shows the face while walking away); 3D-baked sheets ship all four real\n * directions — the renderer prefers a real sheet and keeps the flip only as\n * the legacy fallback.\n */\nexport const SPRITE_DIRECTIONS = ['se', 'sw', 'ne', 'nw'] as const;\n\nexport type SpriteDirection = (typeof SPRITE_DIRECTIONS)[number];\n\nexport const SpriteDirectionSchema = z.enum(SPRITE_DIRECTIONS);\n\n/**\n * Camera projections a baked sprite sheet can ship. `iso` is directional\n * (se/sw physical sheets, ne/nw by mirror); `front`/`top`/`perspective` are\n * single fixed-camera sheets (the mesh reference-sheet camera vocabulary).\n */\nexport const SHEET_PROJECTIONS = ['iso', 'front', 'back', 'top', 'perspective'] as const;\n\nexport type SheetProjection = (typeof SHEET_PROJECTIONS)[number];\n\nexport const SheetProjectionSchema = z.enum(SHEET_PROJECTIONS);\n\n// ============================================================================\n// Animation Definition\n// ============================================================================\n\n/**\n * Definition for a single named animation within a sprite sheet: which row\n * it occupies, how many frames it has, and its playback rate. This is the\n * shape actually consumed by `@almadar/ui`'s sprite-sheet renderer\n * (`spriteAnimation.ts`'s `frameRect`/`getCurrentFrameFromDef`) — moved here\n * verbatim rather than reconciled with a differently-shaped guess, since\n * `@almadar/ui`'s version is the one with real production consumers.\n */\nexport interface AnimationDef {\n /** Row index in the sprite sheet (0-based; each animation occupies one row). */\n row: number;\n /** Number of frames in this animation. */\n frames: number;\n /** Frames per second. */\n frameRate: number;\n /** Whether the animation loops. */\n loop: boolean;\n}\n\nexport const AnimationDefSchema = z.object({\n row: z.number().int().nonnegative(),\n frames: z.number().int().positive(),\n frameRate: z.number().positive(),\n loop: z.boolean(),\n});\n\n// ============================================================================\n// Sprite Sheet Atlas\n// ============================================================================\n\n/**\n * Parsed sprite-sheet atlas JSON — the contract a `spriteSheet`-role `Asset.url`\n * resolves to when fetched (see `Asset.url` usage in `@almadar/ui`'s\n * `useUnitSpriteAtlas`). A unit's `sprite?: Asset` stays the static single-pose\n * image; `spriteSheet?: Asset` is a SEPARATE reference whose URL points at a\n * `SpriteSheetAtlas`-shaped JSON manifest (e.g. `.../guardian-sprite-sheet.json`),\n * not a PNG. Frame-cutting geometry lives here, not inlined onto `Asset` — an\n * `Asset` traveling through `render-ui` every tick stays small.\n */\nexport interface SpriteSheetAtlas {\n /** Unit archetype key. */\n unit?: string;\n /** Visual type key. */\n type?: string;\n /** Width of a single frame in pixels. */\n frameWidth: number;\n /** Height of a single frame in pixels. */\n frameHeight: number;\n /** Number of columns (frames per row). */\n columns: number;\n /** Number of rows (animations). */\n rows: number;\n /** Directions present as physical PNG files. */\n directions: SpriteDirection[];\n /** Relative PNG sheet paths per direction. */\n sheets: Partial<Record<SpriteDirection, string>>;\n /** Animation row layout keyed by animation name. Unit sheets use the canonical `AnimationName` rows; one-shot fx sheets declare their own names (e.g. `burst`) — the manifest is authoritative for its rows. */\n animations: Partial<Record<string, AnimationDef>>;\n /**\n * Per-projection sheet PNGs (additive; absent on legacy atlases). `iso`\n * mirrors `sheets` (directional se/sw); the fixed cameras carry one sheet\n * each. `sheets` remains the iso back-compat alias — writers emit both.\n */\n projections?: {\n iso?: Partial<Record<SpriteDirection, string>>;\n front?: string;\n back?: string;\n top?: string;\n perspective?: string;\n };\n}\n\nexport const SpriteSheetAtlasSchema = z.object({\n unit: z.string().optional(),\n type: z.string().optional(),\n frameWidth: z.number().positive(),\n frameHeight: z.number().positive(),\n columns: z.number().int().positive(),\n rows: z.number().int().positive(),\n directions: z.array(SpriteDirectionSchema),\n sheets: z.partialRecord(SpriteDirectionSchema, z.string()),\n animations: z.record(z.string(), AnimationDefSchema),\n projections: z\n .object({\n iso: z.partialRecord(SpriteDirectionSchema, z.string()).optional(),\n front: z.string().optional(),\n back: z.string().optional(),\n top: z.string().optional(),\n perspective: z.string().optional(),\n })\n .optional(),\n});\n\n// ============================================================================\n// Texture Atlas — named-subrect packed sheet (the industry standard)\n// ============================================================================\n\n/**\n * One named sub-rectangle inside a packed sheet. Mirrors the ShoeBox /\n * TexturePacker `<SubTexture>` element every Kenney `Spritesheet/*.xml` ships\n * (`x`/`y`/`width`/`height` = the rect in the sheet PNG; `frameX`/`frameY`/\n * `frameWidth`/`frameHeight` = the trim/pad offsets for sprites packed with\n * transparent edges removed — optional, present only on trimmed atlases).\n */\nexport interface SubTexture {\n x: number;\n y: number;\n width: number;\n height: number;\n frameX?: number;\n frameY?: number;\n frameWidth?: number;\n frameHeight?: number;\n}\n\nexport const SubTextureSchema = z.object({\n x: z.number().nonnegative(),\n y: z.number().nonnegative(),\n width: z.number().positive(),\n height: z.number().positive(),\n frameX: z.number().optional(),\n frameY: z.number().optional(),\n frameWidth: z.number().positive().optional(),\n frameHeight: z.number().positive().optional(),\n});\n\n/**\n * A packed sheet + its named sub-rectangles — the canonical parse target for a\n * Kenney `Spritesheet/*.xml` atlas. A STATIC tile/prop/UI Asset references one\n * of these: `{ url: <sheet.png>, atlas: <this.json>, sprite: \"grass.png\" }` →\n * the renderer fetches the sheet + atlas ONCE and blits the named sub-rect,\n * instead of loading N individual PNGs. (Animated actors use `SpriteSheetAtlas`\n * instead; a uniform-grid tile page uses `Tilesheet`.)\n */\nexport interface TextureAtlas {\n /** Relative path to the sheet PNG the sub-rects index into (the atlas's own `imagePath`). */\n imagePath: string;\n /** Sub-rectangles keyed by their atlas name (e.g. `\"grass.png\"`). */\n subTextures: Record<string, SubTexture>;\n}\n\nexport const TextureAtlasSchema = z.object({\n imagePath: z.string(),\n subTextures: z.record(z.string(), SubTextureSchema),\n});\n\n// ============================================================================\n// Tilesheet — uniform-grid packed page (cut by index)\n// ============================================================================\n\n/**\n * A uniform-grid tile page — the shape a Kenney `Tilesheet/` sheet takes (e.g.\n * Pirate Pack: \"each tile is 64×64, no margin\"). Tiles are cut by `(col,row)`\n * index rather than by named rect. `names` is present only when a sibling\n * `.xml`/`.txt` supplies an index→name list; otherwise a tile is addressed by\n * its `\"col,row\"` (or flat index) via `Asset.sprite`.\n */\nexport interface Tilesheet {\n /** Relative path to the tile sheet PNG. */\n imagePath: string;\n /** Width of one tile cell in pixels. */\n tileWidth: number;\n /** Height of one tile cell in pixels. */\n tileHeight: number;\n /** Number of columns in the grid. */\n columns: number;\n /** Number of rows in the grid. */\n rows: number;\n /** Outer margin before the first tile, in pixels (default 0). */\n margin?: number;\n /** Gap between adjacent tiles, in pixels (default 0). */\n spacing?: number;\n /** Optional index→name labels when a descriptor supplies them. */\n names?: string[];\n}\n\nexport const TilesheetSchema = z.object({\n imagePath: z.string(),\n tileWidth: z.number().positive(),\n tileHeight: z.number().positive(),\n columns: z.number().int().positive(),\n rows: z.number().int().positive(),\n margin: z.number().nonnegative().optional(),\n spacing: z.number().nonnegative().optional(),\n names: z.array(z.string()).optional(),\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 type SemanticAssetRef = {\n /**\n * Entity role — a free string. Core no longer constrains the vocabulary to\n * `EntityRole` (that enum stays an exported shared reference for the asset\n * tool + renderer); genre boards may use their own roles (`boss`, `tower`, …).\n */\n role: string;\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 /** 2D sprite vs 3D model — the rendering dimension the consuming canvas needs. */\n dimension?: AssetDimension;\n /** Rendering aspect ratio (square sprite/portrait/tile, 16:9 backdrop, 5:7 card, 8:1 fx-strip). */\n aspect?: AssetAspect;\n};\n\nexport const SemanticAssetRefSchema = z.object({\n role: z.string().min(1),\n category: z.string().min(1),\n animations: z.array(z.string()).optional(),\n style: VisualStyleSchema.optional(),\n variant: z.string().optional(),\n dimension: AssetDimensionSchema.optional(),\n aspect: AssetAspectSchema.optional(),\n});\n\n// ============================================================================\n// Asset — the UNIFIED asset type\n// ============================================================================\n\n/**\n * The single asset type: a `SemanticAssetRef` (role/dimension/animations/aspect/style)\n * WITH its resolved URL folded in. Used everywhere an asset is referenced — a lolo\n * board `assetManifest` (`Map string Asset`), every `@almadar/ui` game prop, the\n * asset-workflow's resolved/pool assets, and the inspector picker. Replaces the bare\n * `AssetUrl`-string asset field so the render metadata travels WITH the asset (no\n * pixel-dimension or filename heuristics needed to know sheet-vs-frame / 2d-vs-3d).\n */\nexport interface Asset extends SemanticAssetRef {\n /** The resolved asset URL. When `atlas`/`sprite` are set this is the SHEET png; otherwise a standalone image. */\n url: AssetUrl;\n /**\n * Optional atlas JSON (a `TextureAtlas` or `Tilesheet`) that slices `url`.\n * When present with `sprite`, the renderer fetches sheet + atlas once and\n * blits one sub-rect instead of loading a standalone PNG. Absent → `url` is\n * a plain whole-image asset (the existing, non-atlas path).\n */\n atlas?: AssetUrl;\n /**\n * The sub-texture selector within `atlas`: a `SubTexture` name for a\n * `TextureAtlas` (e.g. `\"grass.png\"`), or a `\"col,row\"`/flat index for a\n * `Tilesheet`. Only meaningful alongside `atlas`.\n */\n sprite?: string;\n /** Optional display name (inspector picker). */\n name?: string;\n /** Optional thumbnail URL (inspector picker grid). */\n thumbnailUrl?: string;\n /** Authored generation subject (visualDNA) for asset-workflow regeneration. */\n prompt?: string;\n /** Authored per-animation frame choreography — the exact pose per frame, the only pose source for animated slots. */\n choreography?: Record<string, string[]>;\n /** Effect stage-table kind for an `effect` asset; absent → `burst`. */\n fxKind?: FxKind;\n}\n\nexport const AssetSchema = SemanticAssetRefSchema.extend({\n url: z.string(),\n atlas: z.string().optional(),\n sprite: z.string().optional(),\n name: z.string().optional(),\n thumbnailUrl: z.string().optional(),\n prompt: z.string().optional(),\n choreography: z.record(z.string(), z.array(z.string())).optional(),\n fxKind: FxKindSchema.optional(),\n});\n\n// ============================================================================\n// Asset Pack Manifest\n// ============================================================================\n\n/**\n * One board's asset pack, shipped as `assets.json` beside its `board.meta.json`.\n * The board declares `assetPack` (this `pack` id); asset generation writes ONLY\n * this file, never the board `.lolo`. `assets` is keyed `<group>/<name>`\n * (`units/guardian`, `ui/panel-frame`); each entry's `url` is relative to `base`.\n */\nexport interface AssetPackManifest {\n /** Pack id, `<brand>/<board>` (e.g. `kflow/ui-battle-board`). */\n pack: string;\n version: number;\n /** URL prefix every entry `url`/`atlas` is relative to. */\n base: string;\n assets: Record<string, Asset>;\n}\n\nexport const AssetPackManifestSchema = z.object({\n pack: z.string().min(1),\n version: z.number().int().nonnegative(),\n base: z.string(),\n assets: z.record(z.string(), AssetSchema),\n});\n\n// ============================================================================\n// Asset Catalog\n// ============================================================================\n\n/**\n * Single browsable asset in the inspector picker catalog.\n * Backs the asset/icon pickers — a flat list the inspector renders for\n * the user to choose from when a config field's type is `'asset'`.\n */\nexport interface AssetCatalogEntry {\n /** Resolvable URL to the asset. */\n url: string;\n /** Display name for the asset. */\n name: string;\n /** Grouping category within the catalog. */\n category: string;\n /** Asset kind the picker dispatches on. */\n kind: 'image' | 'spritesheet' | 'audio' | 'scene' | 'portrait' | 'model' | 'other';\n /** Optional thumbnail URL for grid previews. */\n thumbnailUrl?: string;\n /** 2D sprite vs 3D model — the asset's actual rendering dimension. */\n dimension?: AssetDimension;\n /** The asset's actual rendering aspect ratio. */\n aspect?: AssetAspect;\n}\n\nexport const AssetCatalogEntrySchema = z.object({\n url: z.string(),\n name: z.string(),\n category: z.string(),\n kind: z.enum(['image', 'spritesheet', 'audio', 'scene', 'portrait', 'model', 'other']),\n thumbnailUrl: z.string().optional(),\n dimension: AssetDimensionSchema.optional(),\n aspect: AssetAspectSchema.optional(),\n});\n\n/**\n * Flat list of browsable assets surfaced by the inspector pickers.\n */\nexport type AssetCatalog = AssetCatalogEntry[];\n\nexport const AssetCatalogSchema = z.array(AssetCatalogEntrySchema);\n\n/**\n * Asset-reference URL marker. A plain alias over `string` — the value is a\n * resolvable asset URL — but the named type lets the pattern-sync tool\n * (`tools/almadar-pattern-sync/parser.ts`) detect a component prop as an asset\n * field (tagged `asset`) the same way `EventKey`/`LucideIcon` are detected by\n * type identity. Components annotate image/url props as `AssetUrl` (`src`,\n * `backgroundImage`, `avatar`, …); the generator emits a `string` config knob\n * declared as the `asset` config type, which the property inspector dispatches\n * an AssetPicker on. Not branded — asset urls originate from user data, so cast\n * friction would buy nothing; the value is the marker the tool finds.\n */\nexport type AssetUrl = string;\n\n// ============================================================================\n// ScenePos — neutral scene coordinate\n// ============================================================================\n\n/**\n * A neutral position in scene space: 2D (`x`,`y`) or optionally 3D (`x`,`y`,`z`).\n * The single coordinate type shared by every drawable descriptor and camera pose\n * across the 2D and 3D canvas hosts, so a scene composes from the same `{x,y,z?}`\n * regardless of projection or painter. Logical, not pixel — the host's projector\n * maps a `ScenePos` to screen space.\n */\nexport interface ScenePos {\n x: number;\n y: number;\n z?: number;\n}\n\nexport const ScenePosSchema = z.object({\n x: z.number(),\n y: z.number(),\n z: z.number().optional(),\n});\n\n// ============================================================================\n// Camera — neutral camera pose shared by the 2D and 3D canvas hosts\n// ============================================================================\n\n/**\n * Camera behaviors, unifying the former per-host vocab (2D `camera` string +\n * 3D `cameraMode`). `isometric`/`top-down`/`front` are fixed framings (`front` =\n * the straight-on flat elevation — side-scroller / reference-sheet view);\n * `follow`/`chase` track a target; `perspective` is the 3D dramatic framing.\n */\nexport const CAMERA_MODES = ['isometric', 'perspective', 'top-down', 'front', 'follow', 'chase'] as const;\n\nexport type CameraMode = (typeof CAMERA_MODES)[number];\n\nexport const CameraModeSchema = z.enum(CAMERA_MODES);\n\n/**\n * A neutral camera pose shared by the 2D and 3D canvas hosts, so `type: canvas`\n * carries one camera object regardless of painter. `pos`/`target` are `ScenePos`\n * (logical scene space, not pixels); `zoom` scales the view (the former `scale`);\n * `fov` is the 3D field of view; `mode` selects the framing/tracking behavior.\n * Every field is optional — an omitted camera means the host's default framing.\n */\nexport interface Camera {\n pos?: ScenePos;\n target?: ScenePos;\n zoom?: number;\n fov?: number;\n mode?: CameraMode;\n /** Orbit the mode's framing position around the vertical axis through the target, in radians (3D hosts only). */\n azimuth?: number;\n /** Orbit height angle above the ground plane, in radians (3D hosts only). */\n elevation?: number;\n /** Whether the viewer may orbit, pan or zoom the camera. `false` holds the authored framing: a decorative backdrop the page scrolls through. Default true. */\n controls?: boolean;\n}\n\nexport const CameraSchema = z.object({\n pos: ScenePosSchema.optional(),\n target: ScenePosSchema.optional(),\n zoom: z.number().optional(),\n fov: z.number().optional(),\n mode: CameraModeSchema.optional(),\n azimuth: z.number().optional(),\n elevation: z.number().optional(),\n controls: z.boolean().optional(),\n});\n\n// ============================================================================\n// Type Exports\n// ============================================================================\n\nexport type SemanticAssetRefInput = z.input<typeof SemanticAssetRefSchema>;\nexport type AnimationDefInput = z.input<typeof AnimationDefSchema>;\nexport type AssetCatalogEntryInput = z.input<typeof AssetCatalogEntrySchema>;\nexport type SpriteSheetAtlasInput = z.input<typeof SpriteSheetAtlasSchema>;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Creates a semantic asset key from role and category.\n * \n * Generates a unique asset identifier by combining role and category\n * with a colon separator. Used for asset management and lookup.\n * \n * @param {EntityRole} role - Entity role (e.g., 'player', 'enemy')\n * @param {string} category - Asset category (e.g., 'sprite', 'animation')\n * @returns {string} Asset key in format 'role:category'\n * \n * @example\n * createAssetKey('player', 'sprite'); // returns 'player:sprite'\n * createAssetKey('enemy', 'animation'); // returns 'enemy:animation'\n */\nexport function createAssetKey(role: EntityRole, category: string): string {\n return `${role}:${category}`;\n}\n\n/**\n * Parses an asset key into role and category components.\n * \n * Deconstructs an asset key string (format 'role:category') into its\n * constituent parts. Returns null if the key format is invalid.\n * \n * @param {string} key - Asset key in format 'role:category'\n * @returns {{ role: string; category: string } | null} Parsed components or null\n * \n * @example\n * parseAssetKey('player:sprite'); // returns { role: 'player', category: 'sprite' }\n * parseAssetKey('enemy:animation'); // returns { role: 'enemy', category: 'animation' }\n * parseAssetKey('invalid'); // returns null\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 * Gets common animations for an entity role.\n * \n * Returns an array of default animation names appropriate for the\n * specified entity role. Used for asset configuration and validation.\n * \n * @param {EntityRole} role - Entity role\n * @returns {string[]} Array of default animation names\n * \n * @example\n * getDefaultAnimationsForRole('player'); // returns ['idle', 'run', 'jump', 'fall', 'attack', 'hurt', 'die']\n * getDefaultAnimationsForRole('enemy'); // returns ['idle', 'walk', 'attack', 'hurt', 'die']\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 * Validates that an asset reference has required animations.\n * \n * Checks if an asset reference contains all required animations.\n * Returns an error message if validation fails, or null if valid.\n * \n * @param {SemanticAssetRef} assetRef - Asset reference to validate\n * @param {string[]} requiredAnimations - Required animation names\n * @returns {string | null} Error message or null if valid\n * \n * @example\n * validateAssetAnimations(assetRef, ['idle', 'run']); // returns null if valid\n * validateAssetAnimations(assetRef, ['missing-animation']); // returns error message\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// ============================================================================\n// Sprite Sheet Layout — the canonical unit sheet convention (owner-approved\n// \"Sheet convergence\": 8 cols x 5 rows @ 256px, dark charcoal background).\n// `tools/asset-workflow`'s `spritesheet-bake.ts` (SPRITE_LAYOUT) and\n// `prompt-composer.ts` derive from this; this is the single source.\n// ============================================================================\n\nexport const SPRITE_SHEET_LAYOUT = {\n frameWidth: 256,\n frameHeight: 256,\n columns: 8,\n rows: 5,\n background: '#20202E',\n} as const;\n\nexport type SpriteSheetLayout = typeof SPRITE_SHEET_LAYOUT;\n\n/**\n * The canonical unit animation row table (idle/walk/attack/hit/death), one\n * row per `AnimationName`, in sheet-row order. Mirrors\n * `tools/asset-workflow/src/spritesheet-bake.ts`'s `SPRITE_LAYOUT`.\n */\nexport const DEFAULT_UNIT_ANIMATION_ROWS: ReadonlyArray<{ name: AnimationName } & AnimationDef> = [\n { name: 'idle', row: 0, frames: 4, loop: true, frameRate: 6 },\n { name: 'walk', row: 1, frames: 8, loop: true, frameRate: 10 },\n { name: 'attack', row: 2, frames: 6, loop: false, frameRate: 12 },\n { name: 'hit', row: 3, frames: 3, loop: false, frameRate: 8 },\n { name: 'death', row: 4, frames: 6, loop: false, frameRate: 8 },\n] as const;\n\n/**\n * Builds the canonical unit `SpriteSheetAtlas` from `SPRITE_SHEET_LAYOUT` +\n * `DEFAULT_UNIT_ANIMATION_ROWS` for a given set of direction sheets. Directions\n * default to whichever keys `sheets` actually carries (legacy se/sw-only packs\n * included), or the caller can force a specific set via `opts.directions`.\n */\nexport function defaultUnitAtlas(\n sheets: SpriteSheetAtlas['sheets'],\n opts?: { directions?: SpriteDirection[] }\n): SpriteSheetAtlas {\n const directions = opts?.directions ?? SPRITE_DIRECTIONS.filter((direction) => sheets[direction] !== undefined);\n const animations: Partial<Record<string, AnimationDef>> = {};\n for (const { name, ...def } of DEFAULT_UNIT_ANIMATION_ROWS) {\n animations[name] = def;\n }\n return {\n frameWidth: SPRITE_SHEET_LAYOUT.frameWidth,\n frameHeight: SPRITE_SHEET_LAYOUT.frameHeight,\n columns: SPRITE_SHEET_LAYOUT.columns,\n rows: SPRITE_SHEET_LAYOUT.rows,\n directions,\n sheets,\n animations,\n };\n}\n\n// ============================================================================\n// Manifest Entry — the kflow-assets `manifest.json` row shape. Core is the\n// owner; `tools/asset-workflow`'s `ExtendedManifestEntry` converges onto this\n// (mirrors `tools/asset-workflow/src/asset-schema.ts`'s `CanvasAffinity`,\n// `FrameSpec`, `AssetLicense`, `SourceCatalog` literal unions).\n// ============================================================================\n\nexport const MANIFEST_ENTRY_KINDS = ['model', 'image', 'spritesheet', 'audio', 'json'] as const;\n\nexport type ManifestEntryKind = (typeof MANIFEST_ENTRY_KINDS)[number];\n\nexport const ManifestEntryKindSchema = z.enum(MANIFEST_ENTRY_KINDS);\n\n// ============================================================================\n// Game audio\n// ============================================================================\n\n/**\n * One entry of a game's sound manifest, keyed by logical cue name. Core owns\n * the shape so both the render substrate (`useGameAudio` / the `game-audio-cue`\n * pattern) and the generated `.lolo` factories resolve the SAME declaration —\n * a hook-local interface is invisible to the pattern extractor and lowers to a\n * shapeless `object`, which the `.lolo` type system rejects outright.\n */\nexport interface SoundEntry {\n /** Single path, or several to pick from at random on each play. */\n path: string | string[];\n /** Volume 0-1, multiplied by the master volume. */\n volume?: number;\n /** Whether this sound loops (background music). */\n loop?: boolean;\n /** Concurrent Audio instances kept in the pool. */\n poolSize?: number;\n /** Start automatically on the first user interaction. */\n autostart?: boolean;\n /** Use crossfade transitions when played as music. */\n crossfade?: boolean;\n /** Crossfade duration in milliseconds. */\n crossfadeDurationMs?: number;\n}\n\nexport const SoundEntrySchema = z.object({\n path: z.union([z.string(), z.array(z.string())]),\n volume: z.number().optional(),\n loop: z.boolean().optional(),\n poolSize: z.number().optional(),\n autostart: z.boolean().optional(),\n crossfade: z.boolean().optional(),\n crossfadeDurationMs: z.number().optional(),\n});\n\n/** A game's sound manifest: logical cue name → its definition. */\nexport type AudioManifest = Record<string, SoundEntry>;\n\nexport const AudioManifestSchema = z.record(z.string(), SoundEntrySchema);\n\nexport const MANIFEST_CANVAS_AFFINITIES = ['isometric', 'hex', 'flat', 'side', '3d', 'none'] as const;\n\nexport type ManifestCanvasAffinity = (typeof MANIFEST_CANVAS_AFFINITIES)[number];\n\nexport const ManifestCanvasAffinitySchema = z.enum(MANIFEST_CANVAS_AFFINITIES);\n\nexport const MANIFEST_SOURCE_CATALOGS = ['kenny', 'kekec-assets', 'iram-assets', 'trait-wars-assets', 'kflow-assets'] as const;\n\nexport type ManifestSourceCatalog = (typeof MANIFEST_SOURCE_CATALOGS)[number];\n\nexport const ManifestSourceCatalogSchema = z.enum(MANIFEST_SOURCE_CATALOGS);\n\nexport const MANIFEST_ASSET_LICENSES = ['CC0', 'proprietary'] as const;\n\nexport type ManifestAssetLicense = (typeof MANIFEST_ASSET_LICENSES)[number];\n\nexport const ManifestAssetLicenseSchema = z.enum(MANIFEST_ASSET_LICENSES);\n\n/**\n * Path of the sheet's `atlas.json` relative to the pack's `shared/` root\n * (`riya-platformer/units/riya/atlas.json`) — the executable frame truth for\n * unit sheets whose rows are not uniform.\n */\nexport type ManifestAtlasRef = string;\n\n/** Tile/sprite-sheet frame layout for a manifest row, an atlas reference, else `null`. */\nexport type ManifestFrameSpec =\n | { kind: 'iso-tile'; w: number; h: number }\n | { kind: 'sprite-sheet'; frame: number; cols: number; rows: number }\n | ManifestAtlasRef\n | null;\n\nexport const ManifestFrameSpecSchema = z.union([\n z.object({ kind: z.literal('iso-tile'), w: z.number(), h: z.number() }),\n z.object({ kind: z.literal('sprite-sheet'), frame: z.number(), cols: z.number(), rows: z.number() }),\n z.string().min(1),\n z.null(),\n]);\n\n/**\n * One row of `almadar-assets/kflow-assets/manifest.json`. Core owns this\n * shape; `tools/asset-workflow`'s `ExtendedManifestEntry` converges onto it.\n */\nexport interface ManifestEntry {\n url: string;\n name: string;\n category: string;\n kind: ManifestEntryKind;\n width: number;\n height: number;\n canvasAffinity: ManifestCanvasAffinity;\n genreAffinity: string[];\n swapClass: string;\n sourceCatalog: ManifestSourceCatalog;\n frameSpec: ManifestFrameSpec;\n /** Provenance-extended field: present on the promote/register path only. */\n license?: ManifestAssetLicense;\n}\n\nexport const ManifestEntrySchema = z.object({\n url: z.string(),\n name: z.string(),\n category: z.string(),\n kind: ManifestEntryKindSchema,\n width: z.number(),\n height: z.number(),\n canvasAffinity: ManifestCanvasAffinitySchema,\n genreAffinity: z.array(z.string()),\n swapClass: z.string(),\n sourceCatalog: ManifestSourceCatalogSchema,\n frameSpec: ManifestFrameSpecSchema,\n license: ManifestAssetLicenseSchema.optional(),\n});\n\nexport type ManifestEntryInput = z.input<typeof ManifestEntrySchema>;\n\n// ============================================================================\n// Manifest -> Asset Catalog adapter\n// ============================================================================\n\nconst ASSET_CATALOG_ENTRY_KINDS: readonly AssetCatalogEntry['kind'][] = [\n 'image',\n 'spritesheet',\n 'audio',\n 'scene',\n 'portrait',\n 'model',\n 'other',\n];\n\nconst MODEL_URL_EXTENSIONS = ['.glb', '.gltf'];\nconst AUDIO_URL_EXTENSIONS = ['.mp3', '.ogg', '.wav'];\n\nfunction urlEndsWithAny(url: string, extensions: readonly string[]): boolean {\n const lower = url.toLowerCase();\n return extensions.some((extension) => lower.endsWith(extension));\n}\n\n/**\n * Declared, order-sensitive rule for deriving the catalog `kind` from a\n * manifest row: `frameSpec`/`kind==='spritesheet'` beats extension, which\n * beats the manifest's own `kind`. No filename-keyword guessing.\n */\nfunction deriveManifestAssetKind(entry: ManifestEntry): AssetCatalogEntry['kind'] {\n if (typeof entry.frameSpec === 'string' || entry.frameSpec?.kind === 'sprite-sheet' || entry.kind === 'spritesheet') return 'spritesheet';\n if (entry.kind === 'model' || urlEndsWithAny(entry.url, MODEL_URL_EXTENSIONS)) return 'model';\n if (entry.kind === 'audio' || urlEndsWithAny(entry.url, AUDIO_URL_EXTENSIONS)) return 'audio';\n if (entry.kind === 'image') return 'image';\n return 'other';\n}\n\nfunction parseAssetAspectRatio(aspect: AssetAspect): number {\n const [w, h] = aspect.split(':').map(Number);\n return w / h;\n}\n\nconst ASSET_ASPECT_RATIO_TOLERANCE = 0.01;\n\n/**\n * The asset's aspect only when width/height are both known (> 0) and their\n * ratio matches exactly one `ASSET_ASPECTS` entry within 1%; otherwise\n * omitted (never guessed).\n */\nfunction deriveManifestAssetAspect(width: number, height: number): AssetAspect | undefined {\n if (width <= 0 || height <= 0) return undefined;\n const ratio = width / height;\n for (const aspect of ASSET_ASPECTS) {\n const expected = parseAssetAspectRatio(aspect);\n if (Math.abs(ratio / expected - 1) <= ASSET_ASPECT_RATIO_TOLERANCE) return aspect;\n }\n return undefined;\n}\n\nconst ABSOLUTE_URL_PATTERN = /^[a-z][a-z0-9+.-]*:\\/\\//i;\n\n/** Prefixes a relative manifest url with `cdnPrefix`; leaves an absolute url untouched. */\nfunction resolveManifestUrl(url: string, cdnPrefix?: string): string {\n if (!cdnPrefix || ABSOLUTE_URL_PATTERN.test(url)) return url;\n const prefix = cdnPrefix.endsWith('/') ? cdnPrefix : `${cdnPrefix}/`;\n const rest = url.startsWith('/') ? url.slice(1) : url;\n return `${prefix}${rest}`;\n}\n\n/**\n * Adapts kflow-assets manifest rows into the inspector picker's\n * `AssetCatalog`. The ONE deterministic derivation the Kura assets server\n * route (`GET /api/assets/catalog`) and any other manifest consumer share.\n */\nexport function manifestToAssetCatalog(entries: ReadonlyArray<ManifestEntry>, opts?: { cdnPrefix?: string }): AssetCatalog {\n return entries.map((entry) => {\n const kind = deriveManifestAssetKind(entry);\n const dimension: AssetDimension = entry.canvasAffinity === '3d' ? '3d' : '2d';\n const aspect = deriveManifestAssetAspect(entry.width, entry.height);\n const url = resolveManifestUrl(entry.url, opts?.cdnPrefix);\n const catalogEntry: AssetCatalogEntry = {\n url,\n name: entry.name,\n category: entry.category,\n kind,\n dimension,\n };\n if (aspect !== undefined) catalogEntry.aspect = aspect;\n if (kind === 'image' || kind === 'spritesheet') catalogEntry.thumbnailUrl = url;\n return catalogEntry;\n });\n}\n\n// ============================================================================\n// Asset query grammar — Unity-style `t:<kind>` / `l:<label>` + free text.\n// The ONE grammar `parseAssetQuery`/`matchAssetQuery` implement; every\n// consumer (the Kura assets server route, the client's `asset-query.ts`)\n// imports these instead of re-parsing.\n// ============================================================================\n\nconst ASSET_QUERY_TYPE_PREFIX = 't:';\nconst ASSET_QUERY_LABEL_PREFIX = 'l:';\n\nfunction isAssetCatalogEntryKind(value: string): value is AssetCatalogEntry['kind'] {\n return ASSET_CATALOG_ENTRY_KINDS.some((kind) => kind === value);\n}\n\ninterface ParsedAssetQuery {\n text: string;\n kind?: AssetCatalogEntry['kind'];\n labels: string[];\n /** A `t:` token whose value is not a known `AssetCatalogEntry['kind']` — the query matches nothing. */\n unknownKind: boolean;\n}\n\nfunction parseAssetQueryTokens(q: string): ParsedAssetQuery {\n const tokens = q.trim().length > 0 ? q.trim().split(/\\s+/) : [];\n const textParts: string[] = [];\n const labels: string[] = [];\n let kind: AssetCatalogEntry['kind'] | undefined;\n let unknownKind = false;\n for (const token of tokens) {\n if (token.startsWith(ASSET_QUERY_TYPE_PREFIX)) {\n const value = token.slice(ASSET_QUERY_TYPE_PREFIX.length);\n if (isAssetCatalogEntryKind(value)) kind = value;\n else unknownKind = true;\n } else if (token.startsWith(ASSET_QUERY_LABEL_PREFIX)) {\n const value = token.slice(ASSET_QUERY_LABEL_PREFIX.length);\n if (value.length > 0) labels.push(value);\n } else {\n textParts.push(token);\n }\n }\n return { text: textParts.join(' '), kind, labels, unknownKind };\n}\n\n/**\n * Parses a `t:<kind>` / `l:<label>` / free-text asset search query. An\n * unrecognized `t:` value is dropped from the returned `kind` (there is no\n * value of `AssetCatalogEntry['kind']` to report) — `matchAssetQuery`, which\n * shares this same tokenizer internally, is the authority that turns it into\n * \"matches nothing\".\n */\nexport function parseAssetQuery(q: string): { text: string; kind?: AssetCatalogEntry['kind']; labels: string[] } {\n const parsed = parseAssetQueryTokens(q);\n return parsed.kind === undefined ? { text: parsed.text, labels: parsed.labels } : { text: parsed.text, kind: parsed.kind, labels: parsed.labels };\n}\n\n/**\n * Matches one catalog entry against a `t:`/`l:`/free-text query. `l:` labels\n * are ANDed against `entry.category` (exact, case-insensitive); free text is\n * an ANDed case-insensitive substring over `name`+`category`. An unrecognized\n * `t:` kind matches nothing.\n */\nexport function matchAssetQuery(entry: AssetCatalogEntry, q: string): boolean {\n const parsed = parseAssetQueryTokens(q);\n if (parsed.unknownKind) return false;\n if (parsed.kind !== undefined && entry.kind !== parsed.kind) return false;\n for (const label of parsed.labels) {\n if (entry.category.toLowerCase() !== label.toLowerCase()) return false;\n }\n if (parsed.text.length > 0) {\n const haystack = `${entry.name} ${entry.category}`.toLowerCase();\n if (!haystack.includes(parsed.text.toLowerCase())) return false;\n }\n return true;\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 { EntityIdSchema } from './identity.js';\nimport type { EntityId } from './identity.js';\nimport { EntityFieldSchema, type EntityField, type FileValue } from './field.js';\nimport { SemanticAssetRefSchema, type SemanticAssetRef } from './asset.js';\nimport { JsonValueSchema, type JsonValue, type RuntimeValue } from './json.js';\nimport { SExprListSchema, SExprSchema, type SExpr } from './expression.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 */\nexport type EntityPersistence = 'persistent' | 'runtime';\n\nexport const EntityPersistenceSchema = z.enum([\n 'persistent',\n 'runtime',\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 type OrbitalEntity = {\n /** V4 dual-carry id sibling of `name` — optional until the Phase-7 flip. */\n id?: EntityId;\n\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 /** Whether this entity's state is shared across all bound traits (vs per-trait copy). Orthogonal to persistence. */\n shared?: boolean;\n\n /**\n * Whether this entity types the ambient `@user` viewer. Orthogonal to both\n * `persistence` and `shared`: `[persistent: people, identity]` is an\n * app-owned user directory, `[runtime, identity]` the provider-supplied\n * current viewer. At most one per composed program.\n */\n identity?: boolean;\n\n /**\n * `[persistent: x, browser]` — the rows live in the browser (IndexedDB), so\n * `fetch`/`persist` on this entity run client-side on both paths. Orthogonal\n * like `shared`; meaningful only on a persistent entity.\n */\n browser?: boolean;\n\n /**\n * `[store: Driver]` — the store-driver orbital that answers this entity's row\n * asks (EXEC-STORE-4); wins over the app's `store`.\n */\n store?: string;\n\n /**\n * `@read` — a per-row predicate (`@entity` = candidate row, `@user` =\n * viewer) ANDed with any call-site `filter:`. The un-bypassable twin of\n * `filter:`, enforced once for every trait that fetches this entity.\n */\n read_policy?: SExpr;\n\n /** `@create` — `@entity` binds the incoming data about to become a row. */\n create_policy?: SExpr;\n\n /** `@update` — `@entity` binds the existing row before mutation. */\n update_policy?: SExpr;\n\n /** `@delete` — same binding shape as `@update`. */\n delete_policy?: SExpr;\n\n /**\n * `@<op> none \"<reason>\"` — a directive's omission, DECLARED.\n *\n * Runtime behaviour is identical to leaving the directive out (an absent\n * policy is allow-all). It records that the author concluded no per-row\n * predicate can express the rule — usually because visibility depends on a\n * DIFFERENT entity, which a per-row predicate cannot join across. Without\n * it a lint must flag considered and forgotten omissions alike, and a lint\n * that flags correct code is one people learn to ignore.\n */\n access_waivers?: {\n read?: string;\n create?: string;\n update?: string;\n delete?: string;\n };\n\n /** `@invariant <expr>`: every stored row satisfies each, proved by `orb validate` over the program's writes. No runtime effect. */\n invariants?: SExpr[];\n\n /** `@index { fields, orderBy? }`: declared access paths. A path changes a query's cost, never its result. */\n indexes?: { fields: string[]; orderBy?: string }[];\n\n /** Collection name (auto-derived if not provided for persistent entities) */\n collection?: string;\n\n /** Entity fields */\n fields: EntityField[];\n\n /** Pre-authored instances (seed data or static reference data) */\n instances?: EntityRow[];\n\n /**\n * A browser-stored entity's first rows per locale (`instances ar [ … ]`),\n * keyed by a declared locale; a locale with no block takes `instances`.\n */\n localeInstances?: Record<string, EntityRow[]>;\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 // V4 arena id (`EntityDefinition.id`); declared so the strip-mode zod gate\n // carries an imported entity's id through instead of erasing it.\n id: EntityIdSchema.optional(),\n persistence: EntityPersistenceSchema.default('persistent'),\n shared: z.boolean().optional(),\n // Must stay in step with the Rust serde field (`EntityDefinition.identity`,\n // orbital-core/src/schema/types.rs). `z.object()` STRIPS unknown keys rather\n // than rejecting them, so a Rust-only field works on the compiled path and\n // silently vanishes on the interpreter path.\n identity: z.boolean().optional(),\n // Rust twin: `EntityDefinition.browser`.\n browser: z.boolean().optional(),\n // Rust twin: `EntityDefinition.store`.\n store: z.string().min(1).optional(),\n // Same \"must stay in step with Rust serde\" hazard as `identity` above —\n // these four mirror `EntityDefinition.{read,create,update,delete}_policy`.\n // Rust has no `rename_all` on this struct, so the wire key IS snake_case\n // (unlike this file's other camelCase fields, which are Rust-side-absent\n // and so never hit this cross-language constraint — see `visual_prompt`\n // just below for the existing precedent).\n read_policy: SExprSchema.optional(),\n create_policy: SExprSchema.optional(),\n update_policy: SExprSchema.optional(),\n delete_policy: SExprSchema.optional(),\n // Snake_case for the same cross-language reason as the four policies above.\n access_waivers: z\n .object({\n read: z.string().optional(),\n create: z.string().optional(),\n update: z.string().optional(),\n delete: z.string().optional(),\n })\n .optional(),\n invariants: SExprListSchema.optional(),\n indexes: z.array(z.object({ fields: z.array(z.string()), orderBy: z.string().optional() }).strict()).optional(),\n collection: z.string().optional(),\n fields: z.array(EntityFieldSchema),\n instances: z.array(z.record(z.string(), JsonValueSchema)).optional(),\n localeInstances: z.record(z.string(), z.array(z.record(z.string(), JsonValueSchema))).optional(),\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/** The rows an entity starts with for a viewer's locale: its locale block, else `instances`. */\nexport function instancesForLocale(entity: Pick<OrbitalEntity, 'instances' | 'localeInstances'>, locale: string | undefined): EntityRow[] {\n const localized = locale !== undefined ? entity.localeInstances?.[locale] : undefined;\n return localized ?? entity.instances ?? [];\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Checks if an entity is runtime-only (not persisted).\n * \n * Type guard to determine if an entity exists only at runtime\n * and is not stored in the database.\n * \n * @param {OrbitalEntity} entity - Entity to check\n * @returns {boolean} True if entity is runtime-only, false otherwise\n * \n * @example\n * isRuntimeEntity({ persistence: 'runtime' }); // returns true\n * isRuntimeEntity({ persistence: 'persistent' }); // returns false\n */\nexport function isRuntimeEntity(entity: OrbitalEntity): boolean {\n return entity.persistence === 'runtime';\n}\n\n/**\n * Whether an entity's rows live in the client: `[runtime]` (in memory) or\n * `[persistent: x, browser]` (the browser's IndexedDB). Data effects on such an\n * entity run in the client. Twin of Rust `EntityDefinition::is_client_resident`.\n */\nexport function isClientResident(entity: Pick<OrbitalEntity, 'persistence' | 'browser'>): boolean {\n return entity.persistence === 'runtime' || entity.browser === true;\n}\n\n/**\n * Whether an entity's ROWS live in the browser (`[persistent: x, browser]`), so\n * `fetch`/`persist` on it run client-side. A `[runtime]` entity's rows stay in\n * the server's per-session store. Twin of Rust `Residence` (`effects/runs_on.rs`).\n */\nexport function storesRowsInBrowser(entity: Pick<OrbitalEntity, 'browser'>): boolean {\n return entity.browser === true;\n}\n\n/**\n * Checks whether an entity's persistence mode allows `persistence` /\n * `collection` overrides at the factory call site.\n *\n * Only `persistent` entities (explicit or default) support these overrides.\n * Runtime entities are fixed; callers must not expose `persistence` or\n * `collection` params for them.\n *\n * @param persistence - The entity persistence mode (undefined = default persistent)\n * @returns True when overrides are allowed, false otherwise\n *\n * @example\n * persistenceModeAllowsOverrides('persistent'); // returns true\n * persistenceModeAllowsOverrides('runtime'); // returns false\n * persistenceModeAllowsOverrides(undefined); // returns true (default persistent)\n */\nexport function persistenceModeAllowsOverrides(\n persistence: EntityPersistence | undefined,\n dataBearing = false,\n): boolean {\n // A runtime record a data atom fetches or persists may be saved; other runtime state may not.\n return persistence === 'persistent' || persistence === undefined || (persistence === 'runtime' && dataBearing);\n}\n\n// ============================================================================\n// Entity Instance Data (Runtime)\n// ============================================================================\n\n/**\n * A single field value at runtime: a JSON value. A date is its ISO string, an absent field is an absent key;\n * `Date` and `undefined` never travel on the wire, so neither is a field value.\n */\nexport type FieldValue = JsonValue;\n\n/** Zod twin of `FieldValue` — the one runtime validator for a stored field slot. */\nexport const FieldValueSchema: z.ZodType<FieldValue> = JsonValueSchema;\n\n/**\n * What a FORM CONTROL puts on the event bus — the closed set of shapes an\n * Input / Select / Checkbox / Date / multi-select / file field actually\n * produces.\n *\n * A TRANSPORT type, deliberately distinct from `FieldValue`, and the separation\n * is the point. `FieldValue` conflated two jobs: what a control emits, and what\n * an entity field holds. The second never needed it — an entity field always\n * has one declared type (`email : email!`, `age : number`) — so the openness\n * only travelled outward, degrading every generated `.lolo` payload to a\n * shapeless `object`.\n *\n * NOT recursive, and the variants are enumerated from what is actually emitted\n * rather than guessed. `FileValue` is here because the compiler put it here: a\n * scalar-only draft failed against the file field, which hands\n * `Form.handleChange` a `{ name, url, mimeType, sizeBytes }` record.\n *\n * The rule is Aeson's — enumerate the shapes that occur, keep the open type at\n * the boundary, convert on the way in. In `.lolo` that boundary is the\n * `(set @entity.X ?value)` of the receiving transition, where the entity\n * field's own declared type does the checking.\n */\nexport type ControlValue = string | number | boolean | null | string[] | FileValue;\n\n/**\n * Runtime guard for `FieldValue` — narrows interpreter-produced `unknown`\n * values at typed substrate boundaries (e.g. sampled values).\n */\nexport function isFieldValue(value: RuntimeValue): value is FieldValue {\n if (value === null) return true;\n const kind = typeof value;\n if (kind === 'string' || kind === 'number' || kind === 'boolean') return true;\n if (Array.isArray(value)) return value.every((item: RuntimeValue) => isFieldValue(item));\n if (kind === 'object' && typeof value === 'object' && !(value instanceof Date)) {\n return Object.values(value).every((item: RuntimeValue) => isFieldValue(item));\n }\n return false;\n}\n\n/**\n * One instance of an entity with actual field values.\n * The shape is determined by the Entity definition at schema time.\n *\n * @example\n * // Entity defines: Patient { fullName: string, age: number, active: boolean }\n * // EntityRow is: { id: \"p1\", fullName: \"Sarah\", age: 34, active: true }\n */\nexport type EntityRow = { id?: string } & Record<string, FieldValue>;\n\n/** Zod twin of `EntityRow` — the one runtime validator for an `@entity` wire row. */\nexport const EntityRowSchema: z.ZodType<EntityRow> = z\n .object({ id: z.string().optional() })\n .catchall(FieldValueSchema);\n\n/**\n * A field-TYPED `EntityRow` — the SINGLE entity type, refined with a concrete\n * field SHAPE `S`. Non-optional members of `S` are REQUIRED, each with its real\n * type; the result stays `& EntityRow`, so the index signature is intact and\n * every other field is still field-open — any domain entity that provides those\n * fields satisfies it.\n *\n * One declaration, two jobs: (1) TypeScript enforces the bound entity has the\n * fields WITH their types (a behavior binding a thinner/mistyped entity fails to\n * typecheck); and (2) pattern-sync reads the same type and writes the entity\n * prop's field shape (`properties` + `requiredFields`) onto the registry, so\n * lolo-ui emits a COMPLETE `entity { … }` (every field, typed + demo-seeded) and\n * the `ORB_X_ENTITY_PROP_CONTRACT` validator rejects an incompatible bind at\n * `orbital validate`. (A raw `EntityRow & { rating: number }` intersection is\n * equivalent for one-off shapes.)\n *\n * @example\n * // HeroOrganism renders entity.title / entity.subtitle:\n * entity?: EntityWith<{ title: string; subtitle?: string }>;\n * // entity.title → string (required)\n * // entity.subtitle → string | undefined (optional)\n * // entity.other → FieldValue | undefined (still field-open)\n */\n// `S extends object` (not `Record<string, FieldValue>`) so a plain `interface`\n// row shape satisfies it — interfaces lack the implicit index signature `Record`\n// requires. FieldValue-compatibility is still enforced structurally: `& EntityRow`\n// intersects every field with the `FieldValue | undefined` index signature, so a\n// non-FieldValue field (e.g. a React `LucideIcon`) collapses to `never` at use.\nexport type EntityWith<S extends object> = EntityRow & S;\n\n/**\n * Collection of entity instances keyed by entity name.\n * Used by OrbPreview mockData, OrbitalServerRuntime state, data grids, etc.\n *\n * @example\n * const data: EntityData = {\n * Patient: [{ id: \"1\", fullName: \"Sarah\", age: 34 }],\n * QueueEntry: [{ id: \"1\", patientName: \"Sarah\", waitMinutes: 12 }],\n * };\n */\nexport type EntityData = Record<string, EntityRow[]>;\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, type Expression, type EventPayload, SExprDataSchema } from './expression.js';\nimport type { RuntimeValue, JsonValue, JsonObject } from './json.js';\nimport { type ServiceParams } from './service.js';\nimport { type EntityRow, type FieldValue } from './entity.js';\n\n// ============================================================================\n// UI Slots\n// ============================================================================\n\n/**\n * Known UI slots where content can be rendered\n */\nexport const UI_SLOTS = [\n // App slots\n 'main',\n 'sidebar',\n 'dock', // Right inline panel that pushes main (narrow screens: a drawer)\n 'modal',\n 'drawer',\n 'overlay',\n 'center',\n 'toast',\n 'floating',\n 'system', // For invisible system components (InputListener, CollisionDetector)\n 'content',\n 'screen',\n // Game HUD slots\n 'hud',\n 'hud-top',\n 'hud-bottom',\n 'hud.health',\n 'hud.score',\n 'hud.inventory',\n 'hud.stamina',\n // Game overlay slots\n 'overlay.inventory',\n 'overlay.dialogue',\n 'overlay.menu',\n 'overlay.pause',\n] as const;\n\nexport type UISlot = (typeof UI_SLOTS)[number];\n\n/** The slots a renderer mounts as `#slot-{name}`: every slot except the HUD group key, the `screen` alias and dotted sub-slots. */\nexport const RENDERED_SLOTS: readonly UISlot[] = UI_SLOTS.filter(\n (slot) => !slot.includes('.') && slot !== 'hud' && slot !== 'screen',\n);\n\nexport const UISlotSchema = z.enum(UI_SLOTS);\n\n// ============================================================================\n// Pattern Config (for render-ui effects)\n// ============================================================================\n\n// Import pattern types for local use and re-export for consumers\nimport type {\n PatternType,\n PatternConfig,\n PatternProps,\n PatternPropsMap,\n AnyPatternConfig,\n} from '../patterns/index.js';\n\n/**\n * Type-safe pattern configuration for render-ui effects.\n *\n * Re-exported from @almadar/patterns. Generated from patterns-registry.json.\n *\n * @example\n * // Type-safe with specific pattern type\n * const config: PatternConfig<'table-view'> = {\n * patternType: 'table-view',\n * columns: [{ key: 'name', header: 'Name' }], // ✅ Required prop\n * entity: 'User',\n * };\n *\n * // Error: Property 'columns' is missing (required prop)\n * const bad: PatternConfig<'table-view'> = { patternType: 'table-view' };\n *\n * // Error: 'fake-pattern' is not assignable to PatternType\n * const invalid: PatternConfig = { patternType: 'fake-pattern' };\n */\nexport type {\n PatternType,\n PatternConfig,\n PatternProps,\n PatternPropsMap,\n AnyPatternConfig,\n};\n\n// ============================================================================\n// Service Config (for call-service effects)\n// ============================================================================\n\n/**\n * Configuration extracted from call-service effects\n */\nexport type CallServiceConfig = {\n service: string;\n action: string;\n endpoint?: string;\n method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n params?: ServiceParams;\n onSuccess?: string;\n onError?: string;\n};\n\n// ============================================================================\n// Typed Effect Tuples\n// ============================================================================\n\n/**\n * A binding reference to a render tree stored elsewhere — a trait `config`\n * knob or a payload field — e.g. `\"@config.bodyContent\"`. Resolved to a pattern\n * node at render time. This is how an atom renders a tree that contains data\n * bindings (`entity: \"@payload.data\"`, `fields: \"@config.fields\"`): the tree is\n * a permissive `TraitConfigValue` stored in `config` (a binding string is not a\n * valid `AnyPatternConfig` prop value), and the render-ui effect points at it.\n * Worked example: `std-browse`'s loaded transition is `['render-ui', 'main',\n * '@config.bodyContent']`. The Rust validator accepts this form; this variant\n * lets the TS effect type express it.\n */\nexport type RenderBinding = `@${string}`;\n\n/**\n * A binding reference resolving to a {@link UISlot} at inline time — a trait\n * `config` knob holding the slot name, e.g. `\"@config.reviewSlot\"`. Mirrors\n * {@link RenderBinding} for the SLOT position: the compiler's inline phase\n * substitutes the config value before anything renders, and the Rust\n * validator accepts the pre-substitution form (worked example:\n * `std-approval-gate`'s review queue renders into `@config.reviewSlot`).\n * This variant lets the TS effect type express the template-layer form.\n */\nexport type SlotBinding = `@config.${string}`;\n\n/**\n * Template-layer pattern node: a render tree whose discriminant and/or props\n * are still bindings (`type: '@config.viewPattern'`, `title: '@config.title'`)\n * or loose nested descriptors the compiler's inline phase resolves. The\n * resolved layer is {@link AnyPatternConfig}; this variant lets generated\n * behavior descriptors (std-ts) carry the pre-substitution form the Rust\n * validator accepts (worked example: `std-graphs` renders\n * `{ type: '@config.viewPattern', chartType: '@config.chartType', … }`).\n */\nexport type TemplatePatternConfig = { type: PatternType | RenderBinding } & Record<string, JsonValue>;\n\n/**\n * Render UI effect - displays a pattern in a UI slot.\n * @example ['render-ui', 'main', { patternType: 'table-view', columns: [{ key: 'name', header: 'Name' }] }]\n * @example ['render-ui', 'main', '@config.bodyContent'] // a {@link RenderBinding} target\n * @example ['render-ui', '@config.reviewSlot', { patternType: 'table-view' }] // a {@link SlotBinding} slot\n */\nexport type RenderUIEffect =\n | ['render-ui', UISlot | SlotBinding, AnyPatternConfig]\n | ['render-ui', UISlot | SlotBinding, TemplatePatternConfig]\n | ['render-ui', UISlot | SlotBinding, RenderBinding]\n | ['render-ui', UISlot | SlotBinding, null];\n\n/**\n * Lambda expression for per-item rendering in data-grid/data-list.\n * The compiler generates: {(paramName: Record<string, unknown>) => (<>JSX</>)}\n * where @{paramName}.field bindings reference the current iteration item.\n *\n * @example [\"fn\", \"item\", { \"type\": \"stack\", \"children\": [{ \"type\": \"typography\", \"content\": \"@item.title\" }] }]\n */\nexport type RenderItemLambda = ['fn', string, AnyPatternConfig];\n\n/**\n * Dynamic-collection children entry: renders one child per item of a collection\n * expression, authored inline in a `children:` position and kept verbatim as IR\n * (no new node kind). The collection expression is an {@link SExpr} evaluated at\n * render time; the {@link RenderItemLambda} body is instantiated per item with\n * the lambda param bound as an `@item`-scope binding. Both execution paths lower\n * onto the one lambda + `@item` + splice machinery.\n *\n * @example [\"array/map\", \"@entity.tasks\", [\"fn\", \"item\", { \"type\": \"typography\", \"content\": \"@item.title\" }]]\n */\nexport type RenderChildrenMap = ['array/map', SExpr, RenderItemLambda];\n\n/**\n * Trailing options object on navigate effects. `crumb` labels the navigation\n * stack entry the client pushes for the target page (e.g. the record title a\n * list router has in `?row` at push time); without it the entry falls back to\n * the target page's declared/derived label.\n */\nexport type NavigateOptions = { crumb?: string | SExpr };\n\n/**\n * Navigate effect - navigates to an internal page path or an external URL.\n * @example ['navigate', '/tasks'] or ['navigate', '/tasks/:id', { id: '123' }]\n * @example ['navigate', 'https://example.com']\n * @example ['navigate', '/contracts/42', { id: '42' }, { crumb: '@payload.row.title' }]\n */\nexport type NavigateEffect =\n | ['navigate', string | SExpr]\n | ['navigate', string | SExpr, Record<string, string | SExpr>]\n | ['navigate', string | SExpr, Record<string, string | SExpr>, NavigateOptions];\n\n/**\n * Navigate-back effect - pops the current entry off the orbital-scoped\n * navigation stack and navigates to the previous one. The stack is\n * client-session state (cold loads are seeded from declared page-path\n * prefixes), so an ancestor always exists on nested paths; the validator\n * rejects `navigate-back` reachable only from pages with no path ancestor.\n * @example ['navigate-back']\n */\nexport type NavigateBackEffect = ['navigate-back'];\n\n/**\n * Emit effect - emits an event, optionally with payload.\n * @example ['emit', 'SAVE'] or ['emit', 'PLAYER_DIED', { playerId: '@entity.id' }]\n * @example ['emit', 'FILTER_CHANGED', '@entity.filters']\n */\nexport type EmitEffect = ['emit', string] | ['emit', string, EventPayload | string];\n\n/**\n * `emit:` config block attached to async / reactive data operators.\n *\n * Each key names an event the runtime should fire on the bus when the\n * effect reaches the corresponding lifecycle point. The set of keys an\n * operator actually supports is enforced by the compiler validator:\n *\n * | Operator | Supported keys |\n * |------------------|---------------------------|\n * | `fetch` | `success`, `failure` |\n * | `persist` | `success`, `failure` |\n * | `call-service` | `success`, `failure`, `cancelled` |\n * | `set` | `success` |\n * | `fetch-stream` | `on_message`, `success`, `failure` |\n *\n * Payload convention:\n * - `success` → the effect's result (fetched entity, new value)\n * - `failure` → `{ error: string, code?: string }`\n * - `on_message` → the incoming chunk (`fetch-stream`)\n *\n * See `docs/Almadar_Std_Gaps.md` §3.1 for the close-the-circuit design.\n */\nexport interface EmitConfig {\n /** Fires after a one-shot async effect resolves successfully. */\n success?: string;\n /** Fires when the effect throws; payload is `{ error: string }`. */\n failure?: string;\n /** `call-service` only: fires when `cancel-call` aborts the call; payload is `{ key }`. */\n cancelled?: string;\n /** Per-chunk fire for `fetch-stream`. */\n on_message?: string;\n}\n\n/**\n * Set effect - sets a binding to a value.\n *\n * Two forms are supported to match the runtime's `set` handler signature\n * `(targetId, field, value)`:\n *\n * - 3-element binding form (legacy / std behaviors): ['set', '@entity.field', value]\n * - 4-element target form (canonical runtime): ['set', entityId, fieldName, value]\n *\n * The 4-element form is what `OrbitalServerRuntime`'s set handler\n * dispatches directly (`update(entityType, targetId, { field: value })`).\n * Prefer the 4-element form when authoring schemas in TypeScript that\n * load directly into the runtime.\n *\n * @example ['set', '@entity.health', 100] // 3-element\n * @example ['set', '@entity.id', 'health', 100] // 4-element\n * @example ['set', '@entity.id', 'count', ['+', '@entity.count', 1]]\n */\nexport type SetEffect =\n | ['set', string, SExpr]\n | ['set', string, string, SExpr];\n\n/**\n * Trailing config object on persist effects. When present, it carries the\n * `emit` map specifying which events to fire on persist success/failure.\n * Mirrors what the runtime's `EffectExecutor` reads at the 5th tuple\n * position. See `(persist create Entity @payload.data { emit: { success:\n * \"Saved\", failure: \"SaveFailed\" } })` in `.lolo` source.\n */\nexport type PersistEmitConfig = {\n emit?: { success?: string; failure?: string };\n};\n\n/**\n * Persist effect data argument: an entity row literal (field map), a\n * binding string referencing a row in scope (e.g. `@payload.data`,\n * `@entity`), or an expression form that evaluates to a row (e.g.\n * `[\"object/merge\", \"@payload.data\", { sender: \"@user.id\" }]`). At\n * runtime, binding strings and expressions resolve to `EntityRow` values\n * before the persist op runs — both paths evaluate the expression first.\n */\nexport type PersistRowInput = { id?: string | SExpr } & Record<string, FieldValue | SExpr | undefined>;\n\nexport type PersistData = EntityRow | PersistRowInput | string | SExpr[];\n\n/**\n * One EVALUATED operation of the runtime path's `[\"persist\", \"batch\", [...ops]]`\n * form, as `EffectExecutor` hands it to `handlers.persist('batch', '', { operations })`\n * and both server persist handlers execute it. The row is optional on\n * create/update (an absent row persists `{}`), exactly as the handlers always\n * tolerated. The compiled path has no batch persist — ledger §169.\n */\nexport type PersistBatchOperation =\n | ['create', string, EntityRow?]\n | ['update', string, string, EntityRow?]\n | ['delete', string, string];\n\nfunction isRowObject(value: RuntimeValue): value is EntityRow {\n return typeof value === 'object' && value !== null && !Array.isArray(value) && !(value instanceof Date);\n}\n\n/** The ONE structural check for a batch operation — every consumer narrows through it. */\nexport function isPersistBatchOperation(value: RuntimeValue): value is PersistBatchOperation {\n if (!Array.isArray(value) || typeof value[1] !== 'string') return false;\n switch (value[0]) {\n case 'create':\n return value.length === 2 || (value.length === 3 && isRowObject(value[2]));\n case 'update':\n return typeof value[2] === 'string' && (value.length === 3 || (value.length === 4 && isRowObject(value[3])));\n case 'delete':\n return value.length === 3 && typeof value[2] === 'string';\n default:\n return false;\n }\n}\n\n/**\n * Persist effect - creates, updates, deletes, or clears entities.\n *\n * Each operation accepts an optional trailing `PersistEmitConfig` so the\n * runtime can fire success / failure events when the operation completes.\n *\n * @example ['persist', 'create', 'Task', { title: '@payload.title' }]\n * @example ['persist', 'update', '@entity.entityType', '@payload.data']\n * @example ['persist', 'create', 'Task', '@payload.data', { emit: { success: 'TaskCreated' } }]\n */\nexport type PersistEffect =\n | ['persist', 'create', string, PersistData]\n | ['persist', 'create', string, PersistData, PersistEmitConfig]\n | ['persist', 'upsert', string, PersistData]\n | ['persist', 'upsert', string, PersistData, PersistEmitConfig]\n | ['persist', 'update', string, PersistData]\n | ['persist', 'update', string, PersistData, PersistEmitConfig]\n | ['persist', 'delete', string]\n | ['persist', 'delete', string, PersistData]\n | ['persist', 'delete', string, PersistData, PersistEmitConfig]\n | ['persist', 'clear', string]\n | ['persist', 'clear', string, PersistData]\n | ['persist', 'clear', string, PersistData, PersistEmitConfig]\n | ['persist', 'batch', SExpr]\n | ['persist', 'batch', SExpr, PersistEmitConfig];\n\n/**\n * Call service effect - invokes an external service.\n *\n * Two shapes are accepted:\n *\n * 1. Flat form (what the runtime reads and every .orb file uses):\n * `['call-service', serviceName, action, params?]` — args[0]=service,\n * args[1]=action, args[2]=params. This is the canonical form; the\n * runtime's EffectExecutor decodes exactly these positions.\n *\n * 2. Legacy config-object form (kept for the `callService()` helper):\n * `['call-service', serviceName, CallServiceConfig]` — retained so\n * older call sites using the builder helper continue to typecheck.\n *\n * @example ['call-service', 'my-service', 'run', { target: '@entity.target', event: 'order.placed' }]\n * @example ['call-service', 'my-service', 'run', { target: '...', event: '...' }, { emit: { success: 'OK', failure: 'ERR' } }]\n * @example ['call-service', 'WeatherAPI', { service: 'weather', action: 'get', onSuccess: 'OK' }]\n */\n/** Trailing config on `call-service`: outcome events, plus `onMessage` for\n * the live messages a running call delivers to the requesting client. */\nexport type CallServiceEmitConfig = {\n /** Expression evaluated at call time to a string; names the call for `cancel-call`. */\n key?: SExpr;\n emit?: { success?: string; failure?: string; cancelled?: string; onMessage?: string };\n};\n\n/**\n * Cancel-call effect - aborts the in-flight keyed call (`call-service`,\n * `browser/prompt` or `browser/embed`) started with that key in the same running\n * app; no-op when none is in flight. The cancelled call emits its `emit.cancelled`\n * event with `{ key }`, never success/failure, and a reply that arrives later is dropped.\n * @example ['cancel-call', '@entity.id']\n */\nexport type CancelCallEffect = ['cancel-call', SExpr];\n\n/** Trailing config of `random-bytes`, `credential-status`, `credential-forget` and `credential-connect`: outcome events only. */\nexport type HostCallEmitConfig = {\n emit?: { success?: string; failure?: string };\n};\n\n/** The OAuth client an `oauth-authorize` names: tag, mode, issuer XOR endpoints, secret-knob client credentials, clientAuth. */\nexport type OAuthClient = { [field: string]: SExpr };\n\n/** Authorization request of `oauth-authorize`. */\nexport interface OAuthAuthorizeRequest {\n redirectUri: SExpr;\n scope?: SExpr;\n subject?: SExpr;\n params?: SExpr;\n}\n\n/**\n * OAuth-authorize effect - starts an authorization for a client; success carries `{ authUrl, state, code }`. Server-only.\n * @example ['oauth-authorize', { tag: 'google', mode: 'real' }, { redirectUri: 'https://app.example.com/cb', scope: ['openid'] }, { emit: { success: 'AUTH_URL' } }]\n */\nexport type OAuthAuthorizeEffect =\n | ['oauth-authorize', OAuthClient, OAuthAuthorizeRequest]\n | ['oauth-authorize', OAuthClient, OAuthAuthorizeRequest, HostCallEmitConfig & { key?: SExpr }];\n\n/**\n * OAuth-connection-status effect - the signed-in viewer's connection to a provider (google, github or auth0).\n * @example ['oauth-connection-status', 'google', { emit: { success: 'CONNECTION' } }]\n */\nexport type OAuthConnectionStatusEffect =\n | ['oauth-connection-status', SExpr]\n | ['oauth-connection-status', SExpr, HostCallEmitConfig];\n\n/**\n * OAuth-connection-forget effect - drops the signed-in viewer's connection to a provider.\n * @example ['oauth-connection-forget', 'google', { emit: { success: 'DISCONNECTED' } }]\n */\nexport type OAuthConnectionForgetEffect =\n | ['oauth-connection-forget', SExpr]\n | ['oauth-connection-forget', SExpr, HostCallEmitConfig];\n\n/**\n * Random-bytes effect - `n` bytes (an integer from 1 to 1024) of the host CSPRNG, journaled on the kernel path.\n * Success carries {@link RandomBytesPayload}; failure carries `{ error }`. Server-only.\n * @example ['random-bytes', 32, { emit: { success: 'STATE_DRAWN' } }]\n */\nexport type RandomBytesEffect =\n | ['random-bytes', SExpr]\n | ['random-bytes', SExpr, HostCallEmitConfig & { key?: SExpr }];\n\n/** Success payload of `random-bytes`: the bytes as base64url without padding; a keyed call adds its `key`. */\nexport interface RandomBytesPayload {\n value: string;\n key?: string;\n}\n\n/**\n * Credential-status effect - a bare secret knob checks the signed-in viewer's credential. An explicit\n * `{ credential: knob, scope: 'app' | 'user' }` selects a scope; app checks need no viewer and empty is absent.\n * Success carries {@link CredentialPayload}; user checks fail when nobody is signed in. Server-only.\n * @example ['credential-status', '@config.googleToken', { emit: { success: 'STATUS_KNOWN' } }]\n */\nexport type CredentialStatusEffect =\n | ['credential-status', SExpr]\n | ['credential-status', SExpr, HostCallEmitConfig];\n\n/**\n * Credential-forget effect - drops the signed-in viewer's credential a `secret` knob names; success carries\n * `{ connected: false }`. Server-only.\n * @example ['credential-forget', '@config.googleToken', { emit: { success: 'DISCONNECTED' } }]\n */\nexport type CredentialForgetEffect =\n | ['credential-forget', SExpr]\n | ['credential-forget', SExpr, HostCallEmitConfig];\n\n/** Why a `credential-connect` did not connect. */\nexport type CredentialConnectFailureKind =\n | 'unavailable' | 'unsigned' | 'denied' | 'invalid_grant' | 'invalid_client' | 'transport' | 'malformed' | 'refused';\n\n/** The request of `credential-connect`: `credential`, `clientId` and `clientSecret` are secret knobs; `code` and `verifier` are the single-use values the host's credential store exchanges. */\nexport interface CredentialConnectRequest {\n credential: SExpr;\n scope?: SExpr;\n tokenEndpoint: SExpr;\n grant: SExpr;\n code: SExpr;\n redirectUri: SExpr;\n verifier?: SExpr;\n clientId: SExpr;\n clientSecret?: SExpr;\n clientAuth: SExpr;\n scopes?: SExpr;\n}\n\n/**\n * Credential-connect effect - asks the host's credential store to exchange an OAuth code at a declared token endpoint and\n * keep the result under the named secret knob; the program never holds a token. Success carries {@link CredentialPayload};\n * failure carries {@link CredentialConnectFailure}. Server-only.\n * @example ['credential-connect', { credential: '@config.googleToken', tokenEndpoint: 'https://oauth2.googleapis.com/token', grant: 'authorization_code', code: '@payload.code', redirectUri: 'https://app.example.com/cb', clientId: '@config.googleClientId', clientAuth: 'body' }, { emit: { success: 'CONNECTED' } }]\n */\nexport type CredentialConnectEffect =\n | ['credential-connect', CredentialConnectRequest]\n | ['credential-connect', CredentialConnectRequest, HostCallEmitConfig];\n\n/** Failure payload of `credential-connect`. */\nexport interface CredentialConnectFailure {\n error: string;\n kind: CredentialConnectFailureKind;\n}\n\n/** Success payload of `credential-status` and `credential-forget`. */\nexport interface CredentialPayload {\n connected: boolean;\n /** The non-secret account label stored beside the credential (the email it was signed in as); empty text when it has none. Never the value. */\n label: string;\n}\n\n/**\n * Access-check effect - the kernel's verdict on an entity's declared access policy for `viewer` (`null` for nobody) on\n * `row`, through the evaluator fetch and persist enforce. Success carries {@link AccessCheckPayload}; an undeclared entity,\n * an unknown action or a missing key fails with `{ error }`. Server-only.\n * @example ['access-check', { entity: 'Task', action: 'create', row: { ownerId: 'u1' }, identity: { id: 'u1' } }, { emit: { success: 'CHECKED' } }]\n */\nexport type AccessCheckEffect =\n | ['access-check', AccessCheckRequest]\n | ['access-check', AccessCheckRequest, HostCallEmitConfig];\n\n/** The request of `access-check`. */\nexport interface AccessCheckRequest {\n entity: SExpr;\n action: SExpr;\n row: SExpr;\n identity: SExpr;\n}\n\n/** Success payload of `access-check`. */\nexport interface AccessCheckPayload {\n allowed: boolean;\n}\n\n/** The credential administration operators: the kernel owns the role gate, the declared-name check and the masking. */\nexport type CredentialAdminOperator =\n | 'credential-list'\n | 'credential-set'\n | 'credential-remove'\n | 'credential-test'\n | 'credential-mode'\n | 'credential-rotate';\n\n/**\n * Credential administration effect - `(credential-<verb> request { emit })`. `credential-list` is open; `set`,\n * `remove`, `test`, `mode` and `rotate` need the caller's `@user.role` among `ALMADAR_CREDENTIAL_ADMIN_ROLES` (default\n * admin, owner). Failures carry\n * {@link CredentialAdminFailure}. Server-only.\n * @example ['credential-set', { service: 'KeysOrbital', envVar: 'ALMADAR_API_KEY_SALT', value: '@payload.value' }, { emit: { success: 'SAVED' } }]\n */\nexport type CredentialAdminEffect =\n | [CredentialAdminOperator, SExpr]\n | [CredentialAdminOperator, SExpr, HostCallEmitConfig];\n\n/** One credential in the masked inventory: where it resolves from and its last four characters, never its value. */\nexport interface CredentialListEntry {\n id: string;\n service: string;\n envVar: string;\n required: boolean;\n description: string;\n configured: boolean;\n source: 'store' | 'env' | 'none';\n last4: string;\n}\n\n/** One service's row of the inventory. */\nexport interface CredentialServiceStatus {\n id: string;\n service: string;\n configured: boolean;\n mocked: boolean;\n status: 'real' | 'emulated' | 'mocked' | 'not configured';\n backend: string;\n needs: string;\n}\n\n/** Success payload of `credential-list`. */\nexport interface CredentialListPayload {\n enabled: boolean;\n mode: 'mock' | 'real';\n services: CredentialServiceStatus[];\n entries: CredentialListEntry[];\n}\n\n/** Success payload of `credential-set`. */\nexport interface CredentialSetPayload {\n saved: true;\n service: string;\n envVar: string;\n last4: string;\n}\n\n/** Success payload of `credential-remove`. */\nexport interface CredentialRemovePayload {\n removed: boolean;\n}\n\n/** Success payload of `credential-test`: presence only, never a live probe. */\nexport interface CredentialTestPayload {\n service: string;\n configured: boolean;\n missing: string[];\n probed: false;\n ok: boolean;\n message: string;\n}\n\n/** Success payload of `credential-mode`. */\nexport interface CredentialModePayload {\n mode: 'mock' | 'real';\n}\n\n/** Success payload of `credential-rotate`. */\nexport interface CredentialRotatePayload {\n rotated: number;\n alreadyCurrent: number;\n unreadable: number;\n}\n\n/** Failure payload of every credential administration effect: `AUTH_ERROR` for a refused role, `VALIDATION_ERROR` for a bad request. */\nexport interface CredentialAdminFailure {\n error: string;\n code: 'AUTH_ERROR' | 'VALIDATION_ERROR' | null;\n}\n\nexport type CallServiceEffect =\n | ['call-service', string, string]\n | ['call-service', string, string, ServiceParams]\n | ['call-service', string, string, ServiceParams, CallServiceEmitConfig]\n | ['call-service', string, CallServiceConfig];\n\n/** A page fact `browser/page-facts` can read; the list order is the read order. */\nexport type PageFactField = 'hostname' | 'referrer' | 'screenWidth' | 'href';\n\n/** Success payload of `browser/page-facts`: a fact that was not requested carries its default. */\nexport interface BrowserPageFacts {\n /** False when there is no page (no window or document). */\n available: boolean;\n hostname: string;\n referrer: string;\n screenWidth: number | null;\n /** The full URL of the current location; empty when it was not requested or there is no page. */\n href: string;\n}\n\n/**\n * Page-facts effect - read the requested page facts (client-only).\n * @example ['browser/page-facts', ['referrer', 'screenWidth'], { emit: { success: 'FACTS', failure: 'FACTS_FAILED' } }]\n */\nexport type BrowserPageFactsEffect =\n | ['browser/page-facts', PageFactField[]]\n | ['browser/page-facts', PageFactField[], CallServiceEmitConfig];\n\n/** The on-device model's surface; the host (a browser, the chrome-extension shell) supplies it. */\nexport interface OnDeviceModelPort {\n availability(): Promise<'available' | 'downloadable' | 'downloading' | 'unavailable'>;\n /** Run one prompt whose reply must satisfy the JSON schema; returns the raw reply text. An aborted `signal` stops it. */\n prompt(text: string, schema: object, signal?: AbortSignal): Promise<string>;\n}\n\n/** The on-device text embedder: one vector per text, in input order. An aborted `signal` stops it. */\nexport interface OnDeviceEmbedderPort {\n embed(texts: string[], signal?: AbortSignal): Promise<number[][]>;\n}\n\n/** The on-device model and embedder a host wires in; each is absent when the host has none. */\nexport interface OnDeviceModelPorts {\n model?: OnDeviceModelPort;\n embedder?: OnDeviceEmbedderPort;\n}\n\n/**\n * Why an on-device call gave no answer: the host wires none (`unconfigured`), has one that cannot answer now\n * (`unavailable`), or it answered with an error (`failed`).\n */\nexport type OnDeviceFailureKind = 'unconfigured' | 'unavailable' | 'failed';\n\n/** Success payload of `browser/prompt`: the model's raw reply text and the call's key (null unkeyed). */\nexport interface BrowserPromptPayload {\n reply: string;\n key: string | null;\n}\n\n/** Success payload of `browser/embed`: one vector per text, in input order, and the call's key (null unkeyed). */\nexport interface BrowserEmbedPayload {\n embeddings: number[][];\n key: string | null;\n}\n\n/** Failure payload of `browser/prompt` and `browser/embed`. */\nexport interface OnDeviceFailurePayload {\n error: string;\n kind: OnDeviceFailureKind;\n key: string | null;\n}\n\n/**\n * Prompt effect - ask the host's on-device model for a reply satisfying the JSON Schema text (client-only,\n * keyed and cancellable by `cancel-call`).\n * @example ['browser/prompt', '@payload.text', '{\"type\":\"object\"}', { key: '@entity.batchId', emit: { success: 'REPLIED', failure: 'FAILED', cancelled: 'CANCELLED' } }]\n */\nexport type BrowserPromptEffect =\n | ['browser/prompt', string, string]\n | ['browser/prompt', string, string, CallServiceEmitConfig];\n\n/**\n * Embed effect - ask the host's on-device embedder for one vector per text (client-only, keyed and cancellable).\n * @example ['browser/embed', ['a', 'b'], { key: '@entity.batchId', emit: { success: 'EMBEDDED', failure: 'FAILED', cancelled: 'CANCELLED' } }]\n */\nexport type BrowserEmbedEffect =\n | ['browser/embed', string[]]\n | ['browser/embed', string[], CallServiceEmitConfig];\n\n/** Why a `browser/tab-*` call failed: refused before any ask, no tabs on the host, no page script, a vanished element, or another error. */\nexport type BrowserTabFailureKind = 'invalid' | 'unavailable' | 'not-ready' | 'not-found' | 'failed';\n\n/** Failure payload of every `browser/tab-*` effect. */\nexport interface BrowserTabFailurePayload {\n error: string;\n kind: BrowserTabFailureKind;\n /** The call's evaluated `key`; null when unkeyed. */\n key: string | null;\n}\n\n/** One element a `browser/tab-query` read, with the fields its call declared. */\nexport interface BrowserTabElement {\n elementId: string;\n fields: Record<string, string>;\n}\n\n/** What a `browser/tab-capture` hands back: the tab, the image format and the image as standard base64. */\nexport interface BrowserTabCapture {\n tab: number;\n format: 'png' | 'jpeg';\n image: string;\n /** The call's evaluated `key`; null when unkeyed. */\n key: string | null;\n}\n\n/** One element a `browser/tab-apply-many` named, in the tab it was named in. */\nexport interface BrowserTabElementRef {\n tab: number;\n elementId: string;\n}\n\n/**\n * Tab effects - drive the browser's tabs (client-only, keyed and cancellable). The request is the op's closed\n * object; the kernel validates it and shapes the result.\n * @example ['browser/tab-query', { tab: '@entity.tab', selector: '.result', fields: { title: { selector: 'h2' } } }, { emit: { success: 'RESULTS_READ', failure: 'QUERY_FAILED' } }]\n */\nexport type BrowserTabEffect =\n | [BrowserTabOperator, SExpr]\n | [BrowserTabOperator, SExpr, CallServiceEmitConfig];\n\n/** The `browser/tab-*` operator names. */\nexport type BrowserTabOperator =\n | 'browser/tab-list'\n | 'browser/tab-open'\n | 'browser/tab-close'\n | 'browser/tab-navigate'\n | 'browser/tab-query'\n | 'browser/tab-watch'\n | 'browser/tab-unwatch'\n | 'browser/tab-apply'\n | 'browser/tab-apply-many'\n | 'browser/tab-act'\n | 'browser/tab-capture';\n\n/** Public AUTH code of an `oauth` failure. */\n/** Closed reason set of an `oauth` failure. */\n/**\n * Spawn effect - creates a new entity instance (games).\n * @example ['spawn', 'Bullet', { x: '@entity.x', y: '@entity.y' }]\n */\nexport type SpawnEffect = ['spawn', string] | ['spawn', string, EntityRow];\n\n/**\n * Despawn effect - removes an entity instance (games).\n * @example ['despawn', '@entity.id']\n */\nexport type DespawnEffect = ['despawn', string];\n\n/**\n * Do effect - executes multiple effects in sequence.\n * Uses SExpr to allow deeply nested conditionals.\n * @example ['do', ['set', '@entity.x', 0], ['set', '@entity.y', 0]]\n */\nexport type DoEffect = ['do', ...SExpr[]];\n\n/**\n * Options accepted by `fetch` effects. Mirrors what\n * `OrbitalServerRuntime`'s fetch handler reads at runtime: `id`, `filter`,\n * `limit`, `offset`, `include`, plus the trailing `emit:` map for\n * success/failure event names.\n */\nexport type 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. The template layer may carry a\n * binding (`'@config.pageSize'`) or a computed S-expression — the\n * compiler's inline phase resolves it to a number. */\n limit?: number | RenderBinding | SExpr[];\n /** Number of entities to skip — same template-layer forms as `limit`. */\n offset?: number | RenderBinding | SExpr[];\n /** `\"field\"` or `\"field:asc|desc\"`, applied after the filter and before offset/limit; missing values sort last. */\n orderBy?: string | RenderBinding | SExpr[];\n /** Relations to populate (entity field names). The template layer may\n * carry a binding (`'@config.include'`) — same as `limit`/`offset`, the\n * compiler's inline phase resolves it to the concrete list. */\n include?: string[] | RenderBinding;\n /** `rows` (absent) delivers the rows; `ids` delivers a `RowSetMarker`, only passed whole as a `render-ui` prop. */\n deliver?: 'rows' | 'ids';\n /** `exact` (absent) counts every match for `totalCount`; `none` skips the count. */\n total?: 'exact' | 'none';\n /** A non-empty string expression echoed as `key` in the success and failure payloads (EXEC-FETCH-3). */\n key?: string | RenderBinding;\n /** Lifecycle events to emit on resolve / reject */\n emit?: { success?: string; failure?: string };\n};\n\n/**\n * Fetch effect - retrieves entity data (server-side).\n * @example ['fetch', 'User'] or ['fetch', 'User', { id: '@payload.userId' }]\n */\nexport type FetchEffect = ['fetch', string] | ['fetch', string, FetchOptions];\n\n/** Options for `fetch-stream` — mirror of the compiler's `OirEffect::FetchStream`\n * (`orbital-core/src/ir/effects.rs`) and the runtime's `fetchStream` handler. */\nexport type FetchStreamOptions = {\n id?: string | SExpr;\n filter?: SExpr;\n /** `on_message` fires per chunk; `success` on completion. */\n emit?: { on_message?: string; success?: string; failure?: string };\n};\n\n/**\n * Fetch-stream effect - streams entity rows (server-side), one `on_message`\n * emit per chunk. The compiled path (`OirEffect::FetchStream`) and the\n * runtime (`EffectExecutor` `'fetch-stream'`) both execute it.\n * @example ['fetch-stream', 'Message', { filter: ['=', '@entity.roomId', '@payload.roomId'], emit: { on_message: 'CHUNK' } }]\n */\nexport type FetchStreamEffect = ['fetch-stream', string] | ['fetch-stream', string, FetchStreamOptions];\n\n/**\n * Result returned by a fetch handler.\n *\n * `rows` carries the entity (or entities) that survived `filter` AND\n * pagination (`offset`/`limit`). `total` is the count of rows that\n * matched the filter BEFORE pagination, so paginating consumers can\n * compute `totalPages = ceil(total / pageSize)` without a second\n * round-trip. Single-entity fetches by id return `total: 1` (or `0`\n * if not found, in which case the handler returns `null` instead).\n */\nexport interface FetchResult {\n rows: EntityRow | EntityRow[];\n total: number;\n}\n\n/**\n * If effect - conditional effect execution.\n * Uses SExpr to allow deeply nested conditionals.\n * @example ['if', ['>', '@entity.health', 0], ['emit', 'ALIVE'], ['emit', 'DEAD']]\n */\nexport type IfEffect = ['if', Expression, SExpr] | ['if', Expression, SExpr, SExpr];\n\n/**\n * When effect - conditional effect similar to if but without else.\n * Uses SExpr to allow deeply nested conditionals.\n * @example ['when', ['>', '@entity.health', 0], ['emit', 'ALIVE']]\n */\nexport type WhenEffect = ['when', Expression, SExpr];\n\n/**\n * Let effect - creates local bindings for effects.\n * Uses SExpr to allow deeply nested conditionals.\n * @example ['let', ['temp', ['get', '@payload.value']], ['set', '@entity.value', 'temp']]\n */\nexport type LetEffect = ['let', [string, SExpr][], ...SExpr[]];\n\n/**\n * Log effect - logs a message for debugging.\n * @example ['log', 'User created:', '@entity.name']\n */\nexport type LogEffect = ['log', ...SExpr[]];\n\n/**\n * Wait effect - delays execution.\n * @example ['wait', 1000] - wait 1 second\n */\nexport type WaitEffect = ['wait', number];\n\n// ============================================================================\n// Agent Effects (from agent/* operator namespace)\n// ============================================================================\n\n/**\n * Agent effect - invokes an agent/* operator.\n * Covers all 22 operators in the std-agent category.\n * @example ['agent/memorize', 'use data-grid for tables', 'preference']\n * @example ['agent/recall', 'user preferences']\n * @example ['agent/generate', 'Summarize this schema']\n */\nexport type AgentEffect = [`agent/${string}`, ...SExpr[]];\n\n/**\n * OS effect - invokes an os/* operator.\n *\n * The `os/` family declared in `@almadar/std` (`modules/os.ts`): one-shot operations and\n * streams that answer through a trailing `EmitConfig` block.\n *\n * @example ['os/read-file', '/etc/hosts', { emit: { success: 'FILE_READ', failure: 'READ_FAILED' } }]\n */\nexport type OsEffect = [`os/${string}`, ...SExpr[]];\n\n/**\n * Browser effect - invokes a browser/* device operator (client host path).\n * User-initiated, async, resolves via the standard trailing emit envelope.\n * Concrete operators (browser/open-file-picker, browser/clipboard-read,\n * browser/clipboard-write, browser/geolocation-current) and their arity /\n * payload shapes live in @almadar/std BROWSER_OPERATORS.\n * @example ['browser/open-file-picker', { multiple: false }, { emit: { success: 'FILES_PICKED', failure: 'PICK_CANCELLED' } }]\n */\nexport type BrowserEffect = [`browser/${string}`, ...SExpr[]];\n\n/**\n * LLM effect - invokes an llm/* operator (agent path).\n * @example ['llm/generate', '@entity.request', { emit: { success: 'PLANNED', failure: 'PLAN_FAILED' } }]\n */\nexport type LlmEffect = [`llm/${string}`, ...SExpr[]];\n\n/**\n * Behavior reflection effects: list installed behaviors by registry folder,\n * describe a trait value, read a behavior's source. They read the host's\n * installed packages through `orb`, so they run on the server.\n * @example ['behavior/catalog', { paths: ['std/ui/core/molecules'] }, { emit: { success: 'LISTED', failure: 'LIST_FAILED' } }]\n */\nexport type BehaviorReflectionEffect = ['behavior/catalog' | 'behavior/describe' | 'behavior/source' | 'behavior/resolve' | 'behavior/dependencies' | 'behavior/packages', ...SExpr[]];\n\n/**\n * Kernel-owned memory asks (EXEC-METAL-1..4): arenas, blocks, borrows and the atomic cells of shared arenas. The\n * pure reads of the family (`mem/read`, `mem/read-uint`, `mem/read-int`, `mem/length`, `mem/layout`) are expressions, not effect heads.\n * @example ['mem/arena-new', 'bump', 4096, { emit: { success: 'ARENA_OK', failure: 'FAILED' } }]\n */\nexport type MemEffect = ['mem/arena-new' | 'mem/arena-drop' | 'mem/alloc' | 'mem/free' | 'mem/borrow' | 'mem/release' | 'mem/write' | 'mem/freeze' | 'mem/atomic-load' | 'mem/atomic-store' | 'mem/atomic-add' | 'mem/atomic-cas', ...SExpr[]];\n\n/**\n * Granted worklist reorders (EXEC-METAL-5), applied after the step's own emits; the rest of `kernel/` is expressions.\n * @example ['kernel/queue-front', 'TICK']\n */\nexport type KernelEffect = ['kernel/queue-front' | 'kernel/queue-back', ...SExpr[]];\n\n/**\n * A granted C call through the native host (EXEC-METAL-6).\n * @example ['ffi/call', '/usr/lib/libSystem.B.dylib', 'cos', [0.5], { emit: { success: 'COS_DONE', failure: 'FFI_FAILED' } }]\n */\nexport type FfiEffect = ['ffi/call', ...SExpr[]];\n\n/**\n * A granted GPU ask answered by the host's installed answerer (EXEC-GPU-1..7): device, resources, shaders, pipelines, a\n * submitted command list and readback, each handle a sealed value the kernel mints.\n * @example ['gpu/submit', '@entity.device', [{ compute: { pipeline: '@entity.pipeline', bindGroups: ['@entity.bindGroup'], dispatch: [64, 1, 1] } }], { emit: { success: 'DONE', failure: 'GPU_FAILED' } }]\n */\nexport type GpuEffect = ['gpu/device-open' | 'gpu/device-close' | 'gpu/buffer-create' | 'gpu/texture-create' | 'gpu/sampler-create' | 'gpu/query-create' | 'gpu/shader-create' | 'gpu/pipeline-create' | 'gpu/bind-group-create' | 'gpu/submit' | 'gpu/release', ...SExpr[]];\n\n/**\n * Program effects: read `.lolo` text into a quoted program, print one back,\n * evaluate one (validate, then instantiate). Run `orb` on the server.\n * @example ['program/eval', '@entity.program', { emit: { success: 'BUILT', failure: 'BUILD_FAILED' } }]\n */\nexport type ProgramEffect = ['program/read' | 'program/print' | 'program/eval' | 'program/validate' | 'program/prove' | 'program/os-grants' | 'program/compose' | 'program/step' | 'program/live' | 'program/self' | 'program/tick' | 'program/resolve-rows' | 'program/open' | 'program/navigate' | 'program/close', ...SExpr[]];\n\n/**\n * Agent-port effects, the three abilities an LLM tool loop is written with: `program/inputs` lists the\n * running program's declared external inputs, `program/dispatch` fires one AS THE CALLER through the ordinary\n * dispatch (guards, grants and policies apply), `persist/read-named` reads an entity named at run time through\n * its `@read` policy for the caller. Success carries `{ result }`, failure `{ error, errors? }`.\n * @example ['program/dispatch', '@payload.address', '@payload.arguments', { emit: { success: 'DISPATCHED', failure: 'DISPATCH_FAILED' } }]\n */\nexport type AgentPortEffect = ['program/inputs' | 'program/dispatch' | 'persist/read-named', ...SExpr[]];\n\n/**\n * Remaining agent-path operator effects: session/* (workspace session ops),\n * trace/* (trace emission), memory/* (agent memory), application/* (app\n * lifecycle). Expression-only namespaces (array/, math/, object/, str/, …)\n * are deliberately NOT effect heads.\n * @example ['session/write-spec', '@entity.spec']\n */\nexport type SessionEffect = [`session/${string}`, ...SExpr[]];\nexport type TraceEffect = [`trace/${string}`, ...SExpr[]];\nexport type MemoryEffect = [`memory/${string}`, ...SExpr[]];\nexport type KvEffect = [`kv/${string}`, ...SExpr[]];\nexport type ApplicationEffect = [`application/${string}`, ...SExpr[]];\nexport type AudioEffect = [`audio/${string}`, ...SExpr[]];\nexport type AuthEffect = [`auth/${string}`, ...SExpr[]];\nexport type IdentityEffect = [`identity/${string}`, ...SExpr[]];\nexport type ThemeEffect = [`theme/${string}`, ...SExpr[]];\n\n/** Effect operators the std registry declares that had no typed tuple (arity from the registry). */\nexport type NotifyEffect = ['notify', SExpr] | ['notify', SExpr, SExpr];\nexport type SendServerEffect = ['send-server', SExpr] | ['send-server', SExpr, SExpr];\nexport type ProbSeedEffect = ['prob/seed', SExpr];\nexport type ProbConditionEffect = ['prob/condition', SExpr];\nexport type WorkspaceWriteOrbitalEffect = ['workspace/write-orbital', SExpr, SExpr];\nexport type WorkspaceWriteFileEffect = ['workspace/write-file', SExpr, SExpr];\nexport type WorkspaceWriteSchemaEffect = ['workspace/write-schema', SExpr];\nexport type WorkspaceWritePlanEffect = ['workspace/write-plan', SExpr];\nexport type WorkspaceArchiveOrbitalEffect = ['workspace/archive-orbital', SExpr];\n\n/**\n * Union of all typed effects.\n * Provides compile-time validation for common effect types.\n */\nexport type TypedEffect =\n | RenderUIEffect\n | NavigateEffect\n | NavigateBackEffect\n | EmitEffect\n | SetEffect\n | PersistEffect\n | CallServiceEffect\n | CancelCallEffect\n | OAuthAuthorizeEffect\n | OAuthConnectionStatusEffect\n | OAuthConnectionForgetEffect\n | RandomBytesEffect\n | CredentialStatusEffect\n | CredentialForgetEffect\n | CredentialConnectEffect\n | CredentialAdminEffect\n | AccessCheckEffect\n | SpawnEffect\n | DespawnEffect\n | DoEffect\n | FetchEffect\n | FetchStreamEffect\n | IfEffect\n | WhenEffect\n | LetEffect\n | LogEffect\n | WaitEffect\n | AgentEffect\n | OsEffect\n | BrowserEffect\n | LlmEffect\n | BehaviorReflectionEffect\n | ProgramEffect\n | MemEffect\n | KernelEffect\n | FfiEffect\n | GpuEffect\n | AgentPortEffect\n | SessionEffect\n | TraceEffect\n | MemoryEffect\n | KvEffect\n | ApplicationEffect\n | AudioEffect\n | AuthEffect\n | IdentityEffect\n | ThemeEffect\n | NotifyEffect\n | SendServerEffect\n | ProbSeedEffect\n | ProbConditionEffect\n | WorkspaceWriteOrbitalEffect\n | WorkspaceWriteFileEffect\n | WorkspaceWriteSchemaEffect\n | WorkspaceWritePlanEffect\n | WorkspaceArchiveOrbitalEffect;\n\n// ============================================================================\n// Effect Type (Strictly Typed)\n// ============================================================================\n\n/**\n * Effect type - typed S-expression format.\n *\n * Effects are strongly typed tuples that enforce:\n * - Valid effect operators (render-ui, emit, set, persist, navigate, call-service)\n * - Valid UISlots for render-ui\n * - Valid PatternTypes and props for render-ui\n * - Correct argument types for each effect\n *\n * Available typed effects:\n * - RenderUIEffect: ['render-ui', UISlot, PatternConfig]\n * - NavigateEffect: ['navigate', path] or ['navigate', path, params]\n * - EmitEffect: ['emit', eventName] or ['emit', eventName, payload]\n * - SetEffect: ['set', binding, value]\n * - PersistEffect: ['persist', operation, entity, data?]\n * - CallServiceEffect: ['call-service', serviceName, config]\n *\n * @example\n * [\"set\", \"@entity.health\", 100]\n * [\"emit\", \"PLAYER_DIED\", { \"playerId\": \"@entity.id\" }]\n * [\"render-ui\", \"main\", { \"patternType\": \"table-view\", \"columns\": [{ \"key\": \"name\", \"header\": \"Name\" }] }]\n * [\"call-service\", \"WeatherAPI\", { \"action\": \"getWeather\", \"onSuccess\": \"OK\" }]\n * [\"navigate\", \"/tasks\"]\n * [\"persist\", \"create\", \"Task\", { \"title\": \"@payload.title\" }]\n */\nexport type Effect = TypedEffect;\n\n/** Every literal effect operator the {@link Effect} union declares, as runtime data. */\nexport const EFFECT_OPERATORS = [\n 'render-ui', 'navigate', 'navigate-back', 'emit', 'set', 'persist', 'call-service', 'cancel-call', 'oauth-authorize', 'oauth-connection-status', 'oauth-connection-forget', 'random-bytes', 'credential-status', 'credential-forget', 'credential-connect', 'credential-list', 'credential-set', 'credential-remove', 'credential-test', 'credential-mode', 'credential-rotate', 'access-check', 'spawn',\n 'despawn', 'do', 'fetch', 'fetch-stream', 'if', 'when', 'let', 'log', 'wait',\n 'notify', 'send-server',\n 'prob/seed', 'prob/condition', 'workspace/write-orbital', 'workspace/write-file',\n 'workspace/write-schema', 'workspace/write-plan', 'workspace/archive-orbital', 'behavior/catalog',\n 'behavior/describe', 'behavior/source', 'behavior/resolve', 'behavior/dependencies', 'behavior/packages', 'program/read', 'program/print', 'program/eval', 'program/validate', 'program/prove', 'program/os-grants', 'program/compose', 'program/step',\n 'program/inputs', 'program/dispatch', 'program/open', 'program/navigate', 'program/close', 'program/live', 'program/self', 'program/tick', 'program/resolve-rows', 'persist/read-named',\n 'mem/arena-new', 'mem/arena-drop', 'mem/alloc', 'mem/free', 'mem/borrow', 'mem/release', 'mem/write', 'mem/freeze',\n 'mem/atomic-load', 'mem/atomic-store', 'mem/atomic-add', 'mem/atomic-cas', 'kernel/queue-front', 'kernel/queue-back', 'ffi/call',\n 'gpu/device-open', 'gpu/device-close', 'gpu/buffer-create', 'gpu/texture-create', 'gpu/sampler-create', 'gpu/query-create', 'gpu/shader-create', 'gpu/pipeline-create', 'gpu/bind-group-create', 'gpu/submit', 'gpu/release',\n] as const;\n\n/** Namespaced effect families (`<family>/<name>`, e.g. `llm/generate`) the {@link Effect} union declares. */\nexport const EFFECT_OPERATOR_FAMILIES = [\n 'agent', 'os', 'browser', 'llm', 'session', 'trace', 'memory', 'kv',\n 'application', 'audio', 'auth', 'identity', 'theme',\n] as const;\n\nexport type EffectOperator = (typeof EFFECT_OPERATORS)[number];\nexport type EffectOperatorFamily = (typeof EFFECT_OPERATOR_FAMILIES)[number];\n\ntype EffectHead = Effect[0];\ntype FamilyOfHead<H> = H extends `${infer P}/${string}` ? (`${P}/\\u0000` extends H ? P : never) : never;\ntype LiteralOfHead<H> = H extends `${infer P}/${string}` ? (`${P}/\\u0000` extends H ? never : H) : H;\ntype AssertTrue<T extends true> = T;\n/** Fails to compile when the runtime lists and the {@link Effect} union drift apart, in either direction. */\nexport type EffectOperatorsInSync = AssertTrue<\n [Exclude<LiteralOfHead<EffectHead>, EffectOperator>, Exclude<EffectOperator, LiteralOfHead<EffectHead>>,\n Exclude<FamilyOfHead<EffectHead>, EffectOperatorFamily>, Exclude<EffectOperatorFamily, FamilyOfHead<EffectHead>>] extends [never, never, never, never]\n ? true : false\n>;\n\n/**\n * The effects a server reports an outcome for on\n * `EventResponse.effectResults` (`ServerEffectResult.effect`). Every\n * member is checked against the effect heads above at compile time, so a\n * name that is not an effect cannot be listed and a new server-reported\n * effect is added HERE only — the wire type, its zod twin and the\n * `events-wire` fixture case all derive from this array.\n */\nexport const SERVER_REPORTED_EFFECTS = [\n 'set',\n 'persist',\n 'call-service',\n 'fetch',\n 'fetch-stream',\n 'emit',\n] as const satisfies readonly Effect[0][];\n\nexport type ServerReportedEffect = (typeof SERVER_REPORTED_EFFECTS)[number];\n\n/** A namespaced effect head (`llm/generate`, `behavior/describe`, `program/read`) — what a\n * `substrate` result's `name` carries. Derived from the union, never listed. */\nexport type NamespacedEffectName = Extract<Effect[0], `${string}/${string}`>;\n\n/**\n * Schema for Effect - validates S-expression format. Arguments validate as\n * s-expr-shaped DATA (`SExprDataSchema`) — literal data arrays (empty or\n * non-operator-headed) are valid argument values; the operator-head refine\n * applies to the effect itself, not to every argument.\n */\nconst EffectShapeSchema = z.array(SExprDataSchema).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\n/** Validates the S-expression shape and yields the typed `Effect` (the claim `isEffect` makes). */\nexport const EffectSchema: z.ZodType<Effect> = z.custom<Effect>(\n (value) => EffectShapeSchema.safeParse(value).success,\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 * \n * Validates that a value conforms to the Effect structure. Effects are\n * represented as arrays where the first element is a string (effect type)\n * and subsequent elements are parameters. Used for runtime validation\n * of effect structures.\n * \n * @param {RuntimeValue} value - Value to check\n * @returns {boolean} True if value is a valid Effect, false otherwise\n *\n * @example\n * isEffect(['set', '@entity.health', 100]); // returns true\n * isEffect('not-an-effect'); // returns false\n * isEffect([]); // returns false\n */\nexport function isEffect(value: RuntimeValue): 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 * Creates a set effect for state updates.\n * \n * Generates an effect that sets a binding to a value. Used in state\n * machine transitions to update entity fields, UI state, or other\n * mutable data.\n * \n * @param {string} binding - Target binding (e.g., '@entity.health')\n * @param {SExpr} value - Value to set (can be literal or expression)\n * @returns {Effect} Set effect array\n * \n * @example\n * set('@entity.health', 100); // returns [\"set\", \"@entity.health\", 100]\n * set('@state.loading', false); // returns [\"set\", \"@state.loading\", false]\n */\nexport function set(binding: string, value: SExpr): Effect {\n return ['set', binding, value];\n}\n\n/**\n * Creates an emit effect for event dispatching.\n * \n * Generates an effect that emits an event with optional payload.\n * Used in state machine transitions to trigger events that can be\n * handled by other traits, services, or external systems.\n * \n * @param {string} event - Event name to emit\n * @param {EventPayload} [payload] - Optional event payload\n * @returns {Effect} Emit effect array\n * \n * @example\n * emit('PLAYER_DIED', { playerId: '@entity.id' }); // returns [\"emit\", \"PLAYER_DIED\", { playerId: \"@entity.id\" }]\n * emit('GAME_STARTED'); // returns [\"emit\", \"GAME_STARTED\"]\n */\nexport function emit(event: string, payload?: EventPayload): Effect {\n return payload ? ['emit', event, payload] : ['emit', event];\n}\n\n/**\n * Creates a navigation effect for page routing.\n * \n * Generates an effect that navigates to a specified path with optional\n * parameters. Used in state machine transitions to change pages or\n * update URL parameters.\n * \n * @param {string} path - Target path (e.g., '/tasks')\n * @param {Record<string, string>} [params] - Optional URL parameters\n * @returns {NavigateEffect} Navigation effect array\n * \n * @example\n * navigate('/tasks'); // returns [\"navigate\", \"/tasks\"]\n * navigate('/user', { id: '123' }); // returns [\"navigate\", \"/user\", { id: \"123\" }]\n */\nexport function navigate(path: string): NavigateEffect;\nexport function navigate(path: string, params: Record<string, string>): NavigateEffect;\nexport function navigate(path: string, params: Record<string, string>, options: NavigateOptions): NavigateEffect;\nexport function navigate(path: string, params?: Record<string, string>, options?: NavigateOptions): NavigateEffect {\n if (params && options) return ['navigate', path, params, options];\n return params ? ['navigate', path, params] : ['navigate', path];\n}\n\n/**\n * Creates a navigate-back effect: pop the orbital's navigation stack and\n * navigate to the previous entry.\n *\n * @example\n * navigateBack(); // returns [\"navigate-back\"]\n */\nexport function navigateBack(): NavigateBackEffect {\n return ['navigate-back'];\n}\n\n/**\n * Create a render-ui effect\n * @example [\"render-ui\", \"main\", { \"patternType\": \"table-view\", \"columns\": [{ \"key\": \"name\", \"header\": \"Name\" }] }]\n */\nexport function renderUI(target: UISlot, pattern: AnyPatternConfig): RenderUIEffect {\n return ['render-ui', target, pattern];\n}\n\n/**\n * Create a persist effect\n * @example [\"persist\", \"create\", \"Task\", { \"title\": \"@payload.title\" }]\n */\nexport function persist(\n action: 'create' | 'upsert' | 'update',\n entity: string,\n data: PersistData\n): PersistEffect;\nexport function persist(\n action: 'delete' | 'clear',\n entity: string,\n data?: PersistData\n): PersistEffect;\nexport function persist(\n action: 'create' | 'upsert' | 'update' | 'delete' | 'clear',\n entity: string,\n data?: PersistData\n): PersistEffect {\n if (action === 'create' || action === 'upsert' || action === 'update') {\n return ['persist', action, entity, data!] as PersistEffect;\n }\n return data\n ? ['persist', action, entity, data] as PersistEffect\n : ['persist', action, entity] as PersistEffect;\n}\n\n/**\n * Create a call-service effect\n * @example [\"call-service\", \"my-service\", { \"service\": \"my-service\", \"action\": \"run\", \"onSuccess\": \"OK\", \"onError\": \"ERR\" }]\n */\nexport function callService(\n serviceName: string,\n config: CallServiceConfig\n): CallServiceEffect {\n return ['call-service', serviceName, config];\n}\n\n/**\n * Create a spawn effect (games)\n * @example [\"spawn\", \"Bullet\", { \"x\": \"@entity.x\", \"y\": \"@entity.y\" }]\n */\nexport function spawn(entity: string): SpawnEffect;\nexport function spawn(entity: string, initialState: EntityRow): SpawnEffect;\nexport function spawn(entity: string, initialState?: EntityRow): SpawnEffect {\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): DespawnEffect {\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: SExpr[]): DoEffect {\n return ['do', ...effects];\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(entity: string): FetchEffect;\nexport function fetch(entity: string, options: FetchOptions): FetchEffect;\nexport function fetch(entity: string, options?: FetchOptions): FetchEffect {\n return options ? ['fetch', entity, options] : ['fetch', entity];\n}\n\n// ============================================================================\n// Runtime Pattern Types\n// ============================================================================\n\n/** Resolved pattern props for render-ui effects at runtime. Recursive for nested pattern configs. */\nexport type ResolvedPatternProps = {\n [prop: string]:\n | string\n | number\n | boolean\n | null\n | undefined\n | ResolvedPatternProps\n | RenderChildrenMap\n | Array<ResolvedPatternProps | RenderChildrenMap>;\n};\n\n/**\n * Zod twin of `PatternConfig`/`AnyPatternConfig` — validates the WIRE SHAPE\n * (a plain object, or `null` for an unset render-ui target) only. Per-pattern\n * prop shape (the hundreds of generated `PatternPropsMap` variants) is\n * enforced by the patterns registry at `orb validate` / lolo parse time, not\n * re-validated here — a second, drifting copy of that registry is exactly\n * the duplicate this schema must not become.\n */\nexport const PatternConfigSchema: z.ZodType<AnyPatternConfig | null> = z.custom<AnyPatternConfig | null>(\n (value) => value === null || (typeof value === 'object' && value !== null && !Array.isArray(value)),\n { message: 'Expected a pattern config object or null' },\n);\n\n/** A pattern config that must be present — the non-null twin of {@link PatternConfigSchema}. */\nexport const PatternObjectSchema: z.ZodType<AnyPatternConfig> = z.custom<AnyPatternConfig>(\n (value) => typeof value === 'object' && value !== null && !Array.isArray(value),\n { message: 'Expected a pattern config object' },\n);\n\n/** Zod twin of `ResolvedPatternProps` — validates the wire shape (a plain object) only, see {@link PatternConfigSchema}. */\nexport const ResolvedPatternPropsSchema: z.ZodType<ResolvedPatternProps> = z.custom<ResolvedPatternProps>(\n (value) => typeof value === 'object' && value !== null && !Array.isArray(value),\n { message: 'Expected a resolved pattern props object' },\n);\n\n/** A node in a render-ui effect tree. */\nexport interface RenderUINode {\n type: string;\n props?: ResolvedPatternProps;\n /** Static child nodes and/or dynamic-collection map entries. A\n * {@link RenderChildrenMap} entry expands at render time into resolved\n * `RenderUINode`s, so components always receive a flat, fully-resolved list. */\n children?: Array<RenderUINode | RenderChildrenMap>;\n content?: string;\n entity?: string;\n renderItem?: RenderUINode;\n}\n\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/json.ts"],"names":[],"mappings":";;;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K,CAAA,EAAG,OAAO,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,KAAuB,UAAA,CAAW,IAAI,CAAA,IAAK,IAAI,CAAA;AAC3F,EAAA,MAAM,MAAkB,EAAC;AACzB,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,IAAI,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/C,IAAA,MAAM,IAAA,GAAO,WAAW,IAAI,CAAA;AAC5B,IAAA,IAAI,IAAA,KAAS,MAAA,EAAW,GAAA,CAAI,GAAG,CAAA,GAAI,IAAA;AAAA,EACrC;AACA,EAAA,OAAO,GAAA;AACT;AAMO,SAAS,eAAe,KAAA,EAAqD;AAClF,EAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,EAAW,OAAO,IAAA;AAClD,EAAA,MAAM,IAAA,GAAO,WAAW,KAAK,CAAA;AAC7B,EAAA,IAAI,IAAA,KAAS,MAAA,EAAW,MAAM,IAAI,UAAU,6BAA6B,CAAA;AACzE,EAAA,OAAO,IAAA;AACT","file":"chunk-7GHJU5WI.js","sourcesContent":["/**\n * JSON primitives — the universal \"data crossed a boundary\" type.\n *\n * Every value that arrives over the wire from an LLM (tool-call args),\n * from disk (workspace files), or from an HTTP body before\n * domain-specific validation is a `JsonValue`. Narrow with a typed\n * predicate (`is`-guard) at the boundary; don't widen back to `unknown`.\n *\n * `JsonObject` and `ToolArgs` are aliases for the common\n * `Record<string, JsonValue>` shape. `ToolArgs` is the name the\n * agent surface uses for LLM-emitted tool-call arguments; `JsonObject`\n * is the general-purpose alias. They are the same type — the alias\n * exists so call sites read at the right semantic level.\n *\n * Why not `Record<string, unknown>`? Two reasons. (1) `unknown` widens\n * back to anything, which defeats the purpose of typing the boundary.\n * (2) The `@almadar/eslint-plugin/no-record-string-unknown` rule blocks\n * the wider form — `JsonValue`-based records are the typed answer.\n *\n * @packageDocumentation\n */\n\nimport { z } from 'zod';\nimport type { EventPayloadValue } from './expression.js';\n\n/**\n * Recursive JSON value union — every shape JSON can carry.\n */\nexport type JsonValue =\n | string\n | number\n | boolean\n | null\n | JsonValue[]\n | { [key: string]: JsonValue };\n\n/**\n * JSON object — keyed string→JsonValue. The wire form of arbitrary\n * structured data. Replaces `Record<string, unknown>` at typed\n * boundaries (LLM emits, file reads, HTTP bodies).\n */\nexport type JsonObject = { [key: string]: JsonValue };\n\n/** Zod schema for JsonValue — the one boundary validator for parsed-JSON slots. */\nexport const JsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n z.union([z.string(), z.number(), z.boolean(), z.null(), z.array(JsonValueSchema), z.record(z.string(), JsonValueSchema)]),\n);\n\n/**\n * LLM tool-call arguments — same shape as `JsonObject`, named for the\n * agent-surface call site. Each tool's `execute(args: ToolArgs)`\n * receives this and narrows via an `is`-guard predicate before any\n * field access.\n */\nexport type ToolArgs = JsonObject;\n\n/**\n * Universal type-guard input — every runtime value shape a predicate can\n * be handed, enumerated instead of `unknown` (the repo bans `unknown`\n * even at guard boundaries). Primitives cover every `typeof` result;\n * `object` covers arrays, records, class instances, and functions.\n */\nexport type RuntimeValue =\n | string\n | number\n | bigint\n | boolean\n | symbol\n | Date\n | null\n | undefined\n | object;\n\n/**\n * Type guard: is the given value a JSON primitive (non-array,\n * non-object)? Used by walkers that decide whether to recurse.\n */\nexport function isJsonPrimitive(\n value: JsonValue,\n): value is string | number | boolean | null {\n return (\n value === null\n || typeof value === 'string'\n || typeof value === 'number'\n || typeof value === 'boolean'\n );\n}\n\n/**\n * Type guard: is the given value a JSON object (non-array, non-null)?\n */\nexport function isJsonObject(value: JsonValue): value is JsonObject {\n return (\n value !== null\n && typeof value === 'object'\n && !Array.isArray(value)\n );\n}\n\n/**\n * Type guard: is the given value a JSON array?\n */\nexport function isJsonArray(value: JsonValue): value is JsonValue[] {\n return Array.isArray(value);\n}\n\n/** The JSON form of a runtime value, as `JSON.stringify` would write it; `undefined` when JSON drops the value (undefined, function, symbol). */\nfunction jsonFormOf(value: RuntimeValue): JsonValue | undefined {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return value;\n if (typeof value === 'number') return Number.isFinite(value) ? value : null;\n if (typeof value === 'bigint') throw new TypeError('A bigint has no JSON form');\n if (value === undefined || typeof value === 'function' || typeof value === 'symbol') return undefined;\n if (value instanceof Date) return value.toISOString();\n if (Array.isArray(value)) return value.map((item: RuntimeValue) => jsonFormOf(item) ?? null);\n const out: JsonObject = {};\n for (const [key, item] of Object.entries(value)) {\n const form = jsonFormOf(item);\n if (form !== undefined) out[key] = form;\n }\n return out;\n}\n\n/**\n * A rich value the UI hands back (a program schema, a selected node) as an event payload value:\n * its JSON form, which is what the event wire carries. `JsonValue` is a payload value.\n */\nexport function toPayloadValue(value: object | null | undefined): EventPayloadValue {\n if (value === null || value === undefined) return null;\n const form = jsonFormOf(value);\n if (form === undefined) throw new TypeError('A function has no JSON form');\n return form;\n}\n"]}
|